元编程参考文档

图像生成

7 个节点

本页内容 7

添加 ControlNet

函数

Adds a ControlNet to steer a picture: Generate Image, Transform Image or Inpaint Image follows its conditioning picture. Chain several to combine them, such as edges and depth.

签名
添加 ControlNet -> Control Net Guide
    Control Net: Control Net
    控制图像: Pixel Image
    控制强度: 数字
    开始: 数字
    结束: 数字
    猜测模式: 真否
    控制: Control Net Guide
ControlNetGuide AddControlNet(
    ControlNet controlNet,
    PixelImage image,
    double scale = 0,
    double start = 0,
    double end = 1,
    bool guessMode = false,
    ControlNetGuide control)

参数

名称类型默认值说明
Control NetControl Net—A ControlNet made for the generator's family, from Load ControlNet.
控制图像Pixel Image—The conditioning picture, already processed as the ControlNet expects (an edge map for a canny ControlNet, a depth map, a pose); Generate Image paints at its size, and Transform Image and Inpaint Image need it at their picture's.
控制强度数字0How strongly it steers: 1 fully, less to loosen its hold; 0 for the pipeline's own (1 from text, 0.8 for img2img, 0.5 for Stable Diffusion inpainting, 1 for SDXL inpainting). SDXL ControlNets often want about 0.5.
开始数字0The share of the steps after which it starts to steer: 0 from the first step.
结束数字1The share of the steps after which it stops: 1 to the last step.
猜测模式真否FalseLet the conditioning picture carry the content with little or no prompt; on for every ControlNet of the chain once any asks for it.
控制Control Net Guide—ControlNets already added, to combine with this one.

返回

控制Control Net Guide
所属发行版
元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
图像生成
所属包
机器学习

用精修器收尾

函数

Finishes an SDXL picture with SDXL's refiner: the base model paints the first part of the steps and hands its unfinished picture over, and the refiner paints the rest. Give it to Generate Image, Transform Image or Inpaint Image.

签名
用精修器收尾 -> Refiner Stage
    精修器: Image Generator
    交接点: 数字
    美学评分: 数字
    反向美学评分: 数字
RefinerStage FinishWithRefiner(
    ImageGenerator refiner,
    double handOverAt = 0.8,
    double aestheticScore = 6,
    double negativeAestheticScore = 2.5)

参数

名称类型默认值说明
精修器Image Generator—The refiner, loaded by Load Image Generator from stabilityai/stable-diffusion-xl-refiner-1.0 on the base model's device and precision.
交接点数字0.8The share of the steps the base model paints before handing over: 0.8 leaves the refiner the last fifth.
美学评分数字6The aesthetic score the refiner aims for, on the scale of the LAION ratings it was trained on.
反向美学评分数字2.5The score it steers away from, when Guidance is above 1.

返回

精修器Refiner Stage
所属发行版
元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
图像生成
所属包
机器学习

生成图像

函数

Paints a picture from a description, optionally following ControlNets and finished by SDXL's refiner.

签名
生成图像 -> Pixel Image
    生成器: Image Generator
    提示词: 文本
    反向提示词: 文本
    宽度: 整数
    高度: 整数
    步数: 整数
    引导强度: 数字
    种子: 大整数
    调度器: Diffusion Scheduler
    控制: Control Net Guide
    精修器: Refiner Stage
PixelImage GenerateImage(
    ImageGenerator generator,
    string prompt,
    string negativePrompt,
    int width = 0,
    int height = 0,
    int steps = 0,
    double guidance = -1,
    long seed = 0,
    DiffusionScheduler scheduler = DiffusionScheduler.Default,
    ControlNetGuide control,
    RefinerStage refiner)

参数

