/
Models' Guide

Models' Guide

Models list in SNNF

The SNNF has many built-in models that can be used directly. The model list is as follows:

 

Model Name

Network Binary

Pytorch File

OCR

OcrCls

snnf_ocr_cls_i16.nb

 

OcrDet

snnf_ocr_det_i16.nb

 

OcrRec

snnf_ocr_rec_i16.nb

 

detection

Rtmdets

snnf_rtmdets_i16.nb

 

Yolov5sDetection

snnf_yolov5s_u8.nb

 

YoloV8nDetectionBaseOpti

snnf_yolov8n_detection_opti_i16.nb

 

YoloV8nDetectionOpti

snnf_yolov8n_detection_opti_i16.nb

snnf_yolov8_anchor.pt

YoloV8sDetection

snnf_yolov8s_detection_i16.nb

 

YoloV8sDetectionBaseOpti

snnf_yolov8s_detection_opti_i16.nb

 

YoloV8sDetectionOpti

snnf_yolov8s_detection_opti_i16.nb

snnf_yolov8_anchor.pt

YoloV8sOdMap

snnf_yolov8s_object_detection_map.nb

 

YoloV10sDetection

snnf_yolov10s_detection_i16.nb

 

YoloV8nCcpdOpti

snnf_yolov8n_ccpd_opti_u8.nb

 

classify

Yolov8nClassify

snnf_yolov8n_classify_i16.nb

 

Yolov8sClassify

snnf_yolov8s_classify_i16.nb

 

obb

YoloV8sObb

snnf_yolov8s_obb_i16.nb

 

YoloV8nObbOpti

snnf_yolov8n_obb_opti_i16.nb

snnf_yolov8_obb_anchor.pt

pose

YoloV8sPose

snnf_yolov8s_pose_i16.nb

 

YoloV8nPoseOpti

snnf_yolov8n_pose_opti_i16.nb

snnf_yolov8_anchor.pt

segment

YoloV8sSegment

snnf_yolov8s_segment_i16.nb

 

YoloV8nSegmentOpti

snnf_yolov8n_segment_opti_i16.nb

snnf_yolov8_anchor.pt

attribute

HumanAttr

snnf_human_attr_i16.nb

 

VehicleAttr

snnf_vehicle_attr_i16.nb

 

track

BotSortTrack

snnf_reid_i16.nb

 

BotSortTrackStgcn

snnf_reid_i16.nb+snnf_stgcn_i16.nb

 

others

Age

snnf_age_i16.nb

 

LightFace

snnf_light_face_i16.nb

 

GenderAge

snnf_genderage_i16.nb

 

W600kR50

snnf_w600k_r50_i16.nb

 

Det10g

snnf_det_10g_i16.nb

 

These models require .nb to be used in conjunction with .pt files:

  • YoloV8nDetectionOpti

  • YoloV8sDetectionOpti

  • YoloV8nObbOpti

  • YoloV8nPoseOpti

  • YoloV8nSegmentOpti

while other models only need to use .nb files.

Select and build the models

You can configure whether the model needs to be opened during compilation by simply configuring it in makefile_config.mk or makefile_config_user.mk.

If makefile_config_user.mk file exists, use makefile_config_user.mk's configuration first.

