...
Release folder structure
...
bin: nnfsnnf_nnsample. Prebuild sample programs that can run on the c3v Linux platform.
include:header file of sunplus NN framework SDK.
lib:libraries of sunplus NN framework SDK.
resource
config: some config files for features.
font: ttf file for plotting sample.
image: image files used for test.
model: models to be used in the sample program.
video: video files used for test.
samples:example code for using sunplus NN framework.
snnf_run.sh:executable script for running sample code.
snnf_build_samples.sh: executable script for building sample code.
snnf_env.sh: executable script for compiling environment.
thirdparty: just as its name implies.
How to run
...
SNNF sample
Copy the release foler to C3V Linux.
Code Block |
---|
/SNNF/release # ls -alh total 3644K drwxr-xr-x 8 8 xxx B400 4096 Sep 30 14:23 ./101065 11400 4.0K Jan 3 2025 . drwxr-xr-x 5 15 xxx B400 4096 Sep 30 14:15101065 11400 4.0K Jan 3 2025 ../ drwxr-xr-x 2 101065 211400 xxx4.0K B400Jan 4096 Sep3 30 14:152025 bin/ drwxr-xr-x 6 6 xxx B400 4096 Sep 30 14:15 include/101065 11400 4.0K Jan 3 2025 include drwxr-xr-x 3 3 xxx B400 4096 Sep 30 14:15 lib/101065 11400 4.0K Jan 3 2025 lib drwxr-xr-x 7 7 xxx B400 4096 Sep 30 14:15 resource/101065 11400 4.0K Jan 3 2025 resource drwxr-xr-x 4 101065 11400 4.0K xxxJan B400 40963 Sep 30 14:152025 samples/ -rwxr-xr-x 1 1101065 11400 xxx B400223 Jan 262 Sep3 30 14:152025 snnf_runbuild_samples.sh* drwxr-rwxr-xr-x 1 101065 711400 xxx1.6K B400Jan 4096 Sep3 30 14:15 thirdparty/ |
...
2025 snnf_env.sh
-rwxr-xr-x 1 101065 11400 430 Jan 3 2025 snnf_run.sh
drwxr-xr-x 7 101065 11400 4.0K Jan 3 2025 thirdparty |
Run nnf_run.sh to run the SNNF sample.
a. One-time input
./snnf_run.sh -m YoloV8sDetection
Code Block |
---|
# ./snnf_run.sh -m YoloV8sDetection 17276259052421735821845919|7fad06c0207f808d8a00|T|common: [app]YoloV8sDetection in 17276259052611735821846236|7fad06c0207f69ef80e0|IT|common: [nnapp]createGeneralModelOutputListener modeldetect from pluginName: YoloV8sDetection takes: 17 1727625905722|7f96fdf0e0|I|common: [nn]picked: 5 1727625905722|7f96fdf0e0|T|common: [app]GeneralModelOutputListener detect from resourceresource/image/objectDetectvehicle.jpg, the result: (box: 415.31 35 196 158 403288.56 1218.38 520.88) --> label: 02(personcar), confidence: 0.8996, fin: falsetrue 17276259057221735821846284|7f96fdf0e07f808d8a00|T|common: [app]GeneralModelOutputListener detect from YoloV8sDetection out, retVal: 0 |
b. Read input from the image file
./snnf_run.sh -m YoloV8nDetectionOpti -i resource/image/
...
person640x640.jpg
...
Code Block |
---|
# ./snnf_run.sh -m YoloV8nDetectionOpti -i resource/image/person640x640.jpg 1735822076622|7fbe2f5a00|T|common: [app]YoloV8nDetectionOpti in 1735822079033|7fa61da0e0|T|common: [app]GeneralModelOutputListener detect from resource/image/objectDetectperson640x640.jpg, the result: (box: 173 203 97 3600.00 19.00 614.75 619.44) --> label: 0(person), confidence: 0.8687, fin: falsetrue 17276259057221735822079075|7f96fdf0e07fbe2f5a00|T|common: [app]GeneralModelOutputListenerYoloV8nDetectionOpti detectout, from resource/image/objectDetect.jpg, the result: (box: 0 321 44 253) --> label: 0(person), confidence: 0.75, fin: false 1727625905722|7f96fdf0e0|T|common: [app]GeneralModelOutputListener detect from resource/image/objectDetect.jpg, the result: (box: 12 66 625 403) --> label: 5(bus), confidence: 0.74, fin: true 1727625905781|7fad06c020|T|common: [app]YoloV8sDetection out, retVal: 0 |
b. Read input from the image file
./snnf_run.sh -m YoloV8nDetectionOpti -i resource/image/person640x640.jpg
Code Block |
---|
# ./snnf_run.sh -m YoloV8nDetectionOpti -i resource/image/person640x640.jpg
1727626580087|7fbd7de020|T|common: [app]YoloV8nDetectionOpti in
1727626582152|7fbd7de020|I|common: [nn]create model from pluginName: YoloV8nDetectionOpti takes: 2063
1727626582574|7fa569a0e0|T|common: [app]GeneralModelOutputListener detect from resource/image/person640x640.jpg, the result: (box: 0 19 614 619) --> label: 0(person), confidence: 0.87, fin: true
1727626582622|7fbd7de020|T|common: [app]YoloV8nDetectionOpti out, retVal: 0 |
c. Read inputs from the video file.
./snnf_run.sh -m YoloV8nDetectionOpti -v resource/video/humanCount.mp4
Code Block |
---|
# ./snnf_run.sh -m YoloV8nDetectionOpti -v resource/video/humanCount.mp4 1727626644381|7faf81e020|T|common: [app]streaming in 1727626645952|7faf81e020|I|common: [nn]create model from pluginName: YoloV8nDetectionOpti takes: 1388 1727626646044|7f951d80e0|T|common: [app]streaming test: runner func in 1727626646304|7f959e80e0|T|common: [app]GeneralModelOutputListener detect from , the result: (box: 671 129 307 873) --> label: 0(person), confidence: 0.90, fin: false 1727626646305|7f959e80e0|T|common: [app]GeneralModelOutputListener detect from , the result: (box: 0 364 268 461) --> label: 7(truck), confidence: 0.38, fin: true 1727626646375|7f959e80e0retVal: 0 |
c. Read inputs from the video file.
./snnf_run.sh -m YoloV8nDetectionOpti -v resource/video/humanCount.mp4
Code Block |
---|
# ./snnf_run.sh -m YoloV8nDetectionOpti -v resource/video/humanCount.mp4 1735823196079|7fabb9e040|T|common: [app]GeneralModelOutputListenerstreaming detect from , the result: (box: 672 127 325 873) --> label: 0(person), confidence: 0.90, fin: false 1727626646375|7f959e80e0in 1735823198479|7f91468080|T|common: [app]streaming test: runner func in 1735823198840|7f91c78080|T|common: [app]GeneralModelOutputListener detect from , the result: (box: 0 364 267 461 (box: 672.19 131.25 303.19 873.38) --> label: 70(truckperson), confidence: 0.3990, fin: truefalse 17276266464401735823198840|7f959e80e07f91c78080|T|common: [app]GeneralModelOutputListener detect from , the result: (box: 671 125 327 8780.56 364.31 268.12 460.69) --> label: 07(persontruck), confidence: 0.9039, fin: false 17276266464401735823198840|7f959e80e07f91c78080|T|common: [app]GeneralModelOutputListener detect from , the result: (box: 548.06 10.31 0 364 267 4601369.88 1009.69) --> label: 76(trucktrain), confidence: 0.4125, fin: true 17276266464981735823198859|7f959e80e07f91c78080|T|common: [app]GeneralModelOutputListener detect from , the result: (box: 673.88 127.88 125 323 878.06 875.44) --> label: 0(person), confidence: 0.90, fin: false ...... 1727626682667|7f959e80e01735823198859|7f91c78080|T|common: [app]GeneralModelOutputListener detect from , the result: (box: 977 159 330 8940.56 364.31 268.31 460.69) --> label: 07(persontruck), confidence: 0.9140, fin: false 17276266826671735823198859|7f959e80e07f91c78080|T|common: [app]GeneralModelOutputListener detect from , the result: (box: 668 262 270 708543.00 13.31 1375.31 1009.50) --> label: 06(persontrain), confidence: 0.8626, fin: false 1727626682667|7f959e80e0 true ...... 1735823234584|7f91c78080|T|common: [app]GeneralModelOutputListener detect from , the result: (box: 977.81 159.75 1 363 267 457329.81 895.69) --> label: 70(truckperson), confidence: 0.3590, fin: false 17276266826671735823234584|7f959e80e07f91c78080|T|common: [app]GeneralModelOutputListener detect from , the result: (box: 465 26 1454 1003666.94 263.81 275.06 708.00) --> label: 60(trainperson), confidence: 0.3287, fin: false 17276266826671735823234584|7f959e80e07f91c78080|T|common: [app]GeneralModelOutputListener detect from , the result: (box: 847 565 173 4031583.39 458.81 64.27 130.03) --> label: 0(person), confidence: 0.26, fin: true 1727626686753|7faf81e020|T|common: [app]q to quit |
d. Sequential models
./snnf_run.sh -s Yolov5sDetection,HumanAttr
Code Block |
---|
# ./snnf_run.sh -s Yolov5sDetection,HumanAttr 1727627713332|7fa3285020.33, fin: false 1735823234584|7f91c78080|T|common: [app]sequential in 1727627713501|7fa3285020|T|common: [app]input image name: resource/image/person.jpg 1727627713833|7f937c50e0GeneralModelOutputListener detect from , the result: (box: 466.12 10.88 1453.88 1017.75) --> label: 6(train), confidence: 0.32, fin: true 1735823343756|7fabb9e040|T|common: [nn]detectedInfos: 1 1727627713833|7f937c50e0app]q to quit q 1735823348373|7fabb9e040|T|common: [app]human attr(box: 606 141 274 655) --> result: Male Age18-60 Direct: Front Glasses: True Hat: False HoldObjectsInFront: False Bag: No bag Upper: ShortSleeve UpperStride Lower: Trousers Shose: No boots 1727627713833|7f937c50e0The input file: resource/video/humanCount.mp4 has 516 frames 1735823348374|7fabb9e040|T|common: [app]streaming out, retVal: -0x0 |
d. Sequential models
./snnf_run.sh -s Yolov5sDetection,HumanAttr
Code Block |
---|
# ./snnf_run.sh -s Yolov5sDetection,HumanAttr 1735827166109|7f8a9f9040|T|common: [app]sequential in 1735827166536|7f8a9f9040|T|common: [nn]detectedInfos: 1 1727627713833|7f937c50e0app]input image name: resource/image/person.jpg 1735827166657|7f792b9080|T|common: [app]human attr(box: 308 188 207 591612.44 156.84 268.88 625.51) --> result: Femaleage: Age1818-60 Directbag: No Backbag Glassesdirection: FalseFront Hatgender: FalseMale HoldObjectsInFrontglasses: FalseTrue Baghat: ShoulderBagFalse UpperholdObjectsInFront: ShortSleeveFalse UpperLogo Lowerlower: LowerPattern ShortsTrousers Shoseshose: No boots 1727627718787|7fa3285020 upper: ShortSleeve UpperStride 1735827166660|7f792b9080|T|common: [app]sequential out, retVal: -0x0 |
e. Model inference results save to image.
./snnf_run.sh -s YoloV8sPose,imageWriter
Code Block |
---|
# ./snnf_run.sh -s YoloV8sPose,imageWriter 1727627887700|7fafe27020|T|common: [app]sequential in 1727627887700|7fafe27020|T|common: [app]warning: sequential model list(not tested) 1727627887725|7fafe27020|I|common: [nn]create model from pluginName: YoloV8sPose takes: 24 1727627887858|7fafe27020human attr(box: 311.82 181.12 199.79 606.84) --> result: age: 18-60 bag: ShoulderBag direction: Back gender: Female glasses: False hat: False holdObjectsInFront: False lower: LowerPattern Shorts shose: No boots upper: ShortSleeve 1735827171625|7f8a9f9040|T|common: [app]inputsequential imageout, nameretVal: resource/image/pose_input.jpg 1727627888707|7f9db2a0e0|I-0x0 |
e. Model inference results save to image.
./snnf_run.sh -s YoloV8sPose,imageWriter
Code Block |
---|
# ./snnf_run.sh -s YoloV8sPose,imageWriter 1735827675908|7fba745040|T|common: [nnapp]picked:sequential 5in 17276278887071735827675908|7f9db2a0e07fba745040|IT|common: [nn]plot: 0 91%, [(852, 142) - (1169, 753)], person 1727627888710|7f9db2a0e0|Iapp]warning: sequential model list(not tested) 1735827676344|7fba745040|T|common: [nnapp]plot:input image 0 89%, [(1689, 187) - (1835, 642)], person 1727627888711|7f9db2a0e0|Iname: resource/image/pose_input.jpg 1735827676641|7fa3fff080|T|common: [app]write an image: detected_1883_0931_1735827676535.jpg 1735827681383|7fba745040|T|common: [nnapp]plot:sequential out, 0 89%, [(61, 123) - (232, 601)], person 1727627888711|7f9db2a0e0|IretVal: -0x0 |
Results will save to the image detected_1883_0931_1735827676535.jpg.
f. Model inference results save to json file.
./snnf_run.sh -s YoloV8sPose,jsonWriter -o yolov8PoseResults.json
Code Block |
---|
# ./snnf_run.sh -s YoloV8sPose,jsonWriter -o yolov8PoseResults.json 1736129305551|7fb7dfae30|T|common: [nnapp]plot:sequential in 0 88%, [(1337, 330) - (1441, 679)], person 1727627888712|7f9db2a0e0|I|common: [nn]plot: 0 87%, [(369, 252) - (480, 671)], person 1727627888839|7f9db2a0e0 1736129305551|7fb7dfae30|T|common: [app]warning: sequential model list(not tested) 1736129305738|7fb7dfae30|T|common: [app]writeinput animage imagename: detected_1883_0931_1727627888712resource/image/pose_input.jpg 1727627893526 1736129310785|7fafe270207fb7dfae30|T|common: [app]sequential out, retVal: -0x0 |
Results will save to the image detected_1883_0931_1727627888712.jpg
yolov8PoseResults.json. If the - o
option is not used, it will be saved as a file by default: default_result.json.
How to build SNNF
Cross-compile for C3V environment.
...