当前位置:网站首页>【医学分割】attention-unet
【医学分割】attention-unet
2022-07-07 14:17:00 【可乐大牛】
概述
attention-unet主要的贡献就是提出了attention gate,它即插即用,可以直接集成到unet模型当中,作用在于抑制输入图像中的不相关区域,同时突出特定局部区域的显著特征,并且它用soft-attention 代替hard-attention,所以attention权重可以由网络学习,并且不需要额外的label,只增加少量的计算量。
细节
结构
核心还是unet的结构,但是在做skip-connection的时候,中间加了一个attention gate,经过这个ag之后,再进行concat操作。因为encoder中的细粒度信息相对多一点,但是很多是不需要的冗余的,ag相当于是对encoder的当前层进行了一个过滤,抑制图像中的无关信息,突出局部的重要特征。
attention gate
两个输入分别是encoder的当前层 x l x^l xl和decoder的下一层 g g g,他们经过1x1的卷积(将通道数变为一致之后),再做逐元素的相加,然后经过relu,1x1的卷积(将通道数降为1)和sigmoid得到注意力系数,然后再经过一个resample模块将尺寸还原回来,最后就可以使用注意力系数对特征图进行加权了。
注:这里是3D的,2D理解的话,直接去掉最后一个维度就好了。

一些解释:为什么要两个输入做加法而不是直接根据encoder的当前层得到注意力系数呢?
可能是因为,首先处理完成之后的两张相同尺寸和通道数的特征图,提取的特征是不同的。那么这么操作能够使相同的感兴趣区域的信号加强,同时各自不同的区域也能作为辅助,两份加起来辅助信息也会更多。或者说是对核心信息的进一步强调,同时又不忽视那些细节信息。
为什么需要resample呢?
因为 x l 与 g x^l与g xl与g的尺寸是不相同的,显然 g g g的尺寸是 x l x^l xl的一半,他们不可能进行逐元素的相加,所以需要将两个尺寸变得一致,要么大的下采样要么小的上采样,实验出来是大的下采样效果好。但是这个操作之后得到的就是注意力系数了,要和 x l x^l xl做加权肯定要尺寸相同的,所以还得重新上采样。
attention
Attention函数的本质可以被描述为一个查询(query)到一系列(键key-值value)对的映射
在计算attention时主要分为三步:
- 第一步是将query和每个key进行相似度计算得到权重,常用的相似度函数有点积,拼接,感知机等;
- 第二步一般是使用一个softmax函数对这些权重进行归一化;
- 最后将权重和相应的键值value进行加权求和得到最后的attention。
hard-attention:一次选择一个图像的一个区域作为注意力,设成1,其他设为0。他是不能微分的,无法进行标准的反向传播,因此需要蒙特卡洛采样来计算各个反向传播阶段的精度。 考虑到精度取决于采样的完成程度,因此需要其 他技术(例如强化学习)。
soft-attention:加权图像的每个像素。 高相关性区域乘以较大的权重,而低相关性区域标记为较小的权重。权重范围是(0-1)。他是可微的,可以正常进行反向传播。
边栏推荐
- Three singleton modes of unity (hungry man, lazy man, monobehavior)
- 3000 words speak through HTTP cache
- The unity vector rotates at a point
- 【Vulnhub靶场】THALES:1
- Laravel 中config的用法
- Excessive dependence on subsidies, difficult collection of key customers, and how strong is the potential to reach the dream of "the first share of domestic databases"?
- Laravel post shows an exception when submitting data
- laravel中将session由文件保存改为数据库保存
- Iptables only allows the specified IP address to access the specified port
- logback. XML configure logs of different levels and set color output
猜你喜欢

SPI master RX time out interrupt

Sysom case analysis: where is the missing memory| Dragon lizard Technology
![[flower carving experience] 15 try to build the Arduino development environment of beetle esp32 C3](/img/8f/ca9ab042916f68de7994d9f2124da9.jpg)
[flower carving experience] 15 try to build the Arduino development environment of beetle esp32 C3

Tragedy caused by deleting the console statement

AutoLISP series (1): function function 1

Three. JS series (1): API structure diagram-1

Talk about the cloud deployment of local projects created by SAP IRPA studio

【Vulnhub靶场】THALES:1

torch. Numel action

The difference and working principle between compiler and interpreter
随机推荐
Three. JS series (3): porting shaders in shadertoy
Leetcode-136-只出现一次的数(用异或来解答)
prometheus api删除某个指定job的所有数据
Laravel 中config的用法
Eye of depth (VI) -- inverse of matrix (attachment: some ideas of logistic model)
How to implement backspace in shell
Logback日志框架第三方jar包 免费获取
Opportunity interview experience summary
Unity drawing plug-in = = [support the update of the original atlas]
Performance measure of classification model
MySQL数据库基本操作-DQL-基本查询
Apache Doris just "graduated": why should we pay attention to this kind of SQL data warehouse?
【知识小结】PHP使用svn笔记总结
面试题 01.02. 判定是否互为字符重排-辅助数组算法
Introduction to ThinkPHP URL routing
Continuous creation depends on it!
Bidding announcement: Panjin people's Hospital Panjin hospital database maintenance project
Have fun | latest progress of "spacecraft program" activities
Performance comparison of tidb for PostgreSQL and yugabytedb on sysbench
Three. JS series (2): API structure diagram-2