- In this project I train an image classifier to recognize different species of flowers among 102 flower categories.
- Use the trained classifier to predict image content of top-K predictions
- Develope a Command Line Application to allows users to set hyperparameters for learning rate, number of hidden units, training epochs, GPU/CPU
- Python 3.x
- Numpy
- PyTorch
- PIL
- json
- matplotlib
- collections
- Jupyter notebook file:
Image Classifier Project_july01_2018_submit - html file of Jupyter notebook:
Image Classifier Project_july01_2018_submit.html - Image folder (
assets): containing figures in the notebook - A json file:
cat_to_name.jsoncontaining a dictionary that translate folder name to flower name - A helper file:
workspace_utils.pycontainingactive_sessionfunction that used to avoid disconnecting program during long run - Two Python file:
train_submission.pyandpredict_submission.pyfor train and prediction using command line for Image classifier - Two txt file :
sample_train_in_out.txtandsample_predict_in_out.txtcontaing a successful printout oftrain.pyandpredict.pyin the output - MIT License file
- Clone the repository use:
git clone https://github.com/ania4data/Developing_AI_application_for_classification.git
Train the network on the dataset
- Basic usage: python
train_submission.pydata_directory - Prints out training loss, validation loss, and validation accuracy as the network trains
- Set directory to save checkpoints: python
train_submission.pydata_dir --save_dir save_directory - Choose architecture: python
train_submission.pydata_dir --arch "resnet152" - Set hyperparameters: python
train_submission.pydata_dir --learning_rate 0.01 --hidden_units 512 --epochs 20 - Use GPU for training: python
train_submission.pydata_dir --gpu
Predict flower name from an image with predict_submission.py along with the probability of that name.
- Basic usage: python
predict_submission.py/path/to/image checkpoint_from_training - Return top K most likely classes: python
predict_submission.pyinput checkpoint_from_training --top_k 3 - Use a mapping of categories to real names: python
predict_submission.pyinput checkpoint_from_training --category_names cat_to_name.json - Use GPU for inference: python
predict_submission.pyinput checkpoint_from_training --gpu
The zipped 102flowers.tgz file can be downloaded from download section of Visual Geometry Group in Oxford University website:
