From the course: Transfer Learning for Images Using PyTorch: Essential Training
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Evaluate the network and viewing images
From the course: Transfer Learning for Images Using PyTorch: Essential Training
Evaluate the network and viewing images
- [Instructor] So let's look at evaluating the network and viewing images. So I import Matplotlib and NumPy because I'm looking to display some images. So let's talk through this chunk of code. So firstly we create a list with ten different categories for the CIFAR-10 dataset. When we're training, we want our model and the images and labels to be on GPU memory. When you use models for inference, say on CCTV cameras, then they're normally run on CPU memory. So, in the next line of code, we copy our model back to CPU memory. Now, by default, a PyTorch network model is run in the train mode. As long as there's no dropout layers or batch normalization in the network, you don't need to worry about the train mode versus the eval mode. But since the VGG16 network has a dropout layer, then before we use the network to compute outward values, we must explicitly set the network into eval mode. The reason is that during training,…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
Creating a fixed feature extractor5m 30s
-
(Locked)
Understanding loss: CrossEntropyLoss() and NLLLoss()3m 37s
-
(Locked)
Autograd1m 33s
-
(Locked)
Using autograd4m 9s
-
(Locked)
Training the fixed feature extractor3m 24s
-
(Locked)
Optimizers1m 49s
-
(Locked)
CPU to GPU59s
-
(Locked)
Train the extractor37s
-
(Locked)
Evaluate the network and viewing images2m 22s
-
(Locked)
Viewing images and normalization5m 52s
-
(Locked)
Accuracy of the model2m 40s
-
-
-
-