Introduction to Computer Vision with PyTorch (3/6)
Previous << Introduction to Computer Vision with PyTorch (2/6)
Convolutional Neural Networks
In this unit we will learn about Convolutional Neural Networks (CNNs), which are specifically designed for computer vision.
Computer vision is different from generic classification, because when we are trying to find a certain object in the picture, we are scanning the image looking for some specific patterns and their combinations. For example, when looking for a cat, we first may look for horizontal lines, which can form whiskers, and then certain combination of whiskers can tell us that it is actually a picture of a cat. Relative position and presence of certain patterns is important, and not their exact position on the image. To extract patterns, we will use the notion of convolutional filters. But first, let us load all dependencies and functions that we have defined earlier.
!wget https://raw.githubusercontent.com/MicrosoftDocs/pytorchfundamentals/main/computer-vision-pytorch/pytorchcv.py
import torch
import torch.nn as nn
import torchvision
import matplotlib.pyplot as plt
from torchinfo import summary
import numpy as np
from pytorchcv import load_mnist, train, plot_results, plot_convolution, display_dataset
load_mnist(batch_size=128)
Convolutional Filters
Convolutional filters are small windows that run over each pixel of the image and…