偶然看到一篇好文章,分享给大家。 今天介绍下ST官方刚刚推出的CubeMx 自带的X-CUBE-AI(Artificial intelligent)插件功能,可以给现有的STM32 M3-M7高性能的处理器添加基于训练好的ANN 的模型用于不同的数据分析处理。 使用STM32Cube.AI简化了人工神经网络映射 1.可与流行的深度学习培训工具互操作 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 & i8 @+ k% x6 n) k% J8 l+ {& z那先前的准备工作就是需要安装最新版本的CubeMx 5.0.1 然后使用CubeMx 去安装X-CUBE-AI插件, 700多M的容量。。慢慢下载吧 ; z7 t8 |; M/ x' O/ E [5 `+ y下载好后,CubeMx里的Artificial intelligent 激活Enable 这里我们就可以看到里面的选项了 下载下来。。然后选择Keras 的AI API算法 % H; l$ R+ o' y- ^model.h5就是我们需要导入到工程里的AI Keras的训练好的模型 , F. P% U& A+ \Human Activity Recognition Using Convolutional Neural Network in Keras 人类活动识别卷积神经网络算法模型 然后我们导入到工程里 这里选择压缩参数,不同的压缩参数对MCU的flash容量 要求也不一样。。 点击Analyze cube就好计算使用这个神经网络算法的ram和flash容量占用 " T+ b7 S8 M4 r+ S" K好了结果出来了, 经过分析后Cube会自动列出可以使用的MCU 然后显示在列表里 这里举个例子,我们选择没有压缩优化 分析模型算法后的结果我没有匹配的MCU可以使用 这是选择压缩比参数8的结果,可以支持很多的MCU使用这个神经网络算法。。 2 t+ Y5 {6 J+ U2 r) R好了,这里我们就选择STM32F767ZI Nucleo 板卡作为 这次演示使用的板卡 $ O8 Q) q5 _/ Z* E% C- C8 L3 o$ m7 K9 W & x7 u3 f+ O9 B6 C* | 选择好Validation 和打勾 AI core 然后在cube 左下方可以看到下图箭头 提示的插件功能 我们需要打勾以下2个功能 3 J: R9 \. ]+ i9 ^9 s @然后创建我的AI算法名称,这个名称会在后续的里自动创建好。 * X7 I: x( l6 E. f$ \2 j9 q9 R添加好,我们下载好的AI神经网络算法,然后再Analyze下就好。。打勾表示验证通过 & b1 z4 B- k9 q$ c6 y然后我们需要配置我们的mcu的 CPU ICache 和 CPU DCache 然后配置MCU主频为216Mhz ! v4 C- x$ S% N, a, N; ^ 然后我们需要配置串口3和CubeMx进行通讯,验证我们工程。。。 然后在 AI扩展功能里选择通讯端口为串口3 ( ], U0 {8 O+ F) U+ \& xi! `# c' L s9 o1 y R 好了工程生成好了,我们就可以 使用IAR 打开工程了 工程如下,工程里自动生成了基于AI的算法的所以文件 9 i4 x- N0 k$ y+ D! Q这里可以看到,基于AI训练好的模型数据列表。。。 好了,配置位STLINK,然后编译好就可以直接下载到板子上了 好了,现在我们需要回到CubeMx里,回到 AI扩展功能里。。 先重启下开发板,然后 点击Validation on target 3 E6 @6 x: ~3 N2 j9 i# F6 ?! w8 X+ q0 Q- g选择手动,然后选择对应的串口端口 这里可以看到验证已经开始了‘ ’$ l4 K% y) h+ d c) Q. N 好了,结果出来了。我们可以在串口输出的信息里看到有关的数据 好了,基于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 VS Code Extension (在Ubuntu上开发STM32,ST官方vscode插件使用指南)
无刷直流电机控制应用+基于STM8S系列单片机---电子书
assembling startup_stm32f767xx.s...: y/ E' H& e8 ]6 g6 w
compiling main.c...9 b* N1 R+ a( n8 `, J" W* P4 n- ~
../Inc/app_x-cube-ai.h(77): error: #5: cannot open source input file "network.h": No such file or directory
#include "network.h"8 n. G- L5 t+ e9 w) N) `3 k
../Src/main.c: 0 warnings, 1 error8 i& y) M3 \ C G; v6 p! B
compiling app_x-cube-ai.c...7 U& e( r3 k8 Q9 t$ T* F2 _
../Inc/app_x-cube-ai.h(77): error: #5: cannot open source input file "network.h": No such file or directory! L# g+ [) e, d
#include "network.h"/ W! @, {8 K; u5 U% x* Y9 v
../Src/app_x-cube-ai.c: 0 warnings, 1 error Z! X# \& g. c f, S5 u9 N, [$ z; P
compiling stm32f7xx_it.c...6 Q/ v1 ?) P- \6 z. p) J
compiling stm32f7xx_hal_msp.c...
compiling stm32f7xx_hal_cortex.c...: n4 f4 {& C# U2 K* U) k
compiling stm32f7xx_hal_crc.c...- `! y a% X; `% a/ N& [7 y, ?
compiling stm32f7xx_hal_crc_ex.c...' s& A/ v8 @7 q
compiling stm32f7xx_hal_tim.c...
compiling stm32f7xx_hal_tim_ex.c...$ M& S# v9 |/ J4 m' _" ]+ a& ~
compiling stm32f7xx_hal_uart.c...5 K" o3 U7 r; `" p& i' z3 @
compiling stm32f7xx_hal_uart_ex.c...
compiling stm32f7xx_hal_rcc.c...
compiling stm32f7xx_hal_rcc_ex.c...
compiling stm32f7xx_hal_flash.c...
compiling stm32f7xx_hal_flash_ex.c...0 S- ^, ~! g. ]! _8 U7 r
compiling stm32f7xx_hal_gpio.c...
compiling stm32f7xx_hal_dma.c...
compiling stm32f7xx_hal_dma_ex.c...
compiling stm32f7xx_hal_pwr.c...( s" p% \9 b! Y3 i0 x
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$ K. C) u, ~& d' z" }
#include "network.h"3 F% G+ l% ]: L! G; {. W. ?
../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 directory6 j2 v3 ?8 a3 f' [$ c) p1 }
#include "network.h"! r; n7 m1 V: F# S3 x8 X# B
../Middlewares/ST/X-CUBE-AI_Application/Validation/Src/aiTestUtility.c: 0 warnings, 1 error8 R, l( l [, ]
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"' |+ b$ q6 p3 x( V( t& i8 e
../Middlewares/ST/X-CUBE-AI_Application/Validation/Src/aiValidation.c: 0 warnings, 1 error3 k+ I2 g' z+ Q
compiling pb_common.c...
compiling pb_decode.c...
compiling pb_encode.c...0 ] a0 W8 X, }4 _0 A1 W
compiling stm32msg.pb.c...# s* y$ g* w% U# Q( I4 v! T
"STM32F767_AI\STM32F767_AI.axf" - 5 Error(s), 0 Warning(s).
Target not created.
assembling startup_stm32f767xx.s...
compiling main.c...
../Inc/app_x-cube-ai.h(77): error: #5: cannot open source input file "network.h": No such file or directory6 l- o7 w8 @) F- V) ^6 C
#include "network.h"7 B; t G R2 y7 k; ]
../Src/main.c: 0 warnings, 1 error
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! P2 u9 [3 B. G! A' E
#include "network.h"
../Src/app_x-cube-ai.c: 0 warnings, 1 error: v( Y' W, v- ^+ I' [) }
compiling stm32f7xx_it.c...% z) g9 z$ h% g1 t
compiling stm32f7xx_hal_msp.c...; {7 k( D+ F- G0 X
compiling stm32f7xx_hal_cortex.c...2 j1 r) j7 u1 C! Q& v) ]" a
compiling stm32f7xx_hal_crc.c...
compiling stm32f7xx_hal_crc_ex.c...2 Z3 ?# ~' W R* G' J* |* N
compiling stm32f7xx_hal_tim.c...
compiling stm32f7xx_hal_tim_ex.c...0 ?4 c/ L- m( Z7 {9 O3 N- z# L+ j
compiling stm32f7xx_hal_uart.c...
compiling stm32f7xx_hal_uart_ex.c...9 p# F* }# h- l+ ], e
compiling stm32f7xx_hal_rcc.c...2 m7 n- a! R4 ]3 n2 k9 ^/ g
compiling stm32f7xx_hal_rcc_ex.c...; i m. J! ?" T" l' P* {$ \
compiling stm32f7xx_hal_flash.c...
compiling stm32f7xx_hal_flash_ex.c...) T! S% B( K: S. t& S, _ T
compiling stm32f7xx_hal_gpio.c...( \+ v- y& m) y; H ?3 s# s H
compiling stm32f7xx_hal_dma.c...4 S1 e. s+ q% E) _* u. [/ p5 E% I6 a
compiling stm32f7xx_hal_dma_ex.c...
compiling stm32f7xx_hal_pwr.c..., G$ p; Z! L7 `, t; D! O
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...4 e6 Z1 q) s* |+ \
compiling system_stm32f7xx.c...) U8 p% x) m9 V" R2 E- g0 o9 b- g
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"
../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 directory1 F8 b6 c9 |4 l$ J8 H2 d: P
#include "network.h"6 L* X- W) j8 V! x7 A1 T: {$ u1 M A
../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 directory
#include "network.h": J* [2 h- |+ A0 {
../Middlewares/ST/X-CUBE-AI_Application/Validation/Src/aiValidation.c: 0 warnings, 1 error6 J$ } c3 N5 u- N, j% N
compiling pb_common.c...
compiling pb_decode.c...
compiling pb_encode.c...! U+ `5 D5 U5 [3 K/ S2 Y
compiling stm32msg.pb.c...
"STM32F767_AI\STM32F767_AI.axf" - 5 Error(s), 0 Warning(s).( G, E6 u6 Q( [+ {7 h
Target not created.
首先确保已经安装了AI库
- k1 E B) ^4 ^$ O# W5 n4 b" ~
使能Atificial intelligence后,配置好参数,确保自己使用的单片机是在列表中的。
' Y1 t9 B' u& u4 g0 B+ D
9 i2 X2 h5 `, F0 A
如果确定上面操作无误,界面还是空的话那就看看这里的配置是否和你真实的路径是一致的。4 ^' e7 u; L& |9 \
厉害了大佬
model.h5就是我们需要导入到工程里的AI Keras的训练好的模型
输出吗 这是去使用库的AI神经算法
我导入model.h5就没反应了,没有出现他教程中的STM32F767AI.H5,请问要怎么操作
导入到工程的时候,没出现STM32F767AI.h5吗