Files
uniface/scripts
yakhyo 2c78f39e5d ref: Add comprehensive test suite and enhance model functionality
- Add new test files for age_gender, factory, landmark, recognition, scrfd, and utils
- Add new scripts for age_gender, landmarks, and video detection
- Update documentation in README.md, MODELS.md, QUICKSTART.md
- Improve model constants and face utilities
- Update detection models (retinaface, scrfd) with enhanced functionality
- Update project configuration in pyproject.toml
2025-11-15 21:09:37 +09:00
..
2025-11-07 23:58:47 +09:00

Scripts

Collection of example scripts demonstrating UniFace functionality.

Available Scripts

  • run_detection.py - Face detection on images
  • run_age_gender.py - Age and gender prediction
  • run_landmarks.py - Facial landmark detection
  • run_recognition.py - Face recognition and embeddings
  • run_face_search.py - Face search and matching
  • run_video_detection.py - Video processing with face detection
  • batch_process.py - Batch processing of image folders
  • download_model.py - Download and manage models

Quick Start

# Face detection
python scripts/run_detection.py --image assets/test.jpg

# Age and gender detection
python scripts/run_age_gender.py --image assets/test.jpg

# Webcam demo
python scripts/run_age_gender.py --webcam

# Batch processing
python scripts/batch_process.py --input images/ --output results/

Import Examples

The scripts use direct class imports for better developer experience:

# Face Detection
from uniface.detection import RetinaFace, SCRFD

detector = RetinaFace()  # or SCRFD()
faces = detector.detect(image)

# Face Recognition
from uniface.recognition import ArcFace, MobileFace, SphereFace

recognizer = ArcFace()  # or MobileFace(), SphereFace()
embedding = recognizer.get_embedding(image, landmarks)

# Age & Gender
from uniface.attribute import AgeGender

age_gender = AgeGender()
gender, age = age_gender.predict(image, bbox)

# Landmarks
from uniface.landmark import Landmark106

landmarker = Landmark106()
landmarks = landmarker.get_landmarks(image, bbox)

Available Classes

Detection:

  • RetinaFace - High accuracy face detection
  • SCRFD - Fast face detection

Recognition:

  • ArcFace - High accuracy face recognition
  • MobileFace - Lightweight face recognition
  • SphereFace - Alternative face recognition

Attributes:

  • AgeGender - Age and gender prediction

Landmarks:

  • Landmark106 - 106-point facial landmarks

Common Options

Most scripts support:

  • --help - Show usage information
  • --verbose - Enable detailed logging
  • --detector - Choose detector (retinaface, scrfd)
  • --threshold - Set confidence threshold

Testing

Run basic functionality test:

python scripts/run_detection.py --image assets/test.jpg

For comprehensive testing, see the main project tests:

pytest tests/