mirror of
https://github.com/deepinsight/insightface.git
synced 2026-07-24 16:17:50 +00:00
Update InspireFace to 1.1.2
This commit is contained in:
@@ -6,7 +6,7 @@ option(ISF_BUILD_SAMPLE_CLUTTERED "Whether to compile the cluttered sample progr
|
||||
include_directories(${SRC_DIR})
|
||||
|
||||
if (ISF_ENABLE_RKNN)
|
||||
set(ISF_RKNN_API_LIB ${ISF_THIRD_PARTY_DIR}/${ISF_RKNPU_MAJOR}/runtime/${ISF_RK_DEVICE_TYPE}/Linux/librknn_api/${CPU_ARCH}/)
|
||||
set(ISF_RKNN_API_LIB ${ISF_THIRD_PARTY_DIR}/inspireface-precompile/rknn/${ISF_RKNPU_MAJOR}/runtime/${ISF_RK_DEVICE_TYPE}/Linux/librknn_api/${CPU_ARCH}/)
|
||||
link_directories(${ISF_RKNN_API_LIB})
|
||||
set(ext rknn_api dl)
|
||||
endif ()
|
||||
@@ -38,12 +38,16 @@ set_target_properties(MTFaceTrackSample PROPERTIES
|
||||
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/sample/"
|
||||
)
|
||||
|
||||
# Examples of face detection and tracking
|
||||
add_executable(FaceTrackVideoSample cpp/sample_face_track_video.cpp)
|
||||
target_link_libraries(FaceTrackVideoSample InspireFace ${ext})
|
||||
set_target_properties(FaceTrackVideoSample PROPERTIES
|
||||
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/sample/"
|
||||
)
|
||||
if(NOT DISABLE_GUI)
|
||||
# Examples of face detection and tracking
|
||||
add_executable(FaceTrackVideoSample cpp/sample_face_track_video.cpp)
|
||||
target_link_libraries(FaceTrackVideoSample InspireFace ${ext})
|
||||
set_target_properties(FaceTrackVideoSample PROPERTIES
|
||||
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/sample/"
|
||||
)
|
||||
endif()
|
||||
|
||||
|
||||
|
||||
# Examples of face recognition
|
||||
add_executable(FaceRecognitionSample cpp/sample_face_recognition.cpp)
|
||||
|
||||
@@ -4,7 +4,9 @@
|
||||
#include <cstddef>
|
||||
#include <iostream>
|
||||
#include <opencv2/core/types.hpp>
|
||||
#ifndef DISABLE_GUI
|
||||
#include <opencv2/highgui.hpp>
|
||||
#endif
|
||||
#include <opencv2/imgproc.hpp>
|
||||
#include <vector>
|
||||
#include "data_type.h"
|
||||
@@ -38,10 +40,10 @@ int main() {
|
||||
auto &item = results[i];
|
||||
cv::rectangle(img, cv::Point2f(item.x1, item.y1), cv::Point2f(item.x2, item.y2), cv::Scalar(0, 0, 255), 4);
|
||||
}
|
||||
|
||||
#ifndef DISABLE_GUI
|
||||
cv::imshow("w", img);
|
||||
cv::waitKey(0);
|
||||
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -31,9 +31,9 @@ int main(int argc, char* argv[]) {
|
||||
// Non-video or frame sequence mode uses IMAGE-MODE, which is always face detection without tracking
|
||||
HFDetectMode detMode = HF_DETECT_MODE_ALWAYS_DETECT;
|
||||
// Maximum number of faces detected
|
||||
HInt32 maxDetectNum = 5;
|
||||
HInt32 maxDetectNum = 20;
|
||||
// Face detection image input level
|
||||
HInt32 detectPixelLevel = 640;
|
||||
HInt32 detectPixelLevel = 160;
|
||||
// Handle of the current face SDK algorithm context
|
||||
HFSession session = {0};
|
||||
ret = HFCreateInspireFaceSessionOptional(option, detMode, maxDetectNum, detectPixelLevel, -1, &session);
|
||||
@@ -42,7 +42,7 @@ int main(int argc, char* argv[]) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
HFSessionSetTrackPreviewSize(session, 640);
|
||||
HFSessionSetTrackPreviewSize(session, detectPixelLevel);
|
||||
HFSessionSetFilterMinimumFacePixelSize(session, 32);
|
||||
|
||||
// Load a image
|
||||
|
||||
@@ -29,12 +29,12 @@ int main(int argc, char* argv[]) {
|
||||
// Enable the functions in the pipeline: mask detection, live detection, and face quality detection
|
||||
HOption option = HF_ENABLE_QUALITY | HF_ENABLE_MASK_DETECT | HF_ENABLE_LIVENESS;
|
||||
// Non-video or frame sequence mode uses IMAGE-MODE, which is always face detection without tracking
|
||||
HFDetectMode detMode = HF_DETECT_MODE_LIGHT_TRACK;
|
||||
HFDetectMode detMode = HF_DETECT_MODE_ALWAYS_DETECT;
|
||||
// Maximum number of faces detected
|
||||
HInt32 maxDetectNum = 50;
|
||||
// Handle of the current face SDK algorithm context
|
||||
HFSession session = {0};
|
||||
ret = HFCreateInspireFaceSessionOptional(option, detMode, maxDetectNum, -1, -1, &session);
|
||||
ret = HFCreateInspireFaceSessionOptional(option, detMode, maxDetectNum, 160, -1, &session);
|
||||
if (ret != HSUCCEED) {
|
||||
std::cout << "Create FaceContext error: " << ret << std::endl;
|
||||
return ret;
|
||||
|
||||
@@ -48,9 +48,9 @@ int main(int argc, char* argv[]) {
|
||||
// Video or frame sequence mode uses VIDEO-MODE, which is face detection with tracking
|
||||
HFDetectMode detMode = HF_DETECT_MODE_TRACK_BY_DETECTION;
|
||||
// Maximum number of faces detected
|
||||
HInt32 maxDetectNum = 5;
|
||||
HInt32 maxDetectNum = 20;
|
||||
// Face detection image input level
|
||||
HInt32 detectPixelLevel = 640;
|
||||
HInt32 detectPixelLevel = 320;
|
||||
// fps in tracking-by-detection mode
|
||||
HInt32 trackByDetectFps = 20;
|
||||
HFSession session = {0};
|
||||
@@ -61,8 +61,8 @@ int main(int argc, char* argv[]) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
HFSessionSetTrackPreviewSize(session, 640);
|
||||
HFSessionSetFilterMinimumFacePixelSize(session, 32);
|
||||
HFSessionSetTrackPreviewSize(session, detectPixelLevel);
|
||||
HFSessionSetFilterMinimumFacePixelSize(session, 0);
|
||||
|
||||
// Open the video file
|
||||
cv::VideoCapture cap(videoPath);
|
||||
|
||||
Reference in New Issue
Block a user