Contents

MLImageClassifier

A model you train to classify images.

Declaration

struct MLImageClassifier

Mentioned in

Overview

Use an image classifier to train a machine learning model that you can include in your app to categorize images.

When you create the model, you give it a training dataset made up of labeled images, along with parameters that control the training process. For example, you can provide the model with images of elephants and giraffes, in two folders labeled Elephant and Giraffe, to train it to recognize these animals.

After training completes, you evaluate the trained model by showing it a testing dataset containing labeled images that the model hasn’t seen before. The metrics that come from this evaluation tell you whether the model performs well enough. For example, you can see how often the elephant and giraffe classifier mistakes a giraffe for an elephant. When the model makes too many mistakes, you can add more or better training data, or change the parameters, and try again.

When your model does perform well enough, you save it as a Core ML model file with the mlmodel extension. You can then import this model file into an app—like the Classifying Images with Vision and Core ML sample code project—that uses a Core ML model file to classify images.

Topics

Training an image classifier asynchronously

Creating an image classifier from a checkpoint

Training an image classifier synchronously

Evaluating an image classifier

Testing an image classifier

Saving an image classifier

Inspecting an image classifier model

Describing an image classifier

Supporting types

Default Implementations

See Also

Image models