【论文阅读 AAAI2025】FOCUS: Towards Universal Foreground Segmentation

标题

FOCUS: Towards Universal Foreground Segmentation

papercode

动机

 “Previous research has typically designed task-specific architectures for each task, leading to a lack of unification. Moreover, they primarily focus on recognizing foreground objects without effectively distinguishing them from the background.”
 ——以往的研究通常为每个任务设计特定于任务的架构,导致缺乏统一。此外,它们主要关注识别前景物体,而没有有效地将其与背景区分开来。

  1. 现有研究缺乏前景分割任务统一处理的有效方法;

本文贡献

  1. 提出了一个统一的前景分割框架;

  2. 提出了一个新的模块,通过对比学习利用背景信息细化分割掩码;

  3. 实验,SOTA

方法

 本文认为需要解决两个问题:

  1. 如何对不同前景分割任务的前景和背景进行一般化表示?

  2. 如何充分利用图像的背景信息来优化预测结果?

 对于问题(1),本文借用了DETRobject query概念,引入了ground query(GQ),同时使用multi-scale策略提取图像特征,使用masked attention让使GQ专注于与前景和背景对应的相关特征。使用backbone提取的特征图对masked attention进行初始化,以提供定位的先验信息。在这个过程中,ground query自适应地学习与不同任务上下文相关的特征,使其成为通用特征。

 对于问题(2),本文引入了对比学习策略,并通过CLIP的多模态学习能力校正模型生成的掩码。

图1 下

FOCUS框架

图2

FOCUS详细框架

整体流程

  1. Backbone(DINOv2)和Edge Enhancer模块提取多尺度边缘增强的特征;

  2. Pixel Decoder生成像素级输出,并将像素级特征与 \(\bold{GQ}\) 一起输入Transformer Decoder;

  3. Transformer Decoder用masked attention更新 \(\bold{GQ}\),获得ground-centric输出,该过程可以描述为

\[\bold{X}_l=\text{softmax}(\mathcal{M}_{l-1}+\bold{GQ}_l\bold{K}^\mathsf{T}_l)\bold{V}_l+\bold{X}_{l-1} \]

  其中 \(\bold{K}_l, \bold{V}_l \in \mathbb{R}^{H_lW_l \times C}\) 表示pixel decoder第 \(l\) 个block线性变换后的 \(C\) 维图像特征。\(\bold{X}_l \in \mathbb{R}^{2 \times C}\) 表示第 \(l\) 个Transformer Decoder block的query特征,\(\bold{X}_0\) 通过Transformer Decoder的输入query特征初始化。

  \(\bold{GQ}_l \in \mathbb{R}^{2 \times C}\)是第 \(l\) 个ground query,\(\mathcal{M}_{l-1}\) 定义为:

\[\mathcal{M}_{l-1}(x, y) = \begin{cases} 0 & \text{if} \ \bold{M}_{l-1}(x, y) = 1 \\ -\infty & \text{otherwise} \end{cases} \]

  对 \(\bold{GQ}_{l-1}\) 解码和二值化,得到 \(\bold{M}_{l-1} \in \{0,1\}^{2 \times H_l W_l}\) ,其维度与 \(\bold{K}_l\) 一致。

  对DINOv2的最后一个block的特征图进行PCA和二值化,以初始化注意力掩码 \(\mathcal{M}_0\)\(\mathcal{M}_0\) 形式化为:

\[\mathcal{M}_0(x, y) = \begin{cases} 0 & \text{if} \ \bold{F}_{DINOv2}(x, y)=1 \\ -\infty & \text{otherwise} \end{cases} \]

  其中 \(\bold{F}_{DINOv2}\) 表示DINOv2的最后一个block生成的二值特征图,它被resize到与 \(\bold{K}_1\) 相同的分辨率。这种新的初始化方法可以充分利用DINOv2在大规模数据上学习到的定位先验知识。

  1. 使用两个多层感知机,记为mask head和class head,来对ground queries进行解码,并同时生成前景和背景的掩码和类别预测。

Edge Enhancer

Edge Enhancer

Edge Enhancer

目标:利用目标的边缘信息校正backbone生成的图像特征。

 先对图像进行灰度处理,然后进行高斯平滑,ResNet50提取灰度图像边缘特征,用边缘检测器(Canny)获取梯度图,并将其叠加在原始图像上。

 再通过ResNet提取图像特征,每个block生成的特征会被flatten,并通过 \(1 \times 1\) 卷积投影到相同的维度 \(D\),得到特征金字塔 \(F^1_{\text{edge}} \in \mathbb{R}^{(\frac{HW}{8^2} + \frac{HW}{16^2} + \frac{HW}{32^2}) \times D}\)

