Ubuntu18.04配置darknet环境实现YOLOv4目标检测(四)——YOLOv4网络解析

1. 概述

  基于这篇文章https://blog.csdn.net/linghu8812/article/details/105729693对YOLOv4论文的学习,YOLOv4模型由以下部分组成:CSPDarknet53作为骨干网络SPP作为附加模块PANet作为特征融合的NeckYOLOv3检测器作为Header

2. 网络分层解析

  按照这篇文章https://blog.csdn.net/linghu8812/article/details/100867702,在终端中输入./darknet detector test cfg/coco.data cfg/yolov4.cfg yolov4.weights -thresh 0.25 ./data/dog.jpg后,首先看到的是YOLOv4的layer输出,每一层layer是如何得到的注释在了每一行后面,没有注释的就是对上一行的特征图进行卷积

layer   filters  size/strd(dil)      input                output
   0 conv     32       3 x 3/ 1    608 x 608 x   3 ->  608 x 608 x  32 0.639 BF
   1 conv     64       3 x 3/ 2    608 x 608 x  32 ->  304 x 304 x  64 3.407 BF  降低特征图宽度和高度 size // 2,特征图尺寸 304 x 304 x  64
   2 conv     64       1 x 1/ 1    304 x 304 x  64 ->  304 x 304 x  64 0.757 BF  1 x 1 卷积 通道不降维 64 ==> 64
   3 route  1 		                           ->  304 x 304 x  64                 复制 layer 1 特征图
   4 conv     64       1 x 1/ 1    304 x 304 x  64 ->  304 x 304 x  64 0.757 BF
   5 conv     32       1 x 1/ 1    304 x 304 x  64 ->  304 x 304 x  32 0.379 BF
   6 conv     64       3 x 3/ 1    304 x 304 x  32 ->  304 x 304 x  64 3.407 BF
   7 Shortcut Layer: 4,  wt = 0, wn = 0, outputs: 304 x 304 x  64 0.006 BF       由 layer 4 和 layer 6 相加得到
   8 conv     64       1 x 1/ 1    304 x 304 x  64 ->  304 x 304 x  64 0.757 BF  1 x 1 卷积 通道不降维 64 ==> 64
   9 route  8 2 	                           ->  304 x 304 x 128                 concatenation layer 8 和 layer 2
  10 conv     64       1 x 1/ 1    304 x 304 x 128 ->  304 x 304 x  64 1.514 BF  1 x 1 特征融合并降维 128 ==> 64
  11 conv    128       3 x 3/ 2    304 x 304 x  64 ->  152 x 152 x 128 3.407 BF  降低特征图宽度和高度 size // 2,特征图尺寸 152 x 152 x 128
  12 conv     64       1 x 1/ 1    152 x 152 x 128 ->  152 x 152 x  64 0.379 BF  1 x 1 卷积 通道降维 128 ==> 64
  13 route  11 		                           ->  152 x 152 x 128                 复制 layer 11 特征图
  14 conv     64       1 x 1/ 1    152 x 152 x 128 ->  152 x 152 x  64 0.379 BF  1 x 1 卷积 通道降维 128 ==> 64
  15 conv     64       1 x 1/ 1    152 x 152 x  64 ->  152 x 152 x  64 0.189 BF
  16 conv     64       3 x 3/ 1    152 x 152 x  64 ->  152 x 152 x  64 1.703 BF
  17 Shortcut Layer: 14,  wt = 0, wn = 0, outputs: 152 x 152 x  64 0.001 BF      由 layer 14 和 layer 16 相加得到
  18 conv     64       1 x 1/ 1    152 x 152 x  64 ->  152 x 152 x  64 0.189 BF
  19 conv     64       3 x 3/ 1    152 x 152 x  64 ->  152 x 152 x  64 1.703 BF
  20 Shortcut Layer: 17,  wt = 0, wn = 0, outputs: 152 x 152 x  64 0.001 BF      由 layer 17 和 layer 19 相加得到
  21 conv     64       1 x 1/ 1    152 x 152 x  64 ->  152 x 152 x  64 0.189 BFF 1 x 1 卷积 通道不降维 64 ==> 64
  22 route  21 12 	                           ->  152 x 152 x 128               concatenation layer 21 和 layer 12
  23 conv    128       1 x 1/ 1    152 x 152 x 128 ->  152 x 152 x 128 0.757 BF  1 x 1 特征融合不降维 128 ==> 128
  24 conv    256       3 x 3/ 2    152 x 152 x 128 ->   76 x  76 x 256 3.407 BF  降低特征图宽度和高度 size // 2,特征图尺寸 76 x  76 x 256
  25 conv    128       1 x 1/ 1     76 x  76 x 256 ->   76 x  76 x 128 0.379 BF  1 x 1 卷积 通道降维 256 ==> 128
  26 route  24 		                           ->   76 x  76 x 256                 复制 layer 25 特征图
  27 conv    128       1 x 1/ 1     76 x  76 x 256 ->   76 x  76 x 128 0.379 BF  1 x 1 卷积 通道降维 256 ==> 128
  28 conv    128       1 x 1/ 1     76 x  76 x 128 ->   76 x  76 x 128 0.189 BF
  29 conv    128       3 x 3/ 1     76 x  76 x 128 ->   76 x  76 x 128 1.703 BF
  30 Shortcut Layer: 27,  wt = 0, wn = 0, outputs:  76 x  76 x 128 0.001 BF      由 layer 27 和 layer 29 相加得到
  31 conv    128       1 x 1/ 1     76 x  76 x 128 ->   76 x  76 x 128 0.189 BF
  32 conv    128       3 x 3/ 1     76 x  76 x 128 ->   76 x  76 x 128 1.703 BF
  33 Shortcut Layer: 30,  wt = 0, wn = 0, outputs:  76 x  76 x 128 0.001 BF      由 layer 30 和 layer 32 相加得到
  34 conv    128       1 x 1/ 1     76 x  76 x 128 ->   76 x  76 x 128 0.189 BF
  35 conv    128       3 x 3/ 1     76 x  76 x 128 ->   76 x  76 x 128 1.703 BF
  36 Shortcut Layer: 33,  wt = 0, wn = 0, outputs:  76 x  76 x 128 0.001 BF      由 layer 33 和 layer 35 相加得到
  37 conv    128       1 x 1/ 1     76 x  76 x 128 ->   76 x  76 x 128 0.189 BF
  38 conv    128       3 x 3/ 1     76 x  76 x 128 ->   76 x  76 x 128 1.703 BF
  39 Shortcut Layer: 36,  wt = 0, wn = 0, outputs:  76 x  76 x 128 0.001 BF      由 layer 36 和 layer 38 相加得到
  40 conv    128       1 x 1/ 1     76 x  76 x 128 ->   76 x  76 x 128 0.189 BF
  41 conv    128       3 x 3/ 1     76 x  76 x 128 ->   76 x  76 x 128 1.703 BF
  42 Shortcut Layer: 39,  wt = 0, wn = 0, outputs:  76 x  76 x 128 0.001 BF      由 layer 30 和 layer 41 相加得到
  43 conv    128       1 x 1/ 1     76 x  76 x 128 ->   76 x  76 x 128 0.189 BF
  44 conv    128       3 x 3/ 1     76 x  76 x 128 ->   76 x  76 x 128 1.703 BF
  45 Shortcut Layer: 42,  wt = 0, wn = 0, outputs:  76 x  76 x 128 0.001 BF      由 layer 42 和 layer 44 相加得到
  46 conv    128       1 x 1/ 1     76 x  76 x 128 ->   76 x  76 x 128 0.189 BF
  47 conv    128       3 x 3/ 1     76 x  76 x 128 ->   76 x  76 x 128 1.703 BF
  48 Shortcut Layer: 45,  wt = 0, wn = 0, outputs:  76 x  76 x 128 0.001 BF      由 layer 45 和 layer 47 相加得到
  49 conv    128       1 x 1/ 1     76 x  76 x 128 ->   76 x  76 x 128 0.189 BF
  50 conv    128       3 x 3/ 1     76 x  76 x 128 ->   76 x  76 x 128 1.703 BF
  51 Shortcut Layer: 48,  wt = 0, wn = 0, outputs:  76 x  76 x 128 0.001 BF      由 layer 48 和 layer 50 相加得到
  52 conv    128       1 x 1/ 1     76 x  76 x 128 ->   76 x  76 x 128 0.189 BF  1 x 1 卷积 通道不降维 128 ==> 128
  53 route  52 25 	                           ->   76 x  76 x 256               concatenation layer 25 和 layer 52
  54 conv    256       1 x 1/ 1     76 x  76 x 256 ->   76 x  76 x 256 0.757 BF  1 x 1 特征融合不降维 256 ==> 256
  55 conv    512       3 x 3/ 2     76 x  76 x 256 ->   38 x  38 x 512 3.407 BF  降低特征图宽度和高度 size // 2,特征图尺寸 38 x  38 x 512
  56 conv    256       1 x 1/ 1     38 x  38 x 512 ->   38 x  38 x 256 0.379 BF  1 x 1 卷积 通道降维 512 ==> 256
  57 route  55 		                           ->   38 x  38 x 512                 复制 layer 55 特征图
  58 conv    256       1 x 1/ 1     38 x  38 x 512 ->   38 x  38 x 256 0.379 BF  1 x 1 卷积 通道降维 512 ==> 256
  59 conv    256       1 x 1/ 1     38 x  38 x 256 ->   38 x  38 x 256 0.189 BF
  60 conv    256       3 x 3/ 1     38 x  38 x 256 ->   38 x  38 x 256 1.703 BF
  61 Shortcut Layer: 58,  wt = 0, wn = 0, outputs:  38 x  38 x 256 0.000 BF      由 layer 58 和 layer 60 相加得到
  62 conv    256       1 x 1/ 1     38 x  38 x 256 ->   38 x  38 x 256 0.189 BF
  63 conv    256       3 x 3/ 1     38 x  38 x 256 ->   38 x  38 x 256 1.703 BF
  64 Shortcut Layer: 61,  wt = 0, wn = 0, outputs:  38 x  38 x 256 0.000 BF      由 layer 61 和 layer 63 相加得到
  65 conv    256       1 x 1/ 1     38 x  38 x 256 ->   38 x  38 x 256 0.189 BF
  66 conv    256       3 x 3/ 1     38 x  38 x 256 ->   38 x  38 x 256 1.703 BF
  67 Shortcut Layer: 64,  wt = 0, wn = 0, outputs:  38 x  38 x 256 0.000 BF      由 layer 64 和 layer 66 相加得到
  68 conv    256       1 x 1/ 1     38 x  38 x 256 ->   38 x  38 x 256 0.189 BF
  69 conv    256       3 x 3/ 1     38 x  38 x 256 ->   38 x  38 x 256 1.703 BF
  70 Shortcut Layer: 67,  wt = 0, wn = 0, outputs:  38 x  38 x 256 0.000 BF      由 layer 67 和 layer 69 相加得到
  71 conv    256       1 x 1/ 1     38 x  38 x 256 ->   38 x  38 x 256 0.189 BF
  72 conv    256       3 x 3/ 1     38 x  38 x 256 ->   38 x  38 x 256 1.703 BF
  73 Shortcut Layer: 70,  wt = 0, wn = 0, outputs:  38 x  38 x 256 0.000 BF      由 layer 70 和 layer 72 相加得到
  74 conv    256       1 x 1/ 1     38 x  38 x 256 ->   38 x  38 x 256 0.189 BF
  75 conv    256       3 x 3/ 1     38 x  38 x 256 ->   38 x  38 x 256 1.703 BF
  76 Shortcut Layer: 73,  wt = 0, wn = 0, outputs:  38 x  38 x 256 0.000 BF      由 layer 73 和 layer 75 相加得到
  77 conv    256       1 x 1/ 1     38 x  38 x 256 ->   38 x  38 x 256 0.189 BF
  78 conv    256       3 x 3/ 1     38 x  38 x 256 ->   38 x  38 x 256 1.703 BF
  79 Shortcut Layer: 76,  wt = 0, wn = 0, outputs:  38 x  38 x 256 0.000 BF      由 layer 76 和 layer 78 相加得到
  80 conv    256       1 x 1/ 1     38 x  38 x 256 ->   38 x  38 x 256 0.189 BF
  81 conv    256       3 x 3/ 1     38 x  38 x 256 ->   38 x  38 x 256 1.703 BF
  82 Shortcut Layer: 79,  wt = 0, wn = 0, outputs:  38 x  38 x 256 0.000 BF      由 layer 79 和 layer 81 相加得到
  83 conv    256       1 x 1/ 1     38 x  38 x 256 ->   38 x  38 x 256 0.189 BF  1 x 1 卷积 通道不降维 256 ==> 256
  84 route  83 56 	                           ->   38 x  38 x 512               concatenation layer 56 和 layer 83
  85 conv    512       1 x 1/ 1     38 x  38 x 512 ->   38 x  38 x 512 0.757 BF  1 x 1 特征融合不降维 512 ==> 512
  86 conv   1024       3 x 3/ 2     38 x  38 x 512 ->   19 x  19 x1024 3.407 BF  降低特征图宽度和高度 size // 2,特征图尺寸 19 x  19 x 1024
  87 conv    512       1 x 1/ 1     19 x  19 x1024 ->   19 x  19 x 512 0.379 BF  1 x 1 卷积 通道降维 1024 ==> 512
  88 route  86 		                           ->   19 x  19 x1024                 复制 layer 86 特征图
  89 conv    512       1 x 1/ 1     19 x  19 x1024 ->   19 x  19 x 512 0.379 BF  1 x 1 卷积 通道降维 1024 ==> 512
  90 conv    512       1 x 1/ 1     19 x  19 x 512 ->   19 x  19 x 512 0.189 BF
  91 conv    512       3 x 3/ 1     19 x  19 x 512 ->   19 x  19 x 512 1.703 BF
  92 Shortcut Layer: 89,  wt = 0, wn = 0, outputs:  19 x  19 x 512 0.000 BF      由 layer 89 和 layer 91 相加得到
  93 conv    512       1 x 1/ 1     19 x  19 x 512 ->   19 x  19 x 512 0.189 BF
  94 conv    512       3 x 3/ 1     19 x  19 x 512 ->   19 x  19 x 512 1.703 BF
  95 Shortcut Layer: 92,  wt = 0, wn = 0, outputs:  19 x  19 x 512 0.000 BF      由 layer 92 和 layer 94 相加得到
  96 conv    512       1 x 1/ 1     19 x  19 x 512 ->   19 x  19 x 512 0.189 BF
  97 conv    512       3 x 3/ 1     19 x  19 x 512 ->   19 x  19 x 512 1.703 BF
  98 Shortcut Layer: 95,  wt = 0, wn = 0, outputs:  19 x  19 x 512 0.000 BF      由 layer 95 和 layer 97 相加得到
  99 conv    512       1 x 1/ 1     19 x  19 x 512 ->   19 x  19 x 512 0.189 BF
 100 conv    512       3 x 3/ 1     19 x  19 x 512 ->   19 x  19 x 512 1.703 BF
 101 Shortcut Layer: 98,  wt = 0, wn = 0, outputs:  19 x  19 x 512 0.000 BF      由 layer 98 和 layer 100 相加得到
 102 conv    512       1 x 1/ 1     19 x  19 x 512 ->   19 x  19 x 512 0.189 BF  1 x 1 卷积 通道不降维 512 ==> 512
 103 route  102 87 	                           ->   19 x  19 x1024               concatenation layer 87 和 layer 102
 104 conv   1024       1 x 1/ 1     19 x  19 x1024 ->   19 x  19 x1024 0.757 BF  1 x 1 特征融合不降维 1024 ==> 1024
 105 conv    512       1 x 1/ 1     19 x  19 x1024 ->   19 x  19 x 512 0.379 BF  1 x 1 卷积 通道降维 1024 ==> 512
 106 conv   1024       3 x 3/ 1     19 x  19 x 512 ->   19 x  19 x1024 3.407 BF  3 x 3 卷积 通道升维 512 ==> 1024
 107 conv    512       1 x 1/ 1     19 x  19 x1024 ->   19 x  19 x 512 0.379 BF  1 x 1 卷积 通道降维 1024 ==> 512
 108 max                5x 5/ 1     19 x  19 x 512 ->   19 x  19 x 512 0.005 BF  对 layer 107 进行 5 x 5 最大池化
 109 route  107 		                           ->   19 x  19 x 512
 110 max                9x 9/ 1     19 x  19 x 512 ->   19 x  19 x 512 0.015 BF  对 layer 107 进行 9 x 9 最大池化
 111 route  107 		                           ->   19 x  19 x 512
 112 max               13x13/ 1     19 x  19 x 512 ->   19 x  19 x 512 0.031 BF  对 layer 107 进行 13 x 13 最大池化
 113 route  112 110 108 107 	                   ->   19 x  19 x2048             concatenation layer 107, layer 108,layer 110 和 layer 112
 114 conv    512       1 x 1/ 1     19 x  19 x2048 ->   19 x  19 x 512 0.757 BF  1 x 1 卷积 通道降维 2048 ==> 512
 115 conv   1024       3 x 3/ 1     19 x  19 x 512 ->   19 x  19 x1024 3.407 BF
 116 conv    512       1 x 1/ 1     19 x  19 x1024 ->   19 x  19 x 512 0.379 BF  1 x 1 卷积 通道降维 1024 ==> 512
 117 conv    256       1 x 1/ 1     19 x  19 x 512 ->   19 x  19 x 256 0.095 BF  1 x 1 卷积 通道降维 512 ==> 256
 118 upsample                 2x    19 x  19 x 256 ->   38 x  38 x 256           上采样特征图宽度和高度 size x 2,特征图尺寸 38 x  38 x 256
 119 route  85 		                           ->   38 x  38 x 512                 复制 layer 85 特征图
 120 conv    256       1 x 1/ 1     38 x  38 x 512 ->   38 x  38 x 256 0.379 BF  1 x 1 卷积 通道降维 512 ==> 256
 121 route  120 118 	                           ->   38 x  38 x 512             concatenation layer 118 和 layer 120
 122 conv    256       1 x 1/ 1     38 x  38 x 512 ->   38 x  38 x 256 0.379 BF  1 x 1 卷积 通道降维 512 ==> 256
 123 conv    512       3 x 3/ 1     38 x  38 x 256 ->   38 x  38 x 512 3.407 BF
 124 conv    256       1 x 1/ 1     38 x  38 x 512 ->   38 x  38 x 256 0.379 BF
 125 conv    512       3 x 3/ 1     38 x  38 x 256 ->   38 x  38 x 512 3.407 BF
 126 conv    256       1 x 1/ 1     38 x  38 x 512 ->   38 x  38 x 256 0.379 BF
 127 conv    128       1 x 1/ 1     38 x  38 x 256 ->   38 x  38 x 128 0.095 BF
 128 upsample                 2x    38 x  38 x 128 ->   76 x  76 x 128           上采样特征图宽度和高度 size x 2,特征图尺寸 76 x  76 x 128
 129 route  54 		                           ->   76 x  76 x 256                 复制 layer 54 特征图
 130 conv    128       1 x 1/ 1     76 x  76 x 256 ->   76 x  76 x 128 0.379 BF  1 x 1 卷积 通道降维 256 ==> 128
 131 route  130 128 	                           ->   76 x  76 x 256             concatenation layer 128 和 layer 130
 132 conv    128       1 x 1/ 1     76 x  76 x 256 ->   76 x  76 x 128 0.379 BF  1 x 1 卷积 通道降维 256 ==> 128
 133 conv    256       3 x 3/ 1     76 x  76 x 128 ->   76 x  76 x 256 3.407 BF  76 x 76 YOLO Head
 134 conv    128       1 x 1/ 1     76 x  76 x 256 ->   76 x  76 x 128 0.379 BF
 135 conv    256       3 x 3/ 1     76 x  76 x 128 ->   76 x  76 x 256 3.407 BF
 136 conv    128       1 x 1/ 1     76 x  76 x 256 ->   76 x  76 x 128 0.379 BF
 137 conv    256       3 x 3/ 1     76 x  76 x 128 ->   76 x  76 x 256 3.407 BF
 138 conv    255       1 x 1/ 1     76 x  76 x 256 ->   76 x  76 x 255 0.754 BF
 139 yolo                                                                        YOLO layer 76 x  76 x 255
