当前位置:网站首页>Yolov5 adds a small target detection layer
Yolov5 adds a small target detection layer
2022-06-28 06:20:00 【Caribbean kelp 66】
Small target detection has always been CV One of the difficulties in the field , that ,YOLOv5 How to add a small target detection layer ?

YOLOv5 Code changes ———— For small target detection
1.YOLOv5 Introduction to the algorithm
YOLOv5 Mainly by input terminal 、Backone、Neck as well as Prediction Four-part composition . among :
(1) Backbone: The convolution neural network of image features is formed by combining different fine-grained images .
(2) Neck: A network layer that mixes and combines image features , And transfer the image features to the prediction layer .
(3) Head: Prediction of image features , Generate bounding boxes and predict categories .
Detection framework :

2. original YOLOv5 Model
# YOLOv5 head
head:
[[-1, 1, Conv, [512, 1, 1]],
[-1, 1, nn.Upsample, [None, 2, 'nearest']],
[[-1, 6], 1, Concat, [1]], # cat backbone P4
[-1, 3, C3, [512, False]], # 13
[-1, 1, Conv, [256, 1, 1]],
[-1, 1, nn.Upsample, [None, 2, 'nearest']],
[[-1, 4], 1, Concat, [1]], # cat backbone P3
[-1, 3, C3, [256, False]], # 17 (P3/8-small)
[-1, 1, Conv, [256, 3, 2]],
[[-1, 14], 1, Concat, [1]], # cat head P4
[-1, 3, C3, [512, False]], # 20 (P4/16-medium)
[-1, 1, Conv, [512, 3, 2]],
[[-1, 10], 1, Concat, [1]], # cat head P5
[-1, 3, C3, [1024, False]], # 23 (P5/32-large)
[[17, 20, 23], 1, Detect, [nc, anchors]], # Detect(P3, P4, P5)
]If you enter the image size =640X640,
# P3/8 The size of the corresponding detection feature map is 80X80, Used to detect that the size is in 8X8 The above goals .
# P4/16 The size of the corresponding detection feature map is 40X40, Used to detect that the size is in 16X16 The above goals .
# P5/32 The size of the corresponding detection feature map is 20X20, Used to detect that the size is in 32X32 The above goals .
3. Add a small target detection layer
# parameters
nc: 1 # number of classes
depth_multiple: 0.33 # model depth multiple
width_multiple: 0.50 # layer channel multiple
# anchors
anchors:
- [5,6, 8,14, 15,11] #4
- [10,13, 16,30, 33,23] # P3/8
- [30,61, 62,45, 59,119] # P4/16
- [116,90, 156,198, 373,326] # P5/32
# YOLOv5 backbone
backbone:
# [from, number, module, args]
[[-1, 1, Focus, [64, 3]], # 0-P1/2
[-1, 1, Conv, [128, 3, 2]], # 1-P2/4
[-1, 3, BottleneckCSP, [128]], #160*160
[-1, 1, Conv, [256, 3, 2]], # 3-P3/8
[-1, 9, BottleneckCSP, [256]], #80*80
[-1, 1, Conv, [512, 3, 2]], # 5-P4/16
[-1, 9, BottleneckCSP, [512]], #40*40
[-1, 1, Conv, [1024, 3, 2]], # 7-P5/32
[-1, 1, SPP, [1024, [5, 9, 13]]],
[-1, 3, BottleneckCSP, [1024, False]], # 9 20*20
]
# YOLOv5 head
head:
[[-1, 1, Conv, [512, 1, 1]], #20*20
[-1, 1, nn.Upsample, [None, 2, 'nearest']], #40*40
[[-1, 6], 1, Concat, [1]], # cat backbone P4 40*40
[-1, 3, BottleneckCSP, [512, False]], # 13 40*40
[-1, 1, Conv, [512, 1, 1]], #40*40
[-1, 1, nn.Upsample, [None, 2, 'nearest']],
[[-1, 4], 1, Concat, [1]], # cat backbone P3 80*80
[-1, 3, BottleneckCSP, [512, False]], # 17 (P3/8-small) 80*80
[-1, 1, Conv, [256, 1, 1]], #18 80*80
[-1, 1, nn.Upsample, [None, 2, 'nearest']], #19 160*160
[[-1, 2], 1, Concat, [1]], #20 cat backbone p2 160*160
[-1, 3, BottleneckCSP, [256, False]], #21 160*160
[-1, 1, Conv, [256, 3, 2]], #22 80*80
[[-1, 18], 1, Concat, [1]], #23 80*80
[-1, 3, BottleneckCSP, [256, False]], #24 80*80
[-1, 1, Conv, [256, 3, 2]], #25 40*40
[[-1, 14], 1, Concat, [1]], # 26 cat head P4 40*40
[-1, 3, BottleneckCSP, [512, False]], # 27 (P4/16-medium) 40*40
[-1, 1, Conv, [512, 3, 2]], #28 20*20
[[-1, 10], 1, Concat, [1]], #29 cat head P5 #20*20
[-1, 3, BottleneckCSP, [1024, False]], # 30 (P5/32-large) 20*20
[[21, 24, 27, 30], 1, Detect, [nc, anchors]], # Detect(p2, P3, P4, P5)
]
# New addition 160X160 Detection characteristic diagram of , Used to detect 4X4 The above goals .
After improvement , Although the amount of computation and the speed of detection have increased , However, the detection accuracy of small targets has been significantly improved .
边栏推荐
- Mosaic data enhanced mosaic
- Development trend of mobile advertising: Leveraging stock and fine marketing
- Install and manage multiple versions of PHP under mac
- ROS rviz_ Satellite function package visualizes GNSS track and uses satellite map
- 【Paper Reading-3D Detection】Fully Convolutional One-Stage 3D Object Detection on LiDAR Range Images
- Xcode13.3.1 项目执行pod install后报错
- 链表(三)——反转链表
- API learning of OpenGL (2007) gltexcoordpointer
- Unity packaging webgl uses IIS to solve the error
- At first glance, I can see several methods used by motionlayout
猜你喜欢

ES9023音频解码芯片的工作原理

借助nz-pagination中的let-total解析ng-template

Apple MDM bypass jailfree bypass MDM configuration lock free

High quality domestic stereo codec cjc8988, pin to pin replaces wm8988

整型提升和大小端字节序

Openharmony gnawing paper growth plan -- json-rpc

YYGH-BUG-03

自定义 cube-ui 弹出框dialog支持多个且多种类型的input框

Linked list (III) - reverse linked list

AutoCAD C polyline small acute angle detection
随机推荐
ImportError: cannot import name 'ensure_dir_exists'的可解决办法
脚本语言和编程语言
ThreadLocal
4. use MySQL shell to install and deploy Mgr clusters | explain Mgr in simple terms
Idea automatically adds comments when creating classes
YOLOv5增加小目标检测层
【Paper Reading-3D Detection】Fully Convolutional One-Stage 3D Object Detection on LiDAR Range Images
Drop down list processing in Web Automation
Uni app wechat applet sharing function
Working principle of es9023 audio decoding chip
链表(一)——移除链表元素
Object对象转 List集合
JSP
Lombok @equalsandhashcode annotation how to make objects The equals () method compares only some attributes
Apple MDM Bypass 免越狱绕过MDM配置锁 免费
AutoCAD C polyline small acute angle detection
Differences between overloads, rewrites, abstract classes and interfaces
Configure redis from 0
Promotion intégrale et ordre des octets de fin de taille
Apple MDM bypass jailfree bypass MDM configuration lock free