Hello, I am trying to prune channels of each layer in
Kaiming He's Resnet50 caffemodel. In order to do so, I load the caffemodel, copy the weights to a python dictionary and then remove half of the filter. From the
net graph you can see that the weights of the last conv layer have shape [2048,512,7,7] and the activation is fed to a pooling of blob size [1, 1024, 1,1].
Using the reshaped weights in the python dictionary, I try to transplant the weights by first loading the orginal caffemodel and renaming some layers in order to write the pruned weight s to the caffemodel
Everything seems to be working except for the connection betweem the last conv layer and the final fc. Naturally, when I delete filters from the last conv layers, I also remove the correspondent weights of the fc layer that follows. However whe I try to create a caffemoded I encounter the following error, even if all input and output dimension from the pruned layers match in the prototxt
WARNING: Logging before InitGoogleLogging() is written to STDERR
F1125 22:29:52.137406 32553 blob.hpp:122] Check failed: axis_index < num_axes() (1 vs. 1) axis 1 out of range for 1-D Blob with shape 10 (10)
*** Check failure stack trace: ***
Aborted (core dumped)
The shape 10 at the end of the error refers to the batch size, but I dont understand why there is any conflict if I only modified the number of channels. This problems is present when I prune models with several FC layers at the end, such as VGG.
Any suggestions on how to find the root of the problem?