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.

๐ HarmonyBench Dataset Demo

๐ Examples


Dual-Category Editing

๐ง Requirements
- Python>=3.8
- PyTorch>=2.0.0
- cuda>=11.8
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.