Image classification (persons, animals, other) on raspberry pi from pi-camera (in live time) using custom model .h5 (output to terminal), using TensorFlow
Short summary:
In this article, I will explain how to create image classification (persons, animals, other) on raspberry pi from pi-camera (in live time) using custom model .h5 (output to terminal). The full 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 this.
2 Try to predict class from camera raspberry pi in live time with output to the terminal using Tensorflow Lite and custom model .h5 (which I trained and saved above).
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_in_live_time_cusom_model.git#go to direcory
cd classify_picamera_in_live_time_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_live_time_custom_model.py
3 You should see something like that.
Result:
In this article, we have created image classification (persons, animals, other) on raspberry pi from pi-camera (in live time) used custom model .h5 (output to terminal). The full code is located here.