An open API service indexing awesome lists of open source software.

https://github.com/qengineering/tensorflow_lite_classification_rpi_64-bits

TensorFlow Lite classification on a bare Raspberry Pi 4 with 64-bit OS at 23 FPS
https://github.com/qengineering/tensorflow_lite_classification_rpi_64-bits

aarch64 armv7 armv8 bare-raspberry-pi cpp deep-learning high-fps inception inceptionv2 inceptionv4 lite mobilenet raspberry-pi-4 tensorflow-examples tensorflow-lite testtensorflow-lite ubuntu1804

Last synced: about 2 months ago
JSON representation

TensorFlow Lite classification on a bare Raspberry Pi 4 with 64-bit OS at 23 FPS

Awesome Lists containing this project

README

        

![output image](https://qengineering.eu/images/SDcard16GB_tiny.jpg) Find this example on our [SD-image](https://github.com/Qengineering/RPi-image)
# TensorFlow_Lite_Classification_RPi_64-bits
![output image]( https://qengineering.eu/images/SchoolbusUb.png )

## TensorFlow Lite classification running on a bare Raspberry Pi 4
[![License](https://img.shields.io/badge/License-BSD%203--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause)


A fast C++ implementation of TensorFlow Lite classification on a bare Raspberry Pi 4. The Raspberry Pi 64 bits version of Ubuntu is used as operating system. Once overclocked to 1925 MHz, your app runs at 23 FPS without any hardware accelerator.
Special made for a bare Raspberry Pi see: https://qengineering.eu/install-ubuntu-18.04-on-raspberry-pi-4.html

------------

Papers: https://arxiv.org/pdf/1712.05877.pdf

Training set: COCO with 1000 objects

Size: 224x224

------------

## Benchmark.
| Model | RPI 4 @1950 MHz - 64 OS |
| :------------: | :-------------: |
| Mobile_V1 Lite | 38.5 FPS |
| Mobile_V2 Lite | 45.5 FPS |
| Inception_V2 Lite | 10.0 FPS |
| Inception_V4 Lite | 2.0 FPS |

With a regular 32 bits Raspbian OS you get lower frame rates see: https://github.com/Qengineering/TensorFlow_Lite_Classification_RPi_32-bits

------------

## Dependencies.

To run the application, you have to:
- A raspberry Pi 4 with a 64-bit operating system. It can be the Raspberry 64-bit OS, or Ubuntu 18.04 / 20.04. [Install 64-bit OS](https://qengineering.eu/install-raspberry-64-os.html)

- TensorFlow Lite framework installed. [Install TensorFlow Lite](https://qengineering.eu/install-tensorflow-2-lite-on-raspberry-64-os.html)

- OpenCV 64 bit installed. [Install OpenCV 4.5](https://qengineering.eu/install-opencv-4.5-on-raspberry-64-os.html)

- Code::Blocks installed. (```$ sudo apt-get install codeblocks```)

------------

## Installing the app.
To extract and run the network in Code::Blocks

$ mkdir *MyDir*

$ cd *MyDir*

$ wget https://github.com/Qengineering/TensorFlow_Lite_Classification_RPi_64-bits/archive/refs/heads/master.zip

$ unzip -j master.zip

Remove master.zip and README.md as they are no longer needed.

$ rm master.zip

$ rm README.md


Your *MyDir* folder must now look like this:

tabby.jpeg

schoolbus.jpg

grace_hopper.bmp

Labels.txt

TensorFlow_Lite_Mobile.cpb

TensorFlow_Lite_Class.cpp



Next, choose your model from TensorFlow: https://www.tensorflow.org/lite/guide/hosted_models

Download a quantized model, extract the .tflite from the tarball and place it in your *MyDir*.


Now your *MyDir* folder may contain: mobilenet_v1_1.0_224_quant.tflite.

Or: inception_v4_299_quant.tflite. Or both of course.


Enter the .tflite file of your choice on line 54 in TensorFlow_Lite_Class.cpp

The image to be tested is given a line 84, also in TensorFlow_Lite_Class.cpp

------------

## Running the app.
Run TestTensorFlow_Lite.cpb with Code::Blocks. More info or

if you want to connect a camera to the app, follow the instructions at [Hands-On](https://qengineering.eu/deep-learning-examples-on-raspberry-32-64-os.html#HandsOn).

------------

[![paypal](https://qengineering.eu/images/TipJarSmall4.png)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=CPZTM5BB3FCYL)