当前位置: 首页 > news >正文

每日Attention学习3——Cross-level Feature Fusion

模块出处

[link] [code] [PR 23] Cross-level Feature Aggregation Network for Polyp Segmentation


模块名称

Cross-level Feature Fusion (CFF)


模块作用

双级特征融合


模块结构

在这里插入图片描述


模块代码
import torch
import torch.nn as nnclass BasicConv2d(nn.Module):def __init__(self, in_planes, out_planes, kernel_size, stride=1, padding=0, dilation=1):super(BasicConv2d, self).__init__()self.conv = nn.Conv2d(in_planes, out_planes,kernel_size=kernel_size, stride=stride,padding=padding, dilation=dilation, bias=False)self.bn = nn.BatchNorm2d(out_planes)self.relu = nn.ReLU(inplace=True)def forward(self, x):x = self.conv(x)x = self.bn(x)return xclass CFF(nn.Module):def __init__(self, in_channel1, in_channel2, out_channel):self.init__ = super(CFF, self).__init__()act_fn         = nn.ReLU(inplace=True)self.layer0    = BasicConv2d(in_channel1, out_channel // 2, 1)self.layer1    = BasicConv2d(in_channel2, out_channel // 2, 1)self.layer3_1  = nn.Sequential(nn.Conv2d(out_channel, out_channel // 2, kernel_size=3, stride=1, padding=1),  nn.BatchNorm2d(out_channel // 2),act_fn)self.layer3_2  = nn.Sequential(nn.Conv2d(out_channel, out_channel // 2, kernel_size=3, stride=1, padding=1),  nn.BatchNorm2d(out_channel // 2),act_fn)self.layer5_1  = nn.Sequential(nn.Conv2d(out_channel, out_channel // 2, kernel_size=5, stride=1, padding=2),  nn.BatchNorm2d(out_channel // 2),act_fn)self.layer5_2  = nn.Sequential(nn.Conv2d(out_channel, out_channel // 2, kernel_size=5, stride=1, padding=2),  nn.BatchNorm2d(out_channel // 2),act_fn)self.layer_out = nn.Sequential(nn.Conv2d(out_channel // 2, out_channel, kernel_size=3, stride=1, padding=1), nn.BatchNorm2d(out_channel),act_fn)def forward(self, x0, x1):x0_1  = self.layer0(x0)x1_1  = self.layer1(x1)x_3_1 = self.layer3_1(torch.cat((x0_1,  x1_1),  dim=1))    x_5_1 = self.layer5_1(torch.cat((x1_1,  x0_1),  dim=1))x_3_2 = self.layer3_2(torch.cat((x_3_1, x_5_1), dim=1))x_5_2 = self.layer5_2(torch.cat((x_5_1, x_3_1), dim=1))out   = self.layer_out(x0_1 + x1_1 + torch.mul(x_3_2, x_5_2))return outif __name__ == '__main__':x1 = torch.randn([1, 256, 16, 16])x2 = torch.randn([1, 512, 16, 16])cff = CFF(in_channel1=256, in_channel2=512, out_channel=64)out = cff(x1, x2)print(out.shape)  # 1, 64, 16, 16

原文表述

利用特征提取网络可以获得不同分辨率的多级特征。因此,有效整合多级特征非常重要,这可以提高不同尺度特征的表示能力。因此,我们提出了一个 CFF模块来融合相邻的两个特征,然后将其输入分割网络。

http://www.lryc.cn/news/344976.html

相关文章:

  • 华为eNSP学习—IP编址
  • 数据库的要求
  • Spring MVC(二)
  • ECP44304T-76是一款增强型通信处理器吗?
  • mongoDB分组查询
  • 【Java 刷题记录】位运算
  • WINDOWS下zookeeper突然无法启动但是端口未占用的解决办法(用了WSL)
  • 【LLM第三篇】名词解释:RLHF——chatgpt的功臣
  • 基于Opencv的车牌识别系统(毕业设计可用)
  • Leetcode—295. 数据流的中位数【困难】
  • JavaWeb之过滤器(Filter)与监听器(Listener)
  • video.js的请求头问题
  • leetcode 1235
  • Activiti7 开发快速入门【2024版】
  • vue3组件插槽
  • Cloudera简介和安装部署
  • Spring Boot集成Ldap快速入门Demo
  • 杨辉三角的打印
  • 贪吃蛇(下)游戏的实现
  • 偏微分方程算法之椭圆型方程差分格式编程示例
  • PCIe协议之-TLP路由基础
  • inline内联函数-虚函数(virtual)可以是内联函数(inline)吗?
  • Spring Boot | Spring Boot 消息管理 ( 消息中间件 ) 、RabbitMQ“消息中间件“
  • 二层交换机与路由器连通上网实验
  • AJAX知识点(前后端交互技术)
  • 用wordpress为外贸进出口公司搭建多语言国际站
  • 雷军-2022.8小米创业思考-6-互联网七字诀之口碑:口碑即定位,超预期才有口碑,品牌建设
  • 欧盟MDR法规对医疗器械网络安全都有哪些要求?
  • Linux —— 信号初识
  • webpack进阶 -- 自定义Plugin,Loader封装打包优化