$29
*GPUs are not necessary for speeding up the neural network training process in this homework.
Description
In this homework you will practice writing a Neural Network classifier in Python using the Pytorch framework. You need to understand how a Neural Network classifier works, including back propagation and gradient descent in order to implement this homework successfully. The goal of this homework is:
• To implement and understand a Neural Network classifier.
• Get familiar with using pytorch.
Instruction
• The dataset used in this homework is CIFAR-10. You may need these packages: pytorch, torchvision, (for the CIFAR-10 dataset), NumPy, and OpenCV (for reading images). The commonly used classifiers are SoftMax and SVM.
• You are strongly recommended to use pytorch framework.
• You can add as many layers as you want, however, no convolutional layers are allowed. Optimization techniques such as mini-batch, batch normalization, dropout and regularization might be used.
• Requirements:
1. Contain a training function that will be called to train a model with the command
“python classify.py train”.
2. Save the model in a folder named “model” after finishing the training process.
3. Show the testing accuracy in each iteration of the training function. The test accuracy should be greater than or equal to 40% in the end using the CIFAR-10 dataset.
4. Implement a testing function that accepts the command “python classify.py test xxx.png” to test your model by loading it from the folder “model” created in the training step. The function should read “xxx.png” and predict the output. The output might not match the true image type because this type of classifiers cannot achieve high accuracy.
• Some hints to improve the accuracy:
Fall 2021
EECE 7398 HW 1
ST: Advances in Deep Learning
Due 10/15/2021
1. add more linear classifier layers (pay attention to the dimension of weights and biases);
2. apply batch normalization;
3. apply an activation function like ReLU between the layers;
4. use a powerful optimizer like Adam;
5. apply dropout and regularization.
Submission
• You need to submit a zip file including:
1. a python file named “classify.py”;
2. a generated model folder named “model”;
3. two screenshots of training and testing results.
• The “classify.py” file should be able to run with the following commands:
1. python classify.py train
to train your neural network classifier and generate a model in the model folder;
2. python classify.py test xxx.png
to predict the class of an image and display the prediction result.
• The zip file should be named using the following convention:
<Last-Name>_<First-Name>_HW1.zip
Ex: Bourne_Jason_HW1.zip
• Note:
Do not put any print function other than showing the results. Comment your code.
◦ You are strongly recommended to use pytorch framework.
Grading criteria
• Your model will be tested by running “python classify.py test xxx.png” with additional testing images. Please make sure your functions work correctly.
• The testing accuracy should be greater than or equal to 40% in the end. There will be 1-point deduction for every 1% of accuracy degradation based on 40%.
• Upload the zip file to Canvas before 11:59PM (EST Time) 10/15/2021.