[yolo] params: iou loss: ciou (4), iou_norm: 0.07, cls_norm: 1.00, scale_x_y: 1.20
nms_kind: greedynms (1), beta = 0.600000
 140 route  136 		                           ->   76 x  76 x 128               复制 layer 136 特征图
 141 conv    256       3 x 3/ 2     76 x  76 x 128 ->   38 x  38 x 256 0.852 BF  降低特征图宽度和高度 size // 2,特征图尺寸 38 x  38 x 256
 142 route  141 126 	                           ->   38 x  38 x 512             concatenation layer 126 和 layer 141
 143 conv    256       1 x 1/ 1     38 x  38 x 512 ->   38 x  38 x 256 0.379 BF  1 x 1 卷积 通道降维 512 ==> 256
 144 conv    512       3 x 3/ 1     38 x  38 x 256 ->   38 x  38 x 512 3.407 BF  38 x 38 YOLO Head
 145 conv    256       1 x 1/ 1     38 x  38 x 512 ->   38 x  38 x 256 0.379 BF
 146 conv    512       3 x 3/ 1     38 x  38 x 256 ->   38 x  38 x 512 3.407 BF
 147 conv    256       1 x 1/ 1     38 x  38 x 512 ->   38 x  38 x 256 0.379 BF
 148 conv    512       3 x 3/ 1     38 x  38 x 256 ->   38 x  38 x 512 3.407 BF
 149 conv    255       1 x 1/ 1     38 x  38 x 512 ->   38 x  38 x 255 0.377 BF
 150 yolo                                                                        YOLO layer 38 x  38 x 255
