DDColor can provide vivid and natural colorization for historical black-and-white photos.
π¨ DDColor
Official PyTorch implementation of ICCV 2023 Paper "DDColor: Towards Photo-Realistic Image Colorization via Dual Decoders".
Xiaoyang Kang, Tao Yang, Wenqi Ouyang, Peiran Ren, Lingzhi Li, Xuansong Xie
DAMO Academy, Alibaba Group
πͺ DDColor can provide vivid and natural colorization for historical black and white old photos.
π² It can even colorize/recolor landscapes from anime games, transforming your animated scenery into a realistic real-life style! (Image source: Genshin Impact)
π₯ News
-
[2024-01-28] Support inferencing via Hugging Face! Thanks @Niels for the suggestion and example code and @Skwara for fixing bug.
-
[2024-01-18] Add Replicate demo and API! Thanks @Chenxi.
-
[2023-12-13] Release the DDColor-tiny pre-trained model!
-
[2023-09-07] Add the Model Zoo and release three pretrained models!
-
[2023-05-15] Code release for training and inference!
-
[2023-05-05] The online demo is available!
Online Demo
We provide online demos through ModelScope at and Replicate at .
Feel free to try themβ¦
In this post, Iβll introduce how to run DDColor on Google Colab free-tier, T4.
Step 1. Clone the repo & install dependencies
First, we need to install dependencies and this step will take some time.
!git clone https://github.com/piddnad/DDColor
!cd DDColor
!pip install -r requirements.txt
!python setup.py develop
!pip install "modelscope[cv]" -f https://modelscope.oss-cn-beijing.aliyuncs.com/releases/repo.html
Step 2. Adding Colors to Image
import cv2
from modelscope.outputs import OutputKeys
from modelscope.pipelines import pipeline
from modelscope.utils.constant import Tasks
from google.colab.patches import cv2_imshow
img_colorization = pipeline(Tasks.image_colorization, model='damo/cv_ddcolor_image-colorization')
result = img_colorization('https://th.bing.com/th/id/R.bfff865861dc593b14fa030a9ac2aee5?rik=Of2Q7oLKe0r0fg&riu=http%3a%2f%2fstatic.guim.co.uk%2fsys-images%2fGuardian%2fPix%2fpictures%2f2013%2f2%2f18%2f1361186749737%2fblack-and-white-picture-o-005.jpg&ehk=zoDQaeRIcKRivy%2fXZH7lZa3ixweCv47WKzD8uJGwZgw%3d&risl=&pid=ImgRaw&r=0')
cv2.imwrite('result.png', result[OutputKeys.OUTPUT_IMG])
cv2_imshow(result[OutputKeys.OUTPUT_IMG])
Top comments (0)