This is the official repository of the paper Deep Automatic Natural Image Matting.
Introduction | Network | AIM-500 | Results | Train and Test | Inference code | Statement
[2021-11-17]: Release the code for training and dataset processing in this code-base page.
[2021-10-02]: Publish the network, the inference code and the pretrained models in this code-base page.
[2021-07-16]: Publish the validation dataset AIM-500. Please follow the
readme.txt
for details.
Dataset Dataset Link
(Google Drive)Dataset Link
(Baidu Wangpan 百度网盘)Dataset Release Agreement AIM-500 Link Link (pw: 0l69) Agreement (MIT License)
Different from previous methods only focusing on images with salient opaque foregrounds such as humans and animals, in this paper, we investigate the difficulties when extending the automatic matting methods to natural images with salient transparent/meticulous foregrounds or non-salient foregrounds.
To address the problem, we propose a novel end-to-end matting network, which can predict a generalized trimap for any image of the above types as a unified semantic representation. Simultaneously, the learned semantic features guide the matting network to focus on the transition areas via an attention mechanism.
We also construct a test set AIM-500 that contains 500 diverse natural images covering all types along with manually labeled alpha mattes, making it feasible to benchmark the generalization ability of AIM models. Results of the experiments demonstrate that our network trained on available composite matting datasets outperforms existing methods both objectively and subjectively.
We propose the methods consist of:
-
Improved Backbone for Matting: an advanced max-pooling version of ResNet-34, serves as the backbone for the matting network, pretrained on ImageNet;
-
Unified Semantic Representation: a type-wise semantic representation to replace the traditional trimaps;
-
Guided Matting Process: an attention based mechanism to guide the matting process by leveraging the learned semantic features from the semantic decoder to focus on extracting details only within transition area.
The backbone pretrained on ImageNet, the model pretrained on DUTS dataset, and the model pretrained on synthetic matting dataset will be released soon.
Model | Pretrained Backbone on ImageNet | Pretrained Model on DUTS Dataset | Pretrained Model on Synthetic Matting Dataset (update) |
---|---|---|---|
Google Drive | Link | Link | Link |
Baidu Wangpan |
Link |
Link |
Link |
We propose AIM-500 (Automatic Image Matting-500), the first natural image matting test set, which contains 500 high-resolution real-world natural images from all three types (SO, STM, NS), many categories, and the manually labeled alpha mattes. Some examples and the amount of each category are shown below. The AIM-500 dataset is published now, can be downloaded directly from Google Drive or Baidu Wangpan (pw: 0l69). Please make sure that you have read the agreement and agreed to it.
Portrait | Animal | Transparent | Plant | Furniture | Toy | Fruit |
---|---|---|---|---|---|---|
100 | 200 | 34 | 75 | 45 | 36 | 10 |
We test our network on different types of images in AIM-500 and compare with previous SOTA methods, the results are shown below. The code for testing and evaluating on AIM-500 can be checked in this code-base page.
Here we provide the procedure of testing on sample images by our pretrained model:
-
Setup environment following this instruction page;
-
Insert the path
REPOSITORY_ROOT_PATH
in the filecore/config.py
; -
Download the pretrained AimNet model from here (Google Drive|Baidu Wangpan (pw: evik)) and unzip to the folder
models/pretrained/
; -
Save your sample images in folder
samples/original/.
; -
Setup parameters in the file
scripts/test_samples.sh
and run by:chmod +x scripts/test_samples.sh
scripts/test_samples.sh
; -
The results of alpha matte and transparent color image will be saved in folder
samples/result_alpha/.
andsamples/result_color/.
.
We show some sample images from the internet, the predicted alpha mattes, and their transparent results as below. We use the pretrained model from section Network with Hybrid (1/2 & 1/4)
test strategy.
If you are interested in our work, please consider citing the following:
@inproceedings{ijcai2021-111,
title = {Deep Automatic Natural Image Matting},
author = {Li, Jizhizi and Zhang, Jing and Tao, Dacheng},
booktitle = {Proceedings of the Thirtieth International Joint Conference on
Artificial Intelligence, {IJCAI-21}},
publisher = {International Joint Conferences on Artificial Intelligence Organization},
editor = {Zhi-Hua Zhou},
pages = {800--806},
year = {2021},
month = {8},
note = {Main Track}
doi = {10.24963/ijcai.2021/111},
url = {https://doi.org/10.24963/ijcai.2021/111},
}
This project is under the MIT license. For further questions, please contact Jizhizi Li at jili8515@uni.sydney.edu.au.
[1] Privacy-Preserving Portrait Matting, ACM MM, 2021 | Paper | Github
Jizhizi Li∗, Sihan Ma∗, Jing Zhang, and Dacheng Tao
[2] Bridging Composite and Real: Towards End-to-end Deep Image Matting, IJCV, 2022 | Paper | Github
Jizhizi Li∗, Jing Zhang∗, Stephen J. Maybank, Dacheng Tao
[3] Referring Image Matting, CVPR, 2023 | Paper | Github
Jizhizi Li, Jing Zhang, and Dacheng Tao
[4] Rethinking Portrait Matting with Privacy Preserving, IJCV, 2023 | Paper | Github
Sihan Ma∗, Jizhizi Li∗, Jing Zhang, He Zhang, Dacheng Tao
[5] Deep Image Matting: A Comprehensive Survey, ArXiv, 2023 | Paper | Github
Jizhizi Li, Jing Zhang, and Dacheng Tao