14 lines
723 B
Python
14 lines
723 B
Python
|
"""
|
|||
|
Dual Attention Network for Scene Segmentation---CVPR2019
|
|||
|
|
|||
|
论文地址:https://arxiv.org/pdf/1809.02983.pdf
|
|||
|
这是CVPR2019的文章,思想上非常简单,就是将self-attention用到场景分割的任务中,
|
|||
|
不同的是self-attention是关注每个position之间的注意力,而本文将self-attention做了一个拓展,
|
|||
|
还做了一个通道注意力的分支,操作上和self-attention一样,不同的通道attention中把生成Q,K,V的三个Linear去掉了。最后将两个attention之后的特征进行element-wise sum。
|
|||
|
"""
|
|||
|
from attention.DANet import DAModule
|
|||
|
import torch
|
|||
|
|
|||
|
input = torch.randn(50, 512, 7, 7)
|
|||
|
danet = DAModule(d_model=512, kernel_size=3, H=7, W=7)
|
|||
|
print(danet(input).shape)
|