NeurIPS 2021 | GFNet:用于图像分类的全局滤波网络

代码:https://github.com/raoyongming/GFNet
摘要:
本文提出一个全局滤波网络GFNet,用傅里叶变换处理代替ViT中的注意力机制,其中二维离散傅里叶变换将输入的空间特征转换为频域特征,然后通过全局滤波处理,最后反变换映射回空间域。解决了token大小改变带来的计算量问题。实验结果表明改进后的网络在计算速度和参数量/泛化能力上有提升。
Introduction
Transformer与MLP模型的发展证明了其具有以更少的归纳偏置取得更佳性能的潜力,这些模型往往基于从原始数据学习空间位置上相关性。这些自注意力与MLP的计算复杂度会随图像尺寸迅速增长O(N^2),这使得其难以满足高分辨率特征需求。
复杂度对比
频谱图表示图像梯度的分布图,所以原图和频率图上的点不是一一对应的,频谱图上的点表示空域图某点的灰度梯度大小,梯度大其频率高.经过傅里叶变换后,在频域中计算某一位置的信息时,对应空间域多个位置的信息,有综合考虑整个图像的效果,与transformer的自注意力层异曲同工。由此,本文提出了全局滤波器网络(GFNet),一种概念简单且高效的架构,它在频域以log-linear复杂度学习长距离空间依赖。GFNet在ImageNet以及下游任务上表现出了非常有力的精度-复杂度均衡。相比Transformer与CNN模型,在高效性、泛化性以及鲁棒性方面极具竞争力。
Architecture
GFNet基于ViT改进了注意力机制,如下图绿色部分。结构
代码部分
实现代码
滤波器初始化的时候将数据*0.02,作用是将数变小,均值还是0方差变成原来的0.0004,猜测是希望初始化数据不要太分散了。然后加入了输入x是空间形状的判断,这里特征图是在网络中被展平之后传入,所以将他复原成二维之后再傅里叶变换。
实验
在这里插入图片描述
GFNet不同版本的详细配置:
GFNet-XS与 DeiT-S 和 ResMLP-12 具有类似的架构
GFNet-Ti、GFNet-S 和 GFNet-B对应 ResNet-18、 50 和 101有相似的计算代价
GFNet-H-Ti、GFNet-H-S和 GFNet-H-B对应 ResNet-18、 50 和 101
在这里插入图片描述
“↑384”表示在30个epoch的384 × 384图像上微调的模型
在这里插入图片描述
在这里插入图片描述
可以看到泛化和鲁棒性都有所提高
在这里插入图片描述
可视化中,频域可以学到更有区别的特征表示,空间域就比较模糊
总结:
·本文提出一个全局滤波网络GFNet,用傅里叶变换处理代替ViT中的注意力机制,其中二维离散傅里叶变换将输入的空间特征转换为频域,然后通过全局滤波处理,最后反变换映射回空间域。
·解决了token数量带来的计算复杂度问题,以及token大小的限制。实验结果表明改进后的网络在计算速度和参数量/泛化能力上有提升。
·傅里叶变换应用到对特征图处理,可以考虑到全局位置信息,是很好的改进方向

Most existing state-of-the-art image denoising algorithms are based on exploiting similarity between a relatively modest number of patches. These patch-based methods are strictly dependent on patch matching, and their performance is hamstrung by the ability to reliably find sufficiently similar patches. As the number of patches grows, a point of diminishing returns is reached where the performance improvement due to more patches is offset by the lower likelihood of finding sufficiently close matches. The net effect is that while patch based methods, such as BM3D, are excellent overall, they are ultimately limited in how well they can do on (larger) images with increasing complexity. In this paper, we address these shortcomings by developing a paradigm for truly global filtering where each pixel is estimated from all pixels in the image. Our objectives in this paper are two-fold. First, we give a statistical analysis of our proposed global filter, based on a spectral decomposition of its corresponding operator, and we study the effect of truncation of this spectral decomposition. Second, we derive an approximation to the spectral (principal) components using the Nyström extension. Using these, we demonstrate that this global filter can be implemented efficiently by sampling a fairly small percentage of the pixels in the image. Experiments illustrate that our strategy can effectively globalize any existing denoising filters to estimate each pixel using all pixels in the image, hence improving upon the best patch-based methods.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值