YOLOv8/YOLOv7/YOLOv5/YOLOv4/Faster-rcnn series algorithm improvement [NO.67] Add attention mechanism MHSA

 

 Preface
As the current advanced deep learning target detection algorithm YOLOv8, a large number of tricks have been collected, but there is still room for improvement and improvement. Different improvement methods can be used for detection difficulties in specific application scenarios. The following series of articles will focus on how to improve YOLOv8 in detail. The purpose is to provide meager help and reference for those students engaged in scientific research who need innovation or friends who engage in engineering projects to achieve better results. Since YOLOv8, YOLOv7, and YOLOv5 algorithms have emerged in 2020, a large number of improved papers have emerged. Whether it is for students engaged in scientific research or friends who are already working, the value and novelty of the research are not enough. In order to keep pace with the times In the future, the improved algorithm will be based on YOLOv7. The previous YOLOv5 improvement method is also applicable to YOLOv7, so continue the serial number of the YOLOv5 series improvement. In addition, the improvement method can also be applied to other algorithms such as YOLOv5 for improvement. Hope to be helpful to everyone.

1. Solve the problem

There are also many ways to improve the attention mechanism before, such as SE, CA, ECA, botnet, cotnet, swin transformer, etc. You can read the previous records to learn. Today, I will share the attention module of MHSA (multi-head attention mechanism), and try to add attention mechanism to make the network pay more attention to the characteristics of the target to be tested and improve the detection effect.

2. Basic principles

This module is derived from the classic Transformer model in the NLP field, and MHSA is one of the basic unit modules that constitute the Transformer model. Interested friends can read the original text of Transformer to learn the principle.

 Transformer original text link

8c43ec1a2f50499884804d802e925d10.png

b7b22136260e4a4a9509ad7b7939d448.png

 3. Add method

Integrating the MHSA module into YOLOv8, the running results are as follows: Specific improvement method, network disk link: https://pan.baidu.com/s/1Z-j4pq1cM0sLLcwR0eyWIQ 
extraction code: Private message after paying attention.

d6742e19dfc5495e8502663727600952.png

 

Four. Summary

A preview: the next article will continue to share related improvement methods for deep learning algorithms. Interested friends can pay attention to me, if you have any questions, you can leave a message or chat with me privately

PS: This method is not only suitable for improving YOLOv5, but also can improve other YOLO networks and target detection networks, such as YOLOv7, v6, v4, v3, Faster rcnn, ssd, etc.

Finally, please pay attention to private message me if you need it. Pay attention to receive free learning materials for deep learning algorithms!

YOLO series algorithm improvement method | Directory list

 

Guess you like

Origin blog.csdn.net/m0_70388905/article/details/130256077