vadimkantorov / caffemodel2pytorch

Convert Caffe models to PyTorch
389 stars 84 forks source link

What mean of Skipping Layer?? #11

Closed edwardcho closed 4 years ago

edwardcho commented 5 years ago

Using your modules (caffemodel2pytorch), I tested your sample code.


model = caffemodel2pytorch.Net(
    prototxt = 'caffemodel2pytorch/ubuntu14.04_bvlc_epoch_100.0/inception_v1_deploy.prototxt',
    weights = 'caffemodel2pytorch/ubuntu14.04_bvlc_epoch_100.0/inception_v1_iter_156251.caffemodel',
    caffe_proto = 'caffe/src/caffe/proto/caffe.proto'
    )
model.cuda()
model.eval()

torch.set_grad_enabled(False)

# make sure to have right procedure of image normalization and channel reordering
image = torch.autograd.Variable(torch.Tensor(8, 3, 224, 224).cuda())

# outputs dict of pytorch Variables
# in this example the dict contains the only key 'prob'
output_dict = model(data=image)

I met this message.

Skipping layer [data, Input, Input]: not found in caffemodel2pytorch.modules dict Skipping layer [inception_3a/output, Concat, Concat]: not found in caffemodel2pytorch.modules dict Skipping layer [inception_3b/output, Concat, Concat]: not found in caffemodel2pytorch.modules dict Skipping layer [inception_4a/output, Concat, Concat]: not found in caffemodel2pytorch.modules dict Skipping layer [inception_4b/output, Concat, Concat]: not found in caffemodel2pytorch.modules dict Skipping layer [inception_4c/output, Concat, Concat]: not found in caffemodel2pytorch.modules dict Skipping layer [inception_4d/output, Concat, Concat]: not found in caffemodel2pytorch.modules dict Skipping layer [inception_4e/output, Concat, Concat]: not found in caffemodel2pytorch.modules dict Skipping layer [inception_5a/output, Concat, Concat]: not found in caffemodel2pytorch.modules dict Skipping layer [inception_5b/output, Concat, Concat]: not found in caffemodel2pytorch.modules dict ... File "/usr/local/lib/python2.7/dist-packages/torch/nn/modules/module.py", line 489, in call result = self.forward(*input, **kwargs) File "caffemodel2pytorch/caffemodel2pytorch.py", line 122, in forward assert name in variables, 'Variable [{}] does not exist. Pass it as a keyword argument or provide a layer which produces it.'.format(name) AssertionError: Variable [inception_3a/output] does not exist. Pass it as a keyword argument or provide a layer which produces it.

vadimkantorov commented 5 years ago

This converter supports a limited number of operations and Concat is not one of them. You’d need to support it yourself. Check the supported operations in code (modules collection) for examples.