当前位置:网站首页>Yolov5 improvement 15: network lightweight method deep separable convolution
Yolov5 improvement 15: network lightweight method deep separable convolution
2022-07-28 22:49:00 【Artificial Intelligence Algorithm Research Institute】
front said : As the current advanced deep learning target detection algorithm YOLOv5, A large number of trick, But there is still room for improvement , For the detection difficulties in specific application scenarios , There are different ways to improve . 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 : One of the problems of deep learning target detection model is that it is too large , Facing the problem of insufficient memory , Second, these scenarios require low latency , In other words, the response speed should be fast , Imagine the pedestrian detection system of self driving cars. What terrible things will happen if the speed is slow? . therefore , Research small and efficient CNN Models are crucial in these scenarios , At least for now , Although the hardware will be faster and faster in the future . This paper attempts to transform ordinary convolution into deep separable convolution , To realize the lightweight of the network model , Balance speed and accuracy .
Same series of articles :YOLOv5 Improvement 13 : Backbone network C3 Replace with lightweight network EfficientNetv2_ AI algorithm engineer 0301 The blog of -CSDN Blog
https://blog.csdn.net/m0_70388905/article/details/125612096?spm=1001.2014.3001.5502YOLOv5 Improvement 12 : Backbone network C3 Replace with lightweight network ShuffleNetV2_ AI algorithm engineer 0301 The blog of -CSDN Blog https://blog.csdn.net/m0_70388905/article/details/125612052
https://blog.csdn.net/m0_70388905/article/details/125612052YOLOv5 Improvement Xi : Backbone network C3 Replace with lightweight network MobileNetV3_ AI algorithm engineer 0301 The blog of -CSDN Blog https://blog.csdn.net/m0_70388905/article/details/125593267
https://blog.csdn.net/m0_70388905/article/details/125593267
principle :
Conventional convolution : For one 5×5 Pixels 、 Three channels (shape by 5×5×3), after 3×3 The convolution layer of the convolution kernel ( Suppose the number of output channels is 4, Then convolution kernel shape by 3×3×3×4, Final output 4 individual Feature Map, If there is same padding Then the size is the same as the input layer (5×5), If not, the dimension becomes 3×3
Depth separates the convolution :Depthwise Convolution A convolution kernel of is responsible for a channel , A channel is convoluted by only one convolution kernel . a sheet 5×5 Pixels 、 Three channel color input picture (shape by 5×5×3),Depthwise Convolution First, after the first convolution operation ,DW Completely in a two-dimensional plane . The number of convolution kernels is the same as the number of channels in the upper layer ( The channel corresponds to the convolution kernel one by one ). So a three channel image is generated after operation 3 individual Feature map( If there is same padding Then the size is the same as that of the input layer 5×5), As shown in the figure below .
Fang Law :
Step 1 modify common.py, increase ghostC3 modular .
def DWConv(c1, c2, k=1, s=1, act=True):
# Depthwise convolution
return Conv(c1, c2, k, s, g=math.gcd(c1, c2), act=act)
class Conv(nn.Module):
# Standard convolution
def __init__(self, c1, c2, k=1, s=1, p=None, g=1, act=True): # ch_in, ch_out, kernel, stride, padding, groups
super(Conv, self).__init__()
self.conv = nn.Conv2d(c1, c2, k, s, autopad(k, p), groups=g, bias=False)
self.bn = nn.BatchNorm2d(c2)
self.act = nn.SiLU() if act is True else (act if isinstance(act, nn.Module) else nn.Identity())
def forward(self, x):# Network execution sequence
return self.act(self.bn(self.conv(x)))
def fuseforward(self, x):
return self.act(self.conv(x))The second step : take yolo.py Registration module in .
if m in [Conv,MobileNetV3_InvertedResidual,ShuffleNetV2_InvertedResidual,ghostc3,DWconv
]:
The third step : Make changes yaml file
junction fruit : I have done a lot of experiments on multiple data sets , For different data sets, the effect is different ,map Value down , But the size of the weight model decreases , The parameter quantity decreases .
Let me know : The next content will continue to share the sharing of network lightweight methods . Interested friends can pay attention to me , If you have questions, you can leave a message or chat with me in private
PS: The replacement of backbone network is not only applicable to improvement YOLOv5, You can also improve others YOLO Network and target detection network , such as YOLOv4、v3 etc. .
Last , I hope I can powder each other , Be a friend , Learn and communicate together .
边栏推荐
- PC side web page effects (client series, scroll series, immediate function execution, sidebar effects)
- Bluetooth smart Bracelet system based on STM32 MCU
- Common library code snippet pytorch_ based【tips】
- 近期bug总结
- Configuration and official document of Freia library [tips]
- STM32 - interrupt overview (interrupt priority)
- Introduction to structure
- OSV-q grd_ x=grd_ x[:, :, 0:-1, :]-data_ in[:, :, 1:, :]IndexError: too many indices for tensor of d
- console.log()控制台显示...解决办法
- 1e3是浮点数?
猜你喜欢

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

DIP-VBTV: Color Image Restoration Model Combining Deep Image Prior and Vector Bundle Total Variation

Command line agent: proxychains configuration

【三维目标检测】3DSSD(二)

基于Ernie-3.0 CAIL2019法研杯要素识别多标签分类任务

Summary of the problem that MathType formula does not correspond in word

Install PCL and VTK under the background of ROS installation, and solve VTK and PCL_ ROS conflict problem

Anomaly detection summary: intensity_ based/Normalizing Flow
![Differernet [anomaly detection: normalizing flow]](/img/75/958d753c20227fbbfe1085e7d6ce6f.png)
Differernet [anomaly detection: normalizing flow]

Stm32subeide (10) -- ADC scans multiple channels in DMA mode
随机推荐
Anomaly detection summary: intensity_ based/Normalizing Flow
STM32 single chip microcomputer drive L298N
STM32_ Hal library driven framework
基于Ernie-3.0 CAIL2019法研杯要素识别多标签分类任务
[reprint] the token token is used in the login scenario
Introduction to structure
Intelligent control -- fuzzy mathematics and control
STM32 board level support package for keys
es学习目录
Morphology of image
【三维目标检测】3DSSD(一)
Summary of C language learning content
776. String shift inclusion problem
Paddlenlp is based on ernir3.0 text classification. Take the crime prediction task of cail2018-small dataset as an example [multiple tags]
(重要)初识C语言 -- 函数
Labelme labels circular objects [tips]
DIP-VBTV: Color Image Restoration Model Combining Deep Image Prior and Vector Bundle Total Variation
《Robust and Communication-Efficient Federated Learning From Non-i.i.d. Data》论文阅读
LeetCode练习3——回文数
Pictures are named in batches in order (change size /jpg to PNG) [tips]