GithubHelp home page GithubHelp logo

bilal-e / image-classifier Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 555 KB

Image Classifier Command Line App using PyTorch - Udacity Nanodegree Project

HTML 97.24% Python 2.76%
python3 pytorch deeplearning-framework jupyter-notebook vscode commandline-interface anaconda-environment numpy pandas matplotlib image-processing datatransformation prediction-model supervised-learning hyperparameter-tuning

image-classifier's Introduction

Image Classifier Command Line Application


TRAINING (train.py)


PURPOSE:

Train a dataset on a new network (models to be used: vgg or densenet);

Output Training loss, Validation loss, Validation accuracy, and Best value accuracy

Saves checkpoint to file 'model_checkpoint.pth'


EXPECTED USER INPUT:

python train.py --train_dir 'path to desired directory for training' --arch 'model(vgg or densenet)'

--lr 'learning rate for training(float)' --hidden_units 'hidden units for training(int)'

--epochs 'epochs for training(int)' --gpu 'train on gpu'


EXAMPLE CALL:

python train.py --train_dir '/dir' --arch vgg --lr 0.005 --hidden_units 1024 --epochs 30 --gpu cuda



PREDICTION (predict.py)


PURPOSE:

Reads in an image and a checkpoint to predict image class

Prints the top-k probability with class name


EXPECTED USER INPUT:

python predict.py --arch 'vgg or densenet (since there is only one checkpoint file that this application generates

based on the training model; choose the same model as of training to avoid mismatch)'

--img_path 'complete path of image to be predicted' --lr 'learning rate used when training(float)'

--hidden_units 'hidden units used when training(int)' --top_k 'required no. of top K classes(int)'

--print_k '1 prints a list of top_k; 0 prints only max probability' --json_file 'complete path to category names file'


CHECKPOINT FILE:

'model_checkpoint.pth', created by train.py


EXAMPLE CALL

python predict.py --arch vgg --img_path /predict_img.jpg --lr 0.005 --hidden_units 1024 --top_k 3 --print_k 1


Tested on 102 flower categories

Model probability accuracy > 0.8

image-classifier's People

Contributors

bilal-e avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.