This repository contains code for the paper "Quantized Neural Networks for Ball Detection on the NAO Robot: An Optimized Implementation", presented at the RoboCup 2024 Symposium.
Thielke, F. (2025). Quantized Neural Networks for Ball Detection on the NAO Robot: An Optimized Implementation. In: Barros, E., Hanna, J.P., Okada, H., Torta, E. (eds) RoboCup 2024: Robot World Cup XXVII. RoboCup 2024. Lecture Notes in Computer Science(), vol 15570. Springer, Cham. https://doi.org/10.1007/978-3-031-85859-8_9
- Open ball_model_experiments and either start the devcontainer or install NaoQNN and requirements.txt into your Python environment.
- Download b-alls-2019.hdf5.
- Run
python prepare_dataset.pyto prepare the TensorFlow datasets. - Train the models by executing
python train_ball_model.py 0topython train_ball_model.py 7. Since the models are very small, depending on your hardware these 8 processes can easily run in parallel on the same machine. - Run
python inference_test.pyto perform predictions on the test set. - Run
test_models/export_models.pyto convert the quantized models to asm and the float models to H5 files. - Compile
test_models/measure_speed.cppand link it with CompiledNN. Run the resulting executable on a NAO V6 robot to get inference timings. - Check that the resulting inference times match those in
MEASURED_INFERENCE_TIMEincalculate_metrics.pyand correct them if necessary. - Run
python calculate_metrics.pyto generate plots and a LaTeX table with the results. - Run
python plot_ball_detections.pyto recreate Fig. 4 from the paper. Note that by default the plotted cases are chosen randomly.