A sophisticated Flask web application that applies stunning 3D thermal effects to faces in videos using Microsoft's DaviD (Depth and Visual Understanding in Dense prediction) models.
- Blue/Cyan Thermal Visualization: Stunning surface normal mapping that creates a thermal camera-like effect
- Precise Face Targeting: Advanced face tracking ensures effects only apply to face and upper body
- Real-time Parameter Control: Adjust thermal intensity, depth contribution, and targeting precision
- High-Quality Processing: Uses Microsoft's state-of-the-art DaviD models for depth and surface normal estimation
- Thermal Effect (85%): Controls the intensity of the blue/cyan thermal effect
- Effect Intensity (90%): Overall strength of the 3D overlay
- Depth Contribution (15%): Amount of geometric depth information to blend
- Face Focus Precision (75%): How tightly the effect targets face and upper body
- DaviD Thermal 3D: Primary mode using Microsoft DaviD models
- 3D Surface Normal: Geometric UV mapping visualization
- Holographic Depth: Alternative depth-based overlay
- Time Estimates: Real-time processing time predictions based on file size
- Progress Tracking: Live progress updates during processing
- Performance Stats: Detailed processing statistics and FPS metrics
- GPU Acceleration: Optimized for Apple M4 and other GPU hardware
- Python 3.8+
- OpenCV
- ONNX Runtime
- Flask and dependencies
- Clone the repository
git clone https://github.com/yourusername/david-3d-thermal-processor.git
cd david-3d-thermal-processor- Create virtual environment
python3 -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate- Install dependencies
pip install -r requirements.txt- Download DaviD Models
mkdir -p DaviD/models/david
curl https://facesyntheticspubwedata.z6.web.core.windows.net/iccv-2025/models/multi-task-model-vitl16_384.onnx -o DaviD/models/david/multitask-vitl16_384.onnx- Run the application
python3 app.py- Open in browser
Navigate to
http://127.0.0.1:5001
- Upload Video: Drag & drop or click to select video files
- Choose Processing Mode: Select "DaviD Thermal 3D" for the thermal effect
- Adjust Parameters:
- Increase "Thermal Effect" for more blue/cyan intensity
- Adjust "Effect Intensity" for stronger overlay
- Fine-tune "Face Focus" for precise targeting
- Process: Click "Process Video" and monitor progress
- Download: Get your processed video with thermal effects
curl -X POST -F "video=@input.mp4" \
-F "processing_mode=david" \
-F "david_normal_weight=0.85" \
-F "david_blend_strength=0.9" \
-F "david_depth_contribution=0.15" \
-F "david_face_focus=0.75" \
http://127.0.0.1:5001/uploadapp.py: Flask web server and API endpointsprocessor/david_processor.py: DaviD model integration and thermal effect generationprocessor/face_tracker.py: Precise face and upper body detectionprocessor/main_pipeline.py: Video processing orchestrationtemplates/index.html: Web interface with real-time controls
- Video Input: Upload and frame extraction
- Face Tracking: Detect and track face/upper body regions
- DaviD Analysis: Depth, surface normal, and foreground estimation
- Thermal Visualization: Generate blue/cyan thermal effects
- Precise Masking: Apply effects only to targeted face/body areas
- Video Output: Render final video with thermal effects
- Multi-task Model: Simultaneous depth, surface normal, and segmentation
- ONNX Runtime: Optimized inference on CPU and GPU
- Visualization Pipeline: Custom thermal effect rendering using DaviD outputs
- OpenCV Detection: Robust face detection across video frames
- Conservative Masking: Precise elliptical masks for face and upper body
- Tracking Continuity: Maintains effect consistency across frames
- GPU Acceleration: Automatic GPU detection and utilization
- Memory Management: Efficient frame processing and cleanup
- Progress Monitoring: Real-time processing statistics
- Processing Speed: ~0.27 FPS on typical hardware
- Time Estimate: ~0.5 minutes per MB of video
- Memory Usage: Optimized for standard desktop/laptop systems
- Quality: High-resolution thermal effects with precise targeting
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Microsoft DaviD Team: For the incredible depth and surface normal estimation models
- OpenCV Community: For robust computer vision tools
- Flask Team: For the excellent web framework
Built with ❤️ for creating stunning 3D thermal face effects