Skip to content

Commit

Permalink
Merge pull request #144 from HyperInspire/dev/patch-5
Browse files Browse the repository at this point in the history
Dev/patch 5
  • Loading branch information
tunmx authored Jan 13, 2025
2 parents b072f92 + 40c7772 commit 1144d9b
Show file tree
Hide file tree
Showing 14 changed files with 774 additions and 15 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build_wheels.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: Build Wheels

on:
push:
branches: ["dev/patch-4"]
branches: ["release/wheels"]
pull_request:
branches: ["dev/patch-4"]
branches: ["release/wheels"]

env:
GITHUB_TOKEN: ${{ secrets.MY_GITHUB_TOKEN }}
Expand Down
1 change: 0 additions & 1 deletion command/build_cross_rk356x_aarch64.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ 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/
Expand Down
6 changes: 3 additions & 3 deletions command/build_cross_rv1106_armhf_uclibc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,9 @@ cmake -DCMAKE_SYSTEM_NAME=Linux \
-DISF_ENABLE_BENCHMARK=OFF \
-DISF_ENABLE_USE_LFW_DATA=OFF \
-DISF_ENABLE_TEST_EVALUATION=OFF \
-DISF_BUILD_SHARED_LIBS=ON ${SCRIPT_DIR}
-DISF_BUILD_SHARED_LIBS=OFF ${SCRIPT_DIR}

make -j4
make install
# make install

move_install_files "$(pwd)"
# move_install_files "$(pwd)"
1 change: 1 addition & 0 deletions cpp/inspireface/c_api/inspireface.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1008,6 +1008,7 @@ HResult HFSetLogLevel(HFLogLevel level) {

HResult HFLogDisable() {
INSPIRE_SET_LOG_LEVEL(inspire::ISF_LOG_NONE);

return HSUCCEED;
}

Expand Down
4 changes: 4 additions & 0 deletions cpp/inspireface/pipeline_module/face_pipeline_module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,11 @@ int32_t FacePipelineModule::InitMaskPredict(InspireModel &model) {

int32_t FacePipelineModule::InitRBGAntiSpoofing(InspireModel &model) {
auto input_size = model.Config().get<std::vector<int>>("input_size");
#ifdef INFERENCE_HELPER_ENABLE_RKNN2
m_rgb_anti_spoofing_ = std::make_shared<RBGAntiSpoofingAdapt>(input_size[0], true);
#else
m_rgb_anti_spoofing_ = std::make_shared<RBGAntiSpoofingAdapt>(input_size[0]);
#endif
auto ret = m_rgb_anti_spoofing_->loadData(model, model.modelType);
if (ret != InferenceHelper::kRetOk) {
return HERR_ARCHIVE_LOAD_FAILURE;
Expand Down
6 changes: 6 additions & 0 deletions cpp/sample/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,12 @@ if(ISF_RK_DEVICE_TYPE STREQUAL "RV1106")
set_target_properties(FaceTrackSampleRV1106 PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/sample/"
)

add_executable(FaceAttributeSampleRV1106 rv1106/face_attribute.cpp)
target_link_libraries(FaceAttributeSampleRV1106 InspireFace ${ext})
set_target_properties(FaceAttributeSampleRV1106 PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/sample/"
)
endif()

add_executable(NexusImageSample rv1106/rga_image.cpp)
Expand Down
30 changes: 30 additions & 0 deletions cpp/sample/rv1106/face_attribute.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#include <inspirecv/inspirecv.h>
#include <inspireface/pipeline_module/attribute/face_attribute_adapt.h>
#include "inspireface/initialization_module/launch.h"
#include <inspireface/middleware/inspirecv_image_process.h>
#include <inspirecv/time_spend.h>
#include <log.h>

using namespace inspire;

int main() {
INSPIRE_SET_LOG_LEVEL(ISF_LOG_DEBUG);
std::string expansion_path = "";
INSPIRE_LAUNCH->Load("test_res/pack/Gundam_RV1106");
auto archive = INSPIRE_LAUNCH->getMArchive();
InspireModel detModel;
auto ret = archive.LoadModel("face_attribute", detModel);
if (ret != SARC_SUCCESS) {
INSPIRE_LOGE("Load %s error: %d", "face_detect_160", ret);
return HERR_ARCHIVE_LOAD_MODEL_FAILURE;
}

FaceAttributePredictAdapt face_attribute;
face_attribute.loadData(detModel, detModel.modelType, false);

auto img = inspirecv::Image::Create("test_res/data/crop/crop.png");
auto result = face_attribute(img);
std::cout << "result: " << result[0] << ", " << result[1] << ", " << result[2] << std::endl;

return 0;
}
3 changes: 2 additions & 1 deletion cpp/sample/rv1106/face_detect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
using namespace inspire;

int main() {
INSPIRE_SET_LOG_LEVEL(ISF_LOG_DEBUG);
std::string expansion_path = "";
INSPIRE_LAUNCH->Load("Gundam_RV1106");
INSPIRE_LAUNCH->Load("test_res/pack/Gundam_RV1106");
auto archive = INSPIRE_LAUNCH->getMArchive();
InspireModel detModel;
auto ret = archive.LoadModel("face_detect_160", detModel);
Expand Down
21 changes: 18 additions & 3 deletions cpp/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,26 @@ if (ISF_ENABLE_TEST_EVALUATION)
endif ()

if (ISF_ENABLE_RKNN)
if (ISF_RKNPU_MAJOR STREQUAL "rknpu1")
set(DEPEND rknn_api dl)
set(ISF_RKNN_API_LIB ${ISF_THIRD_PARTY_DIR}/inspireface-precompile-lite/rknn/${ISF_RKNPU_MAJOR}/runtime/${ISF_RK_DEVICE_TYPE}/Linux/librknn_api/${CPU_ARCH}/)
message("Enable RKNN Inference")
link_directories(${ISF_RKNN_API_LIB})
set(DEPEND rknn_api dl)
message("Enable RKNN Inference")
link_directories(${ISF_RKNN_API_LIB})
set(DEPEND rknn_api dl)
elseif(ISF_RKNPU_MAJOR STREQUAL "rknpu2" AND ISF_RK_COMPILER_TYPE STREQUAL "aarch64")
set(DEPEND rknnrt dl)
if(ANDROID)
set(RK_PLATFORM "Android")
else()
set(RK_PLATFORM "Linux")
endif()
set(ISF_RKNN_API_LIB ${ISF_THIRD_PARTY_DIR}/inspireface-precompile-lite/rknn/${ISF_RKNPU_MAJOR}/runtime/${RK_PLATFORM}/librknn_api/${ISF_RK_COMPILER_TYPE}/)
message("ISF_RKNN_API_LIB: ${ISF_RKNN_API_LIB}")
link_directories(${ISF_RKNN_API_LIB})
set(DEPEND rknnrt dl)
else()
set(DEPEND dl)
endif()
endif ()

include_directories(${SRC_DIR})
Expand Down
Loading

0 comments on commit 1144d9b

Please sign in to comment.