English | 简体中文
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
This repository is based on 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。
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
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 the development board is sample_vi_fd + face detection model file
. Note that the models used in Duo and Duo256M/DuoS are different:
-
Duo (CV180X)
./sample_vi_fd /mnt/cvimodel/scrfd_320_256_ir_0x.cvimodel
-
Duo256M/DuoS (SG200X)
./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.
For more examples and detailed instructions, please refer to the Milk-V Documentation.
https://github.com/sophgo/tdl_models/tree/main
Chinese Version(中文版) | 格式 | English Version | Format | ||
深度学习SDK软件开发指南 | html | TDL SDK Software Development Guide | html | ||
YOLO系列开发指南 | html | YOLO Development Guide | html |
The compilation of the original tdl_sdk repository depends on the buildroot SDK 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.
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 and cvi_mpi. For the source code files corresponding to each library, please refer to the README file in the libs directory of this repository.