地瓜patch 发表于 2025-5-10 22:36

【STM32N6570-DK评测】五、一个AI新手为N6构建软件环境

本帖最后由 地瓜patch 于 2025-5-11 22:50 编辑

一、初级阶段
查看代码,编辑代码用IAR或keil或StmCubeIDE或CubeMX是足够的
下载程序,用StmCubeProgrammer.
在之前的帖子里,用脚本下载多个程序文件,也是在脚本中调用StmCubeProgrammer,在一下帖子中有说明。


【STM32N6570-DK评测】三、初识AI及下载多个程序文件的快捷方法
https://bbs.21ic.com/icview-3452 ... 9C%B0%E7%93%9Cpatch

有了以上几个软件,下载ST官方给出的例程足够了。






二、进阶
除去上述ST官方给出的例程,还给出了一些更其他的例程,用stm32ai-modelzoo训练完成的一些例程
比如stm32ai-modelzoo-main\object_detection\ssd_mobilenet_v2_fpnlite\ST_pretrainedmodel_public_dataset\coco_2017_person\ssd_mobilenet_v2_fpnlite_035_192\ssd_mobilenet_v2_fpnlite_035_192_int8.tflite
比如stm32ai-modelzoo-main\object_detection\ssd_mobilenet_v2_fpnlite\ST_pretrainedmodel_public_dataset\coco_2017_person\ssd_mobilenet_v2_fpnlite_035_192\ssd_mobilenet_v2_fpnlite_035_192_int8.tflite
这些都是modelzoo中用tersorflow训练完成的一些模型,要调用这些模型需要进行编译后下载
学习众多高手的对STM32N6570 AI的测试文章、帖子、讨论等等,自己也在学习尝试编译这些模型。
在学习过程中遇到了重困难。
利用pip install -r requirements.txt命令通过python安装所有工具软件插件。
requirements.txt文件就是一个软件列表,包含使用版本
mlflow==2.3.0
hydra-core==1.3.2
omegaconf==2.3.0
numpy==1.23.4
pandas==1.5.3
wget==3.2
munch==2.5.0
seaborn==0.12.2
scikit-learn==1.2.2
tqdm==4.65.0
skl2onnx==1.14.0
onnx==1.12.0
onnxconverter-common==1.13.0
onnxruntime==1.15.1
optuna==3.1.1
imgaug==0.4.0
matplotlib==3.6.2
opencv_python==4.6.0.66
joblib==1.2.0
librosa==0.10.0.post2
mako==1.2.4
pyserial==3.5
colorama==0.4.5
larq==0.13.3
Requests==2.28.2
urllib3==1.26.13
xmlrunner==1.7.7
marshmallow==3.20.1
tf2onnx==1.14.0
clearml==1.16.5
pip-system-certs==4.0


执行pip install -r requirements.txt命令时遇到了不少错误提示
比如
ModuleNotFoundError: No module named 'tensorflow';
No matching distribution found for tensorflow==2.8.3;
ModuleNotFoundError: No module named 'mlflow';
ModuleNotFoundError: No module named 'hydra';
Running `icl ""` gave " 系统找不到指定的文件。";
Running `cl /?` gave " 系统找不到指定的文件。";
Running `cc --version` gave " 系统找不到指定的文件。";
Running `gcc --version` gave " 系统找不到指定的文件。";
Running `clang --version` gave " 系统找不到指定的文件。";
Running `clang-cl /?` gave " 系统找不到指定的文件。";
Running `pgcc --version` gave " 系统找不到指定的文件。";
这些错误通过执行pip install ...命令将软件安装后,基本都能解决这些错误。

No matching distribution found for tensorflow==2.8.3;的错误试过很多种方法总是不能解决。
最后通过deepseek找到了一种可能,

于是重新下载python3.8后重新安装,然后再次执行,终于可以下载tensorflow2.8.3了

开始逐个下载 requirements.txt中的软件,插件或工具


安装完成tenserflow以后,又出现新问题

