Skip to content

Latest commit

 

History

History
43 lines (31 loc) · 2.31 KB

README.md

File metadata and controls

43 lines (31 loc) · 2.31 KB

Supervised Learning (Image classifier)

using TensorFlow and Keras

This project is part of the CharityML project for the Udacity course: Intro to Machine Learning with TensorFlow, and its github repository.

In this project, first a code for an image classifier is built with TensorFlow and a Keras model is generated, then it will be converted it into a command line application. the command line application takes an image and the trained Keras model, and then returns the top K most likely class labels along with the probabilities.

Goal

Classify images of flowers to 102 diffrent categories.

Data

A dataset from Oxford of 102 flower categories is used. This dataset has 1,020 images in the training and avaluation set, and 6,149 images in the test set.

Model

  • A MobileNet pre-trained network from TensorFlow Hub is used. The model is used without its last layer, and some fully connected layers with dropout is added sequentially to be trained on the data.

  • A model using Conv2D and some fully connected layers with dropout is added sequentially to be trained on the data.

Code

The code is provided in the finding_donors.ipynb notebook file. the visuals.py Python file and the census.csv dataset file is used.

Run

In a terminal or command window, navigate to the top-level project directory finding_donors/ (that contains this README) and run one of the following commands:

ipython notebook Project_Image_Classifier_Project.ipynb.ipynb

or

jupyter notebook Project_Image_Classifier_Project.ipynb.ipynb

This will open the iPython Notebook software and project file in your browser.

or for the python application run one of the follwoing:

python predict.py /path/to/image best_model
python predict.py /path/to/image best_model --top_k 5
python predict.py /path/to/image best_model --category_names label_map.json

It will print the top_k or 3 most probable predicted classes for the image. If the label_map.json is also given, the the name of each flower representing each class will be shown.