Abstract
Diffusion models often fail to maintain precise object counts and spatial layouts during image editing, a problem known as "counting error." IMAGHarmony addresses this through a lightweight "Harmony Aware" module and a Preference-guided Noise Selection (PNS) strategy. By fine-tuning only 10.6M parameters on a minimal dataset of 200 images, the framework achieves state-of-the-art structural consistency in complex multi-object scenes, outperforming existing methods in both accuracy and inference speed.
The Challenge of Quantity and Layout (QL-Edit)
While models like Stable Diffusion excel at artistic generation, they struggle with "QL-Edit" tasks—editing images while strictly adhering to the original object count and placement. For instance, changing "six tigers" to "six lions" often results in merged objects or incorrect counts. The authors identify two primary causes: the inability of text prompts to convey precise spatial layouts and the high sensitivity of diffusion models to initial random noise (seeds), which can introduce layout bias.
The IMAGHarmony Framework
To solve these issues, IMAGHarmony introduces two core components designed to work with a frozen Stable Diffusion XL (SDXL) backbone:
- Harmony Aware (HA) Module: This plug-and-play component utilizes a Quantity-and-Layout (QL) attention mechanism. It fuses visual features from the source image with auxiliary text cues. Research indicated that injecting this guidance into the "Down4" block of the UNet—the intersection of high-level semantics and fine-grained structure—optimizes structural alignment.
- Preference-guided Noise Selection (PNS): Instead of relying on a single random seed, PNS samples multiple candidates and performs a brief 10-step denoising. A frozen Vision-Language Model (VLM), such as CogVLM2, then acts as a judge to select the seed that best aligns with the target count and layout before final generation.
Experimental Results and HarmonyBench
The authors introduced HarmonyBench, a benchmark of 2,000 instruction-image pairs, to evaluate multi-object editing. Despite being trained on only 200 images, IMAGHarmony demonstrated significant improvements over existing baselines:
- Superior Accuracy: It achieved an Object Count Accuracy (OCA) of 88.8%, significantly higher than InstructPix2Pix (82.5%) and LEDITS++ (70.0%).
- Robustness to Complexity: Unlike other models whose performance drops as object counts increase, IMAGHarmony maintains high accuracy even in crowded scenes (9+ objects).
- Efficiency: The model averages an inference time of 6.6 seconds, making it 30-70% faster than many current state-of-the-art frameworks.
Conclusion and Future Work
IMAGHarmony proves that structural consistency in image editing can be achieved through targeted feature injection and intelligent seed selection rather than massive data scaling. While highly effective, the system's performance is currently tied to the counting accuracy of the underlying VLM judge. Future research will focus on handling extremely dense occlusions and extending these harmony-aware principles to video editing.
Summary updated