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.
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.
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
Place the model file in the repository's ./model directory.
Run the command below.
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.
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
Run the command below to create the composite training and test data.
python tools/composite.pyRun the command below to place the pretrained model at ./model/vgg_state_dict.pth.
python tools/chg_model.pyRun the command below to start training.
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.
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

