当前位置:网站首页>Yolov5 changing the upper sampling mode
Yolov5 changing the upper sampling mode
2022-06-25 10:13:00 【Deepheherman】
Yolov5 Change up sampling mode
List of articles
Introduction to common sampling methods
1. Nearest neighbor interpolation (Nearest neighbor interpolation)

2. Bilinear interpolation (Bi-Linear interpolation)

3. Bicubic interpolation (Bi-Cubic interpolation)

Calculation effect : Nearest neighbor interpolation algorithm < Bilinear interpolation < Bicubic interpolation
Calculation speed : Nearest neighbor interpolation algorithm > Bilinear interpolation > Bicubic interpolation
4. Anti pooling

5. Transposition convolution

yolov5 The default is Nearest neighbor interpolation 
experimental result
Here I will present the original Nearest neighbor interpolation The upsampling method of is replaced by Transposition convolution ; Some people have proved through experiments that it does rise , But I am VOC Data sets Up test No rise ,mAP0.5 Probably less than 1 spot 
Modify the way :
First step ; stay models/yolo.py add to nn.ConvTranspose2d
The second step ;models/yolo.py Add the following code

elif m is nn.ConvTranspose2d:
if len(args) >= 7:
args[6] = make_divisible(args[6] * gw, 8)
The third step ; Modify the configuration file , With yolov5s.yaml For example
# YOLOv5 by Ultralytics, GPL-3.0 license
# Parameters
nc: 80 # number of classes
depth_multiple: 0.33 # model depth multiple
width_multiple: 0.50 # layer channel multiple
anchors:
- [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 v6.0 backbone
backbone:
# [from, number, module, args]
[[-1, 1, Conv, [64, 6, 2, 2]], # 0-P1/2
[-1, 1, Conv, [128, 3, 2]], # 1-P2/4
[-1, 3, C3, [128]],
[-1, 1, Conv, [256, 3, 2]], # 3-P3/8
[-1, 6, C3, [256]],
[-1, 1, Conv, [512, 3, 2]], # 5-P4/16
[-1, 9, C3, [512]],
[-1, 1, Conv, [1024, 3, 2]], # 7-P5/32
[-1, 3, C3, [1024]],
[-1, 1, SPPF, [1024, 5]], # 9
]
# YOLOv5 v6.0 head
head:
[[-1, 1, Conv, [512, 1, 1]],
[-1, 1, nn.ConvTranspose2d, [512, 4, 2, 1, 0, 512]],
[[-1, 6], 1, Concat, [1]], # cat backbone P4
[-1, 3, C3, [512, False]], # 13
[-1, 1, Conv, [256, 1, 1]],
[-1, 1, nn.ConvTranspose2d, [256, 4, 2, 1, 0, 256]],
[[-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)
]
The following is a successful operation 
边栏推荐
- 如何在Microsoft Exchange 2010中安装SSL证书
- Opencv中的GrabCut图像分割
- Summary of considerations for native applet development
- Experience in writing C
- Basic usage and principle of schedulemaster distributed task scheduling center
- i++ 和 ++i的真正区别
- WebApi性能优化
- Redis(一)原理与基本使用
- Remittance international empowers cross-border e-commerce: to be a compliant cross-border payment platform!
- Shuttle JSON, list, map inter transfer
猜你喜欢

Mongodb's principle, basic use, clustering and partitioned clustering

Free platform for wechat applet making, steps for wechat applet making

Jetpack compose layout (II) - material components and layout

Free applet making tool, how to make wechat applet

Unique Wulin, architecture selection manual (including PDF)

Mengyou Technology: tiktok live broadcast with goods elements hot topics retention skills shaping image highlight selling points

8. Intelligent transportation project (1)

Basic usage and principle of schedulemaster distributed task scheduling center

Consul的基本使用与集群搭建

Can two Mitsubishi PLC adopt bcnettcp protocol to realize wireless communication of network interface?
随机推荐
ShardingSphere-Proxy 4.1 分库分表
Processing picture class library
Guiding principle - read source code
IdentityServer4 定义概念
Methodchannel of flutter
Linked list delete nodes in the linked list
Shuttle JSON, list, map inter transfer
How much does a wechat applet cost? Wechat applet development and production costs? Come and have a look
Redis (I) principle and basic use
ShardingSphere-Proxy 5.0 分库分表(一)
【论文阅读|深读】DRNE:Deep Recursive Network Embedding with Regular Equivalence
String longest common prefix
View. post VS Handler. Differences and usage scenarios of post
Swift recursively queries the array for the number closest to the specified value
Oracle function trigger
String implementation strstr()
Gradle download warehouse is slow
The left sliding menu +menu item icon is grayed out
Jetpack compose layout (IV) - constraintlayout
Houdini图文笔记:Could not create OpenCL device of type (HOUDINI_OCL_DEVICETYPE)问题的解决