20.03.2021 Views

Deep-Learning-with-PyTorch

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Preventing overfitting with data augmentation

353

--balanced --augment-noise

sanity-bal-noise

$ .venv/bin/python -m p2ch12.training --epochs 20 \

--balanced --augmented sanity-bal-aug

While that’s running, we can start TensorBoard. Let’s direct it to only show these runs

by changing the logdir parameter like so: ../path/to/tensorboard --logdir

runs/p2ch12.

Depending on the hardware you have at your disposal, the training might take a

long time. Feel free to skip the flip, shift, and scale training jobs and reduce the

first and last runs to 11 epochs if you need to move things along more quickly. We

chose 20 runs because that helps them stand out from the other runs, but 11 should

work as well.

If you let everything run to completion, your TensorBoard should have data like

that shown in figure 12.22. We’re going to deselect everything except the validation

data, to reduce clutter. When you’re looking at your data live, you can also change the

smoothing value, which can help clarify the trend lines. Take a quick look at the figure,

and then we’ll go over it in some detail.

Unaugmented

Noise is

worse than

unaugmented

tag: correct/all tag: correct/neg tag: correct/pos

Unaugmented

Individual

Augments

FuLly

Augmented

tag: loss/all tag: loss/neg tag:

loss/pos

FuLly

Augmented

tag: pr/f1_score tag: pr/precision

p

tag:

pr/recall

FuLly Augmented

is Worse than unaugmented...

...Except for how unaugmented

is overfiTting on positive samples

Figure 12.22 Percent correctly classified, loss, F1 score, precision, and recall for the validation set from

networks trained with a variety of augmentation schemes

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

Saved successfully!

Ooh no, something went wrong!