cancel
Showing results for 
Search instead for 
Did you mean: 

Deploy an image classification model in STM32N6570-DK discovery board

diama13
Associate III

I follow the instructions found in  https://github.com/STMicroelectronics/stm32ai-modelzoo-services/blob/main/image_classification/deployment/README.md in order to deploy an image classification model in STM32N6570-DK board. 

When i launch (in ubuntu) 

python stm32ai_main.py --config-path ./config_file_examples/ --config-name deployment_n6_mobilenet_v2_config.yaml

i get the following error 

[WARNING] The usable GPU memory is unlimited.
Please consider setting the 'gpu_memory_limit' attribute in the 'general' section of your configuration file.
[INFO] : Running `deployment` operation mode
[INFO] : ClearML config check
[INFO] : The random seed for this simulation is 123
INFO: Created TensorFlow Lite XNNPACK delegate for CPU.
[INFO] : Generating C header file for Getting Started...
loading model.. model_path="../../../stm32ai-modelzoo/image_classification/mobilenetv2/ST_pretrainedmodel_public_dataset/flowers/mobilenet_v2_0.35_128_fft/mobilenet_v2_0.35_128_fft_int8.tflite"
loading conf file.. "../../application_code/image_classification/STM32N6/stmaic_STM32N6570-DK.conf" config="None"
"n6 release" configuration is used
[INFO] : Selected board : "STM32N6570-DK Getting Started Image Classification (STM32CubeIDE)" (stm32_cube_ide/n6 release/stm32n6)
[INFO] : Compiling the model and generating optimized C code + Lib/Inc files: ../../../stm32ai-modelzoo/image_classification/mobilenetv2/ST_pretrainedmodel_public_dataset/flowers/mobilenet_v2_0.35_128_fft/mobilenet_v2_0.35_128_fft_int8.tflite
setting STM.AI tools.. root_dir="", req_version=""
Cube AI Path: "/opt/st/STEdgeAI/2.0/Utilities/linux/stedgeai".
[INFO] : Offline CubeAI used; Selected tools: 10.0.0 (x-cube-ai pack)
loading conf file.. "../../application_code/image_classification/STM32N6/stmaic_STM32N6570-DK.conf" config="None"
"n6 release" configuration is used
compiling... "mobilenet_v2_0_35_128_fft_int8_tflite" session
model_path : ['../../../stm32ai-modelzoo/image_classification/mobilenetv2/ST_pretrainedmodel_public_dataset/flowers/mobilenet_v2_0.35_128_fft/mobilenet_v2_0.35_128_fft_int8.tflite']
tools : 10.0.0 (x-cube-ai pack)
target : "STM32N6570-DK Getting Started Image Classification (STM32CubeIDE)" (stm32_cube_ide/n6 release/stm32n6)
options : --st-neural-art default@../../application_code/image_classification/STM32N6/Model/user_neuralart.json --input-data-type uint8 --inputs-ch-position chlast --output-data-type float32
[returned code = 255 - FAILED]
$ cwd: None
$ args: /opt/st/STEdgeAI/2.0/Utilities/linux/stedgeai generate --target stm32n6 -m ../../../stm32ai-modelzoo/image_classification/mobilenetv2/ST_pretrainedmodel_public_dataset/flowers/mobilenet_v2_0.35_128_fft/mobilenet_v2_0.35_128_fft_int8.tflite --output /home/test/Work/ST/stm32ai-modelzoo-services/image_classification/src/experiments_outputs/2025_04_01_11_43_46 --workspace /home/test/Work/ST/stm32ai-modelzoo-services/image_classification/src/experiments_outputs/2025_04_01_11_43_46 --st-neural-art default@../../application_code/image_classification/STM32N6/Model/user_neuralart.json --input-data-type uint8 --inputs-ch-position chlast --output-data-type float32
ST Edge AI Core v2.0.0-20049

