当前位置:网站首页>【目标检测】TPH-YOLOv5:基于transformer的改进yolov5的无人机目标检测
【目标检测】TPH-YOLOv5:基于transformer的改进yolov5的无人机目标检测
2022-07-25 16:40:00 【zstar-_】
简介
最近在使用VisDrone作为目标检测任务的数据集,看到了这个TPH-YOLOv5这个模型在VisDrone2021 testset-challenge数据集上的检测效果排到了第五,mAP达到39.18%。
于是开始阅读它的论文,并跑一跑的它的代码。
论文地址:https://arxiv.org/pdf/2108.11539.pdf
项目地址:https://github.com/cv516Buaa/tph-yolov5
VisDrone数据集下载:https://pan.baidu.com/s/1JzRTeSi_LgdUVhwtbWhA_w?pwd=8888
解决问题
TPH-YOLOv5旨在解决无人机影像中存在的两个问题:
- 因无人机在不同的高度飞行,物体的尺度变化剧烈
- 高速和低空飞行对排列密集的物体带来了运动模糊。
主要改进
TPH-YOLOv5是在YOLOv5的基础上做了下列改进:
- 1、新增了一个检测头来检测更小尺度的物体
- 2、用transformer prediction heads(TPH)替换原来的预测头部
- 3、将CBAM集成到YOLOv5中,帮助网络在大区域覆盖的图像中找到感兴趣的区域。
- 4、其它一系列小tricks
新的检测头

新的检测头不难理解,之前在我的这篇博文【目标检测】YOLOv5针对小目标检测的改进模型/添加帧率检测也提到过这个改进想法。
改进后的网络整体结构图如下:
TPH
作者使用了一个Transformer Encoder来代替一些卷积和CSP结构,将Transformer在视觉中应用,也是目前的主流趋势,Transformer具有独特的注意力机制,效果比原先更好。

CBAM

CBAM(Convolutional Block Attention Module)是作者提出的一种新的设计结构。如图所示,一张特征图被输入到下一个处理单元前,会先并行计算它的通道注意力和空间注意力,然后将其进行融合重塑,这样会让后面的处理单元更加注意到(focus on)有价值的目标区域。
总结,这篇是国人写的论文,论文结构和思路都非常符合中国人的认知习惯,读起来很顺畅。
实战
下面我将使用TPH-YOLOv5对Visdron数据集进行训练。由于代码是根据YOLOv5进行修改的,所以熟悉YOLOv5的读者能够非常轻松的跑通。
值得注意的是,作者提供了两个模型结构,第一个是yolov5l-xs-tph.yaml这个模型结构,并没有用到CBAM,只是在YOLOv5 6.0版本上新增了一个检测头,我估计是消融实验用到的。如果需要跑最好的效果,应该使用yolov5l-xs-tr-cbam-spp-bifpn.yaml这个模型结构。
同时,作者提供了两个预训练模型,之后我会放在文末供读者下载。
我是用Visdron数据集训练100epoch之后,拿网上一段视频来进行检测,和YOLOv5 5.0,6.1版本的结果做对比,效果如下面这个视频所示。
YOLOv5/TPH-YOLOv5检测效果对比测试
B站Link:https://www.bilibili.com/video/BV17a411u7JD(前往B站一键三连体验更佳)
可以看到实际效果还是比较明显的,TPH-YOLOv5对于密集人群的识别效果有明显提升。
测试视频我也分享出来:https://pan.baidu.com/s/1jgTonbDYmONkqvLjhLPpRQ?pwd=8888
使用其它模型的测试效果可以@我一下让我康康。
另附测试数据:
| 算法 | [email protected] | [email protected]:.95s |
|---|---|---|
| yolov5-5.0 | 34.9% | 20.6% |
| yolov5-6.1 | 33.1% | 18.7% |
| tph-yolov5 | 37.4% | 21.7% |
注:只是100个epoch的得到的best.pt的测试结果,并未达到最优性能。
代码备份
另附TPH-YOLOv5代码本地备份(包含作者提供的两个预训练权重):https://pan.baidu.com/s/15mVle5Exghu3jJMFyl9Lyg?pwd=8888
边栏推荐
- 2D 语义分割——DeepLabV3plus 复现
- 伦敦银K线图的各种有用形态
- fastadmin tp 安装使用百度富文本编辑器UEditor
- 只有1000元能买什么理财产品赚钱?
- Quickly deploy mqtt clusters on AWS using terraform
- MySQL pessimistic lock
- Use huggingface to quickly load pre training models and datasets in moment pool cloud
- Verifiable random function VRF
- 聊聊如何用 Redis 实现分布式锁?
- Test Driven Development (TDD) online practice room | classes open on September 17
猜你喜欢

Fudan University emba2022 graduation season - graduation does not forget the original intention and glory to embark on the journey again

【redis】redis安装

2D semantic segmentation -- deeplabv3plus reproduction

Is the win11 dynamic tile gone? Method of restoring dynamic tile in Win 11

2D 语义分割——DeepLabV3plus 复现

MySQL之联表查询、常用函数、聚合函数
![[fault diagnosis] bearing fault diagnosis based on Bayesian optimization support vector machine with matlab code](/img/9e/138e4b160fa9bd6486fac44a788d09.png)
[fault diagnosis] bearing fault diagnosis based on Bayesian optimization support vector machine with matlab code

激荡20年,芯片产能从零起步到反超美国,中国制造的又一大成就

easyui下拉框,增加以及商品的上架,下架

MQTT X CLI 正式发布:强大易用的 MQTT 5.0 命令行工具
随机推荐
用递归进行数组求和
[image denoising] image denoising based on bicube interpolation and sparse representation matlab source code
异常处理机制专题1
自定义mvc项目登录注册和树形菜单
Register service instances in ngmodule through dependency injection
终极套娃 2.0 | 云原生交付的封装
fastadmin tp 安装使用百度富文本编辑器UEditor
论文笔记:Highly accurate protein structure prediction with AlphaFold (AlphaFold 2 & appendix)
MyBaits
ILSSI认证|六西格玛DMAIC的历程
3D semantic segmentation - scribed supervised lidar semantic segmentation
Mqtt x cli officially released: powerful and easy-to-use mqtt 5.0 command line tool
C Music
Why 4everland is the best cloud computing platform for Web 3.0
Attachment handling of SAP Fiori
0x80131500打不开微软商店的解决办法
Various useful forms of London Silver K-line chart
免费的低代码开发平台有哪些?
Two methods of importing sqllite table from MySQL
【图像隐藏】基于混合 DWT-HD-SVD 的数字图像水印方法技术附matlab代码