DPS921/PyTorch: Convolutional Neural Networks
Convolutional Neural Networks Using Pytorch
The basic idea was to create a convolutional neural network using the python machine learning Framework PyTorch. The actual code will
be written in Jupyter Lab both for demonstration and implementation purposes. Furthermore, using the the torchvision dataset, the goal
was to show the training of the neural network, and show the classification of several images which have a single digit from 0 - 9.
A successful execution will show the correct determination of what number resides in that specific image. As part our of research,
We will explain in detail how an actual convolution neural network works at a fundamental level. Will we will both take a graphical
and mathematical approach to explaining the different parts of the neural network and how it comes together as whole. Furthermore,
we will briefly explain how it relates to parallel computing and how parallel computing plays a significant role in driving the
implementation of the neural network.
Group Members
1. Shervin Tafreshipour
2. Parsa Jalilifar
3. Novell Rasam
Progress
Intro to Neural Networks
Artificial intelligence is an umbrella term with many levels. Machine learning is a subset of AI that focuses on these self-teaching algorithms. Deep learning is a further subset of machine learning where multi-layered artificial neural networks are employed to allow for more versatile, independent learning [1]. Machine learning algorithms that do not utilize deep learning would be less versatile in what they could learn and would need more hand-holding by programmers. A handy infographic is shown below:
Implementation of Neural Network
In order to implement a Convolutional Neural Network in python, there are several key steps we need to follow:
1. Import the required modules to implement and train the neural network.
import torch import torchvision from torchvision import transforms, datasets
2. Download the needed datasets from the MNIST API, partition them to feasible data
train = datasets.MNIST(, train = True, download = True, transform=transforms.Compose([transforms.ToTensor()])) test = datasets.MNIST(, train = False, download = True, transform=transforms.Compose([transforms.ToTensor()]))
trainset = torch.utils.data.DataLoader(train, batch_size = 10, shuffle = True) testset = torch.utils.data.DataLoader(test, batch_size = 10, shuffle = False)
Getting Started With Jupyter lab
What is Jupyter Notebook?
This is basically a way for us to run the code interactively within a web browser alongside some visualizations and some markdown text to explain the process of what is going on.
User Interaction Model
Installation methods
- Anaconda
- pip
- Vs code by using plugin (best)
In order to do Jupyter code, the easiest way is using plugin in vs code to install anaconda but if you don’t like environment of vs code IDE to do coding, you can install anaconda directly on your pc. This gives you chance to code on browser or use suggested IDES by anaconda. Also, pip can be used which is a package-management system written in Python used to install and manage software packages.
Installing PyTorch
The following instructions are guidelines directed at installing the PyTorch framework for Ubuntu Linux, Mac OS, and Windows using the Python Package Manager.
1. Ubuntu Linux:
pip install torchvision
2. Mac OS:
pip install torch torchvision torchaudio
3. Windows:
pip install torch===1.7.0 torchvision===0.8.1 torchaudio===0.7.0 -f https://download.pytorch.org/whl/torch_stable.html