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

problem running convert example #126

Closed
wl3b10s opened this issue Feb 2, 2018 · 2 comments
Closed

problem running convert example #126

wl3b10s opened this issue Feb 2, 2018 · 2 comments
Assignees

Comments

@wl3b10s
Copy link

wl3b10s commented Feb 2, 2018

run the example in https://apple.github.io/coremltools/ for model conversion

"
import coremltools

Convert a caffe model to a classifier in Core ML

coreml_model = coremltools.converters.caffe.convert(('bvlc_alexnet.caffemodel', 'deploy.prototxt'),
predicted_feature_name='class_labels.txt'
)

Now save the model

coreml_model.save('BVLCObjectClassifier.mlmodel')
"

i got
"Traceback (most recent call last):
File "convert.py", line 5, in
predicted_feature_name='class_labels.txt'
File "/root/.local/lib/python2.7/site-packages/coremltools-0.8-py2.7.egg/coremltools/converters/caffe/_caffe_converter.py", line 191, in convert
predicted_feature_name)
File "/root/.local/lib/python2.7/site-packages/coremltools-0.8-py2.7.egg/coremltools/converters/caffe/_caffe_converter.py", line 255, in _export
predicted_feature_name)
MemoryError: std::bad_alloc
"

why example fails ?? thanks

@aseemw
Copy link
Collaborator

aseemw commented Feb 10, 2018

I see. There is a bug in the documentation. Instead of "predicted_feature_name", the argument should be "class_labels". Kindly see documentation here, it is correctly described there.
Also, when you download the class_labels.txt file linked in the page https://apple.github.io/coremltools/, it gets downloaded as a file named "synset_words.txt" so you should use that name instead, i.e.:

coreml_model = coremltools.converters.caffe.convert(
('bvlc_alexnet.caffemodel', 'deploy.prototxt'),
class_labels='synset_words.txt'
)

The typo in the documentation will be corrected. Thanks!

@aseemw aseemw self-assigned this Feb 10, 2018
@wl3b10s
Copy link
Author

wl3b10s commented Feb 11, 2018

it works , thanks~~~ @aseemw

@wl3b10s wl3b10s closed this as completed Feb 11, 2018
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