摘要: import torch import torch.nn as nn import torch.nn.functional as F class PCFN(nn.Module): ''' 使用带有GELU的激活函数的1*1卷积对扩展的隐藏空间进行跨信道交互。 然后将隐藏特征分割成两块 对其中一块使用 阅读全文
posted @ 2024-11-17 18:55 iceeci 阅读(68) 评论(0) 推荐(0)
摘要: import torch import torch.nn as nn import torch.nn.functional as F class DMlp(nn.Module): ''' 用来提取局部特征 ''' def __init__(self, dim, growth_rate=2.0): s 阅读全文
posted @ 2024-11-17 18:54 iceeci 阅读(179) 评论(0) 推荐(0)
摘要: paper class LinearSelfAttention(nn.Module): """ This layer applies a self-attention with linear complexity, as described in `https://arxiv.org/abs/220 阅读全文
posted @ 2024-11-15 19:58 iceeci 阅读(79) 评论(0) 推荐(0)
摘要: paper def my_self(x: torch.Tensor): ''' 通过这段代码 可以把每张图片图片中相对位置相同的若干个tokens放到最后两个维度 ''' # [B, C, H, W] -> [B, C, n_h, p_h, n_w, p_w] # n_h是高度方向上可以分多少个pa 阅读全文
posted @ 2024-11-15 19:27 iceeci 阅读(25) 评论(0) 推荐(0)
摘要: paper 通过密集连接的小卷积核实现细节特征(高频特征提取)提取 import torch.nn as nn class Dense(nn.Module): def __init__(self, in_channels): super(Dense, self).__init__() # self. 阅读全文
posted @ 2024-11-12 10:27 iceeci 阅读(91) 评论(0) 推荐(0)
摘要: paper 可以借鉴的点:下采样和上次样 融合两个不同尺度特征图 from collections import OrderedDict import torch import torch.nn as nn import torch.nn.functional as F def BasicConv( 阅读全文
posted @ 2024-11-12 09:47 iceeci 阅读(160) 评论(0) 推荐(0)
摘要: 这也是一个从空间和通道进行创新的 和moganet的创新思路一样 阅读全文
posted @ 2024-11-11 20:45 iceeci 阅读(68) 评论(0) 推荐(0)
摘要: paper import torch.nn as nn import torch import torch.nn.functional as F def build_act_layer(act_type): """Build activation layer.""" if act_type is N 阅读全文
posted @ 2024-11-10 16:13 iceeci 阅读(38) 评论(0) 推荐(0)
摘要: paper (1) 前向路径 fc1 和 dwconv: 第一部分是一个标准的 ConvFFN 模块,先用逐点卷积(fc1)将输入特征维度扩展为 4 倍的 feedforward_channels,然后通过深度卷积(dwconv)增强局部特征提取能力。 act 和 drop: 在激活函数后使用 dr 阅读全文
posted @ 2024-11-09 17:04 iceeci 阅读(96) 评论(0) 推荐(0)
摘要: 代码图片同上一篇出处 阅读全文
posted @ 2024-11-08 17:11 iceeci 阅读(291) 评论(0) 推荐(0)