Metadata-Version: 2.5
Name: seetapsych-face-hub
Version: 0.0.3
Summary: Face modules for SeetaPsych
Project-URL: Homepage, https://github.com/seetapsych/seetapsych-face-hub
Project-URL: Repository, https://github.com/seetapsych/seetapsych-face-hub
Project-URL: Issues, https://github.com/seetapsych/seetapsych-face-hub/issues
License: BSD 3-Clause License
        
        Copyright (c) 2026, Visual Information Processing and Learning (VIPL) group,
        Institute of Computing Technology, Chinese Academy of Sciences, Beijing, China;
        Southeast University, China;
        Beijing Seetatech Co., Ltd.
        All rights reserved.
        
        Redistribution and use in source and binary forms, with or without
        modification, are permitted provided that the following conditions are met:
        
        1. Redistributions of source code must retain the above copyright notice, this
           list of conditions and the following disclaimer.
        
        2. Redistributions in binary form must reproduce the above copyright notice,
           this list of conditions and the following disclaimer in the documentation
           and/or other materials provided with the distribution.
        
        3. Neither the name of the copyright holder nor the names of its
           contributors may be used to endorse or promote products derived from
           this software without specific prior written permission.
        
        THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
        AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
        IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
        ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
        LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
        CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
        SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
        INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
        CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
        ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
        POSSIBILITY OF SUCH DAMAGE.
License-File: LICENSE
Requires-Python: >=3.10
Requires-Dist: seetapsych-lib
Provides-Extra: all
Requires-Dist: mediapipe>=0.10.33; extra == 'all'
Requires-Dist: numpy>=2.2.6; extra == 'all'
Requires-Dist: onnx>=1.20.1; extra == 'all'
Requires-Dist: onnxruntime-gpu<1.24; (sys_platform != 'darwin' and python_version <= '3.10') and extra == 'all'
Requires-Dist: onnxruntime-gpu>=1.24; (sys_platform != 'darwin' and python_version > '3.10') and extra == 'all'
Requires-Dist: onnxruntime<1.24; (sys_platform == 'darwin' and python_version <= '3.10') and extra == 'all'
Requires-Dist: onnxruntime>=1.24; (sys_platform == 'darwin' and python_version > '3.10') and extra == 'all'
Requires-Dist: opencv-python>=4.11.0.86; extra == 'all'
Requires-Dist: safetensors>=0.7.0; extra == 'all'
Requires-Dist: scikit-image>=0.25.2; extra == 'all'
Requires-Dist: torch>=2.9.1; extra == 'all'
Requires-Dist: torchvision>=0.24.1; extra == 'all'
Provides-Extra: dev
Requires-Dist: bandit>=1.7; extra == 'dev'
Requires-Dist: build>=1.4.4; extra == 'dev'
Requires-Dist: mediapipe>=0.10.33; extra == 'dev'
Requires-Dist: mypy>=1.11; extra == 'dev'
Requires-Dist: numpy>=2.2.6; extra == 'dev'
Requires-Dist: onnx>=1.20.1; extra == 'dev'
Requires-Dist: onnxruntime-gpu<1.24; (sys_platform != 'darwin' and python_version <= '3.10') and extra == 'dev'
Requires-Dist: onnxruntime-gpu>=1.24; (sys_platform != 'darwin' and python_version > '3.10') and extra == 'dev'
Requires-Dist: onnxruntime<1.24; (sys_platform == 'darwin' and python_version <= '3.10') and extra == 'dev'
Requires-Dist: onnxruntime>=1.24; (sys_platform == 'darwin' and python_version > '3.10') and extra == 'dev'
Requires-Dist: opencv-python>=4.11.0.86; extra == 'dev'
Requires-Dist: pytest>=8.0; extra == 'dev'
Requires-Dist: ruff>=0.6; extra == 'dev'
Requires-Dist: safetensors>=0.7.0; extra == 'dev'
Requires-Dist: scikit-image>=0.25.2; extra == 'dev'
Requires-Dist: torch>=2.9.1; extra == 'dev'
Requires-Dist: torchvision>=0.24.1; extra == 'dev'
Requires-Dist: twine>=6.2.0; extra == 'dev'
Description-Content-Type: text/markdown

# SeetaPsych Face Hub

> Community open-source face modules for SeetaPsych

## Usage

This project is already included in the seetapsych-lib default configuration. Download and use it via `seetapsych-manager download`.

