A fast C++ implementation of TensorFlow Lite classification on a Jetson Nano.
Once overclocked to 2015 MHz, the app runs at 50 FPS.
Special made for a Jetson Nano see Q-engineering deep learning examples
Papers: https://arxiv.org/pdf/1712.05877.pdf
Training set: COCO with 1000 objects
Size: 224x224
CPU 2015 MHz | GPU 2015 MHz | CPU 1479 MHz | GPU 1479 MHZ | RPi 4 64os 1950 MHz |
---|---|---|---|---|
50 FPS | -- FPS | 36.3 FPS | -- FPS | 38.5 FPS |
To run the application, you have to:
- TensorFlow Lite framework installed. Install TensorFlow Lite
- Optional OpenCV installed. Install OpenCV 4.5
- Code::Blocks installed. (
$ sudo apt-get install codeblocks
)
To extract and run the network in Code::Blocks
$ mkdir MyDir
$ cd MyDir
$ wget https://github.com/Qengineering/TensorFlow_Lite_Classification_Jetson-Nano/archive/refs/heads/main.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
Run TestTensorFlow_Lite.cpb with Code::Blocks.
You may need to adapt the specified library locations in TestTensorFlow_Lite.cpb to match your directory structure.
With the #define GPU_DELEGATE
uncommented, the TensorFlow Lite will deploy GPU delegates, if you have, of course, the appropriate libraries compiled by bazel. Install GPU delegates