DiffusionPreprocessorBase<T>

Base Classes · AiDotNet.Diffusion.Preprocessing

Base class for diffusion model condition preprocessors that convert input images into control signals (edge maps, depth maps, pose skeletons, etc.).

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

Known derived types: CannyEdgePreprocessor<T>, ColorPalettePreprocessor<T>, ContentShufflePreprocessor<T>, DWPosePreprocessor<T>, DepthEstimationPreprocessor<T>, InpaintingMaskPreprocessor<T>, LineArtPreprocessor<T>, MLSDPreprocessor<T>, MediaPipeFacePreprocessor<T>, NormalMapPreprocessor<T>, OpenPosePreprocessor<T>, QRCodePreprocessor<T>, SAMPreprocessor<T>, ScribblePreprocessor<T>, SemanticSegPreprocessor<T>, ShufflePreprocessor<T>, SoftEdgePreprocessor<T>, TilePreprocessor<T>

For Beginners

These preprocessors are the “preparation step” before using ControlNet. They extract specific features from your image:

  • Edge detection: finds outlines and boundaries
  • Depth estimation: estimates how far each pixel is
  • Pose detection: finds body keypoints
  • Segmentation: identifies object regions

The output becomes the “blueprint” that guides image generation.

How It Works

Diffusion preprocessors transform input images into condition maps that guide controlled generation. For example, a Canny edge preprocessor converts a photo into an edge map that ControlNet uses to preserve structure.

Properties

Property Summary
ControlType OutputControlType { get; } Gets the control type this preprocessor produces.
bool IsFitted { get; }
bool SupportsInverseTransform { get; }
int OutputChannels { get; } Gets the number of output channels for the control signal.
int[] ColumnIndices { get; }

Methods

Method Summary
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)