forked from xuos/xiuos
refactor(knowing app): add common k210 yolov2 detection procedure
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
config K210_DETECT_ENTRY
|
||||
bool "enable apps/k210 detect entry"
|
||||
depends on BOARD_K210_EVB
|
||||
depends on DRV_USING_OV2640
|
||||
depends on USING_KPU_PROCESSING
|
||||
depends on USING_YOLOV2
|
||||
depends on USING_YOLOV2_JSONPARSER
|
||||
depends on USING_K210_DETECT
|
||||
select LIB_USING_CJSON
|
||||
default n
|
||||
|
||||
config K210_DETECT_CONFIGJSON
|
||||
string "k210 detect config path"
|
||||
default "/kmodel/face.json"
|
||||
---help---
|
||||
k210 detect task config json path
|
||||
@@ -0,0 +1,35 @@
|
||||
# Face detection demo
|
||||
|
||||
### A face object detection task demo. Running MobileNet-yolo on K210-based edge devices.
|
||||
|
||||
---
|
||||
|
||||
## Training
|
||||
|
||||
kmodel from [GitHub](https://github.com/kendryte/kendryte-standalone-demo/blob/develop/face_detect/detect.kmodel).
|
||||
|
||||
## Deployment
|
||||
|
||||
### compile and burn
|
||||
|
||||
Use `(scons --)menuconfig` in bsp folder *(Ubiquitous/RT_Thread/bsp/k210)*, open:
|
||||
|
||||
- More Drivers --> ov2640 driver
|
||||
- Board Drivers Config --> Enable LCD on SPI0
|
||||
- Board Drivers Config --> Enable SDCARD (spi1(ss0))
|
||||
- Board Drivers Config --> Enable DVP(camera)
|
||||
- RT-Thread Components --> POSIX layer and C standard library --> Enable pthreads APIs
|
||||
- APP_Framework --> Framework --> support knowing framework --> kpu model postprocessing --> yolov2 region layer
|
||||
- APP_Framework --> Applications --> knowing app --> enable apps/face detect
|
||||
|
||||
`scons -j(n)` to compile and burn in by *kflash*.
|
||||
|
||||
### json config and kmodel
|
||||
|
||||
Copy json config for deployment o SD card */kmodel*. Example config file is *detect.json* in this directory. Copy final kmodel to SD card */kmodel* either.
|
||||
|
||||
---
|
||||
|
||||
## Run
|
||||
|
||||
In serial terminal, `face_detect` to start a detection thread, `face_detect_delete` to stop it. Detection results can be found in output.
|
||||
@@ -0,0 +1,9 @@
|
||||
from building import *
|
||||
|
||||
cwd = GetCurrentDir()
|
||||
src = Glob('*.c') + Glob('*.cpp')
|
||||
CPPPATH = [cwd]
|
||||
|
||||
group = DefineGroup('Applications', src, depend = ['USING_K210_DETECT'], LOCAL_CPPPATH = CPPPATH)
|
||||
|
||||
Return('group')
|
||||
@@ -0,0 +1,36 @@
|
||||
{
|
||||
"net_input_size": [
|
||||
240,
|
||||
320
|
||||
],
|
||||
"net_output_shape": [
|
||||
20,
|
||||
15,
|
||||
30
|
||||
],
|
||||
"sensor_output_size": [
|
||||
240,
|
||||
320
|
||||
],
|
||||
"anchors": [
|
||||
1.889,
|
||||
2.5245,
|
||||
2.9465,
|
||||
3.94056,
|
||||
3.99987,
|
||||
5.3658,
|
||||
5.155437,
|
||||
6.92275,
|
||||
6.718375,
|
||||
9.01025
|
||||
],
|
||||
"kmodel_path": "/kmodel/face.kmodel",
|
||||
"kmodel_size": 388776,
|
||||
"obj_thresh": [
|
||||
0.7
|
||||
],
|
||||
"labels": [
|
||||
"face"
|
||||
],
|
||||
"nms_thresh": 0.3
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,38 @@
|
||||
{
|
||||
"net_input_size": [
|
||||
256,
|
||||
256
|
||||
],
|
||||
"net_output_shape": [
|
||||
8,
|
||||
8,
|
||||
35
|
||||
],
|
||||
"sensor_output_size": [
|
||||
256,
|
||||
256
|
||||
],
|
||||
"anchors": [
|
||||
0.1384,
|
||||
0.276,
|
||||
0.308,
|
||||
0.504,
|
||||
0.5792,
|
||||
0.8952,
|
||||
1.072,
|
||||
1.6184,
|
||||
2.1128,
|
||||
3.184
|
||||
],
|
||||
"kmodel_path": "/kmodel/helmet.kmodel",
|
||||
"kmodel_size": 2714044,
|
||||
"obj_thresh": [
|
||||
0.7,
|
||||
0.9
|
||||
],
|
||||
"labels": [
|
||||
"head",
|
||||
"helmet"
|
||||
],
|
||||
"nms_thresh": 0.45
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,36 @@
|
||||
{
|
||||
"net_input_size": [
|
||||
224,
|
||||
320
|
||||
],
|
||||
"net_output_shape": [
|
||||
10,
|
||||
7,
|
||||
30
|
||||
],
|
||||
"sensor_output_size": [
|
||||
240,
|
||||
320
|
||||
],
|
||||
"anchors": [
|
||||
1.043,
|
||||
1.092,
|
||||
0.839,
|
||||
2.1252,
|
||||
1.109,
|
||||
2.7461,
|
||||
1.378,
|
||||
3.6708,
|
||||
2.049,
|
||||
4.6711
|
||||
],
|
||||
"kmodel_path": "/kmodel/instrusion.kmodel",
|
||||
"kmodel_size": 2713236,
|
||||
"obj_thresh": [
|
||||
0.7
|
||||
],
|
||||
"labels": [
|
||||
"human"
|
||||
],
|
||||
"nms_thresh": 0.35
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,9 @@
|
||||
#ifdef USING_K210_DETECT
|
||||
#include "k210_detect.h"
|
||||
#endif
|
||||
#include <transform.h>
|
||||
|
||||
static void detect_app() { k210_detect(K210_DETECT_CONFIGJSON); }
|
||||
#ifdef __RT_THREAD_H__
|
||||
MSH_CMD_EXPORT(detect_app, detect app);
|
||||
#endif
|
||||
Reference in New Issue
Block a user