当前位置:网站首页>Yolov5 improvement 4: add ECA channel attention mechanism
Yolov5 improvement 4: add ECA channel attention mechanism
2022-07-28 22:45:00 【Artificial Intelligence Algorithm Research Institute】
front said : As the current advanced deep learning target detection algorithm YOLOv5, A large number of trick, But when dealing with some complex background problems , It is still prone to the problem of mistakes and omissions . Subsequent articles , Focus on YOLOv5 How to improve is introduced in detail , The purpose is to provide their own meager help and reference for those who need innovation in scientific research or friends who need to achieve better results in engineering projects .
solve the problem : Join in ECA Attention mechanism , It can make the network pay more attention to the target to be detected , Improve the detection effect . The attention mechanism is an article CVPR2020 Articles on improving channel attention ---ECANet,ECANet Mainly for SENet Some improvements have been made to the module , Put forward a kind of Local cross channel interaction strategy without dimensionality reduction (ECA modular ) And adaptive selection of one-dimensional convolution kernel size , So the performance is improved .

Add method :
First step : Determine where to add , As a plug and play attention module , Can be added to YOLOv5 Anywhere in the network .
The second step :common.py structure Eca_layer modular .
class Eca_layer(nn.Module):
"""Constructs a ECA module.
Args:
channel: Number of channels of the input feature map
k_size: Adaptive selection of kernel size
"""
def __init__(self, channel, k_size=3):
super(Eca_layer, self).__init__()
self.avg_pool = nn.AdaptiveAvgPool2d(1)
self.conv = nn.Conv1d(1, 1, kernel_size=k_size, padding=(k_size - 1) // 2, bias=False)
self.sigmoid = nn.Sigmoid()
def forward(self, x):
# x: input features with shape [b, c, h, w]
b, c, h, w = x.size()
# feature descriptor on the global spatial information
y = self.avg_pool(x)
# Two different branches of ECA module
y = self.conv(y.squeeze(-1).transpose(-1, -2)).transpose(-1, -2).unsqueeze(-1)
# Multi-scale information fusion
y = self.sigmoid(y)
return x * y.expand_as(x)The third step :yolo.py Register in Eca_layer modular
elif m is Eca_layer:
channel,k_size=args[0],args[1]
channel = make_divisible(channel * gw, 8) if channel != no else channel
args = [channel, k_size]Step four : modify yaml file , This paper aims to modify backbone For example , The original C3 Add the module after the module .

Step five : take train.py In this article yaml File can , Start training .
junction fruit : I have done a lot of experiments on multiple data sets , For different data sets, the effect is different , There are also differences in the methods of adding locations to the same dataset , You need to experiment . Most cases are effective and improved .
Let me know : The next article shares how to modify the feature fusion network structure , The original BIFPN Change it to BIFPN, Improve the feature fusion ability of the algorithm . Interested friends can pay attention to me , If you have questions, you can leave a message or chat with me in private
PS:ECA Attention mechanism , Not only can it be added YOLOv5, It can also be added to any other deep learning network , Whether it is classification, detection or segmentation , Mainly in the field of computer vision , May have different degrees of improvement effect .
Last , I hope I can powder each other , Be a friend , Learn and communicate together .
边栏推荐
- OSV_ q The size of tensor a (704) must match the size of tensor b (320) at non-singleton dime
- What to do after mathematical modeling gets the competition problem and some ("crooked ways") tips - must see before the competition
- Summary of the problem that MathType formula does not correspond in word
- OSV-q ValueError: axes don‘t match array
- 6K6w5LiA5qyh5pS75Ye75YiG5p6Q
- Redis related
- When can I sign up for the 2022 class I constructor examination?
- Mspba [anomaly detection: representation_based]
- The blueprint of flask complements openpyxl
- Closure, prototype and original link
猜你喜欢

shell脚本基础——Shell运行原理+变量、数组定义

JVM——自定义类加载器
![Draem+sspcab [anomaly detection: block]](/img/97/75ce235c2021b56007eecb82afe4b0.png)
Draem+sspcab [anomaly detection: block]
![Fastflow [abnormal detection: normalizing flow]](/img/5e/984e5bd34c493039e3c9909fc4df05.png)
Fastflow [abnormal detection: normalizing flow]

STM32 - external interrupt application (exti) (use cubemx to configure interrupts)

Use PCL to batch convert point cloud.Bin files to.Pcd
![Padim [anomaly detection: embedded based]](/img/11/834d8b4fdd39959a9dd380e179d317.png)
Padim [anomaly detection: embedded based]

STM32 -- program startup process

Stm32subeide (10) -- ADC scans multiple channels in DMA mode

LTE小区搜索过程及SCH/BCH设计
随机推荐
775. 倒排单词
职场pua但有道理
Mysql8.0 cannot authorize users or prompt you are not allowed to create a user with grant
LeetCode刷题系列之-多数之和类型
elment-plus图标input上面带的图标为什么不显示
PHP库neo4j怎么安装及使用
【三维目标检测】3DSSD(一)
Concise history of graphic technology
Configuration and official document of Freia library [tips]
Lvs+keepalived high availability deployment practical application
近期bug总结
LTE小区搜索过程及SCH/BCH设计
Evaluation index of anomaly detection: rocauc et al. [tips]
STM32 -- program startup process
Find out the maximum value of all indicators in epoch [tips]
Baidu map usage
DOM programming + events
C语言学习内容总结
How do we do full link grayscale on the database?
UNET [basic network]