[yolo] params: iou loss: ciou (4), iou_norm: 0.07, cls_norm: 1.00, scale_x_y: 1.10
nms_kind: greedynms (1), beta = 0.600000
 151 route  147 		                           ->   38 x  38 x 256               复制 layer 147 特征图
 152 conv    512       3 x 3/ 2     38 x  38 x 256 ->   19 x  19 x 512 0.852 BF  降低特征图宽度和高度 size // 2,特征图尺寸 19 x  19 x 512
 153 route  152 116 	                           ->   19 x  19 x1024             concatenation layer 116 和 layer 152
 154 conv    512       1 x 1/ 1     19 x  19 x1024 ->   19 x  19 x 512 0.379 BF  1 x 1 卷积 通道降维 1024 ==> 512
 155 conv   1024       3 x 3/ 1     19 x  19 x 512 ->   19 x  19 x1024 3.407 BF  19 x 19 YOLO Head
 156 conv    512       1 x 1/ 1     19 x  19 x1024 ->   19 x  19 x 512 0.379 BF
 157 conv   1024       3 x 3/ 1     19 x  19 x 512 ->   19 x  19 x1024 3.407 BF
 158 conv    512       1 x 1/ 1     19 x  19 x1024 ->   19 x  19 x 512 0.379 BF
 159 conv   1024       3 x 3/ 1     19 x  19 x 512 ->   19 x  19 x1024 3.407 BF
 160 conv    255       1 x 1/ 1     19 x  19 x1024 ->   19 x  19 x 255 0.189 BF
 161 yolo                                                                        YOLO layer 19 x  19 x 255
 [yolo] params: iou loss: ciou (4), iou_norm: 0.07, cls_norm: 1.00, scale_x_y: 1.05
