k1x-ai-support/demo
2024-07-16 19:26:24 +08:00
..
utils Update for v1.0 2024-05-30 23:19:44 +08:00
build.sh Update for v1.0.8 2024-07-16 19:26:24 +08:00
CMakeLists.txt Update for v1.0alpha1 2024-03-01 19:26:21 +08:00
dataloader.hpp Update for v1.0 2024-05-30 23:19:44 +08:00
image_classification_demo.cc Update for v1.0 2024-05-30 23:19:44 +08:00
object_detection.hpp Update for v1.0beta3.1 2024-04-15 11:42:57 +08:00
object_detection_demo.cc Update for v1.0 2024-05-30 23:19:44 +08:00
object_detection_stream_demo.cc Update for v1.0 2024-05-30 23:19:44 +08:00
object_detection_video_demo.cc Update for v1.0 2024-05-30 23:19:44 +08:00
pose_estimation.hpp Update for v1.0 2024-05-30 23:19:44 +08:00
pose_estimation_demo.cc Update for v1.0 2024-05-30 23:19:44 +08:00
pose_tracker_stream_demo.cc Update for v1.0 2024-05-30 23:19:44 +08:00
README.md Update for v1.0rc1 2024-04-30 17:48:07 +08:00

User Guide

Quick Build

# Note: update the following settings if necessary
SDK=${PATH_TO_SPACEMIT_AI_SDK} # e.g. /opt/spacemit-ai-sdk.v1.0.0

# For cross compilation, try:
CROSS_TOOL=$SDK/spacemit-gcc/bin/riscv64-unknown-linux-gnu-
SYSROOT=$SDK/spacemit-gcc/sysroot
BIANBUAI_HOME=$SDK/bianbu-ai-support
ORT_HOME=$SDK/spacemit-ort
OPENCV_DIR=$SDK/bianbu-ai-support/lib/3rdparty/opencv4/lib/cmake/opencv4

# For native building, one may need to install opencv first, then try:
#CROSS_TOOL=
#SYSROOT=
#BIANBUAI_HOME=$SDK/bianbu-ai-support
#ORT_HOME=${PATH_TO_ONNXRUNTIME_RELEASE}  # e.g. /usr
#OPENCV_DIR=

mkdir build && pushd build
cmake .. -DBIANBUAI_HOME=${BIANBUAI_HOME} -DORT_HOME=${ORT_HOME} -DOpenCV_DIR=${OPENCV_DIR} -DCMAKE_C_COMPILER=${CROSS_TOOL}gcc -DCMAKE_CXX_COMPILER=${CROSS_TOOL}g++ -DCMAKE_SYSROOT=${SYSROOT}
make -j4
popd

Quick Test

# Add qemu settings if necessary(e.g. run riscv64 demo on x86_64).
QEMU_CMD="$SDK/spacemit-qemu/bin/qemu-riscv64 -L $SYSROOT"
# For native test, just let:
#QEMU_CMD=
# Add test data dirpath, e.g.
DATA=${BIANBUAI_HOME}/share/ai-support

# Smoke test with image classification
env LD_LIBRARY_PATH=${ORT_HOME}/lib:$LD_LIBRARY_PATH ${QEMU_CMD} \
  build/classification_demo ${DATA}/models/squeezenet1.1-7.onnx ${DATA}/labels/synset.txt ${DATA}/imgs/dog.jpg

# Smoke test with object detection
env LD_LIBRARY_PATH=${ORT_HOME}/lib:$LD_LIBRARY_PATH ${QEMU_CMD} \
  build/detection_demo ${DATA}/models/yolov6p5_n.q.onnx ${DATA}/labels/coco.txt ${DATA}/imgs/person.jpg result0.jpg
  • Model List

5a479f85b255e46721b8452a306f820f yolov6p5_n.q.onnx
4f22f9a64ab9612ca4372a0343b3879a nanodet-plus-m_320.onnx
497ad0774f4e0b59e4f2c77ae88fcdfc squeezenet1.1-7.onnx