All Projects → CDOTAD → Alphagan Matting

CDOTAD / Alphagan Matting

Licence: apache-2.0
This project is an unofficial implementation of AlphaGAN: Generative adversarial networks for natural image matting published at the BMVC 2018

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Alphagan Matting

The Gan Zoo
A list of all named GANs!
Stars: ✭ 11,454 (+8200%)
Mutual labels:  gan
Mlds2018spring
Machine Learning and having it Deep and Structured (MLDS) in 2018 spring
Stars: ✭ 124 (-10.14%)
Mutual labels:  gan
Gandissect
Pytorch-based tools for visualizing and understanding the neurons of a GAN. https://gandissect.csail.mit.edu/
Stars: ✭ 1,700 (+1131.88%)
Mutual labels:  gan
Pi Rec
🔥 PI-REC: Progressive Image Reconstruction Network With Edge and Color Domain. 🔥 图像翻译,条件GAN,AI绘画
Stars: ✭ 1,619 (+1073.19%)
Mutual labels:  gan
Gdwct
Official PyTorch implementation of GDWCT (CVPR 2019, oral)
Stars: ✭ 122 (-11.59%)
Mutual labels:  gan
Reconstructing faces from voices
An example of the paper "reconstructing faces from voices"
Stars: ✭ 127 (-7.97%)
Mutual labels:  gan
Msg Gan V1
MSG-GAN: Multi-Scale Gradients GAN (Architecture inspired from ProGAN but doesn't use layer-wise growing)
Stars: ✭ 116 (-15.94%)
Mutual labels:  gan
Oneshottranslation
Pytorch implementation of "One-Shot Unsupervised Cross Domain Translation" NIPS 2018
Stars: ✭ 135 (-2.17%)
Mutual labels:  gan
Tensorflow Mnist Cgan Cdcgan
Tensorflow implementation of conditional Generative Adversarial Networks (cGAN) and conditional Deep Convolutional Adversarial Networks (cDCGAN) for MANIST dataset.
Stars: ✭ 122 (-11.59%)
Mutual labels:  gan
Electra
中文 预训练 ELECTRA 模型: 基于对抗学习 pretrain Chinese Model
Stars: ✭ 132 (-4.35%)
Mutual labels:  gan
Nucleisegmentation
cGAN-based Multi Organ Nuclei Segmentation
Stars: ✭ 120 (-13.04%)
Mutual labels:  gan
Capsule Gan
Code for my Master thesis on "Capsule Architecture as a Discriminator in Generative Adversarial Networks".
Stars: ✭ 120 (-13.04%)
Mutual labels:  gan
Awesome Gan For Medical Imaging
Awesome GAN for Medical Imaging
Stars: ✭ 1,814 (+1214.49%)
Mutual labels:  gan
O Gan
O-GAN: Extremely Concise Approach for Auto-Encoding Generative Adversarial Networks
Stars: ✭ 117 (-15.22%)
Mutual labels:  gan
Combogan
Stars: ✭ 134 (-2.9%)
Mutual labels:  gan
Vae Gan Tensorflow
Tensorflow code of "autoencoding beyond pixels using a learned similarity metric"
Stars: ✭ 116 (-15.94%)
Mutual labels:  gan
Cyclegan
Software that can generate photos from paintings, turn horses into zebras, perform style transfer, and more.
Stars: ✭ 10,933 (+7822.46%)
Mutual labels:  gan
Infogan Pytorch
implement infoGAN using pytorch
Stars: ✭ 135 (-2.17%)
Mutual labels:  gan
Deep Learning With Python
Example projects I completed to understand Deep Learning techniques with Tensorflow. Please note that I do no longer maintain this repository.
Stars: ✭ 134 (-2.9%)
Mutual labels:  gan
Ganimation
GANimation: Anatomically-aware Facial Animation from a Single Image (ECCV'18 Oral) [PyTorch]
Stars: ✭ 1,730 (+1153.62%)
Mutual labels:  gan

AlphaGAN

This project is an unofficial implementation of AlphaGAN: Generative adversarial networks for natural image matting published at the BMVC 2018. As for now, the result of my experiment is not as good as the paper's.

Dataset

Adobe Deep Image Matting Dataset

Follow the instruction to contact the author for the dataset

You might need to follow the method mentioned in the Deep Image Matting to generate the trimap using the alpha mat.

The trimap are generated while the data are loaded.

import numpy as np
import cv2 as cv

def generate_trimap(alpha):
   k_size = random.choice(range(2, 5))
   iterations = np.random.randint(5, 15)
   kernel = cv.getStructuringElement(cv.MORPH_ELLIPSE, (k_size, k_size))
   dilated = cv.dilate(alpha, kernel, iterations=iterations)
   eroded = cv.erode(alpha, kernel, iterations=iterations)
   trimap = np.zeros(alpha.shape, dtype=np.uint8)
   trimap.fill(128)

   trimap[eroded >= 255] = 255
   trimap[dilated <= 0] = 0

   return trimap

See scripts/MattingTrain.ipynb and scripts/MattingTest.ipynb to compose the training/testing set.

The Dataset structure in my project

Train
  ├── alpha  # the alpha ground-truth
  ├── fg     # the foreground image
  ├── merged_cv  # the real image composed by the fg & bg
MSCOCO
  ├── train2014 # the background image

Running the Codes

   python train.py --dataroot ${YOUR_DIM_DATASET_ROOT} \
                     --training_file ${THE TRAINING FILE OF THE DIM DATASET}

Differences from the original paper

  • SyncBatchNorm instead of pytorch original BatchNorm when use multi GPU.

  • Training batch_size = 1 [1] [2]

  • Using GroupNorm [2]

  • Using Warmup [3] [4]

Records

4 GPUS 32 batch size, and SyncBatchNorm

  • Achieved SAD=78.22 after 21 epoches.

1 GPU 1 batch size, and GroupNorm

Results

image trimap alpha(predicted)

Acknowledgments

My code is inspired by:

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].