The official repository for Deep Image Matting with Flexible Guidance Input

Overview

FGI-Matting

The official repository for Deep Image Matting with Flexible Guidance Input.

Paper: https://arxiv.org/abs/2110.10898

image

all

Requirements

  • easydict
  • numpy
  • opencv-python
  • Pillow
  • PyQt5
  • scikit-image
  • scipy
  • toml
  • torch>=1.5.0
  • torchvision

Models and supplementary data for DIM test set(Composition-1k) and Distinctions-646 test set

Google drive: https://drive.google.com/drive/folders/13qnlXUSKS5HfkfvzdMKAv7FvJ6YV_wPK?usp=sharing
百度网盘: https://pan.baidu.com/s/1ZYcbwyCIrL6G9t7pkCIBYw 提取码: zjtj

  • Weight_DIM.pth The model trained with Adobe matting dataset.

  • Weight_D646.pth The model trained with Distincions-646 dataset.

  • DIM_test_supp_data.zip Scribblemaps and Clickmaps for DIM test set.

  • D-646_test_supp_data.zip Scribblemaps and Clickmaps for Distinctions-646 test set.

Place Weight_DIM.pth and Weight_D646.pth in ./checkpoints.
Edit ./config/FGI_config to modify the path of the testset and choose the checkpoint name.

Test on DIM test set(Composition-1k)

Methods SAD MSE Grad Conn
Trimap test 30.19 0.0061 13.07 26.66
Scribblemap test 32.86 0.0090 14.18 29.09
Clickmap test 34.67 0.0112 15.45 30.96
No guidance test 36.36 0.0141 15.23 32.76

"checkpoint" in ./config/FGI_config.toml should be "Weight_DIM".
bash test.sh
Modify "guidancemap_phase" in ./config/FGI_config.toml to test on trimap, scribblemap, clickmap and No_guidance.
For further test, please use the code in ./DIM_evaluation_code and the predicted alpha mattes in ./alpha_pred.

Test on Distinctions-646 test set(Not appear in the paper)

Methods SAD MSE Grad Conn
Trimap test 28.90 0.0105 24.67 27.40
Scribblemap test 33.22 0.0131 26.93 31.38
Clickmap test 34.97 0.0146 27.60 33.11
No guidance test 36.83 0.0156 28.28 34.90

"checkpoint" in ./config/FGI_config.toml should be "Weight_D646".
bash test.sh
Modify "guidancemap_phase" in ./config/FGI_config.toml to test on trimap, scribblemap, clickmap and No_guidance.
For further test, please use the code in ./DIM_evaluation_code and the predicted alpha mattes in ./alpha_pred.

The QT Demo

Copy one of the pth file and rename it "Weight_qt_in_use.pth", also place it in ./checkpoints.
Run test_one_img_qt.py. Try images in ./testimg. It will use GPU if avaliable, otherwise it will use CPU.

demo

I recommend to use the one trained on DIM dataset.
Have fun :D

Acknowledgment

GCA-Matting: https://github.com/Yaoyi-Li/GCA-Matting

You might also like...
Github project for Attention-guided Temporal Coherent Video Object Matting.

Attention-guided Temporal Coherent Video Object Matting This is the Github project for our paper Attention-guided Temporal Coherent Video Object Matti

Robust Video Matting in PyTorch, TensorFlow, TensorFlow.js, ONNX, CoreML!
Robust Video Matting in PyTorch, TensorFlow, TensorFlow.js, ONNX, CoreML!

Robust Video Matting in PyTorch, TensorFlow, TensorFlow.js, ONNX, CoreML!

Robust Video Matting in PyTorch, TensorFlow, TensorFlow.js, ONNX, CoreML!
Robust Video Matting in PyTorch, TensorFlow, TensorFlow.js, ONNX, CoreML!

Robust Video Matting (RVM) English | 中文 Official repository for the paper Robust High-Resolution Video Matting with Temporal Guidance. RVM is specific

 MODNet: Trimap-Free Portrait Matting in Real Time
MODNet: Trimap-Free Portrait Matting in Real Time

MODNet is a model for real-time portrait matting with only RGB image input.

Real-Time High-Resolution Background Matting
Real-Time High-Resolution Background Matting

Real-Time High-Resolution Background Matting Official repository for the paper Real-Time High-Resolution Background Matting. Our model requires captur

Video Matting Refinement For Python

Video-matting refinement Library (use pip to install) scikit-image numpy av matplotlib Run Static background python path_to_video.mp4 Moving backgroun

Rethinking Portrait Matting with Privacy Preserving
Rethinking Portrait Matting with Privacy Preserving

Rethinking Portrait Matting with Privacy Preserving This is the official repository of the paper Rethinking Portrait Matting with Privacy Preserving.

Self-Attention Between Datapoints: Going Beyond Individual Input-Output Pairs in Deep Learning

We challenge a common assumption underlying most supervised deep learning: that a model makes a prediction depending only on its parameters and the features of a single input. To this end, we introduce a general-purpose deep learning architecture that takes as input the entire dataset instead of processing one datapoint at a time.

