cancel
Showing results for 
Search instead for 
Did you mean: 

object detection application on the STM32H747

MH24
Associate II

hello,

I want to deploy an object detection application on the STM32H747 board. I used YOLOv5n; can I use FP-AI-Vision like in the example from the tutorial "How to use transfer learning to perform image classification on STM32".

Best Regard

8 REPLIES 8
Matthieu
ST Employee

Hello,

The Yolov5n is not well adapted in term of complexity to the STM32H7.

It is why we have developed more tiny object detector such as the YoloLC or the ST SSD mobilenet v1 available through our model zoo: https://github.com/STMicroelectronics/stm32ai-modelzoo/tree/main/object_detection/pretrained_models

You can easily retrain them thanks to the training script and deploy them on the STM32H747 Discovery kit directly using deployment scripts.

It is recommended to use this method rather than the FP-AI-VISION1 package.

The yolov5n is a perfect match for our next generation STM32N6: https://blog.st.com/stm32n6/.

Stay tuned.

 

liaifat85
Senior II

you can use FP-AI-Vision as a starting point. However, deploying YOLOv5n on the STM32H747 will require careful optimization, including model quantization, potential architecture adjustments, and possible modifications to FP-AI-Vision.

 

Hello,

Thank you for your response.

I tried using Model Zoo, but I encountered the errors shown in the attached figure. I haven't been able to solve them.

Best regards,

zoo.png

Matthieu
ST Employee

Hello,

Can you share a higher resolution picture with the last part of the error ?

Did you try the default yaml file to train the ST ssd mobilenet v1 model ?

You just need to change the dataset section with the path to the dataset and possibly the classes.

Keep the model_path empty has the model will be generated.

Then simply do:

python .\stm32ai_main.py

Unfortunately, the error still persists. I have attached a clearer screenshot of the error

Matthieu
ST Employee

Hello,

It seems your dataset is not loaded properly as you can see 0it in the trace.

Note that the dataset for object detection shall be with the YOLO Darknet format. There are scripts to convert datasets in COCO or Pascal VOC format to YOLO Darknet format in https://github.com/STMicroelectronics/stm32ai-modelzoo/tree/main/object_detection/datasets

Hello,

Thank you for your response. I tried to convert the COCO format to YOLO Darknet format., But I keep encountering errors. Should there be any modifications made in the YAML file or the Python converter file? Attached is a screenshot of the errors.

Best regards,

Matthieu
ST Employee

Hello,

With your COCO dataset, on one side you have the images, on the other the annotations as a json file.

A COCO structure is usually as follow:

<dataset_dir>/
images/train/
<imagename0>.<ext>
<imagename1>.<ext>
<imagename2>.<ext>
...
annotations/
train_labels.json
val_labels.json
test_labels.json
...

 

In your yaml file you should have:

coco_format:
  images_path: <dataset_dir>/images/train
  json_annotations_file_path: <dataset_dir>/train_labels.json
  export_dir: coco_darknet/train

 

On your log, it looks like the son_annotations_file_path field is missing

Best Regards