偶然看到一篇好文章,分享给大家。 8 |2 E2 Y+ P& x7 M* ~! \- x) A8 T! T7 l 今天介绍下ST官方刚刚推出的CubeMx 自带的X-CUBE-AI(Artificial intelligent)插件功能,可以给现有的STM32 M3-M7高性能的处理器添加基于训练好的ANN 的模型用于不同的数据分析处理。 # l8 T' M* [7 m4 ~1 [: P使用STM32Cube.AI简化了人工神经网络映射 , w2 X9 p2 p) [; Q, }4 Q1.可与流行的深度学习培训工具互操作 2.兼容许多IDE和编译器 3.传感器和RTOS无关 4.允许多个人工神经网络在单个STM32MCU上运行 5.完全支持超低功耗STM32MCU 提高您的工作效率 利用DeepLearning的强大功能提高信号处理性能并提高STM32应用程序的生产率。创建人工神经网络并将其映射到STM32(通过CubeMx自动生成优化的代码),而无需手动构建代码。 以上就做个简短的介绍,想了解更多有关STM32Cube.AI可以访问下面的链接:http://www.st.com/content/st_com ... 2_gl_social_dec2018 - q' c9 I }9 Y5 |$ J c2 e那先前的准备工作就是需要安装最新版本的CubeMx 5.0.1 然后使用CubeMx 去安装X-CUBE-AI插件, 700多M的容量。。慢慢下载吧 下载好后,CubeMx里的Artificial intelligent 激活Enable 这里我们就可以看到里面的选项了 下载下来。。然后选择Keras 的AI API算法 model.h5就是我们需要导入到工程里的AI Keras的训练好的模型 Human Activity Recognition Using Convolutional Neural Network in Keras 人类活动识别卷积神经网络算法模型 然后我们导入到工程里 这里选择压缩参数,不同的压缩参数对MCU的flash容量 要求也不一样。。 点击Analyze cube就好计算使用这个神经网络算法的ram和flash容量占用 好了结果出来了, 经过分析后Cube会自动列出可以使用的MCU 然后显示在列表里 这里举个例子,我们选择没有压缩优化 分析模型算法后的结果我没有匹配的MCU可以使用 这是选择压缩比参数8的结果,可以支持很多的MCU使用这个神经网络算法。。 好了,这里我们就选择STM32F767ZI Nucleo 板卡作为 这次演示使用的板卡 ' G5 p) ]5 W4 \, F! F0 v0 O( L5 y, X- z1 v 选择好Validation 和打勾 AI core 然后在cube 左下方可以看到下图箭头 提示的插件功能 我们需要打勾以下2个功能 0 ?) e" Y& g/ C然后创建我的AI算法名称,这个名称会在后续的里自动创建好。 * ~8 r& Z6 m! T3 A8 m& l添加好,我们下载好的AI神经网络算法,然后再Analyze下就好。。打勾表示验证通过 然后我们需要配置我们的mcu的 CPU ICache 和 CPU DCache 然后配置MCU主频为216Mhz 0 R1 |4 X6 q3 ]$ H9 H 然后我们需要配置串口3和CubeMx进行通讯,验证我们工程。。。 然后在 AI扩展功能里选择通讯端口为串口3 4 s& v! Y$ ~. `- D 好了工程生成好了,我们就可以 使用IAR 打开工程了 工程如下,工程里自动生成了基于AI的算法的所以文件 这里可以看到,基于AI训练好的模型数据列表。。。 好了,配置位STLINK,然后编译好就可以直接下载到板子上了 . Y K- z. _2 z; Q, H F6 \好了,现在我们需要回到CubeMx里,回到 AI扩展功能里。。 先重启下开发板,然后 点击Validation on target 7 |' ]6 L) i% L7 j8 z2 z2 P2 \3 n! C( W 选择手动,然后选择对应的串口端口 2 S1 Q5 q/ b8 d这里可以看到验证已经开始了‘ ’ 好了,结果出来了。我们可以在串口输出的信息里看到有关的数据 9 H0 e n s, y0 M1 o# o+ [4 @: i0 U# z# X) g( C1 f 好了,基于CubeMx+AI扩展库的使用就分享到这了,想了解更多关于 使用STM32 AI的朋友可以关注ST官网的教程。。。 |
【银杏科技ARM+FPGA双核心应用】STM32H7系列10——ADC
破解边缘AI硬件与软件挑战,意法半导体解读三大创新要点
【银杏科技ARM+FPGA双核心应用】STM32H7系列57——MDK_FLM
【STM32图书分享之九】—《STM32F 32位ARM微控制器应用设计与实践》
基于STM32F746G-Discover的扩展电路板
意法半导体助力企业产品智能化,加快边缘人工智能应用
【合集】STM32F7教程、资料大集合
F769 Discovery实现播放U盘音乐的播放器
STM32不至于芯,2023济南站研讨会
ST机器学习汽车解决方案
assembling startup_stm32f767xx.s...- t9 H7 v, e) H2 y, e: [: ~1 [, j
compiling main.c...
../Inc/app_x-cube-ai.h(77): error: #5: cannot open source input file "network.h": No such file or directory, P! ?- H0 e; p, ?& J) i
#include "network.h"
../Src/main.c: 0 warnings, 1 error8 ?5 m0 K' {8 q% Z& \. ^, a: ^
compiling app_x-cube-ai.c...
../Inc/app_x-cube-ai.h(77): error: #5: cannot open source input file "network.h": No such file or directory* p3 x! M4 q9 t1 p. W+ R
#include "network.h"# j9 ?- K! q% ?" A1 c
../Src/app_x-cube-ai.c: 0 warnings, 1 error7 X* Q$ K9 M% `" Z) D6 L
compiling stm32f7xx_it.c...
compiling stm32f7xx_hal_msp.c...* j7 Z3 v$ t& }) T
compiling stm32f7xx_hal_cortex.c...$ h# e6 u) D+ t0 }$ E: M1 G
compiling stm32f7xx_hal_crc.c...# ?' x1 y. D% x2 N6 X# V; ?+ w
compiling stm32f7xx_hal_crc_ex.c...' R; S, X) x" V1 K. y5 T% I2 z
compiling stm32f7xx_hal_tim.c...
compiling stm32f7xx_hal_tim_ex.c...! c! f8 a9 v8 T# O
compiling stm32f7xx_hal_uart.c.../ V7 q% W$ O |9 ^ L% e
compiling stm32f7xx_hal_uart_ex.c...; E- Z" I) y- `- I
compiling stm32f7xx_hal_rcc.c.... t" p/ i" F1 d' A2 t6 p3 w! Q, C/ B
compiling stm32f7xx_hal_rcc_ex.c...* b$ x. o" i8 M2 z
compiling stm32f7xx_hal_flash.c... @+ l7 C" P1 j5 g; E4 U7 _2 o
compiling stm32f7xx_hal_flash_ex.c...+ w# r4 F3 S1 v" Y& X) f
compiling stm32f7xx_hal_gpio.c...
compiling stm32f7xx_hal_dma.c...
compiling stm32f7xx_hal_dma_ex.c...; u* W$ S1 k6 w+ S0 v* h
compiling stm32f7xx_hal_pwr.c...
compiling stm32f7xx_hal_pwr_ex.c...
compiling stm32f7xx_hal.c...
compiling stm32f7xx_hal_i2c.c...
compiling stm32f7xx_hal_i2c_ex.c...% C' p5 t- z G
compiling stm32f7xx_hal_exti.c.... Y$ w& b: G0 D- w4 P& i4 j
compiling system_stm32f7xx.c.... Y) e# c4 r3 O# C/ Q. [
compiling aiPbMgr.c...
../Inc/app_x-cube-ai.h(77): error: #5: cannot open source input file "network.h": No such file or directory$ A' f0 Z+ _, ?4 ]. b
#include "network.h"
../Middlewares/ST/X-CUBE-AI_Application/Validation/Src/aiPbMgr.c: 0 warnings, 1 error
compiling aiTestUtility.c...
../Inc/app_x-cube-ai.h(77): error: #5: cannot open source input file "network.h": No such file or directory
#include "network.h"
../Middlewares/ST/X-CUBE-AI_Application/Validation/Src/aiTestUtility.c: 0 warnings, 1 error, j7 j, x1 m: i1 H1 S% Y
compiling aiValidation.c...
../Inc/app_x-cube-ai.h(77): error: #5: cannot open source input file "network.h": No such file or directory
#include "network.h"
../Middlewares/ST/X-CUBE-AI_Application/Validation/Src/aiValidation.c: 0 warnings, 1 error
compiling pb_common.c...
compiling pb_decode.c...
compiling pb_encode.c...7 O+ c' [. c' m5 ]: y) K7 s
compiling stm32msg.pb.c...
"STM32F767_AI\STM32F767_AI.axf" - 5 Error(s), 0 Warning(s).3 x7 m* |( N# [3 S0 S' j) }' C% O
Target not created.
assembling startup_stm32f767xx.s...9 I- j$ F3 @: l
compiling main.c...
../Inc/app_x-cube-ai.h(77): error: #5: cannot open source input file "network.h": No such file or directory
#include "network.h"! T# B& |" A8 F$ z6 U
../Src/main.c: 0 warnings, 1 error% J6 B: w7 P6 I% ^
compiling app_x-cube-ai.c...1 s- p$ g5 R: `; z3 X- [
../Inc/app_x-cube-ai.h(77): error: #5: cannot open source input file "network.h": No such file or directory
#include "network.h"
../Src/app_x-cube-ai.c: 0 warnings, 1 error9 R0 k2 d9 W( K2 E6 c
compiling stm32f7xx_it.c...1 X' |7 O8 o, W x2 S/ O) W! v7 n
compiling stm32f7xx_hal_msp.c...; ^6 d" W2 ~0 C' x8 z( O
compiling stm32f7xx_hal_cortex.c...3 X Z% Z/ T. e9 W6 a& U% ?" ^
compiling stm32f7xx_hal_crc.c..." \2 A0 V' w0 {7 |
compiling stm32f7xx_hal_crc_ex.c...
compiling stm32f7xx_hal_tim.c...% J! |# \3 @0 o p/ a
compiling stm32f7xx_hal_tim_ex.c...
compiling stm32f7xx_hal_uart.c...
compiling stm32f7xx_hal_uart_ex.c...8 ?$ j$ I' B+ c( t0 j
compiling stm32f7xx_hal_rcc.c...: |& \1 r1 f4 L" {4 ?
compiling stm32f7xx_hal_rcc_ex.c...9 P- k U& B! [; W' N- W
compiling stm32f7xx_hal_flash.c...
compiling stm32f7xx_hal_flash_ex.c...
compiling stm32f7xx_hal_gpio.c...
compiling stm32f7xx_hal_dma.c...
compiling stm32f7xx_hal_dma_ex.c...: a: B! h8 P6 ]8 g9 i2 {2 B, Y
compiling stm32f7xx_hal_pwr.c...' {7 o( d4 @" ]) a: |
compiling stm32f7xx_hal_pwr_ex.c...
compiling stm32f7xx_hal.c...
compiling stm32f7xx_hal_i2c.c...
compiling stm32f7xx_hal_i2c_ex.c...
compiling stm32f7xx_hal_exti.c...
compiling system_stm32f7xx.c...
compiling aiPbMgr.c...
../Inc/app_x-cube-ai.h(77): error: #5: cannot open source input file "network.h": No such file or directory
#include "network.h", ?4 N7 C0 f, S' z8 `- C/ Z
../Middlewares/ST/X-CUBE-AI_Application/Validation/Src/aiPbMgr.c: 0 warnings, 1 error
compiling aiTestUtility.c...
../Inc/app_x-cube-ai.h(77): error: #5: cannot open source input file "network.h": No such file or directory
#include "network.h"; H* M' {; p9 }
../Middlewares/ST/X-CUBE-AI_Application/Validation/Src/aiTestUtility.c: 0 warnings, 1 error
compiling aiValidation.c...
../Inc/app_x-cube-ai.h(77): error: #5: cannot open source input file "network.h": No such file or directory6 _& x K, w9 r' t' F- S+ T. O t
#include "network.h"
../Middlewares/ST/X-CUBE-AI_Application/Validation/Src/aiValidation.c: 0 warnings, 1 error0 k! I! B; y# p# Y
compiling pb_common.c...' L5 i1 e" S4 T9 e
compiling pb_decode.c...
compiling pb_encode.c...
compiling stm32msg.pb.c...+ B* K. N e# b: Y
"STM32F767_AI\STM32F767_AI.axf" - 5 Error(s), 0 Warning(s).
Target not created.
首先确保已经安装了AI库
使能Atificial intelligence后,配置好参数,确保自己使用的单片机是在列表中的。& Z9 U/ l. e" \3 X) j0 C
t8 z5 a9 k$ ?3 ^! s; j. x/ H2 q
如果确定上面操作无误,界面还是空的话那就看看这里的配置是否和你真实的路径是一致的。
厉害了大佬
model.h5就是我们需要导入到工程里的AI Keras的训练好的模型
输出吗 这是去使用库的AI神经算法
我导入model.h5就没反应了,没有出现他教程中的STM32F767AI.H5,请问要怎么操作
导入到工程的时候,没出现STM32F767AI.h5吗( G0 l& X- y0 |! n