-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
support sample_vi_fd and sample_vi_od Signed-off-by: carbon <[email protected]>
- Loading branch information
0 parents
commit 1888bc6
Showing
166 changed files
with
24,478 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,21 @@ | ||
|
||
host-tools | ||
host-tools/ | ||
|
||
*.o | ||
|
||
*~ | ||
*.swp | ||
*.swo | ||
*.bak | ||
*.rej | ||
.DS_Store | ||
|
||
tags | ||
.tags* | ||
cscope.* | ||
ncscope.* | ||
.svim | ||
|
||
__pycache__ | ||
.vscode |
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,100 @@ | ||
|
||
# Milk-V Duo 系列 TDL-SDK 示例 | ||
[English](./README.md) | 简体中文 | ||
|
||
## TDL-SDK 简介 | ||
|
||
Cvitek 所提供的 TDL(Turnkey Deep Learning)集成算法,用以缩短应用程序开发所需的时间。此架构实现了 TDL 所需算法包含其前后处理, 提供统一且便捷的编程接口。 | ||
|
||
参考链接: [https://github.com/sophgo/tdl_sdk](https://github.com/sophgo/tdl_sdk) | ||
|
||
## 本仓库简介 | ||
|
||
本仓库基于 [tdl_sdk](https://github.com/sophgo/tdl_sdk),针对 Milk-V Duo 系列开发板创建,方便用户单独使用各示例进行验证测试,或者开发相关应用。 | ||
|
||
**该仓库的示例需在 V2 版本的固件中测试,镜像地址:** [Relese](https://github.com/milkv-duo/duo-buildroot-sdk-v2/releases)。 | ||
|
||
## 开发环境 | ||
|
||
使用本地的 Ubuntu 系统,推荐 `Ubuntu 22.04 LTS`。 | ||
|
||
也可以使用虚拟机中的 Ubuntu 系统、Windows 中 WSL 安装的 Ubuntu 或者基于 Docker 的 Ubuntu 系统。 | ||
|
||
安装编译依赖的工具: | ||
``` | ||
sudo apt-get install wget git make | ||
``` | ||
|
||
获取本仓库代码: | ||
``` | ||
git clone https://github.com/milkv-duo/duo-tdl-examples.git | ||
``` | ||
|
||
## 编译示例 | ||
|
||
以下以编译人脸检测的程序为例,介绍编译的过程。 | ||
|
||
进入代码目录: | ||
``` | ||
cd duo-tdl-examples | ||
``` | ||
|
||
加载编译环境: | ||
``` | ||
source envsetup.sh | ||
``` | ||
第一次加载会自动下载所需的编译工具链,下载后的目录名为`host-tools`,下次再加载编译环境时,会检测该目录,如果已存在则不会再次下载。 | ||
|
||
加载编译环境时需要按提示输入所需编译目标: | ||
``` | ||
Select Product: | ||
1. Duo (CV1800B) | ||
2. Duo256M (SG2002) or DuoS (SG2000) | ||
``` | ||
如果目标板是 Duo 则选择 `1`,如果目标板是 Duo256M 或者 DuoS 则选择 `2`。由于 Duo256M 和 DuoS 支持 RISCV 和 ARM 两种架构,还需要按提示继续选择: | ||
``` | ||
Select Arch: | ||
1. ARM64 | ||
2. RISCV64 | ||
Which would you like: | ||
``` | ||
如果测试程序需要在 ARM 系统中运行,选择 `1`,如果是 RISCV 系统则选择 `2`。 | ||
|
||
**同一个终端中,只需要加载一次编译环境即可。** | ||
|
||
人脸检测的示例程序为 `sample_vi_fd`,进入到 sample_vi_fd 目录: | ||
``` | ||
cd sample_vi_fd | ||
``` | ||
使用 `make` 命令编译: | ||
``` | ||
make | ||
``` | ||
将当前目录中生成的 `sample_vi_fd` 程序通过 scp 或者其他方式上传到 Duo 系列开发板中进行测试。如需清除编译生成的程序,可以执行 `make clean` 清除。 | ||
|
||
通过网络直接上传到 Duo 开发板中的程序,可能没有执行权限,需要先在开发板的系统里通过 `chmod` 命令添加可执行权限: | ||
``` | ||
chmod +x sample_vi_fd | ||
``` | ||
|
||
在 DuoS 中的测试该人脸检测示例的命令为 `sample_vi_fd + 人脸检测模型文件`: | ||
``` | ||
./sample_vi_fd /mnt/cvimodel/scrfd_768_432_int8_1x.cvimodel | ||
``` | ||
此时将摄像头对准人脸,终端日志中会打印当前检测到人脸的数量。如需通过电脑实时预览视频画面,可参考 [人脸检测文档](https://milkv.io/zh/docs/duo/application-development/tdl-sdk/tdl-sdk-face-detection)。 | ||
|
||
|
||
## 示例文档 | ||
|
||
更多示例及详细使用说明,请参考 [Milk-V 文档](https://milkv.io/zh/docs/duo/application-development/tdl-sdk/tdl-sdk-introduction)。 | ||
|
||
|
||
## 常见问题 | ||
|
||
### 该仓库和 Sophgo TDL SDK 仓库有何区别? | ||
|
||
原始 [tdl_sdk](https://github.com/sophgo/tdl_sdk) 仓库的编译依赖固件SDK [duo-buildroot-sdk-v2](https://github.com/milkv-duo/duo-buildroot-sdk-v2),编译过程稍复杂一些。该仓库将示例代码从 tdl_sdk 中分离出来,对于只关心 AI 程序开发的用户,可以直接编译测试。本仓库示例的源码与 tdl_sdk 是一致的,会定期同步 tdl_sdk 中相关代码的更新。 | ||
|
||
### libs 目录中的动态库 so 文件是否开源? | ||
|
||
为了简化示例程序的编译,libs 目录中存放了示例所依赖的预编译动态库 so 文件,其中大部分的库的源码都可以在 [tdl_sdk](https://github.com/sophgo/tdl_sdk) 和 [cvi_mpi](https://github.com/sophgo/cvi_mpi) 中找到。每个库对应的源码文件请参考本仓库 libs 目录下的 README 说明。 |
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,100 @@ | ||
|
||
# Milk-V Duo series TDL-SDK examples | ||
English | [简体中文](./README-zh.md) | ||
|
||
## Introduction to TDL-SDK | ||
|
||
Cvitek provides TDL integration algorithms to reduce the time required for application development. This architecture realizes the algorithm required by TDL, including its pre and post processing, and provides a unified and convenient programming interface. | ||
|
||
Reference Links: [https://github.com/sophgo/tdl_sdk](https://github.com/sophgo/tdl_sdk) | ||
|
||
## Introduction to this repository | ||
|
||
This repository is based on [tdl_sdk](https://github.com/sophgo/tdl_sdk) and is created for the Milk-V Duo series development board, so that users can use each example separately for verification testing or develop related applications. | ||
|
||
**The examples in this repository need to be tested in the V2 version of the firmware, image address:** [Relese](https://github.com/milkv-duo/duo-buildroot-sdk-v2/releases)。 | ||
|
||
## Development Environment | ||
|
||
Use a Ubuntu system, `Ubuntu 22.04 LTS` is recommended. | ||
|
||
You can also use an Ubuntu system in a virtual machine, Ubuntu installed in WSL in Windows, or an Ubuntu system based on Docker. | ||
|
||
Install the compilation dependent tools: | ||
``` | ||
sudo apt-get install wget git make | ||
``` | ||
|
||
Get the repository code: | ||
``` | ||
git clone https://github.com/milkv-duo/duo-tdl-examples.git | ||
``` | ||
|
||
## Compile Example | ||
|
||
The following takes the compilation of face detection program as an example to introduce the compilation process. | ||
|
||
Enter the code directory: | ||
``` | ||
cd duo-tdl-examples | ||
``` | ||
|
||
Prepare the compilation environment: | ||
``` | ||
source envsetup.sh | ||
``` | ||
The first time you source it, the required toolchain will be automatically downloaded. The downloaded directory is named `host-tools`. When source it next time, if the directory already exists, it will not be downloaded again. | ||
|
||
In the source process, you need to enter the required compilation target as prompted: | ||
``` | ||
Select Product: | ||
1. Duo (CV1800B) | ||
2. Duo256M (SG2002) or DuoS (SG2000) | ||
``` | ||
If the target board is Duo, select `1`, if the target board is Duo256M or DuoS, select `2`. Since Duo256M and DuoS support both RISCV and ARM architectures, you need to continue to select as prompted: | ||
``` | ||
Select Arch: | ||
1. ARM64 | ||
2. RISCV64 | ||
Which would you like: | ||
``` | ||
If the test program needs to be run on a ARM system, select `1`, if it is an RISCV system, select `2`. | ||
|
||
**In the same terminal, you only need to source it once.** | ||
|
||
The sample program for face detection is `sample_vi_fd`. Enter the sample_vi_fd directory: | ||
``` | ||
cd sample_vi_fd | ||
``` | ||
Compile using the `make` command: | ||
``` | ||
make | ||
``` | ||
Send the `sample_vi_fd` program generated in the current directory to the Duo series board via `scp` or other methods for testing. If you need to clear the generated program, you can execute `make clean` to clear it. | ||
|
||
Programs directly transferred to the Duo development board through `scp` may not have execution permissions. You need to add executable permissions in the development board's system using the `chmod` command: | ||
``` | ||
chmod +x sample_vi_fd | ||
``` | ||
|
||
The command to test the face detection example in DuoS is `sample_vi_fd + face detection model file`: | ||
``` | ||
./sample_vi_fd /mnt/cvimodel/scrfd_768_432_int8_1x.cvimodel | ||
``` | ||
At this time, point the camera at the face, and the terminal log will print the number of faces currently detected. If you need to preview the video screen in real time on a computer, please refer to [Face Detection Documentation](https://milkv.io/docs/duo/application-development/tdl-sdk/tdl-sdk-face-detection). | ||
|
||
|
||
## Examples Documentation | ||
|
||
For more examples and detailed instructions, please refer to the [Milk-V Documentation](https://milkv.io/docs/duo/application-development/tdl-sdk/tdl-sdk-introduction). | ||
|
||
|
||
## FAQs | ||
|
||
### What is the difference between this repository and the Sophgo TDL SDK repository? | ||
|
||
The compilation of the original [tdl_sdk](https://github.com/sophgo/tdl_sdk) repository depends on the buildroot SDK [duo-buildroot-sdk-v2](https://github.com/milkv-duo/duo-buildroot-sdk-v2), and the compilation process is slightly more complicated. This repository separates the sample code from tdl_sdk, so users who only care about AI program development can compile and test directly. The source code of the examples in this repository is consistent with tdl_sdk, and the updates of the relevant code in tdl_sdk will be synchronized regularly. | ||
|
||
### Are the dynamic library so files in the libs directory open source? | ||
|
||
To simplify the compilation of the sample programs, the libs directory contains the precompiled dynamic library so files that the samples depend on. Most of the source code of these libraries can be found in [tdl_sdk](https://github.com/sophgo/tdl_sdk) and [cvi_mpi](https://github.com/sophgo/cvi_mpi). For the source code files corresponding to each library, please refer to the README file in the libs directory of this repository. |
Oops, something went wrong.