#!/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. Use the web interface to process photos")
    print("2. Or use the API endpoints to trigger face processing")

if __name__ == "__main__":
    main()
