This program classifies images from the CIFAR-10 dataset using a Convolutional Neural Network (CNN). The images are preprocessed and normalized then used to train a CNN consisting of convolutional, max pooling, dropout, fully connected, and output layers.
In-depth analysis and examples can be found in dlnd_image_classification.ipynb.
- Python 3.7
- TensorFlow 2.0
- tqdm
- numpy
- sklearn
The CIFAR-10 dataset consists of 5 batches, named data_batch_1
, data_batch_2
, etc.. Each batch contains the labels and images that are one of the following:
- airplane
- automobile
- bird
- cat
- deer
- dog
- frog
- horse
- ship
- truck
You can view different example of the CIFAR-10 dataset by changing the values of the batch_id
and the sample_id
:
batch_id
- id for a batch (1-5)sample_id
- id for a image and label pair in the batch
batch_id = 1
sample_id = 10
helper.display_stats(cifar10_dataset_folder_path, batch_id, sample_id)
You can experiment with the CNN by altering:
depth
- Alter the depths of the CNN layers using common memory sizes- 64
- 128
- 256
- ...
epochs
- number of training iterationsbatch_size
- the number of training examples utilized in one iteration. Make sure to change this according to your system's memory and GPU capacitykeep_probability
- the probability of keeping node using dropout
Command Line
python image_recognition.py
*You must press [enter] to continue after example image appears.
python train_image_recognition.py
The image_classification program is a public domain work, dedicated to using CC0 1.0.