mirror of
https://github.com/yakhyo/uniface.git
synced 2025-12-30 09:02:25 +00:00
* feat: Update linting and type annotations, return types in detect * feat: add face analyzer and face classes * chore: Update the format and clean up some docstrings * docs: Update usage documentation * feat: Change AgeGender model output to 0, 1 instead of string (Female, Male) * test: Update testing code * feat: Add Apple silicon backend for torchscript inference * feat: Add face analyzer example and add run emotion for testing
29 lines
796 B
Python
29 lines
796 B
Python
# Copyright 2025 Yakhyokhuja Valikhujaev
|
|
# Author: Yakhyokhuja Valikhujaev
|
|
# GitHub: https://github.com/yakhyo
|
|
|
|
from .base import BaseLandmarker
|
|
from .models import Landmark106
|
|
|
|
|
|
def create_landmarker(method: str = '2d106det', **kwargs) -> BaseLandmarker:
|
|
"""
|
|
Factory function to create facial landmark predictors.
|
|
|
|
Args:
|
|
method (str): Landmark prediction method. Options: '106'.
|
|
**kwargs: Model-specific parameters.
|
|
|
|
Returns:
|
|
Initialized landmarker instance.
|
|
"""
|
|
method = method.lower()
|
|
if method == '2d106det':
|
|
return Landmark106(**kwargs)
|
|
else:
|
|
available = ['2d106det']
|
|
raise ValueError(f"Unsupported method: '{method}'. Available: {available}")
|
|
|
|
|
|
__all__ = ['create_landmarker', 'Landmark106', 'BaseLandmarker']
|