名称类型默认值说明
生成器Image Generator—An image generator.
提示词文本—What the picture shows, such as "a lighthouse at dusk, oil painting".
反向提示词文本—What it should not show; used only when Guidance is above 1.
宽度整数0Its width in pixels, a multiple of 8; 0 for the model's own (512 for Stable Diffusion 1.5, 1024 for SDXL), or with Control the control picture's.
高度整数0Its height in pixels, a multiple of 8; 0 for the model's own, or with Control the control picture's.
步数整数0How many denoising steps: 0 for the pipeline's own (50); 20 to 50 suit most models, 1 to 4 Turbo models.
引导强度数字-1How closely it follows the prompt: below 0 for the pipeline's own (7.5 for Stable Diffusion, 5 for SDXL); 0 for Turbo models.
种子大整数0The starting noise; the same seed and settings give the same picture. Negative for a different one each time.
调度器Diffusion Scheduler默认The denoising method.
控制Control Net Guide—ControlNets the picture follows, from Add ControlNet.
精修器Refiner Stage—SDXL's refiner to finish the picture, from Finish With Refiner.

返回

图像Pixel Image
所属发行版
元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
图像生成
所属包
机器学习

局部重绘图像

函数

Repaints the part of a picture a mask marks to match a description, and keeps the rest: inpainting, optionally following ControlNets and finished by SDXL's refiner. An inpainting checkpoint fills best; any other model repaints too.

签名
局部重绘图像 -> Pixel Image
    生成器: Image Generator
    图像: Pixel Image
    遮罩: Pixel Image
    提示词: 文本
    反向提示词: 文本
    强度: 数字
    步数: 整数
    引导强度: 数字
    种子: 大整数
    调度器: Diffusion Scheduler
    精修器: Refiner Stage
    控制: Control Net Guide
PixelImage InpaintImage(
    ImageGenerator generator,
    PixelImage image,
    PixelImage mask,
    string prompt,
    string negativePrompt,
    double strength = 0,
    int steps = 0,
    double guidance = -1,
    long seed = 0,
    DiffusionScheduler scheduler = DiffusionScheduler.Default,
    RefinerStage refiner,
    ControlNetGuide control)

参数

名称类型默认值说明
生成器Image Generator—An image generator.
图像Pixel Image—The picture to repaint; the result is its size, whose sides must be multiples of 8.
遮罩Pixel Image—White where to repaint and black where to keep, the picture's size; grey counts from half way.
提示词文本—What the repainted part shows.
反向提示词文本—What it should not show; used only when Guidance is above 1.
强度数字0How much of the masked part to change: 1 paints it afresh, less keeps more of what was there and runs that share of the steps; 0 for the pipeline's own (1 for Stable Diffusion, 0.9999 for SDXL).
步数整数0How many denoising steps the whole schedule has: 0 for the pipeline's own (50).
引导强度数字-1How closely it follows the prompt: below 0 for the pipeline's own (7.5; 5 for SDXL with Control).
种子大整数0The starting noise; the same seed and settings give the same picture. Negative for a different one each time.
调度器Diffusion Scheduler默认The denoising method.
精修器Refiner Stage—SDXL's refiner to finish the repainted part, from Finish With Refiner.
控制Control Net Guide—ControlNets the repainted part follows, from Add ControlNet; their pictures are this picture's size.

返回

图像Pixel Image
所属发行版
元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
图像生成
所属包
机器学习

加载 ControlNet

函数

Loads a ControlNet, which makes a picture follow a conditioning picture such as an edge map, a depth map or a pose.

签名
加载 ControlNet -> Control Net
    模型: 文本
    设备: Compute Device
    精度: Precision
    变体: 文本
ControlNet LoadControlNet(
    string model,
    ComputeDevice device = ComputeDevice.Auto,
    Precision precision = Precision.Auto,
    string variant)

参数

名称类型默认值说明
模型文本—A repository id such as lllyasviel/control_v11p_sd15_canny for Stable Diffusion 1.5 or diffusers/controlnet-canny-sdxl-1.0-small for SDXL, or a folder with its config.json.
设备Compute Device自动Where it runs: the generator's device.
精度Precision自动The number format of its weights: the generator's precision.
变体文本—Which copy of the weights to download, such as fp16 for half-size files; empty for the full ones.

