快速实现形状差异大的概念替换,保持图像前后景一致
InstantSwap: Fast Customized Concept Swapping across Sharp Shape Differences
- 基于注意力图自动提取目标框,分离前景与背景处理
- 仅在目标框内更新梯度,提升速度且保持前后景一致性
- 无需训练,推理高效,适合实时应用与高形状差异场景
近期的定制化概念替换(CCS)技术使文生图模型可将源图像中的概念替换为自定义目标概念。然而,现有方法在形状差异大时仍面临前后景不一致、效率低的问题:要么需耗时训练,要么推理时冗余计算。为此,我们提出InstantSwap,一种针对显著形状差异的快速替换方法。首先通过注意力图分析自动提取源图像中物体的边界框(bbox),利用bbox实现前后景一致性——对背景,交换过程中移除框外梯度以防止修改;对前景,采用跨注意力机制将语义信息注入框内源与目标概念,学习语义增强表示,引导替换聚焦于前景。为提升速度,不每步计算梯度,而是周期性计算,大幅减少前向传播次数,性能损失极小。最后构建基准数据集用于全面评估。大量实验验证了InstantSwap的优越性与泛化能力。
原文摘要 · Abstract (English)
Recent advances in Customized Concept Swapping (CCS) enable a text-to-image model to swap a concept in the source image with a customized target concept. However, the existing methods still face the challenges of inconsistency and inefficiency. They struggle to maintain consistency in both the foreground and background during concept swapping, especially when the shape difference is large between objects. Additionally, they either require time-consuming training processes or involve redundant calculations during inference. To tackle these issues, we introduce InstantSwap, a new CCS method that aims to handle sharp shape disparity at speed. Specifically, we first extract the bbox of the object in the source image automatically based on attention map analysis and leverage the bbox to achieve both foreground and background consistency. For background consistency, we remove the gradient outside the bbox during the swapping process so that the background is free from being modified. For foreground consistency, we employ a cross-attention mechanism to inject semantic information into both source and target concepts inside the box. This helps learn semantic-enhanced representations that encourage the swapping process to focus on the foreground objects. To improve swapping speed, we avoid computing gradients at each timestep but instead calculate them periodically to reduce the number of forward passes, which improves efficiency a lot with a little sacrifice on performance. Finally, we establish a benchmark dataset to facilitate comprehensive evaluation. Extensive evaluations demonstrate the superiority and versatility of InstantSwap. Project Page: https://instantswap.github.io/
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。