This is a lightweight image matting model in PyTorch.
- MobileNetV2 as backbone.
- DeepLabv3 heads.
- Small model (size: 23.5MB, FLOPs: 11.39GB, total params: 7.62 millions)
- The Composition-1k testing dataset.
- Evaluate with whole image.
- SAD normalized by 1000.
- Input image is normalized with mean=[0.485, 0.456, 0.406] and std=[0.229, 0.224, 0.225].
- Both erode and dialte to generate trimap.
Models | SAD | MSE | Download |
---|---|---|---|
paper-stage0 | 59.6 | 0.019 | |
paper-stage1 | 54.6 | 0.017 | |
paper-stage3 | 50.4 | 0.014 | |
my-stage0 | 127.4 | 0.068 | Link |
- Python 3.6.8
- PyTorch 1.3
Follow the instruction to contact author for the dataset.
Go to MSCOCO to download:
Go to PASCAL VOC to download:
- VOC challenge 2008 training/validation data
- The test data for the VOC2008 challenge
Extract training images:
$ python pre_process.py
# python data_gen.py
$ python train.py
If you want to visualize during training, run in your terminal:
$ tensorboard --logdir runs
- Test:
$ python test.py
It prints out average SAD and MSE errors when finished.
Download pre-trained Deep Image Matting Link then run:
$ python demo.py
Image/Trimap | Output/GT | New BG/Compose |
---|---|---|