cancel
Showing results for 
Search instead for 
Did you mean: 

How to use yolov8 on STM32H747

dogg
Associate II

Hi,

 

I have successfully ran and trained the models in modelzoo but I would like to use a larger model with yolov8 for higher resolution.

 

It was mentioned in another post that yolov5 and above is not compatible with ST chips at the moment.

 

In any case can how can I use a previous model let's say v4? The available models seem to be:

st_ssd_mobilenet_v1
ssd_mobilenet_v2_fpnlite
st_yolo_lc_v1
tiny_yolo_v2
 
What would the .yaml file look like. Can I just use the .tflite file from yolov4 and use one of the yolo derivatives from the above list?
 
Alternatively, can I increase the input matrix on the available models to be larger than 416x416?
 
I am using the h747 disco board.
 
thanks
13 REPLIES 13

Thanks for your answer.

The logic we put in place supposes that the maximum input size for a tiny yolov2 is 608, else the model will be too big to fit in the target Ram and flash.

So try to not use a resolution bigger than 608.

By the way in the next release of the model zoo there will be support for yolov8 deployment.

Best Regards.

dogg
Associate II

Ok, when I use 608 trained tiny yolo model I get this error while deploying the model:

File "C:\Users\Haris\Desktop\stm32ai-modelzoo\object_detection\src\../../common/deployment\external_memory_mgt.py", line 88, in update_activation_c_code
line = "#define CAMERA_RESOLUTION (" + cam_res + ")\n"
UnboundLocalError: local variable 'cam_res' referenced before assignment

Which does not happen when I use a 416 trained model.

 

thanks

Hello @dogg,

It seems that the model cannot be superior to VGA (640x480) and it doesn't seem to be upscaling on H7.

You could try with an input size of 480x480 (I don't think 640x480 will pass for the model input)

 

If you want to go further, you need to modify the C code yourself to allow for bigger image acquisition (camera drivers + buffers):

  • you need to bypass the python error for the model to be deployed (it can hardcode the CAMERA_RESOLUTION value it needs).
  • Once the C code is generated, modify the camera drivers so that it sends the resolution you need (greater than or equal in width and height to the model's input).
  • modify the defines to match the camera's resolution.

Normally the code is quite readable, there are patterns in the READMEs

 

The limitation for the model to be trained and to be embedded are different.

I contacted the dev team to add better errors.

 

Anyways, it may be better for you to wait a little bit for the next model zoo release and yolov8

 

Julian


In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.

Additionally, if you want to try, I got the information that if you do as follow, it should let you deploy your model (but it was not tested).

 

Before the deployment, try to replace the value of  "AXIRAM", "size" and "value"  in  stm32ai_application_code/object_detection/mempools_STM32H747I-DISCO.json by 0.

 

In theory, this should put all the buffer is SDRAM which should not saturate.

 

Julian

 

 


In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.