-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
liujie
committed
Jul 7, 2023
1 parent
12455f6
commit 152f8ca
Showing
235 changed files
with
42,849 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
cmake_minimum_required(VERSION 3.2) | ||
project(nncase_sdk C CXX) | ||
|
||
set(nncase_sdk_root "${PROJECT_SOURCE_DIR}/../../big/nncase/") | ||
set(k230_sdk ${nncase_sdk_root}/../../../) | ||
set(CMAKE_EXE_LINKER_FLAGS "-T ${PROJECT_SOURCE_DIR}/cmake/link.lds --static") | ||
|
||
# set opencv | ||
set(k230_opencv ${k230_sdk}/src/big/utils/lib/opencv) | ||
include_directories(${k230_opencv}/include/opencv4/) | ||
link_directories(${k230_opencv}/lib ${k230_opencv}/lib/opencv4/3rdparty) | ||
|
||
# set mmz | ||
link_directories(${k230_sdk}/src/big/mpp/userapps/lib) | ||
|
||
# set nncase | ||
include_directories(${nncase_sdk_root}/riscv64) | ||
include_directories(${nncase_sdk_root}/riscv64/nncase/include) | ||
include_directories(${nncase_sdk_root}/riscv64/nncase/include/nncase/runtime) | ||
link_directories(${nncase_sdk_root}/riscv64/nncase/lib/) | ||
|
||
add_subdirectory(face_detection) | ||
add_subdirectory(face_landmark) | ||
add_subdirectory(face_glasses) | ||
add_subdirectory(face_mask) | ||
add_subdirectory(face_emotion) | ||
add_subdirectory(face_pose) | ||
add_subdirectory(face_gender) | ||
add_subdirectory(sq_hand_det) | ||
add_subdirectory(sq_handkp_class) | ||
add_subdirectory(sq_handkp_det) | ||
add_subdirectory(sq_handreco) | ||
add_subdirectory(object_detect_yolov8n) | ||
add_subdirectory(person_detect) | ||
add_subdirectory(falldown_detect) | ||
add_subdirectory(pose_detect) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
#!/bin/bash | ||
set -x | ||
|
||
# set cross build toolchain | ||
export PATH=$PATH:/opt/toolchain/riscv64-linux-musleabi_for_x86_64-pc-linux-gnu/bin/ | ||
|
||
clear | ||
rm -rf out | ||
mkdir out | ||
pushd out | ||
cmake -DCMAKE_BUILD_TYPE=Release \ | ||
-DCMAKE_INSTALL_PREFIX=`pwd` \ | ||
-DCMAKE_TOOLCHAIN_FILE=cmake/Riscv64.cmake \ | ||
.. | ||
|
||
make -j && make install | ||
popd | ||
|
||
k230_bin=`pwd`/k230_bin | ||
rm -rf ${k230_bin} | ||
mkdir -p ${k230_bin} | ||
|
||
cp -a ../../big/kmodel/ai_poc/kmodel/*.kmodel ${k230_bin} | ||
cp -a ../../big/kmodel/ai_poc/images/* ${k230_bin} | ||
cp -a shell/* ${k230_bin} | ||
|
||
if [ -f out/bin/face_detection.elf ]; then | ||
cp out/bin/face_detection.elf ${k230_bin} | ||
fi | ||
|
||
if [ -f out/bin/face_landmark.elf ]; then | ||
cp out/bin/face_landmark.elf ${k230_bin} | ||
fi | ||
|
||
if [ -f out/bin/face_glasses.elf ]; then | ||
cp out/bin/face_glasses.elf ${k230_bin} | ||
fi | ||
|
||
if [ -f out/bin/face_mask.elf ]; then | ||
cp out/bin/face_mask.elf ${k230_bin} | ||
fi | ||
|
||
if [ -f out/bin/face_emotion.elf ]; then | ||
cp out/bin/face_emotion.elf ${k230_bin} | ||
fi | ||
|
||
if [ -f out/bin/face_pose.elf ]; then | ||
cp out/bin/face_pose.elf ${k230_bin} | ||
fi | ||
|
||
if [ -f out/bin/face_gender.elf ]; then | ||
cp out/bin/face_gender.elf ${k230_bin} | ||
fi | ||
|
||
if [ -f out/bin/sq_hand_det.elf ]; then | ||
cp out/bin/sq_hand_det.elf ${k230_bin} | ||
fi | ||
|
||
if [ -f out/bin/sq_handkp_class.elf ]; then | ||
cp out/bin/sq_handkp_class.elf ${k230_bin} | ||
fi | ||
|
||
if [ -f out/bin/sq_handkp_det.elf ]; then | ||
cp out/bin/sq_handkp_det.elf ${k230_bin} | ||
fi | ||
|
||
if [ -f out/bin/sq_handreco.elf ]; then | ||
cp out/bin/sq_handreco.elf ${k230_bin} | ||
fi | ||
|
||
if [ -f out/bin/ob_det.elf ]; then | ||
cp out/bin/ob_det.elf ${k230_bin} | ||
fi | ||
|
||
if [ -f out/bin/person_detect.elf ]; then | ||
cp out/bin/person_detect.elf ${k230_bin} | ||
fi | ||
|
||
if [ -f out/bin/falldown_detect.elf ]; then | ||
cp out/bin/falldown_detect.elf ${k230_bin} | ||
fi | ||
|
||
if [ -f out/bin/pose_detect.elf ]; then | ||
cp out/bin/pose_detect.elf ${k230_bin} | ||
fi | ||
|
||
rm -rf out |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
include(CMakeForceCompiler) | ||
|
||
# target system | ||
set(CMAKE_SYSTEM_NAME Generic) | ||
set(CMAKE_SYSTEM_PROCESSOR riscv64) | ||
|
||
# cross compiler | ||
set(CMAKE_C_COMPILER riscv64-unknown-linux-musl-gcc) | ||
set(CMAKE_CXX_COMPILER riscv64-unknown-linux-musl-g++) | ||
|
||
set(CMAKE_C_FLAGS_DEBUG "-O0 -g3") | ||
set(CMAKE_C_FLAGS_RELEASE "-O2 -s") | ||
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g3") | ||
set(CMAKE_CXX_FLAGS_RELEASE "-O2 -s") | ||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp") | ||
|
||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=rv64imafdcv -mabi=lp64d -mcmodel=medany") | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=rv64imafdcv -mabi=lp64d -mcmodel=medany") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
/* | ||
* Copyright (c) 2006-2020, RT-Thread Development Team | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* Change Logs: | ||
* Date Author Notes | ||
* 2020/12/12 bernard The first version | ||
*/ | ||
|
||
OUTPUT_ARCH( "riscv" ) | ||
|
||
ENTRY(_start) | ||
SECTIONS | ||
{ | ||
/* | ||
* 64bit userspace: 0x200000000 (default) | ||
* 32bit userspace: 0xD0000000 | ||
*/ | ||
. = 0x200000000; | ||
|
||
.text : | ||
{ | ||
__text_start__ = .; | ||
*(.start); | ||
//*(.text) /* remaining code */ | ||
*(.text .text.*) /* remaining code */ | ||
|
||
KEEP(*(.init)) | ||
KEEP(*(.fini)) | ||
|
||
/* .ctors */ | ||
*crtbegin.o(.ctors) | ||
*crtbegin?.o(.ctors) | ||
*(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) | ||
*(SORT(.ctors.*)) | ||
*(.ctors) | ||
|
||
/* .dtors */ | ||
*crtbegin.o(.dtors) | ||
*crtbegin?.o(.dtors) | ||
*(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) | ||
*(SORT(.dtors.*)) | ||
*(.dtors) | ||
|
||
*(.rodata) /* read-only data (constants) */ | ||
|
||
KEEP(*(.eh_frame*)) | ||
|
||
. = ALIGN(8); | ||
_etext = .; | ||
__text_end__ = .; | ||
} | ||
|
||
. = ALIGN(0x1000); /* must define page align after .text */ | ||
|
||
.plt : | ||
{ | ||
*(*.plt) | ||
} | ||
.got : | ||
{ | ||
__got_start__ = .; | ||
*(*.got) | ||
__got_end__ = .; | ||
} | ||
|
||
data : | ||
{ | ||
__data_start__ = .; | ||
|
||
*(vtable) | ||
*(.data*) | ||
|
||
. = ALIGN(8); | ||
/* preinit data */ | ||
PROVIDE_HIDDEN (__preinit_array_start = .); | ||
KEEP(*(.preinit_array)) | ||
PROVIDE_HIDDEN (__preinit_array_end = .); | ||
|
||
. = ALIGN(8); | ||
/* init data */ | ||
PROVIDE_HIDDEN (__init_array_start = .); | ||
KEEP(*(SORT(.init_array.*))) | ||
KEEP(*(.init_array)) | ||
PROVIDE_HIDDEN (__init_array_end = .); | ||
|
||
. = ALIGN(8); | ||
/* finit data */ | ||
PROVIDE_HIDDEN (__fini_array_start = .); | ||
KEEP(*(SORT(.fini_array.*))) | ||
KEEP(*(.fini_array)) | ||
PROVIDE_HIDDEN (__fini_array_end = .); | ||
|
||
. = ALIGN(8); | ||
/* All data end */ | ||
__data_end__ = .; | ||
} | ||
|
||
bss : | ||
{ | ||
__bss_start__ = .; | ||
*(.bss*) | ||
*(COMMON) | ||
*(.stack) | ||
__bss_end__ = .; | ||
} | ||
|
||
_end = .; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
set(src main.cc utils.cc ai_base.cc face_detection.cc anchors_320.cc anchors_640.cc) | ||
set(bin face_detection.elf) | ||
|
||
include_directories(${PROJECT_SOURCE_DIR}) | ||
include_directories(${nncase_sdk_root}/riscv64/rvvlib/include) | ||
include_directories(${k230_sdk}/src/big/mpp/userapps/api/) | ||
include_directories(${k230_sdk}/src/big/mpp/include) | ||
include_directories(${k230_sdk}/src/big/mpp/include/comm) | ||
include_directories(${k230_sdk}/src/big/mpp/userapps/sample/sample_vo) | ||
link_directories(${nncase_sdk_root}/riscv64/rvvlib/) | ||
|
||
add_executable(${bin} ${src}) | ||
target_link_libraries(${bin} nncase.rt_modules.k230 Nncase.Runtime.Native functional_k230 sys) | ||
target_link_libraries(${bin} rvv vicap vb cam_device cam_engine | ||
hal oslayer ebase fpga isp_drv binder auto_ctrol common cam_caldb isi 3a ahdr buffer_management avs cameric_drv | ||
aflt adci aca aee awdr3 cameric_reg_drv t_database_c t_shell_c t_mxml_c t_json_c t_common_c vo sensor) | ||
|
||
target_link_libraries(${bin} opencv_imgcodecs opencv_imgproc opencv_core zlib libjpeg-turbo libopenjp2 libpng libtiff libwebp csi_cv) | ||
install(TARGETS ${bin} DESTINATION bin) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# 1.简介 | ||
|
||
人脸检测采用了retina-face网络结构,backbone选取0.25-mobilenet。使用该应用,可得到图像或视频中的每个人脸检测框以及每个人脸的左眼球/右眼球/鼻尖/左嘴角/右嘴角五个landmark。 | ||
|
||
# 2.应用使用说明 | ||
|
||
## 2.1 使用帮助 | ||
|
||
``` | ||
Usage: ./face_detection.elf <kmodel_det> <obj_thres> <nms_thres> <input_mode> <debug_mode> | ||
各参数释义如下: | ||
kmodel_det :人脸检测kmodel文件路径 | ||
obj_thres :人脸检测阈值 | ||
nms_thres:人脸检测非极大值抑制的阈值 | ||
input_mode:本地图片(图片路径)/ 摄像头(None) | ||
debug_mode:是否需要调试,0、1、2分别表示不调试、简单调试、详细调试 | ||
#单图推理示例:(face_detect_image.sh) | ||
./face_detection.elf face_detection_320.kmodel 0.6 0.2 1024x624.jpg 1 | ||
#视频流推理:(face_detect_isp.sh) | ||
./face_detection.elf face_detection_320.kmodel 0.6 0.2 None 0 | ||
``` | ||
|
||
|
||
|
Oops, something went wrong.