当前位置:网站首页>记录使用yolov5进行旋转目标的检测
记录使用yolov5进行旋转目标的检测
2022-06-12 16:52:00 【江小白jlj】
由于实习公司需要使用到旋转目标的检测,所以这几天学习了相关知识,并找了许多资料,饶了许多的弯路。下面记录下项目的整个实现过程。
我参考的是以下几位博主:
DOTAv2遥感图像旋转目标检测竞赛经验分享(Swin Transformer + Anchor free/based方案) - 知乎
首先,先为该项目创建一个虚拟环境
VS2015
pytorch 1.6.0
torchvision 0.7.0
其中这个VS2015,17,19版本都可以,但是pytorch和torchvision必须是要求的版本 ,不然可能会出错。建议安装pytorch和torchvision时采用离线安装包安装,比较稳定。地址,
https://download.pytorch.org/whl/torch_stable.html
接着打开Anaconda prompt创建项目的虚拟环境
conda create -n royolov5 python=3.8
conda activate yolov5
进入创建的虚拟环境之后cd进入下载好pytorch和torchvision的文件夹。然后执行
pip install torch-1.6.0+cu101-cp38-cp38-win_amd64.whl
pip install torchvision-0.7.0+cu101-cp38-cp38-win_amd64.whl
这里注意后缀名.whl不要忘了。
到这里,就将pytorch框架搭好了。
接着,下载我发的压缩包,解压后,同样cd进入YOLOv5_DOTA_OBB-master项目文件的主目录
执行 pip install -r requirements.txt 安装相关的包。
再,添加E:\PytorchPro\YOLOv5_DOTA_OBB-master\swigwin-4.0.2到path里面,这里要进行系统环境的刷新,可以选择重启,也可以进入cmd,输入set path=c 进行刷新
再,在Anaconda prompt中的royolov5环境下cd进入utils分别运行
swig -c++ -python polyiou.i
python setup.py build_ext --inplace
再,将E:\ProgramData\Anaconda3\envs\royolov5\Lib\site-packages\shapely\DLLs所有dll复制到E:\ProgramData\Anaconda3\envs\royolov5\Library\bin
到这一步,训练环境基本准备好了,下面开始准备旋转目标所需的数据集
首先要使用到rolabelimg旋转目标标注工具,具体怎么使用自行百度。下载地址
https://github.com/cgvict/roLabelImg
标注图像后得到的是xml格式,这里需要对数据格式进行转换,符合yolov5的txt格式
首先,运行roxml_to_data.py,准换到dota的8点数据格式
再,进入DOTA_devkit_YOLO-master,修改DOTA_devkit_YOLO-master\dota_utils.py中的classnames_v1_5,修改为你标注数据的种类

再,分别运行PaddingPIC.py和YOLO_Transform.py
其中,PaddingPIC.py的作用是将图片扩展到高宽相同,便于数据处理。YOLO_Transform.py的作用是将dota的数据格式转换为yolov5的数据格式。
再,将yolov5训练所需的图片和txt文件分别放入DOTA_demo_view文件夹里的images和labels中

再修改data\DOTA_ROTATED.yaml中nc和names,或者自己写个yaml文件
可以再修改下网络模型的yaml文件,不会的话用官方的yaml文件就行
最后别忘了下载权重文件,这里要注意,因为这个项目是基于v5-3.1版本的,所以,下载的权重文件不能下载最新的pt文件,不然会报错。
最后,开始训练就可以了。
边栏推荐
- JS écoute si l'utilisateur allume le focus de l'écran
- Leetcode 2194. Excel 錶中某個範圍內的單元格(可以,已解决)
- 有趣的 LD_PRELOAD
- 【树莓派】:(四)Camera 进阶
- 性能优化之编译优化
- (六)控制语句if/else switch
- (五)输出和输出
- Large scale real-time quantile calculation -- a brief history of quantitative sketches
- Double write consistency problem
- What's the matter with pbootcms' if judgment failure and direct display of labels?
猜你喜欢

两位新晋Committer的“升级攻略”

JVM memory model and local memory

CVPR 2022 | 元学习在图像回归任务的表现

Unit sshd. service could not be found

Uniapp wallpaper applet source code / double ended wechat Tiktok applet source code

MySQL interview arrangement

Structural requirement analysis of software engineering student information management system

使用ubantu时,遇见的一些小毛病和解决方法

Collect | 22 short videos to learn Adobe Illustrator paper graphic editing and typesetting

QCustomplot笔记(一)之QCustomplot添加数据以及曲线
随机推荐
SwinTransformer网络架构
CVPR 2022 | meta learning performance in image regression task
Gerrit触发Jenkins SonarQube扫描
MySQL interview arrangement
C # final review programming question (guessed by the teacher)
Leetcode 2194. Excel 錶中某個範圍內的單元格(可以,已解决)
canvas 处理图像(上)
Why is your next computer a computer? Explore different remote operations
Picture online collection and delivery system source code
Pat class a 1139 first contact
Leetcode 2190. The number that appears most frequently in the array immediately after the key (yes, once)
goland变成中文版了怎么修改回英文版
redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the pool
启牛开的证券账户安全吗?合法吗?
数据库的三大范式
The C programming language (version 2) notes / 8 UNIX system interface / 8.2 low level i/o (read and write)
Swin transformer code explanation
Download PHP source code of leaf sharing station
js監聽用戶是否打開屏幕焦點
STL -- function object