Seeing What the Classifier() Saw in a FOMO Model

This program I created runs an EdgeImpulse (EI) FOMO Machine Learning (ML) model that is looking to find one or more screws in a single image captured by a Sony Spresense Camera module connected to a Sony Spresense Main board. When one or more FOMOed objects are found, then a BMP is written to a SD card on the Sony Spresense Extension board with the centroid of the predicated object location overlayed on the BMP in a rectangular black outline. The size and location of the centroid rectangle is an output on the EdgeImpulse FOMO model inference routine.


Being able to see were the EdgeImpulse Classifier() placed bounding boxes in a EdgeImpulse FOMO model is very useful to see why your Model is giving False Positives.

The EdgeImpulse Python code here imports the object “ImageImpulseRunner”. The code uses the Runner to run an EIM file (EdgeImpulse Model file) that will classify an image passed in as a command line argument. If the segmented image classification finds objects, then the Python code, using OpenCV, draws bounding boxes as determined by the Classifier() onto the image and then saves the image as a JPEG. The bounding boxes in this case seem to be identifying the location and size of the FOMOed object itself (not the centroid of the predicted object).


Q1. Does anyone know of other example code to draw bounding boxes and saves the camera framebuffer as a JPEG (or any image format) in C++ or more specifically in Arduino code with a Sony Spresense?

Q2. Is the difference in Bounding Box size between the Python code and the Arduino Library code
due to the assumed difference in CPU speed and avaliable memory so each code base
got coded differently?

  • Python code output image examples are here showing “true bounding boxes” not “centroid type bounding boxes” output from Arduino Library call to run_classifier().

rjames answered this in another related post. In summary, the Classifier() returns Bounding Boxes (BBs) not centroids. To place centroids on an image the BBs must be post-processed.

1 Like