ContextDrag: 通过上下文保留的标记注入和位置对齐注意力实现精确的拖动式图像编辑
ContextDrag: Precise Drag-Based Image Editing via Context-Preserving Token Injection and Position-Aligned Attention
AI总结:
本文提出ContextDrag,首个将拖动式操作引入上下文图像编辑的框架,通过上下文保留的标记注入和位置对齐注意力实现精确拖动编辑,提升编辑精度与质量。
摘要:
拖动式图像编辑通过点基拖动操作实现直观的视觉操控。现有方法主要依赖扩散反向或像素空间变形配以修复。然而,反向操作固有地引入近似误差,降低纹理保真度;而刚性像素空间操作丢弃语义上下文,产生不自然变形。为解决这些问题,我们引入ContextDrag,据我们所知,这是首个将拖动式操作引入上下文图像编辑范式的框架。通过利用编辑模型(如FLUX-Kontext)的上下文能力,ContextDrag在不使用反向或微调的情况下实现精确拖动编辑。具体而言,我们首先提出上下文保留的标记注入(CTI),将VAE编码的参考特征注入到注意力层中,通过在用户指定的控制点直接估计的潜在空间对应关系进行空间对齐。通过操作干净的直接编码特征而非噪声反向输出,CTI保留丰富的纹理细节并实现精确的拖动控制。其次,我们提出位置对齐注意力(PAA)以消除参考特征空间位移引起的干扰。PAA重新编码位移参考标记的位置嵌入以匹配其目标位置,并屏蔽源与目标之间的重叠区域以防止冲突特征降低视觉一致性。在DragBench-SR和DragBench-DR上的实验表明,ContextDrag实现了SOTA编辑准确度和整体质量,全面的消融验证了每个提出组件的有效性。代码将公开提供。
英文摘要:
Drag-based image editing enables intuitive visual manipulation through point-based drag operations. Existing methods mainly rely on diffusion inversion or pixel-space warping with inpainting. However, inversion inherently introduces approximation errors that degrade texture fidelity, whereas rigid pixel-space operations discard semantic context and produce unnatural deformations. To address these issues, we introduce ContextDrag, to our knowledge the first framework that brings drag-based manipulation into the in-context image editing paradigm. By leveraging the in-context capabilities of editing models (e.g., FLUX-Kontext), ContextDrag enables precise drag editing without inversion or fine-tuning. Specifically, we first propose Context-preserving Token Injection (CTI), which injects VAE-encoded reference features into attention layers at spatially aligned target positions, guided by latent-space correspondences estimated directly from user-specified control points. By operating on clean, directly encoded features rather than noisy inversion outputs, CTI preserves rich texture details and enables precise drag control. Second, we propose Position-Aligned Attention (PAA) to eliminate interference caused by spatial displacement of reference features. PAA re-encodes positional embeddings of displaced reference tokens to match their target locations, and masks overlapping regions between source and destination to prevent conflicting features from degrading visual consistency. Experiments on DragBench-SR and DragBench-DR demonstrate that ContextDrag achieves SOTA editing accuracy and overall quality, and comprehensive ablations validate the effectiveness of each proposed component. Code will be publicly available.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。