Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: THEend8_
CSCE 421 Machine Learning
Convolutional Neural Networks
In this assignment, you’ll be coding up a convolutional neural network from scratch to classify images using PyTorch.
Instructions
Install PyTorch following the instructions here.
Install the torchinfo package to visualize the network architecture and the number of parameters. The maximum number of parameters you are allowed to use for your network is 100,000.
You are required to complete the functions defined in the code blocks following each question. Fill out sections of the code marked “YOUR CODE HERE” .
You’re free to add any number of methods within each class.
You may also add any number of additional code blocks that you deem necessary.
Once you’ve filled out your solutions, submit the notebook on Canvas.
Do NOT forget to type in your name and UIN at the beginning of the notebook.
Data Preparation
In [ ]:
!pip install torchinfo
In [ ]:
# Importing the libraries
import os
import torch
import torchvision
from torchvision.utils import make_grid
import numpy as np
In this assignment, we will use the Fashion-MNIST dataset. Fashion-MNIST is a dataset of Zalando’s article images—consisting of a training set of 60,000 examples and a test set of 10,000 examples. Each example is a 28×28 grayscale image, associated with a label from 10 classes.Data
Each image is 28 pixels in height and 28 pixels in width, for a total of 784 pixels in total. Each pixel has a single pixel-value associated with it, indicating the lightness or darkness of that pixel, with higher numbers meaning darker. This pixel-value is an integer between 0 and 255.