Giter VIP home page Giter VIP logo

hukaixuan19970627 / yolov5_obb Goto Github PK

View Code? Open in Web Editor NEW
1.7K 12.0 421.0 18.15 MB

yolov5 + csl_label.(Oriented Object Detection)(Rotation Detection)(Rotated BBox)基于yolov5的旋转目标检测

License: GNU General Public License v3.0

Python 59.68% Makefile 0.01% C++ 29.73% Cython 0.15% Cuda 3.82% SWIG 0.03% Dockerfile 0.31% Shell 0.43% Jupyter Notebook 5.86%
yolov5 detection dota rotation oriented aerial-imagery rotated-object

yolov5_obb's Introduction

Hi there 👋

📈 My GitHub Stats

hukaixuan19970627

yolov5_obb's People

Contributors

ethan-niu avatar hukaixuan19970627 avatar sunbuhui avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

yolov5_obb's Issues

想了解提高识别率的方法,谢谢

❔Question

我star了也fork了,恳请回答。

Additional context

在用于密集场景的识别中,制作训练集的时候是选择稀疏的房屋然后训练,再应用于密集场景呢,还是应用于什么样的场景就拿什么场景的类似样本进行训练。因为密集场景标注十分耗时间所以我想提前问问以免采坑。

训练时的train_batch图片上检测框位置偏移

❔Question

@hukaixuan19970627 略哥你好,我使用的是全新的自制数据集,根据YOLO_Transform.py将DOTA格式的标注转为YOLO格式后可视化正常

但是开始训练后,从train_batch012图上发现送入模型的图片上一些角度的检测框发生了偏移,最终训练结果也是如此

请问这可能会和哪里有关系,如何修改呢?感谢!

RuntimeError: a view of a leaf Variable that requires grad is being used in an in-place operation.

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.

python detect.py 报错

❔Question

image
带佬又是我,我由于手边没安装linux电脑,所以暂时想用windows跑一下demo,调用命令 python detect.py 报出了如上图错误,我不太清楚如何解决这个error。

Additional context

评估代码问题

感觉大佬给的评估代码用起来有点繁琐。如果能直接用yolov5中test.py那种方式去计算map,感觉会简洁很多。

demofiles运行YOLOv5_DOTAv1.5_OBB.pt正常,运行yolov5x.pt报错

请问带佬,配置好环境后用主页下载的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,请问这是哪里的问题呢?

swig执行报错

❔Question

image
大佬好,请问我在执行
python setup.py build_ext --inplace 这条命令的时候会报这样的错误请问是什么原因呢?操作系统是windows10

Additional context

反归一化的问题

❔Question

博主您好。我用您的模型训练自己的数据集效果很好,中心点的坐标和角度都比较准确,但是检测时画的框有些是正常的,有些极其瘦长,框里的图形已经看不出是标签对应的图形了,我看了下detect中pred的数据,好像model输出的label直接为反归一后的label。我看您的注解里有些label是(:w,h,:)有些是(:longside,shortside,:),反归一时会用wimg_w,himg_h,w,h并不平行于图像的边,可能是这里造成我的结果有瘦长的框出现,但是有些框又是正常的,我看了好几天代码,实在是想不通,希望能够得到您的解答,谢谢。

Additional context

关于YOLOv5的参数优化策略问题

请问,YOLOv5先将backbone的前9层冻结,然后又将其每一层解冻,还把bias,weight分别分组加入优化器optimizer。
为什么将前九层冻结,而后又解冻?(直接不冻结不就行了吗),为什么将bias和weight以及其他层分别放入pg2,pg1,pg0中?(是为了分别指定不同weight_decay?)为什么这么做呢?能说明一下Yolov5参数优化策略吗?我也不太懂。
十分感谢!!!
image
image

关于输出的result中的mAP计算

❔我得到的输出result.txt后八位始终是零

我在train.py中只能找到result的初始化(归零)操作,但无法找到对它赋值的操作,是否是缺少了修改的模块,如果想要添加需要在哪里加。希望得到回复。感谢

自定义数据训练问题

❔Question

大佬,我用这个网络训练八类飞机目标的时候没问题,损失下降的很正常,检测效果也还可以
image
但是我把它归为一类之后,其他参数也没变,box损失根本降不下去,定位效果很差,这是为什么
image

Additional context

断点继续训练问题

❔Question:大佬,如果麻烦问一下,想要接着上次没有训练完的结果继续训练的话,需要怎么修改代码呀,尝试的修改了一下,总是不成功

Additional context

image

image

关于图像分割检测小目标的问题以及提高分类

❔Question

请教大佬,自己利用该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倍下采样之后物体对应的特征尺度是不变的,那么分割提高小目标检测的准确率的原理是什么呢?谢谢!
还有就是怎么提高物体的分类精度呢?有些物体是被框出来了但是分类错误了,谢谢!