PASS: 0%| | 0/82 [00:00<?, ?it/s]
PASS: 9%|▊ | 7/82 [00:00<00:01, 39.76it/s]
PASS: 13%|█▎ | 11/82 [00:00<00:02, 34.83it/s]
PASS: 24%|██▍ | 20/82 [00:00<00:01, 54.28it/s]
PASS: 32%|███▏ | 26/82 [00:00<00:01, 47.81it/s]
PASS: 39%|███▉ | 32/82 [00:00<00:01, 44.83it/s]
PASS: 45%|████▌ | 37/82 [00:00<00:01, 43.41it/s]
PASS: 51%|█████ | 42/82 [00:00<00:00, 44.66it/s]
PASS: 57%|█████▋ | 47/82 [00:01<00:00, 46.05it/s]
PASS: 65%|██████▍ | 53/82 [00:01<00:00, 46.39it/s]
PASS: 71%|███████ | 58/82 [00:01<00:00, 43.25it/s]
PASS: 77%|███████▋ | 63/82 [00:01<00:00, 39.67it/s]
PASS: 83%|████████▎ | 68/82 [00:01<00:00, 41.47it/s]
PASS: 89%|████████▉ | 73/82 [00:01<00:00, 40.27it/s]

>>>> EXECUTING NEURAL ART COMPILER

PASS: 89%|████████▉ | 73/82 [00:02<00:00, 40.27it/s]

/opt/st/STEdgeAI/2.0/Utilities/linux/atonn -i "/home/test/Work/ST/stm32ai-modelzoo-services/image_classification/src/experiments_outputs/2025_04_01_11_43_46/mobilenet_v2_0.35_128_fft_int8_OE_3_1_0.onnx" --json-quant-file "/home/test/Work/ST/stm32ai-modelzoo-services/image_classification/src/experiments_outputs/2025_04_01_11_43_46/mobilenet_v2_0.35_128_fft_int8_OE_3_1_0_Q.json" -g "network.c" --load-mdesc "/opt/st/STEdgeAI/2.0/Utilities/configs/stm32n6.mdesc" --load-mpool "/home/test/Work/ST/stm32ai-modelzoo-services/application_code/image_classification/STM32N6/Model/my_mpools/stm32n6-app2.mpool" --save-mpool-file "/home/test/Work/ST/stm32ai-modelzoo-services/image_classification/src/experiments_outputs/2025_04_01_11_43_46/neural_art__network/stm32n6-app2.mpool" --out-dir-prefix "/home/test/Work/ST/stm32ai-modelzoo-services/image_classification/src/experiments_outputs/2025_04_01_11_43_46/neural_art__network/" --all-buffers-info --no-hw-sw-parallelism --cache-maintenance --enable-virtual-mem-pools --native-float --optimization 3 --Os --Omax-ca-pipe 4 --Ocache-opt --enable-epoch-controller --output-info-file "c_info.json"

PASS: 89%|████████▉ | 73/82 [00:02<00:00, 40.27it/s]


>>> Shell execution has FAILED (returned code = 1)

PASS: 89%|████████▉ | 73/82 [00:02<00:00, 40.27it/s]

$ /opt/st/STEdgeAI/2.0/Utilities/linux/atonn -i /home/test/Work/ST/stm32ai-modelzoo-services/image_classification/src/experiments_outputs/2025_04_01_11_43_46/mobilenet_v2_0.35_128_fft_int8_OE_3_1_0.onnx --json-quant-file /home/test/Work/ST/stm32ai-modelzoo-services/image_classification/src/experiments_outputs/2025_04_01_11_43_46/mobilenet_v2_0.35_128_fft_int8_OE_3_1_0_Q.json -g network.c --load-mdesc /opt/st/STEdgeAI/2.0/Utilities/configs/stm32n6.mdesc --load-mpool /home/test/Work/ST/stm32ai-modelzoo-services/application_code/image_classification/STM32N6/Model/my_mpools/stm32n6-app2.mpool --save-mpool-file /home/test/Work/ST/stm32ai-modelzoo-services/image_classification/src/experiments_outputs/2025_04_01_11_43_46/neural_art__network/stm32n6-app2.mpool --out-dir-prefix /home/test/Work/ST/stm32ai-modelzoo-services/image_classification/src/experiments_outputs/2025_04_01_11_43_46/neural_art__network/ --all-buffers-info --no-hw-sw-parallelism --cache-maintenance --enable-virtual-mem-pools --native-float --optimization 3 --Os --Omax-ca-pipe 4 --Ocache-opt --enable-epoch-controller --output-info-file c_info.json

