YOLOv9改进策略【卷积层】| AKConv: 具有任意采样形状和任意参数数量的卷积核

一、本文介绍

本文记录的是利用AKConv优化YOLOv9的目标检测网络模型。标准卷积操作的卷积运算局限于局部窗口,无法捕获其他位置的信息,且采样形状固定,无法适应不同数据集和位置中目标形状的变化。而AKConv旨在为卷积核提供任意数量的参数和任意采样形状,以在网络开销和性能之间提供更丰富的权衡选择。本文利用AKConv模块改进YOLOv9,来提高网络性能。

文章目录

  • 一、本文介绍
  • 二、AKConv介绍
    • 2.1、AKConv原理
    • 2.2、AKConv优势
  • 三、AKConv的实现代码
  • 四、添加步骤
    • 4.1 修改common.py
      • 4.1.1 基础模块1
      • 4.1.2 创新模块2⭐
    • 4.2 修改yolo.py
  • 五、yaml模型文件
    • 5.1 模型改进版本一
    • 5.2 模型改进版本二⭐
  • 六、成功运行结果


二、AKConv介绍

AKConv: 具有任意采样形状和任意参数数量的卷积核

2.1、AKConv原理

  1. 定义初始采样位置
    • 通过新的坐标生成算法为任意大小的卷积核定义初始位置。具体来说,先生成规则采样网格,再为剩余采样点创建不规则网格,最后拼接生成整体采样网格。以 3 × 3 3×3 3×3卷积操作为例,其采样网格 R = { ( − 1 , − 1 ) , ( − 1 , 0 ) , . . . , ( 0 , 1 ) , ( 1 , 1 ) } R = \{(-1,-1),(-1,0),...,(0,1),(1,1)\} R={(1,1),(1,0),...,(0,1),(1,1)},但AKConv针对不规则形状的卷积核,通过算法生成卷积核 P n P_n Pn的初始采样坐标。在算法中,将左上角 ( 0 , 0 ) (0, 0) (0,0)点设为采样原点。定义在位置 P 0 P_0 P0的相应卷积运算为 C o n v ( P 0 ) = ∑ w × ( P 0 + P n ) Conv(P_0) = \sum w \times (P_0 + P_n) Conv(P0)=w×(P0+Pn),其中 w w w表示卷积参数。
  2. 可变卷积操作
    • 标准卷积采样位置固定,只能提取当前窗口的局部信息,无法捕获其他位置的信息。Deformable Conv通过学习偏移来调整初始规则模式的采样网格,以弥补卷积操作的不足,但它和标准卷积不允许卷积核有任意数量的参数,且卷积参数随卷积核大小呈平方增长,对硬件环境不友好。
    • AKConv类似于Deformable Conv,先通过卷积操作获得对应核的偏移,其维度为 ( B , 2 N , H , W ) (B, 2N, H, W) (B,2N,H,W) N N N为卷积核大小),然后通过偏移和原始坐标求和得到修改后的坐标,最后通过插值和重采样获得对应位置的特征。
    • 对于不规则卷积核难以提取对应采样位置特征的问题,可采用多种方法解决。例如,在Deformable ConvRFAConv中,通过在空间维度堆叠 3 × 3 3×3 3×3卷积特征,然后用步长为3的卷积操作提取特征,但此方法针对正方形采样形状。因此,可以将特征按行或列堆叠,使用列卷积或行卷积来提取对应不规则采样形状的特征;也可以将特征转换为四维 ( C , N , H , W ) (C, N, H, W) (C,N,H,W),然后用步长和卷积大小为 ( N , 1 , 1 ) (N,1,1) (N,1,1)Conv3d提取特征;还可以将特征在通道维度堆叠为 ( C N , H , W ) (CN, H, W) (CN,H,W),然后用(1×1)卷积降维为 ( C , H , W ) (C, H, W) (C,H,W)。在AKConv中,按照上述方法对特征进行重塑并使用相应卷积操作即可提取对应特征。最终,AKConv通过不规则卷积完成特征提取过程,能根据偏移灵活调整样本形状,为卷积采样形状带来更多探索选项。
  3. 扩展AKConv
    • AKConv可以通过重新采样初始坐标呈现多种变化,即使不使用Deformable Conv中的偏移思想,也能实现多种卷积核形状。
    • 根据数据集目标形状的变化,设计对应采样形状的卷积操作,通过设计特定形状的初始采样形状来实现。例如,为长管状结构分割任务设计具有相应形状的采样坐标,但形状选择仅针对长管状结构。
    • AKConv真正实现了卷积核操作具有任意形状和数量的过程,能够使卷积核呈现多种形状。而Deformable Conv旨在弥补常规卷积的不足,DSConv针对特定对象形状设计,它们都没有探索任意大小和形状的卷积。AKConv通过Offset使卷积操作能高效提取不规则样本形状的特征,允许卷积有任意数量的卷积参数和多种形状。

