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.

422 CHAPTER 14 End-to-end nodule analysis, and where to go next

To compute the area under this curve, we use numeric integration by the trapezoidal

rule (https://en.wikipedia.org/wiki/Trapezoidal_rule), where we multiply the average

TPRs (on the Y-axis) between two points by the difference of the two FPRs (on the

X-axis)—the area of trapezoids between two points of the graph. Then we sum the

area of the trapezoids:

# In[5]:

fp_diam_diff = fp_diam[1:] - fp_diam[:-1]

tp_diam_avg = (tp_diam[1:] + tp_diam[:-1])/2

auc_diam = (fp_diam_diff * tp_diam_avg).sum()

Now, if we run pyplot.plot(fp_diam, tp_diam, label=f"diameter baseline,

AUC={auc_diam:.3f}") (along with the appropriate figure setup we see in cell 8), we

get the plot we saw in figure 14.6.

14.5.3 Reusing preexisting weights: Fine-tuning

One way to quickly get results (and often also get by with much less data) is to start not

from random initializations but from a network trained on some task with related data.

This is called transfer learning or, when training only the last few layers, fine-tuning. Looking

at the highlighted part in figure 14.7, we see that in step 2c, we’re going to cut out

the last bit of the model and replace it with something new.

1. Nodule Candidate Generation

1a. Segmentation

n 1b. Grouping 1c. sample tuples

((...,(..., IRC),

...

(..., IRC))

2. Nodule and malignancy claSsification

2a. Nodule claSsification 2b. ROC/AUC Metrics 2c. fine-tuning malignancy model

3. End-to-end detection

3a. (..., IRC) 3b. Is nodule? 3c. is Malignant?

Figure 14.7

The end-to-end project we’re implementing in this chapter, with a focus on fine-tuning

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

Saved successfully!

Ooh no, something went wrong!