All Projects → stormy-ua → Dog Breeds Classification

stormy-ua / Dog Breeds Classification

Set of scripts and data for reproducing dog breed classification model training, analysis, and inference.

Projects that are alternatives of or similar to Dog Breeds Classification

Dogs vs cats
猫狗大战
Stars: ✭ 570 (+442.86%)
Mutual labels:  kaggle, jupyter-notebook, inception
Healthcheck
Health Check ✔ is a Machine Learning Web Application made using Flask that can predict mainly three diseases i.e. Diabetes, Heart Disease, and Cancer.
Stars: ✭ 35 (-66.67%)
Mutual labels:  kaggle, jupyter-notebook
Kaggle Web Traffic Time Series Forecasting
Solution to Kaggle - Web Traffic Time Series Forecasting
Stars: ✭ 29 (-72.38%)
Mutual labels:  kaggle, jupyter-notebook
Fraud Detection
Credit Card Fraud Detection using ML: IEEE style paper + Jupyter Notebook
Stars: ✭ 58 (-44.76%)
Mutual labels:  kaggle, jupyter-notebook
4th Place Home Credit Default Risk
Codes and dashboards for 4th place solution for Kaggle's Home Credit Default Risk competition
Stars: ✭ 23 (-78.1%)
Mutual labels:  kaggle, jupyter-notebook
Kaggle Carvana Image Masking Challenge
Top 15% ranked solution to the Carvana Image Masking Challenge on Kaggle
Stars: ✭ 13 (-87.62%)
Mutual labels:  kaggle, jupyter-notebook
Lung Diseases Classifier
Diseases Detection from NIH Chest X-ray data
Stars: ✭ 52 (-50.48%)
Mutual labels:  kaggle, jupyter-notebook
Entity Embedding Rossmann
Stars: ✭ 758 (+621.9%)
Mutual labels:  kaggle, jupyter-notebook
My Journey In The Data Science World
📢 Ready to learn or review your knowledge!
Stars: ✭ 1,175 (+1019.05%)
Mutual labels:  kaggle, jupyter-notebook
Allstate capstone
Allstate Kaggle Competition ML Capstone Project
Stars: ✭ 72 (-31.43%)
Mutual labels:  kaggle, jupyter-notebook
Kaggle Notebooks
Sample notebooks for Kaggle competitions
Stars: ✭ 77 (-26.67%)
Mutual labels:  kaggle, jupyter-notebook
Deepfake Detection
DeepFake Detection: Detect the video is fake or not using InceptionResNetV2.
Stars: ✭ 23 (-78.1%)
Mutual labels:  kaggle, jupyter-notebook
Webinar Titanic
Stars: ✭ 16 (-84.76%)
Mutual labels:  kaggle, jupyter-notebook
Interview
Interview = 简历指南 + LeetCode + Kaggle
Stars: ✭ 7,207 (+6763.81%)
Mutual labels:  kaggle, jupyter-notebook
Face Mask Detection
Face Mask Detection system based on computer vision and deep learning using OpenCV and Tensorflow/Keras
Stars: ✭ 774 (+637.14%)
Mutual labels:  kaggle, jupyter-notebook
Machinelearningcourse
A collection of notebooks of my Machine Learning class written in python 3
Stars: ✭ 35 (-66.67%)
Mutual labels:  kaggle, jupyter-notebook
Deep Learning Boot Camp
A community run, 5-day PyTorch Deep Learning Bootcamp
Stars: ✭ 1,270 (+1109.52%)
Mutual labels:  kaggle, jupyter-notebook
Deep Recommender System
深度学习在推荐系统中的应用及论文小结。
Stars: ✭ 657 (+525.71%)
Mutual labels:  kaggle, jupyter-notebook
Keras Idiomatic Programmer
Books, Presentations, Workshops, Notebook Labs, and Model Zoo for Software Engineers and Data Scientists wanting to learn the TF.Keras Machine Learning framework
Stars: ✭ 720 (+585.71%)
Mutual labels:  jupyter-notebook, inception
Pneumonia Detection From Chest X Ray Images With Deep Learning
Detecting Pneumonia in Chest X-ray Images using Convolutional Neural Network and Pretrained Models
Stars: ✭ 64 (-39.05%)
Mutual labels:  jupyter-notebook, inception

Dog Breeds Classification

This repo is intended to contain a set of scripts and data for reproducing dog breed classification model training, analysis, and inference.

preview

Prerequisites

  1. Install Python 2.7
  2. Install all required python dependencies: pip install -r requirements.txt

Download Data

  1. cd to this repo root directory
  2. Execute setup script: sh ./setup/setup.sh. In its turn the script executes the following other scripts:
    • Creates all required directories: sh ./create_dirs.sh
    • Downloads Google Inception model: sh ./inception_download.sh. The link to the frozen TensorFlow model is taken from here
    • Downloads Stanford Dogs Dataset: sh ./download_stanford_dogs_dataset.sh

Prepare Data

  1. Convert downloaded Stanford Dogs Dataset to TensorFlow friendly TFRecords file: python -m src.data_preparation.stanford_ds_to_tfrecords

Train

This section describes how to build dog breed classification dense neural network model on top of the pre-trained by Google deep neural network (namely Inception model).

  1. Give a name to the model your are going to train by assigning a name to CURRENT_MODEL_NAME variable in consts.py script
  2. Configure number of layers and number of units in each layer by setting HEAD_MODEL_LAYERS variable in consts.py
  3. Train the model: python -m src.training.train. It might take 25-35 minutes depending on the depth of your model and number of epochs (which could be configured in the train.py script itself). TensorBoard could be used to observe the training process: tensorboard --logdir=./summary

Freeze Model

  1. Freeze the model: python -m src.freezing.freeze. This will bind Inception model with the trained on the previous step "head" model and serialize it as a TensorFlow graph with variables represented as constants. This frozen model will be ready to use for classification tasks.

Analyze

  1. Produce CSV file with predicted vs actual breed. This could be used to analyze precision on the training data e.g. plot a confusion matrix (see Confusion.ipynb). Result CSV file goes to metrics/training_confusion.csv: python -m src.analysis.training_perf_analysis

Infer

  1. Use the model frozen on the previous step to classify an image either available on the filesystem or downloadable as an HTTP resource:

python -m src.inference.classify uri https://raw.githubusercontent.com/stormy-ua/dog-breeds-classification/master/images/shih-tzu.jpg

python -m src.inference.classify file images/airedale.jpg

In my case the model was training for 25 mins (5000 epochs) and the following sample classification outputs were produced:

airedale

(Image is taken from http://dogtime.com/dog-breeds/airedale-terrier)

breed probability
airedale 0.992064
otterhound 0.005108
chesapeake_bay_retriever 0.001259
irish_terrier 0.000635
wire-haired_fox_terrier 0.000378

shi-tzu

(Image is taken from http://dogtime.com/dog-breeds/shih-tzu)

breed probability
shih-tzu 0.752834
lhasa 0.234748
tibetan_terrier 0.007598
maltese_dog 0.000969
japanese_spaniel 0.000936

These examples also available in the Inference.ipynb Python notebook.

Have a fun!

Running in Docker

The already pre-built model w/ all the scripts and Python notebooks for inference are available in the docker container. Run the container:

docker run -p 8888:8888 -p 6006:6006 kirillpanarin/dog_breed_classification

Navigate a browser to http://localhost:8888/notebooks/Inference.ipynb and you will be all set for doing inference against real-life dog images.

Kagle Dog Breed Classification Competition

This model ranked #3 in the Kaggle's Dog Breed Classification Challenge.

kaggle

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].