Skip to content

Latest commit

 

History

History
59 lines (32 loc) · 1.63 KB

File metadata and controls

59 lines (32 loc) · 1.63 KB

Model conversion

image

In order to convert prelearned models such as Caffe, Keras, e.t.c. into .mlmodel file extension you have to do so with convertor that you can install via PIP.

PIP - package management system that helps you install packages

How to install PIP

0) Install python if needed

brew install python

1) Save this file

2) cd to this file and install it with

sudo python get-pip.py

3) Finally, install coreML tools by Apple

pip install -U coremltools

Hint: -U means latest version

4) Create "convert-script.py" in the directory the model placed. It should be looking something like that

import coremltools

caffe_model = ('oxford102.caffemodel', 'deploy.prototxt')

labels = 'flower-labels.txt'

coreml_model = coremltools.converters.caffe.convert(caffe_model, class_labels=labels, image_input_names='data')

coreml_model.save('FlowerClassifier.mlmodel')

5) Run the script

pip install -U coremltools

The Converted model file should be in the directory


Links

Troubleshooting