Image classification (persons, animals, other) on raspberry pi from pi-camera (with cycle while) using custom tflite model (output to terminal), TensorFlow Lite
Short summary:
In this article, I will explain how to create a solution for image classification (persons, animals, other) on raspberry pi from pi-camera (with cycle while) using custom tflite model (output to terminal).
I will use a custom model tflite which I converted from h5.
And all results will be shown in the terminal. Code for this article is available 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 Convert h5 model to tflite model
I have already done it in the article below. So in this article, you do NOT NEED to DO IT.
3 So, let’s implement our model to image classification (persons, animals, other) on raspberry pi from pi-camera (with cycle while) used custom tflite model (output to terminal)
For that, you need to run the next code:
#clone my repo
git clone https://github.com/oleksandr-g-rock/image_classify_tflite_camera_pi_while.git#go to folder
cd image_classify_tflite_camera_pi_while#download tflite model
wget https://github.com/oleksandr-g-rock/how_to_convert_h5_model_to_tflite/raw/main/animall_person_other_v2_fine_tuned.tflite#run script
python3 classify_picamera_with_while_used_tflite.py
4 You should see something like that.
Result:
In this article, we created image classification (persons, animals, other) on raspberry pi from pi-camera (with cycle while) using custom tflite model (output to terminal). All code located here.