Skip to content

BananuhBeatDown/image_classification

Repository files navigation

Classifying Images using a Neural Network

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.

Install

  • Python 3.6
    • I recommend installing Anaconda as it is alreay set up for machine learning
    • If unfamiliar with the command line there are graphical installs for macOS, Windows, and Linux
  • TensorFlow
  • tqdm

Dataset

The dataset is broken into batches to prevent your machine from running out of memory. 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

Parameters

image_recognition.py

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 = 5
helper.display_stats(cifar10_dataset_folder_path, batch_id, sample_id)

train_image_recognition.py

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 iterations
  • batch_size - set to highest number your machine has memory for using common memory sizes
  • keep_probability - probability of keeping node using dropout

Example Output

Command Line

python image_recognition.py

*You must press [enter] to continue after example image appears.

python train_image_recognition.py

License

The image_classification program is a public domain work, dedicated using CC0 1.0. I encourage you to use it, and enhance your understanding of CNNs and the deep learning concepts therein. :)

Releases

No releases published

Packages

No packages published