A Trimap-Free Portrait Matting Solution in Real Time [AAAI 2022]
Go to file
kevin 5da2bb6c81 support TorchScript 2021-03-12 17:10:47 +08:00
demo add ONNX version of MODNet 2021-02-19 14:48:22 +08:00
doc/gif update README 2020-12-16 01:03:02 +08:00
onnx add ONNX version of MODNet 2021-02-19 14:48:22 +08:00
pretrained upload portrait image/video matting demos of MODNet 2020-12-10 18:36:07 +08:00
src support TorchScript 2021-03-12 17:10:47 +08:00
torchscript support TorchScript 2021-03-12 17:10:47 +08:00
.gitignore add ONNX version of MODNet 2021-02-19 14:48:22 +08:00
README.md support TorchScript 2021-03-12 17:10:47 +08:00

README.md

MODNet: Is a Green Screen Really Necessary for Real-Time Portrait Matting?

Arxiv Preprint | Supplementary Video

WebCam Video Demo [Offline][Colab] | Custom Video Demo [Offline] | Image Demo [WebGUI][Colab]

This is the official project of our paper Is a Green Screen Really Necessary for Real-Time Portrait Matting?
MODNet is a trimap-free model for portrait matting in real time under changing scenes.

News

Demos

Video Matting

We provide two real-time portrait video matting demos based on WebCam. When using the demo, you can move the WebCam around at will. If you have an Ubuntu system, we recommend you to try the offline demo to get a higher fps. Otherwise, you can access the online Colab demo.
We also provide an offline demo that allows you to process custom videos.

Image Matting

We provide an online Colab demo for portrait image matting.
It allows you to upload portrait images and predict/visualize/download the alpha mattes.

Community

Here we share some cool applications/extentions of MODNet built by the community.

  • WebGUI for Image Matting
    You can try this WebGUI (hosted on Gradio) for portrait matting from your browser without code!
  • Colab Demo of Bokeh (Blur Background)
    You can try this Colab demo (built by @eyaler) to blur the backgroud based on MODNet!

  • ONNX Version of MODNet
    You can convert the pre-trained MODNet to an ONNX model by using this code (provided by @manthan3C273). You can also try this Colab demo for MODNet image matting (ONNX version).

  • TorchScript Version of MODNet
    You can convert the pre-trained MODNet to an TorchScript model by using this code (provided by @yarkable).

Code

We provide the code of MODNet training iteration, including:

  • Supervised Training: Train MODNet on a labeled matting dataset
  • SOC Adaptation: Adapt a trained MODNet to an unlabeled dataset

In the function comments, we provide examples of how to call the function.

TODO

  • Release the code of One-Frame Delay
  • Release PPM-100 validation benchmark (Delayed, But On The Way...)
    NOTE: PPM-100 is a validation set. Our training set will not be published.

License

This project (code, pre-trained models, demos, etc.) is released under the Creative Commons Attribution NonCommercial ShareAlike 4.0 license.

NOTE: The license will be changed to allow commercial use after this work is accepted by a conference or a journal.

Acknowledgement

Citation

If this work helps your research, please consider to cite:

@article{MODNet,
  author = {Zhanghan Ke and Kaican Li and Yurou Zhou and Qiuhua Wu and Xiangyu Mao and Qiong Yan and Rynson W.H. Lau},
  title = {Is a Green Screen Really Necessary for Real-Time Portrait Matting?},
  journal={ArXiv},
  volume={abs/2011.11961},
  year = {2020},
}

Contact

This project is currently maintained by Zhanghan Ke (@ZHKKKe).
If you have any questions, please feel free to contact kezhanghan@outlook.com.