IMAGHarmony: Controllable Image Editing with Consistent Object Quantity and Layout

March 24, 2026 ยท View on GitHub

๐Ÿ—“๏ธ Release

  • [2025/5/30] ๐Ÿ”ฅ We released the technical report of IMAGHarmony.
  • [2025/5/28] ๐Ÿ”ฅ We release the train and inference code of IMAGHarmony.
  • [2025/5/17] ๐ŸŽ‰ We launch the project page of IMAGHarmony.

๐Ÿ’ก Introduction

IMAGHarmony tackles the challenge of controllable image editing in multi-object scenes, where existing models struggle with aligning object quantity and spatial layout. To this end, IMAGHarmony introduces a structure-aware framework for quantity-and-layout consistent image editing (QL-Edit), enabling precise control over object count, category, and arrangement. We propose a harmony aware (HA) mudule to jointly model object structure and semantics, and a preference-guided noise selection (PNS) strategy to stabilize generation by selecting semantically aligned initial noise. Our method is trained and evaluated on HarmonyBench, a newly curated benchmark with diverse editing scenarios.

architecture

๐Ÿš€ HarmonyBench Dataset Demo

dataset_demo

๐Ÿš€ Examples

results_1

results_2

Dual-Category Editing

results_5

๐Ÿ”ง Requirements

conda create --name IMAGHarmony python=3.8.18
conda activate IMAGHarmony

# Install requirements
pip install -r requirements.txt

๐ŸŒ Download Models

You can download our models from Huggingface. You can download the other component models from the original repository, as follows.

๐Ÿš€ How to train

# Please download the HarmonyBench data first or prepare your own images
# and modify the path in run.sh
## Write caption of your image in your train.json file 
# start training

sh train.sh

๐Ÿš€ How to test

#Please convert your checkpionts
python conver_bin.py

#Please fill in your path in test.py
#then run

python test.py

Or you may like to test it on gradio

python demo.py

Acknowledgement

We would like to thank the contributors to the Instantstyle and IP-Adapter repositories, for their open research and exploration.

The IMAGHarmony code is available for both academic and commercial use. Users are permitted to generate images using this tool, provided they comply with local laws and exercise responsible use. The developers disclaim all liability for any misuse or unlawful activity by users.

Citation

If you find IMAGHarmony useful for your research and applications, please cite using this BibTeX:

@misc{shen2025imagharmonycontrollableimageediting,
      title={IMAGHarmony: Controllable Image Editing with Consistent Object Quantity and Layout}, 
      author={Fei Shen and Yutong Gao and Jian Yu and Xiaoyu Du and Jinhui Tang},
      year={2025},
      eprint={2506.01949},
      archivePrefix={arXiv},
      primaryClass={cs.CV},
      url={https://arxiv.org/abs/2506.01949}, 
}

๐Ÿ•’ TODO List

  • Paper
  • Train Code
  • Inference Code
  • HarmonyBench Dataset
  • Model Weights

๐Ÿ‘‰ Our other projects:

  • IMAGEdit: Training-Free Controllable Video Editing with Consistent Object Layout. [ๅฏๆŽงๅคš็›ฎๆ ‡่ง†้ข‘็ผ–่พ‘]
  • IMAGDressing: Controllable dressing generation. [ๅฏๆŽง็ฉฟ่กฃ็”Ÿๆˆ]
  • IMAGGarment: Fine-grained controllable garment generation. [ๅฏๆŽงๆœ่ฃ…็”Ÿๆˆ]
  • IMAGHarmony: Controllable image editing with consistent object layout. [ๅฏๆŽงๅคš็›ฎๆ ‡ๅ›พๅƒ็ผ–่พ‘]
  • IMAGPose: Pose-guided person generation with high fidelity. [ๅฏๆŽงๅคšๆจกๅผไบบ็‰ฉ็”Ÿๆˆ]
  • RCDMs: Rich-contextual conditional diffusion for story visualization. [ๅฏๆŽงๆ•…ไบ‹็”Ÿๆˆ]
  • PCDMs: Progressive conditional diffusion for pose-guided image synthesis. [ๅฏๆŽงไบบ็‰ฉ็”Ÿๆˆ]
  • V-Express: Explores strong and weak conditional relationships for portrait video generation. [ๅฏๆŽงๆ•ฐๅญ—ไบบ็”Ÿๆˆ]
  • FaceShot: Talkingface plugin for any character. [ๅฏๆŽงๅŠจๆผซๆ•ฐๅญ—ไบบ็”Ÿๆˆ]
  • CharacterShot: Controllable and consistent 4D character animation framework. [ๅฏๆŽง4D่ง’่‰ฒ็”Ÿๆˆ]
  • StyleTailor: An Agent for personalized fashion styling. [ไธชๆ€งๅŒ–ๆ—ถๅฐšAgent]
  • SignVip: Controllable sign language video generation. [ๅฏๆŽงๆ‰‹่ฏญ็”Ÿๆˆ]

๐Ÿ“จ Contact

If you have any questions, please feel free to contact with us at shenfei140721@126.com and yutonggaokkk@njust.edu.cn.