偶然看到一篇好文章,分享给大家。 0 e% W4 }, f: g+ m) a/ F9 f) k% E+ V% ] 今天介绍下ST官方刚刚推出的CubeMx 自带的X-CUBE-AI(Artificial intelligent)插件功能,可以给现有的STM32 M3-M7高性能的处理器添加基于训练好的ANN 的模型用于不同的数据分析处理。 使用STM32Cube.AI简化了人工神经网络映射 1.可与流行的深度学习培训工具互操作 2.兼容许多IDE和编译器 3.传感器和RTOS无关 4.允许多个人工神经网络在单个STM32MCU上运行 5.完全支持超低功耗STM32MCU 提高您的工作效率 # [6 h: N8 k7 ?利用DeepLearning的强大功能提高信号处理性能并提高STM32应用程序的生产率。创建人工神经网络并将其映射到STM32(通过CubeMx自动生成优化的代码),而无需手动构建代码。 以上就做个简短的介绍,想了解更多有关STM32Cube.AI可以访问下面的链接:http://www.st.com/content/st_com ... 2_gl_social_dec2018 / Q% C4 U) L( O2 ?7 w! N' E. A( n, G% X那先前的准备工作就是需要安装最新版本的CubeMx 5.0.1 然后使用CubeMx 去安装X-CUBE-AI插件, 700多M的容量。。慢慢下载吧 下载好后,CubeMx里的Artificial intelligent 激活Enable 这里我们就可以看到里面的选项了 下载下来。。然后选择Keras 的AI API算法 : M/ X6 I$ D( K7 P4 _model.h5就是我们需要导入到工程里的AI Keras的训练好的模型 ) u, P4 `+ J# U1 J9 xHuman Activity Recognition Using Convolutional Neural Network in Keras 人类活动识别卷积神经网络算法模型 然后我们导入到工程里 这里选择压缩参数,不同的压缩参数对MCU的flash容量 要求也不一样。。 点击Analyze cube就好计算使用这个神经网络算法的ram和flash容量占用 好了结果出来了, 经过分析后Cube会自动列出可以使用的MCU 然后显示在列表里 这里举个例子,我们选择没有压缩优化 分析模型算法后的结果我没有匹配的MCU可以使用 这是选择压缩比参数8的结果,可以支持很多的MCU使用这个神经网络算法。。 好了,这里我们就选择STM32F767ZI Nucleo 板卡作为 这次演示使用的板卡 ; P7 l' p+ t# @$ G F3 W" K, h% \" F; `% s% [* W# K: u 选择好Validation 和打勾 AI core 5 |) }0 T1 o0 M! g v) @, k然后在cube 左下方可以看到下图箭头 提示的插件功能 我们需要打勾以下2个功能 然后创建我的AI算法名称,这个名称会在后续的里自动创建好。 / L# @: ^0 o" \$ I' _添加好,我们下载好的AI神经网络算法,然后再Analyze下就好。。打勾表示验证通过 然后我们需要配置我们的mcu的 CPU ICache 和 CPU DCache 然后配置MCU主频为216Mhz $ I @/ Y0 E5 U- N! a 然后我们需要配置串口3和CubeMx进行通讯,验证我们工程。。。 然后在 AI扩展功能里选择通讯端口为串口3 好了工程生成好了,我们就可以 使用IAR 打开工程了 工程如下,工程里自动生成了基于AI的算法的所以文件 这里可以看到,基于AI训练好的模型数据列表。。。 7 ~9 |& C& w0 T b- s好了,配置位STLINK,然后编译好就可以直接下载到板子上了 3 ]/ x+ W4 Y; f) [" w好了,现在我们需要回到CubeMx里,回到 AI扩展功能里。。 先重启下开发板,然后 点击Validation on target - n5 c. @6 k* i" W3 ?% }! t, H2 Q 选择手动,然后选择对应的串口端口 这里可以看到验证已经开始了‘ ’ 好了,结果出来了。我们可以在串口输出的信息里看到有关的数据 : A; W! ~ x# v1 H好了,基于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...7 c; T( r% w& }* F8 Q" Y- P4 S, Y
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"
../Src/main.c: 0 warnings, 1 error
compiling app_x-cube-ai.c...; I; H) t0 t8 O7 K. E$ m: v' S
../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 error7 |6 {7 `% j& o
compiling stm32f7xx_it.c...- [" O! ~: G* Z1 l) a6 w7 _
compiling stm32f7xx_hal_msp.c...
compiling stm32f7xx_hal_cortex.c...
compiling stm32f7xx_hal_crc.c...% ^- I W! O3 }2 u# p" \* Y6 C" A+ M
compiling stm32f7xx_hal_crc_ex.c...$ b( J7 z! N1 S& q8 R0 b) M6 O: i
compiling stm32f7xx_hal_tim.c...+ ?8 X6 r- @: n: R
compiling stm32f7xx_hal_tim_ex.c...5 D8 f- X/ X0 f. t: Q1 A3 M3 a
compiling stm32f7xx_hal_uart.c...
compiling stm32f7xx_hal_uart_ex.c...
compiling stm32f7xx_hal_rcc.c...; C1 Y7 r: g$ }% Y7 J
compiling stm32f7xx_hal_rcc_ex.c...
compiling stm32f7xx_hal_flash.c...8 _4 B7 h0 {0 d8 a6 q2 K- w- `
compiling stm32f7xx_hal_flash_ex.c...
compiling stm32f7xx_hal_gpio.c...
compiling stm32f7xx_hal_dma.c...
compiling stm32f7xx_hal_dma_ex.c...
compiling stm32f7xx_hal_pwr.c..., I& h" H. _& f6 V3 g* H
compiling stm32f7xx_hal_pwr_ex.c...
compiling stm32f7xx_hal.c...$ {. I! H: I" p/ f. m
compiling stm32f7xx_hal_i2c.c...
compiling stm32f7xx_hal_i2c_ex.c...# }7 i( G6 _* _
compiling stm32f7xx_hal_exti.c...6 D, d4 _9 O7 Y5 p$ s) {' V$ r" Q+ P
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"
../Middlewares/ST/X-CUBE-AI_Application/Validation/Src/aiPbMgr.c: 0 warnings, 1 error9 t/ `( C& O' P+ I
compiling aiTestUtility.c...
../Inc/app_x-cube-ai.h(77): error: #5: cannot open source input file "network.h": No such file or directory2 Z$ `5 W5 f2 z2 C, J
#include "network.h"5 p& O' C; A" |. l" o! Q0 U
../Middlewares/ST/X-CUBE-AI_Application/Validation/Src/aiTestUtility.c: 0 warnings, 1 error$ ?8 P$ ]6 I2 t. ?/ k/ U
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" c: Q4 o. C7 r2 z, o
../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...
compiling stm32msg.pb.c.../ Z: v* O' e0 _* A: j
"STM32F767_AI\STM32F767_AI.axf" - 5 Error(s), 0 Warning(s).
Target not created.
assembling startup_stm32f767xx.s...8 j3 ~: s T. Z# F7 Q
compiling main.c...( `$ p6 d* F! u; f9 i( q& m& u
../Inc/app_x-cube-ai.h(77): error: #5: cannot open source input file "network.h": No such file or directory2 e1 ?) l, x( L. s7 W
#include "network.h"
../Src/main.c: 0 warnings, 1 error, c2 J+ `/ B Z4 x5 I+ I2 E
compiling app_x-cube-ai.c.../ z( s# V b4 z" ~/ D: u
../Inc/app_x-cube-ai.h(77): error: #5: cannot open source input file "network.h": No such file or directory8 a/ z! o! g$ C% ~$ z
#include "network.h"
../Src/app_x-cube-ai.c: 0 warnings, 1 error; n$ {' Q) b b! x# [
compiling stm32f7xx_it.c...: f- ?! O) x; g+ Q7 w
compiling stm32f7xx_hal_msp.c...
compiling stm32f7xx_hal_cortex.c...
compiling stm32f7xx_hal_crc.c...# g, h8 e" ~/ u" X# T) }/ U V
compiling stm32f7xx_hal_crc_ex.c...6 d1 ^- T" h( [1 Q! h0 s
compiling stm32f7xx_hal_tim.c...# {/ E' u* k4 E- m& M
compiling stm32f7xx_hal_tim_ex.c...
compiling stm32f7xx_hal_uart.c...
compiling stm32f7xx_hal_uart_ex.c..., [1 c3 K( C$ d* Q% A% I
compiling stm32f7xx_hal_rcc.c...
compiling stm32f7xx_hal_rcc_ex.c...
compiling stm32f7xx_hal_flash.c.../ a h# u2 O' C# ?: z
compiling stm32f7xx_hal_flash_ex.c...
compiling stm32f7xx_hal_gpio.c...
compiling stm32f7xx_hal_dma.c...& t6 v: I& i1 f Y
compiling stm32f7xx_hal_dma_ex.c...+ U8 @# m8 T% O& K( P
compiling stm32f7xx_hal_pwr.c...
compiling stm32f7xx_hal_pwr_ex.c...
compiling stm32f7xx_hal.c...
compiling stm32f7xx_hal_i2c.c...5 C: F+ l, L F2 E) g7 G1 v
compiling stm32f7xx_hal_i2c_ex.c...
compiling stm32f7xx_hal_exti.c...9 i* f$ e- V2 z) Y; h
compiling system_stm32f7xx.c...0 e$ G: G0 o7 p- [) T& L2 Y
compiling aiPbMgr.c...- |* E6 k5 I* X: u
../Inc/app_x-cube-ai.h(77): error: #5: cannot open source input file "network.h": No such file or directory3 P# \4 ?; `: d' O
#include "network.h"% O) A( q( f" |, G4 D" Y
../Middlewares/ST/X-CUBE-AI_Application/Validation/Src/aiPbMgr.c: 0 warnings, 1 error
compiling aiTestUtility.c...3 F6 s# a0 O$ X4 N6 J. w- _7 b
../Inc/app_x-cube-ai.h(77): error: #5: cannot open source input file "network.h": No such file or directory
#include "network.h"6 v8 N8 Z) [% P! x( G
../Middlewares/ST/X-CUBE-AI_Application/Validation/Src/aiTestUtility.c: 0 warnings, 1 error* ~' Q' X! @3 D# n
compiling aiValidation.c...
../Inc/app_x-cube-ai.h(77): error: #5: cannot open source input file "network.h": No such file or directory& m- D* o. V. ^! g# t" o0 [
#include "network.h"
../Middlewares/ST/X-CUBE-AI_Application/Validation/Src/aiValidation.c: 0 warnings, 1 error. d) y8 B& s9 \/ Q6 D& Z) U C2 R
compiling pb_common.c...
compiling pb_decode.c...: F1 x" ]2 S6 l$ ~9 @& a1 U
compiling pb_encode.c...
compiling stm32msg.pb.c...6 ]% f0 o1 q5 N4 Q3 a3 z, U
"STM32F767_AI\STM32F767_AI.axf" - 5 Error(s), 0 Warning(s)./ t6 D& u' e6 ]) q
Target not created.
首先确保已经安装了AI库7 ^. h, U2 G# v0 a1 B
使能Atificial intelligence后,配置好参数,确保自己使用的单片机是在列表中的。
+ S- y# j6 H6 X2 I
3 T! @ ^$ U0 G# [; J; j
如果确定上面操作无误,界面还是空的话那就看看这里的配置是否和你真实的路径是一致的。& B, S: D+ }% c; I6 k$ u& k
厉害了大佬
model.h5就是我们需要导入到工程里的AI Keras的训练好的模型
输出吗 这是去使用库的AI神经算法
我导入model.h5就没反应了,没有出现他教程中的STM32F767AI.H5,请问要怎么操作
导入到工程的时候,没出现STM32F767AI.h5吗7 Y3 F0 Q* |/ x7 h s4 a