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 tool, you can use Core ML Tools to convert it to the Core ML model format. Table 1 lists the supported models and third-party 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 tool. 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 in Table 1.
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 tools are converted to the Core ML model format.