[论文解读] Focal Modulation Networks
Focal Modulation Networks 用聚焦调制模块取代自注意力,通过深度卷积聚合多尺度上下文并对每个标记查询进行调制,在分类、检测和分割任务上取得最先进的结果,且保持具有竞争力的效率。
We propose focal modulation networks (FocalNets in short), where self-attention (SA) is completely replaced by a focal modulation mechanism for modeling token interactions in vision. Focal modulation comprises three components: (i) hierarchical contextualization, implemented using a stack of depth-wise convolutional layers, to encode visual contexts from short to long ranges, (ii) gated aggregation to selectively gather contexts for each query token based on its content, and (iii) element-wise modulation or affine transformation to inject the aggregated context into the query. Extensive experiments show FocalNets outperform the state-of-the-art SA counterparts (e.g., Swin and Focal Transformers) with similar computational costs on the tasks of image classification, object detection, and segmentation. Specifically, FocalNets with tiny and base size achieve 82.3% and 83.9% top-1 accuracy on ImageNet-1K. After pretrained on ImageNet-22K in 224 resolution, it attains 86.5% and 87.3% top-1 accuracy when finetuned with resolution 224 and 384, respectively. When transferred to downstream tasks, FocalNets exhibit clear superiority. For object detection with Mask R-CNN, FocalNet base trained with 1 imes outperforms the Swin counterpart by 2.1 points and already surpasses Swin trained with 3 imes schedule (49.0 v.s. 48.5). For semantic segmentation with UPerNet, FocalNet base at single-scale outperforms Swin by 2.4, and beats Swin at multi-scale (50.5 v.s. 49.7). Using large FocalNet and Mask2former, we achieve 58.5 mIoU for ADE20K semantic segmentation, and 57.9 PQ for COCO Panoptic Segmentation. Using huge FocalNet and DINO, we achieved 64.3 and 64.4 mAP on COCO minival and test-dev, respectively, establishing new SoTA on top of much larger attention-based models like Swinv2-G and BEIT-3. Code and checkpoints are available at https://github.com/microsoft/FocalNet.
研究动机与目标
- 开发一种无注意力机制,以在视觉任务中建模输入相关的长程交互。
- 利用多级分层调制来捕捉短程和长程视觉上下文。
- 展示在分类、检测和分割方面,相较于最先进的基于自注意力的模型,在精度和效率上的提升。
提出的方法
- 用 Focal Modulation 模块替代自注意力,首先在多个聚焦层级通过深度卷积聚集上下文。
- 通过门控聚合机制从聚合的上下文计算调制器,然后通过逐元素仿Affine式交互将其注入查询。
- 使用两步上下文聚集:(i) 使用堆叠的深度卷积实现分层上下文化,(ii) 通过门控聚合形成每个标记的调制器。
- 定义 y_i = q(x_i) ⊙ h(Z_out),其中 Z_out 编码多层上下文,门控权重选择各层的贡献。
- 引入非线性(GeLU)以及维持平移不变性与调制的显式输入依赖性的设计选择。
- 讨论复杂度:主要由 3C^2 + C(2L+3) + C∑(k^ℓ)^2 所控制,并实现高效的无注意力标记交互。
实验结果
研究问题
- RQ1一个无注意力的调制机制是否能够在视觉模型的分类、检测和分割任务中达到或超过自注意力?
- RQ2先进行多尺度上下文聚合再进行逐标记调制,是否在提高精度的同时维持或提升计算效率?
- RQ3在密集预测任务和大规模预训练设置中,Focal Modulation 与 Swin 与 Focal Transformers 的比较如何?
- RQ4与传统注意力机制相比,焦点调制带来哪些定性可解释性方面的好处?
主要发现
- FocalNets 在图像分类、目标检测和分割方面,成本相当的情况下,超越了基于自注意力的最先进对手。
- Tiny 与 Base FocalNets 在 ImageNet-1K 上达到 82.3% 和 83.9% 的 top-1,在 ImageNet-22K 进行预训练后(224^2/384^2 微调)进一步提升至 86.5%/87.3% top-1。
- 在 COCO 目标检测中,采用 1× 计划训练的 FocalNet base 超越了 Swin 的 3×,并在检测变体上展现出竞争力的结果。
- 在 ADE20K 分割中,FocalNet base 达到单尺度 50.5 mIoU,超越 Swin 多尺度(49.7);大规模 FocalNet 分别在 ADE20K 和 COCO Panoptic 达到 58.5 mIoU 和 57.9 PQ。
- 当与更大骨干网和训练方案搭配时,FocalNets 在 COCO minival/test-dev 的 mAP 上确立新的状态最优,模型包括 Swinv2-G 和 BEIT-3。
- 可视化结果表明调制器聚焦于诱发识别类别的目标区域,凸显了 FocalNets 的可解释性。
更好的研究,从现在开始
从论文设计到论文写作,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。