All Projects → guanyingc → TOM-Net

guanyingc / TOM-Net

Licence: MIT License
TOM-Net: Learning Transparent Object Matting from a Single Image (CVPR 2018)

Programming Languages

lua
6591 projects
python
139335 projects - #7 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to TOM-Net

image-background-remove-tool
✂️ Automated high-quality background removal framework for an image using neural networks. ✂️
Stars: ✭ 767 (+936.49%)
Mutual labels:  torch, matting
gans-collection.torch
Torch implementation of various types of GAN (e.g. DCGAN, ALI, Context-encoder, DiscoGAN, CycleGAN, EBGAN, LSGAN)
Stars: ✭ 53 (-28.38%)
Mutual labels:  torch
P3M
[ACM MM 2021] Privacy-Preserving Portrait Matting
Stars: ✭ 81 (+9.46%)
Mutual labels:  matting
GodlyTorch
[NOT MAINTAINED] An app that can control the intensity of the torch of your rooted android device.
Stars: ✭ 16 (-78.38%)
Mutual labels:  torch
resnet.torch
an updated version of fb.resnet.torch with many changes.
Stars: ✭ 35 (-52.7%)
Mutual labels:  torch
vqa-soft
Accompanying code for "A Simple Loss Function for Improving the Convergence and Accuracy of Visual Question Answering Models" CVPR 2017 VQA workshop paper.
Stars: ✭ 14 (-81.08%)
Mutual labels:  torch
TorchGA
Train PyTorch Models using the Genetic Algorithm with PyGAD
Stars: ✭ 47 (-36.49%)
Mutual labels:  torch
chemicalx
A PyTorch and TorchDrug based deep learning library for drug pair scoring.
Stars: ✭ 176 (+137.84%)
Mutual labels:  torch
torch-asg
Auto Segmentation Criterion (ASG) implemented in pytorch
Stars: ✭ 42 (-43.24%)
Mutual labels:  torch
tensorsem
Structural Equation Modeling using Torch
Stars: ✭ 36 (-51.35%)
Mutual labels:  torch
DeepClassifier
DeepClassifier is aimed at building general text classification model library.It's easy and user-friendly to build any text classification task.
Stars: ✭ 25 (-66.22%)
Mutual labels:  torch
poisson-matting
Python implementation of Poisson matting method
Stars: ✭ 41 (-44.59%)
Mutual labels:  matting
photontorch
Highly parallel simulation and optimization of photonic circuits in time and frequency domain based on the deep-learning framework PyTorch
Stars: ✭ 29 (-60.81%)
Mutual labels:  torch
torch-lrcn
An implementation of the LRCN in Torch
Stars: ✭ 85 (+14.86%)
Mutual labels:  torch
pytorch-extras
Some extra features for pytorch.
Stars: ✭ 48 (-35.14%)
Mutual labels:  torch
neuralBlack
A Multi-Class Brain Tumor Classifier using Convolutional Neural Network with 99% Accuracy achieved by applying the method of Transfer Learning using Python and Pytorch Deep Learning Framework
Stars: ✭ 36 (-51.35%)
Mutual labels:  torch
Neural-Zoom
Infinite Zoom For Style Transfer
Stars: ✭ 34 (-54.05%)
Mutual labels:  torch
Amber
Amber-ify LED torch.
Stars: ✭ 26 (-64.86%)
Mutual labels:  torch
a-minimalist-guide
Walkthroughs for DSL, AirSim, the Vector Institute, and more
Stars: ✭ 37 (-50%)
Mutual labels:  torch
vak
a neural network toolbox for animal vocalizations and bioacoustics
Stars: ✭ 21 (-71.62%)
Mutual labels:  torch

TOM-Net

TOM-Net: Learning Transparent Object Matting from a Single Image, CVPR 2018 (Spotlight),
Guanying Chen*, Kai Han*, Kwan-Yee K. Wong
(* equal contribution)

This paper addresses the problem of transparent object matting from a single image.

Dependencies

TOM-Net is implemented in Torch and tested with Ubuntu 14.04. Please install Torch first following the official document.

  • python 2.7
  • numpy
  • cv2
  • CUDA-8.0
  • CUDNN v5.1
  • Torch STN (qassemoquab/stnbhwd)
    # Basic installation steps for stn
    git clone https://github.com/qassemoquab/stnbhwd.git
    cd stnbhwd
    luarocks make

Overview

We provide:

  • Pretrained model
  • Datasets: Train (40GB), Validation (196MB), Test (179MB)
  • Code to test model on new images
  • Evaluation code on both the validation and testing data
  • Instructions to train the model
  • Example code for synthetic data rendering
  • Code and models used in the journal extension (New!)

If the automatic downloading scripts are not working, please download the trained models and the introduced dataset from Google Drive (Models, Datasets).

Testing

Download Pretrained Model

sh scripts/download_pretrained_model.sh

