Temperature test of the raspberry pi 4 using TensorFlow & TensorFlow Lite

Alex G.
3 min readDec 21, 2020
Temperature test of the raspberry pi 4 using TensorFlow & TensorFlow Lite (Photo,GIF by Author) https://github.com/oleksandr-g-rock/flower_classification/blob/main/temperature.jpg

Short summary:

In this article, I will explain how to create a temperature test of the raspberry pi 4 using TensorFlow & TensorFlow Lite.
I will run image-classification of the raspberry pi 4 using TensorFlow & TensorFlow Lite in real-time from pi-camera.
I will be using raspberry pi 4 without any cooling or radiators.

Note before you start:

So, let’s start :)

Hardware preparation:

Software preparation:

1. At-first I will do a temperature test using TensorFlow image-classification in real-time from pi-camera.

For that, I will use the scripts from this article.

So for that test, I ran the following commands:

#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/How_to_create-image-classification-for-recognizing-persons-animals-others/raw/main/animall_person_other_v2_fine_tuned.h5
#run script for start image-classification using TensorFlow
python3 classify_picamera_with_live_time_custom_model.py
#open new terminal and run commnad for start temperature check
watch vcgencmd measure_temp

After 25 min using TensorFlow image-classification in real-time from pi-camera raspberry pi has warmed up to a maximum temperature of 64 degrees. So this is a good result.

2. In the next test I will do a temperature test using TensorFlow Lite image-classification in real-time from pi-camera.

For that, I will use the scripts from this article.

So for that test, I ran the following commands:

#clone my repo
git clone https://github.com/oleksandr-g-rock/image_classification_pi_camera_live_time_custom_model_tflite.git
#go to folder
cd image_classification_pi_camera_live_time_custom_model_tflite
#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_live_time_custom_tflite_model.py
#open new terminal and run commnad for start temperature check
watch vcgencmd measure_temp

After 25 min using TensorFlow Lite image-classification in real-time from pi-camera raspberry pi has warmed up to a maximum temperature of 61 degrees. The result is better than before.

Result:

So I tested raspberry pi 4 using TensorFlow & TensorFlow Lite for image-classification in real-time from pi-camera.
I used raspberry pi 4 without any cooling or radiators.
So after 25 minutes using TensorFlow result was: a maximum temperature of 64 degrees.
So after 25 minutes using TensorFlow Lite result was: a maximum temperature of 61 degrees.

And if you using raspberry pi 4 with TensorFlow & TensorFlow Lite for image-classification in real-time from pi-camera, you can use WITHOUT radiator or cooler, BUT but it would be better to use a heatsink or any passive cooling solution.

--

--

Alex G.

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