20.03.2021 Views

Deep-Learning-with-PyTorch

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Adding a second model to our project

359

will accomplish this will be very similar to the code from the last chapter, especially if

we focus on the larger structure. All of the changes we’re going to make will be

smaller and targeted. As we see in figure 13.2, we need to make updates to our model

(step 2A in the figure), dataset (2B), and training loop (2C) to account for the new

model’s inputs, outputs, and other requirements. (Don’t worry if you don’t recognize

each component in each of these steps in step 2 on the right side of the diagram. We’ll

go through the details when we get to each step.) Finally, we’ll examine the results we

get when running our new model (step 3 in the figure).

1. Segmentation

UNet

2. Update:

2a. Model

T/F

2b. Dataset

3. Results

2c. Training

Figure 13.2 The new model architecture for segmentation, along with the model, dataset,

and training loop updates we will implement

Breaking down figure 13.2 into steps, our plan for this chapter is as follows:

1 Segmentation. First we will learn how segmentation works with a U-Net model,

including what the new model components are and what happens to them as

we go through the segmentation process. This is step 1 in figure 13.2.

2 Update. To implement segmentation, we need to change our existing code base

in three main places, shown in the substeps on the right side of figure 13.2.The

code will be structurally very similar to what we developed for classification, but

will differ in detail:

a Update the model (step 2A). We will integrate a preexisting U-Net into our segmentation

model. Our model in chapter 12 output a simple true/false classification;

our model in this chapter will instead output an entire image.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!