RegionE: Adaptive Region-Aware Generation for Efficient Image Editing
🥳 What's New
- [2025/12/22] Release the PyPi Package.
- [2025/12/22] Release the code for Step1X-Edit-v1p2 and Qwen-Image-Edit-2509.
- [2025/10/29] 👋 Upload paper and init project. RegionE losslessly accelerates SOTA instruction-based image editing models, including Step1X-Edit, FLUX.1 Kontext, and Qwen-Image-Edit, achieving acceleration factors of 2.57×, 2.41×, and 2.06×.
🎥 Demo
https://github.com/user-attachments/assets/23cb6eda-6f2e-418d-8638-8de6c6aaf44d
🏃 Overview
RegionE is an adaptive, region-aware generation framework that accelerates instruction-based image editing tasks without additional training. Specifically, the RegionE framework consists of three main components: 1) Adaptive Region Partition. We observed that the trajectory of unedited regions is straight, allowing for multi-step denoised predictions to be inferred in a single step. Therefore, in the early denoising stages, we partition the image into edited and unedited regions based on the difference between the final estimated result and the reference image. 2) Region-Aware Generation. After distinguishing the regions, we replace multi-step denoising with one-step prediction for unedited areas. For edited regions, the trajectory is curved, requiring local iterative denoising. To improve the efficiency and quality of local iterative generation, we propose the Region-Instruction KV Cache, which reduces computational cost while incorporating global information. 3) Adaptive Velocity Decay Cache. Observing that adjacent timesteps in edited regions exhibit strong velocity similarity, we further propose an adaptive velocity decay cache to accelerate the local denoising process.
🛠️ Dependencies and Installation
Begin by cloning the repository:
git clone https://github.com/Peyton-Chen/RegionE.git
cd RegionE
We recommend CUDA versions 12.4 or 12.1 for the manual installation.
# 1. Create conda environment
conda create -n regione python==3.10.18
# 2. Activate the environment
conda activate regione
# 3. Install PyTorch and other dependencies using pip
# For CUDA 12.1
pip install torch==2.5.1 torchvision==0.20.1 torchaudio==2.5.1 --index-url https://download.pytorch.org/whl/cu121
# For CUDA 12.4
pip install torch==2.5.1 torchvision==0.20.1 torchaudio==2.5.1 --index-url https://download.pytorch.org/whl/cu124
# 4. Install pip dependencies
python -m pip install -r requirements.txt
# 5. Install the latest version of diffusers
pip install git+https://github.com/Peyton-Chen/diffusers.git@step1xedit_v1p2
# 6. Install flash attention v2 (optional)
python -m pip install git+https://github.com/Dao-AILab/flash-attention.git@v2.8.2 --no-build-isolation
🎯 Quick Start
You can directly run the provided demo scripts under the scripts/ directory.
Alternatively, you can manually run the example command below:
Step1X-Edit [🤗Download Pretrained Model ]
python src/Step1X-Edit/main.py \
--model_path stepfun-ai/Step1X-Edit-v1p1-diffusers \
--num_inference_steps 28 \
--use_regione \
--warmup_step 6 \
--post_step 2 \
--refresh_step "16" \
--threshold 0.88 \
--cache_threshold 0.02 \
--erosion_dilation \
--guidance_scale 6.0 \
--seed 110 \
--device cuda \
--image_path assets/data.jsonl \
--output_dir result/Step1X-Edit/Demo/RegionE
FLUX.1 Kontext [🤗Download Pretrained Model ]
python src/FluxKontext/main.py \
--model_path black-forest-labs/FLUX.1-Kontext-dev \
--num_inference_steps 28 \
--use_regione \
--warmup_step 6 \
--post_step 2 \
--refresh_step "16" \
--threshold 0.93 \
--cache_threshold 0.01 \
--erosion_dilation \
--guidance_scale 2.5 \
--seed 110 \
--device cuda \
--image_path assets/data.jsonl \
--output_dir result/FluxKontext/Demo/RegionE
Qwen-Image-Edit [🤗Download Pretrained Model ]
python src/Qwen-Image/main.py \
--model_path Qwen/Qwen-Image-Edit \
--num_inference_steps 28 \
--use_regione \
--warmup_step 6 \
--post_step 2 \
--refresh_step "16" \
--threshold 0.80 \
--cache_threshold 0.03 \
--erosion_dilation \
--guidance_scale 4.0 \
--seed 110 \
--device cuda \
--image_path assets/data.jsonl \
--output_dir result/Qwen-Image/Demo/RegionE
📝 Evaluation
1. Load Benchmark
RegionE was evaluated on Kontext-Bench or GEdit-Bench, and the following is the script for obtaining the benchmark data.
bash script/load_data.sh
2. Batch Image Generation
For Step1X-Edit,
# Vanilla
python src/Step1X-Edit/main.py \
--model_path stepfun-ai/Step1X-Edit-v1p1-diffusers \
--num_inference_steps 28 \
--guidance_scale 6.0 \
--seed 110 \
--device cuda \
--evaluation \
--image_path data/Processed/GEdit-Bench/en \
--output_dir result/Step1X-Edit/Pretrain
# + RegionE
python src/Step1X-Edit/main.py \
--model_path stepfun-ai/Step1X-Edit-v1p1-diffusers \
--num_inference_steps 28 \
--use_regione \
--warmup_step 6 \
--post_step 2 \
--refresh_step "16" \
--threshold 0.88 \
--cache_threshold 0.02 \
--erosion_dilation \
--guidance_scale 6.0 \
--seed 110 \
--device cuda \
--evaluation \
--image_path data/Processed/GEdit-Bench/en \
--output_dir result/Step1X-Edit/RegionE
For FLUX.1 Kontext,
# Vanilla
python src/FluxKontext/main.py \
--model_path black-forest-labs/FLUX.1-Kontext-dev \
--num_inference_steps 28 \
--guidance_scale 2.5 \
--seed 110 \
--device cuda \
--evaluation \
--image_path data/Processed/Kontext-Bench \
--output_dir result/FluxKontext/Pretrain
# + RegionE
python src/FluxKontext/main.py \
--model_path black-forest-labs/FLUX.1-Kontext-dev \
--num_inference_steps 28 \
--use_regione \
--warmup_step 6 \
--post_step 2 \
--refresh_step "16" \
--threshold 0.93 \
--cache_threshold 0.04 \
--erosion_dilation \
--guidance_scale 2.5 \
--seed 110 \
--device cuda \
--evaluation \
--image_path data/Processed/Kontext-Bench \
--output_dir result/FluxKontext/RegionE
For Qwen-Image-Edit,
# Vanilla
python src/Qwen-Image/main.py \
--model_path Qwen/Qwen-Image-Edit \
--num_inference_steps 28 \
--guidance_scale 4.0 \
--seed 110 \
--device cuda \
--evaluation \
--image_path data/Processed/GEdit-Bench/en \
--output_dir result/Qwen-Image/Pretrain
# + RegionE
python src/Qwen-Image/main.py \
--model_path Qwen/Qwen-Image-Edit \
--num_inference_steps 28 \
--use_regione \
--warmup_step 6 \
--post_step 2 \
--refresh_step "16" \
--threshold 0.80 \
--cache_threshold 0.03 \
--erosion_dilation \
--guidance_scale 4.0 \
--seed 110 \
--device cuda \
--evaluation \
--image_path data/Processed/GEdit-Bench/en \
--output_dir result/Qwen-Image/RegionE
3. Metric Evaluation
The evaluation scripts for PSNR, SSIM and LPIPS are as follows:
python evaluation/metric_all_task.py \
--folder1 result/Step1X-Edit/Pretrain \
--folder2 result/Step1X-Edit/RegionE
The evaluation scripts for GPT4o-Score are as follows (please refer to EVAL):
cd evaluation/GEdit-Bench
python run_gedit_score.py \
--backbone="gpt4o" \
--instruction_language="en" \
--task_type="all" \
--edited_images_dir="../../result/Step1X-Edit/RegionE" \
--source_img_dir="../../data/Processed/GEdit-Bench/en" \
--model_name="RegionE"
The folder structure of this project should look like:
RegionE/
├── assets/
├── data/
│ ├── GEdit-Bench/
│ ├── Kontext-Bench/
│ ├── Processed/
│ └── preprocess.py
├── evaluation/
│ ├── GEdit-Bench/
│ ├── metric_all_task.py
│ └── merge_metric.py
├── src/
│ ├── Step1X-Edit/
│ │ ├── fused_kernels.py
│ │ ├── inplace.py
│ │ ├── main.py
│ │ └── utils.py
│ ├── Qwen-Image/
│ └── FluxKontext/
├── result/
│ ├── Step1X-Edit/
│ │ ├── RegionE/
│ │ │ ├── background_change/
│ │ │ │ ├── generation/
│ │ │ │ │ ├── 0f385bcff859231789a9c978cafecc2a.png
│ │ │ │ │ ├── 1e6d1fa7e02689ee2409aa686132cab1.png
│ │ │ │ └── └── ...
│ │ │ ├── color_alter/
│ │ │ ├── material_alter/
│ │ │ └── ...
│ │ └── Pretrain/
│ ├── Qwen-Image/
│ └── FluxKontext/
├── script/
├── requirements.txt
└── README.md
💫 Acknowledgments
We thank the following excellent open-source works: Step1X-Edit, FLUX.1 Kontext, Qwen-Image and RAS.
🔗 Citation
@article{chen2025regione,
title = {RegionE: Adaptive Region-Aware Generation for Efficient Image Editing},
author = {Pengtao Chen and Xianfang Zeng and Maosen Zhao and Mingzhu Shen and Peng Ye and Bangyin Xiang and Zhibo Wang and Wei Cheng and Gang Yu and Tao Chen},
journal = {arXiv preprint arXiv:2510.25590},
year = {2025}
}
Metadata
Release files for RegionE 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| regione-0.1.0.tar.gz | 82.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| regione-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 168.2 kB
Release files / regione-0.1.0.tar.gz
| Download URL | regione-0.1.0.tar.gz |
|---|---|
| Size | 82.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
30b2b9a85984a7158bbb01c314906279eddf86791c08fcd43316902972eed880
|
|
BLAKE2b-256 checksum How to use checksums |
13ea0b4128243122e4001332f057510dd3de4b81533d353097427eb079e74b49
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 23, 2025.
Transparency logRelease files / regione-0.1.0-py3-none-any.whl
| Download URL | regione-0.1.0-py3-none-any.whl |
|---|---|
| Size | 85.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
dc682422714f7825322b123151e577a767c69f2f7c9ee535b5b2484a1d91d2ec
|
|
BLAKE2b-256 checksum How to use checksums |
6c302d39edf59cd9f166f1e0fa42c8620b7e1447df03a4a97779b0dad1bae5d3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 23, 2025.
Transparency log