FLUX, a groundbreaking AI image generation model, is rapidly gaining popularity in the digital art world. Celebrated for its remarkable ability to generate high-quality images from simple text prompts, it has quickly become a go-to tool for artists and creators alike. However, a notable limitation has been its lack of support for negative prompts — a feature that lets users exclude specific elements from their generated images. In this article, we’ll explore a recent breakthrough that enables negative prompts in FLUX and provide a step-by-step guide on how to implement them effectively.
What Are Negative Prompts?
Negative prompts are specific instructions that guide the AI to exclude certain elements from an image. This feature is essential for creators who want more control over the output, helping them avoid unwanted details or refine the final product. Initially, FLUX did not support negative prompts or allow for Classifier-Free Guidance (CFG) values other than 1. As a result, users were limited in their ability to fine-tune images.
Dynamic Thresholding: A Solution for Negative Prompts in FLUX
A solution developed by the user community has made it possible to use negative prompts and adjust CFG values in FLUX. This method, called Dynamic Thresholding, significantly enhances FLUX’s capabilities by giving users more flexibility and control.
How Dynamic Thresholding Works
Dynamic Thresholding operates by rescaling latent values and clamping extreme ones. This prevents oversaturation and the collapse of image quality when using higher CFG values. By managing these latent values, it ensures that the image remains balanced and visually appealing, even when more detailed instructions are provided.
Implementing Dynamic Thresholding in FLUX
To implement Dynamic Thresholding, users need to install the sd-dynamic-thresholding extension in their FLUX setup. This is typically done through interfaces like ComfyUI or similar platforms, allowing seamless integration of this powerful feature.
Setting Up for Negative Prompts for FLUX
What you need:
- FLUX model
- ComfyUI or a similar interface
- sd-dynamic-thresholding extension
Now Let’s work on this!
- Install the sd-dynamic-thresholding extension.
- In ComfyUI, add the DynamicThresholdingFull node.
- Connect your FLUX model to the input of the DynamicThresholdingFull node.
- Link the output to your KSampler’s input.
How to Optimize Dynamic Thresholding Parameters
Basically, you need to take care of these parameters:
- CFG Scale: Typically set between 3–7. Higher values increase prompt adherence but may lead to oversaturation.
- Interpolate Phi: Controls image saturation. Values between 0.7–0.9 often yield the best results.
- Mimic Scale and CFG Mode: “Half Cosine Up” for both parameters has shown to produce optimal results.
While increasing CFG improves prompt adherence, it can slow down generation. Find a balance between CFG and the built-in Flux Guidance Scale for optimal results.
Here are some more tips about CFG values:
- Realistic Images: Lower CFG (around 2–3) and reduce Interpolate Phi (0.6–0.7).
- Artistic Renderings: Higher CFG (4–6) and increased Interpolate Phi (0.8–0.9).
- Abstract Concepts: Experiment with extreme CFG values (7+) but be prepared for more unpredictable results.
Here are some example settings you can use:
CFG Scale: 3
Interpolate Phi: 0.7
Mimic Scale: Half Cosine Up
CFG Mode: Half Cosine Up
How to Write the Best Prompts for FLUX
Most of the negative Prompts from Stable Diffusion works in FLUX. Here is an example:
blurry, oversaturated colors, modern buildings, people, animals other than koi fish, text, logos, watermarks, distorted proportions, unrealistic lighting
It’s always the best to create negative prompts based on the type of images you want to create. For Portrait Photography:
Positive Prompts: Professional portrait of a middle-aged woman with short gray hair, warm smile, and kind eyes. Natural outdoor lighting, shallow depth of field, bokeh background of a park. High-quality DSLR photo, sharp focus on the face.
Negative Prompts: young appearance, long hair, indoor setting, harsh lighting, blurry focus, multiple people, accessories, hats, glasses
Here’s the test result:
You can test it out here at Anakin AI:
FLUX Realism LoRA Online | Anakin
Elevate your AI-generated images with unparalleled photorealism using FLUX Realism LoRA.
app.anakin.ai
How to Write Better FLUX Prompts, Generally
- Oversaturation: If images appear too saturated, reduce the Interpolate Phi value.
- Lack of Prompt Adherence: Increase CFG scale gradually, but be aware of the performance impact.
- Slow Generation: Consider using a lower resolution for initial tests, then scale up for final outputs.
- Inconsistent Results: Experiment with different seed values to find optimal starting points.
And you might want to consider these techniques to make your image quality better:
- LoRA Integration: Combine Dynamic Thresholding with LoRA models for even more precise control.
from Anakin Blog http://anakin.ai/blog/how-to-write-negative-prompts-in-flux/
via IFTTT
No comments:
Post a Comment