Chapter 8. Augmentation

This chapter explores the practical side of implementing generative- and recommendation-related AI features in your Swift apps: we’ve collectively called the domain Augmentation. Taking a top-down approach, we explore five augmentation tasks, and how to implement them using a variety of AI tools.

Practical AI and Augmentation

We examine augmentation across two subdomains: generation and recommendation. Here are the five practical augmentation tasks that we explore in this chapter:

Image style transfer

Transferring style between images

Text generation

Using a Markov chain to generate sentences.

Image generation

Creating our own generative adversarial network (GAN) to create images on iOS.

Movie recommendation

Recommending movies to a user, based on their previous movie reviews.


Predicting numeric values using regression.


We’ve called this chapter “Augmentation” because we’ve included tasks related to generating things with AI together with our task for recommending things using AI. These things aren’t necessarily technically related in a way that makes sense beyond that, and we’ve chosen to combine them for convenience more than any other reason. “Augmentation” made sense to us as a title.

Task: Image Style Transfer

We’ve done quite a few practical AI tasks that involve detecting something, or classifying something. Neural Style Transfer (NST, or just style transfer) is a machine-learning technique that, most traditionally, ...

Get Practical Artificial Intelligence with Swift 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.