ControlNetQRModel<T>

Models & Types · AiDotNet.Diffusion.Control

ControlNet QR model specialized for embedding QR codes in generated artwork.

Inheritance: DiffusionModelBase<T> → LatentDiffusionModelBase<T> → ControlNetQRModel<T>

For Beginners

This model generates beautiful artwork that secretly contains a working QR code. When you scan the generated image with a QR reader, it works as a real QR code, but the image looks like art rather than a plain barcode.

How It Works

Specialized ControlNet fine-tuned for QR code pattern control. Trained to embed scannable QR codes into aesthetically pleasing generated images while maintaining QR readability.

Example

// Create a ControlNet QR model for artistic QR code generation
var options = new DiffusionModelOptions<float>
{
    LatentChannels = 4,
    DefaultInferenceSteps = 30
};
            
// Generate artwork with embedded QR code
var qrPattern = Tensor<float>.CreateRandom(new[] { 1, 1, 768, 768 });
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 ControlNetQRModel<float>(options: options))
    .Build(trainX, trainY);
var artisticQR = result.Predict(qrPattern);

Constructors

Constructor Summary
ControlNetQRModel(NeuralNetworkArchitecture<T> architecture, DiffusionModelOptions<T> options, INoiseScheduler<T> scheduler, UNetNoisePredictor<T> baseUNet, StandardVAE<T> vae, IConditioningModule<T> conditioner, int? seed) Initializes a new ControlNet QR model.

Properties

Property Summary
IConditioningModule<T> Conditioner { get; }
INoisePredictor<T> NoisePredictor { get; }
IVAEModel<T> VAE { get; }
int LatentChannels { get; }

Methods

Method Summary
ModelMetadata<T> GetModelMetadata()