feat: add debug mode, distance-based thresholds, and improve pose detection
- Add debug mode support for encoding statistics in API responses - Debug info includes encoding length, min/max/mean/std, and first 10 values - Frontend logs encoding stats to browser console when debug enabled - Identify page enables debug mode by default - Implement distance-based confidence thresholds for stricter matching - Borderline distances require higher confidence (70-95% vs 50%) - Applied when use_distance_based_thresholds=True (auto-match) - Reduces false positives for borderline matches - Dual tolerance system for auto-match - Default tolerance 0.6 for regular browsing (more lenient) - Run auto-match button uses 0.5 tolerance with distance-based thresholds (stricter) - Auto-accept threshold updated to 85% (from 70%) - Enhance pose detection with single-eye detection - Profile threshold reduced from 30° to 15° (stricter) - Detect single-eye visibility for extreme profile views - Infer profile direction from landmark visibility - Improved face width threshold (20px vs 10px) - Clean up debug code - Remove test photo UUID checks from production code - Remove debug print statements - Replace print statements with proper logging
This commit is contained in:
@@ -89,6 +89,7 @@ class SimilarFaceItem(BaseModel):
|
||||
quality_score: float
|
||||
filename: str
|
||||
pose_mode: Optional[str] = Field("frontal", description="Pose classification (frontal, profile_left, etc.)")
|
||||
debug_info: Optional[dict] = Field(None, description="Debug information (encoding stats) when debug mode is enabled")
|
||||
|
||||
|
||||
class SimilarFacesResponse(BaseModel):
|
||||
@@ -98,6 +99,7 @@ class SimilarFacesResponse(BaseModel):
|
||||
|
||||
base_face_id: int
|
||||
items: list[SimilarFaceItem]
|
||||
debug_info: Optional[dict] = Field(None, description="Debug information (base face encoding stats) when debug mode is enabled")
|
||||
|
||||
|
||||
class BatchSimilarityRequest(BaseModel):
|
||||
@@ -215,6 +217,7 @@ class AutoMatchRequest(BaseModel):
|
||||
tolerance: float = Field(0.5, ge=0.0, le=1.0, description="Tolerance threshold (lower = stricter matching)")
|
||||
auto_accept: bool = Field(False, description="Enable automatic acceptance of matching faces")
|
||||
auto_accept_threshold: float = Field(70.0, ge=0.0, le=100.0, description="Similarity threshold for auto-acceptance (0-100%)")
|
||||
use_distance_based_thresholds: bool = Field(False, description="Use distance-based confidence thresholds (stricter for borderline distances)")
|
||||
|
||||
|
||||
class AutoMatchFaceItem(BaseModel):
|
||||
|
||||
Reference in New Issue
Block a user