当前位置:网站首页>记录使用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文件,不然会报错。
最后,开始训练就可以了。
边栏推荐
- (四)Golang运算符
- [Hunan University] information sharing of the first and second postgraduate entrance examinations
- CAS optimistic lock
- 并发包和AQS
- The C programming language (version 2) notes / 8 UNIX system interface / 8.3 open, create, close, unlink
- Probation period and overtime compensation -- knowledge before and after entering the factory labor law
- Three paradigms of database
- \begin{algorithm} 笔记
- The safety of link 01 was questioned, and "ultra high strength" became "high strength"_ Publicity_ Steel_ problem
- su直接切换到超级管理员模式,这样很多报错都可以避免了
猜你喜欢

Doctor application | National University of Singapore, Xinchao Wang, teacher recruitment, doctor / postdoctoral candidate in the direction of graph neural network

CVPR 2022 | meta learning performance in image regression task

Qt开发高级进阶:初探qt + opengl

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

Structural requirement analysis of software engineering student information management system

redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the pool

博士申請 | 新加坡國立大學Xinchao Wang老師招收圖神經網絡方向博士/博後

修改自己电脑连接的路由器的配置网址192.168.1.1
![[Hunan University] information sharing of the first and second postgraduate entrance examinations](/img/15/298ea6f7367741e1e085007c498e51.jpg)
[Hunan University] information sharing of the first and second postgraduate entrance examinations
![[MySQL] Cartesian product - multi table query (detailed explanation)](/img/46/6a9a62b35eaa538232da1d738b3931.jpg)
[MySQL] Cartesian product - multi table query (detailed explanation)
随机推荐
Double write consistency problem
Cloud development kunkun chicken music box wechat applet source code
(六)控制语句if/else switch
How to play the map with key as assertion
丁总路由器设置以及401联网
Preprocessing command section 3
The C programming language (version 2) notes / 8 UNIX system interface / 8.2 low level i/o (read and write)
有趣的 LD_PRELOAD
Gerrit触发Jenkins SonarQube扫描
ISCC-2022 部分wp
(八)goto关键字
Unit sshd.service could not be found
Canvas advanced functions (Part 2)
token与幂等性问题
js 使用Rsa 加密 解密
修改自己电脑连接的路由器的配置网址192.168.1.1
890. find and replace mode / Sword finger offer II 080 Combination with k elements
Pat class a 1142 largest regiment
\begin{algorithm} 笔记
C#期末复习编程题(老师猜的)