SpinalNet: Deep Neural Network with Gradual Input
SpinalNet: Deep Neural Network with Gradual Input

SpinalNet: Deep Neural Network with Gradual Input This repository contains scripts for training different variations of the SpinalNet and its counterp

Comments
  • Potential stuck in generating flex trimap

    Potential stuck in generating flex trimap

    Hi,

    During the training process, sometimes I found that my flex trimap generation step gets stuck forever. This issue takes place randomly which makes it hard to debug. Have you met similar problem during training?

    And, I am wondering when will the training code be released?

    Thanks for answering in advance.

    opened by WANGEOGEO 1
  • Variation of line thickness

    Variation of line thickness

    Hi,

    After reading through the code, I found that there is no specific pipeline showing how the 'thickness' of lines drawing through points are varied during training. To my understanding, there will be 5 levels of thickness: 600, 260, 140, 80 and 40. As the training goes on, when a specific iteration number is reached, the thickness will be changed to next level (from 600->260 directly for example). Is my understanding correct?

    opened by WANGEOGEO 4
  • Question about threshold of 50 pixels

    Question about threshold of 50 pixels

    Hi,

    Awesome work for introducing different forms of trimaps into training! After reading through the code implementation, there is one point I'm not sure about. In 3.1.2 'Simulating User Scribbles', it says 'To avoid the points being too close to each other, we set a threshold of 50 pixels between each two points'. After going through code in dataloader/Test_dataset/data_generator.py, class Genclickmap, seems there is no strict constraint applied on the distances between randomly selected fg points and bg points. I am not sure if I have missed some stuff, hope someone could help me. Thanks in advance.

    opened by WANGEOGEO 4
  • Which version of `torchvision` is needed?

    Which version of `torchvision` is needed?

    For a fresh conda environment, torchvision is needed. but after installing the v0.11.1 of torchvision, Stderr raised No module named 'torchvision.models.utils' error. So, which version of torchvision is required?

    opened by km4sh 3
Owner
Hang Cheng
Hang Cheng
[IJCAI'21] Deep Automatic Natural Image Matting

Deep Automatic Natural Image Matting [IJCAI-21] This is the official repository of the paper Deep Automatic Natural Image Matting. Introduction | Netw

Jizhizi_Li 316 Jan 6, 2023
Very simple NCHW and NHWC conversion tool for ONNX. Change to the specified input order for each and every input OP. Also, change the channel order of RGB and BGR. Simple Channel Converter for ONNX.

scc4onnx Very simple NCHW and NHWC conversion tool for ONNX. Change to the specified input order for each and every input OP. Also, change the channel

Katsuya Hyodo 16 Dec 22, 2022
UMT is a unified and flexible framework which can handle different input modality combinations, and output video moment retrieval and/or highlight detection results.

Unified Multi-modal Transformers This repository maintains the official implementation of the paper UMT: Unified Multi-modal Transformers for Joint Vi

Applied Research Center (ARC), Tencent PCG 84 Jan 4, 2023
Reviving Iterative Training with Mask Guidance for Interactive Segmentation

This repository provides the source code for training and testing state-of-the-art click-based interactive segmentation models with the official PyTorch implementation

Visual Understanding Lab @ Samsung AI Center Moscow 406 Jan 1, 2023
Learning Calibrated-Guidance for Object Detection in Aerial Images

Learning Calibrated-Guidance for Object Detection in Aerial Images arxiv We propose a simple yet effective Calibrated-Guidance (CG) scheme to enhance

null 51 Sep 22, 2022
dualFace: Two-Stage Drawing Guidance for Freehand Portrait Sketching (CVMJ)

dualFace dualFace: Two-Stage Drawing Guidance for Freehand Portrait Sketching (CVMJ) We provide python implementations for our CVM 2021 paper "dualFac

Haoran XIE 46 Nov 10, 2022
Exploring Versatile Prior for Human Motion via Motion Frequency Guidance (3DV2021)

Exploring Versatile Prior for Human Motion via Motion Frequency Guidance This is the codebase for video-based human motion reconstruction in human-mot

Jiachen Xu 5 Jul 14, 2022
Edge-aware Guidance Fusion Network for RGB-Thermal Scene Parsing

EGFNet Edge-aware Guidance Fusion Network for RGB-Thermal Scene Parsing Dataset and Results Test maps: 百度网盘 提取码:zust Citation @ARTICLE{ author={Zhou,

ShaohuaDong 10 Dec 8, 2022
A fast poisson image editing implementation that can utilize multi-core CPU or GPU to handle a high-resolution image input.

Poisson Image Editing - A Parallel Implementation Jiayi Weng (jiayiwen), Zixu Chen (zixuc) Poisson Image Editing is a technique that can fuse two imag

Jiayi Weng 110 Dec 27, 2022
PyMatting: A Python Library for Alpha Matting

Given an input image and a hand-drawn trimap (top row), alpha matting estimates the alpha channel of a foreground object which can then be composed onto a different background (bottom row).

PyMatting 1.4k Dec 30, 2022