hukaixuan19970627 / yolov5_obb Goto Github PK
View Code? Open in Web Editor NEWyolov5 + csl_label.(Oriented Object Detection)(Rotation Detection)(Rotated BBox)基于yolov5的旋转目标检测
License: GNU General Public License v3.0
yolov5 + csl_label.(Oriented Object Detection)(Rotation Detection)(Rotated BBox)基于yolov5的旋转目标检测
License: GNU General Public License v3.0
请问大佬可以把poly_iou的计算,在 GPU中实现吗?
using torch 1.8.0+cu102 torchvision0.9.0
Using CUDA device0 _CudaDeviceProperties(name='GeForce GTX 1080', total_memory=8116MB)
Namespace(adam=False, batch_size=4, bucket='', cache_images=False, cfg='', data='data/DOTA_ROTATED.yaml', device='0', epochs=150, evolve=False, global_rank=-1, hyp='data/hyp.scratch.yaml', image_weights=False, img_size=[1024, 1024], local_rank=-1, logdir='runs/', multi_scale=False, name='', noautoanchor=False, nosave=False, notest=True, rect=False, resume=False, single_cls=False, sync_bn=False, total_batch_size=4, weights='./weights/yolov5m.pt', workers=8, world_size=1)
Start Tensorboard with "tensorboard --logdir runs/", view at http://localhost:6006/
2021-04-17 05:40:37.084303: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libcudart.so.10.1
Hyperparameters {'lr0': 0.01, 'lrf': 0.2, 'momentum': 0.937, 'weight_decay': 0.0005, 'warmup_epochs': 3.0, 'warmup_momentum': 0.8, 'warmup_bias_lr': 0.1, 'box': 0.1, 'cls': 0.5, 'cls_pw': 1.0, 'obj': 1.0, 'obj_pw': 1.0, 'angle': 0.8, 'angle_pw': 1.0, 'iou_t': 0.2, 'anchor_t': 4.0, 'fl_gamma': 2.0, 'hsv_h': 0.015, 'hsv_s': 0.7, 'hsv_v': 0.4, 'degrees': 0.0, 'translate': 0.1, 'scale': 0.5, 'shear': 0.0, 'perspective': 0.0, 'flipud': 0.5, 'fliplr': 0.5, 'mosaic': 1.0, 'mixup': 0.0}
from n params module arguments
0 -1 1 5280 models.common.Focus [3, 48, 3]
1 -1 1 41664 models.common.Conv [48, 96, 3, 2]
2 -1 1 67680 models.common.BottleneckCSP [96, 96, 2]
3 -1 1 166272 models.common.Conv [96, 192, 3, 2]
4 -1 1 639168 models.common.BottleneckCSP [192, 192, 6]
Overriding model.yaml nc=80 with nc=16
5 -1 1 664320 models.common.Conv [192, 384, 3, 2]
6 -1 1 2550144 models.common.BottleneckCSP [384, 384, 6]
7 -1 1 2655744 models.common.Conv [384, 768, 3, 2]
8 -1 1 1476864 models.common.SPP [768, 768, [5, 9, 13]]
9 -1 1 4283136 models.common.BottleneckCSP [768, 768, 2, False]
10 -1 1 295680 models.common.Conv [768, 384, 1, 1]
11 -1 1 0 torch.nn.modules.upsampling.Upsample [None, 2, 'nearest']
12 [-1, 6] 1 0 models.common.Concat [1]
13 -1 1 1219968 models.common.BottleneckCSP [768, 384, 2, False]
14 -1 1 74112 models.common.Conv [384, 192, 1, 1]
15 -1 1 0 torch.nn.modules.upsampling.Upsample [None, 2, 'nearest']
16 [-1, 4] 1 0 models.common.Concat [1]
17 -1 1 305856 models.common.BottleneckCSP [384, 192, 2, False]
18 -1 1 332160 models.common.Conv [192, 192, 3, 2]
19 [-1, 14] 1 0 models.common.Concat [1]
20 -1 1 1072512 models.common.BottleneckCSP [384, 384, 2, False]
21 -1 1 1327872 models.common.Conv [384, 384, 3, 2]
22 [-1, 10] 1 0 models.common.Concat [1]
23 -1 1 4283136 models.common.BottleneckCSP [768, 768, 2, False]
24 [17, 20, 23] 1 812241 models.yolo.Detect [16, [[10, 13, 16, 30, 33, 23], [30, 61, 62, 45, 59, 119], [116, 90, 156, 198, 373, 326]], [192, 384, 768]]
Traceback (most recent call last):
File "/home/user1/projects/308/Yolo_OBB/YOLOv5_DOTA_OBB-master/train.py", line 724, in
train(hyp, opt, device, tb_writer)
File "/home/user1/projects/308/Yolo_OBB/YOLOv5_DOTA_OBB-master/train.py", line 126, in train
model = Model(opt.cfg or ckpt['model'].yaml, ch=3, nc=nc).to(device) # create
File "/home/user1/projects/308/Yolo_OBB/YOLOv5_DOTA_OBB-master/models/yolo.py", line 168, in init
self._initialize_biases() # only run once
File "/home/user1/projects/308/Yolo_OBB/YOLOv5_DOTA_OBB-master/models/yolo.py", line 262, in _initialize_biases
b[:, 4] += math.log(8 / (640 / s) ** 2) # obj (8 objects per 640 image)
RuntimeError: a view of a leaf Variable that requires grad is being used in an in-place operation.
发现训练的时候输入如果不是640大小的话,训出来的模型预测不出框。只有输入大小是640训练的,才能在预测的时候出现框,这是为什么呢?麻烦作者看下,谢谢。
请问大佬,标签转换中,长短边放缩到(0,1)之间时,长短边怎么乘系数啊,是乘dw还是dh
请问,关于Yolov5 在预测阶段中,不同通的尺寸的图片是如何处理的?好像用了个LetterBox函数,但是,经过LetterBox处理的图片仍然不是1024*1024。但这样不会影响到预测效果吗?
您好,看到您的utils/datasets文件有数据增强功能,请问train.py中有调用这个代码吗?还是要先设置路径对数据进行python datesets.py?
感谢您的项目。
因为使用的是rtx30系列的显卡,已经升级到pytorch1.8 和cuda11.1,请问你的这个代码支持吗?如果要改的话,有哪些需要调整的?
@hukaixuan19970627 略哥你好,我使用的是全新的自制数据集,根据YOLO_Transform.py将DOTA格式的标注转为YOLO格式后可视化正常
但是开始训练后,从train_batch012图上发现送入模型的图片上一些角度的检测框发生了偏移,最终训练结果也是如此
请问这可能会和哪里有关系,如何修改呢?感谢!
感觉大佬给的评估代码用起来有点繁琐。如果能直接用yolov5中test.py那种方式去计算map,感觉会简洁很多。
我star了也fork了,恳请回答。
在用于密集场景的识别中,制作训练集的时候是选择稀疏的房屋然后训练,再应用于密集场景呢,还是应用于什么样的场景就拿什么场景的类似样本进行训练。因为密集场景标注十分耗时间所以我想提前问问以免采坑。
你好,我看你的代码对于mosaic好像支持,但是处理和水平的没啥区别,请问你做mosaic了么?不太理解为啥与之前的没啥区别呢
Why are you requesting images with width = height? Does it matter if my data doesn't comply?
我发现只有正方形图像输入训练,训练结果才正常。如果是矩形图像输入训练,train_batchxx.jpg显示的框就乱了。请问大佬,目前是只能训练正方形图像吗
when I used the evalution file for evaluation, I changed the following path to mine:
classnames=['product']
classnames_inVal = ['0']
evaluation(
detoutput='image_eval',
imageset=r'/mnt/hdd10tb/Users/hoangnn/product/prj14_data_gen/DATA_26/GenProduct_Yolo_26_convert90_final/images/test/',annopath=r'/mnt/hdd10tb/Users/hoangnn/product/prj14_data_gen/DATA_26/GenProduct_Yolo_26_convert90_final/labels/test/{:s}.txt',
classnames=classnames_inVal
)
However, I have bugs related to not having a file:
FileNotFoundError: [Errno 2] No such file or directory: 'image_eval/result_txt/result_classname/Task1_0.txt'
I don't know what the folders: result_before_merge, result_merged, result_classname, result_txt are and I need to create them myself?
不知道您有没有想法,或者有什么相关教程能够引路的哇?
Before submitting a bug report, please be aware that your issue must be reproducible with all of the following, otherwise it is non-actionable, and we can not help you:
git fetch && git status -uno
to check and git pull
to update repoIf this is a custom dataset/training question you must include your train*.jpg
, test*.jpg
and results.png
figures, or we can not help you. You can generate these with utils.plot_results()
.
A clear and concise description of what the bug is.
Input:
import torch
a = torch.tensor([5])
c = a / 0
Output:
Traceback (most recent call last):
File "/Users/glennjocher/opt/anaconda3/envs/env1/lib/python3.7/site-packages/IPython/core/interactiveshell.py", line 3331, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-5-be04c762b799>", line 5, in <module>
c = a / 0
RuntimeError: ZeroDivisionError
A clear and concise description of what you expected to happen.
If applicable, add screenshots to help explain your problem.
Add any other context about the problem here.
I want to ask why when I use the detect.py file the speed is very fast, but the speed when I use the test.py file is very slow?
我想问为什么当我使用detect.py文件时速度非常快,但是当我使用test.py文件时速度却很慢?
如果要检测一个物体的具体方向,比如说不同旋转角度的字,那么角度能不能改成[0, 360)?
博主您好。我用您的模型训练自己的数据集效果很好,中心点的坐标和角度都比较准确,但是检测时画的框有些是正常的,有些极其瘦长,框里的图形已经看不出是标签对应的图形了,我看了下detect中pred的数据,好像model输出的label直接为反归一后的label。我看您的注解里有些label是(:w,h,:)有些是(:longside,shortside,:),反归一时会用wimg_w,himg_h,w,h并不平行于图像的边,可能是这里造成我的结果有瘦长的框出现,但是有些框又是正常的,我看了好几天代码,实在是想不通,希望能够得到您的解答,谢谢。
应该不是bug,不过你的opencv版本建议注明 小于4.5.1吧
...搞错了
我在train.py中只能找到result的初始化(归零)操作,但无法找到对它赋值的操作,是否是缺少了修改的模块,如果想要添加需要在哪里加。希望得到回复。感谢
Traceback (most recent call last):
File "detect.py", line 253, in
detect()
File "detect.py", line 156, in detect
det[:, :5] = scale_labels(img.shape[2:], det[:, :5], im0.shape).round()
File "/home/malb/doc5/YOLOv5_DOTA_OBB-master/utils/general.py", line 297, in scale_labels
label[-1] = int(label[-1] + 180.5) # range int[0,180] 四舍五入
IndexError: too many indices for array: array is 0-dimensional, but 1 were indexed
classy 一直是 flase
请问,您做遥感物体检测的时候,研究过RoI Transoformer算法吗?
我star了也folk,诚心求助呀
环境:windows
用大佬训练好的weights (YOLOv5_DOTA_OBB.pt)测试标注很好,但在试验训练的代码时发现不收敛。
测试数据:直接用的是大佬demo的数据,执行python train.py 。
batchsize 4
epoch 150
训练得到的result文件长这样:
100/149 4.24G 0.2301 0.01797 0.02276 0.3905 0.6614 158 1024 0 0 0 0 0 0 0 0
101/149 4.24G 0.2307 0.01975 0.0227 0.3783 0.6514 66 1024 0 0 0 0 0 0 0 0
102/149 4.24G 0.2304 0.01748 0.02173 0.3773 0.6469 32 1024 0 0 0 0 0 0 0 0
103/149 4.24G 0.2284 0.01488 0.02366 0.3678 0.6347 71 1024 0 0 0 0 0 0 0 0
104/149 4.24G 0.2327 0.0176 0.01982 0.3642 0.6343 95 1024 0 0 0 0 0 0 0 0
105/149 4.24G 0.2303 0.02012 0.02213 0.3723 0.6449 51 1024 0 0 0 0 0 0 0 0
106/149 4.24G 0.2372 0.01658 0.02031 0.3688 0.6429 18 1024 0 0 0 0 0 0 0 0
107/149 4.24G 0.2356 0.01885 0.01716 0.3587 0.6303 139 1024 0 0 0 0 0 0 0 0
什么都没改,只是把代码跑通了但是没有效果。
另外我个人标注的数据用YOLOv5可以得到一定的效果,但是密集的房屋很多识别不到,想试试大佬的网络,但是也是学习不到特征。诚心求助。膜拜大佬。
Before submitting a bug report, please be aware that your issue must be reproducible with all of the following, otherwise it is non-actionable, and we can not help you:
git fetch && git status -uno
to check and git pull
to update repoIf this is a custom dataset/training question you must include your train*.jpg
, test*.jpg
and results.png
figures, or we can not help you. You can generate these with utils.plot_results()
.
A clear and concise description of what the bug is.
Input:
import torch
a = torch.tensor([5])
c = a / 0
Output:
Traceback (most recent call last):
File "/Users/glennjocher/opt/anaconda3/envs/env1/lib/python3.7/site-packages/IPython/core/interactiveshell.py", line 3331, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-5-be04c762b799>", line 5, in <module>
c = a / 0
RuntimeError: ZeroDivisionError
A clear and concise description of what you expected to happen.
If applicable, add screenshots to help explain your problem.
Add any other context about the problem here.
请问,我看到您在项目里写了计算四边形iou的函数,rbox_iou。但是您好像并没有用到这个函数。在训练过程中,找到与target相匹配的anchor的时候,仍然用的是bbox,而没有用rbox。这是为什么呢?
谢谢。
请教大佬,自己利用该repo在FAIR1M数据集上进行训练,原图像大小多为1000×1000或者1500×1500像素,当自己不对原图像进行分割直接crop_size=1024进行训练,最终评价结果得到船、飞机等较小物体的类别评价指标明显不好,但篮球场、网球场等大物体评价指标较高,在知乎上问了略略略大佬,不知道自己如下理解对不对:就是对于yolo下采样为8倍的分支,假设原图大小为800×800,那么下采样得到的feature map为100×100,分割之后原图大小假设为400×400,那么8倍下采样得到的feature map为50×50,但是对于物体来说下采样之后尺度是不变的,就是不管图像尺寸是多大,8倍下采样之后物体对应的特征尺度是不变的,那么分割提高小目标检测的准确率的原理是什么呢?谢谢!
还有就是怎么提高物体的分类精度呢?有些物体是被框出来了但是分类错误了,谢谢!
Hello,
Thanks for making your repo available to github community. Is it possible for you to put the demo files and trained YOLO model on google drive or dropbox because some of us don't have access to Baidu Cloud outside of China.
Thanks.
请问带佬,配置好环境后用主页下载的YOLOv5_DOTAv1.5_OBB.pt跑demofiles的detect.py,没有问题检测效果良好,但是用yolov5s.pt和yolov5m.pt运行就报错cannot perform reduction function max on tensor with no elements because the operation does not have an identity,请问这是哪里的问题呢?
为什么训练速度特别慢?训练的时候感觉相比较正常的yolov5只是加了一个角度分类维度的预测,为什么训练速度差很多呢
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.