Skip to content

Simplified Deep Image Matting training code with keras on tensorflow

Notifications You must be signed in to change notification settings

adumrewal/imageMatting

Repository files navigation

Deep Image Matting

Image Matting. Given an image, the code in this project can separate its foreground and background components. This repository is to reproduce Deep image matting and is a modification to the codes used by foamliu.

History

Hi all, All of us must have tried finding available github codes to train a Deep Image Matting model. The most common repository we come across is foamliu's repo. The repository is no longer being maintained and the documentation doesn't seem to be sufficient to help with the training. In light of this, I have created this repository for Deep Image matting training in tensorflow which I shall maintain and help solve your problems. I have also added various functionalities in the train.py to help configure your training. I have made the training process very simple. All you need to do is run 'python train.py' and you are all set. Appropriate comments have been added to ensure you can tune the parameters according to your use. If you get stuck anywhere, feel free to reach out.

Dependencies

Dataset

Custom Dataset

  • Use the 'data' folder to provide the dataset
  • data/train_names.txt - Provide the names of the training files here. It will automatically detect the mask file names using the naming convention followed. You can refer to the existing sample data in the folders to know more.
  • data/valid_names.txt - Provide the names of the validation files here.
  • data/input - Contains the input files with merged foreground and background.
  • data/mask - Contains the binary mask for foregrounds.

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:

ImageNet Pretrained Models (Must-do)

Download VGG16 into "models" folder.

Results using the pre-trained model:

Download foamliu's pre-trained Deep Image Matting Model.

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