Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

We provide an example function for post-processing, which can complete the parsing of NN processing results: View file

namevnn_post_process.zip

  • post_proc_init

  • post_proc_process

  • post_proc_deinit

...

For detailed function implementation, please refer to the following file:

View file
nameyolov8sPose_int16_post_process.zip

we needs to be unzipped and placed in ~/c3v/Models/yolov8s-pose/wksp/yolov8s_int16_nbg_unify Folder.

2.2. Program Compile

When compiling NN-related applications, SDK's headers and libraries must be included.

...

Code Block
LIBS+=-lOpenVX -lOpenVXU -lCLC -lVSC -lGAL -ljpeg -lovxlib

...

3. Example flow of the program build and run

Unzipped

View file
nameyolov8sPose_int16_post_process.zip
and
View file
nameMakefile.zip
then placed them in ~/c3v/Models/yolov8s-pose/wksp/yolov8s-pose_int16_nbg_unify Folder. And set the relevant VIVIANTE_ SDK_ DIR and TOOLCHAIN can complete the compilation of the appThe brief folder of the project is like this:

...

3.1. build in c3v

If you want to build the project in c3v directly, please modify these contents of Makefile:

Code Block
BIN=yolov8s-pose-int16

# 1.cross compile
# NN_SDK_DIR=Path to
NN
SDK directory
# TOOLCHAIN=Path to toolchain directory

# CROSS_COMPILE=$(TOOLCHAIN)/aarch64-none-linux-gnu-
# CC=$(CROSS_COMPILE)gcc
# CXX=$(CROSS_COMPILE)g++

# 2.build in c3v
#
NN_SDK_DIR=/usr

# CC=gcc
# CXX=g++

NN_SDK_INC=$(NN_SDK_DIR)/include
NN_SDK_LIB=$(NN_SDK_DIR)/lib

CFLAGS=-Wall -O3

INCLUDE += -I$(NN_SDK_INC) -I$(NN_SDK_INC)/HAL -I$(NN_SDK_INC)/ovxlib -I$(NN_SDK_INC)/jpeg
LIBS += -L$(NN_SDK_LIB) -L./ -L$(STD_LOG_INC)
LIBS += -lOpenVX -lOpenVXU -lOpenVX -lCLC -lVSC -lGAL -ljpeg -lovxlib -lm
LIBS += -lNNArchPerf -lArchModelSw
LIBS += -lstdc++ -ldl -lpthread -lgcc_s

CFLAGS += $(INCLUDE) -fPIC 
CFLAGS += -Wno-unused-variable -Wno-unused-function -Wno-unused-but-set-variable

SRCS=${wildcard *.c}
SRCS+=${wildcard *.cpp}

OBJS=$(addsuffix .o, $(basename $(SRCS)))

.SUFFIXES: .hpp .cpp .c 

.cpp.o:
	$(CXX) $(CFLAGS) -std=c++11 -c $<

.c.o:
	$(CC) $(CFLAGS) -c $<

all: $(BIN)

$(BIN): $(OBJS)
	$(CC) $(CFLAGS) $(LFLAGS) $(OBJS) -o $@ $(LIBS) 
	rm -rf *.o

clean:
	rm -rf *.o
	rm -rf $(BIN) $(LIB)
	rm -rf *~

3. Running on the C3V Linux

Insmod to the kernel if the driver is not probe

Code Block
insmod ./galcore.ko
[14358.019373] galcore f8140000.galcore: NPU get power success
[14358.019458] galcore f8140000.galcore: galcore irq number is 44
[14358.020542] galcore f8140000.galcore: NPU clock: 900000000
[14358.026015] Galcore version 6.4.18.5

...

then copy the whole folder yolov8s-pose_int16_nbg_unify to the c3v Linux system. Then using make to compile the project.

Code Block
cd /sample/yolov8s-pose_int16_nbg_unify
make -j

After compilation, you can see the corresponding application program:yolov8s-pose-int16.

You can run the application directly on c3v:

The param1 is the network_binary.nb file that converts from the acuity toolkit.

The param2 is the image that is for detection. Please prepare the image file which format is jpg and the pixel size is 640 * 640.

Code Block
./yolov8s-pose-int16 ./network_binary.nb ./input.jpg

The result is like this:

Code Block
/mnt/yolov8s-pose_int16_nbg_unify # ./yolov8s-pose-int16 ./network_binary.nb
../input.jpg
Create Neural Network: 59ms or 59044us
Verify...
Verify Graph: 24ms or 24933us
Start run graph [1] times...
Run the 1 time: 122.44ms or 122443.93us
vxProcessGraph execution time:
Total   122.66ms or 122658.48us
Average 122.66ms or 122658.48us
obj: L: 0 P:0.93, [(0, 42) - (200, 599)]
obj: L: 0 P:0.91, [(309, 279) - (180, 361)]
obj: L: 0 P:0.58, [(344, 171) - (170, 301)]

3.2. cross-compile in Linux

If you want to build the project in host Linux, please modify these contents of Makefile:

Code Block
BIN=yolov8s-pose-int16

# 1.cross compile
NN_SDK_DIR=Path to NN SDK directory
TOOLCHAIN=Path to toolchain directory

CROSS_COMPILE=$(TOOLCHAIN)/aarch64-none-linux-gnu-
CC=$(CROSS_COMPILE)gcc
CXX=$(CROSS_COMPILE)g++

you need to set the right path of NN_SDK_DIR and TOOLCHAIN

NN_SDK_DIR: The path to NPU SDK

TOOLCHAIN: The cross-compile toolchain path. which format may be like this:

Code Block
TOOLCHAIN=/pub/toolchain/crossgcc/gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu/bin

then using make to compile the project.

Code Block
make

Copy the application, network_binary.nb file and related libraries into C3V Linux and run:

The param1 is the nb file that converts from the acuity toolkit.

The param2 is the image that is for detection. Please prepare the image file which format is jpg and the pixel size is 640 * 640.

Code Block
./yolov8s-pose-int16 ./network_binary.nb ./input.jpg

...

Code Block
/mnt/yolov8s-pose_int16_nbg_unify # ./yolov8s-pose-int16 ./network_binary.nb
../input.jpg
Create Neural Network: 59ms or 59044us
Verify...
Verify Graph: 24ms or 24933us
Start run graph [1] times...
Run the 1 time: 122.44ms or 122443.93us
vxProcessGraph execution time:
Total   122.66ms or 122658.48us
Average 122.66ms or 122658.48us
obj: L: 0 P:0.93, [(0, 42) - (200, 599)]
obj: L: 0 P:0.91, [(309, 279) - (180, 361)]
obj: L: 0 P:0.58, [(344, 171) - (170, 301)]

3.2. ImageWriter Tool

If you want to show the detection results in an image, we suggest using ImageWriter tools.

Please download

View file
nameimageWriter.zip
and compile it in c3v:

Code Block
cd imageWriter
make -j

Then you can run the imageWriter application directly on c3v:

Param1 is the image which is the same as yolov8s-pose-int16 param2. The yolov8s-pose-int16 is the application that is built in step 3.1. build in c3v.

Param2 is the file pose_results.raw which was generated after the program yolov8s-pose-int16 runs.

Param3 is the output name, which format is jpg.

Code Block
./imageWriter ./input.jpg ./pose_results.raw ./output.jpg

The result is like this:

...