hollance / coreml-survival-guide

Source code for the book Core ML Survival Guide
MIT License
246 stars 36 forks source link

Unable to make predictions using the pipeline (MobileNet+SSD) #11

Open jienwan opened 4 years ago

jienwan commented 4 years ago

Thank you for your posting! I'm also trying to build a mlmodel pipeline with Tiny YOLOV3 and I found your repo really useful and helpful.

I'm following the ssdlite.py. I ran this file on my own laptop without making any changes. Things are clear and I can almost understand all the steps. For the final model generated by making all the 3 models together as a pipeline, I cannot make predictions by running 'final_model.predict({'image': img})' where img is an image with size (300, 300). The errors I got is as following:

final_model.predict({'image': img}) Traceback (most recent call last): File "", line 1, in File "/Users/weishunji/PycharmProjects/coreml_pipeline/venv/lib/python3.6/site-packages/coremltools/models/model.py", line 360, in predict raise Exception('Unable to load CoreML.framework. Cannot make predictions.') Exception: Unable to load CoreML.framework. Cannot make predictions.

However, I can make predictions successfully using ssd_model and decoder_model. But when they're combined as a pipeline, I'm not able to predict. I'm a little confused about this and wonder whether this is the way it should be.

I'll really appreciate it if you can help me with this!

hollance commented 4 years ago

That usually means that the Core ML compiler cannot compile the model because of some error. You can open the mlmodel in Xcode to see the error message, or run coremlcompiler by hand from the command line.