元編程參考文件

影像生成

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
所屬發行版
元編程(專業版)
可用的圖種類
資料流 函數 事件 例程 藍圖 狀態機狀態
宣告於
影像生成
所屬包
機器學習