11 KiB
Face Recognition: Standalone vs Immich Integration
Quick Decision Guide: Which approach should you use?
🎯 Quick Answer
Use Immich Integration if:
- ✅ You already have Immich running
- ✅ Immich is already processing your photos
- ✅ You want faster, simpler setup
- ✅ You want to manage faces in one place
Use Standalone if:
- ❌ You don't use Immich
- ❌ Immich doesn't have access to these downloads
- ❌ You want complete independence
📊 Detailed Comparison
| Feature | Standalone | Immich Integration |
|---|---|---|
| Setup Time | 2-3 hours | 30 minutes |
| Dependencies | face_recognition, dlib, cmake | psycopg2 only |
| Installation Size | ~500MB | ~5MB |
| Processing Speed | 1-2 sec/image | <1 sec/image |
| CPU Usage | High (face detection) | Low (just queries) |
| Duplicate Processing | Yes | No |
| Face Management UI | Must build from scratch | Use existing Immich UI |
| Training Images | Need 5-10 per person | Already done in Immich |
| Learning Capability | Yes (our own) | Yes (from Immich) |
| Accuracy | 85-92% | 90-95% (Immich's) |
| GPU Acceleration | Possible | Already in Immich |
| Maintenance | High (our code) | Low (read Immich DB) |
| Breaking Changes Risk | Low (stable library) | Medium (DB schema changes) |
| Works Offline | Yes | Yes (local DB) |
| Privacy | 100% local | 100% local |
💰 Cost Comparison
Standalone Approach
Initial Investment:
- Development time: 40-60 hours
- Testing: 10-15 hours
- Documentation: 5-10 hours
- Total: 55-85 hours
Ongoing Maintenance:
- Bug fixes: 2-5 hours/month
- Updates: 5-10 hours/year
- Total: ~30-70 hours/year
Server Resources:
- CPU: High during face detection
- RAM: 1-2GB during processing
- Storage: 100KB per person for encodings
Immich Integration
Initial Investment:
- Development time: 10-15 hours
- Testing: 5 hours
- Documentation: 2 hours
- Total: 17-22 hours
Ongoing Maintenance:
- Bug fixes: 1-2 hours/month
- Updates: 2-5 hours/year (if Immich DB schema changes)
- Total: ~15-30 hours/year
Server Resources:
- CPU: Minimal (just database queries)
- RAM: <100MB
- Storage: Negligible (just sort history)
Savings with Immich Integration
- 65-75% less development time
- 50% less maintenance
- 90% less CPU usage
- Much simpler codebase
🏗️ Architecture Comparison
Standalone Architecture
Download → Face Detection → Face Encoding → Compare → Decision
(1-2 seconds) (CPU intensive) (our DB)
↓
Sort or Queue
Components to Build:
- Face detection engine
- Face encoding storage
- Face comparison algorithm
- People management UI
- Training workflow
- Review queue UI
- Database schema (3 tables)
- API endpoints (15+)
Immich Integration Architecture
Download → Query Immich DB → Read Face Data → Decision
(10-50ms) (already processed)
↓
Sort
Components to Build:
- Database connection
- Query methods (5-6)
- Simple sorting logic
- Minimal UI (3 pages)
- Database schema (1 table)
- API endpoints (5-7)
Leverage from Immich:
- ✅ Face detection
- ✅ Face encoding
- ✅ People management
- ✅ Training workflow
- ✅ Face matching algorithm
- ✅ GPU acceleration
- ✅ Web UI for face management
🎨 UI Comparison
Standalone: Must Build
- Dashboard (enable/disable, stats)
- People Management (add, edit, delete, train)
- Review Queue (identify unknown faces)
- Training Interface (upload samples)
- History/Statistics
- Configuration
Estimated UI Development: 20-30 hours
Immich Integration: Minimal UI
- Dashboard (stats, enable/disable)
- People List (read-only, link to Immich)
- Sort History (what we sorted)
- Configuration
Estimated UI Development: 5-8 hours
Bonus: Users already know Immich UI for face management!
🔧 Code Complexity
Standalone
# Core file: modules/face_recognition_manager.py
# ~800-1000 lines of code
class FaceRecognitionManager:
def __init__(...):
# Load face_recognition library
# Initialize encodings
# Setup directories
# Load known faces into memory
def process_image(...):
# Load image
# Detect faces (slow)
# Generate encodings (CPU intensive)
# Compare with known faces
# Calculate confidence
# Make decision
# Move/queue file
def add_person(...):
# Upload training images
# Generate encodings
# Store in database
# Update in-memory cache
# + 15-20 more methods
Immich Integration
# Core file: modules/immich_face_sorter.py
# ~200-300 lines of code
class ImmichFaceSorter:
def __init__(...):
# Connect to Immich PostgreSQL
# Setup directories
def process_image(...):
# Query Immich DB (fast)
# Check if faces identified
# Move/copy file
# Done!
def get_faces_for_file(...):
# Simple SQL query
# Parse results
# + 5-6 more methods
Result: 70% less code, 80% simpler logic
⚡ Performance Comparison
Processing 1000 Images
Standalone:
- Face detection: 500-1000 seconds (8-17 minutes)
- Face encoding: 100 seconds
- Comparison: 100 seconds
- File operations: 100 seconds
- Total: ~15-20 minutes
Immich Integration:
- Query Immich DB: 10-50 seconds
- File operations: 100 seconds
- Total: ~2-3 minutes
Result: 5-10x faster with Immich integration
🛠️ Maintenance Burden
Standalone
Potential Issues:
- face_recognition library updates
- dlib compilation issues on system updates
- Model accuracy drift over time
- Memory leaks in long-running processes
- Complex debugging (ML pipeline)
Typical Support Questions:
- "Why is face detection slow?"
- "How do I improve accuracy?"
- "Why did it match the wrong person?"
- "How do I retrain a person?"
Immich Integration
Potential Issues:
- Immich database schema changes (rare)
- PostgreSQL connection issues
- Simple query debugging
Typical Support Questions:
- "How do I connect to Immich DB?"
- "Where do sorted files go?"
Result: Much simpler maintenance
🎓 Learning Curve
Standalone
Must Learn:
- Face recognition concepts
- dlib library
- face_recognition API
- Encoding/embedding vectors
- Confidence scoring
- Training workflows
- Database schema design
- Complex Python async patterns
Estimated Learning: 20-40 hours
Immich Integration
Must Learn:
- PostgreSQL queries
- Immich database schema (basic)
- Simple file operations
Estimated Learning: 2-5 hours
Result: 90% less learning required
🔄 Migration Path
Can You Switch Later?
Standalone → Immich Integration: Easy
- Keep sorted files
- Start using Immich's face data
- Disable our face detection
- Use Immich for new identifications
Immich Integration → Standalone: Harder
- Would need to extract face data from Immich
- Retrain our own models
- Rebuild people database
- Not recommended
Recommendation: Start with Immich Integration, fall back to standalone only if needed.
✅ Decision Matrix
Choose Standalone if you check ≥3:
- Not using Immich currently
- Don't plan to use Immich
- Want complete independence
- Have time for complex setup
- Enjoy ML/AI projects
- Need custom face detection logic
Choose Immich Integration if you check ≥3:
- [✓] Already using Immich
- [✓] Immich scans these downloads
- [✓] Want quick setup (30 min)
- [✓] Prefer simple maintenance
- [✓] Trust Immich's face recognition
- [✓] Want to manage faces in one place
🎯 Recommendation
For Most Users: Immich Integration ✅
Why:
- You already have Immich running
- Immich already processes your photos
- 5-10x faster implementation
- 70% less code to maintain
- Simpler, cleaner architecture
- Better performance
- One UI for all face management
When to Consider Standalone:
- If you don't use Immich at all
- If these downloads are completely separate from Immich
- If you want a learning project
🚀 Implementation Roadmap
Path 1: Immich Integration (Recommended)
Week 1:
- Install psycopg2
- Test Immich DB connection
- Write query methods
- Basic sorting logic
Week 2:
- Integrate with downloads
- Add configuration
- Build minimal UI
- Testing
Week 3:
- Polish and optimize
- Documentation
- Deploy
Total: 3 weeks, production-ready
Path 2: Standalone
Weeks 1-2: Foundation
- Install dependencies
- Build core module
- Database schema
Weeks 3-4: People Management
- Add/train people
- Storage system
Weeks 5-6: Auto-sorting
- Detection pipeline
- Comparison logic
Weeks 7-8: Review Queue
- Queue system
- Identification UI
Weeks 9-10: Web UI
- Full dashboard
- All CRUD operations
Weeks 11-12: Polish
- Testing
- Optimization
- Documentation
Total: 12 weeks to production
📝 Summary Table
| Metric | Standalone | Immich Integration |
|---|---|---|
| Time to Production | 12 weeks | 3 weeks |
| Development Hours | 55-85 | 17-22 |
| Code Complexity | High | Low |
| Dependencies | Heavy | Light |
| Processing Speed | Slower | Faster |
| Maintenance | High | Low |
| Learning Curve | Steep | Gentle |
| Face Management | Custom UI | Immich UI |
| Accuracy | 85-92% | 90-95% |
| Resource Usage | High | Low |
Winner: Immich Integration by large margin
💡 Hybrid Approach?
Is there a middle ground?
Yes! You could:
- Start with Immich Integration (quick wins)
- Add standalone as fallback/enhancement later
- Use Immich for main library, standalone for special cases
Best of Both Worlds:
def process_image(file_path):
# Try Immich first (fast)
faces = immich_db.get_faces(file_path)
if faces:
return sort_by_immich_data(faces)
else:
# Fall back to standalone detection
return standalone_face_detection(file_path)
🎯 Final Recommendation
Start with Immich Integration
- Immediate benefits: Working in days, not months
- Lower risk: Less code = fewer bugs
- Better UX: Users already know Immich
- Easy to maintain: Simple queries, no ML
- Can always enhance: Add standalone later if needed
The standalone approach is impressive technically, but Immich integration is the smart engineering choice.
Documentation:
- Immich Integration:
docs/AI_FACE_RECOGNITION_IMMICH_INTEGRATION.md - Standalone Plan:
docs/AI_FACE_RECOGNITION_PLAN.md - Quick Start:
docs/AI_FACE_RECOGNITION_QUICKSTART.md
Last Updated: 2025-10-31