﻿# ViTMatte alpha output: a trimap-guided matte is not a class mask

Prepare the ViTMatte image and trimap together and preserve continuous alpha values when using neural matting in a compositing workflow.

Author: Retrivium editorial team
Updated: 2026-11-04
Canonical URL: https://retrivium.ai/journal/fg2-vitmatte-trimap-alpha-segmentation-boundary/
Language: en

## Define the output as alpha

Image matting estimates an alpha field useful for separating foreground contribution from background. The [ViTMatte paper](https://arxiv.org/abs/2305.15272) adapts pretrained vision transformers to that task. Alpha is not a semantic class identifier or an instance number. A consumer that treats the output like an ordinary hard segmentation map can discard partial coverage around hair, fine structures or other transitions that motivated using a matting model in the first place.

## Keep the trimap as an input artifact

The [Transformers interface](https://huggingface.co/docs/transformers/model_doc/vitmatte) expects the image and trimap together. The trimap communicates foreground, background and an uncertain region according to the selected input convention. It is part of the request, not merely a preview generated after inference. Preserve its origin and exact geometry when recording an experiment, because a changed uncertain band can change the problem presented to the model even when the image is unchanged.

## Align transformations across the pair

The [official project](https://github.com/hustvl/ViTMatte) provides training and inference context for the model. Ensure that resizing, cropping and rotation keep the image and trimap aligned. Do not substitute a colorized annotation overlay without checking the processor's accepted trimap representation. A valid file with an attractive appearance can encode different values from those expected by the model, and an unaligned boundary can turn a preprocessing mistake into an apparent failure of matting quality.

## Preserve continuous output through composition

Inspect the numerical alpha before thresholding or converting it to a display image. A hard cutoff changes the result into a binary selection and can remove the smooth boundary information needed by the compositor. Also verify the receiving application's alpha and color conventions. A model can estimate a useful matte while the final composite still shows halos because another component applied an incompatible treatment of foreground color or transparency.

## Evaluate the uncertain region deliberately

Use examples containing a simple opaque edge and a difficult partially covered boundary. Keep the trimap fixed when comparing checkpoints, and assess the resulting composite as well as the alpha field. The guides to [image-coordinate transformations](/journal/data-guide-image-exif-box-coordinate/) and [region identities](/journal/data-guide-coco-instance-caption-identities/) provide background. ViTMatte's distinct contract is continuous alpha conditioned on a trimap, not an automatically interchangeable replacement for any class-based segmentation result or preexisting binary annotation.