PASS:   0%|          | 0/92
PASS:12%|█▏      | 11/92
PASS:13%|█▎      | 12/92
PASS:20%|█▉      | 18/92
PASS:24%|██▍       | 22/92
PASS:28%|██▊       | 26/92
PASS:36%|███▌      | 33/92
PASS:41%|████▏   | 38/92
PASS:46%|████▌   | 42/92
PASS:50%|█████   | 46/92
PASS:54%|█████▍    | 50/92
PASS:59%|█████▊    | 54/92
PASS:64%|██████▍   | 59/92
PASS:68%|██████▊   | 63/92
PASS:73%|███████▎| 67/92
PASS:77%|███████▋| 71/92
PASS:82%|████████▏ | 75/92
PASS:87%|████████▋ | 80/92
PASS:91%|█████████▏| 84/92

>>>> EXECUTING NEURAL ART COMPILER

PASS:91%|█████████▏| 84/92

   E:/ProgramFiles/STEdgeAI/2.1/Utilities/windows/atonn.exe -i "G:/STCL562F429N6570/STM32N6570DK/stm32ai-modelzoo-services-main/image_classification/src/experiments_outputs/2025_05_11_21_56_42/mobilenet_v2_0.35_128_fft_int8_OE_3_2_0.onnx" --json-quant-file "G:/STCL562F429N6570/STM32N6570DK/stm32ai-modelzoo-services-main/image_classification/src/experiments_outputs/2025_05_11_21_56_42/mobilenet_v2_0.35_128_fft_int8_OE_3_2_0_Q.json" -g "network.c" --load-mdesc "E:/ProgramFiles/STEdgeAI/2.1/Utilities/configs/stm32n6.mdesc" --load-mpool "G:/STCL562F429N6570/STM32N6570DK/stm32ai-modelzoo-services-main/application_code/image_classification/STM32N6/Model/my_mpools/stm32n6-app2.mpool" --save-mpool-file "G:/STCL562F429N6570/STM32N6570DK/stm32ai-modelzoo-services-main/image_classification/src/experiments_outputs/2025_05_11_21_56_42/neural_art__network/stm32n6-app2.mpool" --out-dir-prefix "G:/STCL562F429N6570/STM32N6570DK/stm32ai-modelzoo-services-main/image_classification/src/experiments_outputs/2025_05_11_21_56_42/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:91%|█████████▏| 84/92

<<<< DONE EXECUTING NEURAL ART COMPILER

PASS:91%|█████████▏| 84/92


LOAD ERROR: WindowsPath('G:/STCL562F429N6570/STM32N6570DK/stm32ai-modelzoo-services-main/image_classification/src/experiments_outputs/2025_05_11_21_56_42/network.h') and WindowsPath('G:/STCL562F429N6570/STM32N6570DK/stm32ai-modelzoo-services-main/image_classification/src/experiments_outputs/2025_05_11_21_56_42/network.h') are the same file
Error executing job with overrides: []
Traceback (most recent call last):
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\clearml\binding\hydra_bind.py", line 230, in _patched_task_function
    return task_function(a_config, *a_args, **a_kwargs)
File "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 "stm32ai_main.py", line 302, in process_mode
    deploy(cfg=configs)
File "../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 "../../common/deployment\common_deploy.py", line 469, in stm32ai_deploy_stm32n6
    stmaic_local_call(session)
File "../../common/deployment\common_deploy.py", line 443, in stmaic_local_call
    stmaic.compile(session=session, options=opt, target=session._board_config)
File "../../common\stm32ai_local\compile.py", line 208, in cmd_compile
    raise Exception('Error during compilation')
Exception: Error during compilation

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











probedog 发表于 2025-6-5 17:34

支持一下。。。。

AdaMaYun 发表于 2025-6-8 23:39

环境搭建还是必要的

gejigeji521 发表于 2025-6-11 10:45

大佬都玩单片机的AI了啊,牛啊。

Ketose 发表于 2025-7-8 15:58

收一块STM32N6开发板。
页: [1]
查看完整版本: 【STM32N6570-DK评测】五、一个AI新手为N6构建软件环境