### Installation Rules Source: https://github.com/airockchip/rknn_model_zoo/blob/main/examples/ppyoloe/cpp/CMakeLists.txt Installs the built executable to the root directory and installs model files (bus.jpg, labels, and .rknn files) to a 'model' subdirectory. ```cmake install(TARGETS ${PROJECT_NAME} DESTINATION .) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../model/bus.jpg DESTINATION model) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../model/coco_80_labels_list.txt DESTINATION model) file(GLOB RKNN_FILES "${CMAKE_CURRENT_SOURCE_DIR}/../model/*.rknn") install(FILES ${RKNN_FILES} DESTINATION model) ``` -------------------------------- ### Basic CMake Project Setup Source: https://github.com/airockchip/rknn_model_zoo/blob/main/examples/RetinaFace/cpp/CMakeLists.txt Sets the minimum CMake version and project name. This is a standard starting point for any CMake project. ```cmake cmake_minimum_required(VERSION 3.10) project(rknn_retinaface_demo) ``` -------------------------------- ### Install Targets and Files Source: https://github.com/airockchip/rknn_model_zoo/blob/main/examples/wav2vec2/cpp/CMakeLists.txt Defines installation rules for the executable, a sample WAV file, and RKNN model files. ```cmake install(TARGETS ${PROJECT_NAME} DESTINATION .) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../model/test.wav DESTINATION ./model) file(GLOB RKNN_FILES "${CMAKE_CURRENT_SOURCE_DIR}/../model/*.rknn") install(FILES ${RKNN_FILES} DESTINATION model) ``` -------------------------------- ### Installation Rules Source: https://github.com/airockchip/rknn_model_zoo/blob/main/examples/clip/cpp/CMakeLists.txt Defines how the built targets and associated files should be installed. This includes installing the executable, model files, and text assets to their respective destinations. ```cmake install(TARGETS ${PROJECT_NAME} DESTINATION .) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../model/text.txt DESTINATION ./model) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../model/dog_224x224.jpg DESTINATION ./model) file(GLOB RKNN_FILES "${CMAKE_CURRENT_SOURCE_DIR}/../model/*.rknn") install(FILES ${RKNN_FILES} DESTINATION model) ``` -------------------------------- ### Installation Rules Source: https://github.com/airockchip/rknn_model_zoo/blob/main/examples/LPRNet/cpp/CMakeLists.txt Defines installation rules for the executable, a sample image, and all .rknn model files. ```cmake install(TARGETS ${PROJECT_NAME} DESTINATION .) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../model/test.jpg DESTINATION ./model) file(GLOB RKNN_FILES "${CMAKE_CURRENT_SOURCE_DIR}/../model/*.rknn") install(FILES ${RKNN_FILES} DESTINATION model) ``` -------------------------------- ### Install Executable and Model Files Source: https://github.com/airockchip/rknn_model_zoo/blob/main/examples/zipformer/cpp/CMakeLists.txt Defines installation rules for the built executable and associated model files. The executable is installed to the root destination, while model files (WAV, vocabulary, and RKNN models) are installed into a 'model' subdirectory. ```cmake install(TARGETS ${PROJECT_NAME} DESTINATION .) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../model/test.wav DESTINATION ./model) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../model/vocab.txt DESTINATION ./model) file(GLOB RKNN_FILES "${CMAKE_CURRENT_SOURCE_DIR}/../model/*.rknn") install(FILES ${RKNN_FILES} DESTINATION model) ``` -------------------------------- ### Installation Rules Source: https://github.com/airockchip/rknn_model_zoo/blob/main/examples/RetinaFace/cpp/CMakeLists.txt Defines what files and targets to install. This includes the main executable and associated model files. ```cmake install(TARGETS ${PROJECT_NAME} DESTINATION .) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../model/test.jpg DESTINATION model) set(file_path ${CMAKE_CURRENT_SOURCE_DIR}/../model/RetinaFace.rknn) if (EXISTS ${file_path}) install(FILES ${file_path} DESTINATION model) endif() ``` -------------------------------- ### Installation Rules Source: https://github.com/airockchip/rknn_model_zoo/blob/main/examples/PPOCR/PPOCR-Rec/cpp/CMakeLists.txt Specifies the installation targets for the executable, model files, and associated resources. ```cmake install(TARGETS ${PROJECT_NAME} DESTINATION .) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../model/test.png DESTINATION model) file(GLOB RKNN_FILES "${CMAKE_CURRENT_SOURCE_DIR}/../model/*.rknn") install(FILES ${RKNN_FILES} DESTINATION model) ``` -------------------------------- ### Install Targets and Model Files Source: https://github.com/airockchip/rknn_model_zoo/blob/main/examples/yolo11/cpp/CMakeLists.txt Installs the main executable, the zero-copy executable (if built), and model-related files to their designated destinations. This prepares the application for deployment. ```cmake install(TARGETS ${PROJECT_NAME} DESTINATION .) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../model/bus.jpg DESTINATION model) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../model/coco_80_labels_list.txt DESTINATION model) file(GLOB RKNN_FILES "${CMAKE_CURRENT_SOURCE_DIR}/../model/*.rknn") install (FILES ${RKNN_FILES} DESTINATION model) ``` -------------------------------- ### Installation Rules Source: https://github.com/airockchip/rknn_model_zoo/blob/main/examples/whisper/cpp/CMakeLists.txt Installs the built executable to the root directory and copies model files (WAV, TXT, and RKNN) to a 'model' subdirectory. This ensures all necessary components are deployed correctly. ```cmake install(TARGETS ${PROJECT_NAME} DESTINATION .) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../model/test_en.wav DESTINATION ./model) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../model/test_zh.wav DESTINATION ./model) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../model/vocab_en.txt DESTINATION ./model) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../model/vocab_zh.txt DESTINATION ./model) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../model/mel_80_filters.txt DESTINATION ./model) file(GLOB RKNN_FILES "${CMAKE_CURRENT_SOURCE_DIR}/../model/*.rknn") install(FILES ${RKNN_FILES} DESTINATION model) ``` -------------------------------- ### Installation Rules Source: https://github.com/airockchip/rknn_model_zoo/blob/main/examples/yolov5/cpp/CMakeLists.txt Defines installation targets for the executable, model files, label list, and RKNN model files. ```cmake install(TARGETS ${PROJECT_NAME} DESTINATION .) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../model/bus.jpg DESTINATION ./model) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../model/coco_80_labels_list.txt DESTINATION ./model) file(GLOB RKNN_FILES "${CMAKE_CURRENT_SOURCE_DIR}/../model/*.rknn") install(FILES ${RKNN_FILES} DESTINATION model) ``` -------------------------------- ### Installation Rules Source: https://github.com/airockchip/rknn_model_zoo/blob/main/examples/yolov8_obb/cpp/CMakeLists.txt Defines installation rules for the executable, test image, label list, and RKNN model files. ```cmake install(TARGETS ${PROJECT_NAME} DESTINATION .) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../model/test.jpg DESTINATION ./model) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../model/yolov8_obb_labels_list.txt DESTINATION ./model) file(GLOB RKNN_FILES "${CMAKE_CURRENT_SOURCE_DIR}/../model/*.rknn") install(FILES ${RKNN_FILES} DESTINATION model) ``` -------------------------------- ### Installation Rules Source: https://github.com/airockchip/rknn_model_zoo/blob/main/examples/PPOCR/PPOCR-System/cpp/CMakeLists.txt Specifies the installation targets for the built executable and model files. The executable is installed to the root directory, and model files are placed in the 'model' subdirectory. ```cmake install(TARGETS ${PROJECT_NAME} DESTINATION .) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../model/test.jpg DESTINATION model) set(file_path ${CMAKE_CURRENT_SOURCE_DIR}/../../PPOCR-Det/model/ppocrv4_det.rknn) if (EXISTS ${file_path}) install(FILES ${file_path} DESTINATION model) endif() set(file_path ${CMAKE_CURRENT_SOURCE_DIR}/../../PPOCR-Rec/model/ppocrv4_rec.rknn) if (EXISTS ${file_path}) install(FILES ${file_path} DESTINATION model) endif() ``` -------------------------------- ### Basic CMake Project Setup Source: https://github.com/airockchip/rknn_model_zoo/blob/main/examples/yolov7/cpp/CMakeLists.txt Initializes the CMake build system for the rknn_yolov7_demo project, setting the minimum required version and project name. ```cmake cmake_minimum_required(VERSION 3.10) project(rknn_yolov7_demo) ``` -------------------------------- ### Installation Rules Source: https://github.com/airockchip/rknn_model_zoo/blob/main/examples/yolov8_pose/cpp/CMakeLists.txt Defines installation rules for the executable, model files (bus.jpg, labels, .rknn models), and configuration files to specific destinations. ```cmake install(TARGETS ${PROJECT_NAME} DESTINATION .) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../model/bus.jpg DESTINATION ./model) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../model/yolov8_pose_labels_list.txt DESTINATION ./model) file(GLOB RKNN_FILES "${CMAKE_CURRENT_SOURCE_DIR}/../model/*.rknn") install(FILES ${RKNN_FILES} DESTINATION model) ``` -------------------------------- ### Basic CMake Project Setup Source: https://github.com/airockchip/rknn_model_zoo/blob/main/examples/yolov8_pose/cpp/CMakeLists.txt Initializes the CMake build system for the rknn_yolov8_pose_demo project, requiring at least version 3.10. ```cmake cmake_minimum_required(VERSION 3.10) project(rknn_yolov8_pose_demo) ``` -------------------------------- ### Install Executable and Model Files Source: https://github.com/airockchip/rknn_model_zoo/blob/main/examples/mms_tts/cpp/CMakeLists.txt Installs the built executable to the root directory and model files to the 'model' subdirectory. ```cmake install(TARGETS ${PROJECT_NAME} DESTINATION .) file(GLOB RKNN_FILES "${CMAKE_CURRENT_SOURCE_DIR}/../model/*.rknn") install(FILES ${RKNN_FILES} DESTINATION model) ``` -------------------------------- ### Basic CMake Project Setup Source: https://github.com/airockchip/rknn_model_zoo/blob/main/examples/yolo11/cpp/CMakeLists.txt Initializes the CMake project and sets the minimum required version. This is standard for all CMake projects. ```cmake cmake_minimum_required(VERSION 3.10) project(rknn_yolo11_demo) ``` -------------------------------- ### Installing Executable and Model Assets Source: https://github.com/airockchip/rknn_model_zoo/blob/main/examples/yamnet/cpp/CMakeLists.txt Defines installation rules. The executable is installed to the root directory. Model files ('test.wav', 'yamnet_class_map.txt', and all '.rknn' files) are installed into a 'model' subdirectory. ```cmake install(TARGETS ${PROJECT_NAME} DESTINATION .) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../model/test.wav DESTINATION ./model) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../model/yamnet_class_map.txt DESTINATION ./model) file(GLOB RKNN_FILES "${CMAKE_CURRENT_SOURCE_DIR}/../model/*.rknn") install(FILES ${RKNN_FILES} DESTINATION model) ``` -------------------------------- ### Basic CMake Project Setup Source: https://github.com/airockchip/rknn_model_zoo/blob/main/examples/yolov10/cpp/CMakeLists.txt Initializes the CMake build system for the YOLOv10 project and sets the minimum required version. ```cmake cmake_minimum_required(VERSION 3.10) project(rknn_yolov10_demo) ``` -------------------------------- ### Installation Rules Source: https://github.com/airockchip/rknn_model_zoo/blob/main/examples/yolov8_seg/cpp/CMakeLists.txt Defines installation targets for the executable, RKNN runtime library, and model-related files (images and labels) to specific destinations. ```cmake install(TARGETS ${PROJECT_NAME} DESTINATION .) install(FILES ${LIBRKNNRT} DESTINATION lib) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../model/bus.jpg DESTINATION model) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../model/coco_80_labels_list.txt DESTINATION model) ``` -------------------------------- ### Basic CMake Project Setup Source: https://github.com/airockchip/rknn_model_zoo/blob/main/examples/yolov5/cpp/CMakeLists.txt Sets the minimum CMake version and project name for the YOLOv5 C++ demo. ```cmake cmake_minimum_required(VERSION 3.10) project(rknn_yolov5_demo) ``` -------------------------------- ### Include Directories and Installation Source: https://github.com/airockchip/rknn_model_zoo/blob/main/examples/PPOCR/PPOCR-Det/cpp/CMakeLists.txt Specifies private include directories for the project and installs the executable and model files. It also installs all .rknn model files found in the model directory. ```cmake target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${LIBRKNNRT_INCLUDES} ) install(TARGETS ${PROJECT_NAME} DESTINATION .) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../model/test.jpg DESTINATION model) file(GLOB RKNN_FILES "${CMAKE_CURRENT_SOURCE_DIR}/../model/*.rknn") install(FILES ${RKNN_FILES} DESTINATION model) ``` -------------------------------- ### Installation Rules Source: https://github.com/airockchip/rknn_model_zoo/blob/main/examples/yolov5_seg/cpp/CMakeLists.txt Defines the installation rules for the executable, librknnrt, and model files. This ensures that the built application and its assets are correctly placed in the target system. ```cmake install(TARGETS ${PROJECT_NAME} DESTINATION .) install(FILES ${LIBRKNNRT} DESTINATION lib) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../model/bus.jpg DESTINATION model) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../model/coco_80_labels_list.txt DESTINATION model) file(GLOB RKNN_FILES "${CMAKE_CURRENT_SOURCE_DIR}/../model/*.rknn") install(FILES ${RKNN_FILES} DESTINATION model) ``` -------------------------------- ### Include Directories and Installation Source: https://github.com/airockchip/rknn_model_zoo/blob/main/examples/yolov10/cpp/CMakeLists.txt Sets private include directories for the project and defines installation rules for the executable and associated model files. ```cmake target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${LIBRKNNRT_INCLUDES} ) install(TARGETS ${PROJECT_NAME} DESTINATION .) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../model/bus.jpg DESTINATION model) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../model/coco_80_labels_list.txt DESTINATION model) file(GLOB RKNN_FILES "${CMAKE_CURRENT_SOURCE_DIR}/../model/*.rknn") install(FILES ${RKNN_FILES} DESTINATION model) ``` -------------------------------- ### Include Directories and Installation Source: https://github.com/airockchip/rknn_model_zoo/blob/main/examples/deeplabv3/cpp/CMakeLists.txt Specifies private include directories for the target and defines installation rules for the executable and model files. It installs the executable to the root directory and model files to a 'model' subdirectory. ```cmake target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${LIBRKNNRT_INCLUDES} ) install(TARGETS ${PROJECT_NAME} DESTINATION .) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../model/test_image.jpg DESTINATION model) file(GLOB RKNN_FILES "${CMAKE_CURRENT_SOURCE_DIR}/../model/*.rknn") install(FILES ${RKNN_FILES} DESTINATION model) ``` -------------------------------- ### Installation Rules Source: https://github.com/airockchip/rknn_model_zoo/blob/main/examples/mobilenet/cpp/CMakeLists.txt Defines installation rules for the built executable, model assets (images, text, and RKNN model file), ensuring they are placed in the correct destinations. ```cmake install(TARGETS ${PROJECT_NAME} DESTINATION .) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../model/bell.jpg DESTINATION model) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../model/synset.txt DESTINATION model) set(file_path ${CMAKE_CURRENT_SOURCE_DIR}/../model/mobilenet_v2.rknn) if (EXISTS ${file_path}) install(FILES ${file_path} DESTINATION model) endif() ``` -------------------------------- ### Include Directories and Installation Source: https://github.com/airockchip/rknn_model_zoo/blob/main/examples/mobilesam/cpp/CMakeLists.txt Specifies private include directories for the project and defines installation rules for the executable, configuration files, and model files. ```cmake target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${LIBRKNNRT_INCLUDES} ) install(TARGETS ${PROJECT_NAME} DESTINATION .) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../model/coords.txt DESTINATION ./model) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../model/labels.txt DESTINATION ./model) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../model/picture.jpg DESTINATION ./model) file(GLOB RKNN_FILES "${CMAKE_CURRENT_SOURCE_DIR}/../model/*.rknn") install(FILES ${RKNN_FILES} DESTINATION model) ``` -------------------------------- ### YOLOv7 Demo Output Example Source: https://github.com/airockchip/rknn_model_zoo/blob/main/examples/yolov7/README.md This is an example of the detection results printed to the console after running the YOLOv7 demo. It includes the detected object label, its bounding box coordinates, and the confidence score. ```text person @ (212 241 285 511) 0.886 bus @ (86 134 540 444) 0.855 person @ (476 237 561 519) 0.835 person @ (112 234 218 531) 0.835 person @ (79 330 124 524) 0.346 ``` -------------------------------- ### Project and Dependency Setup Source: https://github.com/airockchip/rknn_model_zoo/blob/main/examples/PPOCR/PPOCR-Rec/cpp/CMakeLists.txt Initializes the CMake project and adds subdirectories for external libraries. It also configures OpenCV based on the target system architecture. ```cmake cmake_minimum_required(VERSION 3.10) project(rknn_ppocr_rec_demo) if (ENABLE_ASAN) message(STATUS "BUILD WITH ADDRESS SANITIZER") set (CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=address") set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=address") set (CMAKE_LINKER_FLAGS_DEBUG "${CMAKE_LINKER_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=address") endif () add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../../../../3rdparty/ 3rdparty.out) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../../../../utils/ utils.out) #opencv if(CMAKE_SIZEOF_VOID_P EQUAL 8) message(STATUS "64bit") set (TARGET_LIB_ARCH lib64) else() message(STATUS "32bit") set (TARGET_LIB_ARCH lib) endif() if (CMAKE_SYSTEM_NAME STREQUAL "Android") set(OpenCV_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../../../3rdparty/opencv/opencv-android-sdk-build/sdk/native/jni/abi-${CMAKE_ANDROID_ARCH_ABI}) elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin") set(OpenCV_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../../../3rdparty/opencv/opencv-osx-x86_64/share/OpenCV) elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows") set(OpenCV_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../../../3rdparty/opencv/opencv-windows-x86_64/x64/mingw/staticlib) else() if (TARGET_SOC STREQUAL "x86-64") # set(OpenCV_DIR ${MZ_ROOT}/libs/common/opencv/opencv-linux-x86_64/share/OpenCV) elseif(TARGET_LIB_ARCH STREQUAL "lib") set(OpenCV_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../../../3rdparty/opencv/opencv-linux-armhf/share/OpenCV) else() set(OpenCV_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../../../3rdparty/opencv/opencv-linux-aarch64/share/OpenCV) endif() endif() find_package(OpenCV REQUIRED) message(STATUS OpenCV_DIR=${OpenCV_DIR}) message(STATUS OpenCV_LIBS=${OpenCV_LIBS}) set(CMAKE_INSTALL_RPATH "$ORIGIN/../lib") ``` -------------------------------- ### CMakeLists.txt Configuration Source: https://github.com/airockchip/rknn_model_zoo/blob/main/examples/ppseg/cpp/CMakeLists.txt This snippet shows the main CMakeLists.txt file for the rknn_ppseg_demo project. It defines the project, includes subdirectories, sets up build targets, links libraries, and configures installation rules. ```cmake cmake_minimum_required(VERSION 3.10) project(rknn_ppseg_demo) if (ENABLE_ASAN) message(STATUS "BUILD WITH ADDRESS SANITIZER") set (CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=address") set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=address") set (CMAKE_LINKER_FLAGS_DEBUG "${CMAKE_LINKER_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=address") endif () add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../../../3rdparty/ 3rdparty.out) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../../../utils/ utils.out) set(CMAKE_INSTALL_RPATH "$ORIGIN/../lib") if (TARGET_SOC STREQUAL "rk1808" OR TARGET_SOC STREQUAL "rv1109" OR TARGET_SOC STREQUAL "rv1126") set(ppseg_file rknpu1/ppseg.cc) else() set(ppseg_file rknpu2/ppseg.cc) endif () file(GLOB SRCS ${CMAKE_CURRENT_SOURCE_DIR}/*.cc) add_executable(${PROJECT_NAME} main.cc ${ppseg_file} ) target_link_libraries(${PROJECT_NAME} fileutils imageutils imagedrawing ${LIBRKNNRT} dl ) if (CMAKE_SYSTEM_NAME STREQUAL "Android") target_link_libraries(${PROJECT_NAME} log ) endif () if (CMAKE_SYSTEM_NAME STREQUAL "Linux") set(THREADS_PREFER_PTHREAD_FLAG ON) find_package(Threads REQUIRED) target_link_libraries(${PROJECT_NAME} Threads::Threads) endif () target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${LIBRKNNRT_INCLUDES} ) install(TARGETS ${PROJECT_NAME} DESTINATION .) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../model/test.png DESTINATION model) file(GLOB RKNN_FILES "${CMAKE_CURRENT_SOURCE_DIR}/../model/*.rknn") install(FILES ${RKNN_FILES} DESTINATION model) ``` -------------------------------- ### Install RKNN Model Files Source: https://github.com/airockchip/rknn_model_zoo/blob/main/examples/yolov8_seg/cpp/CMakeLists.txt Installs all .rknn model files found in the model directory to the 'model' destination. ```cmake file(GLOB RKNN_FILES "${CMAKE_CURRENT_SOURCE_DIR}/../model/*.rknn") install(FILES ${RKNN_FILES} DESTINATION model) ``` -------------------------------- ### Run PPOCR-Det Demo on Device Source: https://github.com/airockchip/rknn_model_zoo/blob/main/examples/PPOCR/PPOCR-Det/README.md Connect to the device via adb, navigate to the demo directory, set the library path, and execute the demo with the model and input image. ```shell adb shell cd /userdata/rknn_PPOCR-Det_demo export LD_LIBRARY_PATH=./lib ./rknn_ppocr_det_demo model/ppocrv4_det.rknn model/test.jpg ``` -------------------------------- ### Install Python Dependencies Source: https://github.com/airockchip/rknn_model_zoo/blob/main/examples/mms_tts/export_onnx.md Installs necessary PyTorch and Transformers versions for exporting MMS-TTS models. Ensure compatibility with your environment. ```sh pip install torch==1.10.0+cpu torchvision==0.11.0+cpu torchaudio==0.10.0 -f https://download.pytorch.org/whl/torch_stable.html pip install transformers==4.39.3 ``` -------------------------------- ### Run Wav2Vec2 Demo on Device Source: https://github.com/airockchip/rknn_model_zoo/blob/main/examples/wav2vec2/README.md Connect to the device via ADB, navigate to the demo directory, set the LD_LIBRARY_PATH, and execute the Wav2Vec2 demo with the specified model and WAV file. ```shell adb shell cd /data/rknn_wav2vec2_demo export LD_LIBRARY_PATH=./lib ./rknn_wav2vec2_demo model/wav2vec2_base_960h_20s.rknn model/test.wav ``` -------------------------------- ### Run PPOCR-Rec Demo on Device Source: https://github.com/airockchip/rknn_model_zoo/blob/main/examples/PPOCR/PPOCR-Rec/README.md Connect to the device via adb shell, navigate to the demo directory, set the library path, and execute the recognition demo with the model and test image. ```shell adb shell cd /userdata/rknn_PPOCR-Rec_demo export LD_LIBRARY_PATH=./lib ./rknn_ppocr_rec_demo model/ppocrv4_rec.rknn model/test.png ``` -------------------------------- ### Run Yolov6 Demo (Linux) Source: https://github.com/airockchip/rknn_model_zoo/blob/main/examples/yolov6/README.md Execute the Yolov6 demo on the device after pushing the files. Ensure the LD_LIBRARY_PATH is set correctly and provide the paths to the model and input image. ```shell adb shell cd /userdata/rknn_yolov6_demo export LD_LIBRARY_PATH=./lib ./rknn_yolov6_demo model/yolov6.rknn model/bus.jpg ``` -------------------------------- ### Install Environment for ONNX Export Source: https://github.com/airockchip/rknn_model_zoo/blob/main/examples/yamnet/export_onnx.md Installs the required Python packages for exporting YAMNet models to ONNX. Ensure you use the specified versions for compatibility. ```shell pip install onnx==1.16.0 pip install onnxruntime==1.17.3 pip install tensorflow==2.13.1 pip install tensorflow_hub==0.16.1 pip install tf2onnx==1.16.1 ``` -------------------------------- ### Run RetinaFace Demo on Device Source: https://github.com/airockchip/rknn_model_zoo/blob/main/examples/RetinaFace/README.md Connect to the device via adb shell, navigate to the demo directory, set the library path, and execute the RetinaFace demo with model and image paths. ```shell adb shell cd /userdata/rknn_RetinaFace_demo export LD_LIBRARY_PATH=./lib ./rknn_retinaface_demo model/RetinaFace_mobile320.rknn model/test.jpg ``` -------------------------------- ### Zipformer Output Example Source: https://github.com/airockchip/rknn_model_zoo/blob/main/examples/zipformer/README.md This is an example of the text output from the Zipformer model. Note that results can differ slightly across different platforms, tool versions, and drivers. ```text Zipformer output: 对我做了介绍那么我想说的是大家如果对我的研究感兴趣呢 ``` -------------------------------- ### YOLOX Detection Results Example Source: https://github.com/airockchip/rknn_model_zoo/blob/main/examples/yolox/README.md Example output format for the YOLOX detection results, showing detected object labels, their bounding box coordinates, and confidence scores. ```text bus @ (91 138 549 427) 0.933 person @ (105 234 220 538) 0.901 person @ (210 241 284 506) 0.878 person @ (475 236 560 520) 0.824 person @ (79 327 118 518) 0.508 ``` -------------------------------- ### Run Yolov5 Demo on Device Source: https://github.com/airockchip/rknn_model_zoo/blob/main/examples/yolov5/README.md Connect to the device via adb shell, navigate to the demo directory, set the LD_LIBRARY_PATH, and execute the demo with the model and input image. The output image will be saved as out.png. ```shell adb shell cd /userdata/rknn_yolov5_demo export LD_LIBRARY_PATH=./lib ./rknn_yolov5_demo model/yolov5.rknn model/bus.jpg ``` -------------------------------- ### YOLOv8 Detection Output Example Source: https://github.com/airockchip/rknn_model_zoo/blob/main/examples/yolov8/README.md Example of the text output format for YOLOv8 detection results, showing detected object labels, their bounding box coordinates, and confidence scores. ```text person @ (211 241 283 507) 0.873 person @ (109 235 225 536) 0.866 person @ (476 222 560 521) 0.863 bus @ (99 136 550 456) 0.859 person @ (80 326 116 513) 0.311 ``` -------------------------------- ### Run YOLOv8 OBB Demo on Device Source: https://github.com/airockchip/rknn_model_zoo/blob/main/examples/yolov8_obb/README.md Connect to the device via adb shell, navigate to the demo directory, set the LD_LIBRARY_PATH, and execute the demo with the model and test image paths. ```shell adb shell cd /userdata/rknn_yolov8_obb_demo export LD_LIBRARY_PATH=./lib ./rknn_yolov8_obb_demo model/yolov8n-obb.rknn model/test.jpg ``` ```shell adb pull /userdata/rknn_yolov8_obb_demo/out.png ``` -------------------------------- ### Install OpenCV Manager APK Manually Source: https://github.com/airockchip/rknn_model_zoo/blob/main/3rdparty/opencv/opencv-android-sdk-build/apk/readme.txt Use this command to install the OpenCV Manager APK manually via ADB when Google Play is not available. Ensure you replace placeholders with the correct path and version information. ```bash adb install /apk/OpenCV__Manager__.apk ``` -------------------------------- ### Run YOLO-World Demo on Device Source: https://github.com/airockchip/rknn_model_zoo/blob/main/examples/yolo_world/README.md Connect to the device via adb shell, navigate to the demo directory, set the LD_LIBRARY_PATH, and execute the demo with the required model and image files. ```shell adb shell cd /userdata/rknn_yolo_world_demo export LD_LIBRARY_PATH=./lib ./rknn_yolo_world_demo clip_text_fp16.rknn model/detect_classes.txt yolo_world_v2s_i8.rknn model/bus.jpg ``` -------------------------------- ### YOLOv8 OBB Detection Results Example Source: https://github.com/airockchip/rknn_model_zoo/blob/main/examples/yolov8_obb/README.md This is an example of the text output format for detected objects, including label, bounding box coordinates, and confidence score. Results may vary slightly across different platforms and tool versions. ```text ship @ (172 757 42 43 angle=0.001677) 0.858 ship @ (582 361 64 62 angle=0.207816) 0.858 ship @ (521 489 37 40 angle=0.067267) 0.858 ship @ (187 627 89 84 angle=0.348365) 0.858 ... ship @ (631 224 15 13 angle=0.404585) 0.599 ship @ (459 96 16 13 angle=0.601354) 0.589 ship @ (482 121 13 11 angle=0.666943) 0.589 ship @ (494 136 18 13 angle=0.741903) 0.500 ``` -------------------------------- ### YOLOv5 Segmentation Detection Output Example Source: https://github.com/airockchip/rknn_model_zoo/blob/main/examples/yolov5_seg/README.md This is an example of the text output from a YOLOv5 segmentation model, showing detected objects, their bounding boxes, and confidence scores. Note that results may vary slightly across different platforms and tool versions. ```text person @ (213 238 284 515) 0.886 person @ (109 241 224 536) 0.861 person @ (474 230 560 522) 0.842 bus @ (98 133 547 461) 0.816 person @ (79 326 124 520) 0.510 ``` -------------------------------- ### Run PPOCR-System Demo on Linux Source: https://github.com/airockchip/rknn_model_zoo/blob/main/examples/PPOCR/PPOCR-System/README.md Execute the PPOCR-System demo on your Linux device. This command sets the library path and runs the demo. If librga.so is not found, you may need to add its location to LD_LIBRARY_PATH. ```shell adb shell cd /userdata/rknn_PPOCR-System_demo export LD_LIBRARY_PATH=./lib ./rknn_ppocr_system_demo ppocrv4_det_i8.rknn ppocrv4_rec_fp16.rknn model/test.jpg ``` ```shell export LD_LIBRARY_PATH=./lib: ``` -------------------------------- ### Compile and Build YOLOv8 OBB Demo Source: https://github.com/airockchip/rknn_model_zoo/blob/main/examples/yolov8_obb/README.md Navigate to the rknn_model_zoo root directory and execute the build script. Optionally set the GCC_COMPILER path if it's not found. ```shell # go back to the rknn_model_zoo root directory cd ../.. # if GCC_COMPILER not found while building, please set GCC_COMPILER path (optional)export GCC_COMPILER= ./build-linux.sh -t -a -d yolov8_obb # such as ./build-linux.sh -t rk3588 -a aarch64 -d yolov8_obb ``` ```shell export GCC_COMPILER=~/opt/arm-rockchip830-linux-uclibcgnueabihf/bin/arm-rockchip830-linux-uclibcgnueabihf ``` ```shell # Query architecture. For Linux, ['aarch64' or 'armhf'] should shown in log. adb shell cat /proc/version ``` -------------------------------- ### Runtime Path Configuration Source: https://github.com/airockchip/rknn_model_zoo/blob/main/examples/LPRNet/cpp/CMakeLists.txt Sets the installation runtime path for shared libraries, ensuring they can be found at runtime. ```cmake set(CMAKE_INSTALL_RPATH "$ORIGIN/../lib") ``` -------------------------------- ### Compile and Build PPOCR-System for Android Source: https://github.com/airockchip/rknn_model_zoo/blob/main/examples/PPOCR/PPOCR-System/README.md Use this command to compile and build the PPOCR-System demo for Android. Ensure you set the ANDROID_NDK_PATH and specify the target platform and architecture. ```shell # go back to the rknn_model_zoo root directory cd ../../ export ANDROID_NDK_PATH= ./build-android.sh -t -a -d PPOCR-System # such as ./build-android.sh -t rk3588 -a arm64-v8a -d PPOCR-System ``` -------------------------------- ### Set GCC_COMPILER Path Source: https://github.com/airockchip/rknn_model_zoo/blob/main/examples/RetinaFace/README.md Example of how to set the GCC_COMPILER environment variable if it's not automatically found during the build process. ```shell export GCC_COMPILER=~/opt/arm-rockchip830-linux-uclibcgnueabihf/bin/arm-rockchip830-linux-uclibcgnueabihf ``` -------------------------------- ### Subdirectory and Library Inclusion Source: https://github.com/airockchip/rknn_model_zoo/blob/main/examples/ppyoloe/cpp/CMakeLists.txt Includes external subdirectories for third-party libraries and utility modules, and sets the installation runtime path. ```cmake add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../../../3rdparty/ 3rdparty.out) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../../../utils/ utils.out) set(CMAKE_INSTALL_RPATH "$ORIGIN/../lib") ``` -------------------------------- ### Push PPOCR-System Demo Files to Linux Device Source: https://github.com/airockchip/rknn_model_zoo/blob/main/examples/PPOCR/PPOCR-System/README.md Transfer the compiled demo files to your Linux device. Use ADB for connected devices or SCP for other boards, pushing to the /userdata/ directory. ```shell adb push install/_linux_/rknn_PPOCR-System_demo/ /userdata/ ``` -------------------------------- ### Run Linux CLIP Demo Source: https://github.com/airockchip/rknn_model_zoo/blob/main/examples/clip/README.md Execute the CLIP demo on a Linux device. Navigate to the demo directory and set the library path before running. ```shell adb shell cd /userdata/rknn_clip_demo export LD_LIBRARY_PATH=./lib ./rknn_clip_demo clip_images_fp16.rknn model/dog_224x224.jpg clip_text_fp16.rknn model/text.txt ``` -------------------------------- ### Run YOLOv11 Demo on Device Source: https://github.com/airockchip/rknn_model_zoo/blob/main/examples/yolo11/README.md Execute the YOLOv11 demo on the device after pushing the files. Set the LD_LIBRARY_PATH and provide the paths to the model and input image. ```shell adb shell cd /userdata/rknn_yolo11_demo export LD_LIBRARY_PATH=./lib ./rknn_yolo11_demo model/yolo11.rknn model/bus.jpg ``` -------------------------------- ### Push Linux Demo Files Source: https://github.com/airockchip/rknn_model_zoo/blob/main/examples/ppseg/README.md Push the compiled ppseg demo files to the Linux device. Use scp for other boards if needed. ```shell adb push install/_linux_/rknn_ppseg_demo/ /userdata/ ``` -------------------------------- ### Run YOLOX Demo on Device Source: https://github.com/airockchip/rknn_model_zoo/blob/main/examples/yolox/README.md Execute the YOLOX demo on the device after pushing the files. Set the LD_LIBRARY_PATH and provide the paths to the model and input image. ```shell adb shell cd /userdata/rknn_yolox_demo export LD_LIBRARY_PATH=./lib ./rknn_yolox_demo model/yolox.rknn model/bus.jpg ``` -------------------------------- ### Subdirectory and Library Linking Source: https://github.com/airockchip/rknn_model_zoo/blob/main/examples/yolov10/cpp/CMakeLists.txt Includes external third-party and utility libraries, sets the installation runtime path, and links essential libraries for the main executable. ```cmake add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../../../3rdparty/ 3rdparty.out) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../../../utils/ utils.out) set(CMAKE_INSTALL_RPATH "$ORIGIN/../lib") file(GLOB SRCS ${CMAKE_CURRENT_SOURCE_DIR}/*.cc) add_executable(${PROJECT_NAME} main.cc postprocess.cc ${rknpu_yolov10_file} ) target_link_libraries(${PROJECT_NAME} imageutils fileutils imagedrawing ${LIBRKNNRT} dl ) ``` -------------------------------- ### Run Android Demo Source: https://github.com/airockchip/rknn_model_zoo/blob/main/examples/yolov5_seg/README.md Execute the YOLOv5-Seg demo on the Android device. Set the LD_LIBRARY_PATH and run the executable with the RKNN model and input image paths. The output is saved as 'out.png'. ```shell adb shell cd /data/rknn_yolov5_seg_demo export LD_LIBRARY_PATH=./lib ./rknn_yolov5_seg_demo model/yolov5_seg.rknn model/bus.jpg ``` -------------------------------- ### Run YOLO-World Demo on Android Device Source: https://github.com/airockchip/rknn_model_zoo/blob/main/examples/yolo_world/README.md Execute the YOLO-World demo on the Android device. This command starts the inference process with specified models and an input image. ```shell adb shell cd /data/rknn_yolo_world_demo export LD_LIBRARY_PATH=./lib ./rknn_yolo_world_demo clip_text_fp16.rknn model/detect_classes.txt yolo_world_v2s_i8.rknn model/bus.jpg ``` -------------------------------- ### Compile and Build Wav2Vec2 Demo for Linux Source: https://github.com/airockchip/rknn_model_zoo/blob/main/examples/wav2vec2/README.md Navigate to the rknn_model_zoo root directory and execute the build script. Optionally, set the GCC_COMPILER path if it's not found. Specify the target platform, architecture, and the model type 'wav2vec2'. ```shell # go back to the rknn_model_zoo root directory cd ../.. # if GCC_COMPILER not found while building, please set GCC_COMPILER path (optional)export GCC_COMPILER= ./build-linux.sh -t -a -d wav2vec2 # such as ./build-linux.sh -t rk3588 -a aarch64 -d wav2vec2 ``` -------------------------------- ### Compile and Build YOLO-World Demo Source: https://github.com/airockchip/rknn_model_zoo/blob/main/examples/yolo_world/README.md Navigate to the rknn_model_zoo root directory and execute the build script. Set the GCC_COMPILER path if it's not found. Specify the target platform, architecture, and the demo name. ```shell # go back to the rknn_model_zoo root directory cd ../../ # if GCC_COMPILER not found while building, please set GCC_COMPILER path (optional)export GCC_COMPILER= ./build-linux.sh -t -a -d yolo_world # such as ./build-linux.sh -t rk3588 -a aarch64 -d yolo_world ``` -------------------------------- ### Run Android PPOCR-Det Demo Source: https://github.com/airockchip/rknn_model_zoo/blob/main/examples/PPOCR/PPOCR-Det/README.md Execute the PPOCR-Det demo on the Android device. This command starts the inference process using the specified model and input image. ```shell adb shell cd /data/rknn_PPOCR-Det_demo export LD_LIBRARY_PATH=./lib ./rknn_ppocr_det_demo model/ppocrv4_det.rknn model/test.jpg ``` -------------------------------- ### YOLOv11 Detection Result Format Source: https://github.com/airockchip/rknn_model_zoo/blob/main/examples/yolo11/README.md Example output format for the YOLOv11 detection results, showing the detected object class, bounding box coordinates, and confidence score. ```text person @ (108 236 224 535) 0.898 person @ (212 240 284 509) 0.847 person @ (476 229 559 520) 0.827 person @ (79 358 118 516) 0.396 bus @ (91 136 554 440) 0.948 ``` -------------------------------- ### Get Point Coordinates from Image Source: https://github.com/airockchip/rknn_model_zoo/blob/main/examples/mobilesam/README.md Use this script to interactively select a point on an image. The script will print the coordinates of the clicked point, which can be used as input for the MobileSAM demo. ```shell python get_point_coords.py # Click on the coordinates of a point you need in the image, the point coordinates will be printed. ``` -------------------------------- ### Get Box Coordinates from Image Source: https://github.com/airockchip/rknn_model_zoo/blob/main/examples/mobilesam/README.md Use this script to interactively select a bounding box on an image by clicking and dragging. The script will output the top-left and bottom-right coordinates of the selected box. ```shell python get_box_coords.py # Click on the starting point of the box in the image, then drag the mouse to you need box, the box coordinates: top-left and bottom-right will be printed. ``` -------------------------------- ### Compile and Build Android Demo Source: https://github.com/airockchip/rknn_model_zoo/blob/main/examples/yolov5_seg/README.md Build the Android demo for YOLOv5-Seg. Ensure the ANDROID_NDK_PATH is set and specify the target platform and architecture. Note: RK1808, RV1109, RV1126 do not support Android. ```shell # go back to the rknn_model_zoo root directory cd ../../ export ANDROID_NDK_PATH= ./build-android.sh -t -a -d yolov5_seg ``` ```shell # such as ./build-android.sh -t rk3588 -a arm64-v8a -d yolov5_seg ``` -------------------------------- ### Export ONNX Model with PaddleSeg Source: https://github.com/airockchip/rknn_model_zoo/blob/main/examples/ppseg/Paddle_2_ONNX.md Use this command to export your PaddleSeg model to ONNX format. Ensure you have installed the PaddleSeg repository and refer to the deployment documentation for specific configuration details. ```bash cd PaddleSeg python deploy/python/infer_onnx_trt.py \ --config \ --model_path \ --width \ --height ``` -------------------------------- ### Compile and Build Linux CLIP Demo Source: https://github.com/airockchip/rknn_model_zoo/blob/main/examples/clip/README.md Build the Linux demo for CLIP. Optionally set the GCC_COMPILER path and specify the target platform and architecture. ```shell # go back to the rknn_model_zoo root directory cd ../.. # if GCC_COMPILER not found while building, please set GCC_COMPILER path (optional)export GCC_COMPILER= ./build-linux.sh -t -a -d clip # such as ./build-linux.sh -t rk3588 -a aarch64 -d clip ``` -------------------------------- ### Run YOLOv7 Demo on Device Source: https://github.com/airockchip/rknn_model_zoo/blob/main/examples/yolov7/README.md Execute the YOLOv7 demo on the device after pushing the files. Ensure the LD_LIBRARY_PATH is set correctly and provide the paths to the model and input image. ```shell adb shell cd /userdata/rknn_yolov7_demo export LD_LIBRARY_PATH=./lib ./rknn_yolov7_demo model/yolov7.rknn model/bus.jpg ``` -------------------------------- ### Executable and Source File Definition Source: https://github.com/airockchip/rknn_model_zoo/blob/main/examples/yolov5_seg/cpp/CMakeLists.txt Defines the main executable target and dynamically selects source files for post-processing and Yolov5 segmentation based on the target SOC. It also sets the installation runtime path. ```cmake set(CMAKE_INSTALL_RPATH "$ORIGIN/../lib") file(GLOB SRCS ${CMAKE_CURRENT_SOURCE_DIR}/*.cc) #dma include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../../../3rdparty/allocator/dma) #drm include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../../../3rdparty/allocator/drm) if (TARGET_SOC STREQUAL "rk1808" OR TARGET_SOC STREQUAL "rv1109" OR TARGET_SOC STREQUAL "rv1126") set(postprocess_file rknpu1/postprocess.cc) set(yolov5_seg_file rknpu1/yolov5_seg.cc) #matmul else() set(postprocess_file rknpu2/postprocess.cc) set(yolov5_seg_file rknpu2/yolov5_seg.cc) endif() add_executable(${PROJECT_NAME} main.cc ${postprocess_file} ${yolov5_seg_file} ) ``` -------------------------------- ### Push Android Demo Files to Device Source: https://github.com/airockchip/rknn_model_zoo/blob/main/examples/yolov5/README.md Push the compiled YOLOv5 demo files to the Android device using adb. ```shell adb root adb remount adb push install/_android_/rknn_yolov5_demo/ /data/ ``` -------------------------------- ### Run YOLOv8-OBB Android Demo Source: https://github.com/airockchip/rknn_model_zoo/blob/main/examples/yolov8_obb/README.md Execute the YOLOv8-OBB demo on the Android device. Set the library path and provide the model and test image paths. ```shell adb shell cd /data/rknn_yolov8_obb_demo export LD_LIBRARY_PATH=./lib ./rknn_yolov8_obb_demo model/yolov8n-obb.rknn model/test.jpg ```