Table of Contents

Class SDXLRefiner<T>

Namespace
AiDotNet.Diffusion.Models
Assembly
AiDotNet.dll

SDXL Refiner model for enhancing generated images.

public class SDXLRefiner<T>

Type Parameters

T

The numeric type used for calculations.

Inheritance
SDXLRefiner<T>
Inherited Members

Remarks

The SDXL refiner is a specialized model trained to enhance the fine details of images generated by the SDXL base model. It operates in the latent space and is designed to work with partially denoised latents.

For Beginners: Think of the refiner as a "finishing touch" step:

Without refiner: Base image (good structure, okay details)

With refiner: Refined image (same structure, enhanced details like texture, sharpness)

The refiner uses lower noise levels (typically 0.2-0.4 denoising strength) to preserve the overall composition while enhancing fine details.

Constructors

SDXLRefiner(UNetNoisePredictor<T>, IVAEModel<T>, INoiseScheduler<T>, IConditioningModule<T>?, int?)

Initializes a new SDXL refiner.

public SDXLRefiner(UNetNoisePredictor<T> refinerUNet, IVAEModel<T> vae, INoiseScheduler<T> scheduler, IConditioningModule<T>? conditioner = null, int? seed = null)

Parameters

refinerUNet UNetNoisePredictor<T>

The refiner U-Net.

vae IVAEModel<T>

The VAE (shared with base model).

scheduler INoiseScheduler<T>

The scheduler.

conditioner IConditioningModule<T>

Optional conditioning module.

seed int?

Optional random seed.

Fields

NumOps

Provides numeric operations for the specific type T.

protected static readonly INumericOperations<T> NumOps

Field Value

INumericOperations<T>

Methods

Refine(Tensor<T>, string, string?, int, double, int?)

Refines an image by enhancing details.

public Tensor<T> Refine(Tensor<T> image, string prompt, string? negativePrompt = null, int numInferenceSteps = 25, double denoiseStrength = 0.3, int? seed = null)

Parameters

image Tensor<T>

The input image to refine.

prompt string

Text prompt describing the image.

negativePrompt string

Optional negative prompt.

numInferenceSteps int

Number of refiner steps.

denoiseStrength double

Denoising strength (0.0-1.0).

seed int?

Optional random seed.

Returns

Tensor<T>

Refined image tensor.