Cartoon or Anime?

4483468-3951237824-33456

I decided to try image classifier after installing tensorflow

Siraj Raval’s video & Google’s Codelab tutorial is good stuff to begin with.
I came to know following.

Docker is a tool designed to make it easier to create, deploy, and run applications by using containers. Containers allow a developer to package up an application with all of the parts it needs, such as libraries and other dependencies, and ship it all out as one package.

Here, I don’t need it as I have installed tensorflow successfully. So I just need bunch of images, retrain the last layer of inception model and I’m done with it!

Inception is pre-trained deep learning model. It has been developed by Google and has been trained for the ImageNet Competition using the data from 2012. This model has high classification performance and it is easily available in TensorFlow.

I have created two folders. One with all cartoon images and other with all anime images.

Retrain.py python script scanned all the images and created bottlenecks.

A “Bottleneck”, is  final output layer that actually does the classification. As, near the output, the representation is much more compact than in the main body of the network.

Actual Training begins after generting bottlenecks.

As it trains you’ll see a series of step outputs, each one showing training accuracy, validation accuracy, and the cross entropy:

The training accuracy shows the percentage of the images used in the current training batch that were labeled with the correct class.

Validation accuracy: The validation accuracy is the precision (percentage of correctly-labelled images) on a randomly-selected group of images from a different set.

Cross entropy is a loss function that gives a glimpse into how well the learning process is progressing (lower numbers are better here).

 

Once done, I used  label_image.py and pleased with output. I ran this script on 10 test images and it guessed 7 images perfectly.

7 out of 10. Not bad! Not bad at all!

 

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s