MaskInverter<T>

Models & Types · AiDotNet.Diffusion.MaskUtilities

Inverts a mask so masked regions become unmasked and vice versa.

Implements: IDataTransformer<T, Tensor<T>, Tensor<T>>

For Beginners

If your mask highlights a person (white = person, black = background), inverting it highlights the background instead. This is useful when different tools use opposite conventions for what “masked” means.

How It Works

Mask inversion computes (1 - mask) for each pixel, flipping the masked and unmasked regions. This is commonly used when you want to inpaint the background instead of the foreground, or to convert between “keep” and “replace” mask conventions.

Constructors

Constructor Summary
MaskInverter()

Properties

Property Summary
bool IsFitted { get; }
bool SupportsInverseTransform { get; }
int[] ColumnIndices { get; }

Methods

Method Summary
Tensor<T> Apply(Tensor<T> mask) Inverts a mask tensor by computing (1 - value) for each pixel.
Tensor<T> FitTransform(Tensor<T> data)
Tensor<T> InverseTransform(Tensor<T> data)
Tensor<T> Transform(Tensor<T> data)
string[] GetFeatureNamesOut(string[] inputFeatureNames)
void Fit(Tensor<T> data)