Chapter 10Building a Deep Convolutional Neural Network with Keras

In Chapter 5, you learned about the basics of convolutional neural networks (CNNs) and downloaded a pre-trained convolutional neural network model from Apple. In this chapter, you will create a deep convolutional neural network from scratch using the Keras functional API, train this network on a small publicly available dataset, and then use the trained model in an iOS app.

The dataset used to train this model is the Dogs vs. Cats dataset, available on Kaggle.com at https://www.kaggle.com/c/dogs-vs-cats/data. The dataset is provided by Kaggle as part of a competition to create a model that can detect dogs and cats in images. The dataset consists of two folders.

  • Train: Contains 12,500 images; 6,250 are images of dogs, and the rest are images of cats. The filenames make it clear whether the image contains a dog or a cat.
  • Test: Contains an additional 12,500 unlabeled images, the objective of the completion is to accurately classify the images as containing either dogs or cats. The dataset creators have ensured that there are no images that contain both dogs and cats.

Since the aim of this chapter is to teach you how to build a deep learning model from scratch ...

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.