fix tflitemicro_person_detection
This commit is contained in:
@@ -2,11 +2,11 @@
|
||||
|
||||
**作者:**
|
||||
|
||||
Github ID: [Derekduke](https://github.com/Derekduke) E-mail: dkeji627@gmail.com
|
||||
Github: [Derekduke](https://github.com/Derekduke) E-mail: dkeji627@gmail.com
|
||||
|
||||
Github ID: [QingChuanWS](https://github.com/QingChuanWS) E-mail: bingshan45@163.com
|
||||
Github: [QingChuanWS](https://github.com/QingChuanWS) E-mail: bingshan45@163.com
|
||||
|
||||
Github ID: [yangqings](https://github.com/yangqings) E-mail: yangqingsheng12@outlook.com
|
||||
Github: [yangqings](https://github.com/yangqings) E-mail: yangqingsheng12@outlook.com
|
||||
|
||||
## 概述
|
||||
|
||||
@@ -50,7 +50,7 @@ Github ID: [yangqings](https://github.com/yangqings) E-mail: yangqingsheng12@ou
|
||||
有三种方式获取tflite_micro:
|
||||
|
||||
1. 从TencentOS tiny 代码仓库 `components\ai\tflite_micro`目录获取;
|
||||
2. 以lib文件的形式使用tflite_micro组件,lib文件`TencentOS-tiny\components\ai\tflite_micro`的ARM_CortexM4_lib、ARM_CortexM7_lib和ARM_CortexM55_lib文件夹
|
||||
2. 以lib文件的形式使用tflite_micro组件,lib文件`TencentOS-tiny\components\ai\tflite_micro`的ARM_CortexM4_lib、ARM_CortexM7_lib和ARM_CortexM55_lib文件夹;
|
||||
3. 从Tensorflow代码仓库获取,TFlite_Micro的源码已经开源,github仓库地址为:https://github.com/tensorflow/tensorflow ,可根据google TFLite Micro官方教程获得Tensorflow Lite Micro的全部源码。
|
||||
|
||||
如果没有tflite_micro开发经验,建议以**第一种**或者**第二种**方式获取tflite_micro,希望自行获取最新源码,或者编译lib文件,请参考`TencentOS-tiny\components\tflite_micro`目录的TFlite_Micro_Component_User_Guide.md文档,本指南将直接使用TencentOS tiny 代码仓库内的tflite_micro组件。
|
||||
@@ -62,12 +62,13 @@ Github ID: [yangqings](https://github.com/yangqings) E-mail: yangqingsheng12@ou
|
||||
以下是整个例程的目录规划:
|
||||
|
||||
| 一级目录 | 二级目录 | 三级目录 | 说明 |
|
||||
| :-------: | :--------------------------: | :----------: | :----------------------------------------------------------: |
|
||||
| :-------: | :--------------------------: | :-------------------: | :----------------------------------------------------------: |
|
||||
| arch | arm | | TencentOS tiny适配的IP核架构(含M核中断、调度、tick相关代码) |
|
||||
| board | NUCLEO_STM32L496ZG | | 移植目标芯片的工程文件 |
|
||||
| | | BSP | 板级支持包,外设驱动代码在Hardware目录 |
|
||||
| component | ai | tflite_micro | tflite_micro源码 |
|
||||
| component | ai | tflite_micro | tflite_micro源码及有关库文件 |
|
||||
| examples | tflitemicro_person_detection | | 行人检测demo示例 |
|
||||
| | | tflu_person_detection | 行人检测实例代码 |
|
||||
| kernel | core | | TencentOS tiny内核源码 |
|
||||
| | pm | | TencentOS tiny低功耗模块源码 |
|
||||
| osal | cmsis_os | | TencentOS tiny提供的cmsis os 适配 |
|
||||
@@ -209,9 +210,9 @@ void task1(void *arg)
|
||||
|
||||
其中,retarget.c的路径为:`TencentOS-tiny\components\ai\tflite_micro\KEIL\retarget.c`
|
||||
|
||||
tensorflow_lite_micro.lib的路径为:`TencentOS-tiny\components\ai\tflite_micro\ARM_CortexM4_lib\tensorflow_lite_micro.lib`
|
||||
tensorflow_lite_micro.lib的路径为:`TencentOS-stiny\components\ai\tflite_micro\ARM_CortexM4_lib\tensorflow_lite_micro.lib`
|
||||
|
||||
其余.cc文件均在当前目录下的`tflu_person_detection`文件夹中。
|
||||
其余.cc文件和.h均在`examples\tflu_person_detection\tflu_person_detection`文件夹中。
|
||||
|
||||
#### 1.3 关闭Keil的MicroLib库
|
||||
|
||||
@@ -243,7 +244,7 @@ TencentOS-tiny\components\ai\tflite_micro\ARM_CortexM4_lib\tensorflow\lite\micro
|
||||
|
||||
本例程的任务函数在
|
||||
|
||||
`TencentOS-tiny\examples\tflitemicro_person_detection\tflitemicro_person_detection.c`目录下
|
||||
`TencentOS-tiny\examples\tflitemicro_person_detection\tflitemicro_person_detection.c`
|
||||
|
||||
#### 2.1 图像预处理
|
||||
|
||||
@@ -311,13 +312,13 @@ void task2(void *arg)
|
||||
|
||||
#### 2.3 运行效果
|
||||
|
||||
通过串行输出实时打印信息,移动摄像头,镜头没有对准行人时,输出如下:
|
||||
通过串行输出实时打印信息,移动摄像头,没有对准行人时,输出如下:
|
||||
|
||||
<div align=center>
|
||||
<img src="./image/reasult_no_person.png" width=70% />
|
||||
</div>
|
||||
|
||||
当镜头对准行人时,输出如下:
|
||||
当摄像头对准行人时,输出如下:
|
||||
|
||||
<div align=center>
|
||||
<img src="./image/reasult_person.png" width=70% />
|
||||
|
@@ -1,23 +0,0 @@
|
||||
## TencentOS-tiny_Person_Detection_Demo
|
||||
|
||||
### 1. 目录结构:
|
||||
|
||||
- TencentOS-tiny\board\NUCLEO_STM32L496ZG\BSP\Hardware : **外设驱动代码**
|
||||
- TencentOS-tiny\examples\tflitemicro_person_detection : **Demo任务函数**
|
||||
- TencentOS-tiny\board\NUCLEO_STM32L496ZG\KEIL\tflitemicro_person_detection : **keil工程**
|
||||
- TencentOS-tiny\components\tflite_micro\tensorflow : **tflite_micro代码**
|
||||
|
||||
### 2. 完成的工作:
|
||||
|
||||
- 使用STM32CubeMX,选择与TOS同版本的固件库重新生成外设初始化代码;
|
||||
- TOS、摄像头和LCD工作都正常工作;
|
||||
- tflite_micro 以component的形式加到工程
|
||||
- retarget.c引入工程,并通过宏进行选择
|
||||
- example中行人检测demo已经可以正常工作
|
||||
|
||||
### 3. 未完成的工作:
|
||||
|
||||
- 变量名、函数名还没有按照TOS的风格完全统一
|
||||
- keil移植指南
|
||||
- tflite_micro用户指南
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -137,7 +137,7 @@
|
||||
<DriverSelection>4107</DriverSelection>
|
||||
</Flash1>
|
||||
<bUseTDR>1</bUseTDR>
|
||||
<Flash2>STLink\ST-LINKIII-KEIL_SWO.dll</Flash2>
|
||||
<Flash2>BIN\UL2CM3.DLL</Flash2>
|
||||
<Flash3></Flash3>
|
||||
<Flash4></Flash4>
|
||||
<pFcarmOut></pFcarmOut>
|
||||
@@ -339,7 +339,7 @@
|
||||
<MiscControls></MiscControls>
|
||||
<Define>USE_HAL_DRIVER,STM32L496xx,NUCLEO_STM32L496ZG</Define>
|
||||
<Undefine></Undefine>
|
||||
<IncludePath>..\..\BSP\Inc;..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Inc;..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Inc\Legacy;..\..\..\..\platform\vendor_bsp\st\CMSIS\Device\ST\STM32L4xx\Include;..\..\..\..\platform\vendor_bsp\st\CMSIS\Include;..\..\..\..\arch\arm\arm-v7m\common\include;..\..\..\..\arch\arm\arm-v7m\cortex-m4\armcc;..\..\..\..\kernel\core\include;..\..\..\..\kernel\pm\include;..\..\..\..\osal\cmsis_os;..\..\..\..\examples\hello_world;..\..\TOS_CONFIG;..\..\..\..\net\at\include;..\..\..\..\kernel\hal\include;..\..\BSP\Hardware\Inc;..\..\..\..\components\ai\tflite_micro\ARM_CortexM4_lib;..\..\..\..\components\ai\tflite_micro\ARM_CortexM4_lib\third_party\flatbuffers\include;..\..\..\..\components\ai\tflite_micro\ARM_CortexM4_lib\third_party\gemmlowp;..\..\..\..\components\ai\tflite_micro\ARM_CortexM4_lib\third_party\kissfft;..\..\..\..\components\ai\tflite_micro\ARM_CortexM4_lib\third_party\ruy;..\..\..\..\components\ai\tflite_micro\ARM_CortexM4_lib\tensorflow\lite\micro\tools\make\downloads</IncludePath>
|
||||
<IncludePath>..\..\BSP\Inc;..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Inc;..\..\..\..\platform\vendor_bsp\st\STM32L4xx_HAL_Driver\Inc\Legacy;..\..\..\..\platform\vendor_bsp\st\CMSIS\Device\ST\STM32L4xx\Include;..\..\..\..\platform\vendor_bsp\st\CMSIS\Include;..\..\..\..\arch\arm\arm-v7m\common\include;..\..\..\..\arch\arm\arm-v7m\cortex-m4\armcc;..\..\..\..\kernel\core\include;..\..\..\..\kernel\pm\include;..\..\..\..\osal\cmsis_os;..\..\..\..\examples\hello_world;..\..\TOS_CONFIG;..\..\..\..\net\at\include;..\..\..\..\kernel\hal\include;..\..\BSP\Hardware\Inc;..\..\..\..\components\ai\tflite_micro\ARM_CortexM4_lib;..\..\..\..\components\ai\tflite_micro\ARM_CortexM4_lib\third_party\flatbuffers\include;..\..\..\..\components\ai\tflite_micro\ARM_CortexM4_lib\third_party\gemmlowp;..\..\..\..\components\ai\tflite_micro\ARM_CortexM4_lib\third_party\kissfft;..\..\..\..\components\ai\tflite_micro\ARM_CortexM4_lib\third_party\ruy;..\..\..\..\components\ai\tflite_micro\ARM_CortexM4_lib\tensorflow\lite\micro\tools\make\downloads;..\..\..\..\examples\tflitemicro_person_detection\tflu_person_detection</IncludePath>
|
||||
</VariousControls>
|
||||
</Cads>
|
||||
<Aads>
|
||||
@@ -778,31 +778,6 @@
|
||||
<Group>
|
||||
<GroupName>tensorflow</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>person_detect_model_data.cc</FileName>
|
||||
<FileType>8</FileType>
|
||||
<FilePath>.\tflu_person_detection\person_detect_model_data.cc</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>model_settings.cc</FileName>
|
||||
<FileType>8</FileType>
|
||||
<FilePath>.\tflu_person_detection\model_settings.cc</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>main_functions.cc</FileName>
|
||||
<FileType>8</FileType>
|
||||
<FilePath>.\tflu_person_detection\main_functions.cc</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>image_provider.cc</FileName>
|
||||
<FileType>8</FileType>
|
||||
<FilePath>.\tflu_person_detection\image_provider.cc</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>detection_responder.cc</FileName>
|
||||
<FileType>8</FileType>
|
||||
<FilePath>.\tflu_person_detection\detection_responder.cc</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>retarget.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
@@ -813,6 +788,31 @@
|
||||
<FileType>4</FileType>
|
||||
<FilePath>..\..\..\..\components\ai\tflite_micro\ARM_CortexM4_lib\tensorflow_lite_micro_M4.lib</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>detection_responder.cc</FileName>
|
||||
<FileType>8</FileType>
|
||||
<FilePath>..\..\..\..\examples\tflitemicro_person_detection\tflu_person_detection\detection_responder.cc</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>image_provider.cc</FileName>
|
||||
<FileType>8</FileType>
|
||||
<FilePath>..\..\..\..\examples\tflitemicro_person_detection\tflu_person_detection\image_provider.cc</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>main_functions.cc</FileName>
|
||||
<FileType>8</FileType>
|
||||
<FilePath>..\..\..\..\examples\tflitemicro_person_detection\tflu_person_detection\main_functions.cc</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>model_settings.cc</FileName>
|
||||
<FileType>8</FileType>
|
||||
<FilePath>..\..\..\..\examples\tflitemicro_person_detection\tflu_person_detection\model_settings.cc</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>person_detect_model_data.cc</FileName>
|
||||
<FileType>8</FileType>
|
||||
<FilePath>..\..\..\..\examples\tflitemicro_person_detection\tflu_person_detection\person_detect_model_data.cc</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
|
@@ -1,3 +1,13 @@
|
||||
/**
|
||||
* @file tflitemicro_person_detection.c
|
||||
* @author Derekduke (dkeji627@gmail.com); QingChuanWS (bingshan45@163.com); yangqings (yangqingsheng12@outlook.com)
|
||||
* @brief Person detection example based on TencentOS-Tiny and TFlite_Micro.
|
||||
* @version 0.1
|
||||
* @date 2021-01-05
|
||||
* @copyright Copyright (c) 2021
|
||||
*
|
||||
*/
|
||||
|
||||
#include "cmsis_os.h"
|
||||
#include "mcu_init.h"
|
||||
|
||||
@@ -37,7 +47,7 @@ void task1(void *arg)
|
||||
{
|
||||
while (1) {
|
||||
if(frame_flag == 1){
|
||||
|
||||
printf("*person_detect_task\r\n");
|
||||
if(HAL_DCMI_Stop(&hdcmi))Error_Handler(); //stop DCMI
|
||||
input_convert(camera_buffer,model_buffer);
|
||||
person_detect(model_buffer);
|
||||
@@ -55,8 +65,8 @@ void task1(void *arg)
|
||||
void task2(void *arg)
|
||||
{
|
||||
while (1) {
|
||||
printf("***person detection task\r\n");
|
||||
osDelay(50);
|
||||
//printf("***task2\r\n");
|
||||
osDelay(200);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user