Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev/rk356x #138

Merged
merged 9 commits into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 42 additions & 4 deletions .github/workflows/build_sdks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ jobs:
ls build

build_macos_arm64:
name: Compile MacOS-arm64
name: Compile MacOS-Arm64
runs-on: macos-14

steps:
Expand All @@ -89,7 +89,7 @@ jobs:
ls build

build_armv7_armhf:
name: Compile Armv7-armhf
name: Compile Armv7-Armhf
runs-on: ubuntu-latest

steps:
Expand Down Expand Up @@ -256,7 +256,7 @@ jobs:
ls build

build_ios:
name: Compile iOS-arm64
name: Compile iOS-Arm64
runs-on: macos-latest

steps:
Expand Down Expand Up @@ -302,7 +302,7 @@ jobs:
ls build

build_armv7_rv1106_armhf_uclibc:
name: Compile Linux-armv7 rv1106
name: Compile Linux-Armv7 RV1106
runs-on: ubuntu-latest

steps:
Expand Down Expand Up @@ -336,4 +336,42 @@ jobs:
- name: Start Building the InspireFace-Linux-armv7-rv1106
run: |
bash command/build_cross_rv1106_armhf_uclibc.sh
ls build

build_rk356x_aarch64:
name: Compile Linux-AArch64 RK356X
runs-on: ubuntu-latest

steps:
# Step 1: Checkout the repository
- name: Checkout Repository
uses: actions/checkout@v4

# Step 2: Synchronize and update submodules recursively
- name: Update submodules
run: |
git clone --recurse-submodules https://github.com/tunmx/inspireface-3rdparty.git 3rdparty

# Step 3: Install wget and xz-utils
- name: Install wget and xz-utils
run: |
sudo apt-get update
sudo apt-get install -y wget xz-utils

# Step 4: Download Toolchain
- name: Download and Extract Linaro Toolchain
run: |
mkdir -p /opt/linaro-toolchain
wget -qO- https://releases.linaro.org/components/toolchain/binaries/6.3-2017.05/aarch64-linux-gnu/gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu.tar.xz | tar -xJ -C /opt/linaro-toolchain --strip-components=1

# Step 5: Install Toolchain
- name: Set environment variables
run: |
echo "ARM_CROSS_COMPILE_TOOLCHAIN=/opt/linaro-toolchain" >> $GITHUB_ENV
echo "PATH=/opt/linaro-toolchain/bin:${PATH}" >> $GITHUB_ENV

# Step 6: Start building the SDK
- name: Start Building the InspireFace-Linux-AArch64-rk356x
run: |
bash command/build_cross_rk356x_aarch64.sh
ls build
49 changes: 49 additions & 0 deletions .github/workflows/linux-armv7-rk356x-aarch64.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Build Linux-Ubuntu-AArch64-rk356x

on:
push:
branches: ["feature/rk356x"]

# Set the global GitHub token environment variable
env:
GITHUB_TOKEN: ${{ secrets.MY_GITHUB_TOKEN }}

jobs:
build:
name: Compile Linux-AArch64 RK356X
runs-on: ubuntu-latest

steps:
# Step 1: Checkout the repository
- name: Checkout Repository
uses: actions/checkout@v4

# Step 2: Synchronize and update submodules recursively
- name: Update submodules
run: |
git clone --recurse-submodules https://github.com/tunmx/inspireface-3rdparty.git 3rdparty

# Step 3: Install wget and xz-utils
- name: Install wget and xz-utils
run: |
sudo apt-get update
sudo apt-get install -y wget xz-utils

# Step 4: Download Toolchain
- name: Download and Extract Linaro Toolchain
run: |
mkdir -p /opt/linaro-toolchain
wget -qO- https://releases.linaro.org/components/toolchain/binaries/6.3-2017.05/aarch64-linux-gnu/gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu.tar.xz | tar -xJ -C /opt/linaro-toolchain --strip-components=1

# Step 5: Install Toolchain
- name: Set environment variables
run: |
echo "ARM_CROSS_COMPILE_TOOLCHAIN=/opt/linaro-toolchain" >> $GITHUB_ENV
echo "PATH=/opt/linaro-toolchain/bin:${PATH}" >> $GITHUB_ENV

