MaskFlow: Precise, Consistent and Seamless Regional Image Editing

A mask-aware flow-matching framework for regional image editing with precise localization, consistent background preservation, and seamless boundary transitions.

1 SenseTime Research 2 Beihang University 3 Nanyang Technological University * Corresponding author

MaskFlow examples demonstrating precise localization, consistent background preservation, and seamless boundary transitions
Figure 1. Regional image editing with MaskFlow. (a) MaskFlow follows the provided mask for precise localization. (b) Unrelated content outside the mask remains unchanged. (c) Soft-Poisson de-seaming produces a smooth transition at the edited boundary.

Abstract

Regional image editing offers intuitive spatial control, but existing instruction- and mask-guided methods often struggle with precise localization, background preservation, and smooth boundary transitions. We propose MaskFlow, a training framework that incorporates the mask into the probability path and flow-matching objective to constrain the editable region while preserving unmasked content. A Soft-Poisson de-seaming module further refines the predicted vector field at each sampling step, improving continuity between the generated foreground and preserved background. Experiments on natural scenes and infographic images demonstrate reliable, high-fidelity edits with improved localization, background consistency, and boundary alignment.

Contributions

  1. 1

    A mask-aware flow-matching framework that concentrates generation inside arbitrary edit regions while preserving the source background.

  2. 2

    Soft-Poisson de-seaming, which refines the vector field throughout sampling instead of treating boundary artifacts as post-processing.

  3. 3

    MEData, a paired regional editing dataset covering natural scenes and challenging infographic images.

Experiments

We compare MaskFlow with commercial systems, open-source general-purpose editors, and methods designed for regional editing. Evaluation covers semantic alignment, structural consistency, image fidelity, background preservation, and boundary quality.

Quantitative comparison

MaskFlow obtains the best CLIP, FID, PSNR, SSIM, and background LPIPS among the evaluated methods. The complete comparison on MEData is reported below.

Global Background
MethodCLIP ↑DINO ↑FID ↓PSNR ↑SSIM ↑MSE ↓LPIPS ↓
Gemini 3 Flash Image0.97240.953720.3822.000.74500.00230.0505
GPT Image 20.97340.936724.1216.790.50690.01810.2064
BAGEL-7B-MoT0.94640.905527.7420.800.75600.00300.0648
FLUX.2-dev0.95550.913829.9919.480.66440.00630.0781
HiDream-O1-Image0.91460.843545.3413.170.36130.04500.4313
QwenImage-25110.94920.910729.8519.110.64120.00880.1269
RefineAnything0.96210.905726.4121.290.77400.00000.0007
RegionE0.96720.931325.8321.030.73990.00310.0751
SpotEdit0.93320.892456.4910.890.30010.08440.5083
QwenImage-Inpaint0.95780.894627.5021.580.78210.00050.0278
MaskFlow Ours0.97820.953219.9022.600.78460.00000.0000

Ablation study

The mask-aware framework provides the main improvement in regional control, while Soft-Poisson de-seaming yields consistent additional gains in image fidelity.

MaskFlowSoft-PoissonFID ↓CLIP ↑DINO ↑LPIPS ↓PSNR ↑SSIM ↑
--29.850.94920.91060.207019.110.6412
Yes-20.510.97610.95050.107422.380.7828
YesYes19.900.97820.95320.104722.600.7846

Citation

If you find MaskFlow useful in your research, please cite our paper using the BibTeX entry below.

BibTeX
Coming soon.
Copied to clipboard