cancel
Showing results for 
Search instead for 
Did you mean: 

Stm32n657-dk board with Zoo models

Kumar123
Associate III

Dear Team

How can I implement Zoo models on the STM32N657-DK board?

 

26 REPLIES 26
Julian E.
ST Employee

Hello @Kumar123,

 

You have the ST Model Zoo: GitHub - STMicroelectronics/stm32ai-modelzoo: AI Model Zoo for STM32 devices

That contains model that you can use with the ST Model Zoo Services or with the Standalone getting started

 

ST Model Zoo Services: GitHub - STMicroelectronics/stm32ai-modelzoo-services: AI Model Zoo services for STM32 devices

Standalone getting started: STM32N6-AI | Software - STMicroelectronics

 

With the ST Model Zoo Services, you can find documentation to retrain a model, quantize a model, evaluate a model, deploy a model etc. You need to edit the user_config.yaml and run the stm32_main.py script.

 

With the Standalone getting started, you can replace the default model with models from the model zoo. See the doc in /Doc (you will mainly need to convert the model to c and edit the postprocessing).

 

Have a good day,

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.

Dear Julian

Thank you for your response. I’ve installed the packages, but I’m not familiar with the Model Zoo. I’ve chosen the image_classification example—how do I implement it? Please guide me step by step

GitHub - STMicroelectronics/stm32ai-modelzoo: AI Model Zoo for STM32 devices

GitHub - STMicroelectronics/stm32ai-modelzoo-services: AI Model Zoo services for STM32

 STM32N6-AI | Software - STMicroelectronics

 

Hello @Kumar123,

 

For image classification, everything is explained in the different readme:

stm32ai-modelzoo-services/image_classification at main · STMicroelectronics/stm32ai-modelzoo-services · GitHub

 

You will find a link for each operation modes (training, quantization, deployement ect) with step by step guide.

 

Keep in mind that the way it works is similar. It is always:

  1. Edit the user_config.yaml
  2. Run stm32ai_main.py

 

Have a good day,

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.

Dear Julian

Why do we need to edit the user_config.yaml file? If we run the script directly without editing it, will it still work?

Hello @Kumar123,

 

You can edit the yaml to configure what you want to do:

  • Select which model to use
  • Which operation mode (training, deployment ...)
  • other options

Depending on what you do, you will also need to set your path to cubeIDE, ST Edge AI Core etc

 

Please read the documentation.

 

Have a good day,

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.

Dear Julian

I run script getting errors in image classification example.

  File "d:\Pavan\AI Software packages\stm32ai-modelzoo-services-main\stm32ai-modelzoo-services-main\image_classification\stm32ai_main.py", line 11, in <module>
    from hydra.core.hydra_config import HydraConfig
ModuleNotFoundError: No module named 'hydra'
PS D:\Pavan\AI Software packages\stm32ai-modelzoo-services-main\stm32ai-modelzoo-services-main\image_classification> 

Hello. Here is a helpful guide AI:How to use Teachable Machine to create an image classification application on STM32 - stm32mcu

Different board should not be a big problem. I guess you need the stage "3. Porting to a target".

Try to install correct python version(3.9 or 3.10) and correct requirements from requirements.txt.

Hi Avburmel

I think the next step is Stage 3: Porting to a target. How do I port to a target? I installed the ModelZoo services and the required packages. I tried the image classification example, but when I run stm32ai_main.py, I get errors. Please check.

PS D:\Micro\stm32ai-modelzoo-services-main\stm32ai-modelzoo-services-main\image_classification> & C:/Users/User/AppData/Local/Programs/Python/Python39/python.exe d:/Micro/stm32ai-modelzoo-services-main/stm32ai-modelzoo-services-main/image_classification/stm32ai_main.py
[INFO] : Setting upper limit of usable GPU memory to 24GBytes.
[INFO] : Running `chain_tqeb` operation mode
Error executing job with overrides: []
Traceback (most recent call last):
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\clearml\binding\hydra_bind.py", line 230, in _patched_task_function
    return task_function(a_config, *a_args, **a_kwargs)
  File "d:\Micro\stm32ai-modelzoo-services-main\stm32ai-modelzoo-services-main\image_classification\stm32ai_main.py", line 374, in main
    cfg = get_config(cfg)
  File "d:\Micro\stm32ai-modelzoo-services-main\stm32ai-modelzoo-services-main\image_classification\src\utils\parse_config.py", line 327, in get_config
    parse_dataset_section(cfg.dataset,
  File "d:\Micro\stm32ai-modelzoo-services-main\stm32ai-modelzoo-services-main\image_classification\src\utils\parse_config.py", line 84, in parse_dataset_section
    _check_dataset_paths_and_contents(cfg, mode=mode, mode_groups=mode_groups)
  File "d:\Micro\stm32ai-modelzoo-services-main\stm32ai-modelzoo-services-main\image_classification\src\utils\parse_config.py", line 42, in _check_dataset_paths_and_contents     
    raise FileNotFoundError(f"\nUnable to find the root directory of the {name[:-5]} set\n"
FileNotFoundError:
Unable to find the root directory of the training set
Received path: ./datasets/flower_photos
Please check the 'dataset' section of your configuration file.

Set the environment variable HYDRA_FULL_ERROR=1 for a complete stack trace.
avburmel
Associate II

Hi. I guess you need to download and unzip to "./datasets/flower_photos" flower_photos dataset to train your model.
https://storage.googleapis.com/download.tensorflow.org/example_images/flower_photos.tgz