Blue Navigation Bar



Train Convolutional Neural Networks

Students are encouraged to use any Python framework and publicly available source code. Please credit and cite all references in your report. It is recommended to start work on this project as soon as possible to give yourself time.

Problem 1 (Train FC on MNIST)

This task consists of training a convolutional network to classify handwritten digits. Please write code to the following.


Figure 1: Neural network with one hidden layer of 1000 nodes. The 10 neurons in the output layer are Identity neurons; there is no nonlinearity. Each $y_i$ is just the weighted sum of the inputs to the Identity neuron. Note that $z_i = \frac{e^{y_i}}{e^{y_0} + e^{y_1} + \ldots + e^{y_9}}$ is the soft-max output.

Task 1.2 Train A Convolutional Neural Network

Task 1. 3 Permuted Images


Figure 1: Example of original and permuted MNIST image

Figure 2: Example of original and permuted MNIST image

Problem 2:

2.1 Train RESNET-18 Architecture

2.2: Train RESNET-18 Architecture on Permuted Dataset

# freeze the seed, read more about the what it does to random sequence generation
np.random.seed(0)
num = random.randint(0, len(X_train))
plt.imshow(X_train[num], cmap='gray', interpolation='none')
plt.title("Class {}".format(y_train[num]))
test=X_train[num]
test.reshape(-1)
permuted_test=np.random.permutation(test)
permuted_test.reshape((28,28))
plt.subplot(2,2,2)
plt.xticks([])
plt.yticks([])
plt.imshow(permuted_test, cmap='gray', interpolation='none')
plt.title("Permuted Class {}".format(y_train[num]))
plt.tight_layout()

References

  1. Convnet Size Calculator. URL.

  2. Deep Residual Learning for Image Recognition. arXiv.

  3. MNIST Tutorials. PyTorch Lightning.

  4. Overview of CNNs. CS231n.

  5. PyTorch Tutorials. PyTorch.

  6. Stack Overflow Post on CNN. Stack Overflow.