# Step 6: Start building the SDK
- name: Start Building the InspireFace-Linux-AArch64-rk356x
run: |
bash command/build_cross_rk356x_aarch64.sh
ls build

62 changes: 61 additions & 1 deletion .github/workflows/release-sdks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -548,10 +548,69 @@ jobs:
path: |
inspireface-macos-intel-x86-64-${{ env.VERSION }}.zip

build_rk356x_aarch64:
name: Compile Linux-AArch64 RK356X
runs-on: ubuntu-latest

steps:
# Step 1: Checkout the repository
- name: Checkout Repository
uses: actions/checkout@v4

# Step 2: Extract the version number from the tag (e.g., "v1.2.3" becomes "1.2.3")
- name: Extract Version Number
id: extract_version
run: echo "VERSION=$(echo ${GITHUB_REF#refs/tags/} | sed 's/^v//')" >> $GITHUB_ENV

# Step 3: Synchronize and update submodules recursively
- name: Update submodules
run: |
git clone --recurse-submodules https://github.com/tunmx/inspireface-3rdparty.git 3rdparty

# Step 4: Install wget and xz-utils
- name: Install wget and xz-utils
run: |
sudo apt-get update
sudo apt-get install -y wget xz-utils

# Step 5: Download Toolchain
- name: Download and Extract Linaro Toolchain
run: |
mkdir -p /opt/linaro-toolchain
wget -qO- https://releases.linaro.org/components/toolchain/binaries/6.3-2017.05/aarch64-linux-gnu/gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu.tar.xz | tar -xJ -C /opt/linaro-toolchain --strip-components=1

# Step 6: Install Toolchain
- name: Set environment variables
run: |
echo "ARM_CROSS_COMPILE_TOOLCHAIN=/opt/linaro-toolchain" >> $GITHUB_ENV
echo "PATH=/opt/linaro-toolchain/bin:${PATH}" >> $GITHUB_ENV

# Step 7: Start building the SDK
- name: Start Building the InspireFace-Linux-AArch64-rk356x
run: |
bash command/build_cross_rk356x_aarch64.sh
ls build

# Step 7: Zip SDK directory
- name: Zip SDK directory
run: |
cd build
zip -r ../inspireface-linux-aarch64-rk356x-${{ env.VERSION }}.zip inspireface-linux-aarch64-rk356x-${{ env.VERSION }}
cd ..
stat inspireface-linux-aarch64-rk356x-${{ env.VERSION }}.zip

# Step 8: Upload the zipped SDK files for the next job
- name: Upload SDK Artifacts
uses: actions/upload-artifact@v4
with:
name: sdk_files_linux_aarch64_rk356x
path: |
inspireface-linux-aarch64-rk356x-${{ env.VERSION }}.zip


release:
name: Release SDKs to GitHub
needs: [ build_linux_x86, build_armv7_armhf, build_armv7_rv1109rv1126_armhf, build_linux_aarch64, build_android, build_ios, build_manylinux2014_x86, build_armv7_rv1106_armhf_uclibc, build_macos_apple_silicon_arm64, build_macos_intel_x86_64]
needs: [ build_linux_x86, build_armv7_armhf, build_armv7_rv1109rv1126_armhf, build_linux_aarch64, build_android, build_ios, build_manylinux2014_x86, build_armv7_rv1106_armhf_uclibc, build_rk356x_aarch64, build_macos_apple_silicon_arm64, build_macos_intel_x86_64]
runs-on: ubuntu-latest

