Create image classification for recognizing persons, animals, others. Using TensorFlow

Alex G.
2 min readDec 6, 2020

Short summary:

In this article, I will explain how to create image classification for recognizing persons, animals, others. In this article, I will use Colab . Code for this article is available here

So, Let’s start :)

At first, we need a dataset with the next classes:
- Person
- Animals
- Other

Let me describe what each class I mean:

  • In a first-class “person”, we should have any images of peoples but WITHOUT ANIMALS.
  • In the next class “animals”, we should have images with animals WITHOUT HUMAN.
    In this class, including images with the next classes:
    dog (different breeds), squirrel (different breeds), horse, chicken, cats, raccoon, deer.
  • In the last class “other”, we should have any images WITHOUT HUMAN AND ANIMAL.

I created a dataset with 113k. images with 3 classes which I described above.
This dataset was created from a lot of datasets Kaggle platform:

Person:

Animals:

Other:

I already created a notebook that already does this. But, if you want run this notebook in colab you need to create datasets manually.

You can just open a notebook in Colab and watch how model training :)

I created a model that has a result for NEW data: 0.008% for loss and 100.00% accuracy. I guess it’s a perfect result.

confusion matrix (Photo,GIF by Author) https://github.com/oleksandr-g-rock/How_to_create-image-classification-for-recognizing-persons-animals-others/blob/main/0_w1p1XToA7zVEMsAk.png

So link for the notebook here.

Also, I saved the best model file (with format h5) with the best result here.

Result:

- I created a model that has a result for NEW data: 0.008% for loss and 100.00% accuracy. I guess it’s a perfect result.
- link for the notebook here.
- Code for this article available here.
- I saved the best model file (with format h5) with the best result here.

--

--

Alex G.

ML DevOps engineer. 🙂 I am always open to new opportunities and offers. 🖖 I trying to help the world 🌏 with machine learning.