# ------------------------------------------------------------------------ # define which plugin model to build: ON / OFF NN_PLUGIN_ENABLE_YOLOV5S_V2 := ON NN_PLUGIN_ENABLE_RTMDETS := ON NN_PLUGIN_ENABLE_GEDERAGE := ON NN_PLUGIN_ENABLE_YOLOV8S_DETECTION := ON NN_PLUGIN_ENABLE_YOLOV8S_OBB := ON NN_PLUGIN_ENABLE_YOLOV8S_POSE := ON NN_PLUGIN_ENABLE_YOLOV8S_SEGMENT := ON NN_PLUGIN_ENABLE_YOLOV10S_DETECTION := ON NN_PLUGIN_ENABLE_YOLOV8N_CCPD := ON NN_PLUGIN_ENABLE_YOLOV8N_OBB_OPTI := ON NN_PLUGIN_ENABLE_YOLOV8N_POSE_OPTI := ON NN_PLUGIN_ENABLE_YOLOV8N_SEGMENT_OPTI := ON NN_PLUGIN_ENABLE_YOLOV8N_DETECTION_OPTI := ON NN_PLUGIN_ENABLE_YOLOV8S_DETECTION_OPTI := ON NN_PLUGIN_ENABLE_BOTSORT_TRACK := ON # ------------------------------------------------------------------------ # define which buildin model to build: ON / OFF NN_ENABLE_YOLOV5_CUSTOM := ON NN_ENABLE_AGE := ON NN_ENABLE_DET10G := ON NN_ENABLE_OCR := ON NN_ENABLE_LIGHT_FACE := ON NN_ENABLE_HUMAN_ATTR := ON NN_ENABLE_VEHICLE_ATTR := ON NN_ENABLE_YOLOV5S := ON NN_ENABLE_YOLOV8N_CLASSIFY := ON NN_ENABLE_YOLOV8S_CLASSIFY := ON NN_ENABLE_YOLOV8S_OBJECT_DETECTION_MAP := ON

Note: After executing the compilation script ./snnf_build.sh, the model_config.mk file will be automatically generated in the release directory. The configuration information in this file is automatically generated according to the configuration of makefile_config.mk or makefile_config_user.mk, and its configuration options cannot be modified.

Sample code

The header file of the model file is located in the following location:nnapi/include/models

The source code of the model file is located at the following location:nnmodels/sources/models

The sample code of models used is at the following location: samples.

Single model sample flow

This sample code uses the YOLOv5 detection to explain how to use a model in SNNF models.

  1. create model

Create an instance of Yolov5sModel with the specified model network_binary file path.

auto yolov5sModel = make_shared<Yolov5sModel>("./resource/model/snnf_yolov5s_u8.nb");
  1. model prepare

Create a result listener to handle the detection results.

auto resultListener = make_shared<ResultListener>();

Prepare the model for detection with the result listener.

  1. detection;

Perform the detection of the input image with a timeout of 100 milliseconds.

  1. model release

Destroy the model to release its resources.

For more detailed sample code of single model usage please refer to this folder:samples\single_model

 

Multi-model sequential sample flow

This example code uses the YOLOv5 detection model and the humanoid attribute model to explain how to serialize the use of the multi-models in SNNF.

  1. create the sequential

create a sequential instance, this is the model sequential pipeline.

  1. create models

create the instance of Yolov5sModel and HumanAttrModel with the specified model file path.

  1. add model to the sequential

Add the Yolov5sModel and HumanAttrModel instances to the sequential model

  1. prepare the sequential 

Create a result listener to handle the detection results.

Prepare the sequential model for detection with the result listener

  1. detecting using the sequential 

Perform the detection on the input image with a timeout of 100 milliseconds

  1. destroy the sequential

Destroy the sequential model to release its resources.

For more detailed sample code of sequential model usage please refer to this folder:samples\sequential_model

build sample code

  1. build in the project root folder

In the project root folder modify makefile_configure.mk to select cross-compile or build on c3v directly.

Using the compilation script ./snnf_buld.sh. The total samples will be built and installed into the release folder.

  1. build in the release folder

In the release folder, use the compilation script ./snnf_build_samples.sh with the build parameters:

  • --c3v: build on c3v directly.

  • --cross: cross-compile in host Linux

Then the samples will be built and installed in the path: bin.

Related content

V1.2.0 of SNNF
V1.2.0 of SNNF
More like this
SP7350 模型训练及平台部署
SP7350 模型训练及平台部署
Read with this
V1.0.0 of SNNF
V1.0.0 of SNNF
More like this
SP7350 Hardware
SP7350 Hardware
Read with this
SNNF Model Creater
SNNF Model Creater
More like this
Formal Release Record
Formal Release Record
More like this