PASS: 89%|████████▉ | 73/82 [00:02<00:00, 40.27it/s]


PASS: 89%|████████▉ | 73/82 [00:02<00:00, 40.27it/s]

Error: machine description JSON ERROR:

PASS: 89%|████████▉ | 73/82 [00:02<00:00, 40.27it/s]

INVALID_ARGUMENT:Unexpected end of string. Expected a value.

PASS: 89%|████████▉ | 73/82 [00:02<00:00, 40.27it/s]

^

PASS: 89%|████████▉ | 73/82 [00:02<00:00, 40.27it/s]

Warning: Machine description File: Machine '' does not have a version field

PASS: 89%|████████▉ | 73/82 [00:02<00:00, 40.27it/s]

saving memory pool description "/home/test/Work/ST/stm32ai-modelzoo-services/image_classification/src/experiments_outputs/2025_04_01_11_43_46/neural_art__network/stm32n6-app2.mpool"

PASS: 89%|████████▉ | 73/82 [00:02<00:00, 40.27it/s]

ERROR no fwd progress threshold exceeded (you might want to check the machine description)

PASS: 89%|████████▉ | 73/82 [00:02<00:00, 40.27it/s]

Error: Internal scheduler error

PASS: 89%|████████▉ | 73/82 [00:02<00:00, 40.27it/s]

<<<

PASS: 89%|████████▉ | 73/82 [00:02<00:00, 40.27it/s]


E103(CliRuntimeError): Error calling the Neural Art compiler - ['', '', 'Error: machine description JSON ERROR:', 'INVALID_ARGUMENT:Unexpected end of string. Expected a value.', '', '^', '', "Warning: Machine description File: Machine '' does not have a version field", 'saving memory pool description "/home/test/Work/ST/stm32ai-modelzoo-services/image_classification/src/experiments_outputs/2025_04_01_11_43_46/neural_art__network/stm32n6-app2.mpool"', 'ERROR no fwd progress threshold exceeded (you might want to check the machine description)', '', 'Error: Internal scheduler error', '']
$ cwd: None
$ args: /opt/st/STEdgeAI/2.0/Utilities/linux/stedgeai generate --target stm32n6 -m ../../../stm32ai-modelzoo/image_classification/mobilenetv2/ST_pretrainedmodel_public_dataset/flowers/mobilenet_v2_0.35_128_fft/mobilenet_v2_0.35_128_fft_int8.tflite --output /home/test/Work/ST/stm32ai-modelzoo-services/image_classification/src/experiments_outputs/2025_04_01_11_43_46 --workspace /home/test/Work/ST/stm32ai-modelzoo-services/image_classification/src/experiments_outputs/2025_04_01_11_43_46 --st-neural-art default@../../application_code/image_classification/STM32N6/Model/user_neuralart.json --input-data-type uint8 --inputs-ch-position chlast --output-data-type float32
ST Edge AI Core v2.0.0-20049