nms_kind: greedynms (1), beta = 0.600000
Total BFLOPS 128.459

  可以看到YOLOv4网络共有161层,在 608 × 608 608 \times 608 608×608分辨率下,计算量总共128.46BFLOPS,YOLOv3为141BFLOPS。

3. CSPDarknet53解析

3.1 Size & Channel

  CSPDarknet53网络对应于网络的layer0~layer104,以 608 × 608 608 \times 608 608×608分辨率为例,每个分辨率下特征图的通道数如下所示:

Size Channel
608 × 608 608 \times 608 608×608 32 32 32
304 × 304 304 \times 304 304×304 32 , 64 32,64 3264
152 × 152 152 \times 152 152×152 64 , 128 64,128 64128
76 × 76 76 \times 76 76×76 128 , 256 128,256 128256
38 × 38 38 \times 38 38×38 256 , 512 256,512 256512
19 × 19 19 \times 19 19×19 512 , 1024 512,1024 5121024

3.2 CSP实现

  CSPNet论文详见这里:https://arxiv.org/pdf/1911.11929.pdf,第一个CSP结构如下所示,对应从layer 1到layer 10,layer 1的特征图经过 1 × 1 1 \times 1 1×1卷积不降维得到layer 2保存,另一条路对layer 1进行一系列残差操作得到layer 8,将layer 2和layer 8进行concatenation得到layer 9,对layer 9进行 1 × 1 1 \times 1 1×1卷积进行特征融合,便完成了该分辨率下的CSP构建。
CSP structure

3.3 SPP实现

  SPP论文详见这里:https://arxiv.org/pdf/1406.4729.pdf,网络结构如下图所示。
在这里插入图片描述
  SPP网络用在YOLOv4中的目的是增加网络的感受野。实现是对layer107进行 5 × 5 5 \times 5 5×5 9 × 9 9 \times 9 9×9 13 × 13 13 \times 13 13×13size的最大池化,分别得到layer 108,layer 110和layer 112,完成池化后,将layer 107,layer 108,layer 110和layer 112进行concatenet,连接成一个特征图layer 114并通过 1 × 1 1 \times 1 1×1降维到512个通道。

3.4 PANet实现

  PANet的论文详见这里https://arxiv.org/pdf/1803.01534.pdf,网络结构如下图所示,与FPN相比,UpSample之后又加了DownSample的操作,再接YOLO Head。
PANet
  PANe上采样t对应的layer为layer 105到layer 128,从layer 132开始,为Down Sample和YOLOv3 head。

猜你喜欢

转载自blog.csdn.net/linghu8812/article/details/105812322