steps:
Expand Down Expand Up @@ -584,6 +643,7 @@ jobs:
sdk_artifacts/sdk_files_armv7_armhf/inspireface-linux-armv7-armhf-${{ env.VERSION }}.zip
sdk_artifacts/sdk_files_armv7_rv1109rv1126_armhf/inspireface-linux-armv7-rv1109rv1126-armhf-${{ env.VERSION }}.zip
sdk_artifacts/sdk_files_armv7_rv1106_armhf_uclibc/inspireface-linux-armv7-rv1106-armhf-uclibc-${{ env.VERSION }}.zip
sdk_artifacts/sdk_files_linux_aarch64_rk356x/inspireface-linux-aarch64-rk356x-${{ env.VERSION }}.zip
sdk_artifacts/sdk_files_linux_aarch64/inspireface-linux-aarch64-${{ env.VERSION }}.zip
sdk_artifacts/sdk_files_android/inspireface-android-${{ env.VERSION }}.zip
sdk_artifacts/sdk_files_ios/inspireface-ios-${{ env.VERSION }}.zip
Expand Down
11 changes: 10 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3")
# Current version
set(INSPIRE_FACE_VERSION_MAJOR 1)
set(INSPIRE_FACE_VERSION_MINOR 1)
set(INSPIRE_FACE_VERSION_PATCH 9)
set(INSPIRE_FACE_VERSION_PATCH 10)

# Converts the version number to a string
string(CONCAT INSPIRE_FACE_VERSION_MAJOR_STR ${INSPIRE_FACE_VERSION_MAJOR})
Expand Down Expand Up @@ -69,6 +69,12 @@ if (ISF_ENABLE_RKNN)
endif()
# Result
message(STATUS "Use ${ISF_RKNPU_MAJOR}")

if(ISF_RK_DEVICE_TYPE STREQUAL "RV1106")
set(ISF_RKNPU_RV1106 ON)
add_definitions("-DISF_RKNPU_RV1106")
endif()

endif ()

