Chapter 6Creating an Image Classifier with the Create ML App

In this chapter, you will use the Create ML app to train a machine learning model that can detect the dominant object in an image and classify the image as containing a dog or a cat. The model will be trained on a subset of the Kaggle Dogs vs. Cats dataset. After the model is trained, you will use the model in an iOS app that allows users to take a picture and determine whether the picture contains a dog or a cat. The full version of this dataset contains 25,000 images and is available on Kaggle.com at https://www.kaggle.com/c/dogs-vs-cats/data.

Training an image classification model can take a long time, and, therefore, the downloads that accompany this chapter include a reduced version of the Kaggle dataset, containing only 404 images instead of the original 25,000. The reduced dataset consists of two folders.

  • Train: Contains 202 images. There are 101 images of dogs located within the train/dog folder. The remaining images are images of cats located within the train/cat folder.
  • Test: Contains an additional 202 images, using a similar folder hierarchy as the train folder.

If you decide to use the full version of the Dogs vs. Cats dataset, you will need to download it from Kaggle.com and reorganize its contents to ensure that each object category in the training data ...

Get Machine Learning for iOS Developers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.