Deep Image Matting : A machine learning model to perform accurate image matting
This is an introduction to「Deep Image Matting」, a machine learning model that can be used with ailia SDK. You can easily use this model to create AI applications using ailia SDK as well as many other ready-to-use ailia MODELS.
Image matting refers to the problem of extracting interesting targets, usually objects in the foreground, from a static image or a video sequence, which has played an important role in many image and video editing applications.
Deep Image Matting is a machine learning model to perform highly accurate foreground estimation that was announced in April 2017.
Deep Image Matting
Image matting is a fundamental computer vision problem and has many applications. Previous algorithms have poor…
Deep Image Matting performs foreground estimation with high accuracy using
TRIMAP images as input, where
TRIMAP is an image with value is set to 255 for foreground objects, 0 for the background, and 127 for areas where it is unclear whether it is part of the foreground or the background.
TRIMAPs are usually created manually or from depth cameras, but in recent years they can also be generated by segmentation models.
Just in case you are interested, Deep Image Matting v2 is an upgraded version of this. This repository is to reproduce…
Input and output of Deep Image Matting
Below is an example of input image.
The corresponding TRIMAP
And the final result image.
Since Deep Image Matting has been trained on 320x320 resolution images, the resolution of the output will also be 320x320.
Usage in ailia SDK
You can run Deep Image Matting in ailia SDK with the following command, which outputs a PNG with an alpha channel by supplying an RGB image and a TRIMAP image as arguments.
python3 deep-image-matting.py -i image.png -t trimap.png
ailia-models/background_removal/deep-image-matting at master · axinc-ai/ailia-models
input image input trimap (from…
In the ailia SDK, the TRIMAP can also be automatically generated. Provide an empty string as a TRIMAP argument to use Deep Image Matting in conjunction with a segmentation model to automatically generate the TRIMAP.
python3 deep-image-matting.py -i pixaboy.jpg -t “”
Below are the different steps performed internally to generate the TRIMAP on the following input image.
DeeplabV3 is used to perform the automated segmentation.
Below is the result after binarization.
Then the TRIMAP is generated using
And the final Deep Image Matting model output.