Reinforcing your learning
The same concepts for classification image transformations apply to segmentation image transformations. Here, Pluto reuses or slightly hacks the wrapper functions in Chapter 3. In particular, Pluto hacks the following methods for segmentation:
- Horizontal flip
- Vertical flip
- Random resizing and cropping
You can’t complete or understand this chapter unless you have read Chapter 3. This is because Pluto reuses or slightly modifies the existing image augmentation wrapper functions.
Pluto chose these filters because the Albumentations library marked them as safe for segmentation. So, let’s start with horizontal flip.
Pluto demonstrated horizontal flip using the PIL library in Chapter 3 because the code is easy to understand. Thus, he will hack
draw_image_flip_pil() into the
draw_image_flip_pil_segmen() function. The transformation code is...