For usage, refer to [SeetaPsych](https://github.com/seetapsych/seetapsych-lib).

You can additionally add this algorithm module using the following methods.

### WebUI

Run `seetapsych-webui` with the `--dirs` argument to use it.

```
seetapsych-webui --files seetapsych_face_hub/modules/insightface/retinaface.yml
```

### Programmatic Usage

Add the following code in your program to use this algorithm module.
```python
from seetapsych_lib.runtime.factory import Factory
from seetapsych_lib.runtime.pipeline import Pipeline

factory = Factory()
factory.load_file_modules("seetapsych_face_hub/modules/insightface/retinaface.yml")

pipeline = Pipeline(factory, ...)

pipeline.add_attributes("face/detection")
```

### Module Catalog

| Module YML | Packages |
|---|---|
| [insightface/retinaface.yml](seetapsych_face_hub/modules/insightface/retinaface.yml) | FaceDetection-RetinaFace(InsightFace) |
| [insightface/arcface.yml](seetapsych_face_hub/modules/insightface/arcface.yml) | FaceFeature-ArcFace(InsightFace) |
| [mediapipe.yml](seetapsych_face_hub/modules/mediapipe.yml) | FaceDetection-MediaPipe, FaceMesh-MediaPipe |
| [retinaface.yml](seetapsych_face_hub/modules/retinaface.yml) | FaceDetection-RetinaFace(PyTorch) |

### InsightFace (RetinaFace)

> InsightFace Buffalo RetinaFace detector: face bounding box + 5-point landmark detection with 500M / 2.5G / 10G FLOPs model variants.

Module config: [insightface/retinaface.yml](seetapsych_face_hub/modules/insightface/retinaface.yml)

| Package Name | Provides Attributes | Requires Attributes |
|---|---|---|
| FaceDetection-RetinaFace(InsightFace) | `face/detection`, `face/landmarks` | *(none)* |

**Description**: InsightFace RetinaFace detecting face boxes + 5-point landmarks with configurable input size; 3 accuracy/speed model tiers

**Parameters**

| Name | Type | Default | Description & Tuning |
|---|---|---|---|
| input_size | number[] | [640, 640] | Network input [width, height] in pixels. Larger sizes improve small-face recall but slow inference. Square inputs are recommended. |

**Models**

| Name | Recommended | Notes |
|---|---|---|
| det_500m.onnx | ✓ | |
| det_2.5g.onnx | | |
| det_10g.onnx | | |

### InsightFace (ArcFace)

> InsightFace Buffalo face feature extraction via ArcFace models producing L2-normalized 512-dim embeddings.

Module config: [insightface/arcface.yml](seetapsych_face_hub/modules/insightface/arcface.yml)

| Package Name | Provides Attributes | Requires Attributes |
|---|---|---|
| FaceFeature-ArcFace(InsightFace) | `face/feature` | `face/landmarks` |

**Description**: Extract L2-normalized 512-dim face embeddings for recognition, clustering, or similarity search from 5-point aligned faces

**Parameters**: *(none)*

**Models**

| Name | Recommended | Notes |
|---|---|---|
| w600k_r50.onnx | ✓ | |
| w600k_mbf.onnx | | |

### MediaPipe

> MediaPipe Tasks face detection and 468-point 3D face mesh landmarking via BlazeFace short/full-range models.

Module config: [mediapipe.yml](seetapsych_face_hub/modules/mediapipe.yml)

| Package Name | Provides Attributes | Requires Attributes |
|---|---|---|
| FaceDetection-MediaPipe | `face/detection` | *(none)* |
| FaceMesh-MediaPipe | `face/mesh` | `face/detection` |

#### Package: FaceDetection-MediaPipe

**Description**: Face bounding box detection via MediaPipe BlazeFace detector with short/full-range/sparse model variants

**Parameters**

| Name | Type | Default | Description & Tuning |
|---|---|---|---|
| running_mode | selection (IMAGE, VIDEO, LIVE_STREAM) | IMAGE | Task execution mode. IMAGE for single static frames; VIDEO/LIVE_STREAM for time-series smoothing across frames. |
| min_detection_confidence | number | 0.5 | Minimum confidence score for a detection box to be returned. Lower values catch more faces at the cost of false positives. |
| min_suppression_threshold | number | 0.3 | IoU threshold for non-maximum suppression. Higher values keep more overlapping boxes; lower values prune aggressively. |

**Models**

| Name | Recommended | Notes |
|---|---|---|
| blaze_face_full_range.tflite | ✓ | |
| blaze_face_full_range_sparse.tflite | | |
| blaze_face_short_range.tflite | | |

#### Package: FaceMesh-MediaPipe

**Description**: 468-point normalized 3D face mesh landmark extraction from detected face boxes with optional blendshapes and pose matrices

**Parameters**

| Name | Type | Default | Description & Tuning |
|---|---|---|---|
| running_mode | selection (IMAGE, VIDEO, LIVE_STREAM) | IMAGE | Task execution mode. VIDEO/LIVE_STREAM enable temporal landmark smoothing when num_faces = 1. |
| num_faces | integer | 1 | Maximum number of faces to landmark simultaneously. Smoothing is only active when num_faces is 1. |
| min_face_detection_confidence | number | 0.5 | Minimum confidence for the built-in face detector to succeed when initializing landmark placement. |
| min_face_presence_confidence | number | 0.5 | Minimum confidence that a face is present in the frame before landmark output; filters intermittent dropouts in video. |
| min_tracking_confidence | number | 0.5 | Minimum tracking confidence to reuse the last known face position vs. re-running full detection. Higher values reduce drift but trigger re-detection more often. |
| output_face_blendshapes | boolean | false | Whether to output 52 face blendshape coefficients for 3D avatar/AR rendering. Adds minor compute overhead. |
| output_facial_transformation_matrixes | boolean | false | Whether to output 4x4 facial pose transformation matrices for rigid head pose estimation. |

**Models**

| Name | Recommended | Notes |
|---|---|---|
| face_landmarker.task | ✓ | |

## References

- [MediaPipe](https://ai.google.dev/edge/mediapipe/solutions/guide)
- [InsightFace](https://github.com/deepinsight/insightface)
- [Pytorch_Retinaface](https://github.com/biubug6/Pytorch_Retinaface)
