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

Evaluate the network and viewing images

From the course: Transfer Learning for Images Using PyTorch: Essential Training

Start my 1-month free trial

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,…

Contents