Use Core ML to integrate machine learning models into your app. Core ML provides a unified representation for all models. Your app uses Core ML APIs and user data to make predictions, and to train or fine-tune models, all on the user’s device.
Core ML optimizes on-device performance by leveraging the CPU, GPU, and Neural Engine while minimizing its memory footprint and power consumption. Running a model strictly on the user’s device removes any need for a network connection, which helps keep the user’s data private and your app responsive.
This page lists short code examples and full examples of using coremltools to convert models.
Topic | Example |
---|---|
For a quick start | Quickstart Example: Demonstrates how to convert an image classifier model trained using the TensorFlow Keras API to the Core ML format. |
TensorFlow 2 | Load and convert a model Full examples: |
TensorFlow 1 | Convert from TensorFlow 1 Full examples: |
PyTorch | Convert from PyTorch Full examples: |
Model Intermediate Language (MIL) | Model Intermediate Language: Construct a MIL program using the Python builder. |
Conversion Options | Image Inputs: Classifiers: Produce a classifier model Flexible Input Shapes: Composite Operators: Defining a composite operation by decomposing it into MIL operations. Full examples: |
Quantization | Quantization: Reduce the size of the Core ML model produced by conversion. |
Other Converters | |
Trees and Linear Models | |
MLModel | MLModel Overview: Model Prediction: Xcode Model Preview Types: MLModel Utilities: |
Updatable Models | Nearest Neighbor Classifier: Create an updatable empty k-nearest neighbor. |
If you have a code example you'd like to submit, see Contributing.