IPAdapterPlusModel<T>

Models & Types · AiDotNet.Diffusion.Control

IP-Adapter Plus model for image prompt conditioning in diffusion models.

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

For Beginners

Instead of describing what you want with text, you can show the AI a reference image. IP-Adapter Plus extracts the style and content from your reference and applies them to the generation, like saying “make something like this.”

How It Works

IP-Adapter Plus enables image-based conditioning for diffusion models by extracting image features through a vision encoder and injecting them via cross-attention. The “Plus” variant uses fine-grained image features with decoupled cross-attention for higher fidelity image prompting.

Reference: Ye et al., “IP-Adapter: Text Compatible Image Prompt Adapter for Text-to-Image Diffusion Models”, 2023

Example

// Create IP-Adapter Plus for image-prompt-guided generation
var options = new DiffusionModelOptions<float>
{
    LatentChannels = 4,
    DefaultInferenceSteps = 30
};
            
// Use a reference image to guide generation style and content
var imageFeatures = Tensor<float>.CreateRandom(new[] { 1, 1024 });
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 IPAdapterPlusModel<float>(options: options))
    .Build(trainX, trainY);
var prediction = result.Predict(imageFeatures);

Constructors

Constructor Summary
IPAdapterPlusModel(NeuralNetworkArchitecture<T> architecture, DiffusionModelOptions<T> options, INoiseScheduler<T> scheduler, UNetNoisePredictor<T> baseUNet, StandardVAE<T> vae, IConditioningModule<T> conditioner, double ipAdapterScale, int? seed) Initializes a new IP-Adapter Plus 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()