Skip to content

JizhiziLi/GFM

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bridging Composite and Real: Towards End-to-end Deep Image Matting [IJCV-2022]

This is the official repository of the paper Bridging Composite and Real: Towards End-to-end Deep Image Matting.

Jizhizi Li1∗, Jing Zhang1∗, Stephen J. Maybank2, and Dacheng Tao1
1 The University of Sydney, Sydney, Australia; 2 Birkbeck College, University of London, U.K.
IJCV 2022 (DOI 10.1007/s11263-021-01541-0)

Google Colab Demo | Introduction | GFM | AM-2k | BG-20k | Results Demo | Train and Test | Inference Code | Statement


🚀 News

[2021-11-12]: The training code, test code and all the pretrained models are released in this code-base page.

[2021-10-22]: The paper has been accepted by the International Journal of Computer Vision (IJCV)! 🎉

[2021-09-21]: The datasets AM-2k and BG-20k can now be openly accessed from the links below (both at Google Drive and at Baidu Wangpan) ! Please follow the dataset release agreements to access. Due to some privacy issues, the dataset PM-10k will be published after privacy-preserving from the project Privacy-Preserving Portrait Matting (ACM MM 21). You can refer to this repo for access and updates.

Dataset

Dataset Link
(Google Drive)

Dataset Link
(Baidu Wangpan 百度网盘)

Dataset Release Agreement
AM-2k Link Link (pw: 29r1) Agreement (MIT License)
BG-20k Link Link (pw: dffp) Agreement (MIT License)

[2020-11-17]: Create Google Colab demo to benefit users who want to have a try online.

[2020-11-03]: Publish the inference code and a pretrained model that can be used to test on your own animal images.

[2020-10-27]: Publish a video demo (YouTube | bilibili | Google drive) contains motivation, network, datasets, and test results on an animal video.

Demo on Google Colab

For those who do not have GPUs in their environment or only want to have a simple try online, you can try our Google Colab demo to generate the results for your images easily.

Introduction

This repository contains the code, datasets, models, test results and a video demo for the paper Bridging Composite and Real: Towards End-to-end Deep Image Matting. We propose a novel Glance and Focus Matting network (GFM), which employs a shared encoder and two separate decoders to learn both tasks in a collaborative manner for end-to-end image matting. We also establish a novel Animal Matting dataset (AM-2k) to serve for end-to-end matting task. Furthermore, we investigate the domain gap issue between composition images and natural images systematically, propose a carefully designed composite route RSSN and a large-scale high-resolution background dataset (BG-20k) to serve as better candidates for composition.

We have released the train code, the test code, the datasets, and the pretrained models in this code-base page. We have also prepared a Google Colab demo and inference code for you to test on our pre-trained models on your own sample images. For the datasets AM-2k and BG-20k, please follow the sections AM-2k and BG-20k to access. Besides, we prepare a video demo (YouTube | bilibili) to illustrate the motivation, the network, the datasets, and the test results on an animal video

GFM

The architecture of our proposed end-to-end method GFM is illustrated below. We adopt three kinds of Representation of Semantic and Transition Area (RoSTa) -TT, -FT, -BT within our method.

We trained GFM with four backbones, -(r) (ResNet-34), -(d) (DenseNet-121), -(r2b) (ResNet-34 with 2 extra blocks), and -(r') (ResNet-101). The trained model for each backbone can be downloaded via the link listed below.

Model GFM(d)-TT GFM(r)-TT GFM(r)-FT GFM(r)-BT GFM(r2b)-TT GFM(r')-TT GFM(d)-RIM
Google Drive Link Link Link Link Link Link Link

Baidu Wangpan
(百度网盘)

Link
(pw: l6bd)

Link
(pw: svcv)

Link
(pw: jfli)

Link
(pw: 80k8)

Link
(pw: 34hf)

Link
(pw: 7p8j)

Link
(pw: mrf7)

AM-2k

Our proposed AM-2k contains 2,000 high-resolution natural animal images from 20 categories along with manually labeled alpha mattes. Some examples are shown as below, more can be viewed in the video demo (YouTube | bilibili | Google drive).

AM-2k can be accessed from here (Google Drive | Baidu Wangpan (pw: 29r1)), please make sure that you have read this agreement before accessing the dataset. Please refer to the readme.txt in the dataset folder for more details.

BG-20k

Our proposed BG-20k contains 20,000 high-resolution background images excluded salient objects, which can be used to help generate high quality synthetic data. Some examples are shown as below, more can be viewed in the video demo (YouTube | bilibili | Google drive).

BG-20k can be accessed from here (Google Drive | Baidu Wangpan (pw: dffp)), please make sure that you have read this agreement before accessing the dataset. Please refer to the readme.txt in the dataset folder for more details.

Results Demo

We test GFM on our AM-2k test dataset and show the results as below. More results on AM-2k test set can be found here.

Inference Code - How to Test on Your Images

Here we provide the procedure of testing on sample images by our pretrained models:

  1. Setup environment following this instruction page.

  2. Download pretrained models as shown in section GFM, unzip to the folder models/pretrained/

  3. Save your high-resolution sample images in folder samples/original/.

  4. Setup parameters in scripts/test/test_samples.sh and run it

    chmod +x scripts/*

    ./scripts/test/test_samples.sh

  5. The results of alpha matte and transparent color image will be saved in folder samples/result_alpha/. and samples/result_color/.

We show some sample images from the internet, the predicted alpha mattes, and their transparent results as below. We adopt backbone='r34_2b', rosta=TT, hybrid testing strategy and the pretrained model (Google Drive | Baidu Wangpan (pw: 34hf)) for this case.

Statement

If you are interested in our work, please consider citing the following:

@article{li2022bridging,
  title={Bridging composite and real: towards end-to-end deep image matting},
  author={Li, Jizhizi and Zhang, Jing and Maybank, Stephen J and Tao, Dacheng},
  journal={International Journal of Computer Vision},
  volume={130},
  number={2},
  pages={246--266},
  year={2022},
  publisher={Springer}
}

This project is under the MIT license. For further questions, please contact Jizhizi Li at [email protected].

Relevant Projects

[1] Deep Automatic Natural Image Matting, IJCAI, 2021 | Paper | Github
     Jizhizi Li, Jing Zhang, and Dacheng Tao

[2] Privacy-Preserving Portrait Matting, ACM MM, 2021 | Paper | Github
     Jizhizi Li, Sihan Ma, Jing Zhang, and 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