/Click2Trimap

Primary LanguagePythonMIT LicenseMIT

Learning Trimaps via Clicks for Image Matting

Chenyi Zhang, Yihan Hu, Henghui Ding, Humphrey Shi, Yao Zhao, Yunchao Wei

drawing

Quick Installation

Our demo is developed in : Python3.8, PyTorch 1.10.1, CUDA 11.3.

Run the following command to install required packages. You can refer to the issues of RITM, SimpleClick and AEMatter if you run into problems.

pip3 install -r requirements.txt

Demo

drawing

drawing

drawing

A command to run the demo.

python3 demo.py --checkpoint-c2t='path to click2trimap checkpoint' --checkpoint-matting='path to matting model checkpoint'

Images can be found here.

Guidelines of Clicking

drawing

Tip 1:
Click the left mouse button on foreground region.
Click the roll mouse button on unknown region.
Click the right mouse button on background region.

Tip 2:
Refer to the gif for how to provide appropriate clicks.

Tip 3:
Using images with high resolutions leads to longer waiting time and might even run out of memory.

Download

Checkpoints:

Click2Trimap: Google Drive

Matting Model: AEMatter

We choose AEMatter as our trimap-based matting model in this demo because of its excellent performance and friendly memory usage. But it's also convenient to switch to any other trimap-based matting model if you want.

To do list

  • Web UI
  • HuggingFace Demo
  • ...

License

The code is released under the MIT License. It is a short, permissive software license. Basically, you can do whatever you want as long as you include the original copyright and license notice in any copy of the software/source.

Citation

@misc{zhang2024learning,
      title={Learning Trimaps via Clicks for Image Matting}, 
      author={Chenyi Zhang and Yihan Hu and Henghui Ding and Humphrey Shi and Yao Zhao and Yunchao Wei},
      year={2024},
      eprint={2404.00335},
      archivePrefix={arXiv},
      primaryClass={cs.CV}
}

Acknowledgement

Our project is developed based on RITM, SimpleClick and AEMatter. Thanks for their nice demo GUI and wonderful work!