Caffe is a deep learning framework that is commonly known for its Model Zoo. The following example shows how to convert the AlexNet (download) Caffe model to Core ML.

🚧

In maintenance mode

Caffe is not in active development. New features in the current version of coremltools (such as MIL, custom operators, and so on) do not appear in the Caffe converter.

Supporting files:

import coremltools as ct

# Convert a Caffe model to a classifier in Core ML
model = ct.converters.caffe.convert(
    ('bvlc_alexnet.caffemodel', 'deploy.prototxt'),
    predicted_feature_name='class_labels.txt'
)

# Now save the model
model.save('BVLCObjectClassifier.mlmodel')

For more details about the Caffe convert() method, see the API Reference.