If the above command is not working, please manually download the trained models from Google Drive (PS-FCN and UPS-FCN) and put them in ./data/models/.

Test on New Images

# Replace ${gpu} with the selected GPU ID (starting from 0)

# Test a single image without having the background image
CUDA_VISIBLE_DEVICES=${gpu} th eval/run_model.lua -input_img images/bull.jpg 

# You can find the results in data/TOM-Net_model/

Evaluation on Synthetic Validation Data

# Download synthetic validation dataset
sh scripts/download_validation_dataset.sh

# Quantitatively evaluate TOM-Net on different categories of synthetic object 
# Replace ${class} with one of the four object categories (glass, water, lens, cplx)
CUDA_VISIBLE_DEVICES=${gpu} th eval/run_synth_data.lua -img_list ${class}.txt

# Similarly, you can find the results in data/TOM-Net_model/

Evaluation on Real Testing Data

# Download real testing dataset, 
sh scripts/download_testing_dataset.sh

# Test on sample images used in the paper
CUDA_VISIBLE_DEVICES=${gpu} th eval/run_model.lua -img_list Sample_paper.txt

# Quantitatively evaluate TOM-Net on different categories of real-world object 
# Replace ${class} with one of the four object categories (Glass, Water, Lens, Cplx)
CUDA_VISIBLE_DEVICES=${gpu} th eval/run_model.lua -img_list ${class}.txt  

Training

To train a new TOM-Net model, please follow the following steps:

  • Download the training data
# The size of the zipped training dataset is 40 GB and you need about 207 GB to unzip it.
sh scripts/download_training_dataset.sh
  • Train CoarseNet on simple objects
CUDA_VISIBLE_DEVICES=$gpu th main.lua -train_list train_simple_98k.txt -nEpochs 13 -prefix 'simple'
# Please refer to opt.lua for more information about the training options

# You can find log file, checkpoints and visualization results in data/training/simple_*
  • Train CoarseNet on both simple and complex objects
# Finetune CoarseNet with all of the data
CUDA_VISIBLE_DEVICES=$gpu th main.lua -train_list train_all_178k.txt -nEpochs 7 -prefix 'all' -retrain data/training/simple_*/checkpointdir/checkpoint13.t7

# You can find log file, checkpoints and visualization results in data/training/all_*
  • Train RefineNet on both simple and complex objects
CUDA_VISIBLE_DEVICES=$gpu th refine/main_refine.lua -train_list train_all_178k.txt -nEpochs 20 -coarse_net data/training/all_*/checkpointdir/checkpoint7.t7 
# Train RefineNet with all of the data
# Please refer to refine/opt_refine.lua for more information about the training options

# You can find log file, checkpoints and visualization results in data/training/all_*/refinement/

Synthetic Data Rendering

Please refer to TOM-Net_Rendering for sample rendering codes.

Codes and Models Used in the Journal Extension (IJCV)

Test TOM-Net+Bg and TOM-Net+Trimap on Sample Images

# Download pretrained models
sh scripts/download_pretrained_models_IJCV.sh

# Test TOM-Net+Bg on sample images
CUDA_VISIBLE_DEVICES=${gpu} th eval/run_model.lua -input_root images/TOM-Net_with_Trimap_Bg_Samples/ -img_list img_bg_trimap_list.txt -in_bg -c_net data/TOM-Net_plus_Bg_Model/CoarseNet_plus_Bg.t7 -r_net data/TOM-Net_plus_Bg_Model/RefineNet_plus_Bg.t7 
# You can find the results in data/TOM-Net_plus_Bg_Model/*

# Test TOM-Net+Trimap on sample images
CUDA_VISIBLE_DEVICES=${gpu} th eval/run_model.lua -input_root images/TOM-Net_with_Trimap_Bg_Samples/ -img_list img_bg_trimap_list.txt -in_trimap -c_net data/TOM-Net_plus_Trimap_Model/CoarseNet_plus_Trimap.t7 -r_net data/TOM-Net_plus_Trimap_Model/RefineNet_plus_Trimap.t7 
# You can find the results in data/TOM-Net_plus_Trimap_Model/*

Train TOM-Net+Bg and TOM-Net+Trimap

To train a new TOM-Net+Bg or TOM-Net+Trimap model, please follow the same procedures as training TOM-Net, except that you need to append -in_bg or -in_trimap at the end of the commands.

Citation

If you find this code or the provided data useful in your research, please consider cite the following relevant paper(s):

@inproceedings{chen2018tomnet,
  title={TOM-Net: Learning Transparent Object Matting from a Single Image},
  author={Chen, Guanying and Han, Kai and Wong, Kwan-Yee K.},
  booktitle={CVPR},
  year={2018}
}

@inproceedings{chen2019LTOM,
  title={Learning Transparent Object Matting},
  author={Chen, Guanying and Han, Kai and Wong, Kwan-Yee K.},
  booktitle={IJCV},
  year={2019}
}
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].