-
Notifications
You must be signed in to change notification settings - Fork 677
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3a64cc2
commit 6a25006
Showing
2 changed files
with
113 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
# 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`](./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. | ||
|
||
||| | ||
|-|-| | ||
|
||
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. | ||
|
||
||| | ||
|-|-| | ||
|
||
## 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. | ||
|
||
||| | ||
|-|-| | ||
|
||
||| | ||
|-|-| | ||
|
||
## 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 | ||
|
||
|||| | ||
|-|-|-| | ||
|
||
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 | ||
|
||
|||| | ||
|-|-|-| | ||
|
||
## 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. | ||
|
||
 | ||
|
||
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| | ||
|-|-| | ||
||| | ||
|
||
Generate! | ||
|
||
 | ||
|
||
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 | ||
|
||
 | ||
|
||
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 | ||
|
||
 | ||
|
||
Zoom in to see details. | ||
|
||
 | ||
|
||
Enjoy! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters