Download faces/constants.py from Atomio/facerecog: direct link, hf CLI and curl.
- Browser
- Download file 1.97 kB
-
https://huggingface.co/spaces/Atomio/facerecog/resolve/main/faces/constants.py
- Command line
-
hf download hf://spaces/Atomio/facerecog/faces/constants.py
-
curl -L -o constants.py https://huggingface.co/spaces/Atomio/facerecog/resolve/main/faces/constants.py
1.97 kB
| """Face recognition domain constants.""" | |
| from enum import Enum | |
| class FaceDetectionBackend(str, Enum): | |
| """Supported face detection backends.""" | |
| MTCNN = "mtcnn" | |
| OPENCV = "opencv" | |
| SSD = "ssd" | |
| DLIB = "dlib" | |
| RETINAFACE = "retinaface" | |
| class FaceRecognitionModel(str, Enum): | |
| """Supported face recognition models.""" | |
| FACENET = "Facenet" | |
| ARCFACE = "ArcFace" | |
| OPENFACE = "OpenFace" | |
| DEEPFACE = "DeepFace" | |
| DEEPID = "DeepID" | |
| DLIB = "Dlib" | |
| class SimilarityMetric(str, Enum): | |
| """Supported similarity metrics.""" | |
| COSINE = "cosine" | |
| EUCLIDEAN = "euclidean" | |
| EUCLIDEAN_L2 = "euclidean_l2" | |
| class ImageFormat(str, Enum): | |
| """Supported image formats.""" | |
| JPEG = "jpeg" | |
| JPG = "jpg" | |
| PNG = "png" | |
| BMP = "bmp" | |
| TIFF = "tiff" | |
| class VideoFormat(str, Enum): | |
| """Supported video formats.""" | |
| MP4 = "mp4" | |
| AVI = "avi" | |
| MOV = "mov" | |
| MKV = "mkv" | |
| # Error codes for consistent error handling | |
| class ErrorCode(str, Enum): | |
| """Error codes for face recognition operations.""" | |
| FACE_NOT_DETECTED = "FACE_NOT_DETECTED" | |
| MULTIPLE_FACES_DETECTED = "MULTIPLE_FACES_DETECTED" | |
| INVALID_IMAGE_FORMAT = "INVALID_IMAGE_FORMAT" | |
| INVALID_VIDEO_FORMAT = "INVALID_VIDEO_FORMAT" | |
| FILE_TOO_LARGE = "FILE_TOO_LARGE" | |
| FACE_PROCESSING_ERROR = "FACE_PROCESSING_ERROR" | |
| USER_NOT_FOUND = "USER_NOT_FOUND" | |
| FACE_NOT_FOUND = "FACE_NOT_FOUND" | |
| NO_MATCH_FOUND = "NO_MATCH_FOUND" | |
| EMBEDDING_EXTRACTION_FAILED = "EMBEDDING_EXTRACTION_FAILED" | |
| DATABASE_ERROR = "DATABASE_ERROR" | |
| # Default values | |
| DEFAULT_SIMILARITY_THRESHOLD = 0.6 | |
| DEFAULT_MAX_FACES_TO_RETURN = 5 | |
| DEFAULT_VIDEO_FRAME_INTERVAL = 0.5 # seconds | |
| DEFAULT_EMBEDDING_DIMENSION = 512 | |
| # File size limits (in bytes) | |
| MAX_IMAGE_SIZE = 10 * 1024 * 1024 # 10 MB | |
| MAX_VIDEO_SIZE = 100 * 1024 * 1024 # 100 MB | |
| # Processing limits | |
| MAX_VIDEO_DURATION = 300 # 5 minutes in seconds | |
| MAX_FRAMES_TO_PROCESS = 1000 | |