A revised and improved version of DDColor, offering additional features and optimizations for image colorization.
This project is developed as part of my Bachelor of Computer Engineering with Honours Final Year Project (2025).
DDColor is a state-of-the-art automatic image colorization framework proposed in the paper "DDColor: Towards Photo-Realistic Image Colorization via Dual Decoders" (ICCV 2023). This revised version maintains the core functionality while adding new features, optimizing performance, and improving user interfaces.
Below is a comparison of the input black-and-white images and the colorized outputs generated by re-DDColor:
Before (Black & White) | After (Colorized) |
---|---|
![]() |
![]() |
You can try colorizing your own images using the methods described in the Usage section.
- Added support for Apple Metal Performance Shaders (MPS) for better performance on Mac devices
- Optimized memory usage for improved processing on devices with limited resources
- Enhanced inference pipeline for faster colorization
- Gradio Web UI: Added interactive web interface for easy colorization with before/after slider comparison
- Flask API: Implemented a REST API for integration with other applications
- Video Processing: Extended support for colorizing videos frame by frame
- Improved CLI: Enhanced command-line interface with more options and better feedback
- Better cross-platform compatibility (Windows, macOS, Linux)
- Streamlined installation process with clearer dependencies
- Additional model configuration options
- Enhanced error handling and recovery
- Comprehensive documentation
# Clone the repository
git clone https://github.com/yourusername/re-DDColor.git
cd re-DDColor
# Install dependencies
pip install -r requirements.txt
# Download pre-trained models (automatically done on first run)
python pretraindownload.py
For the easiest and most consistent experience across different platforms, you can use Docker:
# Build the Docker image
docker build -t ddcolor-app .
# Run the container
docker run -p 8501:8501 ddcolor-app
# Access the web application
# Open http://localhost:8501 in your browser
- No need to install dependencies manually
- Works consistently across Windows, macOS, and Linux
- Model is downloaded automatically during the build process
- All required libraries are pre-configured
- Docker installed on your system (Get Docker)
- At least 2GB of free disk space
The easiest way to use re-DDColor is through the Gradio web interface:
python gradio_app.py
This will start a local web server with an interactive UI where you can:
- Upload black and white images
- View colorization results with a before/after slider
- Download the colorized images
For integration with other applications:
python flaskapi.py
The API will be available at http://localhost:5000/
with the following endpoints:
POST /colorize
: Upload an image for colorizationGET /models
: List available models
For batch processing or scripting:
# Colorize a single image
python predict.py --input path/to/image.jpg --output path/to/output.jpg
# Colorize all images in a directory
python predict.py --input path/to/input_dir --output path/to/output_dir
# Specify a different model
python predict.py --input image.jpg --output output.jpg --model ddcolor_artistic.pth
To colorize videos:
python video_converter.py --input path/to/video.mp4 --output path/to/colorized_video.mp4
re-DDColor includes several pre-trained models as described in MODEL_ZOO.md:
Model | Description | Best For |
---|---|---|
ddcolor_modelscope.pth (default) |
DDColor-L with cleaned data | General use, best quality |
ddcolor_paper.pth |
Original paper model | Paper reproduction |
ddcolor_artistic.pth |
Trained with artistic images | Creative colorization, fewer artifacts |
ddcolor_paper_tiny.pth |
Lightweight model | Resource-constrained devices |
re-DDColor uses a dual-decoder architecture:
- Encoder: ConvNeXt-based (tiny or large variants)
- Decoder: Two options:
MultiScaleColorDecoder
: Transformer-based decoder with multi-scale featuresSingleColorDecoder
: Simpler decoder for faster inference
- Color Processing: Lab color space for accurate colorization
- Python 3.7+
- PyTorch 1.7+
- CUDA-compatible GPU (recommended) or Apple Silicon
- 4GB+ VRAM for large models, 2GB+ for tiny models
To train a custom model:
# Edit the configuration
# Modify options/train/train_ddcolor.yml with your dataset paths and parameters
# Start training
python basicsr/train.py -opt options/train/train_ddcolor.yml
See the training configuration file for details on available options including loss functions, optimizers, and data augmentation.
If you use this code in your research, please cite the original DDColor paper:
@inproceedings{kang2023ddcolor,
title={DDColor: Towards Photo-Realistic Image Colorization via Dual Decoders},
author={Kang, Xiaoyang and Yang, Tao and Ouyang, Wenqi and Ren, Peiran and Li, Lingzhi and Xie, Xuansong},
booktitle={Proceedings of the IEEE/CVF International Conference on Computer Vision},
year={2023}
}
This work is a revised version of the original DDColor project by Xiaoyang Kang et al. I thank the original authors for their outstanding contribution to the field of image colorization.
This project is licensed under the terms of the LICENSE file included in the repository.