what the meaning of this sentense   skip_connection_channel_counts.insert(0,cur_channels_count)?

username: highhig
cooked: <pre><code class="lang-auto">class FCDenseNet(nn.Module):
    def __init__(self, in_channels=3, down_blocks=(5,5,5,5,5), #其中down_blocks是指下采样的denseblock（即论文中的db块+C+TD）,这里一共有5个denseblock块且每个denseblock块中默认有5个卷积层。
                 up_blocks=(5,5,5,5,5), bottleneck_layers=5,  # up_blocks代表上采样的denseblock，同理共有五个denseblock块，并且每个参数默认为5代表每个块有5个卷积层
                 growth_rate=16, out_chans_first_conv=48, n_classes=12): #增长率为16，代表每层提取的特征数16的比率增加；
        super().__init__()
        self.down_blocks = down_blocks
        self.up_blocks = up_blocks
        cur_channels_count = 0
        skip_connection_channel_counts = []

        ## First Convolution ##

        self.add_module('firstconv', nn.Conv2d(in_channels=in_channels, #刚开始为一个卷积层；
                  out_channels=out_chans_first_conv, kernel_size=3,
                  stride=1, padding=1, bias=True))
        cur_channels_count = out_chans_first_conv

        #####################
        # Downsampling path #
        #####################

        self.denseBlocksDown = nn.ModuleList([])
        self.transDownBlocks = nn.ModuleList([])
        for i in range(len(down_blocks)): #5个denseblock,每一个denseblock分别由论文中的db块+C+TD组成：即dense块、链接、下采样组成；
            self.denseBlocksDown.append(
                DenseBlock(cur_channels_count, growth_rate, down_blocks[i]))
            cur_channels_count += (growth_rate*down_blocks[i])
            skip_connection_channel_counts.insert(0,cur_channels_count)
            self.transDownBlocks.append(TransitionDown(cur_channels_count))

        #####################
        #     Bottleneck    #
        #####################

        self.add_module('bottleneck',Bottleneck(cur_channels_count,
                                     growth_rate, bottleneck_layers))
        prev_block_channels = growth_rate*bottleneck_layers
        cur_channels_count += prev_block_channels

        #######################
        #   Upsampling path   #
        #######################

        self.transUpBlocks = nn.ModuleList([])
        self.denseBlocksUp = nn.ModuleList([])
        for i in range(len(up_blocks)-1):
            self.transUpBlocks.append(TransitionUp(prev_block_channels, prev_block_channels))
            cur_channels_count = prev_block_channels + skip_connection_channel_counts[i]

            self.denseBlocksUp.append(DenseBlock(
                cur_channels_count, growth_rate, up_blocks[i],
                    upsample=True))
            prev_block_channels = growth_rate*up_blocks[i]
            cur_channels_count += prev_block_channels

        ## Final DenseBlock ##

        self.transUpBlocks.append(TransitionUp(
            prev_block_channels, prev_block_channels))
        cur_channels_count = prev_block_channels + skip_connection_channel_counts[-1]

        self.denseBlocksUp.append(DenseBlock(
            cur_channels_count, growth_rate, up_blocks[-1],
                upsample=False))
        cur_channels_count += growth_rate*up_blocks[-1]

        ## Softmax ##

        self.finalConv = nn.Conv2d(in_channels=cur_channels_count,
               out_channels=n_classes, kernel_size=1, stride=1,
                   padding=0, bias=True)
        self.softmax = nn.LogSoftmax(dim=1)

    def forward(self, x):
        out = self.firstconv(x)

        skip_connections = []
        for i in range(len(self.down_blocks)):
            out = self.denseBlocksDown[i](out)
            skip_connections.append(out)
            out = self.transDownBlocks[i](out)

        out = self.bottleneck(out)
        for i in range(len(self.up_blocks)):
            skip = skip_connections.pop()
            out = self.transUpBlocks[i](out, skip)
            out = self.denseBlocksUp[i](out)

        out = self.finalConv(out)
        out = self.softmax(out)
        return out
</code></pre>
<p>I want to ask what the meaning of this sentense   skip_connection_channel_counts.insert(0,cur_channels_count)???</p>

username: albanD
cooked: <p>It adds <code>cur_channels_count</code> to the python list <code>skip_connection_channel_counts</code> at position 0.</p>

username: highhig
cooked: <p>do you know how to exact the feature maps of images from this model? I mean we can extract the middle layer separately in the FCDenseNet network</p>

username: alpha_omega_alpha
cooked: <p>You would make a copy of the middle layer output and return that too.<br>
Example:</p>
<pre><code class="lang-auto">out = self.bottleneck(out)
middle_layer = out
</code></pre>
<p>then return <code>out</code> and <code>middle_layer</code>:</p>
<pre><code class="lang-auto">return out, middle_layer
</code></pre>