feat: Implement face detection improvements and cleanup script

This commit introduces significant enhancements to the face detection system, addressing false positives by updating configuration settings and validation logic. Key changes include stricter confidence thresholds, increased minimum face size, and improved aspect ratio requirements. A new script for cleaning up existing false positives from the database has also been added, successfully removing 199 false positive faces. Documentation has been updated to reflect these changes and provide usage instructions for the cleanup process.
This commit is contained in:
tanyar09
2025-10-16 15:56:17 -04:00
parent d398b139f5
commit 68673ccdbe
8 changed files with 295 additions and 6 deletions
+39
View File
@@ -0,0 +1,39 @@
#!/usr/bin/env python3
"""
Script to clean up false positive face detections from the database
"""
import sys
import os
# Add the project root to the Python path
project_root = os.path.join(os.path.dirname(__file__), '..')
sys.path.insert(0, project_root)
from src.core.database import DatabaseManager
from src.core.face_processing import FaceProcessor
def main():
"""Clean up false positive faces from the database"""
print("🧹 PunimTag False Positive Face Cleanup")
print("=" * 50)
# Initialize database and face processor
db_manager = DatabaseManager()
face_processor = FaceProcessor(db_manager, verbose=1)
# Clean up false positives
removed_count = face_processor.cleanup_false_positive_faces(verbose=True)
if removed_count > 0:
print(f"\n✅ Cleanup complete! Removed {removed_count} false positive faces.")
print("You can now re-run face processing with improved filtering.")
else:
print("\n✅ No false positive faces found to remove.")
print("\nTo reprocess photos with improved face detection:")
print("1. Run the dashboard: python run_dashboard.py")
print("2. Go to Process tab and click 'Process Photos'")
if __name__ == "__main__":
main()