SNNF Demo Source Code Release
SNNF demo includes the following model samples
yolov8n_pose_opti;
yolov8n_segment_opti;
yolov8n_detection_opti;
det_10g + w600k_r50; (face match)
lightFace;
age;
yolov8n_detection_opti + humanAttr;
Human tracking;
Human falling detection;
OCRDet + OCRCls + OCRRec;
If you want to see the demo's effects more quickly, please refer to the SNNF Demo Introduction.
Please read this document carefully if you want to compile the SNNF demo.
HW Environment
Camera
The SNNF demo supports obtaining input data through a camera or a video file. The camera can be connected through MIPI or USB.
MIPI
Currently, the sensor we support for the MIPI interface is OV5640. The sensor needs to be connected to MIPI-RX4_2D on the platform, the MIPI Sensor interface as shown in the diagram above.
If you plan to use it, you must make the following modifications.
Modify the linux/kernel/arch/arm64/boot/dts/sunplus/sp7350-dm.dts before building the C3V image, enable OV5640_IN4.
@@ -19,7 +19,7 @@
//#define IMX708_IN5
//#define OV5640_IN2
//#define OV5640_IN3
-//#define OV5640_IN4
+#define OV5640_IN4
//#define OV5640_IN5
//#define OV5647_IN2
//#define OV5647_IN3
To improve the speed of reading data from the sensor, execute the following command before running the SNNF demo.
root@ubuntu:/snnf_demo_release# cat /sys/module/videobuf2_dma_contig/parameters/remap
N
root@ubuntu:/snnf_demo_release# echo 1 > /sys/module/videobuf2_dma_contig/parameters/remap
root@ubuntu:/snnf_demo_release# cat /sys/module/videobuf2_dma_contig/parameters/remap
Y
USB
The USB Camera supports USB 2.0 and USB 3.0. If you want to use USB 3.0, Set the jump cap in the figure below to the OFF state.
Display
SNNF demo requires a display screen by default. If you do not connect the display screen, the program will run incorrectly.
The display screen supports MIPI or HDMI connection, and the currently supported MIPI display screen is the official 7-inch display screen of Raspberry Pi.
MIPI and HDMI displays cannot be used simultaneously. The specific switching method is as follows:
Switch to MIPI
Set the jump cap in the above figure to the ON state and unplug the HDMI cable.
Switch to HDMI
Set the jump cap in the above figure to OFF, power off the Panel connected to MIPI, and plug in the HDMI cable.
Source code
Please get the SNNF Demo V1.0.0 release source code here.
Folder structure
dependency_libraries: the library that snnf_demo depends on.
demo_assist
face_match
ffmpeg-4.4.2-prebuilt
freetype-2.12.1
libdrm-2.4.100-prebuilt
libpng-1.6.37
lvgl-9.1.0-prebuilt
opencv-4.9.0-prebuilt
snnf_release
vsi_lib
yuvconvert
snnf_demo_src: demo source code.
src
menu: code related to UI.
nn: sample code for SNNF and code for processing the NN results.
stream: reading video stream and displaying NN results.
makefile
out: the generation path of the snnf_demo program.
bin: snnf_demo, Prebuild sample programs that can run on the c3v Linux platform.
snnf_demo_env.sh: setup environment variable.
How to build SNNF Demo
Compile on the C3V platform
Copy the release folder to C3V Linuxï¼›
root@ubuntu:/snnf_demo_release# ls -al
total 24
drwxr-xr-x 5 10860 11400 4096 Nov 7 11:30 .
drwxr-xr-x 4 root root 4096 Nov 7 11:17 ..
drwxr-xr-x 3 10860 11400 4096 Nov 7 10:52 bin
drwxr-xr-x 13 10860 11400 4096 Nov 7 10:54 dependency_libraries
-rw-r--r-- 1 10860 11400 1887 Nov 7 11:30 snnf_demo_env.sh
drwxr-xr-x 5 10860 11400 4096 Nov 7 12:09 snnf_demo_src
cd snnf_demo_src
Ensure that "CROSS_COMPILE" in the makefile is set to "NO"
make
Run snnf_demo, please refer to the How to run SNNF Demo.
Cross-compile SNNF Demo
Copy the release folder to Cross-compile Linuxï¼›
cd snnf_demo_src
Ensure that "CROSS_COMPILE" in the makefile is set to "YES", and modify the toolchain path("TOOLCHAIN_PREFIX") in the makefile
make
Copy the newly compiled snnf_demo program and the folder named "dependency_libraries" from the snnf_demo_delease folder to C3V Linux.
Run snnf_demo, please refer to the How to run SNNF Demo.
Setup the running environment
Copy the newly compiled snnf_demo program and the folder named "dependency_libraries" from the snnf_demo_release folder to C3V Linux.
Copy according to the following directory structure.
Copy the resource files to C3V Linux.
The path of resource files:dependency_libraries/snnf_release/resource
Setup environment variable(Just need to set it once)
Switch to the directory where the dependency_libraries are located, then set the environment variable.
Turn off Display Manager Service (This step is only required for Ubuntu XFCE)
The status of the lightdm service enabled is as follows.
Temporary stop
Permanently Closed
Before running, please ensure that the account you are logged into has root privileges. If you are logging in with a non-root account, please execute the following command before running the demonstration program.
How to run SNNF Demo
Before running snnf_demo, please refer to Setup the running environment.
Run snnf_demo.
Obtaining input data through the camera
Use default param
Set the video size/fps/YUV format by cmd.
How to get the format supported by the camera?
Obtaining input data through the video file
See the demo's effects please refer to the SNNF Demo Introduction.