Additional context

使用自定义数据进行训练,P, R, [email protected], [email protected], val_loss(box, obj, cls, angleloss)全程为0

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:

If 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().

🐛 Bug

A clear and concise description of what the bug is.

To Reproduce (REQUIRED)

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

Expected behavior

A clear and concise description of what you expected to happen.

Environment

If applicable, add screenshots to help explain your problem.

  • OS: [e.g. Ubuntu]
  • GPU [e.g. 2080 Ti]

Additional context

Add any other context about the problem here.

大佬我用测试数据还有我个人的数据训练都没有效果

❔Question

我star了也folk,诚心求助呀

Additional context

环境: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可以得到一定的效果,但是密集的房屋很多识别不到,想试试大佬的网络,但是也是学习不到特征。诚心求助。膜拜大佬。

训练速度特别慢

❔Question

为什么训练速度特别慢?训练的时候感觉相比较正常的yolov5只是加了一个角度分类维度的预测,为什么训练速度差很多呢

Additional context

关于rbox_iou的问题

请问,我看到您在项目里写了计算四边形iou的函数,rbox_iou。但是您好像并没有用到这个函数。在训练过程中,找到与target相匹配的anchor的时候,仍然用的是bbox,而没有用rbox。这是为什么呢?
谢谢。

关于数据标签转化问题

❔Question

Additional context

请问大佬,标签转换中,长短边放缩到(0,1)之间时,长短边怎么乘系数啊,是乘dw还是dh

mosaic

你好,我看你的代码对于mosaic好像支持,但是处理和水平的没啥区别,请问你做mosaic了么?不太理解为啥与之前的没啥区别呢

θ计算出现异常,当前数据为:574.5000000000000000, 277.2500000000000000, 99.3124618530273438, 24.0312232971191406, 78.1;超出opencv表示法的范围:[-90,0)

❔Question

Additional context

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

Test

❔Question

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文件时速度却很慢?

重叠物体检测问题

修改处:将我的图片替换到 DOTA_demo_view/images/文件夹下,对应txt标签文件放到 DOTA_demo_view/labels/文件夹下。train.py中--weights使用yolov5m.pt,--cfg使用yolov5m.yaml(nc改成了2),--data使用DOTA_ROTATED.yaml(nc改成2,names改成[’up’,’down’])。

results
20200929223700486

No access to Baidu files

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.

box loss can not drop

❔Question

您好!我在HRSC2016数据集训练单类别的时候box loss在前几轮训练的时候能正常下降,但是后面box loss就开始上升,然后稳定在较高的水平无法下降。使用训练200轮的权重,然后detection的效果跟预期的一样效果很差,请问您遇到这类情况了吗?

Additional context

2021-05-06 17-55-56 的屏幕截图

正射影像,重叠的应该去掉

这个自yolov3就有,对于1个特征点可能有不同类,它用的sigmoid,但是正射影像应该不会有重叠的,你可以参考一下。
image

只支持正方形图像训练吗

我发现只有正方形图像输入训练,训练结果才正常。如果是矩形图像输入训练,train_batchxx.jpg显示的框就乱了。请问大佬,目前是只能训练正方形图像吗

evaluation

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?

旋转检测框的角度

角度一定需要在[0, 180)的范围吗?

如果要检测一个物体的具体方向,比如说不同旋转角度的字,那么角度能不能改成[0, 360)?

utils/datasets文件在训练时是否调用

❔Question

您好,看到您的utils/datasets文件有数据增强功能,请问train.py中有调用这个代码吗?还是要先设置路径对数据进行python datesets.py?
感谢您的项目。

scale_coords(img.shape[2:], d[:, :4], im0[i].shape) , scale_coords is not found

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:

If 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().

🐛 Bug

A clear and concise description of what the bug is.

To Reproduce (REQUIRED)

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

Expected behavior

A clear and concise description of what you expected to happen.

Environment

If applicable, add screenshots to help explain your problem.

  • OS: [e.g. Ubuntu]
  • GPU [e.g. 2080 Ti]

Additional context

Add any other context about the problem here.

关于重新计算anchor的问题

请问,大佬,您在重新计算anchor的时候,说是利用了遗传算法+kmeans。但是,我并没有看到遗传 算法,倒是看到了kmeans了。
image

dataset

❔Question

Why are you requesting images with width = height? Does it matter if my data doesn't comply?

Additional context

关于LetterBox的问题?

请问,关于Yolov5 在预测阶段中,不同通的尺寸的图片是如何处理的?好像用了个LetterBox函数,但是,经过LetterBox处理的图片仍然不是1024*1024。但这样不会影响到预测效果吗?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.