szagoruyko / loadcaffe

Load Caffe networks in Torch7
BSD 2-Clause "Simplified" License
492 stars 165 forks source link

Loading alexnet causes: Message type "caffe.NetParameter" has no field named "require" #36

Open felixsmueller opened 8 years ago

felixsmueller commented 8 years ago

Hi Szagoruyko

sorry for bothering. I try to load Alexnet as follows: model = loadcaffe.load('./alexnet/deploy.prototxt.lua','./alexnet/bvlc_alexnet.caffemodel','cudnn') The model is from: https://github.com/BVLC/caffe/tree/master/models/bvlc_alexnet

The output using loadCaffe shows an libprotobuf ERROR: [libprotobuf ERROR google/protobuf/text_format.cc:245] Error parsing text-format caffe.NetParameter: 1:9: Message type "caffe.NetParameter" has no field named "require". Successfully loaded ./alexnet/bvlc_alexnet.caffemodel MODULE data UNDEFINED warning: module 'data [type 5]' not found conv1: 96 3 11 11 conv2: 256 48 5 5 conv3: 384 256 3 3 conv4: 384 192 3 3 conv5: 256 192 3 3 fc6: 1 1 9216 4096 fc7: 1 1 4096 4096 fc8: 1 1 4096 1000 nn.Sequential { input -> (1) -> (2) -> (3) -> (4) -> (5) -> (6) -> (7) -> (8) -> (9) -> (10) -> (11) -> (12) -> (13) -> (14) -> (15) -> (16) -> (17) -> (18) -> (19) -> (20) -> (21) -> (22) -> (23) -> (24) -> (25) -> (26) -> output: cudnn.SpatialConvolution(3 -> 96, 11x11, 4,4) (2): cudnn.ReLU (3): inn.SpatialCrossResponseNormalization (4): cudnn.SpatialMaxPooling(3,3,2,2) (5): cudnn.SpatialConvolution(96 -> 256, 5x5, 1,1, 2,2) (6): cudnn.ReLU (7): inn.SpatialCrossResponseNormalization (8): cudnn.SpatialMaxPooling(3,3,2,2) (9): cudnn.SpatialConvolution(256 -> 384, 3x3, 1,1, 1,1) (10): cudnn.ReLU (11): cudnn.SpatialConvolution(384 -> 384, 3x3, 1,1, 1,1) (12): cudnn.ReLU (13): cudnn.SpatialConvolution(384 -> 256, 3x3, 1,1, 1,1) (14): cudnn.ReLU (15): cudnn.SpatialMaxPooling(3,3,2,2) (16): nn.View (17): nn.Linear(9216 -> 4096) (18): cudnn.ReLU (19): nn.Dropout(0.500000) (20): nil (21): nil (22): nn.Dropout(0.500000) (23): nn.Linear(4096 -> 1000) (24): nn.SoftMax (25): nn.Linear(4096 -> 2) (26): nn.SoftMax }

When I then run the model I get the following error: /opt/torch/install/share/lua/5.1/nn/hessian.lua:360: attempt to index a nil value stack traceback: /opt/torch/install/share/lua/5.1/nn/hessian.lua:360: in function 'parameters' /opt/torch/install/share/lua/5.1/nn/hessian.lua:330: in function 'getParameters'

Any Ideas what's wrong? Any help is very much appreciated.

Best regards, Felix

szagoruyko commented 8 years ago

Hi Felix, you are loading a model with several outputs and modified caffe, this is not supported right now. you can split the model in caffe in sequential parts and load in loadcaffe and then construct a network with nn modules.

felixsmueller commented 8 years ago

Hi Szagoruyko thank you very much for the fast feedback. Are you aware of any loadable alexnet model? Regards, Felix