Using Raspberry Pi 3B+ with Apache NiFi MiNiFi and Google Coral Accelerator and Pimoroni Inky Phat
Using Raspberry Pi 3B+ with Apache NiFi MiNiFi and Google Coral Accelerator and Pimoroni Inky Phat
First we need to unbox our new goodies. The Inky Phat is an awesome E-Ink display with low power usage that stays displayed after shutdown!
Next I added a new Google Coral Edge TPU ML Accelerator USB Coprocessor to a new Raspberry Pi 3B+. This was so easy to integrate and get up and running.
Let's unbox this beautiful device (but be careful when it runs it can get really hot and there is a warning in the instructions). So I run this on top of an aluminum case and with a big fan on it.
Pimoroni Inky Phat
It is pretty easy to set this up and it provides a robust Python library to write to our E-Ink display. You can see an example screen here.
https://github.com/pimoroni/inky
Pimoroni Inky pHAT ePaper eInk Display in Red
| Pimoroni Inky Phat (Red) |
https://shop.pimoroni.com/products/inky-phat
https://github.com/pimoroni/inky
https://pillow.readthedocs.io/en/stable/reference/ImageDraw.html
https://learn.pimoroni.com/tutorial/sandyj/getting-started-with-inky-phat
Install Some Python Libraries and Debian Install for Inky PHAT and Coral
pip3 install font_fredoka_one
pip3 install geocoder
pip3 install fswebcam
sudo apt-get install fe
pip3 install psutil
pip3 install font_hanken_grotesk
pip3 install font_intuitive
wget http://storage.googleapis.com/cloud-iot-edge-pretrained-models/edgetpu_api.tar.gz
These libraries are for the Inky, it needs fonts to write. The last TAR is for the Edge device and is a fast install documented well by Google.
Download Apache NiFi - MiNiFi Java Agent
https://nifi.apache.org/minifi/download.html
Next up, the most important piece. You will need to have JDK 8 installed on your device if you are using the Java agent. You can also use the MiniFi C++ Agent but that may require building it for your OS/Platform. That has some interesting Python running abilities.
Google Coral Documentation - Google Edge TPU
- Google Edge TPU ML accelerator coprocessor
- USB 3.0 Type-C socket
- Supports Debian Linux on host CPU
- ASIC designed by Google that provides high performance ML inferencing for TensorFlow Lite models
- https://coral.withgoogle.com/tutorials/edgetpu-retrain-classification-ondevice/
- https://coral.withgoogle.com/tutorials/edgetpu-api/
- http://storage.googleapis.com/cloud-iot-edge-pretrained-models/edgetpu_api_reference.zip
- https://coral.withgoogle.com/web-compiler/
- https://coral.withgoogle.com/tutorials/edgetpu-models-intro/
- https://coral.withgoogle.com/tutorials/accelerator/
- https://coral.withgoogle.com/tutorials/edgetpu-api/
- https://coral.withgoogle.com/models/
- https://coral.withgoogle.com/tutorials/accelerator-datasheet/
Using Pretrained Tensorflow Lite Model:
Inception V4 (ImageNet)
Recognizes 1,000 types of objects
Dataset: ImageNet
Input size: 299x299
Let's run a flow:
Results (Once an hour we update our E-Ink Display with Date, IP, Run Time, Label 1)
Source Code
https://github.com/tspannhw/nifi-minifi-coral
References
- https://medium.freecodecamp.org/building-an-iiot-system-using-apache-nifi-mqtt-and-raspberry-pi-ce1d6ed565bc
- https://community.hortonworks.com/articles/85984/using-minifi-to-read-data-from-a-sense-hat-on-a-ra.html
- https://community.hortonworks.com/articles/107379/minifi-for-image-capture-and-ingestion-from-raspbe.html
- https://community.hortonworks.com/articles/107379/minifi-for-image-capture-and-ingestion-from-raspbe.html
- https://community.hortonworks.com/articles/32605/running-nifi-on-raspberry-pi-best-practices.html
- https://www.tensorflow.org/lite/convert/cmdline_examples
- https://www.tensorflow.org/lite/guide/get_started
- https://pillow.readthedocs.io/en/stable/reference/ImageDraw.html
- https://coral.withgoogle.com/tutorials/edgetpu-faq/