返回

模型Control Net
所属发行版
元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
图像生成
所属包
机器学习

加载图像生成器

函数

Loads a Stable Diffusion or SDXL pipeline from a Hub repository or a folder in diffusers' layout, with LoRAs when given.

签名
加载图像生成器 -> Image Generator
    模型: 文本
    设备: Compute Device
    精度: Precision
    变体: 文本
    LoRA 列表: 文本数组
    LoRA 权重: 数字数组
ImageGenerator LoadImageGenerator(
    string model,
    ComputeDevice device = ComputeDevice.Auto,
    Precision precision = Precision.Auto,
    string variant,
    string[] loras,
    double[] loraWeights)

参数

名称类型默认值说明
模型文本—A repository id such as stable-diffusion-v1-5/stable-diffusion-v1-5, stabilityai/sdxl-turbo, an inpainting checkpoint such as stable-diffusion-v1-5/stable-diffusion-inpainting or SDXL's refiner stabilityai/stable-diffusion-xl-refiner-1.0, or a folder with model_index.json.
设备Compute Device自动Where it runs. A picture takes seconds on a GPU and minutes on a CPU.
精度Precision自动The number format of its weights; Auto is Float32 on the CPU and Float16 on the GPU.
变体文本—Which copy of the weights to download, such as fp16 for half-size files; empty for the full ones.
LoRA 列表文本数组—LoRAs to apply: .safetensors files, folders or repository ids, in diffusers', PEFT's or kohya's layout.
LoRA 权重数字数组—How strongly each LoRA applies, in the same order; 1 when not given.

返回

生成器Image Generator
所属发行版
元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
图像生成
所属包
机器学习

变换图像

函数

Repaints a picture to match a description, keeping its composition: img2img, optionally following ControlNets and finished by SDXL's refiner.

签名
变换图像 -> Pixel Image
    生成器: Image Generator
    图像: Pixel Image
    提示词: 文本
    反向提示词: 文本
    强度: 数字
    步数: 整数
    引导强度: 数字
    种子: 大整数
    调度器: Diffusion Scheduler
    控制: Control Net Guide
    精修器: Refiner Stage
PixelImage TransformImage(
    ImageGenerator generator,
    PixelImage image,
    string prompt,
    string negativePrompt,
    double strength = 0,
    int steps = 0,
    double guidance = -1,
    long seed = 0,
    DiffusionScheduler scheduler = DiffusionScheduler.Default,
    ControlNetGuide control,
    RefinerStage refiner)

参数

名称类型默认值说明
生成器Image Generator—An image generator.
图像Pixel Image—The picture to start from; the result is its size, whose sides must be multiples of 8.
提示词文本—What the result shows.
反向提示词文本—What it should not show; used only when Guidance is above 1.
强度数字0How much to change: 1 ignores the picture, less keeps more of it and runs that share of the steps; 0 for the pipeline's own (0.8 for Stable Diffusion; 0.3 for SDXL, 0.8 with Control).
步数整数0How many denoising steps the whole schedule has: 0 for the pipeline's own (50).
引导强度数字-1How closely it follows the prompt: below 0 for the pipeline's own (7.5 for Stable Diffusion, 5 for SDXL); 0 for Turbo models.
种子大整数0The added noise; the same seed and settings give the same picture. Negative for a different one each time.
调度器Diffusion Scheduler默认The denoising method.
控制Control Net Guide—ControlNets the picture follows, from Add ControlNet; their pictures are this picture's size.
精修器Refiner Stage—SDXL's refiner to finish the picture, from Finish With Refiner; not together with Control.

返回

图像Pixel Image
所属发行版
元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
图像生成
所属包
机器学习