StyleAlignedEditModel<T>
Models & Types · AiDotNet.Diffusion.StyleTransfer
StyleAligned-Edit model for consistent multi-image style editing via shared self-attention.
Inheritance: DiffusionModelBase<T> → LatentDiffusionModelBase<T> → StyleAlignedEditModel<T>
For Beginners
When you need to edit multiple images with the same visual style (like a series of product photos or a consistent set of illustrations), StyleAligned-Edit ensures they all look like they belong together by sharing style information across images.
How It Works
StyleAligned-Edit extends the StyleAligned shared attention mechanism to image editing, ensuring that multiple edited images maintain visual consistency. All images in a batch share self-attention features, enforcing a coherent visual style across the set.
Reference: Hertz et al., “Style Aligned Image Generation via Shared Attention”, CVPR 2024
Example
var options = new DiffusionModelOptions<float> { LatentChannels = 4, DefaultInferenceSteps = 30 };
var input = Tensor<float>.CreateRandom(new[] { 1, 4, 64, 64 });
var trainX = Tensor<float>.CreateRandom(4, 8);
var trainY = Tensor<float>.CreateRandom(4, 2);
var result = new AiModelBuilder<float, Tensor<float>, Tensor<float>>()
.ConfigureModel(new StyleAlignedEditModel<float>(options: options))
.Build(trainX, trainY);
var edited = result.Predict(input);
Constructors
| Constructor | Summary |
|---|---|
StyleAlignedEditModel(NeuralNetworkArchitecture<T> architecture, DiffusionModelOptions<T> options, INoiseScheduler<T> scheduler, UNetNoisePredictor<T> predictor, StandardVAE<T> vae, IConditioningModule<T> conditioner, int? seed) |
Properties
| Property | Summary |
|---|---|
IConditioningModule<T> Conditioner { get; } |
|
INoisePredictor<T> NoisePredictor { get; } |
|
IVAEModel<T> VAE { get; } |
|
int LatentChannels { get; } |
Methods
| Method | Summary |
|---|---|
ModelMetadata<T> GetModelMetadata() |