项目作者: foamliu

项目描述 :
a lightweight image matting model
高级语言: Python
项目地址: git://github.com/foamliu/Mobile-Image-Matting.git
创建时间: 2018-06-22T03:03:55Z
项目社区:https://github.com/foamliu/Mobile-Image-Matting

开源协议:MIT License

下载


Deep Mobile Matting

This is a lightweight image matting model in PyTorch.

Features

  1. MobileNetV2 as backbone.
  2. DeepLabv3 heads.
  3. Small model (size: 23.5MB, FLOPs: 11.39GB, total params: 7.62 millions)

Performance

  • 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

Dependencies

  • Python 3.6.8
  • PyTorch 1.3

Dataset

Adobe Deep Image Matting Dataset

Follow the instruction to contact author for the dataset.

MSCOCO

Go to MSCOCO to download:

PASCAL VOC

Go to PASCAL VOC to download:

Usage

Data Pre-processing

Extract training images:

  1. $ python pre_process.py
  2. # python data_gen.py

Train

  1. $ python train.py

If you want to visualize during training, run in your terminal:

  1. $ tensorboard --logdir runs

Experimental results

The Composition-1k testing dataset

  1. Test:
    1. $ python test.py

It prints out average SAD and MSE errors when finished.

Demo

Download pre-trained Deep Image Matting Link then run:

  1. $ python demo.py

Image/Trimap | Output/GT | New BG/Compose |
|—-|—-|—-|
|image | image | image |
|image | image | image|
|image | image | image |
|image | image | image|
|image | image | image |
|image | image | image|
|image | image | image |
|image | image | image|
|image | image | image |
|image | image | image|
|image | image | image |
|image | image | image|
|image | image | image |
|image | image | image|
|image | image | image |
|image | image | image|
|image | image | image |
|image | image | image|
|image | image | image |
|image | image | image|