New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Vgg16: Problems of Loading Pretrained Weights without fcs #34
Comments
Thank you for trying TensorNets, @LynnHo. Can you share a TensorNets version and your snippets to reproduce the error? The different input shape is not related to the weight shape mismatching. Maybe, I guess that you use different |
@taehoonlee I use a code like below,
and the error is, ValueError: Dimension 0 in both shapes must be equal, but are 32768 and 25088. Shapes are [32768,4096] and [25088,4096]. for 'Assign_26' (op: 'Assign') with input shapes: [32768,4096], [25088,4096]. If the shape is [None, 224, 224, 3], the code works. |
@LynnHo, I see. I misunderstood the problem. The VGG16 and the VGG19 accept only a size of 224x224 because the |
@taehoonlee But if I just want to load the pretrained weights of Convs ignoring the FCs‘, line 320 is unsuitable. I modified the code at line 320-324 to blow, it works for me
|
@LynnHo, Thank you for the idea. But the proposed one will load all the weights except the middle layer |
@taehoonlee You are right, the shape mismatch should be shown. Or an argument to control the ignoring of the shape mismatch would be better. Anyway, thanks a lot! |
@LynnHo, Yes I will considering the argument to control the shape mismatch. Thank you for the idea. |
@taehoonlee I tried to use sess.run(net.pretrained()) for vgg16, but it failed because of shape mismatch (I did not use the default input size). I read the source code and I am confused by line 320 in tensornets/utils.py,
is the code at line 321 designed for tackling the shape mismatch of fcs? If yes, I think it has a problem on vgg16 because it has three fc and this code seems to be only suitable for networks with 1 fc.
The text was updated successfully, but these errors were encountered: