I am kind of stuck here, hopefully someone can throw some light on it.

To demonstrate my problem I will try and simplify my network architecture for sake of convenience. I have a pipeline:

Training: input: 1024 x 2 x 64 x 64 (batchsize x numchannels x h x w) training-net: conn1 -> pool1 -> conn2 -> pool2 - > conn3 -> pool3 -> fc1 -> softmaxloss

Can I convert the "fc1" layer into "fullyconvolutional? The straightforward answer is "yes" by changing "fc1" type from "innerproduct" to "convolution" and add "deconvolution" layer. So my FCN-net: conn1 -> pool1 -> conn2 -> pool2 - > conn3 -> pool3 -> fc1(convolution) -> deconvlution

Here lies my problem, I do not want to train again.

I have lots of labelled "patch" data (64 x 64), so I need the training to work on my "training-net". My test data is one 1024x1024, I would like to use the trained-model on a my test image using "FCN-net".

Will trained parameters of "fc1" map onto "fc1(convolution)"?
or there is no other way but to re-train the FCN-net?

Let me know if you feel I need to add more details in order to better explain my problem.

I appreciate your help.

Note: I am using vanilla-caffe. Thank you,


1 Answer 1


Certainly you don't have to train it again.

Say the after pool3 the size of a feature map is $m*n$, so for each unit in fc1 there should be $m*n*c$ parameters, where $c$ is the number of input feature maps.

To convert fc1 into a convolutional layer, we can just use $m*n$ convolutions, so that the total amount of parameters will be the same, only we need to remember the corresponding spatial positions.

Then if the fully convolutional network is applied on the original inputs, we'll have exactly the same results, because we do not change anything except for reshaping the parameters of fc1. And when applied on larger inputs, we'll get feature maps instead.

I'm not sure if there's such an option in caffe though.

relationship between fully connected layer and convolutional layer

  • $\begingroup$ according to the problem statement of user2979010. If the input is of 1024*1024, then the result after pool3 or just before fc1 will be a feature map with larger size than the one with input of 64*64. Is that right? Because we have replace fc1 with convolutional layer, the size of featuremap does not matter. Is that right? $\endgroup$
    – user3125
    Jul 14, 2016 at 2:42
  • $\begingroup$ @user3125 yep I think so. $\endgroup$
    – dontloo
    Jul 14, 2016 at 2:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.