mirror of
https://github.com/yakhyo/uniface.git
synced 2025-12-30 09:02:25 +00:00
- 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
Scripts
Collection of example scripts demonstrating UniFace functionality.
Available Scripts
run_detection.py- Face detection on imagesrun_age_gender.py- Age and gender predictionrun_landmarks.py- Facial landmark detectionrun_recognition.py- Face recognition and embeddingsrun_face_search.py- Face search and matchingrun_video_detection.py- Video processing with face detectionbatch_process.py- Batch processing of image foldersdownload_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 detectionSCRFD- Fast face detection
Recognition:
ArcFace- High accuracy face recognitionMobileFace- Lightweight face recognitionSphereFace- 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/