Manik Soni


How To Make AI That Classifies Dog Breeds

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…


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

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!?


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.


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.

Happy Deep Learning.

More by Manik Soni

Topics of interest

More Related Stories