PASS: 0%| | 0/82 [00:00<?, ?it/s]
PASS: 9%|▊ | 7/82 [00:00<00:01, 39.76it/s]
PASS: 13%|█▎ | 11/82 [00:00<00:02, 34.83it/s]
PASS: 24%|██▍ | 20/82 [00:00<00:01, 54.28it/s]
PASS: 32%|███▏ | 26/82 [00:00<00:01, 47.81it/s]
PASS: 39%|███▉ | 32/82 [00:00<00:01, 44.83it/s]
PASS: 45%|████▌ | 37/82 [00:00<00:01, 43.41it/s]
PASS: 51%|█████ | 42/82 [00:00<00:00, 44.66it/s]
PASS: 57%|█████▋ | 47/82 [00:01<00:00, 46.05it/s]
PASS: 65%|██████▍ | 53/82 [00:01<00:00, 46.39it/s]
PASS: 71%|███████ | 58/82 [00:01<00:00, 43.25it/s]
PASS: 77%|███████▋ | 63/82 [00:01<00:00, 39.67it/s]
PASS: 83%|████████▎ | 68/82 [00:01<00:00, 41.47it/s]
PASS: 89%|████████▉ | 73/82 [00:01<00:00, 40.27it/s]

>>>> EXECUTING NEURAL ART COMPILER

PASS: 89%|████████▉ | 73/82 [00:02<00:00, 40.27it/s]

/opt/st/STEdgeAI/2.0/Utilities/linux/atonn -i "/home/test/Work/ST/stm32ai-modelzoo-services/image_classification/src/experiments_outputs/2025_04_01_11_43_46/mobilenet_v2_0.35_128_fft_int8_OE_3_1_0.onnx" --json-quant-file "/home/test/Work/ST/stm32ai-modelzoo-services/image_classification/src/experiments_outputs/2025_04_01_11_43_46/mobilenet_v2_0.35_128_fft_int8_OE_3_1_0_Q.json" -g "network.c" --load-mdesc "/opt/st/STEdgeAI/2.0/Utilities/configs/stm32n6.mdesc" --load-mpool "/home/test/Work/ST/stm32ai-modelzoo-services/application_code/image_classification/STM32N6/Model/my_mpools/stm32n6-app2.mpool" --save-mpool-file "/home/test/Work/ST/stm32ai-modelzoo-services/image_classification/src/experiments_outputs/2025_04_01_11_43_46/neural_art__network/stm32n6-app2.mpool" --out-dir-prefix "/home/test/Work/ST/stm32ai-modelzoo-services/image_classification/src/experiments_outputs/2025_04_01_11_43_46/neural_art__network/" --all-buffers-info --no-hw-sw-parallelism --cache-maintenance --enable-virtual-mem-pools --native-float --optimization 3 --Os --Omax-ca-pipe 4 --Ocache-opt --enable-epoch-controller --output-info-file "c_info.json"

PASS: 89%|████████▉ | 73/82 [00:02<00:00, 40.27it/s]


>>> Shell execution has FAILED (returned code = 1)

PASS: 89%|████████▉ | 73/82 [00:02<00:00, 40.27it/s]

$ /opt/st/STEdgeAI/2.0/Utilities/linux/atonn -i /home/test/Work/ST/stm32ai-modelzoo-services/image_classification/src/experiments_outputs/2025_04_01_11_43_46/mobilenet_v2_0.35_128_fft_int8_OE_3_1_0.onnx --json-quant-file /home/test/Work/ST/stm32ai-modelzoo-services/image_classification/src/experiments_outputs/2025_04_01_11_43_46/mobilenet_v2_0.35_128_fft_int8_OE_3_1_0_Q.json -g network.c --load-mdesc /opt/st/STEdgeAI/2.0/Utilities/configs/stm32n6.mdesc --load-mpool /home/test/Work/ST/stm32ai-modelzoo-services/application_code/image_classification/STM32N6/Model/my_mpools/stm32n6-app2.mpool --save-mpool-file /home/test/Work/ST/stm32ai-modelzoo-services/image_classification/src/experiments_outputs/2025_04_01_11_43_46/neural_art__network/stm32n6-app2.mpool --out-dir-prefix /home/test/Work/ST/stm32ai-modelzoo-services/image_classification/src/experiments_outputs/2025_04_01_11_43_46/neural_art__network/ --all-buffers-info --no-hw-sw-parallelism --cache-maintenance --enable-virtual-mem-pools --native-float --optimization 3 --Os --Omax-ca-pipe 4 --Ocache-opt --enable-epoch-controller --output-info-file c_info.json

