Caffe shape mismatch error using pretrained VGG-16 model

前端 未结 2 389
青春惊慌失措
青春惊慌失措 2020-12-06 21:47

I am using PyCaffe to implement a neural network inspired by the VGG 16 layer network. I want to use the pre-trained model available from their GitHub page. Generally this w

相关标签:
2条回答
  • 2020-12-06 22:00

    The problem is not with 4096 but rather with 25088. You need to calculate the output feature maps for each layer of your network based on the input feature maps. Note that the fc layer takes an input of fixed size so the output of the previous conv layer must match the input size required by the fc layer. Calculate your fc6 input feature map size (this is the output feature map of the previous conv layer) using the input feature map size of the previous conv layer. Here's the formula:

    H_out = ( H_in + 2 x Padding_Height - Kernel_Height ) / Stride_Height + 1
    W_out = (W_in + 2 x Padding_Width - Kernel_Width) / Stride_Width + 1
    
    0 讨论(0)
  • 2020-12-06 22:13

    This error comes up if you're cropping the images to 224, rather than the 227 that was done with the original dataset. Adjust that and you should be good to go.

    0 讨论(0)
提交回复
热议问题