当前位置:网站首页>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 .
边栏推荐
- redis相关
- Install PCL and VTK under the background of ROS installation, and solve VTK and PCL_ ROS conflict problem
- fatal error: io. h: No such file or directory
- 基于Ernie-3.0 CAIL2019法研杯要素识别多标签分类任务
- 2022年一级建造师考试什么时候才能报名?
- STM32 single chip microcomputer drive L298N
- Padim [anomaly detection: embedded based]
- How to install and use PHP library neo4j
- Vscode ROS configuration GDB debugging error record
- Wechat applet uses canvas drawing, round avatar, network background, text, dotted line, straight line
猜你喜欢

使用PCL批量将点云.bin文件转.pcd

Imx6q GPIO multiplexing

STM32 board level support package for keys
Integrating database Ecology: using eventbridge to build CDC applications
![Paddlenlp is based on ernir3.0 text classification. Take the crime prediction task of cail2018-small dataset as an example [multiple tags]](/img/87/d943cc1e8169bb670414fbf7a322c5.jpg)
Paddlenlp is based on ernir3.0 text classification. Take the crime prediction task of cail2018-small dataset as an example [multiple tags]

Lenovo r9000p installation matlab2018a+cuda10.0 compilation

STM32CUBEIDE(10)----ADC在DMA模式下扫描多个通道

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

JVM——自定义类加载器

JVM -- custom class loader
随机推荐
Evaluation index of anomaly detection: rocauc et al. [tips]
STM32 - Basic timer (tim6, tim7) working process, interpretation function block diagram, timing analysis, cycle calculation
JSON file to PNG image (batch conversion / image naming / migration / pixel value change) [tips]
CMD common commands
Common library code snippet pytorch_ based【tips】
Annaconda installs pytoch and switches environments
How to use sprintf function
Wechat applet uses canvas drawing, round avatar, network background, text, dotted line, straight line
PC side special effects - animation function
How do we do full link grayscale on the database?
简单的es高亮实战
Chrome encountered a problem when debugging the code. After modifying and saving the code in vscode, chrome did not update after refreshing
Install PCL and VTK under the background of ROS installation, and solve VTK and PCL_ ROS conflict problem
[reprint] the token token is used in the login scenario
微信小程序剪切图片的功能
JVM——自定义类加载器
Paddlenlp text classification based on ernir3.0: take wos dataset as an example (hierarchical classification)
775. Inverted words
ssh免密登陆
The blueprint of flask complements openpyxl