Git Product home page Git Product logo

manaralharbi / aipnd-image_classifier Goto Github PK

View Code? Open in Web Editor NEW
0.0 3.0 0.0 1.08 MB

Build a Python application that can train an image classifier on a dataset, then predict new images using the trained model.

Python 1.28% HTML 73.20% Jupyter Notebook 25.51%
artificial-intelligence udacity-artificial-intelligence jupyter-notebook gpu torchvision image-classifier python-application pytorch pretrained-models vgg

aipnd-image_classifier's Introduction

Image Classifier

Table of Contents

  1. Project Motivation
  2. File Descriptions
  3. Required Libraries
  4. Instructions
  5. Results

Project Motivation

Image Classifier Project is a requirement to complete the AI Programming with Python Nanodegree Program of udacity academy.

The project goal is to build a Python application that can train an image classifier on a dataset, then predicts new images using the trained model. For this purpose, I built and trained an image classifier to recognize different species of flowers. I used this dataset of 102 flower categories, you can see a few examples below.

The project is broken down into multiple steps:

  • Load and preprocess the image dataset
  • Train the image classifier on your dataset
  • Use the trained classifier to predict image content

File Descriptions

  • Image Classifier Project.ipynb: a Jupyter notebook, contains the whole project code to build and train an image classifier.
  • train.py: trains a new network on a dataset and saves the model as a checkpoint.
  • predict.py: uses a trained network to predict the class for an input image.
  • cat_to_name.json: a JSON object which gives you a dictionary mapping the integer encoded categories to the actual names of the flowers.

Required Libraries

Instructions

  • Train a new network on a data set with train.py

    • Basic usage: python train.py data_directory
    • Prints out training loss, validation loss, and validation accuracy as the network trains
    • Options:
      • 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
  • 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 K most likely classes: python 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: : Use GPU for inference: python predict.py input checkpoint --gpu

Results

  • The testing accuracy of the trained network on the 10000 test images is 89%.
  • For sanity checking, I tested the trained network on the english marigold flower, and returned the top 5 classes. As a result, it gave the correct class, the highest probability.

aipnd-image_classifier's People

Contributors

manaralharbi avatar

Watchers

 avatar  avatar  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.