Skip to content
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

Coremltools issue #485

Open
paultas opened this issue Mar 10, 2020 · 4 comments
Open

Coremltools issue #485

paultas opened this issue Mar 10, 2020 · 4 comments

Comments

@paultas
Copy link

paultas commented Mar 10, 2020

I created .py file according to Apple instruction Apple Instuction and Documentation

import coremltools

# Convert a Caffe model to a classifier in Core ML
coreml_model = coremltools.converters.caffe.convert(
    ('nin_imagenet_conv.caffemodel', 'train_val.prototxt'), predicted_feature_name='class_labels.txt'
)

# Now save the model
coreml_model.save('nin_imagenet_conv.mlmodel')

Then in Terminal I run python convert.py

But then I get a error:

================= Starting Conversion from Caffe to CoreML ======================
Layer 0: Type: 'Data', Name: 'data'. Output(s): 'data', 'label'.
WARNING: Skipping Data Layer 'data' of type 'Data'. It is recommended to use Input layer for deployment.
Layer 1: Type: 'Data', Name: 'data'. Output(s): 'data', 'label'.
WARNING: Skipping Data Layer 'data' of type 'Data'. It is recommended to use Input layer for deployment.
Layer 2: Type: 'Convolution', Name: 'conv1'. Input(s): 'data'. Output(s): 'conv1'.
Layer 3: Type: 'ReLU', Name: 'relu0'. Input(s): 'conv1'. Output(s): 'conv1'.
Layer 4: Type: 'Convolution', Name: 'cccp1'. Input(s): 'conv1'. Output(s): 'cccp1'.
Layer 5: Type: 'ReLU', Name: 'relu1'. Input(s): 'cccp1'. Output(s): 'cccp1'.
Layer 6: Type: 'Convolution', Name: 'cccp2'. Input(s): 'cccp1'. Output(s): 'cccp2'.
Layer 7: Type: 'ReLU', Name: 'relu2'. Input(s): 'cccp2'. Output(s): 'cccp2'.
Layer 8: Type: 'Pooling', Name: 'pool0'. Input(s): 'cccp2'. Output(s): 'pool0'.
Layer 9: Type: 'Convolution', Name: 'conv2'. Input(s): 'pool0'. Output(s): 'conv2'.
Layer 10: Type: 'ReLU', Name: 'relu3'. Input(s): 'conv2'. Output(s): 'conv2'.
Layer 11: Type: 'Convolution', Name: 'cccp3'. Input(s): 'conv2'. Output(s): 'cccp3'.
Layer 12: Type: 'ReLU', Name: 'relu5'. Input(s): 'cccp3'. Output(s): 'cccp3'.
Layer 13: Type: 'Convolution', Name: 'cccp4'. Input(s): 'cccp3'. Output(s): 'cccp4'.
Layer 14: Type: 'ReLU', Name: 'relu6'. Input(s): 'cccp4'. Output(s): 'cccp4'.
Layer 15: Type: 'Pooling', Name: 'pool2'. Input(s): 'cccp4'. Output(s): 'pool2'.
Layer 16: Type: 'Convolution', Name: 'conv3'. Input(s): 'pool2'. Output(s): 'conv3'.
Layer 17: Type: 'ReLU', Name: 'relu7'. Input(s): 'conv3'. Output(s): 'conv3'.
Layer 18: Type: 'Convolution', Name: 'cccp5'. Input(s): 'conv3'. Output(s): 'cccp5'.
Layer 19: Type: 'ReLU', Name: 'relu8'. Input(s): 'cccp5'. Output(s): 'cccp5'.
Layer 20: Type: 'Convolution', Name: 'cccp6'. Input(s): 'cccp5'. Output(s): 'cccp6'.
Layer 21: Type: 'ReLU', Name: 'relu9'. Input(s): 'cccp6'. Output(s): 'cccp6'.
Layer 22: Type: 'Pooling', Name: 'pool3'. Input(s): 'cccp6'. Output(s): 'pool3'.
Layer 23: Type: 'Dropout', Name: 'drop'. Input(s): 'pool3'. Output(s): 'pool3'.
WARNING: Skipping training related layer 'drop' of type 'Dropout'.
Layer 24: Type: 'Convolution', Name: 'conv4-1024'. Input(s): 'pool3'. Output(s): 'conv4'.
Layer 25: Type: 'ReLU', Name: 'relu10'. Input(s): 'conv4'. Output(s): 'conv4'.
Layer 26: Type: 'Convolution', Name: 'cccp7-1024'. Input(s): 'conv4'. Output(s): 'cccp7'.
Layer 27: Type: 'ReLU', Name: 'relu11'. Input(s): 'cccp7'. Output(s): 'cccp7'.
Layer 28: Type: 'Convolution', Name: 'cccp8-1024'. Input(s): 'cccp7'. Output(s): 'cccp8'.
Layer 29: Type: 'ReLU', Name: 'relu12'. Input(s): 'cccp8'. Output(s): 'cccp8'.
Layer 30: Type: 'Pooling', Name: 'pool4'. Input(s): 'cccp8'. Output(s): 'pool4'.
Layer 31: Type: 'Accuracy', Name: 'accuracy'. Input(s): 'pool4', 'label'. Output(s): 'accuracy'.
WARNING: Skipping training related layer 'accuracy' of type 'Accuracy'.
Layer 32: Type: 'SoftmaxWithLoss', Name: 'loss'. Input(s): 'pool4', 'label'. WARNING: Skipping training related layer 'loss' of type 'SoftmaxWithLoss'.

================= Summary of the conversion: ===================================
Traceback (most recent call last):
  File "convert.py", line 5, in <module>
    ('nin_imagenet_conv.caffemodel', 'train_val.prototxt'), predicted_feature_name='class_labels.txt'
  File "/Users/pavel.tarasevich/Library/Python/2.7/lib/python/site-packages/coremltools/converters/caffe/_caffe_converter.py", line 192, in convert
    predicted_feature_name)
  File "/Users/pavel.tarasevich/Library/Python/2.7/lib/python/site-packages/coremltools/converters/caffe/_caffe_converter.py", line 260, in _export
    predicted_feature_name)
RuntimeError: Unable to infer input name and dimensions. Please provide a .prototxt file with 'Input' layer and dimensions defined.
@3DTOPO
Copy link

3DTOPO commented Mar 10, 2020

This is not at all related to Neural Style so I doubt you will get much help here. I would suggest looking for help in nin imagenet related forums.

@paultas
Copy link
Author

paultas commented Mar 10, 2020

I don't know, because the link is on the main page, so hope somebody faced this issue 😊

@3DTOPO
Copy link

3DTOPO commented Mar 10, 2020

Just because one project might use a model from another project does not mean that is the right place to look for support. I'm trying to help you and steer you in the right direction.

@paultas
Copy link
Author

paultas commented Mar 10, 2020

Thank you, I wrote on that forum

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants