Main code: Classification.py
Full report: report.pdf
Python package used in implementation: PyTorch
Image source: CIFAR-10 dataset
To build a CNN to conduct a multi-class image classification task on the CIFAR-10 dataset using PyTorch.
-
Design a CNN such that
- ReLU is the activation function
- cross entropy loss is the loss function
- only consists of convolutional layers and fully-connected layers
- only contains 6 layers
-
Evaluate the classification performance using model accuracy on training and testing set.
Convolutional layer (in_channels = 3, out_channels = 8, kernel_size = 3)
=> ReLu => Maxpool
=> Convolutional layer (in_channels = 8, out_channels = 32, kernel_size = 2)
=> ReLu => Maxpool
=> Convolutional layer (in_channels = 32, out_channels = 64, kernel_size = 2)
=> ReLu => Maxpool
=> Fully-connected layer (in_channels = 64*3*3, out_channels = 256)
=> ReLU
=> Fully-connected layer (in_channels = 256, out_channels = 84)
=> ReLU
=> Fully-connected layer (in_channels = 84, out_channels = 10)
Training loss history:
Confusion matrix of testing set:
Average model accuracy on the training set is: 98.38%
Average model accuracy on the testing set is: 72.04%
Full report see: report.pdf