Implementation of "Automatic Portrait Segmentation" and "Deep Automatic Portrait Matting" with Chainer.
Deep Automatic Portrait Matting and Automatic Portrait Segmentation for Image Stylization implementation which predicts alpha or binary masks of portrait images automatically.
This is NOT official implementation.
This software is released under the GPL License except data_original
directory.
Data under data_original
directory is copied from the paper author's.
Rights of the data belong to them.
We created our original alpha masks and the following results are generated by them.
Training data which is contained this repository is binary mask for segmentation created by paper's author.
For training of trimap and matting, extra alpha masks are needed.
# Download images from the internet.
$ python scripts/prepare_seg_dataset.py
# Generate mean masks and grids.
$ python scripts/prepare_seg_plus_dataset.py
# Generate trimaps from alpha masks. (extra alpha mask are needed)
$ python scripts/prepare_seg_tri_dataset.py
# Computes loss weight matrixs. (extra alpha mask are needed)
$ python scripts/prepare_matting_dataset.py
$ python scripts/train.py --mode {seg,seg+,seg_tri,mat}
$ python scripts/train.py --mode {seg,seg+,seg_tri,mat} --model_path <path> -i <image path>
First column is input image. Second column is output alpha mask. Third column is background replacement result.