在这里插入图片描述

2.2、AKConv优势

  • 提高检测性能:在COCO2017、VOC 7 + 12和VisDrone - DET2021等数据集的目标检测实验中,AKConv显著提高了YOLOv5等模型的目标检测性能。例如,在COCO2017数据集上,当AKConv大小为5时,不仅使模型所需的参数和计算开销减少,还显著提高了YOLOv5n的检测精度, A P 50 AP_{50} AP50 A P 75 AP_{75} AP75 A P AP AP均提高了三个百分点,且对大物体的检测精度提升更为明显。
  • 灵活的参数选择:与标准卷积和Deformable Conv相比,AKConv允许卷积参数数量呈线性增减,有利于硬件环境,可作为轻量级模型的替代选择,减少模型参数和计算开销。同时,在大内核且资源充足的情况下,它有更多选项来提高网络性能。
  • 丰富的选择:与Deformable Conv不同,AKConv为网络提供了更丰富的选择,它可以使用规则和不规则卷积操作。当AKConv大小设置为(K)的平方时,它可以成为Deformable Conv,但Deformable Conv没有探索不规则卷积核大小,而AKConv可以实现参数为5和11等的卷积操作。

论文:https://arxiv.org/pdf/2311.11587v2
源码: https://github.com/CV-ZhangXin/AKConv

三、AKConv的实现代码

AKConv模块的实现代码如下:

from einops import rearrangeclass AKConv(nn.Module):def __init__(self, inc, outc, num_param=5, stride=1):super(AKConv, self).__init__()self.num_param = num_paramself.stride = strideself.conv = Conv(inc, outc, k=(num_param, 1), s=(num_param, 1) )self.p_conv = nn.Conv2d(inc, 2 * num_param, kernel_size=3, padding=1, stride=stride)nn.init.constant_(self.p_conv.weight, 0)self.p_conv.register_full_backward_hook(self._set_lr)@staticmethoddef _set_lr(module, grad_input, grad_output):grad_input = (grad_input[i] * 0.1 for i in range(len(grad_input)))grad_output = (grad_output[i] * 0.1 for i in range(len(grad_output)))def forward(self, x):# N is num_param.offset = self.p_conv(x)dtype = offset.data.type()N = offset.size(1) // 2# (b, 2N, h, w)p = self._get_p(offset, dtype)# (b, h, w, 2N)p = p.contiguous().permute(0, 2, 3, 1)q_lt = p.detach().floor()q_rb = q_lt + 1q_lt = torch.cat([torch.clamp(q_lt[..., :N], 0, x.size(2) - 1), torch.clamp(q_lt[..., N:], 0, x.size(3) - 1)],dim=-1).long()q_rb = torch.cat([torch.clamp(q_rb[..., :N], 0, x.size(2) - 1), torch.clamp(q_rb[..., N:], 0, x.size(3) - 1)],dim=-1).long()q_lb = torch.cat([q_lt[..., :N], q_rb[..., N:]], dim=-1)q_rt = torch.cat([q_rb[..., :N], q_lt[..., N:]], dim=-1)# clip pp = torch.cat([torch.clamp(p[..., :N], 0, x.size(2) - 1), torch.clamp(p[..., N:], 0, x.size(3) - 1)], dim=-1)# bilinear kernel (b, h, w, N)g_lt = (1 + (q_lt[..., :N].type_as(p) - p[..., :N])) * (1 + (q_lt[..., N:].type_as(p) - p[..., N:]))g_rb = (1 - (q_rb[..., :N].type_as(p) - p[..., :N])) * (1 - (q_rb[..., N:].type_as(p) - p[..., N:]))g_lb = (1 + (q_lb[..., :N].type_as(p) - p[..., :N])) * (1 - (q_lb[..., N:].type_as(p) - p[..., N:]))g_rt = (1 - (q_rt[..., :N].type_as(p) - p[..., :N])) * (1 + (q_rt[..., N:].type_as(p) - p[..., N:]))# resampling the features based on the modified coordinates.x_q_lt = self._get_x_q(x, q_lt, N)x_q_rb = self._get_x_q(x, q_rb, N)x_q_lb = self._get_x_q(x, q_lb, N)x_q_rt = self._get_x_q(x, q_rt, N)# bilinearx_offset = g_lt.unsqueeze(dim=1) * x_q_lt + \g_rb.unsqueeze(dim=1) * x_q_rb + \g_lb.unsqueeze(dim=1) * x_q_lb + \g_rt.unsqueeze(dim=1) * x_q_rtx_offset = self._reshape_x_offset(x_offset, self.num_param)out = self.conv(x_offset)return out# generating the inital sampled shapes for the AKConv with different sizes.def _get_p_n(self, N, dtype):base_int = round(math.sqrt(self.num_param))row_number = self.num_param // base_intmod_number = self.num_param % base_intp_n_x, p_n_y = torch.meshgrid(torch.arange(0, row_number),torch.arange(0, base_int), indexing='xy')p_n_x = torch.flatten(p_n_x)p_n_y = torch.flatten(p_n_y)if mod_number > 0:mod_p_n_x, mod_p_n_y = torch.meshgrid(torch.arange(row_number, row_number + 1),torch.arange(0, mod_number), indexing='xy')mod_p_n_x = torch.flatten(mod_p_n_x)mod_p_n_y = torch.flatten(mod_p_n_y)p_n_x, p_n_y = torch.cat((p_n_x, mod_p_n_x)), torch.cat((p_n_y, mod_p_n_y))p_n = torch.cat([p_n_x, p_n_y], 0)p_n = p_n.view(1, 2 * N, 1, 1).type(dtype)return p_n# no zero-paddingdef _get_p_0(self, h, w, N, dtype):p_0_x, p_0_y = torch.meshgrid(torch.arange(0, h * self.stride, self.stride),torch.arange(0, w * self.stride, self.stride), indexing='xy')p_0_x = torch.flatten(p_0_x).view(1, 1, h, w).repeat(1, N, 1, 1)p_0_y = torch.flatten(p_0_y).view(1, 1, h, w).repeat(1, N, 1, 1)p_0 = torch.cat([p_0_x, p_0_y], 1).type(dtype)return p_0def _get_p(self, offset, dtype):N, h, w = offset.size(1) // 2, offset.size(2), offset.size(3)# (1, 2N, 1, 1)p_n = self._get_p_n(N, dtype)# (1, 2N, h, w)p_0 = self._get_p_0(h, w, N, dtype)p = p_0 + p_n + offsetreturn pdef _get_x_q(self, x, q, N):b, h, w, _ = q.size()padded_w = x.size(3)c = x.size(1)# (b, c, h*w)x = x.contiguous().view(b, c, -1)# (b, h, w, N)index = q[..., :N] * padded_w + q[..., N:]  # offset_x*w + offset_y# (b, c, h*w*N)index = index.contiguous().unsqueeze(dim=1).expand(-1, c, -1, -1, -1).contiguous().view(b, c, -1)x_offset = x.gather(dim=-1, index=index).contiguous().view(b, c, h, w, N)return x_offset#  Stacking resampled features in the row direction.@staticmethoddef _reshape_x_offset(x_offset, num_param):b, c, h, w, n = x_offset.size()x_offset = rearrange(x_offset, 'b c h w n -> b c (h n) w')return x_offset

