Convert trained models created with third-party machine learning tools to the Core ML model format.
- Core ML
If your model is created and trained using a supported third-party machine learning framework, you can use the Core ML Tools or a third-party conversion tool—such as the MXNet converter or the TensorFlow converter—to convert your model to the Core ML model format. Otherwise, you need to create your own conversion tools.
Use Core ML Tools
Feedforward, convolutional, recurrent
Random forests, boosted trees, decision trees
Support vector machines
Scalar regression, multiclass classification
Generalized linear models
Linear regression, logistic regression
Sparse vectorization, dense vectorization, categorical processing
Sequentially chained models
Convert Your Model
Convert your model using the Core ML converter that corresponds to your model’s third-party framework. Call the converter’s
convert method and save the resulting model to the Core ML model format (
For example, if your model was created using Caffe, pass the Caffe model (
.caffemodel) to the
Now save the resulting model in the Core ML model format.
Depending on your model, you might need to update inputs, outputs, and labels, or you might need to declare image names, types, and formats. The conversion tools are bundled with more documentation, as the options available vary by tool. For more information about Core ML Tools, see the Package Documentation.
Alternatively, Write a Custom Conversion Tool
It's possible to create your own conversion tool when you need to convert a model that isn't in a format supported by the tools listed above.
Writing your own conversion tool involves translating the representation of your model's input, output, and architecture into the Core ML model format. You do this by defining each layer of the model's architecture and its connectivity with other layers. Use the conversion tools provided by Core ML Tools as examples; they demonstrate how various model types created from third-party frameworks are converted to the Core ML model format.