PASS: 89%|████████▉ | 73/82 [00:02<00:00, 40.27it/s]


PASS: 89%|████████▉ | 73/82 [00:02<00:00, 40.27it/s]

Error: machine description JSON ERROR:

PASS: 89%|████████▉ | 73/82 [00:02<00:00, 40.27it/s]

INVALID_ARGUMENT:Unexpected end of string. Expected a value.

PASS: 89%|████████▉ | 73/82 [00:02<00:00, 40.27it/s]

^

PASS: 89%|████████▉ | 73/82 [00:02<00:00, 40.27it/s]

Warning: Machine description File: Machine '' does not have a version field

PASS: 89%|████████▉ | 73/82 [00:02<00:00, 40.27it/s]

saving memory pool description "/home/test/Work/ST/stm32ai-modelzoo-services/image_classification/src/experiments_outputs/2025_04_01_11_43_46/neural_art__network/stm32n6-app2.mpool"

PASS: 89%|████████▉ | 73/82 [00:02<00:00, 40.27it/s]

ERROR no fwd progress threshold exceeded (you might want to check the machine description)

PASS: 89%|████████▉ | 73/82 [00:02<00:00, 40.27it/s]

Error: Internal scheduler error

PASS: 89%|████████▉ | 73/82 [00:02<00:00, 40.27it/s]

<<<

PASS: 89%|████████▉ | 73/82 [00:02<00:00, 40.27it/s]


E103(CliRuntimeError): Error calling the Neural Art compiler - ['', '', 'Error: machine description JSON ERROR:', 'INVALID_ARGUMENT:Unexpected end of string. Expected a value.', '', '^', '', "Warning: Machine description File: Machine '' does not have a version field", 'saving memory pool description "/home/test/Work/ST/stm32ai-modelzoo-services/image_classification/src/experiments_outputs/2025_04_01_11_43_46/neural_art__network/stm32n6-app2.mpool"', 'ERROR no fwd progress threshold exceeded (you might want to check the machine description)', '', 'Error: Internal scheduler error', '']
Error executing job with overrides: []
Traceback (most recent call last):
File "/home/test/anaconda3/envs/st_zoo/lib/python3.10/site-packages/clearml/binding/hydra_bind.py", line 230, in _patched_task_function
return task_function(a_config, *a_args, **a_kwargs)
File "/home/test/Work/ST/stm32ai-modelzoo-services/image_classification/src/stm32ai_main.py", line 407, in main
process_mode(mode=mode, configs=cfg, train_ds=train_ds, valid_ds=valid_ds, quantization_ds=quantization_ds,
File "/home/test/Work/ST/stm32ai-modelzoo-services/image_classification/src/stm32ai_main.py", line 302, in process_mode
deploy(cfg=configs)
File "/home/test/Work/ST/stm32ai-modelzoo-services/image_classification/src/../deployment/deploy.py", line 90, in deploy
stm32ai_deploy_stm32n6(target=board, stlink_serial_number=stlink_serial_number, stm32ai_version=stm32ai_version, c_project_path=c_project_path,
File "/home/test/Work/ST/stm32ai-modelzoo-services/image_classification/src/../../common/deployment/common_deploy.py", line 469, in stm32ai_deploy_stm32n6
stmaic_local_call(session)
File "/home/test/Work/ST/stm32ai-modelzoo-services/image_classification/src/../../common/deployment/common_deploy.py", line 443, in stmaic_local_call
stmaic.compile(session=session, options=opt, target=session._board_config)
File "/home/test/Work/ST/stm32ai-modelzoo-services/image_classification/src/../../common/stm32ai_local/compile.py", line 208, in cmd_compile
raise Exception('Error during compilation')
Exception: Error during compilation

Can anyone help?

10 REPLIES 10

Hello @llcc,

 

If you are talking about the .zip for the NPU, in the new version 2.1 of the st edge ai core, this is directly included.

You don't need to install it manually anymore

 

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.