Tensor Flow Lite On GoPiGo3 Robot Carl
(SORRY ABOUT THE SMALL TEXT SIZE, I DON’T KNOW HOW TO MAKE IT LARGER)
We all read about the latest computing rage and make mental notes - “I’ll look into that one of these days.” For the last few years, I have been seeing articles, tutorials, books and courses about machine learning, and adding some of them to my wish list of deep dives.
I have long dreamed of a day when my robot, Carl, will wander the house collecting images of “unknown object”, asking me at a scheduled “training session” to explain what the unknown object is called (a label), and then in another session asking me to confirm “probable object” images, to allow Carl to add objects from his specific environment to his specific knowledge set.
Carl’s Raspberry Pi 3B is not a good match for the large datasets and massive computations involved with full-up machine learning, but it is no total slouch either. When I saw that ModRobotics had included the Tensor Flow Lite Python package and a GoPiGo/Jupyter notebook tailored 1000 label image classification example in the latest GoPiGo OS beta (formerly DexterOS), my curiosity peaked to see what Carl might be able to actually do on his Pi 3B.
Carl runs Raspbian For Robots (the beta Pi OS version at the moment), and I don’t use Jupyter notebooks, and I could not find the ModRobotics modified Tensor Flow Lite example included in the GoPiGo OS beta on the DexterIndustries GitHub master or develop fork, so I was not sure what would be involved in trying out Tensor Flow Lite on Carl.
The install of Tensor Flow Lite took less than 15 seconds! Bringing down the example took several minutes to get the trained model, and because the instructions have you clone a huge set of examples just to get that one Raspberry Pi example, but it completed successfully, and so I was up and running the example in less than five minutes.
- Carl recognizes an analog clock from a 640x480 30p video stream in 310ms (3 FPS)
analog clock 0.71 310.1ms analog clock 0.60 309.5ms analog clock 0.62 309.8ms
- The processor utilization for the example with 1000 label model is roughly 1.0
(one complete core of the four cores available)
- Processor Temperature averaged 72degC (high but acceptable) with no throttling
- Carl had a rough night! I went to bed forgetting to stop the TFLite example
which caused “Early Trickle Charging”, which meant Carl spent the night getting off his dock before the batteries received a full capacity charge. (Fault of the charger interpreting processor load variations as a battery voltage peak. )
And an orange with my gpg_classify_picamera.py: