Skip to content

Latest commit

 

History

History
91 lines (50 loc) · 6.28 KB

README.md

File metadata and controls

91 lines (50 loc) · 6.28 KB

ControlNet

We provide extensive ControlNet support. Taking the FLUX model as an example, we support many different ControlNet models that can be freely combined, even if their structures differ. Additionally, ControlNet models are compatible with high-resolution refinement and partition control techniques, enabling very powerful controllable image generation.

These examples are in flux_controlnet.py.

Canny/Depth/Normal: Structure Control

Structural control is the most fundamental capability of the ControlNet model. By using Canny to extract edge information, or by utilizing depth maps and normal maps, we can extract the structure of an image, which can then serve as control information during the image generation process.

Model link: https://modelscope.cn/models/InstantX/FLUX.1-dev-Controlnet-Union-alpha

For example, if we generate an image of a cat and use a model like InstantX/FLUX.1-dev-Controlnet-Union-alpha that supports multiple control conditions, we can simultaneously enable both Canny and Depth controls to transform the environment into a twilight setting.

image_5 image_6

The control strength of ControlNet for structure can be adjusted. For example, in the case below, when we move the girl from summer to winter, we can appropriately lower the control strength of ControlNet so that the model will adapt to the content of the image and change her into warm clothes.

image_7 image_8

Upscaler/Tile/Blur: High-Resolution Image Synthesis

There are many ControlNet models that support high definition, such as:

Model link: https://modelscope.cn/models/jasperai/Flux.1-dev-Controlnet-Upscaler, https://modelscope.cn/models/InstantX/FLUX.1-dev-Controlnet-Union-alpha, https://modelscope.cn/models/Shakker-Labs/FLUX.1-dev-ControlNet-Union-Pro

These models can transform blurry, noisy low-quality images into clear ones. In DiffSynth-Studio, the native high-resolution patch processing technology supported by the framework can overcome the resolution limitations of the models, enabling image generation at resolutions of 2048 or even higher, significantly enhancing the capabilities of these models. In the example below, we can see that in the high-definition image enlarged to 2048 resolution, the cat's fur is rendered in exquisite detail, and the skin texture of the characters is delicate and realistic.

image_1 image_2
image_3 image_4

Inpaint: Image Restoration

The Inpaint ControlNet model can repaint specific areas in an image. For example, we can put sunglasses on a cat.

Model link: https://modelscope.cn/models/alimama-creative/FLUX.1-dev-Controlnet-Inpainting-Beta

image_9 mask_9 image_10

However, we noticed that the head movements of the cat have changed. If we want to preserve the original structural features, we can use the Canny, Depth, and Normal models. DiffSynth-Studio provides seamless support for ControlNet of different structures. By using a Normal ControlNet, we can ensure that the structure of the image remains unchanged during local redrawing.

Model link: https://modelscope.cn/models/jasperai/Flux.1-dev-Controlnet-Surface-Normals

image_11 mask_11 image_12

MultiControlNet+MultiDiffusion: Fine-Grained Control

DiffSynth-Studio not only supports the simultaneous activation of multiple ControlNet structures, but also allows for the partitioned control of content within an image using different prompts. Additionally, it supports the chunk processing of ultra-high-resolution large images, enabling us to achieve extremely detailed high-level control. Next, we will showcase the creative process behind a beautiful image.

First, use the prompt "a beautiful Asian woman and a cat on a bed. The woman wears a dress" to generate a cat and a young girl.

image_13

Then, enable Inpaint ControlNet and Canny ControlNet.

Model link: https://modelscope.cn/models/alimama-creative/FLUX.1-dev-Controlnet-Inpainting-Beta, https://modelscope.cn/models/InstantX/FLUX.1-dev-Controlnet-Union-alpha

We control the image using two component.

Prompt: an orange cat, highly detailed Prompt: a girl wearing a red camisole
mask_13_1 mask_13_2

Generate!

image_14

The background is a bit blurry, so we use deblurring LoRA for image-to-image generation.

Model link: https://modelscope.cn/models/LiblibAI/FLUX.1-dev-LoRA-AntiBlur

image_15

The entire image is much clearer now. Next, let's use the high-definition model to increase the resolution to 4096*4096!

Model link: https://modelscope.cn/models/jasperai/Flux.1-dev-Controlnet-Upscaler

image_17

Zoom in to see details.

image_17_cropped

Enjoy!