Chapter 20. ML Pipelines for Computer Vision Problems

In this chapter and the next, we will walk through two ML pipelines that demonstrate a holistic set of common ML problems. We will set up the problems and show you how we implemented the solutions. We assume you have read the previous chapters and will refer to details from them.

In this chapter, we will walk through a typical computer vision problem. We are designing an ML pipeline for an image classification problem. The ML model itself isn’t earth-shattering, but it isn’t the goal to produce a complex model. We wanted to keep the model simple. That way, we can focus on the ML pipeline (the interesting aspect of ML production systems).

In this example, we want to train an ML model to classify images of pets into categories of cats and dogs (shown in Figure 20-1).

The classification problem
Figure 20-1. The classification problem

In this example, we will briefly discuss the ML models, and then we’ll focus on the pipelines, building on the previous chapters. In particular, we’ll highlight how to ingest or how to preprocess the image data.

Warning

At the time of this writing, TFX doesn’t support laptops based on Apple’s Silicon architecture. If you are using a laptop based on the architecture (e.g., M1s), we highly recommend Google’s Colab to work with TFX.

Our Data

For this example, we are using a public dataset compiled by Microsoft Research. The ...

Get Machine Learning Production Systems 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.