File size: 1,590 Bytes
227930f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/usr/bin/env python3
"""
Quick setup script for SCA CV Module
Initializes directories and database
"""
import os
from pathlib import Path

def setup():
    """Setup project directories and database"""
    print("🚀 Setting up SCA CV Module...")
    
    # Configuration - Using absolute paths for robustness
    BASE_DIR = Path(__file__).resolve().parent.parent
    
    # Create directories
    dirs = [
        BASE_DIR / 'models', 
        BASE_DIR / 'uploads', 
        BASE_DIR / 'outputs', 
        BASE_DIR / 'outputs' / 'face_database'
    ]
    
    for dir_path in dirs:
        dir_path.mkdir(parents=True, exist_ok=True)
        print(f"✓ Created directory: {dir_path}")
    
    # Initialize database
    try:
        from database import Database
        db = Database()
        print("✓ Database initialized: outputs/sca_events.db")
    except Exception as e:
        print(f"⚠ Database initialization failed: {e}")
    
    # Check dependencies
    print("\n📦 Checking dependencies...")
    required = ['cv2', 'numpy', 'flask', 'ultralytics', 'sqlalchemy']
    missing = []
    
    for pkg in required:
        try:
            __import__(pkg)
            print(f"✓ {pkg}")
        except ImportError:
            missing.append(pkg)
            print(f"✗ {pkg} - MISSING")
    
    if missing:
        print(f"\n⚠ Install missing packages:")
        print(f"pip install {' '.join(missing)}")
    else:
        print("\n✅ All dependencies installed!")
    
    print("\n🎉 Setup complete! Run: python app.py")

if __name__ == "__main__":
    setup()