/Image_classifier_AI_Project

This is my final project for AI Programming with Python Nanodegree. This model can classify the flowers category with prescribed labels. The two python files predict and the train is for the command-line tool. In the command line it takes some arguments and then performs specific actions

Primary LanguageJupyter Notebook

Flower Image Classifier

In this project, i have created deep learning network to classify flowers per the labels provided. This was a submission project for a AI course provided by Udacity. The project is divided into two parts

1) We select an Neural Network architecture and train it for a centrain number of times using GPU and then saves the model for further use.

2) We load the saved model and provide it with an image to for testing the classification model. The project also utilizes transfer learning to import already trained classifiers from the PyTorch package while modifying the classifier attribute of each package.

Files Included

These are the files included as part of the project and what each contains:

  1. Image Classifier Project.ipynb: This is the Jupyter notebook where I conducted all my activities, including a little more than what is included in the predict.py and train.py files.
  2. Image Classifier Project.html: Same as the file above, except in HTML form.
  3. train.py: This file accepts inputs from the command line prompt and takes the work from the Jupyter notebook for the following activities:
    • Creating the Datasets
    • Creating the Architecture
    • Training the model
    • Saving the Model
  4. predict.py: This file accepts inputs from the command line prompt and takes the work from the Jupyter notebook for the following activities
    • Loading the Model
    • Class Prediction

Instructions for running the classifier

  1. Train a new network on a data set with train.py
    • Basic usage: python train.py (file should be in data_directory)
    • Prints out training loss, validation loss, and validation accuracy as the network trains
    • Other params for different purpose:
      • Set directory to save checkpoints :"python train.py data_dir --save_dir save_directory"
      • Choose architecture :"python train.py data_dir --arch "vgg13" "
      • Set hyperparameters :"python train.py data_dir --learning_rate 0.01 --hidden_units 512 --epochs 20"
      • Use GPU for training :"python train.py data_dir --gpu"
  2. Predict flower name from an image with predict.py along with the probability of that name. That is, you'll pass in a single image /path/to/image and return the flower name and class probability.
    • Basic usage: python predict.py /path/to/image checkpoint
    • Options:
      • Return top KK most likely classes :"predict.py input checkpoint --top_k 3"
      • Use a mapping of categories to real names :"python predict.py input checkpoint --category_names cat_to_name.json"
      • Use GPU for inference :"python predict.py input checkpoint --gpu"