A comprehensive ComfyUI implementation featuring two state-of-the-art reference-based video colorization methods:
- π¨ ColorMNet (2024) - Modern memory-based approach with DINOv2 features
- π¬ Deep Exemplar (2019) - Classic CVPR method with temporal propagation
Transform black & white videos and images into vibrant color using reference images!
See ColorMNet in action colorizing classic black & white footage:
Example: Colorized using ColorMNet with color matching post-processing. The model successfully transfers colors from a reference image while maintaining temporal consistency.
- ColorMNet Video Colorization - Memory-based temporal coherent colorization
- ColorMNet Image Colorization - Single image colorization
- DINOv2-based feature extraction for superior quality
- Multiple memory modes (balanced, low memory, high quality)
- FP16 support for faster processing
- torch.compile optimization for 15-25% speedup (PyTorch 2.0+)
- Performance reports with timing and FPS metrics
- Deep Exemplar Video Colorization - Frame propagation for temporal consistency
- Deep Exemplar Image Colorization - Classic exemplar-based method
- WLS (Weighted Least Squares) filtering for smoother results
- Configurable lambda and sigma parameters
- torch.compile optimization for 15-25% speedup (PyTorch 2.0+)
- SageAttention for 20-30% faster attention operations
- Performance reports for benchmarking
- β Automatic model download - No manual setup required!
- β Progress bars - Real-time processing feedback in ComfyUI
- β Performance metrics - Compare speed and quality between methods
- β Flexible resolution - Process at any resolution
- β ComfyUI native - Fully integrated workflow support
- Install ComfyUI Manager
- Open ComfyUI β Manager β Install Custom Nodes
- Search for "Deep Exemplar Video Colorization"
- Click Install
- Restart ComfyUI
Models will download automatically on first use (~700MB total).
cd ComfyUI/custom_nodes/
git clone https://github.com/jonstreeter/ComfyUI-Reference-Based-Video-Colorization.git
cd ComfyUI-Reference-Based-Video-Colorization/
pip install -r requirements.txtRestart ComfyUI. Models download automatically on first use.
Load the example workflow from workflows/Colorize_Video_Workflow.json:
- Load Video - Use VHS Video Loader to load your grayscale video
- Load Reference - Load a color reference image
- Choose Method - Try both ColorMNet and Deep Exemplar
- Compare Results - Use the performance reports to benchmark
- Save Output - Export colorized video with VHS Video Combine
ColorMNet Video (ColorMNet/Video)
video_frames- Input grayscale video framesreference_image- Color reference imagetarget_width/height- Output resolutionmemory_mode- balanced | low_memory | high_qualityuse_fp16- Enable FP16 for speed (default: True)use_torch_compile- Enable PyTorch 2.0+ compilation (default: False)- Outputs: colorized_frames, performance_report
ColorMNet Image (ColorMNet/Image)
image- Input grayscale imagereference_image- Color reference imagetarget_width/height- Output resolutionuse_fp16- Enable FP16 (default: True)use_torch_compile- Enable PyTorch 2.0+ compilation (default: False)- Outputs: colorized_image, performance_report
Deep Exemplar Video (DeepExemplar/Video)
video_frames- Input grayscale video framesreference_image- Color reference imagetarget_width/height- Output resolutionframe_propagate- Use temporal consistency (default: True)use_half_resolution- Process at half resolution (default: True)use_torch_compile- Enable PyTorch 2.0+ compilation (default: False)use_sage_attention- Enable SageAttention optimization (default: False)- Outputs: colorized_frames, performance_report
Deep Exemplar Image (DeepExemplar/Image)
image_to_colorize- Input grayscale imagereference_image- Color reference imagetarget_width/height- Output resolutionuse_torch_compile- Enable PyTorch 2.0+ compilation (default: False)use_sage_attention- Enable SageAttention optimization (default: False)- Outputs: colorized_image, performance_report
All nodes output optional performance reports with timing metrics:
ColorMNet Video Colorization Report
==================================================
Frames Processed: 240
Resolution: 768x432
Total Time: 45.23 seconds
Average FPS: 5.31
Time per Frame: 0.188 seconds
Memory Mode: balanced
FP16 Enabled: True
Torch Compile: False
==================================================
Deep Exemplar Video Colorization Report
==================================================
Frames Processed: 240
Resolution: 768x432
Total Time: 52.34 seconds
Average FPS: 4.59
Time per Frame: 0.218 seconds
Frame Propagation: Enabled
Half Resolution: Enabled
WLS Filter: Enabled
Lambda: 500.0
Sigma Color: 4.0
Torch Compile: False
SageAttention: False
==================================================
Connect the performance_report output to a text display node or save to file for benchmarking!
- Choose references semantically similar to your content
- Match the color palette you want to achieve
- Higher quality references = better results
- Try multiple references to find the best match
- ColorMNet: Processes at full target resolution
- Deep Exemplar: Internally uses half resolution by default
- Start with 768x432 for good speed/quality balance
- Increase for final high-quality renders
ColorMNet Memory Modes:
balanced- Good quality, moderate memory (recommended)low_memory- Reduced memory usage, slight quality trade-offhigh_quality- Best quality, higher memory requirements
Deep Exemplar:
- Enable
use_half_resolutionto reduce memory - Disable
frame_propagatefor independent frame processing - Process shorter clips if encountering OOM errors
For Best Quality:
- ColorMNet:
memory_mode=high_quality,use_fp16=False,use_torch_compile=False - Deep Exemplar:
use_half_resolution=False,use_torch_compile=False,use_sage_attention=False
For Best Speed:
- ColorMNet:
memory_mode=low_memory,use_fp16=True,use_torch_compile=True - Deep Exemplar:
use_half_resolution=True,use_torch_compile=True,use_sage_attention=True
Optimization Notes:
torch.compilerequires PyTorch 2.0+ and provides 15-25% speedup after initial warmupuse_sage_attention(Deep Exemplar only) provides 20-30% faster attention withsageattentioninstalled- Both optimizations maintain identical quality to non-optimized versions
Models are automatically downloaded to:
custom_nodes/ComfyUI-Reference-Based-Video-Colorization/
βββ checkpoints/
β βββ DINOv2FeatureV6_LocalAtten_s2_154000.pth # ColorMNet (~500MB)
β βββ video_moredata_l1/
β βββ nonlocal_net_iter_76000.pth # Deep Exemplar
β βββ colornet_iter_76000.pth # Deep Exemplar
βββ data/
βββ vgg19_conv.pth # Shared VGG19
βββ vgg19_gray.pth # Deep Exemplar VGG
torch.compile (PyTorch 2.0+): Provides 15-25% speedup through graph compilation and optimization.
- Available for all 4 nodes (ColorMNet + Deep Exemplar)
- Enable via
use_torch_compile=Trueparameter - First run includes warmup compilation (slower), subsequent runs benefit from speedup
- No additional installation required if using PyTorch 2.0+
SageAttention (Deep Exemplar only): INT8-quantized attention for 20-30% faster attention operations.
Installation:
pip install sageattentionRequirements:
- CUDA-capable GPU
- PyTorch with CUDA support
- Enable via
use_sage_attention=Trueparameter - Automatically falls back to standard attention if unavailable
CUDA Correlation Sampler (Optional for ColorMNet): ColorMNet can use optimized CUDA correlation operations if available.
Requirements:
- CUDA Toolkit installed
- Visual Studio Build Tools (Windows)
- Will be attempted automatically on first run
OpenCV Contrib (Required for WLS):
pip install opencv-contrib-python- Architecture - Technical implementation details
- Performance - Benchmarks and optimization guide
- Quick Start - Detailed getting started guide
- Migration Guide - Upgrading from older versions
If you use these methods in your research, please cite the original papers:
@article{yang2024colormnet,
title={ColorMNet: A Memory-based Deep Spatial-Temporal Feature Propagation Network for Video Colorization},
author={Yang, Yixin and Zhou, Xiaoyu and Liu, Chao and Chen, Junchi and Wang, Zhiwen},
journal={arXiv preprint arXiv:2404.06251},
year={2024}
}@inproceedings{zhang2019deep,
title={Deep exemplar-based video colorization},
author={Zhang, Bo and He, Mingming and Liao, Jing and Sander, Pedro V and Yuan, Lu and Bermak, Amine and Chen, Dong},
booktitle={Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition},
pages={8052--8061},
year={2019}
}- Original ColorMNet: https://github.com/yyang181/colormnet
- Original Deep Exemplar: https://github.com/zhangmozhe/Deep-Exemplar-based-Video-Colorization
- ComfyUI: https://github.com/comfyanonymous/ComfyUI
- Bringing Old Photos Back to Life: https://github.com/microsoft/Bringing-Old-Photos-Back-to-Life
This ComfyUI implementation is licensed under the MIT License.
Note on Model Licenses:
- ColorMNet model: CC BY-NC-SA 4.0 (Non-commercial use only)
- Deep Exemplar model: Subject to original project license
- ColorMNet implementation based on yyang181/colormnet
- Deep Exemplar implementation based on zhangmozhe/Deep-Exemplar-based-Video-Colorization
- Thanks to the ComfyUI community for feedback and testing
Found a bug or have a feature request? Please open an issue on GitHub!
For general questions:
- Check the documentation
- Review existing issues
- Open a new issue with details
- Batch processing optimization
- Memory-efficient streaming for long videos
- Additional colorization methods
- Color transfer utilities
- Integration with other ComfyUI nodes
Star β this repo if you find it useful!
