PhotoMakerModel<T>
Models & Types · AiDotNet.Diffusion.Control
PhotoMaker model — identity-customized photo generation with stacked ID embedding.
Inheritance: DiffusionModelBase<T> → LatentDiffusionModelBase<T> → PhotoMakerModel<T>
For Beginners
PhotoMaker creates personalized photos from a few reference images:
Key characteristics:
- 1-4 reference images for identity (no fine-tuning needed)
- Stacked ID embedding: fuses multiple reference features
- CLIP image encoder for identity extraction
- Works with SDXL for high-quality output
Use PhotoMaker when you need:
- Customized photo generation from few references
- Identity-consistent character images
- Quick personalization without training
How It Works
PhotoMaker generates customized photos of a person using 1-4 reference images. It uses a stacked ID embedding approach that fuses identity features from multiple reference images into the text conditioning pipeline.
Technical specifications:
- Architecture: SDXL + stacked ID embedding
- Identity encoder: CLIP ViT-L/14 (fine-tuned)
- Base model: SDXL U-Net
- Resolution: 1024x1024
Reference: Li et al., “PhotoMaker: Customizing Realistic Human Photos via Stacked ID Embedding”, CVPR 2024
Example
// Create a PhotoMaker model with default settings
var photoMaker = new PhotoMakerModel<float>();
// Generate an identity-customized image from text
var image = photoMaker.GenerateFromText(
prompt: "A portrait of [person] in a professional setting",
negativePrompt: "blurry, low quality",
width: 1024,
height: 1024,
numInferenceSteps: 30,
guidanceScale: 5.0,
seed: 42);
Constructors
| Constructor | Summary |
|---|---|
PhotoMakerModel(NeuralNetworkArchitecture<T> architecture, DiffusionModelOptions<T> options, INoiseScheduler<T> scheduler, UNetNoisePredictor<T> unet, StandardVAE<T> vae, IConditioningModule<T> conditioner, int? seed) |
Initializes a new instance of the PhotoMakerModel class. |
Properties
| Property | Summary |
|---|---|
IConditioningModule<T> Conditioner { get; } |
|
INoisePredictor<T> NoisePredictor { get; } |
|
IVAEModel<T> VAE { get; } |
|
int LatentChannels { get; } |
Methods
| Method | Summary |
|---|---|
ModelMetadata<T> GetModelMetadata() |
|
Tensor<T> GenerateFromText(string prompt, string negativePrompt, int width, int height, int numInferenceSteps, double? guidanceScale, int? seed) |
Fields
| Field | Summary |
|---|---|
int DefaultHeight |
Default height for PhotoMaker generation (SDXL native). |
int DefaultWidth |
Default width for PhotoMaker generation (SDXL native). |