# Enable Rockchip RGA
Expand Down Expand Up @@ -288,6 +294,9 @@ if (ISF_ENABLE_RKNN)
message(STATUS "\t ISF_RKNPU_MAJOR: ${ISF_RKNPU_MAJOR}")
message(STATUS "\t ISF_RK_DEVICE_TYPE: ${ISF_RK_DEVICE_TYPE}")
message(STATUS "\t ISF_RK_COMPILER_TYPE: ${ISF_RK_COMPILER_TYPE}")
if(ISF_RKNPU_RV1106)
message(STATUS "\t ISF_RKNPU_RV1106: ${ISF_RKNPU_RV1106}")
endif()
endif ()
message(STATUS "\t ISF_BUILD_LINUX_ARM7: ${ISF_BUILD_LINUX_ARM7}")
message(STATUS "\t ISF_BUILD_LINUX_AARCH64: ${ISF_BUILD_LINUX_AARCH64}")
Expand Down
17 changes: 12 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ Please contact [[email protected]](mailto:[email protected]?subject=In

## Change Logs

**`2024-12-22`** Started adapting for multiple Rockchip devices with NPU support, beginning with RV1106 support.
**`2025-01-08`** Support inference on Rockchip devices **RK3566/RK3568** NPU.

**`2024-12-25`** Add support for optional **RKRGA** image acceleration processing on Rockchip devices.

**`2024-12-22`** Started adapting for multiple Rockchip devices with NPU support, beginning with **RV1103/RV1106** support.

**`2024-12-10`** Added support for quick installation via Python package manager.

Expand Down Expand Up @@ -132,6 +136,8 @@ bash command/download_models_general.sh Megatron
bash command/download_models_general.sh Gundam_RV1109
# Download resource files for RV1106
bash command/download_models_general.sh Gundam_RV1106
# Download resource files for RK356X
bash command/download_models_general.sh Gundam_RV356X

# Download all model files
bash command/download_models_general.sh
Expand Down Expand Up @@ -227,9 +233,9 @@ We have completed the adaptation and testing of the software across various oper
| 1 | **Linux-CPU** | ARMv7 | - | [![build](https://img.shields.io/github/actions/workflow/status/HyperInspire/InspireFace/release-sdks.yaml?&style=for-the-badge&label=build)](https://github.com/HyperInspire/InspireFace/actions/workflows/release-sdks.yaml) | ![test](https://img.shields.io/badge/OFFLINE-PASSING-blue?style=for-the-badge) |
| 2 | | ARMv8 | - | [![build](https://img.shields.io/github/actions/workflow/status/HyperInspire/InspireFace/release-sdks.yaml?&style=for-the-badge&label=build)](https://github.com/HyperInspire/InspireFace/actions/workflows/release-sdks.yaml) | ![test](https://img.shields.io/badge/OFFLINE-PASSING-blue?style=for-the-badge) |
| 3 | | x86/x86_64 | - | [![build](https://img.shields.io/github/actions/workflow/status/HyperInspire/InspireFace/release-sdks.yaml?&style=for-the-badge&label=build)](https://github.com/HyperInspire/InspireFace/actions/workflows/release-sdks.yaml) | [![test](https://img.shields.io/github/actions/workflow/status/HyperInspire/InspireFace/test_ubuntu_x86_Pikachu.yaml?style=for-the-badge&label=Test&color=blue)](https://github.com/HyperInspire/InspireFace/actions/workflows/test_ubuntu_x86_Pikachu.yaml) |
| 4 | **Linux-Rockchip** | ARMv7 | RV1109RV1126 | [![build](https://img.shields.io/github/actions/workflow/status/HyperInspire/InspireFace/release-sdks.yaml?&style=for-the-badge&label=build)](https://github.com/HyperInspire/InspireFace/actions/workflows/release-sdks.yaml) | ![test](https://img.shields.io/badge/OFFLINE-PASSING-blue?style=for-the-badge) |
| 5 | | ARMv7 | RV1106 | [![build](https://img.shields.io/github/actions/workflow/status/HyperInspire/InspireFace/release-sdks.yaml?&style=for-the-badge&label=build)](https://github.com/HyperInspire/InspireFace/actions/workflows/release-sdks.yaml) |![test](https://img.shields.io/badge/OFFLINE-PASSING-blue?style=for-the-badge)|
| 6 | | ARMv8 | RK3566/RK3568 | ![build](https://img.shields.io/badge/build-developing-yellow?style=for-the-badge) | |
| 4 | **Linux-Rockchip** | ARMv7 | RV1109/RV1126 | [![build](https://img.shields.io/github/actions/workflow/status/HyperInspire/InspireFace/release-sdks.yaml?&style=for-the-badge&label=build)](https://github.com/HyperInspire/InspireFace/actions/workflows/release-sdks.yaml) | ![test](https://img.shields.io/badge/OFFLINE-PASSING-blue?style=for-the-badge) |
| 5 | | ARMv7 | RV1103/RV1106 | [![build](https://img.shields.io/github/actions/workflow/status/HyperInspire/InspireFace/release-sdks.yaml?&style=for-the-badge&label=build)](https://github.com/HyperInspire/InspireFace/actions/workflows/release-sdks.yaml) |![test](https://img.shields.io/badge/OFFLINE-PASSING-blue?style=for-the-badge)|
| 6 | | ARMv8 | RK3566/RK3568 | [![build](https://img.shields.io/github/actions/workflow/status/HyperInspire/InspireFace/release-sdks.yaml?&style=for-the-badge&label=build)](https://github.com/HyperInspire/InspireFace/actions/workflows/release-sdks.yaml) | ![test](https://img.shields.io/badge/OFFLINE-PASSING-blue?style=for-the-badge) |
| 7 | | ARMv8 | RK3588 | ![build](https://img.shields.io/badge/build-developing-yellow?style=for-the-badge) | |
| 8 | **Linux-CUDA** | x86/x86_64 | NVIDIA-GPU | ![build](https://img.shields.io/badge/OFFLINE-PASSING-green?style=for-the-badge) | ![test](https://img.shields.io/badge/OFFLINE-PASSING-blue?style=for-the-badge) |
| 9 | **MacOS** | Intel | CPU/Metal/**ANE** | [![build](https://img.shields.io/github/actions/workflow/status/HyperInspire/InspireFace/release-sdks.yaml?&style=for-the-badge&label=build)](https://github.com/HyperInspire/InspireFace/actions/workflows/release-sdks.yaml) | ![test](https://img.shields.io/badge/OFFLINE-PASSING-blue?style=for-the-badge) |
Expand Down Expand Up @@ -530,7 +536,8 @@ For different scenarios, we currently provide several Packs, each containing mul
| Pikachu | CPU | Lightweight edge-side models | [Download](https://github.com/HyperInspire/InspireFace/releases/download/v1.x/Pikachu) |
| Megatron | CPU, GPU | Mobile and server models | [Download](https://github.com/HyperInspire/InspireFace/releases/download/v1.x/Megatron) |
| Gundam-RV1109 | RKNPU | Supports RK1109 and RK1126 | [Download](https://github.com/HyperInspire/InspireFace/releases/download/v1.x/Gundam_RV1109) |
| Gundam-RV1106 | RKNPU | Supports RK1106(RV1103 may be supported, but not verified) | [Download](https://github.com/HyperInspire/InspireFace/releases/download/v1.x/Gundam_RV1106) |
| Gundam-RV1106 | RKNPU | Supports RV1103 and RV1106 | [Download](https://github.com/HyperInspire/InspireFace/releases/download/v1.x/Gundam_RV1106) |
| Gundam-RK356X | RKNPU | Supports RK3566 and RK3568 | [Download](https://github.com/HyperInspire/InspireFace/releases/download/v1.x/Gundam_RK356X) |

## Acknowledgement

Expand Down
76 changes: 76 additions & 0 deletions command/build_cross_rk356x_aarch64.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
#!/bin/bash

# Reusable function to handle 'install' directory operations
move_install_files() {
local root_dir="$1"
local install_dir="$root_dir/install"

# Step 1: Check if the 'install' directory exists
if [ ! -d "$install_dir" ]; then
echo "Error: 'install' directory does not exist in $root_dir"
exit 1
fi

# Step 2: Delete all other files/folders except 'install'
find "$root_dir" -mindepth 1 -maxdepth 1 -not -name "install" -exec rm -rf {} +

# Step 3: Move all files from 'install' to the root directory
mv "$install_dir"/* "$root_dir" 2>/dev/null

# Step 4: Remove the empty 'install' directory
rmdir "$install_dir"

echo "Files from 'install' moved to $root_dir, and 'install' directory deleted."
}

if [ -n "$VERSION" ]; then
TAG="-$VERSION"
else
TAG=""
fi


SCRIPT_DIR=$(pwd) # Project dir


echo "MNN_CUSTOM_SOURCE: ${MNN_CUSTOM_SOURCE}"
cd ${SCRIPT_DIR}

# export ARM_CROSS_COMPILE_TOOLCHAIN=/root/arm-rockchip830-linux-uclibcgnueabihf/

BUILD_FOLDER_PATH="build/inspireface-linux-aarch64-rk356x${TAG}"

mkdir -p ${BUILD_FOLDER_PATH}
# shellcheck disable=SC2164
cd ${BUILD_FOLDER_PATH}

# export ARM_CROSS_COMPILE_TOOLCHAIN=/host/software/gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu

cmake -DCMAKE_SYSTEM_NAME=Linux \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_SYSTEM_VERSION=1 \
-DCMAKE_SYSTEM_PROCESSOR=aarch64 \
-DCMAKE_C_COMPILER=$ARM_CROSS_COMPILE_TOOLCHAIN/bin/aarch64-linux-gnu-gcc \
-DCMAKE_CXX_COMPILER=$ARM_CROSS_COMPILE_TOOLCHAIN/bin/aarch64-linux-gnu-g++ \
-DCMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS} -flax-vector-conversions" \
-DTARGET_PLATFORM=armlinux \
-DISF_BUILD_LINUX_AARCH64=ON \
-DISF_BUILD_LINUX_ARM7=OFF \
-DMNN_SEP_BUILD=off \
-DISF_ENABLE_RKNN=ON \
-DISF_RK_DEVICE_TYPE=RK356X \
-DISF_RKNPU_MAJOR=rknpu2 \
-DISF_RK_COMPILER_TYPE=aarch64 \
-DISF_ENABLE_RGA=ON \
-DISF_ENABLE_COST_TIME=OFF \
-DISF_BUILD_WITH_SAMPLE=OFF \
-DISF_BUILD_WITH_TEST=OFF \
-DISF_ENABLE_BENCHMARK=OFF \
-DISF_ENABLE_USE_LFW_DATA=OFF \
-DISF_ENABLE_TEST_EVALUATION=OFF \
-DISF_BUILD_SHARED_LIBS=OFF ${SCRIPT_DIR}

make -j4
make install

move_install_files "$(pwd)"
Loading
Loading