# InstColorization **Repository Path**: wanganzhi666/InstColorization ## Basic Information - **Project Name**: InstColorization - **Description**: No description available - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-07-23 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # [CVPR 2020] Instance-aware Image Colorization [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/ericsujw/InstColorization/blob/master/InstColorization.ipynb) ### [[Paper](https://arxiv.org/abs/2005.10825)] [[Project Website](https://ericsujw.github.io/InstColorization/)] [[Google Colab](https://colab.research.google.com/github/ericsujw/InstColorization/blob/master/InstColorization.ipynb)]

Image colorization is inherently an ill-posed problem with multi-modal uncertainty. Previous methods leverage the deep neural network to map input grayscale images to plausible color outputs directly. Although these learning-based methods have shown impressive performance, they usually fail on the input images that contain multiple objects. The leading cause is that existing models perform learning and colorization on the entire image. In the absence of a clear figure-ground separation, these models cannot effectively locate and learn meaningful object-level semantics. In this paper, we propose a method for achieving instance-aware colorization. Our network architecture leverages an off-the-shelf object detector to obtain cropped object images and uses an instance colorization network to extract object-level features. We use a similar network to extract the full-image features and apply a fusion module to full object-level and image-level features to predict the final colors. Both colorization networks and fusion modules are learned from a large-scale dataset. Experimental results show that our work outperforms existing methods on different quality metrics and achieves state-of-the-art performance on image colorization. **Instance-aware Image Colorization**
[Jheng-Wei Su](https://github.com/ericsujw), [Hung-Kuo Chu](https://cgv.cs.nthu.edu.tw/hkchu/), and [Jia-Bin Huang](https://filebox.ece.vt.edu/~jbhuang/)
In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2020. ## Prerequisites * Python3 * Pytorch >= 1.5 * Detectron2 * OpenCV-Python * Pillow/scikit-image * Please refer to the [env.yml](env.yml) for detail dependencies. ## Getting Started 1. Clone this repo: ```sh git clone https://github.com/ericsujw/InstColorization cd InstColorization ``` 2. Install [conda](https://www.anaconda.com/). 3. Install all the dependencies ```sh conda env create --file env.yml --name instacolorization ``` 4. Switch to the conda environment ```sh conda activate instacolorization ``` ## Pretrained Model 1. Download it from [google drive](https://drive.google.com/open?id=1Xb-DKAA9ibCVLqm8teKd1MWk6imjwTBh). ```sh sh scripts/download_model.sh ``` 2. Now the pretrained models would place in [checkpoints](checkpoints). ## Instance Prediction Please follow the command below to predict all the bounding boxes fo the images in `example` folder. ``` python inference_bbox.py --test_img_dir example ``` All the prediction results would save in `example_bbox` folder. ## Colorize Images Please follow the command below to colorize all the images in `example` foler. ``` python test_fusion.py --name test_fusion --sample_p 1.0 --model fusion --fineSize 256 --test_img_dir example --results_img_dir results ``` All the colorized results would save in `results` folder. * Note: all the images would convert into L channel to colorize in [test_fusion.py's L51](test_fusion.py#L51) ## License This work is licensed under MIT License. See [LICENSE](LICENSE) for details. ## Citation If you find our code/models useful, please consider citing our paper: ``` @inproceedings{Su-CVPR-2020, author = {Su, Jheng-Wei and Chu, Hung-Kuo and Huang, Jia-Bin}, title = {Instance-aware Image Colorization}, booktitle = {IEEE Conference on Computer Vision and Pattern Recognition (CVPR)}, year = {2020} } ``` ## Acknowledgments Our code borrows heavily from the amazing [colorization-pytorch](https://github.com/richzhang/colorization-pytorch) repository.