四、添加步骤

4.1 修改common.py

此处需要修改的文件是models/common.py

common.py中定义了网络结构的通用模块,我们想要加入新的模块就只需要将模块代码放到这个文件内即可。

4.1.1 基础模块1

模块改进方法1️⃣:直接加入AKConv模块
将上方的实现代码粘贴到common.py文件夹下,AKConv模块添加后如下:

在这里插入图片描述

注意❗:在4.2小节中的yolo.py文件中需要声明的模块名称为:AKConv

4.1.2 创新模块2⭐

模块改进方法2️⃣:基于AKConvRepNCSPELAN4

改进方法是对YOLOv9中的RepNCSPELAN4模块进行改进。在将AKConv模块RepNCSPELAN4 结合后,,AKConv通过提供任意参数数量和采样形状的卷积核,弥补了常规卷积的不足,提高了网络性能,为网络开销和性能的权衡提供了更多选择,并为YOLOv9提供更丰富的特征表示

改进代码如下:

class AKRepNCSPELAN4(nn.Module):# csp-elandef __init__(self, c1, c2, c3, c4, c5=1):  # ch_in, ch_out, number, shortcut, groups, expansionsuper().__init__()self.c = c3//2self.cv1 = Conv(c1, c3, 1, 1)self.cv2 = nn.Sequential(RepNCSP(c3//2, c4, c5), AKConv(c4, c4))self.cv3 = nn.Sequential(RepNCSP(c4, c4, c5), AKConv(c4, c4))self.cv4 = Conv(c3+(2*c4), c2, 1, 1)def forward(self, x):y = list(self.cv1(x).chunk(2, 1))y.extend((m(y[-1])) for m in [self.cv2, self.cv3])return self.cv4(torch.cat(y, 1))def forward_split(self, x):y = list(self.cv1(x).split((self.c, self.c), 1))y.extend(m(y[-1]) for m in [self.cv2, self.cv3])return self.cv4(torch.cat(y, 1))

在这里插入图片描述

注意❗:在4.2小节中的yolo.py文件中需要声明的模块名称为:AKRepNCSPELAN4

4.2 修改yolo.py

