All Projects → PeterL1n → BackgroundMattingV2-TensorFlow

PeterL1n / BackgroundMattingV2-TensorFlow

Licence: MIT license
TensorFlow implementation of Real-Time High-Resolution Background Matting

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to BackgroundMattingV2-TensorFlow

knn-matting
Python implementation of KNN Matting, CVPR 2012 / TPAMI 2013 http://dingzeyu.li/projects/knn/
Stars: ✭ 125 (+66.67%)
Mutual labels:  matting
RobustVideoMatting
Robust Video Matting in PyTorch, TensorFlow, TensorFlow.js, ONNX, CoreML!
Stars: ✭ 6,889 (+9085.33%)
Mutual labels:  matting
Mmediting
OpenMMLab Image and Video Editing Toolbox
Stars: ✭ 2,618 (+3390.67%)
Mutual labels:  matting
Backgroundmattingv2
Real-Time High-Resolution Background Matting
Stars: ✭ 5,155 (+6773.33%)
Mutual labels:  matting
TOM-Net
TOM-Net: Learning Transparent Object Matting from a Single Image (CVPR 2018)
Stars: ✭ 74 (-1.33%)
Mutual labels:  matting
lite.ai.toolkit
🛠 A lite C++ toolkit of awesome AI models with ONNXRuntime, NCNN, MNN and TNN. YOLOX, YOLOP, MODNet, YOLOR, NanoDet, YOLOX, SCRFD, YOLOX . MNN, NCNN, TNN, ONNXRuntime, CPU/GPU.
Stars: ✭ 1,354 (+1705.33%)
Mutual labels:  matting
poisson-matting
Python implementation of Poisson matting method
Stars: ✭ 41 (-45.33%)
Mutual labels:  matting
P3M
[ACM MM 2021] Privacy-Preserving Portrait Matting
Stars: ✭ 81 (+8%)
Mutual labels:  matting
Segmentation-Series-Chaos
Summary and experiment includes basic segmentation, human segmentation, human or portrait matting for both image and video.
Stars: ✭ 75 (+0%)
Mutual labels:  matting
DeepInteractiveSegmentation
Getting to 99% Accuracy in Interactive Segmentation and Interactive Training and Architecture for Deep Object Selection
Stars: ✭ 99 (+32%)
Mutual labels:  matting
Manual-Greenscreen-Matting
Greenscreen Matting done on still images and videos
Stars: ✭ 15 (-80%)
Mutual labels:  matting
image-background-remove-tool
✂️ Automated high-quality background removal framework for an image using neural networks. ✂️
Stars: ✭ 767 (+922.67%)
Mutual labels:  matting

Real-Time High-Resolution Background Matting (TensorFlow)

This repo contains TensorFlow 2 implementation of Real-Time High-Resolution Background Matting. For more information and downloading the weights, please visit our official repo.

The TensorFlow implementation is experimental. We find PyTorch to have faster inference speed and suggest you to use the official PyTorch version whenever possible.

Use our model

We reimplement our model natively in TensorFlow 2 and provide a script to load PyTorch weights directly into the TensorFlow model.

import tensorflow as tf
import torch # For loading PyTorch weights.

from model import MattingRefine, load_torch_weights

# Enable mixed precision, it reduces memory and may make model inference faster.
tf.config.optimizer.set_experimental_options({"auto_mixed_precision": True})

# Create TensorFlow model
model = MattingRefine(backbone='resnet50',
                      backbone_scale=0.25,
                      refine_mode='sampling',
                      refine_sample_pixels=80000)

# Load PyTorch weights into TensorFlow model.
load_torch_weights(model, torch.load('PATH_TO_PYTORCH_WEIGHTS.pth'))

src = tf.random.normal((1, 1080, 1920, 3))
bgr = tf.random.normal((1, 1080, 1920, 3))

# Faster inference with tf.function
# Note that at the first time the model run with
# tf.function will be slow.
model = tf.function(model, experimental_relax_shapes=True)

pha, fgr = model([src, bgr], training=False)[:2]

Download weights

Please visit the official repo for detail.

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].