SASTDModel<T>
Models & Types · AiDotNet.Diffusion.StyleTransfer
SASTD model for structure-aware style transfer via diffusion with edge-guided generation.
Inheritance: DiffusionModelBase<T> → LatentDiffusionModelBase<T> → SASTDModel<T>
For Beginners
SASTD preserves the edges and outlines of your image during style transfer. This means buildings keep their shapes, faces keep their features, and objects stay recognizable even with heavy stylization.
How It Works
SASTD uses edge maps extracted from the content image to guide style transfer, ensuring structural boundaries are preserved during stylization. The edge guidance acts as an additional conditioning signal alongside the style reference.
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 SASTDModel<float>(options: options))
.Build(trainX, trainY);
var stylized = result.Predict(input);
Constructors
| Constructor | Summary |
|---|---|
SASTDModel(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() |