此处需要修改的文件是models/yolo.py

yolo.py用于函数调用,我们只需要将common.py中定义的新的模块名添加到parse_model函数下即可。

AKConv模块以及AKRepNCSPELAN4模块添加后如下:

在这里插入图片描述


五、yaml模型文件

5.1 模型改进版本一

在代码配置完成后,配置模型的YAML文件。

此处以models/detect/yolov9-c.yaml为例,在同目录下创建一个用于自己数据集训练的模型文件yolov9-c-AKConv.yaml

yolov9-c.yaml中的内容复制到yolov9-c-AKConv.yaml文件下,修改nc数量等于自己数据中目标的数量。
在骨干网络中,将四个RepNCSPELAN4模块替换成AKConv模块,注意修改函数中的参数。

# YOLOv9# parameters
nc: 1  # number of classes
depth_multiple: 1.0  # model depth multiple
width_multiple: 1.0  # layer channel multiple
#activation: nn.LeakyReLU(0.1)
#activation: nn.ReLU()# anchors
anchors: 3# YOLOv9 backbone
backbone:[[-1, 1, Silence, []],  # conv down[-1, 1, Conv, [64, 3, 2]],  # 1-P1/2# conv down[-1, 1, Conv, [128, 3, 2]],  # 2-P2/4# elan-1 block[-1, 1, AKConv, [256]],  # 3# avg-conv down[-1, 1, ADown, [256]],  # 4-P3/8# elan-2 block[-1, 1, AKConv, [512]],  # 5# avg-conv down[-1, 1, ADown, [512]],  # 6-P4/16# elan-2 block[-1, 1, AKConv, [512]],  # 7(可替换)# avg-conv down[-1, 1, ADown, [512]],  # 8-P5/32# elan-2 block[-1, 1, AKConv, [512]],  # 9(可替换)]# YOLOv9 head
head:[# elan-spp block[-1, 1, SPPELAN, [512, 256]],  # 10# up-concat merge[-1, 1, nn.Upsample, [None, 2, 'nearest']],[[-1, 7], 1, Concat, [1]],  # cat backbone P4# elan-2 block[-1, 1, RepNCSPELAN4, [512, 512, 256, 1]],  # 13# up-concat merge[-1, 1, nn.Upsample, [None, 2, 'nearest']],[[-1, 5], 1, Concat, [1]],  # cat backbone P3# elan-2 block[-1, 1, RepNCSPELAN4, [256, 256, 128, 1]],  # 16 (P3/8-small)# avg-conv-down merge[-1, 1, ADown, [256]],[[-1, 13], 1, Concat, [1]],  # cat head P4# elan-2 block[-1, 1, RepNCSPELAN4, [512, 512, 256, 1]],  # 19 (P4/16-medium)# avg-conv-down merge[-1, 1, ADown, [512]],[[-1, 10], 1, Concat, [1]],  # cat head P5# elan-2 block[-1, 1, RepNCSPELAN4, [512, 512, 256, 1]],  # 22 (P5/32-large)# multi-level reversible auxiliary branch# routing[5, 1, CBLinear, [[256]]], # 23[7, 1, CBLinear, [[256, 512]]], # 24[9, 1, CBLinear, [[256, 512, 512]]], # 25# conv down[0, 1, Conv, [64, 3, 2]],  # 26-P1/2# conv down[-1, 1, Conv, [128, 3, 2]],  # 27-P2/4# elan-1 block[-1, 1, RepNCSPELAN4, [256, 128, 64, 1]],  # 28# avg-conv down fuse[-1, 1, ADown, [256]],  # 29-P3/8[[23, 24, 25, -1], 1, CBFuse, [[0, 0, 0]]], # 30  # elan-2 block[-1, 1, RepNCSPELAN4, [512, 256, 128, 1]],  # 31# avg-conv down fuse[-1, 1, ADown, [512]],  # 32-P4/16[[24, 25, -1], 1, CBFuse, [[1, 1]]], # 33 # elan-2 block[-1, 1, RepNCSPELAN4, [512, 512, 256, 1]],  # 34# avg-conv down fuse[-1, 1, ADown, [512]],  # 35-P5/32[[25, -1], 1, CBFuse, [[2]]], # 36# elan-2 block[-1, 1, RepNCSPELAN4, [512, 512, 256, 1]],  # 37# detection head# detect[[31, 34, 37, 16, 19, 22], 1, DualDDetect, [nc]],  # DualDDetect(A3, A4, A5, P3, P4, P5)]

5.2 模型改进版本二⭐

此处同样以models/detect/yolov9-c.yaml为例,在同目录下创建一个用于自己数据集训练的模型文件yolov9-c-AKRepNCSPELAN4.yaml

yolov9-c.yaml中的内容复制到yolov9-c-AKRepNCSPELAN4.yaml文件下,修改nc数量等于自己数据中目标的数量。

📌 模型的修改方法是将骨干网络中的所有RepNCSPELAN4模块替换成AKRepNCSPELAN4模块

# YOLOv9# parameters
nc: 1  # number of classes
depth_multiple: 1.0  # model depth multiple
width_multiple: 1.0  # layer channel multiple
#activation: nn.LeakyReLU(0.1)
#activation: nn.ReLU()# anchors
anchors: 3# YOLOv9 backbone
backbone:[[-1, 1, Silence, []],  # conv down[-1, 1, Conv, [64, 3, 2]],  # 1-P1/2# conv down[-1, 1, Conv, [128, 3, 2]],  # 2-P2/4# elan-1 block[-1, 1, AKRepNCSPELAN4, [256, 128, 64, 1]],  # 3# avg-conv down[-1, 1, ADown, [256]],  # 4-P3/8# elan-2 block[-1, 1, AKRepNCSPELAN4, [512, 256, 128, 1]],  # 5# avg-conv down[-1, 1, ADown, [512]],  # 6-P4/16# elan-2 block[-1, 1, AKRepNCSPELAN4, [512, 512, 256, 1]],  # 7(可替换)# avg-conv down[-1, 1, ADown, [512]],  # 8-P5/32# elan-2 block[-1, 1, AKRepNCSPELAN4, [512, 512, 256, 1]],  # 9(可替换)]# YOLOv9 head
head:[# elan-spp block[-1, 1, SPPELAN, [512, 256]],  # 10# up-concat merge[-1, 1, nn.Upsample, [None, 2, 'nearest']],[[-1, 7], 1, Concat, [1]],  # cat backbone P4# elan-2 block[-1, 1, RepNCSPELAN4, [512, 512, 256, 1]],  # 13# up-concat merge[-1, 1, nn.Upsample, [None, 2, 'nearest']],[[-1, 5], 1, Concat, [1]],  # cat backbone P3# elan-2 block[-1, 1, RepNCSPELAN4, [256, 256, 128, 1]],  # 16 (P3/8-small)# avg-conv-down merge[-1, 1, ADown, [256]],[[-1, 13], 1, Concat, [1]],  # cat head P4# elan-2 block[-1, 1, RepNCSPELAN4, [512, 512, 256, 1]],  # 19 (P4/16-medium)# avg-conv-down merge[-1, 1, ADown, [512]],[[-1, 10], 1, Concat, [1]],  # cat head P5# elan-2 block[-1, 1, RepNCSPELAN4, [512, 512, 256, 1]],  # 22 (P5/32-large)# multi-level reversible auxiliary branch# routing[5, 1, CBLinear, [[256]]], # 23[7, 1, CBLinear, [[256, 512]]], # 24[9, 1, CBLinear, [[256, 512, 512]]], # 25# conv down[0, 1, Conv, [64, 3, 2]],  # 26-P1/2# conv down[-1, 1, Conv, [128, 3, 2]],  # 27-P2/4# elan-1 block[-1, 1, RepNCSPELAN4, [256, 128, 64, 1]],  # 28# avg-conv down fuse[-1, 1, ADown, [256]],  # 29-P3/8[[23, 24, 25, -1], 1, CBFuse, [[0, 0, 0]]], # 30  # elan-2 block[-1, 1, RepNCSPELAN4, [512, 256, 128, 1]],  # 31# avg-conv down fuse[-1, 1, ADown, [512]],  # 32-P4/16[[24, 25, -1], 1, CBFuse, [[1, 1]]], # 33 # elan-2 block[-1, 1, RepNCSPELAN4, [512, 512, 256, 1]],  # 34# avg-conv down fuse[-1, 1, ADown, [512]],  # 35-P5/32[[25, -1], 1, CBFuse, [[2]]], # 36# elan-2 block[-1, 1, RepNCSPELAN4, [512, 512, 256, 1]],  # 37# detection head# detect[[31, 34, 37, 16, 19, 22], 1, DualDDetect, [nc]],  # DualDDetect(A3, A4, A5, P3, P4, P5)]

六、成功运行结果

分别打印网络模型可以看到AKConv模块AKRepNCSPELAN4模块已经加入到模型中,并可以进行训练了。

yolov9-c-AKConv

                 from  n    params  module                                  arguments                     0                -1  1         0  models.common.Silence                   []                            1                -1  1      1856  models.common.Conv                      [3, 64, 3, 2]                 2                -1  1     73984  models.common.Conv                      [64, 128, 3, 2]               3                -1  1    175882  models.common.AKConv                    [128, 256]                    4                -1  1    164352  models.common.ADown                     [256, 256]                    5                -1  1    679434  models.common.AKConv                    [256, 512]                    6                -1  1    656384  models.common.ADown                     [512, 512]                    7                -1  1   1357834  models.common.AKConv                    [512, 512]                    8                -1  1    656384  models.common.ADown                     [512, 512]                    9                -1  1   1357834  models.common.AKConv                    [512, 512]                    10                -1  1    656896  models.common.SPPELAN                   [512, 512, 256]               11                -1  1         0  torch.nn.modules.upsampling.Upsample    [None, 2, 'nearest']          12           [-1, 7]  1         0  models.common.Concat                    [1]                           13                -1  1   3119616  models.common.RepNCSPELAN4              [1024, 512, 512, 256, 1]      14                -1  1         0  torch.nn.modules.upsampling.Upsample    [None, 2, 'nearest']          15           [-1, 5]  1         0  models.common.Concat                    [1]                           16                -1  1    912640  models.common.RepNCSPELAN4              [1024, 256, 256, 128, 1]      17                -1  1    164352  models.common.ADown                     [256, 256]                    18          [-1, 13]  1         0  models.common.Concat                    [1]                           19                -1  1   2988544  models.common.RepNCSPELAN4              [768, 512, 512, 256, 1]       20                -1  1    656384  models.common.ADown                     [512, 512]                    21          [-1, 10]  1         0  models.common.Concat                    [1]                           22                -1  1   3119616  models.common.RepNCSPELAN4              [1024, 512, 512, 256, 1]      23                 5  1    131328  models.common.CBLinear                  [512, [256]]                  24                 7  1    393984  models.common.CBLinear                  [512, [256, 512]]             25                 9  1    656640  models.common.CBLinear                  [512, [256, 512, 512]]        26                 0  1      1856  models.common.Conv                      [3, 64, 3, 2]                 27                -1  1     73984  models.common.Conv                      [64, 128, 3, 2]               28                -1  1    212864  models.common.RepNCSPELAN4              [128, 256, 128, 64, 1]        29                -1  1    164352  models.common.ADown                     [256, 256]                    30  [23, 24, 25, -1]  1         0  models.common.CBFuse                    [[0, 0, 0]]                   31                -1  1    847616  models.common.RepNCSPELAN4              [256, 512, 256, 128, 1]       32                -1  1    656384  models.common.ADown                     [512, 512]                    33      [24, 25, -1]  1         0  models.common.CBFuse                    [[1, 1]]                      34                -1  1   2857472  models.common.RepNCSPELAN4              [512, 512, 512, 256, 1]       35                -1  1    656384  models.common.ADown                     [512, 512]                    36          [25, -1]  1         0  models.common.CBFuse                    [[2]]                         37                -1  1   2857472  models.common.RepNCSPELAN4              [512, 512, 512, 256, 1]       38[31, 34, 37, 16, 19, 22]  1  21542822  DualDDetect                             [1, [512, 512, 512, 256, 512, 512]]
yolov9-c-AKConv summary: 730 layers, 47795150 parameters, 47795118 gradients, 228.7 GFLOPs

yolov9-c-AKRepNCSPELAN4

                 from  n    params  module                                  arguments                     0                -1  1         0  models.common.Silence                   []                            1                -1  1      1856  models.common.Conv                      [3, 64, 3, 2]                 2                -1  1     73984  models.common.Conv                      [64, 128, 3, 2]               3                -1  1    191636  models.common.AKRepNCSPELAN4            [128, 256, 128, 64, 1]        4                -1  1    164352  models.common.ADown                     [256, 256]                    5                -1  1    739604  models.common.AKRepNCSPELAN4            [256, 512, 256, 128, 1]       6                -1  1    656384  models.common.ADown                     [512, 512]                    7                -1  1   2379284  models.common.AKRepNCSPELAN4            [512, 512, 512, 256, 1]       8                -1  1    656384  models.common.ADown                     [512, 512]                    9                -1  1   2379284  models.common.AKRepNCSPELAN4            [512, 512, 512, 256, 1]       10                -1  1    656896  models.common.SPPELAN                   [512, 512, 256]               11                -1  1         0  torch.nn.modules.upsampling.Upsample    [None, 2, 'nearest']          12           [-1, 7]  1         0  models.common.Concat                    [1]                           13                -1  1   3119616  models.common.RepNCSPELAN4              [1024, 512, 512, 256, 1]      14                -1  1         0  torch.nn.modules.upsampling.Upsample    [None, 2, 'nearest']          15           [-1, 5]  1         0  models.common.Concat                    [1]                           16                -1  1    912640  models.common.RepNCSPELAN4              [1024, 256, 256, 128, 1]      17                -1  1    164352  models.common.ADown                     [256, 256]                    18          [-1, 13]  1         0  models.common.Concat                    [1]                           19                -1  1   2988544  models.common.RepNCSPELAN4              [768, 512, 512, 256, 1]       20                -1  1    656384  models.common.ADown                     [512, 512]                    21          [-1, 10]  1         0  models.common.Concat                    [1]                           22                -1  1   3119616  models.common.RepNCSPELAN4              [1024, 512, 512, 256, 1]      23                 5  1    131328  models.common.CBLinear                  [512, [256]]                  24                 7  1    393984  models.common.CBLinear                  [512, [256, 512]]             25                 9  1    656640  models.common.CBLinear                  [512, [256, 512, 512]]        26                 0  1      1856  models.common.Conv                      [3, 64, 3, 2]                 27                -1  1     73984  models.common.Conv                      [64, 128, 3, 2]               28                -1  1    212864  models.common.RepNCSPELAN4              [128, 256, 128, 64, 1]        29                -1  1    164352  models.common.ADown                     [256, 256]                    30  [23, 24, 25, -1]  1         0  models.common.CBFuse                    [[0, 0, 0]]                   31                -1  1    847616  models.common.RepNCSPELAN4              [256, 512, 256, 128, 1]       32                -1  1    656384  models.common.ADown                     [512, 512]                    33      [24, 25, -1]  1         0  models.common.CBFuse                    [[1, 1]]                      34                -1  1   2857472  models.common.RepNCSPELAN4              [512, 512, 512, 256, 1]       35                -1  1    656384  models.common.ADown                     [512, 512]                    36          [25, -1]  1         0  models.common.CBFuse                    [[2]]                         37                -1  1   2857472  models.common.RepNCSPELAN4              [512, 512, 512, 256, 1]       38[31, 34, 37, 16, 19, 22]  1  21542822  DualDDetect                             [1, [512, 512, 512, 256, 512, 512]]
yolov9-c-AKRepNCSPELAN4 summary: 978 layers, 49913974 parameters, 49913942 gradients, 234.5 GFLOPs

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.xdnf.cn/news/144364.html

如若内容造成侵权/违法违规/事实不符,请联系一条长河网进行投诉反馈,一经查实,立即删除!

相关文章

LeetCode[中等] 438. 找到字符串中所有字母异位词

给定两个字符串 s 和 p,找到 s 中所有 p 的 异位词 的子串,返回这些子串的起始索引。不考虑答案输出的顺序。 异位词 指由相同字母重排列形成的字符串(包括相同的字符串)。 思路:滑动窗口 s包含p的异位词 ——> 则…

静态住宅代理 vs 住宅代理:稳定IP有哪些优势?

在代理服务器中,我们通常以IP地址是否经常轮换为标准,将代理分为静态和住宅代理。这两种代理方式各有千秋,在不同的应用场景中发挥着不同的作用。但是由于场景繁多,用处也大有不同,导致很多人对于这两种代理方式并不是…

基于微信小程序的游泳馆管理系统--论文源码调试讲解

2 关键技术介绍 2.1 SSM框架 开发信息管理系统的主流框架是SSM(Spring Spring MVC MyBatis),SSM框架web层使用Spring MVC框架,使传输前后端数据变得简单;对于业务层使用Spring作为轻量级控制反转和面向切面的容器框…

C++速通LeetCode中等第5题-无重复字符的最长字串

字串substr法,定义字串的头部和长度,和字串后一位对比,如果不存在重复元素则长度1,存在重复元素则头部更新,长度重置。 class Solution { public:int lengthOfLongestSubstring(string s) {string s2;//存放s的前一部分…

springboot实训学习笔记(4)(Spring Validation参数校验框架、全局异常处理器)

接着上篇博客学习。上篇博客是已经基本完成用户模块的注册接口的开发。springboot实战学习笔记(3)(Lombok插件、postman测试工具、MD5加密算法、post请求、接口文档、注解、如何在IDEA中设置层级显示包结构、显示接口中的方法)-CSDN博客本篇博客主要是关…

【free -h内存占用】

在 free -g 命令的输出中,最能准确反映系统中剩余可用内存的参数是 available。这个参数考虑了缓存和缓冲的内存,可以更准确地反映系统的可用内存。 让我们再看一下假设的输出: total used free shared buff/cache av…

【PGCCC】使用 Postgres 进行数据分析的窗口函数

SQL 在处理单行数据时,甚至在聚合多行数据时都很有意义。但是,当您想比较已计算的行之间的数据时会发生什么?或者创建数据组并进行查询?输入窗口函数。 窗口函数往往会让人感到困惑 - 但它们是 SQL 中用于数据分析的非常棒的工具…

实验2 Linux文件系统常用操作实践

实验2 Linux文件系统常用操作实践 一、实验介绍 本节实验通过实战Linux文件操作模块的基本操作,需要先掌握linux文件系统的原理以及理解linux文件操作的原理,最后通过实操完成linux文件操作的命令,其中包括改变目录、创建目录及文件、删除文件、复制文件、文件移动和改名、查…

【大模型入门】零基础入门AI大模型应用开发,你需要一个系统的入门路径!

随着大模型技术的飞速发展,我们正站在一个全新的技术前沿,探索着如何将这些强大的工具应用于实际问题的解决。如果你对AI大模型应用开发充满热情,那么你可以读一下这篇文章——一个系统全面的入门指南,专为渴望深入AI世界的你设计…

Windows 系统管理

1 安装 Windows Server 2016 操作系统的硬件最低需求? 处理器 1.4GHz 64 位处理器 RAM 512MB(带桌面体验 2GB) 磁盘空间 32GB 2 Windows Server 2016 操作系统的常见版本? Windows Server 2016 Standard( 标 准 版 &a…

【新手必看】SpringBoot集成Minio实现文件上传、下载和删除

一&#xff0c;前言 安装教程可看我以前的文章&#xff0c;Linux和Windows安装教程都有。安装好minio后今天学习minio的使用。 二&#xff0c;集成Minio 1&#xff0c;导入依赖&#xff0c;版本可自己选择 <!-- https://mvnrepository.com/artifact/io.minio/minio -->…

LeetCode力扣——并查集:947. 移除最多的同行或同列石头,1971. 寻找图中是否存在路径,2424. 最长上传前缀

947. 移除最多的同行或同列石头 题目描述 947. 移除最多的同行或同列石头 n 块石头放置在二维平面中的一些整数坐标点上。每个坐标点上最多只能有一块石头。 如果一块石头的 同行或者同列 上有其他石头存在&#xff0c;那么就可以移除这块石头。 给你一个长度为 n 的数组 …

[Golang] Select

[Golang] Select 文章目录 [Golang] Select什么是selectselect用法基本用法空select没有default且case永久无法执行单个case和default多个case和default IO多路复用 什么是select select是Golang中一个控制结构&#xff0c;可以用来处理多个channel的发送和接收操作。select会…

Echats 实现CPK (过程能力)研究报告

背景: 实现: Echarts Option 代码示例 option {title: {text: 折线图示例 - X轴为数值},xAxis: {type: value, // X 轴改为数值型min: 0, // 最小值max: 10, // 最大值},yAxis: {type: value},series: [{type: line,data: [[0, 150], [2, 230], [4, 224], [6…

Photoshop 2021安装教程

软件介绍 Adobe Photoshop&#xff0c;简称“PS”&#xff0c;是美国Adobe公司旗下最为出名的图像处理软件系列之一。ps 2021新增一键换天空&#xff0c;AI只能滤镜&#xff0c;新增内置的画笔工具极为丰富&#xff0c;成千上万的精致像素、动态和矢量画笔可以满足你的各种绘图…

论文阅读--Planning-oriented Autonomous Driving(二)

自动驾驶框架的各种设计比较。 ( a )大多数工业解决方案针对不同的任务部署不同的模型。 ( b )多任务学习方案共享一个具有分割任务头的主干。 ( c )端到端范式将感知和预测模块统一起来。以往的尝试要么采用( c.1 )中对规划的直接优化&#xff0c;要么采用( c.2 )中的部分元…

【结构型】树形结构的应用王者,组合模式

目录 一、组合模式1、组合模式是什么&#xff1f;2、组合模式的主要参与者&#xff1a; 二、优化案例&#xff1a;文件系统1、不使用组合模式2、通过组合模式优化上面代码优化点&#xff1a; 三、使用组合模式有哪些优势1、统一接口&#xff0c;简化客户端代码2、递归结构处理方…

选址模型 | 基于混沌模拟退火粒子群优化算法的电动汽车充电站选址与定容(Matlab)

目录 效果一览基本介绍程序设计参考资料 效果一览 基本介绍 基于混沌模拟退火粒子群优化算法的电动汽车充电站选址与定容&#xff08;Matlab&#xff09; 问题建模&#xff1a;首先&#xff0c;需要将电动汽车充电站选址与定容问题进行数学建模&#xff0c;确定目标函数和约束…

Redis面试真题总结(一)

文章收录在网站&#xff1a;http://hardyfish.top/ 文章收录在网站&#xff1a;http://hardyfish.top/ 文章收录在网站&#xff1a;http://hardyfish.top/ 文章收录在网站&#xff1a;http://hardyfish.top/ 什么是Redis? Redis是一个高性能的开源内存数据库系统&#xff0…

Java从入门到精通学习框架(三)

这一阶段的学习目标是将 Java 的知识从基础提升到实战开发的应用层面&#xff0c;通过对常见的 Java 企业级开发框架的学习和实践&#xff0c;掌握设计模式、分布式系统开发、性能优化等核心技能。在此基础上&#xff0c;学习并应用 Java 的高级特性和最佳实践&#xff0c;使自…