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

[复制链接]
745|4
 楼主| 地瓜patch 发表于 2025-5-10 22:36 | 显示全部楼层 |阅读模式
本帖最后由 地瓜patch 于 2025-5-11 22:50 编辑

一、初级阶段
查看代码,编辑代码用IAR或keil或StmCubeIDE或CubeMX是足够的
下载程序,用StmCubeProgrammer.
在之前的帖子里,用脚本下载多个程序文件,也是在脚本中调用[color=var(--darkreader-text-444444, #a19c95)][backcolor=var(--darkreader-background-ffffff, #141617)]StmCubeProgrammer,在一下帖子中有说明。


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

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


16218681f5ccb67a0d.png

40317681f5ce155e8b.png

二、进阶
除去上述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 "[WinError 2] 系统找不到指定的文件。";
Running `cl /?` gave "[WinError 2] 系统找不到指定的文件。";
Running `cc --version` gave "[WinError 2] 系统找不到指定的文件。";
Running `gcc --version` gave "[WinError 2] 系统找不到指定的文件。";
Running `clang --version` gave "[WinError 2] 系统找不到指定的文件。";
Running `clang-cl /?` gave "[WinError 2] 系统找不到指定的文件。";
Running `pgcc --version` gave "[WinError 2] 系统找不到指定的文件。";
这些错误通过执行pip install ...命令将软件安装后,基本都能解决这些错误。

No matching distribution found for tensorflow==2.8.3;的错误试过很多种方法总是不能解决。
最后通过deepseek找到了一种可能,
91141681f63f32f6b5.png
于是重新下载python3.8后重新安装,然后再次执行,终于可以下载tensorflow2.8.3了
94375681f5c6494a3d.png
开始逐个下载[color=var(--darkreader-text-444444, #a19c95)][backcolor=var(--darkreader-background-ffffff, #141617)] [color=var(--darkreader-text-444444, #a19c95)][backcolor=var(--darkreader-background-ffffff, #141617)]requirements.txt中的软件,插件或工具
49000681f7063d1364.png

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

PASS:   0%|          | 0/92 [00:00<?, ?it/s]
PASS:  12%|█▏        | 11/92 [00:05<00:41,  1.95it/s]
PASS:  13%|█▎        | 12/92 [00:05<00:37,  2.11it/s]
PASS:  20%|█▉        | 18/92 [00:05<00:18,  4.04it/s]
PASS:  24%|██▍       | 22/92 [00:06<00:12,  5.63it/s]
PASS:  28%|██▊       | 26/92 [00:06<00:08,  7.69it/s]
PASS:  36%|███▌      | 33/92 [00:06<00:04, 12.48it/s]
PASS:  41%|████▏     | 38/92 [00:06<00:03, 15.33it/s]
PASS:  46%|████▌     | 42/92 [00:06<00:02, 17.53it/s]
PASS:  50%|█████     | 46/92 [00:06<00:02, 20.05it/s]
PASS:  54%|█████▍    | 50/92 [00:06<00:01, 22.30it/s]
PASS:  59%|█████▊    | 54/92 [00:06<00:01, 24.30it/s]
PASS:  64%|██████▍   | 59/92 [00:07<00:01, 28.57it/s]
PASS:  68%|██████▊   | 63/92 [00:07<00:00, 30.34it/s]
PASS:  73%|███████▎  | 67/92 [00:07<00:00, 30.29it/s]
PASS:  77%|███████▋  | 71/92 [00:07<00:00, 28.92it/s]
PASS:  82%|████████▏ | 75/92 [00:07<00:00, 29.34it/s]
PASS:  87%|████████▋ | 80/92 [00:07<00:00, 31.89it/s]
PASS:  91%|█████████▏| 84/92 [00:08<00:00, 13.35it/s]

>>>> EXECUTING NEURAL ART COMPILER

PASS:  91%|█████████▏| 84/92 [00:08<00:00, 13.35it/s]

   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 [00:08<00:00, 13.35it/s]

<<<< DONE EXECUTING NEURAL ART COMPILER

PASS:  91%|█████████▏| 84/92 [00:09<00:00, 13.35it/s]


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开发板。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

个人签名:出一块TI-PLABS-AMP-EVM

1937

主题

15241

帖子

31

粉丝
快速回复 在线客服 返回列表 返回顶部