paint-brush
How To Make AI That Classifies Dog Breedsby@maniksoni653
2,417 reads
2,417 reads

How To Make AI That Classifies Dog Breeds

by Manik SoniJuly 26th, 2018
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

<strong>Kingdom</strong>:<a href="https://en.wikipedia.org/wiki/Animal" title="Animal" target="_blank">Animalia</a>, <strong>Phylum</strong>:<a href="https://en.wikipedia.org/wiki/Chordate" title="Chordate" target="_blank">Chordata</a>, <strong>Class</strong>:<a href="https://en.wikipedia.org/wiki/Mammal" title="Mammal" target="_blank">Mammalia</a>,<strong> Order</strong>:<a href="https://en.wikipedia.org/wiki/Carnivora" title="Carnivora" target="_blank">Carnivora</a>, <strong>Family</strong>:<a href="https://en.wikipedia.org/wiki/Canidae" title="Canidae" target="_blank">Canidae</a>, <strong>Genus</strong>:<a href="https://en.wikipedia.org/wiki/Canis" title="Canis" target="_blank"><em>Canis</em></a><em>, </em><strong>Species</strong>:<a href="https://en.wikipedia.org/wiki/Gray_wolf" title="Gray wolf" target="_blank"><em>C. lupus</em></a><em>, </em><strong>Subspecies</strong>:<strong><em>C. l. familiaris</em></strong>

People Mentioned

Mention Thumbnail

Company Mentioned

Mention Thumbnail
featured image - How To Make AI That Classifies Dog Breeds
Manik Soni HackerNoon profile picture

Love dogs?

Kingdom:Animalia, Phylum:Chordata, Class:Mammalia, Order:Carnivora, Family:Canidae, Genus:Canis, Species:C. lupus, Subspecies:C. l. familiaris

The relationship between people and dogs goes back at least 15,000 years, making dogs potentially the first animal to be domesticated. In that time, dogs have played many roles and performed many jobs for their human companions. Dogs come in a startling variety of shapes and sizes, but from the giant and noble Great Dane to the tiny and tenacious Chihuahua, they are all one species with one basic history.

In this article, we’ll explore how we can use AI to classify different breeds of dogs, from tall to short, from cute to agressive the easiest way.

We’re going to use Deep Learning Studio to classify different breeds of Dogs. If you’re unaware of Deep Learning Studio do check my medium article…


Iris genus classification|DeepCognition| Azure ML studio_Kingdom:Plantae Clade:Angiosperms Order:Asparagales Family:Iridaceae Subfamily:Iridoideae Tribe:Irideae Genus:Iris_towardsdatascience.com

Dataset

We’re going to use Stanford Dogs dataset which contains images of 120 distinct breeds of dogs. The dataset contains 10222 overall images of dogs. You need to upload the dataset in your account after altering it according to Deep Learning Studio. Don’t worry, I have done it for you. Download the dataset from my github repo and directly upload it to your deep cognition’s account.

Some images from our Dataset:

Left:Afghan Hound, Right:Briard

Let’s get started by uploading the dataset:

Uploading the dataset

Create New Project:

•Create a new project and name it as ‘Dog breeds classification’.

Create new project

Choose the uploaded the dataset in ‘Datasets’ tab

Model

Now, here comes the heart of this project. But with Deep Learning Studio, this is the easiest part. We’ll just use 4 layers to classify the breeds of Dogs and get upto 88% accuracy. Let’s see how!

Left:Model Architecture, Right:Complete view

We’ll use WideResNet to classify our dataset. You can just drag-drop the Pre-trained WideResNet model from the left pane and you’re done!! Did you see how simple is that!?

Hyperparameters:

For any Deep Learning model, hyperparameters plays a major role. For this problem we’ll Adam Optimizer with categorical_crossentropy as loss function.

We are using categorical cross entropy as loss function because we have categorical output(any one out of 120 breeds) with 25 epochs.

Hyperparameters

Training

Let’s start training the model:

Press the ‘start training’ button to start training. Deep Cognition provides you 2hrs of free usage of GPUs. Start any one of the GPU instance to train the model. GPUs help training the model faster.

Left: training loss, Right:Training Accuracy

Did you see how easy it is to create an AI using Deep Learning Studio.

Want to deploy it in market?! No problem! Let’s go to DLS’s deploy tab to generate a WebApp automatically.

Deploying our model for usage

Let’s check our model with any input

Let’s choose an Afghan Hound’s photo from our dataset and see our model predicts correctly.

Model correctly predicts Afghan Hound with an accurcay of 99.99%.

Yo! So our model works perfectly fine. We could still improve the accuracy of our model but this was for demonstration purpose. Try out yourself with different model architecture and hyperparameters.

Thanks for reading! If you liked this article, do clap 👏 and follow me on LinkedIn and Medium. Thanks.


Manik Soni - Machine Learning Researcher - Self-Employed | LinkedIn_View Manik Soni's profile on LinkedIn, the world's largest professional community. Manik has 2 jobs listed on their…_www.linkedin.com


Manik Soni - Medium_Read writing from Manik Soni on Medium. Machine Learning Researcher. Every day, Manik Soni and thousands of other…_medium.com

Happy Deep Learning.