# -*- coding: utf-8 -*- # 修复 uniface 内部导入路径 import sys import os # 获取当前文件所在目录(digitalHuman/uniface) _current_dir = os.path.dirname(os.path.abspath(__file__)) # 获取 digitalHuman 目录 _digital_human_dir = os.path.dirname(_current_dir) # 将 digitalHuman 目录添加到 sys.path,这样 uniface 内部的导入可以正常工作 # 因为 uniface 内部使用 from uniface.xxx,需要让 uniface 作为顶级包 if _digital_human_dir not in sys.path: sys.path.insert(0, _digital_human_dir) # 现在导入 uniface 的公共接口(使用相对导入以避免路径问题) from .face_utils import compute_similarity, face_alignment from .log import Logger, enable_logging from .model_store import verify_model_weights from .visualization import draw_detections from .analyzer import FaceAnalyzer from .attribute import AgeGender from .face import Face try: from .attribute import Emotion except ImportError: Emotion = None # PyTorch not installed from .detection import ( SCRFD, RetinaFace, create_detector, detect_faces, list_available_detectors, ) from .landmark import Landmark106, create_landmarker from .recognition import ArcFace, MobileFace, SphereFace, create_recognizer __all__ = [ '__author__', '__license__', '__version__', # Core classes 'Face', 'FaceAnalyzer', # Factory functions 'create_detector', 'create_landmarker', 'create_recognizer', 'detect_faces', 'list_available_detectors', # Detection models 'RetinaFace', 'SCRFD', # Recognition models 'ArcFace', 'MobileFace', 'SphereFace', # Landmark models 'Landmark106', # Attribute models 'AgeGender', 'Emotion', # Utilities 'compute_similarity', 'draw_detections', 'face_alignment', 'verify_model_weights', 'Logger', 'enable_logging', ]