This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
DaviD 3D Thermal Face Processor - A Flask web application that creates 3D thermal effects on faces in videos using Microsoft's DaviD (Depth and Visual Understanding in Dense prediction) models.
# Automated setup
./setup.sh
# Manual setup
python3 -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txt
# Download DaviD models if not present
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# Start web server
python3 app.py
# Access at http://127.0.0.1:5001
# Run DaviD demo standalone
cd DAViD/DAViD
python demo.py --image path/to/input.jpg --multitask-model models/multitask.onnxNo formal test suite exists. Test manually by:
- Starting the web server
- Uploading a test video through the web interface
- Verifying processing completes without errors
The video processing flow follows this architecture:
-
Web Interface (
app.py,templates/index.html)- Flask server handles uploads and parameter configuration
- Real-time parameter adjustment interface
- Progress tracking and time estimation
-
Main Pipeline (
processor/main_pipeline.py)- Orchestrates the entire processing workflow
- Manages temporary files and cleanup
- Handles progress reporting
-
Processing Components (
processor/)video_handler.py: Video I/O, frame extraction/compilationface_tracker.py: Face and upper body detection using OpenCVdavid_processor.py: DaviD model integration for thermal effectsdepth_estimator.py: Depth map generationsurface_normal_estimator.py: 3D surface normal calculationsdepth_hologram_generator.py: Alternative holographic overlay
-
DaviD Models (
DAViD/DAViD/)runtime/estimation.py: Core multi-task estimation- ONNX models for depth, surface normals, and segmentation
- GPU-accelerated inference with ONNX Runtime
- Pipeline Architecture: Each processor is a separate module that can be tested independently
- Frame-by-Frame Processing: Videos are processed as individual frames for memory efficiency
- Parameter Injection: All processing parameters flow from web interface through the pipeline
- Temporary File Management: Uses unique session IDs to prevent conflicts
- david: Primary mode using DaviD models for blue/cyan thermal effects
- surface_normal: Geometric UV mapping visualization
- holographic_depth: Alternative depth-based overlay
processor/david_processor.py: Core thermal effect implementationprocessor/main_pipeline.py: Pipeline orchestration and progress trackingapp.py: Web server and API endpointsDAViD/DAViD/runtime/estimation.py: DaviD model inference
- Optimized for Apple M4 GPU but works on CPU
- Memory-efficient frame processing to handle large videos
- Progress estimation based on frame count and processing speed
- Cleanup of temporary files after processing