Paper deep dive
MaskFlow: Precise, Consistent and Seamless Regional Image Editing
Rui Xu, Yang Yong, Shunzi Yang, Ruihao Gong, Chengtao Lv
Intelligence
Status: succeeded | Model: Gemma-4-26B-A4B | Prompt: intel-v1 | Confidence: 94%
Last extracted: 8/10/2026, 3:38:52 AM
Summary
The paper introduces MaskFlow, a training framework for regional image editing that ensures precise localization, consistent background preservation, and seamless boundary transitions. It incorporates masks into the probability path and flow-matching objective to coordinate generation within editable regions while preserving the source outside. A Soft-Poisson de-seaming module refines the vector field to smooth boundaries. The authors also present MEData, a dataset for mask-based image editing, and demonstrate improvements over existing methods.
Entities (8)
Relation Signals (10)
Chengtao Lv → affiliatedwith → Nanyang Technological University
confidence 95% · Chengtao Lv1,3... 1 SenseTime Research 3 Nanyang Technological University
Ruihao Gong → affiliatedwith → SenseTime Research
confidence 95% · Ruihao Gong1,2... 1 SenseTime Research 2 Beihang University
Ruihao Gong → affiliatedwith → Beihang University
confidence 95% · Ruihao Gong1,2... 1 SenseTime Research 2 Beihang University
Chengtao Lv → affiliatedwith → SenseTime Research
confidence 95% · Chengtao Lv1,3... 1 SenseTime Research 3 Nanyang Technological University
Rui Xu → affiliatedwith → SenseTime Research
confidence 95% · Rui Xu1... 1 SenseTime Research
Yang Yong → affiliatedwith → SenseTime Research
confidence 95% · Yang Yong1... 1 SenseTime Research
Shunzi Yang → affiliatedwith → Beihang University
confidence 95% · Shunzi Yang2... 2 Beihang University
MaskFlow → uses → Soft-Poisson de-seaming
confidence 95% · The proposed Soft-Poisson de-seaming module further refines the predicted vector field during both training and sampling...
MaskFlow → creates → MEData
confidence 92% · We also design a data synthesis pipeline to construct MEData...
MaskFlow → uses → Flow Matching
confidence 90% · MaskFlow incorporates the mask into the probability path and flow-matching objective...
Cypher Suggestions (0)
No Cypher suggestions yet.
Abstract
Abstract:Regional image editing has attracted considerable attention for its spatial controllability. Although instruction-based and mask-reference-based editing methods can achieve strong semantic alignment, reliable regional control remains challenging, where an edit must be accurately localized and naturally integrated with the preserved context. We propose \textbf{MaskFlow}, a training framework for precise localization, consistent background preservation, and seamless boundary transitions. MaskFlow incorporates the mask into the probability path and flow-matching objective, coordinating generation within the editable region with source preservation outside it. The proposed Soft-Poisson de-seaming module further refines the predicted vector field during both training and sampling to improve the smooth integration of the edited foreground with the preserved background. We also design a data synthesis pipeline to construct MEData, a mask-based image editing dataset for training regional image editing models and facilitating further research. Experiments on natural scenes and infographic images demonstrate consistent improvements over competing methods in both quantitative and qualitative evaluations.
Tags
Links
- Source: https://arxiv.org/abs/2608.06929v1
- Canonical: https://arxiv.org/abs/2608.06929v1
Trouble viewing inline? Open PDF directly →
Full Text
61,229 characters extracted from source content.
Expand or collapse full text
MaskFlow: Precise, Consistent and Seamless Regional Image Editing Rui Xu1, Yang Yong1, Shunzi Yang2, Ruihao Gong1,2🖂, Chengtao Lv1,3 1 SenseTime Research 2 Beihang University 3 Nanyang Technological University chiaroair@gmail.com yongyang@sensetime.com yangshunzi@buaa.edu.cn gongruihao@buaa.edu.cn chengtao001@e.ntu.edu.sg 🖂 Corresponding author Project page: https://reychiaro.github.io/MaskFlow Abstract Regional image editing has attracted considerable attention for its spatial controllability. Although instruction-based and mask-reference-based editing methods can achieve strong semantic alignment, reliable regional control remains challenging, where an edit must be accurately localized and naturally integrated with the preserved context. We propose MaskFlow, a training framework for precise localization, consistent background preservation, and seamless boundary transitions. MaskFlow incorporates the mask into the probability path and flow-matching objective, coordinating generation within the editable region with source preservation outside it. The proposed Soft-Poisson de-seaming module further refines the predicted vector field during both training and sampling to improve the smooth integration of the edited foreground with the preserved background. We also design a data synthesis pipeline to construct MEData, a mask-based image editing dataset for training regional image editing models and facilitating further research. Experiments on natural scenes and infographic images demonstrate consistent improvements over competing methods in both quantitative and qualitative evaluations. Figure 1: Qualitative comparison of the proposed MaskFlow with representative reference-based and inpainting methods. MaskFlow precisely localizes edits to masked regions, consistently preserves background content, and produces seamless transitions across mask boundaries. 1 Introduction Recent advances in diffusion and flow-matching models have substantially improved the fidelity and controllability of image generation (Ho et al., 2020; Rombach et al., 2022; Lipman et al., 2022; Peebles and Xie, 2023; Wu et al., 2025). These developments have stimulated growing interest in conditioning mechanisms and controllable generation, particularly in regional image editing, which aims to modify regions specified by the user while preserving the remaining content (Hertz et al., 2022; Brooks et al., 2023; Zhang et al., 2026). Existing approaches to regional image editing can be broadly categorized according to how the editable region is specified. Instruction-based methods identify the target content from textual instructions, whereas mask-reference-based methods use explicit masks as spatial references. Benefiting from advances in large language models and vision language models (Radford et al., 2021; Achiam et al., 2023; Team et al., 2023; Bai et al., 2025), instruction-based image editors have demonstrated strong semantic understanding and editing capabilities (Koh et al., 2023; Zhou et al., 2025; Huang et al., 2024; Xu et al., 2025), especially when the target can be described unambiguously. However, as illustrated in Figure 1(a,b), specifying an exact target through language becomes cumbersome in complex scenes such as infographic images (Peng et al., 2025; Tang et al., 2026). These images often contain repeated or visually similar elements, dense layouts, or targets whose locations are difficult to describe precisely. Such spatial ambiguity can substantially reduce localization accuracy. Moreover, instruction-based methods commonly predict noise or vector fields over the entire spatial representation without explicit regional constraints (Wu et al., 2025; Labs, 2025; Deng et al., 2025). Consequently, they may unintentionally alter background content that should remain unchanged. Mask-reference-based methods alleviate spatial ambiguity by allowing users to specify the editable region explicitly (Avrahami et al., 2023; Wang et al., 2023; Xie et al., 2023; Zhuang et al., 2024; Zhou et al., 2026). Given a source image and a mask that identifies the editable region, existing methods typically encode the mask as an additional image condition and process it in a manner similar to the source image. Common strategies introduce mask information through shared attention layers (Vaswani et al., 2017), additional conditioning branches (Zhang et al., 2023; Mou et al., 2024), or parameter efficient fine-tuning (Hu et al., 2022; Zhang et al., 2026). Despite their improved localization capability, the mask-reference-based methods continue to face challenges in edit fidelity and image integration. Generating the masked region independently can lead to semantic or stylistic drift (Rombach et al., 2022; Xie et al., 2023), which reduces the reliability of the edited content. In addition, the foreground and background frequently follow different generation or preservation processes (Lugmayr et al., 2022; Zhou et al., 2026). Differences between their trajectories can manifest as inconsistencies in color, texture, and local gradients. These inconsistencies may create visible seams along the mask boundary and produce suboptimal results, as shown in Figure 1(c). Taken together, these limitations call for a regional editing framework that provides precise localization, consistent background preservation, and seamless boundary transitions. To address these challenges, we propose MaskFlow, a training framework for regional image editing. Given a source image, an editing instruction, and a mask of arbitrary shape, MaskFlow incorporates the mask into the probability path and flow-matching objective, explicitly modeling generation within the editable region and source preservation outside it. A Soft-Poisson de-seaming module applied during both training and sampling further refines the vector field to produce a smooth boundary. Specifically, the proposed MaskFlow solves the problems through the following designs. (1) We construct editing instructions that omit explicit position descriptions, thereby encouraging the model to identify editable regions from the masks and improving localization precision. (2) We introduce probability paths guided by masks and a mask-aware optimization objective that constrains editable regions throughout denoising. This formulation supports masks with arbitrary shapes and improves regional control in intricate scenes such as infographic images while consistently preserving the background. (3) We design a Soft-Poisson de-seaming module that suppresses visible discontinuities between the foreground and background using a Soft-Poisson objective to refine the predicted vector field. This procedure promotes smooth and consistent transitions in color and gradients near the boundary. As demonstrated in Figure 1(a), MaskFlow accurately replaces all text instances specified by the masks. Figure 1(b) further shows that semantically related background content remains unchanged. The results in Figure 1(c) illustrates more natural transitions than methods that directly replace masked regions. In summary, this work addresses localization, background preservation, and seamless transitions in regional image editing. Our contributions are summarized below. • We propose MaskFlow, a training framework for regional image editors. The probability path guided by the mask and the vector field refinement module jointly enable precise localization, consistent background preservation, and seamless boundary transitions. • We construct MEData, a dataset tailored for mask-guided image editing, using the proposed data synthesis pipeline. It contains paired source images, target images, prompts, and masks of arbitrary shapes from natural scenes and challenging infographic images for training and evaluating regional editing methods. • Extensive qualitative and quantitative experiments demonstrate that the proposed approach performs the requested edits correctly while improving localization accuracy, background consistency, and boundary alignment. 2 Related Work Diffusion models (Ho et al., 2020; Rombach et al., 2022) and flow-matching models (Lipman et al., 2022; Liu et al., 2022), together with scalable transformer backbones (Peebles and Xie, 2023; Ma et al., 2024), provide the generative foundation for regional edit models. A model must accurately localize, keep the unmasked area unchanged, and integrate the generated foreground with its surrounding context. Existing work mainly addresses these requirements through mask-reference-based editing and refinement at region boundaries. Mask-reference-based regional editing. Masks provide explicit spatial information that is difficult to express through language alone. Early diffusion inpainting methods either blend generated and source latents during denoising or condition the model on masked images, object shapes, and high resolution source content (Avrahami et al., 2023; Wang et al., 2023; Xie et al., 2023). PowerPaint (Zhuang et al., 2024) further uses task prompts to unify filling, insertion, removal, and shape guided inpainting. Recent generalist editors (Mao et al., 2025; Li et al., 2026) encode masks within long context multimodal inputs or combine semantic target recognition with dedicated inpainting branches. Task specific methods (Jiang et al., 2025; Wasserman et al., 2025) improve removal or insertion through guidance from masked regions and purpose built training pairs. RegionE (Chen et al., 2025) and SpotEdit (Qin et al., 2026) instead infer editable or stable tokens from intermediate features and selectively reuse background features. Despite their different implementations, these approaches generally treat the mask or estimated region as a conditioning signal rather than a constraint on the underlying probability path. In contrast, MaskFlow incorporates the user mask into both the probability path and the flow-matching objective. This design directly constrains edits with masks of arbitrary shapes while maintaining the source trajectory outside the mask. Blending and refinement at boundaries. Classical Poisson editing (Pérez et al., 2003) and its modified formulation (Tanaka et al., 2012) reconstruct a pasted region by matching source gradients under destination boundary conditions. Deep Image Blending (Zhang et al., 2020) augments this principle with learned content and style objectives. These methods can suppress abrupt pixel discontinuities, but they operate on a completed composite and may introduce color propagation or fail to repair semantic and structural incompatibility created during generation. Recent approaches move closer to generative models. Long et al. (2025) uses trajectory divergence and feature injection to localize shape changes, whereas RefineAnything (Zhou et al., 2026) and PixPerfect (Zheng et al., 2026) learn refiners that operate at boundaries or in pixel space. However, automatically inferred regions do not provide exact user control. Auxiliary losses and subsequent refinement also cannot directly correct intermediate generative decisions that produce an incompatible foreground. The proposed MaskFlow instead applies soft-Poisson de-seaming at every sampling step to refine the predicted vector field, allowing boundary consistency to influence the entire generation trajectory. 3 Preliminaries Flow-matching. Let the Gaussian noise distribution be p0=(,)p_0=N( 0, I) and the target data distribution be p1=pdatap_1=p_ data. Flow-matching models learn a vector field v_ θ that transports samples from p0p_0 to p1p_1 through a multistep ODE solver (Lipman et al., 2022). Let ϵ∼p0ε p_0 and 1∼p1x_1 p_1, and consider time-dependent schedules α(t),β(t)∈[0,1]α(t),β(t)∈[0,1] for t∈[0,1]t∈[0,1]. The probability path is defined as (t)=α(t)1+β(t)ϵx(t)=α(t)x_1+β(t)ε, where α(0)=0α(0)=0, β(0)=1β(0)=1, α(1)=1α(1)=1, and β(1)=0β(1)=0. A commonly used schedule is α(t)=1−σ(t)α(t)=1-σ(t) and β(t)=σ(t)β(t)=σ(t), where σ(t)∈[0,1]σ(t)∈[0,1] is a monotonically decreasing noise schedule with σ(0)=1σ(0)=1 and σ(1)=0σ(1)=0 (Liu et al., 2022). The target vector field is (t)=α˙(t)1+β˙(t)ϵ=σ˙(t)(ϵ−1) u(t)= α(t)x_1+ β(t)ε= σ(t)(ε-x_1), with (0)=ϵx(0)=ε and (1)=1x(1)=x_1. Flow-matching trains a model to predict ((t),σ(t)) v_ θ(x(t),σ(t)) from the sample (t)x(t) at time t using the objective ℒCFM()=[‖((t),σ(t))−σ˙(t)(ϵ−1)‖22].L_CFM( θ)=E [ v_ θ(x(t),σ(t))- σ(t)(ε-x_1) _2^2 ]. (1) At time t, the clean target can be estimated from the predicted vector field as ^1(t)=(t)−σ(t)σ˙(t)((t),σ(t)). x_1(t)=x(t)- σ(t) σ(t) v_ θ(x(t),σ(t)). (2) During sampling, we use i x_i to denote the realized latent state at the i-th discretization point. Starting from 0∼p0 x_0 p_0, the generated image is obtained by integrating the ODE forward for T∈ℕ+T∈N^+ steps i+1=i+σi+1−σiσ˙i(i,σi) x_i+1= x_i+ _i+1- _i σ_i v_ θ( x_i, _i), where i x_i is a realization of (i/T)x(i/T) and σi=σ(i/T) _i=σ(i/T). The index i increases sequentially from 0 to T−1T-1, and T x_T is the generated sample. Poisson image editing. Poisson image editing (Pérez et al., 2003) seamlessly clones a foreground region into a background image by aligning image gradients. Let ⊂ℝ2S ^2 be the spatial domain of one image channel, and let Ω⊂ ⊂S denote a closed region with boundary ∂Ω∂ . The foreground image f is defined over Ω , and the background image g is defined over \ΩS . Poisson image editing seeks a scalar field h⋆h over Ω that satisfies h⋆=argminh∫Ω∥∇h()−∇f()∥22ds.t.h|∂Ω=g|∂Ω.h = *arg\,min_h _ _ ph( p)- _ pf( p) _2^2\,d p .t. h|_∂ =g|_∂ . (3) Applying the Euler–Lagrange equation yields the Poisson equation with Dirichlet boundary conditions Δh⋆()=Δf()s.t.h⋆|∂Ω=g|∂Ω, _ ph ( p)= _ pf( p) .t. h |_∂ =g|_∂ , (4) where Δ=∇⋅∇ _ p= _ p· _ p is the Laplacian operator over the spatial coordinate p. Equation 4 aligns the synthesized image h⋆h with the foreground image f over Ω while maintaining color continuity along the boundary. It can be solved efficiently using Jacobi iteration. 4 Methodology We propose MaskFlow for regional image editing with precise localization, consistent background preservation and seamless boundary transitions. Section 4.1 introduces the training framework for precise localization and consistent background preservation. Section 4.2 presents the refinement procedure for seamless boundary transitions. Section 4.3 describes the data synthesis pipeline. 4.1 MaskFlow Figure 2: Overview of the proposed MaskFlow framework and data synthesis pipeline. (a) During training, the source image and mask are provided to the MMDiT for vector field prediction. Soft-Poisson de-seaming integrates the generated foreground with the source background. (b) The three-stage data synthesis pipeline uses a vision language model and an image generation model to produce tuples in the form <prompt,source,mask,target>. MaskFlow incorporates the mask into the probability path. Let S,1∈ℝd x_S, x_1 ^d be vectorized source and target latents, where d=CHWd=CHW. Let ∈0,1H×W M∈\0,1\^H× W be a binary mask whose entry Mi,j=1M_i,j=1 denotes an editable pixel. We use ∈0,1d m∈\0,1\^d to denote the channel-wise broadcast and vectorization of M. The proposed probability path is (t)=⊙(α(t)1+β(t)ϵ)+(−)⊙~(t), x(t)= m (α(t) x_1+β(t)ε )+( 1- m) x(t), (5) where the first term generates content inside the masked region, whereas the unmasked component ~(t) x(t) preserves the background. In practice, we use ~(t)=α(t)S+β(t)ϵ x(t)=α(t) x_S+β(t)ε, so that the unmasked region follows the source image rather than the target image. The training objective must account for masks with different shapes and sizes. We define the masked area ratio as a()=1HW∑i=1H∑j=1WMi,ja( M)= 1HW _i=1^H _j=1^WM_i,j. We then introduce an adaptive mask weight into Equation 1 to balance supervision from regions of different sizes ℒMF()=[∥⊙ωmaska()(((t),σ(t)∣S,)−˙(t))∥22],L_MF( θ)=E [ m _maska( M) ( v_ θ( x(t),σ(t) x_S, M)- x(t) ) _2^2 ], (6) where ωmask>0 _mask>0 is the loss weight. We assume that each training mask contains at least one editable pixel, so a()>0a( M)>0. This objective balances the contributions of masks that cover different areas, and is utilized as the supervision for model training. 4.2 Soft-Poisson de-seaming We propose Soft-Poisson de-seaming, which refines the predicted vector field at every sampling step through a unified gradient-domain objective. Given a predicted vector field ((t),σ(t)) v_ θ( x(t),σ(t)), we first estimate the clean target ^1 x_1 using Equation 2 and then reshape the source and estimated target latents into feature maps. Let S(),^1()∈ℝC x_S( p), x_1( p) ^C denote their feature vectors at spatial position p, and let ()∈ℝC z( p) ^C be the refined spatial field. All differential operators below act on p and are applied componentwise. Starting from the binary mask M, we use a finite-support Gaussian kernel to obtain transition weights while retaining a value of 11 inside the original editable region. The resulting soft mask ~ M defines an expanded region Ω~==(i,j)∈1,…,H×1,…,W|M~i,j>0 = \ p=(i,j)∈\1,…,H\×\1,…,W\\; |\; M_i,j>0 \. Let m~()=M~i,j m( p)= M_i,j for =(i,j) p=(i,j). Larger values of m~() m( p) identify positions that should remain close to the generated edit, whereas smaller values gradually increase the influence of the source image toward the exterior of Ω~ . We obtain the refined field by solving ⋆=argmin∫Ω~‖∇()−∇^1()‖F2d+λe∫Ω~m~()‖()−^1()‖22d+λs∫Ω~(1−m~())‖()−S()‖22ds.t.|∂Ω~=S|∂Ω~, aligned z = *arg\,min_ z\;& _ _ p z( p)- _ p x_1( p) _F^2\,d p\\ &+ _e _ m( p) z( p)- x_1( p) _2^2\,d p\\ &+ _s _ (1- m( p) ) z( p)- x_S( p) _2^2\,d p aligned .t. z|_∂ = x_S|_∂ , (7) where λe,λs>0 _e, _s>0. The first term transfers the spatial gradients of the estimated target to preserve the generated structure. The second term anchors the refined field to the estimated edit in regions with large soft-mask values. The third term progressively restores the source feature as the soft-mask value decreases. Together with the boundary condition, these terms form a continuous transition from the generated foreground to the preserved background within a single objective. Applying the Euler–Lagrange equation to Equation 7 yields Δ()−Δ^1()=λem~()(()−^1())+λs(1−m~())(()−S()), _ p z( p)- _ p x_1( p)= _e m( p) ( z( p)- x_1( p) )+ _s (1- m( p) ) ( z( p)- x_S( p) ), (8) which holds for every ∈Ω~ p∈ under the boundary condition in Equation 7. Here, Δ=∇⋅∇ _ p= _ p· _ p is the spatial Laplacian, and solving this Poisson equation we can get the refined spatial field ⋆ z . Combining ⋆ z inside Ω~ with S x_S outside it forms a complete refined feature map ^1⋆(t)∈ℝC×H×W X_1 (t) ^C× H× W. Vectorizing this feature map gives the seamless target estimate ^1⋆(t)=vec(^1⋆(t))∈ℝCHW x_1 (t)=vec( X_1 (t)) ^CHW. We use this estimate to redirect the current sampling trajectory by replacing the original vector field with ⋆((t),σ(t))=σ˙(t)σ(t)((t)−^1⋆(t)) v_ θ ( x(t),σ(t))= σ(t)σ(t) ( x(t)- x_1 (t) ). The next latent state is computed as i+1=i+σi+1−σiσ˙i⋆(i,σi) x_i+1= x_i+ _i+1- _i σ_i v_ θ ( x_i, _i). For i=0,…,T−1i=0,…,T-1, repeating this refinement before each sampling update continuously steers the denoising path toward a target that is compatible with both the generated edit and the source context. Figure 3: Probability paths for Soft-Poisson de-seaming in yellow and conventional flow-matching in gray. Left. The sampling paths move from noise ϵε toward an estimate with seams ^1 x_1 or a seamless estimate ^1⋆ x_1 . Soft-Poisson de-seaming corrects the vector field at time t and moves the sample toward the seamless distribution. Right. A comparison of the two processes, where the upper result from our method contains fewer boundary artifacts. In practice, we discretize Equation 8 for efficient numerical computation. Let N()N( p) be the set of neighboring pixels of ∈Ω~ p∈ , and let m~ m_ p denote the corresponding soft-mask value. Define J=|N()|+λem~+λs(1−m~)J_ p= ( p) + _e m_ p+ _s (1- m_ p ). The discrete equation using Jacobi iteration is (k+1)=1J[ z_ p^(k+1)= 1J_ p [ ∑∈N()∩Ω~(k)+∑∈N()\Ω~S,+∑∈N()(^1,−^1,) _ q ( p)∩ z_ q^(k)+ _ q ( p) x_S, q+ _ q ( p) ( x_1, p- x_1, q ) (9) +λem~^1,+λs(1−m~)S,]. + _e m_ p x_1, p+ _s (1- m_ p ) x_S, p ]. The complete derivation is provided in supplementary Section A. After K iterations, the refined clean feature is approximated by ^1,⋆≈(K) x_1, p ≈ z_ p^(K) for every ∈Ω~ p∈ . Experiments and visualizations demonstrate smoother boundary transitions. 4.3 Data pipeline To improve localization precision using the specified masks, we design a simple and efficient data synthesis pipeline that generates paired source images, masks, prompts, and target images. The resulting MEData dataset contains approximately 10K pairs from natural scenes and infographics. As shown in Figure 2(b), the pipeline contains object detection, prompt generation, and image generation. Given source images containing multiple concepts and potentially editable objects, object detection identifies the salient objects in each image. As there may be many visually insignificant objects whose editing provides limited value for training, we prompt a vision language model to identify the primary objects in each source image. The prompt generation stage produces two instructions for regional editing. The first is a complete instruction that specifies the editing operation, target position, and desired result. The second replaces the explicit position description with a demonstrative expression, encouraging the model to obtain localization information from the mask during training. The final image generation stage synthesizes target images and constructs their masks. We use the complete instructions with detailed positions to generate the target images. SAM (Kirillov et al., 2023) then provides an initial segmentation of each target region and then the human annotators refine these regions and create masks of arbitrary shapes that resemble practical user inputs. 5 Experiments Table 1: Editing accuracy and background preservation on MEData. Bold and underlined values indicate the best and second-ranked results, respectively. Global Background Method CLIP ↑ DINO ↑ FID ↓ PSNR ↑ SSIM ↑ MSE ↓ LPIPS ↓ Gemini 3 Flash Image 0.9724 0.9537 20.38 22.00 0.7450 0.0023 0.0505 GPT Image 2 0.9734 0.9367 24.12 16.79 0.5069 0.0181 0.2064 BAGEL-7B-MoT 0.9464 0.9055 27.74 20.80 0.7560 0.0030 0.0648 FLUX.2-dev 0.9555 0.9138 29.99 19.48 0.6644 0.0063 0.0781 HiDream-O1-Image 0.9146 0.8435 45.34 13.17 0.3613 0.0450 0.4313 QwenImage-Edit-2511 0.9492 0.9107 29.85 19.11 0.6412 0.0088 0.1269 RefineAnything 0.9621 0.9057 26.41 21.29 0.7740 0.0000 0.0007 RegionE 0.9672 0.9313 25.83 21.03 0.7399 0.0031 0.0751 SpotEdit 0.9332 0.8924 56.49 10.89 0.3001 0.0844 0.5083 MaskFlow 0.9782 0.9532 19.90 22.60 0.7846 0.0000 0.0000 5.1 Experimental settings Implementation details. We use the QwenImage-Edit-2511 model (Wu et al., 2025) and train attention LoRA modules (Hu et al., 2022; Vaswani et al., 2017). We train the model for 5K steps with rank 256 using the Prodigy optimizer (Mishchenko and Defazio, 2023). Equations 5 and 6 provide regional control during training. We solve the seamless refinement in Equation 9 using 50 Jacobi iterations by default. During inference, we use 50 sampling steps and a classifier-free guidance scale of 4.0 (Ho and Salimans, 2022). The model supports images with varying resolutions and aspect ratios. Evaluation metrics. We evaluate overall editing quality and background preservation on the MEData benchmark. CLIP similarity (Radford et al., 2021) measures semantic alignment between the edited results and reference images, while DINO similarity (Oquab et al., 2023) measures structural consistency. We also report FID (Heusel et al., 2017), PSNR (Korhonen and You, 2012), and SSIM (Wang et al., 2004) to assess image fidelity. For the ablation studies, we additionally report global LPIPS (Zhang et al., 2018) and VGG (Simonyan and Zisserman, 2014) perceptual distance. Background preservation is evaluated using mean squared error and LPIPS computed only over the unmasked regions. Figure 4: Qualitative comparison with commercial models, open sourced general image editing models, and mask-reference-based methods. Several baselines edit content outside the specified masks, as shown in (a), (b), (g), (h), and (i), alter unrelated background content, as shown in (a), (d), (e), and (f), or introduce visible boundary seams, as shown in (c), (d), and (f). MaskFlow improves localization, background preservation, and boundary transitions. Please zoom in for details. 5.2 Image editing comparisons We compare MaskFlow with commercial models (Achiam et al., 2023; Team et al., 2023), open sourced general image editing models (Deng et al., 2025; Labs, 2025; Cai et al., 2026; Wu et al., 2025), and methods designed for regional editing (Zhou et al., 2026; Chen et al., 2025; Qin et al., 2026) through qualitative and quantitative experiments. Qualitative analysis. Figure 4 presents the qualitative results. In Figure 4(b), several baselines fail to localize the edit or preserve the target identity despite receiving an explicit mask. In contrast, MaskFlow follows both the mask and the editing instruction. The example in Figure 4(h) further reveals background changes in competing methods, where text outside the target region is altered. MaskFlow replaces only the text inside the specified regions while preserving the remaining content. In the object removal example in Figure 4(f), BAGEL (Deng et al., 2025) does not follow the instruction, while QwenImage (Wu et al., 2025) edits the wrong location. Gemini (Team et al., 2023) and RefineAnything (Zhou et al., 2026) localize the removal correctly but leave visible seams between the edited foreground and preserved background. MaskFlow accurately localizes the removal and produces a smoother boundary transition. Overall, these qualitative comparisons show that MaskFlow performs the requested edits within the target regions, preserves surrounding content, and integrates the edited foreground more naturally with the background. Quantitative analysis. Table 1 reports the quantitative comparisons between our method and baselines. MaskFlow achieves the best CLIP, FID, PSNR, and SSIM scores for global image evaluations and the best background LPIPS. These results support the qualitative findings and show that MaskFlow improves editing accuracy without sacrificing the unedited background. 5.3 Ablation studies Table 2: Ablation study of the proposed modules. “MF” denotes MaskFlow, and “SPD” denotes soft-Poisson de-seaming. MF SPD FID ↓ CLIP ↑ DINO ↑ LPIPS ↓ PSNR ↑ SSIM ↑ VGG ↓ - - 29.85 0.9492 0.9106 0.2070 19.11 0.6412 7.269 ✓ - 20.51 0.9761 0.9505 0.1074 22.38 0.7828 3.991 ✓ ✓ 19.90 0.9782 0.9532 0.1047 22.60 0.7846 3.952 Figure 5: Qualitative ablation of the proposed modules. In each group, the left image shows the full result and the right image shows an enlarged view. The red arrows point out the wrong regions. Zoom in for better visualization. Effectiveness of the proposed modules. We analyze the contribution of each proposed module. As illustrated in Figure 5, the base model exhibits poor localization and background consistency given regional masks and editing instructions. MaskFlow without de-seaming refinement constrains the editable regions and preserves background details. However, visible seams may remain because the edited foreground and preserved background follow different trajectories. Adding soft-Poisson de-seaming improves visual continuity and produces smoother transitions near the boundary. The quantitative results in Table 2 support these observations. MaskFlow substantially improves all reported metrics over the base model. Soft-Poisson de-seaming provides consistent additional gains, reducing FID from 20.5120.51 to 19.9019.90 and improving PSNR from 22.3822.38 to 22.6022.60. This result confirms that the two components are complementary, with MaskFlow providing regional control and soft-Poisson de-seaming improving boundary integration. Table 3: Effect of additional textual position descriptions on regional image editing given the masks. Additional Position FID ↓ CLIP ↑ DINO ↑ LPIPS ↓ PSNR ↑ SSIM ↑ VGG ↓ ✓ 29.49 0.9472 0.8750 0.1227 21.15 0.7726 4.128 ✗ (Ours) 17.21 0.9795 0.9563 0.1036 22.74 0.7852 3.937 Figure 6: Application to infographic editing compared with the base model and a standard fine-tuning baseline. The red arrows point out the wrong edit regions. Please zoom in for details. Localization precision. This experiment studies how additional position descriptions in the prompts affect localization. In both settings, the model receives a prompt and a mask. By default, the proposed method is not trained with additional textual position descriptions, only extracting location features from the masks. To evaluate this design choice, we train another model using additional position descriptions. Table 3 presents the results. When an explicit mask is available, omitting redundant position descriptions encourages the model to rely more strongly on the spatial information in the mask. This strategy consistently improves the performance, reducing FID from 29.4929.49 to 17.2117.21. The results show that removing redundant textual position cues during training improves mask-based localization precision. 5.4 Infographic application Infographics combine visual and textual elements for applications such as commercial promotion and poster design. They often contain complex layouts, making it difficult to specify precise locations using language alone. Figure 6 shows that both the base model and the standard fine-tuning baseline fail to localize some editable regions and substantially alter background text. In contrast, MaskFlow uses masks of arbitrary shapes to constrain the editable regions and produces reliable visual and textual edits while preserving surrounding content. These results demonstrate the effectiveness and practical potential of MaskFlow for infographic editing. 6 Conclusion This paper presents MaskFlow, a training framework for regional image editing with precise localization, consistent background preservation, and seamless boundary transitions. MaskFlow incorporates the mask into the flow-matching probability path and uses a mask-aware objective to improve localization accuracy and preserve unmasked content. Training on the prompts without additional position descriptions pushes the model to learn localization from masks, further strengthening the attentions to editable regions. The proposed Soft-Poisson de-seaming module refines the vector field during sampling to produce smooth transitions between edited and preserved regions. Moreover, the constructed MEData provides a new regional editing dataset for further study. Quantitative and qualitative experiments demonstrate the effectiveness of MaskFlow on both natural scenes and infographic images, showing promise for practical application. References J. Achiam, S. Adler, S. Agarwal, L. Ahmad, I. Akkaya, F. L. Aleman, D. Almeida, J. Altenschmidt, S. Altman, S. Anadkat, et al. (2023) Gpt-4 technical report. arXiv preprint arXiv:2303.08774. Cited by: §1, §5.2. O. Avrahami, O. Fried, and D. Lischinski (2023) Blended latent diffusion. ACM transactions on graphics (TOG) 42 (4), p. 1–11. Cited by: §1, §2. S. Bai, Y. Cai, R. Chen, K. Chen, X. Chen, Z. Cheng, L. Deng, W. Ding, C. Gao, C. Ge, et al. (2025) Qwen3-vl technical report. arXiv preprint arXiv:2511.21631. Cited by: §1. T. Brooks, A. Holynski, and A. A. Efros (2023) InstructPix2Pix: learning to follow image editing instructions. In CVPR, Cited by: §1. Q. Cai, J. Chen, C. Gao, Z. Gong, Y. Li, Y. Pan, Y. Peng, Z. Qiu, K. Yu, Y. Zhang, et al. (2026) Hidream-o1-image: a natively unified image generative foundation model with pixel-level unified transformer. arXiv preprint arXiv:2605.11061. Cited by: §5.2. P. Chen, X. Zeng, M. Zhao, M. Shen, P. Ye, B. Xiang, Z. Wang, W. Cheng, G. Yu, and T. Chen (2025) RegionE: adaptive region-aware generation for efficient image editing. arXiv preprint arXiv:2510.25590. Cited by: §2, §5.2. C. Deng, D. Zhu, K. Li, C. Gou, F. Li, Z. Wang, S. Zhong, W. Yu, X. Nie, Z. Song, et al. (2025) Emerging properties in unified multimodal pretraining. arXiv preprint arXiv:2505.14683. Cited by: §1, §5.2, §5.2. A. Hertz, R. Mokady, J. Tenenbaum, K. Aberman, Y. Pritch, and D. Cohen-Or (2022) Prompt-to-prompt image editing with cross attention control. arXiv preprint arXiv:2208.01626. Cited by: §1. M. Heusel, H. Ramsauer, T. Unterthiner, B. Nessler, and S. Hochreiter (2017) Gans trained by a two time-scale update rule converge to a local nash equilibrium. Advances in neural information processing systems 30. Cited by: §5.1. J. Ho, A. Jain, and P. Abbeel (2020) Denoising diffusion probabilistic models. Advances in neural information processing systems 33, p. 6840–6851. Cited by: §1, §2. J. Ho and T. Salimans (2022) Classifier-free diffusion guidance. arXiv preprint arXiv:2207.12598. Cited by: §5.1. E. J. Hu, Y. Shen, P. Wallis, Z. Allen-Zhu, Y. Li, S. Wang, L. Wang, W. Chen, et al. (2022) Lora: low-rank adaptation of large language models.. Iclr 1 (2), p. 3. Cited by: §1, §5.1. Y. Huang, L. Xie, X. Wang, Z. Yuan, X. Cun, Y. Ge, J. Zhou, C. Dong, R. Huang, R. Zhang, et al. (2024) Smartedit: exploring complex instruction-based image editing with multimodal large language models. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, p. 8362–8371. Cited by: §1. L. Jiang, Z. Wang, J. Bao, W. Zhou, D. Chen, L. Shi, D. Chen, and H. Li (2025) Smarteraser: remove anything from images using masked-region guidance. In Proceedings of the Computer Vision and Pattern Recognition Conference, p. 24452–24462. Cited by: §2. A. Kirillov, E. Mintun, N. Ravi, H. Mao, C. Rolland, L. Gustafson, T. Xiao, S. Whitehead, A. C. Berg, W. Lo, et al. (2023) Segment anything. In 2023 IEEE/CVF international conference on computer vision (ICCV), p. 3992–4003. Cited by: §4.3. J. Y. Koh, D. Fried, and R. R. Salakhutdinov (2023) Generating images with multimodal language models. Advances in Neural Information Processing Systems 36, p. 21487–21506. Cited by: §1. J. Korhonen and J. You (2012) Peak signal-to-noise ratio revisited: is simple beautiful?. In 2012 Fourth International Workshop on Quality of Multimedia Experience, Vol. , p. 37–38. External Links: Document Cited by: §5.1. B. F. Labs (2025) FLUX.1 kontext: flow matching for in-context image generation and editing in latent space. arXiv preprint arXiv:2506.15742. Cited by: §1, §5.2. Y. Li, Y. Bian, X. Ju, Z. Zhang, J. Zhuang, Y. Shan, Y. Zou, and Q. Xu (2026) Brushedit: all-in-one image inpainting and editing. IEEE Transactions on Pattern Analysis and Machine Intelligence. Cited by: §2. Y. Lipman, R. T. Chen, H. Ben-Hamu, M. Nickel, and M. Le (2022) Flow matching for generative modeling. arXiv preprint arXiv:2210.02747. Cited by: §1, §2, §3. X. Liu, C. Gong, and Q. Liu (2022) Flow straight and fast: learning to generate and transfer data with rectified flow. arXiv preprint arXiv:2209.03003. Cited by: §2, §3. Z. Long, M. Zheng, K. Feng, X. Zhang, H. Liu, H. Yang, L. Zhang, Q. Chen, and Y. Ma (2025) Follow-your-shape: shape-aware image editing via trajectory-guided region control. arXiv preprint arXiv:2508.08134. Cited by: §2. A. Lugmayr, M. Danelljan, A. Romero, F. Yu, R. Timofte, and L. Van Gool (2022) Repaint: inpainting using denoising diffusion probabilistic models. In 2022 IEEE/CVF conference on computer vision and pattern recognition (CVPR), p. 11451–11461. Cited by: §1. N. Ma, M. Goldstein, M. S. Albergo, N. M. Boffi, E. Vanden-Eijnden, and S. Xie (2024) Sit: exploring flow and diffusion-based generative models with scalable interpolant transformers. In European Conference on Computer Vision, p. 23–40. Cited by: §2. C. Mao, J. Zhang, Y. Pan, Z. Jiang, Z. Han, Y. Liu, and J. Zhou (2025) Ace++: instruction-based image creation and editing via context-aware content filling. In Proceedings of the IEEE/CVF International Conference on Computer Vision, p. 1958–1966. Cited by: §2. K. Mishchenko and A. Defazio (2023) Prodigy: an expeditiously adaptive parameter-free learner. arXiv preprint arXiv:2306.06101. Cited by: §5.1. C. Mou, X. Wang, L. Xie, Y. Wu, J. Zhang, Z. Qi, and Y. Shan (2024) T2i-adapter: learning adapters to dig out more controllable ability for text-to-image diffusion models. In Proceedings of the AAAI conference on artificial intelligence, Vol. 38, p. 4296–4304. Cited by: §1. M. Oquab, T. Darcet, T. Moutakanni, H. Vo, M. Szafraniec, V. Khalidov, P. Fernandez, D. Haziza, F. Massa, A. El-Nouby, et al. (2023) Dinov2: learning robust visual features without supervision. arXiv preprint arXiv:2304.07193. Cited by: §5.1. W. Peebles and S. Xie (2023) Scalable diffusion models with transformers. In Proceedings of the IEEE/CVF international conference on computer vision, p. 4195–4205. Cited by: §1, §2. Y. Peng, S. Xiao, K. Wu, Q. Liao, B. Chen, K. Lin, D. Huang, J. Li, and Y. Yuan (2025) BizGen: advancing article-level visual text rendering for infographics generation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), p. 23615–23624. Cited by: §1. P. Pérez, M. Gangnet, and A. Blake (2003) Poisson image editing. ACM Trans. Graph. 22 (3), p. 313–318. External Links: ISSN 0730-0301 Cited by: §2, §3. Z. Qin, Z. Tan, Z. Wang, S. Liu, and X. Wang (2026) Spotedit: selective region editing in diffusion transformers. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, p. 18683–18692. Cited by: §2, §5.2. A. Radford, J. W. Kim, C. Hallacy, A. Ramesh, G. Goh, S. Agarwal, G. Sastry, A. Askell, P. Mishkin, J. Clark, et al. (2021) Learning transferable visual models from natural language supervision. In International conference on machine learning, p. 8748–8763. Cited by: §1, §5.1. R. Rombach, A. Blattmann, D. Lorenz, P. Esser, and B. Ommer (2022) High-resolution image synthesis with latent diffusion models. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, p. 10684–10695. Cited by: §1, §1, §2. K. Simonyan and A. Zisserman (2014) Very deep convolutional networks for large-scale image recognition. arXiv preprint arXiv:1409.1556. Cited by: §5.1. M. Tanaka, R. Kamio, and M. Okutomi (2012) Seamless image cloning by a closed form solution of a modified poisson problem. In SIGGRAPH Asia 2012 Posters, p. 1–1. Cited by: §2. Y. Tang, X. Liu, B. Zhang, T. Lan, Y. Xie, J. Lao, Y. Wang, H. Li, T. Gao, B. Pan, et al. (2026) IGenBench: benchmarking the reliability of text-to-infographic generation. arXiv preprint arXiv:2601.04498. Cited by: §1. G. Team, R. Anil, S. Borgeaud, J. Alayrac, J. Yu, R. Soricut, J. Schalkwyk, A. M. Dai, A. Hauth, K. Millican, et al. (2023) Gemini: a family of highly capable multimodal models. arXiv preprint arXiv:2312.11805. Cited by: §1, §5.2, §5.2. A. Vaswani, N. Shazeer, N. Parmar, J. Uszkoreit, L. Jones, A. N. Gomez, Ł. Kaiser, and I. Polosukhin (2017) Attention is all you need. Advances in neural information processing systems 30. Cited by: §1, §5.1. S. Wang, C. Saharia, C. Montgomery, J. Pont-Tuset, S. Noy, S. Pellegrini, Y. Onoe, S. Laszlo, D. J. Fleet, R. Soricut, J. Baldridge, M. Norouzi, P. Anderson, and W. Chan (2023) Imagen editor and editbench: advancing and evaluating text-guided image inpainting. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), p. 18359–18369. Cited by: §1, §2. Z. Wang, A.C. Bovik, H.R. Sheikh, and E.P. Simoncelli (2004) Image quality assessment: from error visibility to structural similarity. IEEE Transactions on Image Processing 13 (4), p. 600–612. External Links: Document Cited by: §5.1. N. Wasserman, N. Rotstein, R. Ganz, and R. Kimmel (2025) Paint by inpaint: learning to add image objects by removing them first. In Proceedings of the Computer Vision and Pattern Recognition Conference, p. 18313–18324. Cited by: §2. C. Wu, J. Li, J. Zhou, J. Lin, K. Gao, K. Yan, S. Yin, S. Bai, X. Xu, Y. Chen, et al. (2025) Qwen-image technical report. arXiv preprint arXiv:2508.02324. Cited by: §1, §1, §5.1, §5.2, §5.2. S. Xie, Z. Zhang, Z. Lin, T. Hinz, and K. Zhang (2023) Smartbrush: text and shape guided object inpainting with diffusion model. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, p. 22428–22437. Cited by: §1, §2. Y. Xu, J. Kong, J. Wang, X. Pan, B. Lin, and Q. Liu (2025) Insightedit: towards better instruction following for image editing. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, p. 2694–2703. Cited by: §1. L. Zhang, T. Wen, and J. Shi (2020) Deep image blending. In Proceedings of the IEEE/CVF winter conference on applications of computer vision, p. 231–240. Cited by: §2. L. Zhang, A. Rao, and M. Agrawala (2023) Adding conditional control to text-to-image diffusion models. In Proceedings of the IEEE/CVF international conference on computer vision, p. 3836–3847. Cited by: §1. R. Zhang, P. Isola, A. A. Efros, E. Shechtman, and O. Wang (2018) The unreasonable effectiveness of deep features as a perceptual metric. In 2018 IEEE/CVF conference on computer vision and pattern recognition, p. 586–595. Cited by: §5.1. Z. Zhang, J. Xie, Y. Lu, Z. Yang, and Y. Yang (2026) Enabling instructional image editing with in-context generation in large scale diffusion transformer. Advances in Neural Information Processing Systems 38, p. 139195–139227. Cited by: §1, §1. H. Zheng, Y. Yao, Y. Zhou, J. Luo, Z. Lin, et al. (2026) Pixperfect: seamless latent diffusion local editing with discriminative pixel-space refinement. Advances in Neural Information Processing Systems 38, p. 128266–128292. Cited by: §2. D. Zhou, Y. Li, Z. Yang, and Y. Yang (2026) Refineanything: multimodal region-specific refinement for perfect local details. arXiv preprint arXiv:2604.06870. Cited by: §1, §2, §5.2, §5.2. J. Zhou, J. Li, Z. Xu, H. Li, Y. Cheng, F. Hong, Q. Lin, Q. Lu, and X. Liang (2025) Fireedit: fine-grained instruction-based image editing via region-aware vision language model. In Proceedings of the Computer Vision and Pattern Recognition Conference, p. 13093–13103. Cited by: §1. J. Zhuang, Y. Zeng, W. Liu, C. Yuan, and K. Chen (2024) A task is worth one word: learning with task prompts for high-quality versatile image inpainting. In European Conference on Computer Vision, p. 195–211. Cited by: §1, §2. Appendix A Soft-Poisson De-seaming A.1 Detailed formula derivation Let the VAE-encoded source and target feature maps S,1 X_S, X_1 belong to ℝC×H×WR^C× H× W, and let S,1∈ℝCHW x_S, x_1 ^CHW denote their vectorized representations. At time t, the model predicts a vector field ((t),σ(t)) v_ θ( x(t),σ(t)). For a spatial coordinate p, we use S(),^1()∈ℝC x_S( p), x_1( p) ^C to denote the source feature and estimated target feature at that position. Let Ω denote the editable region and define the binary mask function as m()=∈Ω.m( p)= 1_ p∈ . (10) To support seamless editing, we dilate the region to Ω~⊃Ω ⊃ . Let b()∈(0,1)b( p)∈(0,1) be the normalized value produced by a finite-support Gaussian blur in the transition region. The soft mask is m~()=1,∈Ω,b(),∈Ω~\Ω,0,∈\Ω~. m( p)= cases1,& p∈ ,\\ b( p),& p∈ ,\\ 0,& p∈S . cases (11) The goal of Soft-Poisson de-seaming is to refine the vector field and reduce seams between the masked and unmasked regions. The core idea is to obtain a corrected vector field ⋆((t),σ(t)) v_ θ ( x(t),σ(t)) from the refined target estimate ^1⋆(t) x_1 (t). At time t, the target is estimated as ^1(t)=(t)−σ(t)σ˙(t)((t),σ(t)). x_1(t)= x(t)- σ(t) σ(t) v_ θ( x(t),σ(t)). (12) We reshape this estimate into a spatial feature field ^1(,t)∈ℝC x_1( p,t) ^C. Inspired by Poisson image editing in Equation 4, we optimize the following objective at time t under the boundary constraint |∂Ω~=S|∂Ω~ z|_∂ = x_S|_∂ ⋆=argmin z = *arg\,min_ z ∫Ω~‖∇()−∇^1()‖F2d _ _ p z( p)- _ p x_1( p) _F^2\,d p (13) +λe∫Ω~m~()‖()−^1()‖22d + _e _ m( p) z( p)- x_1( p) _2^2\,d p +λs∫Ω~(1−m~())‖()−S()‖22d, + _s _ (1- m( p) ) z( p)- x_S( p) _2^2\,d p, where λe,λs>0 _e, _s>0. We omit t from the spatial fields for clarity because the optimization has the same form at every time step. Let ()J( z) denote the objective function ()=∫Ω~( ( z)= _ ( ‖∇()−∇^1()‖F2 _ p z( p)- _ p x_1( p) _F^2 (14) +λem~()‖()−^1()‖22 + _e m( p) z( p)- x_1( p) _2^2 +λs(1−m~())∥()−S()∥22)d. + _s (1- m( p) ) z( p)- x_S( p) _2^2 )\,d p. We solve this problem using a variational method. Consider a small perturbation ϵ()ε η( p), where ()∈ℝC η( p) ^C is an arbitrary differentiable vector field satisfying |∂Ω~= η|_∂ = 0. At an extremum, the first variation must satisfy dϵ(+ϵ)|ϵ=0=0. . ddεJ( z+ε η) |_ε=0=0. (15) Term 1. Define the gradient-alignment term as g(+ϵ)=∫Ω~‖∇(+ϵ)−∇^1‖F2d.J_g( z+ε η)= _ _ p( z+ε η)- _ p x_1 _F^2\,d p. (16) Its derivative at ϵ=0ε=0 is dϵg(+ϵ)|ϵ=0= . ddεJ_g( z+ε η) |_ε=0= 2∫Ω~⟨∇−∇^1,∇⟩Fd 2 _ _ p z- _ p x_1, _ p η _F\,d p (17) = = 2∫∂Ω~⊤(∇−∇^1)ds 2 _∂ η ( _ p z- _ p x_1 ) n\,ds −2∫Ω~⊤(Δ−Δ^1)d -2 _ η ( _ p z- _ p x_1 )\,d p (18) = = −2∫Ω~⊤(Δ−Δ^1)d, -2 _ η ( _ p z- _ p x_1 )\,d p, (19) where the second equality follows from integration by parts, n is the outward unit normal vector, and the boundary integral vanishes because |∂Ω~= η|_∂ = 0. Term 2. Define the edited-content alignment term as e(+ϵ)=λe∫Ω~m~()‖(+ϵ)−^1‖22d.J_e( z+ε η)= _e _ m( p) ( z+ε η)- x_1 _2^2\,d p. (20) Its derivative at ϵ=0ε=0 is dϵe(+ϵ)|ϵ=0=2λe∫Ω~m~()(−^1)⊤d. . ddεJ_e( z+ε η) |_ε=0=2 _e _ m( p) ( z- x_1 ) η\,d p. (21) Term 3. Define the source-alignment term as s(+ϵ)=λs∫Ω~(1−m~())‖(+ϵ)−S‖22d.J_s( z+ε η)= _s _ (1- m( p) ) ( z+ε η)- x_S _2^2\,d p. (22) Its derivative at ϵ=0ε=0 is dϵs(+ϵ)|ϵ=0=2λs∫Ω~(1−m~())(−S)⊤d. . ddεJ_s( z+ε η) |_ε=0=2 _s _ (1- m( p) ) ( z- x_S ) η\,d p. (23) Combining the three terms gives 0=2∫Ω~[ 0=2 _ [ −(Δ−Δ^1)+λem~()(−^1) - ( _ p z- _ p x_1 )+ _e m( p) ( z- x_1 ) (24) +λs(1−m~())(−S)]⊤d. + _s (1- m( p) ) ( z- x_S ) ] η\,d p. Because this equality holds for every differentiable η satisfying the homogeneous boundary condition, the vector-valued integrand must vanish. Rearranging the resulting equation gives ( ( −Δ+λem~()+λs(1−m~()))()= - _ p+ _e m( p)+ _s(1- m( p)) ) z( p)= −Δ^1() - _ p x_1( p) (25) +λem~()^1()+λs(1−m~())S(), + _e m( p) x_1( p)+ _s(1- m( p)) x_S( p), where |∂Ω~=S|∂Ω~ z|_∂ = x_S|_∂ . A.2 Discretization To solve Equation 25 in the discrete latent feature space, we discretize the spatial differential operators. Let =(i,j) p=(i,j) be a pixel in Ω~ , let N()N( p) denote its neighboring pixels, and let ∈ℝC z_ p ^C be the feature vector at p. The discrete negative Laplacian L is ()=∑∈N()(−)=|N()|−∑∈N().( L z)_ p= _ q ( p)( z_ p- z_ q)= ( p) z_ p- _ q ( p) z_ q. (26) The boundary condition |∂Ω~=S|∂Ω~ z|_∂ = x_S|_∂ remains in effect. For a neighbor ∈N()∩Ω~ q ( p)∩ , the value z_ q is unknown and must be solved. For a neighbor ∈N()\Ω~ q ( p) , the boundary condition provides the known value =S,. z_ q= x_S, q. (27) Therefore, ()=|N()|−∑∈N()∩Ω~−∑∈N()\Ω~S,.( L z)_ p= ( p) z_ p- _ q ( p)∩ z_ q- _ q ( p) x_S, q. (28) Using Equation 28, we discretize Equation 25. Let m~ m_ p be the soft-mask value at p and define J=|N()|+λem~+λs(1−m~).J_ p= ( p) + _e m_ p+ _s(1- m_ p). (29) The discrete system is J−∑∈N()∩Ω~= J_ p z_ p- _ q ( p)∩ z_ q= ∑∈N()\Ω~S,+∑∈N()(^1,−^1,) _ q ( p) x_S, q+ _ q ( p) ( x_1, p- x_1, q ) (30) +λem~^1,+λs(1−m~)S,. + _e m_ p x_1, p+ _s(1- m_ p) x_S, p. In practice, we use the four-neighbor stencil N()=(i+1,j),(i−1,j),(i,j+1),(i,j−1),|N()|=4.N( p)=\(i+1,j),(i-1,j),(i,j+1),(i,j-1)\, ( p) =4. (31) The neighborhood sum can be implemented efficiently using convolution. A.3 Jacobi iteration Soft-Poisson de-seaming obtains the corrected vector field ⋆((t),σ(t)) v_ θ ( x(t),σ(t)) from the refined target ^1⋆(t) x_1 (t), which is approximated by solving Equation 30. We use Jacobi iteration because of its simplicity. The update is (k+1)=1J[ z_ p^(k+1)= 1J_ p [ ∑∈N()∩Ω~(k)+∑∈N()\Ω~S,+∑∈N()(^1,−^1,) _ q ( p)∩ z_ q^(k)+ _ q ( p) x_S, q+ _ q ( p) ( x_1, p- x_1, q ) (32) +λem~^1,+λs(1−m~)S,]. + _e m_ p x_1, p+ _s(1- m_ p) x_S, p ]. After K∈ℕ+K∈N^+ iterations, we use (K) z_ p^(K) as the approximate solution ⋆ z_ p for every ∈Ω~ p∈ . A.4 Vector field refinement with Poisson editing Solving Equation 32 gives the local refined solution ⋆(t)≈(K) z_ p (t)≈ z_ p^(K) for ∈Ω~ p∈ at time t. Combining this solution with S() x_S( p) for ∉Ω~ p∉ forms a complete refined feature map ^1⋆(t)∈ℝC×H×W X_1 (t) ^C× H× W. We then obtain ^1⋆(t)=vec(^1⋆(t))∈ℝCHW x_1 (t)=vec( X_1 (t)) ^CHW and calculate the corrected vector field as ⋆((t),σ(t))=σ˙(t)σ(t)((t)−^1⋆(t)). v_ θ ( x(t),σ(t))= σ(t)σ(t) ( x(t)- x_1 (t) ). (33) The next latent state is then obtained using i+1=i+σi+1−σiσ˙i⋆(i,σi). x_i+1= x_i+ _i+1- _i σ_i v_ θ ( x_i, _i). (34) For i=0,…,T−1i=0,…,T-1, we repeat the Poisson refinement before each sampling update until obtaining the final edited image T x_T. No refinement is required at the terminal state, where σT=0 _T=0.