You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

54 lines
1.2 KiB

from dataclasses import dataclass
from datetime import datetime
from typing import List, Optional, Tuple
import numpy as np
from enum import Enum
from pydantic import BaseModel
class OperationType(str, Enum):
REGISTER = "register"
VERIFICATION = "verify"
IDENTIFICATION = "identify"
@dataclass
class Face:
id: str
user_id: str
image_path: str
embedding: np.ndarray
created_at: datetime
quality_score: float
bbox: List[float]
landmarks: Optional[List[List[float]]] = None
@dataclass
class User:
id: str
name: str
created_at: datetime
face_ids: List[str]
mean_embedding: Optional[np.ndarray] = None
@dataclass
class VerificationResult:
is_verified: bool
confidence: float
user_id: str
face_id: str
threshold: float
processing_time: float
@dataclass
class IdentificationResult:
is_identified: bool
user_id: Optional[str]
confidence: float
candidates: List[Tuple[str, float]]
threshold: float
processing_time: float
class ProcessedFace(BaseModel):
bbox: List[float] # [x1, y1, x2, y2]
landmarks: List[List[float]] # [[x1, y1], [x2, y2], ...]
quality_score: float
embedding: List[float]