In this series, I will be discussing some training models and techniques on the CIFAR100 dataset using tensorflow. Since this is the first part, we will put some ground work, like downloading, extracting, preprocessing, and saving the dataset for training. In the next tutorial, we will begin the training using a simple CNN. And as the series goes on, we will investigate some modifications like (DropBlocks, Resnets, Depthwise convolutions, Self attention)
Environment Used:
Python 3.6.1
Tensorflow 1.10
imgaug 0.2.8
opencv-python 4.0.0
Problem formulation and dataset info
Given a blurry image, the task is to classify it into one of the 100 classes in CIFAR-100.
The dataset consists of 60000 32x32 colour images in 100 classes, with 600 images per class. There are 50000 training images and 10000 test images.
This script will begin to download the CIFAR100 dataset in the project folder
If the download is successful, run the following script to extract the dataset
Now we are ready to start the dataset preprocessing
Dataset preprocessing and saving
The first thing we should do is to load the dataset:
Now we have the training and test sets loaded into their respective variables, and we also load the meta data which holds information like label index name.
Next we need to reformat the images and shuffle the training set
If you take a look at the images in the dataset, you will notice how blurry they are. So let’s try to combat that by applying an unsharp_masking_kernel to sharpen the blurry images
Now I know what you are thinking… We should normalize the values to be between [-1, 1] or something similar. And you are right, but we will do it during the training to make data augmentation easier.
With that out of the way, the only thing we have left is to save the data.
Now we should be ready for training, which will be done in the next part of the series. If you want to check the full state of the project until now click here to go the repository.
See you in part_2.