Classifying clothing images with CNNs
As mentioned, the CNN model has two main components: the feature extractor composed of a set of convolutional and pooling layers, and the classifier backend, similar to a regular neural network.
Let’s start this project by architecting the CNN model.
Architecting the CNN model
We import the necessary module and initialize a Sequential-based model:
>>> import torch.nn as nn
>>> model = nn.Sequential()
For the convolutional extractor, we are going to use three convolutional layers. We start with the first convolutional layer with 32 small-sized 3 * 3 filters. This is implemented with the following code:
>>> model.add_module('conv1',
nn.Conv2d(in_channels=1,
out_channels=32,
kernel_size=3)
)
>>> model.add_module('relu1', nn.ReLU())
Note that we use ReLU...