大四寒假,第三篇复现的论文。环境是从autodl租的3090,跑完这个程序大概23小时,费用56元。(不包含调参数的时间)(autodl调参数可以用无GPU模式,一小时一毛)
先阅读github提供的运行步骤:
$ git clone
$ cd tph-yolov5
$ pip install -
VisDrone2YOLO_lable.py transfer VisDrone annotiations to yolo labels.
You should set the path of VisDrone dataset in VisDrone2YOLO_lable.py first.
$ python VisDrone2YOLO_lable.py
(这个语句的意思是把VisDrone数据集的标签形式转换成yolo的标签形式,VisDrone的标签在annotation文件夹中,转换后的文件夹是labels)
这个文件中的地址要进行修改的,分别在train、test、val三个地址对应的目录下都运行一遍,最后分别在train、test、val生成三个labels文件夹,就完成了这一步
Datasets : VisDrone
Weights (PyTorch v1.10):
yolov5l-xs-1.pt: | Baidu Drive(pw: vibe). | Google Drive |
yolov5l-xs-2.pt: | Baidu Drive(pw: vffz). | Google Drive |
val.py runs inference on VisDrone2019-DET-val, using weights trained with TPH-YOLOv5.
(We provide two weights trained by two different models based on YOLOv5l.)
$ python val.py --weights ./weights/yolov5l-xs-1.pt --img 1996 --data ./data/VisDrone.yaml --augment --save-txt --save-conf --task val --batch-size 8 --verbose --name v5l-xs
或者
$ python val.py --weights ./weights/yolov5l-xs-2.pt --img 1996 --data ./data/VisDrone.yaml --augment --save-txt --save-conf --task val --batch-size 8 --verbose --name v5l-xs
因为她提供了两个模型,都可以测试一下
If you inference dataset with different models, then you can ensemble the result by weighted boxes fusion using wbf.py.
You should set img path and txt path in wbf.py.
$ python wbf.py
train.py allows you to train new model from strach.
$ python train.py --img 1536 --adam --batch 4 --epochs 80 --data ./data/VisDrone.yaml --weights yolov5l.pt --hy data/hyps/hyp.VisDrone.yaml --cfg models/yolov5l-xs-tph.yaml --name v5l-xs-tph
我用的24G显存的3090训练的刚好占用22.4G显存,如果显卡显存太小,可以调batch为2或者1,这样时间可能会翻倍,但是不会出现 cuda out of memery
因为这个程序按照我的3090来运行,用时23小时,中途如果网络断了,那么远程连接的GPU服务器的python就会自动停止,这里我用了nohup来挂起python程序,输出log,语句:
nohup python -u train.py --img 1536 --adam --batch 4 --epochs 80 --data ./data/VisDrone.yaml --weights yolov5l.pt --hy data/hyps/hyp.VisDrone.yaml --cfg models/yolov5l-xs-tph.yaml --name v5l-xs-tph >yolov5.log 2>&1 &
train.py是你的程序 加粗部分是整体,
yolov5.log是你挂起后输出log的文件名
别的暂时不用管
也可以在语句最后加入shutdown运行自动关机功能(我没用),这样省钱,或者你人工盯着log看(我就是这么做的)
最后,目标检测方向,暂时 遥感领域+transformer,欢迎交流
本文发布于:2024-02-02 20:57:56,感谢您对本站的认可!
本文链接:https://www.4u4v.net/it/170687867446401.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
留言与评论(共有 0 条评论) |