pytorch-deep-image-matting

This repository includes the non-official pytorch implementation of deep image matting.

Performance

model SAD MSE Grad Conn link
paper-stage1 54.6 0.017 36.7 55.3
my-stage1 57.1 0.017 36.1 58.3 download
  • Training batch=1, images=43100, epochs=12.
  • Test maxSize=1600.

Installation

  • Python 2.7.12 or 3.6.5
  • Pytorch 0.4.0 or 1.0.0
  • OpenCV 3.4.3

Demo

Download our model to the ./model and run the following command. Then the predict alpha mattes will locate in the folder ./result/example/pred.

python core/demo.py

Training

Adobe-Deep-Image-Matting-Dataset

Please concat author for available.

MSCOCO-2017-Train-Dataset

Download

PASCAL-VOC-2012

Download

Composite-Dataset

Run the following command and the composite training and test dataset will locate in Combined_Dataset/Training_set/comp and Combined_Dataset/Test_set/comp, Combined_Dataset is the extracted folder of Adobe-Deep-Image-Matting-Dataset

python tools/composite.py

Pretrained-Model

Run the following command and the pretrained model will locate in ./model/vgg_state_dict.pth

python tools/chg_model.py

Start Training

Run the following command and start the training

bash train.sh

Test

Run the following command and start the test of Adobe-1k-Composite-Dataset

bash deploy.sh

Evaluation

Plead eval with official Matlab Code. and get the SAD, MSE, Grad Conn.

Visualization

Running model is Stage1-SAD=57.1, please click to view whole images.

Image Trimap Pred-Alpha GT-Alpha
image image image image
image image image image
image image image image
image image image image
image image image image

GitHub