This commit is contained in:
tunm
2025-05-22 16:07:26 +08:00
parent efb5639ec6
commit 7e25e4e482
168 changed files with 6434 additions and 2527 deletions

View File

@@ -4,7 +4,7 @@ import click
import cv2
import inspireface as isf
import numpy as np
import time
def generate_color(id):
"""
@@ -50,8 +50,13 @@ def case_face_tracker_from_video(source, show, out):
"""
# Optional features, loaded during session creation based on the modules specified.
opt = isf.HF_ENABLE_NONE | isf.HF_ENABLE_INTERACTION
session = isf.InspireFaceSession(opt, isf.HF_DETECT_MODE_LIGHT_TRACK, max_detect_num=25, detect_pixel_level=320) # Use video mode
session = isf.InspireFaceSession(opt, isf.HF_DETECT_MODE_LIGHT_TRACK, max_detect_num=25, detect_pixel_level=160) # Use video mode
session.set_track_mode_smooth_ratio(0.06)
session.set_track_mode_num_smooth_cache_frame(15)
session.set_filter_minimum_face_pixel_size(0)
session.set_track_model_detect_interval(0)
session.set_landmark_augmentation_num(1)
session.set_enable_track_cost_spend(True)
# Determine if the source is a digital webcam index or a video file path.
try:
source_index = int(source) # Try to convert source to an integer.
@@ -82,8 +87,11 @@ def case_face_tracker_from_video(source, show, out):
break # Exit loop if no more frames or error occurs.
# Process frame here (e.g., face detection/tracking).
t1 = time.time()
faces = session.face_detection(frame)
t2 = time.time()
# print(f"Face detection time: {t2 - t1} seconds")
session.print_track_cost_spend()
exts = session.face_pipeline(frame, faces, isf.HF_ENABLE_INTERACTION)
for idx, face in enumerate(faces):