Now that we know what TL is, let's look at whether it works in practice. In this section, we'll apply an advanced ImageNet pretrained network on the CIFAR-10 images with PyTorch 1.3.1 and the torchvision 0.4.2 package. We'll use both types of TL. It's preferable to run this example on a GPU.
Let's get started:
- Do the following imports:
import torchimport torch.nn as nnimport torch.optim as optimimport torchvisionfrom torchvision import models, transforms
- Define batch_size for convenience:
batch_size = 50
- Define the training dataset. We have to consider a few things: ...