pytorch中加入注意力机制(CBAM)以ResNet为例.pdfVIP

  • 610
  • 0
  • 约7.39千字
  • 约 4页
  • 2022-03-31 发布于广西
  • 举报

pytorch中加入注意力机制(CBAM)以ResNet为例.pdf

pytorch中加⼊注意⼒机制 (CBAM)以ResNet为例 源源码码位位置置:: 第第⼀⼀步步::找找到到ResNet源源代代码码 在在⾥⾥⾯⾯添添加加通通道道注注意意⼒⼒机机制制和和 间间注注意意⼒⼒机机制制 所所需需库库 import torch.nn as nn import math try : from torch.hub import load_state_dict_from_ url except ImportError: from torch.utils.model_ oo import load_ url as load_state_dict_from_ url import torch 通通道道注注意意⼒⼒机机制制 class ChannelAttention(nn.Module) : def __ init__ (self, in_ planes, ratio=16) : super(ChannelAttention, self).__ init__ () self.avg_ pool = nn.AdaptiveAvgPool2d(1) s

文档评论(0)

1亿VIP精品文档

相关文档