Implementing semantic segmentation using U-Net
In this section, we’ll leverage the U-Net architecture to predict the class that corresponds to all the pixels in the image. A sample of such an input-output combination is as follows:
Figure 9.5: (Left) input image; (Right) output image with classes corresponding to the various objects present in the image
Note that, in the preceding picture, the objects that belong to the same class (in the left image, the input image) have the same pixel value (in the right image, the output image), which is why we segment the pixels that are semantically similar to each other. This is also known as semantic segmentation. Let’s learn how to code semantic segmentation:
Find the following code in the Semantic_Segmentation_with_U_Net.ipynb
file in the Chapter09
folder on GitHub at https://bit.ly/mcvp-2e. The code contains URLs to download data from and is moderately lengthy.
- Let’s begin by downloading...