Modified files:
backend/config.py - Added MIN_AUTO_MATCH_FACE_SIZE_RATIO = 0.005 backend/services/face_service.py - Multiple changes: Added load_face_encoding() function (supports float32 and float64) Added _calculate_face_size_ratio() function Updated find_similar_faces() to filter small faces Updated find_auto_match_matches() to exclude small reference faces Fixed reference face quality calculation (use actual quality, not hardcoded 0.5) Fixed duplicate detection (exclude faces from same photo) Updated confidence threshold from 40% to 50% Updated confidence calibration (moderate version) backend/api/faces.py - Updated default tolerance to 0.5 for auto-match endpoints backend/schemas/faces.py - Updated default tolerance to 0.5 admin-frontend/src/pages/AutoMatch.tsx - Updated default tolerance to 0.5 admin-frontend/src/api/faces.ts - Added tolerance parameter support
This commit is contained in:
@@ -211,7 +211,8 @@ def get_similar_faces(
|
||||
raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail=f"Face {face_id} not found")
|
||||
|
||||
logger.info(f"API: Calling find_similar_faces for face_id={face_id}, include_excluded={include_excluded}")
|
||||
results = find_similar_faces(db, face_id, include_excluded=include_excluded)
|
||||
# Use 0.6 tolerance for Identify People (more lenient for manual review)
|
||||
results = find_similar_faces(db, face_id, tolerance=0.6, include_excluded=include_excluded)
|
||||
logger.info(f"API: find_similar_faces returned {len(results)} results")
|
||||
|
||||
items = [
|
||||
@@ -246,10 +247,12 @@ def get_batch_similarities(
|
||||
logger.info(f"API: batch_similarity called for {len(request.face_ids)} faces")
|
||||
|
||||
# Calculate similarities between all pairs
|
||||
# Use 0.6 tolerance for Identify People (more lenient for manual review)
|
||||
pairs = calculate_batch_similarities(
|
||||
db,
|
||||
request.face_ids,
|
||||
min_confidence=request.min_confidence,
|
||||
tolerance=0.6,
|
||||
)
|
||||
|
||||
# Convert to response format
|
||||
@@ -747,7 +750,7 @@ def auto_match_faces(
|
||||
@router.get("/auto-match/people", response_model=AutoMatchPeopleResponse)
|
||||
def get_auto_match_people(
|
||||
filter_frontal_only: bool = Query(False, description="Only include frontal/tilted reference faces"),
|
||||
tolerance: float = Query(0.6, ge=0.0, le=1.0, description="Tolerance threshold"),
|
||||
tolerance: float = Query(0.5, ge=0.0, le=1.0, description="Tolerance threshold"),
|
||||
db: Session = Depends(get_db),
|
||||
) -> AutoMatchPeopleResponse:
|
||||
"""Get list of people for auto-match (without matches) - fast initial load.
|
||||
@@ -810,7 +813,7 @@ def get_auto_match_people(
|
||||
@router.get("/auto-match/people/{person_id}/matches", response_model=AutoMatchPersonMatchesResponse)
|
||||
def get_auto_match_person_matches(
|
||||
person_id: int,
|
||||
tolerance: float = Query(0.6, ge=0.0, le=1.0, description="Tolerance threshold"),
|
||||
tolerance: float = Query(0.5, ge=0.0, le=1.0, description="Tolerance threshold"),
|
||||
filter_frontal_only: bool = Query(False, description="Only return frontal/tilted faces"),
|
||||
db: Session = Depends(get_db),
|
||||
) -> AutoMatchPersonMatchesResponse:
|
||||
|
||||
Reference in New Issue
Block a user