CS计算机代考程序代写 Keras algorithm python deep learning COMP9517 – Deep Learning

COMP9517 – Deep Learning
Deep Learning Homework
Week 9, T1 2021

The goal of this homework is to become familiar with the training/testing process for deep learning. You need to implement a CNN network using a small high resolution MNIST dataset.
Note: This is a homework for self-learning only, and you do not need to submit your implementations.

MNIST dataset
Our dataset contains 2000 MNIST images as training data and 500 MNIST images as testing data. All the images are high resolution (28 x 28) with corresponding labels ranging from 0 to 9, and were designed to test classification algorithms.
Sample of 10 different digits images and their corresponding labels.

Lab Task – Build a CNN network for image classification
Develop a program to perform digit recognition by using a deep learning method. To classify the digits using your own CNN network, you also need to complete the main function for training and testing processes. The program has two versions: PyTorch and Keras. You may complete any one of them. The steps as follows:

Set Up
• Load MNIST data set

Preprocessing data
• Data Normalization: which can make your network more efficient
• Transform data into PyTorch tensor(if you use PyTorch)

Build your own CNN network
• Complete your CNN network
• Define your hyperparameters, e.g. learning rate
• Define your optimizer and loss function(criterion).

Complete PlotLearningCurve function
• You need to complete PlotLearningCurve function, the template result sees below.

Main Process for training and testing
• Define the number of iterations (50 ~ 100 is enough for PyTorch, 20 ~ 50 is enough for Keras)
• Fit training data to your model
• Model evaluation by using testing data
• Plot learning curve

If you use PyTorch, you need complete below part before you do model evaluation:
• Calculate your loss
• Calculate backpropagation
• Update network parameters
• Reset your optimizer
• During training, you need to store your loss of training error and testing error

You are encouraged to experiment with different hyperparameters, e.g. different learning rates can show different results, a suitable learning rate can make your model learning more efficiently and effectively.

Task one:
Plot the learning curve, the number of epochs is not important. In the learning curve, you can see whether your model is underfitting or overfitting. The template result is below:

Task two:
• For PyTorch version:
Print the testing accuracy every 10 epochs. Your final test accuracy needs to be great than 90%.
An example can be seen here:

• For Keras version:
Use “model.evaluate” to obtain your final testing accuracy. Your final test accuracy needs to be great than 90%.
An example can be seen here:

Reference
Keras: https://www.datacamp.com/community/tutorials/deep-learning-python
Pytorch: https://nextjournal.com/gkoehler/pytorch-mnist