当前位置:   article > 正文

YOLOv9中的“ADown”结构!_yolov9 adown

yolov9 adown

ADown结构出炉啦,收藏起来写论文用!


 论文链接: YOLOv9: Learning What You Want to Learn Using Programmable Gradient 
 代码链接:https://github.com/WongKinYiu/yolov9/tree/main

1.代码:

        代码路径:yolov9-main->models->common.py,代码如下:

  1. class ADown(nn.Module):
  2. def __init__(self, c1, c2): # ch_in, ch_out, shortcut, kernels, groups, expand
  3. super().__init__()
  4. self.c = c2 // 2
  5. self.cv1 = Conv(c1 // 2, self.c, 3, 2, 1)
  6. self.cv2 = Conv(c1 // 2, self.c, 1, 1, 0)
  7. def forward(self, x):
  8. x = torch.nn.functional.avg_pool2d(x, 2, 1, 0, False, True)
  9. x1,x2 = x.chunk(2, 1)
  10. x1 = self.cv1(x1)
  11. x2 = torch.nn.functional.max_pool2d(x2, 3, 2, 1)
  12. x2 = self.cv2(x2)
  13. return torch.cat((x1, x2), 1)

2.结构图:

       ADown的结构如图:


3.配置文件

  1. # YOLOv9 head
  2. head:
  3. [
  4. # elan-spp block
  5. [-1, 1, SPPELAN, [512, 256]], # 10
  6. # up-concat merge
  7. [-1, 1, nn.Upsample, [None, 2, 'nearest']],
  8. [[-1, 7], 1, Concat, [1]], # cat backbone P4
  9. # elan-2 block
  10. [-1, 1, RepNCSPELAN4, [512, 512, 256, 1]], # 13
  11. # up-concat merge
  12. [-1, 1, nn.Upsample, [None, 2, 'nearest']],
  13. [[-1, 5], 1, Concat, [1]], # cat backbone P3
  14. # elan-2 block
  15. [-1, 1, RepNCSPELAN4, [256, 256, 128, 1]], # 16 (P3/8-small)
  16. # avg-conv-down merge
  17. [-1, 1, ADown, [256]],
  18. [[-1, 13], 1, Concat, [1]], # cat head P4
  19. # elan-2 block
  20. [-1, 1, RepNCSPELAN4, [512, 512, 256, 1]], # 19 (P4/16-medium)
  21. # avg-conv-down merge
  22. [-1, 1, ADown, [512]],
  23. [[-1, 10], 1, Concat, [1]], # cat head P5
  24. # elan-2 block
  25. [-1, 1, RepNCSPELAN4, [512, 512, 256, 1]], # 22 (P5/32-large)
  26. # multi-level reversible auxiliary branch
  27. # routing
  28. [5, 1, CBLinear, [[256]]], # 23
  29. [7, 1, CBLinear, [[256, 512]]], # 24
  30. [9, 1, CBLinear, [[256, 512, 512]]], # 25
  31. # conv down
  32. [0, 1, Conv, [64, 3, 2]], # 26-P1/2
  33. # conv down
  34. [-1, 1, Conv, [128, 3, 2]], # 27-P2/4
  35. # elan-1 block
  36. [-1, 1, RepNCSPELAN4, [256, 128, 64, 1]], # 28
  37. # avg-conv down fuse
  38. [-1, 1, ADown, [256]], # 29-P3/8
  39. [[23, 24, 25, -1], 1, CBFuse, [[0, 0, 0]]], # 30
  40. # elan-2 block
  41. [-1, 1, RepNCSPELAN4, [512, 256, 128, 1]], # 31
  42. # avg-conv down fuse
  43. [-1, 1, ADown, [512]], # 32-P4/16
  44. [[24, 25, -1], 1, CBFuse, [[1, 1]]], # 33
  45. # elan-2 block
  46. [-1, 1, RepNCSPELAN4, [512, 512, 256, 1]], # 34
  47. # avg-conv down fuse
  48. [-1, 1, ADown, [512]], # 35-P5/32
  49. [[25, -1], 1, CBFuse, [[2]]], # 36
  50. # elan-2 block
  51. [-1, 1, RepNCSPELAN4, [512, 512, 256, 1]], # 37
  52. # detection head
  53. # detect
  54. [[31, 34, 37, 16, 19, 22], 1, DualDDetect, [nc]], # DualDDetect(A3, A4, A5, P3, P4, P5)
  55. ]

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/AllinToyou/article/detail/393599
推荐阅读
相关标签
  

闽ICP备14008679号