关于Caffe SqueezeNet Prototxt中全连接(FC)层位置的技术咨询
Hey there! Let's clear up this confusion about SqueezeNet and fully connected (FC) layers—you're not missing something obvious, it's just part of SqueezeNet's clever efficiency-focused design.
SqueezeNet was built to slash model parameter counts while retaining competitive accuracy, and one of its core tricks is replacing traditional FC layers with a combination of global average pooling and 1x1 convolutions. Here's how this plays out in your prototxt:
After the final squeeze-and-expand convolution/ReLU/pooling blocks, you’ll usually find a
poolinglayer configured for global average pooling. Look for settings like this:layer { name: "pool10" type: "Pooling" bottom: "conv10" top: "pool10" pooling_param { pool: AVE global_pooling: true } }This layer takes the output of the last convolution and averages each feature map down to a single value, flattening spatial dimensions without a dedicated FC layer.
Next, a 1x1
convlayer takes the pooled output and maps it to your target number of classes. This acts exactly like an FC layer in terms of outputting class logits, but uses convolution operations instead. For example:layer { name: "conv11" type: "Convolution" bottom: "pool10" top: "conv11" convolution_param { num_output: 1000 # Replace with your dataset's class count kernel_size: 1 stride: 1 pad: 0 } }Finally, this 1x1 convolution’s output feeds directly into your
SoftmaxWithLossandaccuracylayers. You won’t see a layer explicitly labeledInnerProduct(Caffe’s name for standard FC layers) in a vanilla SqueezeNet prototxt—because it’s not needed.
To wrap it up: SqueezeNet doesn’t use traditional FC layers at all. The global average pooling + 1x1 convolution combo serves the same purpose of mapping high-level features to class outputs, but with a tiny fraction of the parameters.
内容的提问来源于stack exchange,提问作者Nima