Injector block

 Injector block的结构与ViT-Adapter相同,利用cross attention对来自backbone和ResNet的特征进行融合,这个过程形式化为:

\[\hat{F}^i_\text{DINOv2}=F^i_\text{DINOv2}+\gamma^i \text{MSDA}(F^i_\text{DINOv2}, F^i_\text{edge}) \]

 其中MSDA表示多尺度可变形注意力(multi-scale deformable attention),它将归一化的backbone特征 \(F^i_\text{DINOv2} \in \mathbb{R}^{\frac{HW}{16^2} \times D}\) 作为query,将归一化的边缘特征 \(F^i_\text{edge} \in \mathbb{R}^{(\frac{HW}{8^2} + \frac{HW}{16^2} + \frac{HW}{32^2}) \times D}\) 作为key和value。

\(\gamma^i\) 是可学习的参数,用于平衡backbone特征和融合特征。

Extractor block

 该过程可以形式化为:

\[\hat{F}^i_\text{edge}=F^i_\text{edge}+\text{ConvFFN(MSDA}(F^i_\text{edge}, F^{i+1}_\text{DINOv2})) \]

 这里的MSDA将边缘特征 \(F^i_\text{edge} \in \mathbb{R}^{(\frac{HW}{8^2} + \frac{HW}{16^2} + \frac{HW}{32^2}) \times D}\) 作为query,将输出特征 \(F^{i+1}_\text{DINOv2} \in \mathbb{R}^{\frac{HW}{16^2} \times D}\) 作为key和value。

 ConvFFN表示两个全连接层和一个深度可分离卷积层,\(\hat{F}^i_\text{edge}\) 会作为下一个injector的输入。

 backbone不同模块的输出会上采样到1/4、1/8、1/16和1/32的分辨率,最后一个extractor的输出会被split,并恢复原始大小,然后将上采样的backbone特征、extractor对应的split输出 以及 STEM的输出 相加,获得边缘增强的多尺度图像特征。这些特征会作为pixel decoder的输入。

CLIP Refiner

目标:利用CLIP的多模态能力校正前景和背景掩码。

 CLIP refiner仅用于从CLIP做知识蒸馏,在推理阶段会被舍去。

 image encoder和text encoder在训练时会被冻结,以充分利用CLIP的多模态能力。

CLIP Refiner中对比损失的计算

\[\mathcal{L}_\text{i2t}=-\frac{1}{2} \bigg [ \log \frac{\exp(I_f \cdot T_f / \tau)}{\exp(I_f \cdot T_f / \tau) + \exp(I_f \cdot T_b / \tau)} + \log \frac{\exp(I_b \cdot T_b / \tau)}{\exp(I_b \cdot T_b / \tau) + \exp(I_b \cdot T_f / \tau)} \bigg ] \]

\[\mathcal{L}_\text{t2i}=-\frac{1}{2} \bigg [ \log \frac{\exp(T_f \cdot I_f / \tau)}{\exp(T_f \cdot I_f / \tau) + \exp(T_f \cdot I_b / \tau)} + \log \frac{\exp(T_b \cdot I_b / \tau)}{\exp(T_b \cdot I_b / \tau) + \exp(T_b \cdot I_f / \tau)} \bigg ] \]

\[\mathcal{L}_\text{clip}=\frac{1}{2}(\mathcal{L}_\text{i2t}+\mathcal{L}_\text{t2i}) \]

 其中 \(I_f, I_b, T_f, T_b \in \mathbb{R}^{2 \times S}\) 表示CLIP生成的 \(S\) 维度的前景和背景的图像特征和文本特征,\(\tau\) 表示用于控制softmax函数平滑的温度参数。

实验

SOD: salient object detection

SD: shadow detection

DBD: defocus blur detection

FD: forgery detection

与其他COD的SOTA方法比较

Edge Enhancer

Table 1: Comparison of FOCUS with recent state-of-the-art COD methods.

与其他SOD的SOTA方法比较

Edge Enhancer

Table 2: Comparison of FOCUS with recent state-of-the-art SOD methods.

与其他SD、DBD和FD的SOTA方法比较

Edge Enhancer

Table 3: Comparison of FOCUS with recent state-of-the-art SD, DBD, and FD methods.

定性评估

Edge Enhancer

Figure 3: Qualitative comparison of FOCUS and previous methods on COD, SOD, SD, DBD, and FD. Zoom in for more details.

消融实验

Edge Enhancer

Table 4: Ablation study results of the proposed modules or methods of FOCUS, including CLIP Refiner (CR), Jointly Prediction (JP), Edge Enhancer (EE), and Pretrain (PR). ⋄ means training with the DINOv2 backbone frozen.

posted @ 2025-06-19 22:22  scarverm  阅读(270)  评论(0)    收藏  举报