OpenViSTAI · Agents · Blockchain · Crypto
Menu
Image & Video AI

Pytorch Deep Image Matting

Pytorch Deep Image Matting is a non-official Python and PyTorch implementation of deep image matting that predicts alpha mattes to estimate foreground opacity in images.

Independent OpenViST project profile, based on linked sources.

Pytorch Deep Image Matting — Local experimentation with foreground-opacity estimation
OpenViST project illustration. See the linked sources for product details.
Understand the project

Practical overview

When it fits

Use it when you need a code-based matting implementation and can work with its documented Python, PyTorch and OpenCV versions.

Who it is for

  • Computer-vision researchers studying image matting
  • Developers building or adapting image foreground-extraction workflows

Documented uses

  • Generate predicted alpha mattes from example images with the demo script.
  • Prepare composite training data and start training a matting model.
  • Test on the Adobe-1k Composite Dataset and evaluate results with SAD, MSE, gradient and connectivity metrics.
Before you choose

Requirements & limits

  • The README specifies Python 2.7.12 or 3.6.5, PyTorch 0.4.0 or 1.0.0, and OpenCV 3.4.3.
  • The reported stage1-our-skip training configuration uses a VGG-16 backbone with skip connection and requires at least 10 GB of GPU memory according to the README.
  • The Adobe Deep Image Matting Dataset is described as available by contacting its authors; MSCOCO-2017 and PASCAL-VOC-2012 are also listed as training sources.
  • The README reports model metrics and example predictions, but those measurements are repository-reported.

Check current requirements in the official documentation. Source-based guidance does not mean OpenViST has run or independently tested this project.

Source-based practical guide

Run the documented alpha-matte demo

Generate predicted alpha mattes using the repository demo.

Before you start

  • Python 2.7.12 or 3.6.5
  • PyTorch 0.4.0 or 1.0.0
  • OpenCV 3.4.3
  • A model file placed in ./model

Steps

  1. Place the model file in the repository's ./model directory.

  2. Run the command below.

    Documented command
    python core/demo.py

Expected outcome

Predicted alpha mattes are written to ./result/example/pred.

Guide limitations

  • The README does not provide a complete environment setup procedure.
  • The documented demo depends on a model file being available in ./model.
Source-based practical guide

Prepare composite training data and start training

Create composite data from the Adobe Deep Image Matting Dataset and begin model training.

Before you start

  • An extracted Adobe Deep Image Matting Dataset in the Combined_Dataset folder
  • Access to the Adobe dataset; the repository says to contact the authors for availability
  • Python and PyTorch versions specified by the repository

Steps

  1. Run the command below to create the composite training and test data.

    Documented command
    python tools/composite.py
  2. Run the command below to place the pretrained model at ./model/vgg_state_dict.pth.

    Documented command
    python tools/chg_model.py
  3. Run the command below to start training.

    Documented command
    bash train.sh

Expected outcome

The composite data is placed under Combined_Dataset/Training_set/comp and Combined_Dataset/Test_set/comp, and the training script is started.

Guide limitations

  • The repository notes GPU memory of at least 10 GB for its reported stage1-our-skip training run.
  • The README does not detail dataset acquisition beyond contacting the authors for the Adobe dataset.
Evidence and transparency

Sources & review

Source record details
Source availability
Active
Sources checked
20 November 2026
Original website title
huochaitiantang/pytorch-deep-image-matting · Official homepage title · retained in its source language