The problem
RoboCupJunior Rescue Maze is a maze a robot drives through on its own. On the walls are victims, and the robot has to find each one and tell which it is.
Ours was SERS Team's robot, Slovenia's national RoboCupJunior team. An STM32 runs the robot, and an OpenMV H7 camera on each side does the seeing. My part was victim recognition.
A victim can be rotated by any angle, and that was the biggest problem for me. The other one was memory: the chip has only 1 MB of RAM.
What did not work
I started in March 2025 with a ready-made model from an OpenMV video. The module it needed is gone from newer firmware, so I downgraded the camera to a version that still had it, and bricked the board.
Then I trained a classifier myself and tried to convert it to TensorFlow Lite, and got one error after another. In the end I moved to Edge Impulse.
The first version did all of the recognition on one camera at 1 FPS and kept running out of memory. It was trained on black-and-white images, and switching the camera between black-and-white and colour made the picture flicker. So the camera now stays in colour, and I made a new dataset from scratch.
What worked
The dataset is my own: I shot the victims with the OpenMV camera itself and labelled them by hand, drawing a box around every one. In the end it had about 10,000 images. The model is FOMO, an object detector made for microcontrollers, trained in Edge Impulse and exported as TensorFlow Lite.
On the camera it runs on 160 × 120 colour frames. Not every victim needs the model: some are found with colour thresholds in the LAB colour space, which costs far less than a second model.
One frame decides nothing. The camera collects its detections over a window of 20 frames, counts only the confident ones, and reports a victim when the vote agrees.
It talks to the STM32 over pins rather than a serial protocol: two pins say which victim it is, an interrupt pin tells the STM32 to look, and the STM32 answers on a fourth pin. The STM32 only reads a victim when the robot is in the centre of a tile.
Light mattered as much as the model. The focus is fixed, so accuracy depends on the light and on the angle of the robot. A NeoPixel strip lights the wall with its white channel only, and the exposure is set by hand to 8,000 µs.
The result: about 90% recognition in good conditions, at about 60 FPS, in under 1 MB of RAM and under 500 KB of flash.
Where it went
We took the robot to the RoboCupJunior Americas SuperRegional in Mercersburg, Pennsylvania, and made it to the finals.
In July 2025 we were at RoboCup in Salvador, Brazil. For the technical challenge the way victims had to be reported changed, so I changed the pin encoding and dropped one kind of victim. We placed 3rd in the technical challenge of the Rescue Maze league, and 10th of 25 overall.
The code is public on GitHub, without the dataset and the model, so that the competition stays fair. Anyone who needs them can ask SERS Team.
What I would do differently
If I started again I would probably use a Raspberry Pi with a demultiplexer adapter for the cameras. I would have many more resources and would not have to spend so much time on optimisation.