Building convolutional networks
You are on a team building a weather forecasting system. As part of the system, cameras will be installed at various locations to take pictures of the sky. Your task is to build a model to classify different cloud types in these pictures, which will help spot approaching weather fronts.
You decide to build a convolutional image classifier. The model will consist of two parts:
- A feature extractor that learns a vector of features from the input image,
- A classifier that predicts the image's class based on the learned features.
Both torch
and torch.nn as nn
have already been imported for you, so let's get to it!
This exercise is part of the course
Intermediate Deep Learning with PyTorch
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
class Net(nn.Module):
def __init__(self, num_classes):
super().__init__()
# Define feature extractor
self.feature_extractor = nn.Sequential(
nn.Conv2d(3, 32, kernel_size=3, padding=1),
nn.ELU(),
nn.MaxPool2d(kernel_size=2),
____,
____,
____,
____,
)