This project is a comparison between MLP and CNN for the CIFAR-10 dataset. The CIFAR-10 dataset consists of 60000 32x32 colour images in 10 classes, with 6000 images per class. There are 50000 training images and 10000 test images. The dataset is divided into five training batches and one test batch, each with 10000 images. The test batch contains exactly 1000 randomly-selected images from each class. The training batches contain the remaining images in random order, but some training batches may contain more images from one class than another. Between them, the training batches contain exactly 5000 images from each class.
- Python 3.6
- Numpy
- Matplotlib
- Tensorflow
- Keras
- First install the required libraries using the following command:
pip install -r requirements.txt
- Run the following command to train the MLP model:
python mlp.py
- Run the following command to train the CNN model:
python cnn.py
The MLP model achieved an accuracy of 50% on the test set, while the CNN model achieved an accuracy of 75% on the test set.
The CNN model outperformed the MLP model on the CIFAR-10 dataset. This is because CNNs are able to capture spatial information in the images, which is important for image classification tasks.