Image classification (persons, animals, other) on raspberry pi from pi-camera (with cycle while) using custom model .h5 (output to terminal) using TensorFlow

Alex G.
2 min readNov 18, 2020

--

Image classification (persons, animals, other) on raspberry pi from pi-camera (with cycle while) using custom model .h5 (output to terminal) (Photo,GIF by Author) https://github.com/oleksandr-g-rock/classify_picamera_with_while_cusom_model/blob/main/0_tyyzq1CGQgqOrCVg.gif

Short summary:

In this article, I will explain how to create image classification (persons, animals, other) on raspberry pi from pi-camera (with cycle while) using custom model .h5 (output to terminal). All code is located here.

Note before you start:

So, Let’s start :)

Hardware preparation:

Software preparation:

1 Create a neural network model to predict 3 classes persons, animals, others.

I have already done it in the article below. So in this article, you do NOT NEED to DO IT.

2 So, let's implement our model to image classification (persons, animals, other) on raspberry pi from pi-camera (with cycle while) using custom model .h5 (output to terminal)

For that, you need to run the next code:

#install Tensorflow Lite
pip3 install https://github.com/google-coral/pycoral/releases/download/release-frogfish/tflite_runtime-2.5.0-cp37-cp37m-linux_armv7l.whl
#clone repo with my code
git clone https://github.com/oleksandr-g-rock/classify_picamera_with_while_cusom_model.git
#go to direcory
cd classify_picamera_with_while_cusom_model
#copy h5 custom model
wget https://github.com/oleksandr-g-rock/create-image-classification-for-recognizing-persons-animals-others/raw/main/animall_person_other_v2_fine_tuned.h5
#run script
python3 classify_picamera_with_while.py

3 You should see something like that.

Image classification (persons, animals, other) on raspberry pi from pi-camera (with cycle while) using custom model .h5 (output to terminal) (Photo,GIF by Author) https://github.com/oleksandr-g-rock/classify_picamera_with_while_cusom_model/blob/main/0_tyyzq1CGQgqOrCVg.gif

Result:

In this article, we created image classification (persons, animals, other) on raspberry pi from pi-camera (with cycle while) using custom model .h5 (output to terminal). All code is located here.

--

--

Alex G.
Alex G.

Written by Alex G.

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

No responses yet