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.

306 CHAPTER 11 Training a classification model to detect suspected tumors

$ ls -1p data-unversioned/part2/luna/subset0/

1.3.6.1.4.1.14519.5.2.1.6279.6001.105756658031515062000744821260.mhd

1.3.6.1.4.1.14519.5.2.1.6279.6001.105756658031515062000744821260.raw

1.3.6.1.4.1.14519.5.2.1.6279.6001.108197895896446896160048741492.mhd

1.3.6.1.4.1.14519.5.2.1.6279.6001.108197895896446896160048741492.raw

...

and that we have the overall correct number of files:

$ ls -1 data-unversioned/part2/luna/subset?/* | wc -l

1776

$ ls -1 data-unversioned/part2/luna/subset0/* | wc -l

178

...

$ ls -1 data-unversioned/part2/luna/subset9/* | wc -l

176

If all of these seem right but things still aren’t working, ask on Manning LiveBook

(https://livebook.manning.com/book/deep-learning-with-pytorch/chapter-11) and

hopefully someone can help get things sorted out.

11.7.2 Interlude: The enumerateWithEstimate function

Working with deep learning involves a lot of waiting. We’re talking about real-world,

sitting around, glancing at the clock on the wall, a watched pot never boils (but you

could fry an egg on the GPU), straight up boredom.

The only thing worse than sitting and staring at a blinking cursor that hasn’t

moved for over an hour is flooding your screen with this:

2020-01-01 10:00:00,056 INFO training batch 1234

2020-01-01 10:00:00,067 INFO training batch 1235

2020-01-01 10:00:00,077 INFO training batch 1236

2020-01-01 10:00:00,087 INFO training batch 1237

...etc...

At least the quietly blinking cursor doesn’t blow out your scrollback buffer!

Fundamentally, while doing all this waiting, we want to answer the question “Do I

have time to go refill my water glass?” along with follow-up questions about having

time to

• Brew a cup of coffee

• Grab dinner

• Grab dinner in Paris 5

To answer these pressing questions, we’re going to use our enumerateWithEstimate

function. Usage looks like the following:

5

If getting dinner in France doesn’t involve an airport, feel free to substitute “Paris, Texas” to make the joke

work; https://en.wikipedia.org/wiki/Paris_(disambiguation).

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

Saved successfully!

Ooh no, something went wrong!