2025-09-12 7:04 AM
Hi
I am using STM32MPU25 to evaluate object detection, when i use stai_mpu_object_detection binary to run default ssd_mobilenet_v2 models , i can see object detection works.
when i run python scripts to launch application( example : launch_bin_object_detection_testdata.sh) i see below error.
root@stm32mp25-discounknownunknown:/usr/local/x-linux-ai/object-detection# sh launch_python_object_detection.sh
stai_mpu wrapper used :
machine used = stm32mp2x with GPU/NPU
user : weston
-sh: /usr/local/x-linux-ai/object-detection/stai_mpu_object_detection.py: Permission denied
i assume it may be due to weston user and root user.
so i copied all objection detection samples to /home/weston and gave appropriate permissions and change user to weston and launch application, i see below errors.
^^^^^^^^^^^^^^^^^^^^^
File "/home/weston/test/Application/ssd_mobilenet_pp.py", line 129, in get_results
return locations, classes, scores
^^^^^^^^^
UnboundLocalError: cannot access local variable 'locations' where it is not associated with a value
Traceback (most recent call last):
File "/home/weston/test//Application/object_detection.py", line 336, in new_sample
self.app.nn_result_locations, self.app.nn_result_classes, self.app.nn_result_scores = self.nn.get_results()
^^^^^^^^^^^^^^^^^^^^^
File "/home/weston/test/Application/ssd_mobilenet_pp.py", line 129, in get_results
return locations, classes, scores
can you point to environment where i can evaluate object detection models ( i followed procedure at https://github.com/STMicroelectronics/stm32ai-modelzoo-services/tree/main/object_detection to create object detection model with custom data set and deploy into stm32mpu25)
Thanks
Solved! Go to Solution.
2025-10-08 1:12 PM
Adding background class started detecting objects properly in stm32mpu257.
couple of questions i have
1) while running launch_python_object_detection.sh i see below error
while running File "/home/weston/object-detection//Application/object_detection.py", line 679, in drawing
y0 = int(self.app.nn_result_locations[0][i][1] * preview_height)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^
IndexError: index 3 is out of bounds for axis 0 with size 3
Traceback (most recent call last):
File "/home/weston/object-detection//Application/object_detection.py", line 679, in drawing
y0 = int(self.app.nn_result_locations[0][i][1] * preview_height)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^
IndexError: index 3 is out of bounds for axis 0 with size 3
Traceback (most recent call last):
File "/home/weston/object-detection//Application/object_detection.py", line 679, in drawing
y0 = int(self.app.nn_result_locations[0][i][1] * preview_height)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^
IndexError: index 3 is out of bounds for axis 0 with size 3
2) does tiny yolo work in stm32mpu25 for object detection , if it works can you point to README or any documentation ?
2025-09-22 5:51 AM
Hello @akr1,
Could you share your OSTL and X linux AI version please?
have a good day,
Julian
2025-09-24 10:40 AM
Hi ,
I am able to run objection detection now . when i use deployment script to deploy into target and changing scripts permissions accordingly in target.
but while running objection detection model i see below error and bounding boxes are not accurate.
Is input_shape: (224, 224, 3) is good for ssd_mobilenet_v2_fpnlite for object detection?
Same custom model runs fine when doing prediction in host pc with test images and all bounding boxes are shown correctly.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^
IndexError: index 2 is out of bounds for axis 0 with size 1
Traceback (most recent call last):
File "/home/weston/object-detection//Application/object_detection.py", line 679, in drawing
y0 = int(self.app.nn_result_locations[0][i][1] * preview_height)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^
IndexError: index 2 is out of bounds for axis 0 with size 2
Traceback (most recent call last):
File "/home/weston/object-detection//Application/object_detection.py", line 679, in drawing
y0 = int(self.app.nn_result_locations[0][i][1] * preview_height)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^
IndexError: index 2 is out of bounds for axis 0 with size 2
2025-09-25 1:07 AM - edited 2025-09-25 1:08 AM
Hello @akr1,
We need your OSTL and X linux AI version to help you.
Are you using the provided model or your own?
Have a good day,
Julian
2025-09-25 5:08 AM
Hi,
Below are details.
root@stm32mp25-discounknownunknown:~# cat /etc/os-release
ID=openstlinux-weston
NAME="ST OpenSTLinux - Weston - (A Yocto Project Based Distro)"
VERSION="5.0.8-snapshot-20250811 (scarthgap)"
VERSION_ID=5.0.8-snapshot-20250811
VERSION_CODENAME="scarthgap"
PRETTY_NAME="ST OpenSTLinux - Weston - (A Yocto Project Based Distro) 5.0.8-snapshot-20250811 (scarthgap)"
CPE_NAME="cpe:/o:openembedded:openstlinux-weston:5.0.8-snapshot-20250811"
root@stm32mp25-discounknownunknown:~# x-linux-ai -v
X-LINUX-AI package repo is already set.
X-LINUX-AI version: v6.1.0
i am using model_type: ssd_mobilenet_v2_fpnlite with custom dataset ,
Object detection works well when i run prediction on host PC, when i am deploying using deployment script into target and run model i am seeing above issue.
let me know if you require more information.
2025-09-29 6:32 AM - edited 2025-09-29 6:37 AM
Hi,
Just follow up question.
WARNING: Attempting to use a delegate that only supports static-sized tensors with a graph that has dynamic-sized tensors (tensor#346 is a dynamic-sized tensor).
How to fix the above, do i miss something in configuration , when i run objection detection model with static images or live feed from camera on STM32MPU257 i see above warning.
2025-09-30 3:00 AM - edited 2025-09-30 3:01 AM
Hello @akr1,
It looks like the issue you are facing comes from two separate points:
1. Model compatibility on MPU
2. Dynamic shapes not supported
Additional note:
The default Model Zoo object detection model for MPU is quantized per-channel. Internally, we tested per-tensor quantization (faster on MPU), but this is not available publicly. This only affects performance, not functionality.
Try with the official object detection model provided for MPU to confirm your setup works.
If you use a different model, re-export it with static shapes and update the ssd_mobilenet_pp.py post-process accordingly.
If this information does not help and you suspect it is purely a bug on our side, please let me know so that I can expose the issue to the model zoo team.
Have a good day,
Julian
2025-09-30 6:16 AM
Hi Thanks for information.
I am using ssd_mobilenet_v2_fpnlite model to pretrain custom dataset.
attached user_config.yaml used to train , preprocessing,post processing and quantization.
if i run same model (tflite) on host with prediction i don't see any issue. but if i deploy same on stm32mpu275(nbg or tflite) , i see bounding boxes are not accurate.
we are evaluating stm32mpu257 to use for object detection.
can you check attached config file and let me know if i am doing something wrong.
Let me know if you need any additional information.
2025-10-03 1:16 PM
Hi can you also suggest how to configure static-sized tensors?
2025-10-05 11:42 PM
Hello @akr1,
Could you share your model (in .zip), so that I can ask the dev team to look at the issue here.
Have a good day,
Julian