Giter VIP home page Giter VIP logo

rotate-yolov3's Introduction

Rotated-Yolov3

Rotaion object detection implemented with yolov3.


Hello, the no-program ryolov3 is available now. Although not so many tricks are attached like this repo, it still achieves good results, and is friendly for beginners to learn, have a good luck.

Update

The latest code has been uploaded, unfortunately, due to my negligence, I incorrectly modified some parts of the code and did not save the historical version last year, which made it hard to reproduce the previous high performance. It is tentatively that there are some problems in the loss calculation part.

But I found from the experimental results left last year that yolov3 is suitable for rotation detection. After using several tricks (attention, ORN, Mish, and etc.), it have achieved good performance. More previous experiment results can be found here.

Support

  • SEBlock
  • CUDA RNMS
  • riou loss
  • Inception module
  • DCNv2
  • ORN
  • SeparableConv
  • Mish/Swish
  • GlobalAttention

Detection Results

The detection results from rotated yolov3 left over last year:

Q&A

Following questions are frequently mentioned. And if you have something unclear, don't doubt and contact me via opening issues.

  • Q: How can I obtain icdar_608_care.txt?

    A: icdar_608_care.txt sets the initial anchors generated via kmeans, you need to run kmeans.py refer to my implemention here. You can also check utils/parse_config.py for more details.

  • Q: How to train the model on my own dataset?

    A: This ryolo implemention is based on this repo, training and evaluation pipeline are the same as that one do.

  • Q: Where is ORN codes?

    A: I'll release the whole codebase as I return school, and this repo may help.

  • Q: I cannot reproduce the result you reported(80 mAP for hrsc and 0.7 F1 for IC15).

  • A: Refer to my reply here. This is only a backup repo, the overall model is no problem, but direct running does not necessarily guarantee good results, cause it is not the latest version, and some parameters may have problems, you need to adjust some details and parameter settings yourself. I will upload the complete executable code as soon as I return to school in September (if lucky).

In the end

There is no need or time to maintain the codebase to reproduce the previous performance. If you are interested in this work, you are welcome to fix the bugs in this codebase, and the trained models are available here with extracted code 5noq . I'll reimplement the rotation yolov4 or yolov5 if time permitting in the future.

rotate-yolov3's People

Contributors

ming71 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

rotate-yolov3's Issues

代码运行问题

大佬你好,我在运行过程中遇到报错:
from utils.nms.r_nms import r_nms
ModuleNotFoundError: No module named 'utils.nms.r_nms
没有这个r_nms,请问是没上传这个文件吗?

results on HRSC2016

Hi Ming

We are interested in your good work based on the yolov3. We have tested this repo on the dataset HRSC2016 (all the images :1680) already. But, unfortunately, we cannot achieve that expected result-mAP around 80%. The tested results are as follows: P: 0.158, R: 0.413, [email protected]: 0.189, F1-score: 0.229.

The configurations are the same as the file provided in the package, hyp.py with 1800 epoches and yolov3-416 with such anchors 792, 2061, 3870, 6353, 9623, 15803 / 4.18, 6.48, 8.71 / -75, -60, -45, -30, -15 ,0,15, 30,45, 60,75, 90 (the same as the values in this file). Although these anchors are different for different datasets, they should not generate such effect on the experimental results obviously.

The model cannot detect the target in terms of most of detected images. We just show two cases with detected targets.
Hopefully we can obtain an expected performance after consulting.

Thanks in advance.

results
Screenshot from 2020-07-24 10-10-53
100001266
100000911

ORN

你好,我想请假一下你是怎么实现ORN的,ORN貌似不匹配pytorch1.1以上版本

数据集

您在repo中展现的舰船数据集,请问能提供下下载链接么?

question to ryolo

Hello ming71, Iam farly new to the whole topik.
I trainet my own Yolo dataset, and now i want to go further. I dont understand axacly how i can customize yolo do i have to do it only in the config file or do I have to write new code, is there some nice explanation out there ? you can recoment ? Sory for opening an issue for this I did not knew how to contact you elswehre. Thank You

Backpropagation skew iou

Hi, does backprop works on you skew iou calculation? This is because from i saw that you were using shapely in your calculation of skewiou which is not tensors

对这个项目很感兴趣,想请教下老哥,配置文件那里的mask和anchor是怎么来的

比如:mask = 144-215 anchors = 792, 2061, 3870, 6353, 9623, 15803 / 4.18, 6.48, 8.71 / -75, -60, -45, -30, -15 ,0,15, 30,45, 60,75, 90
我自己写了个倾斜版的anchor聚类,结果输出 9个 wha,比如对HRSC2016训练集进行聚类,得到
anchors: 153.60285000000002,29.688135000000017,-1.013242, 155.19675,29.394334999999984,0.6998453, 303.57180000000005,41.02582000000001,1.418342, 319.33545000000004,44.92217000000002,0.13387854999999999, 349.01929999999993,52.797129999999925,-0.7143881, 364.179,58.62256000000002,0.5916939, 397.41065000000003,66.58615,1.084582, 398.8361,69.37175500000006,-1.2166975, 533.6992,87.04564000000005,-0.2296711 Accuracy: 51.07%
请问如何转化为你的那种形式?

Dataset

Hello,what is the format of the dataset?

Training on custom dataset Error

Hi, ming71, Thanks for your repo, it is very wonderful.
when I training on custom dataset there is a problem, file train.py import test.py. and it import r_nms from utils.nms.r_nms. But No module named 'utils.nms.r_nms.
How can I get this file ? Thanks.

原理问题

请问大佬,是直接回归xywh还有角度的吗,这个原理是啥子哦

Training on ICDAR15 dataset error

Hi ming71, your work is very wonderful, when I training on ICDAR15 dataset there is a problem , which is "icdar_608_care.txt file is not exist in ${respo_root_dir}/utils/keans file dirctory " . How can I get this file ? Thanks.

UCAS_AOD数据集可以跑吗

大佬,UCAS_AOD数据集可以跑吗,map效果是多少,可以简单说一下吗,目前来说哪个效果最好可以说一下不

旋转框实现 ?

你好,我想问一下,你的旋转框的生成部分 具体是在代码的哪一个部分实现的?具体原理是?源代码看不太懂 ?

Get rotate boxes conner

Hi @ming71
I'm also working with rotate object detection, I'd like to introduce you to an efficient way to get coordinates of a rotated box, please refer to get_corners.

Related to GIoU of 2 rotate boxes, did you find an efficient solution to calculate it? Can you please introduce it to me?

Question about code getting layer_id

Thanks for your great work!

I was trying to train with my own dataset and I got below error.

File "A:\Object detection\rotate-yolov3-ming\rotate-yolov3-master\model\loss.py", line 245, in build_targets j[layer_id][(best_iou_indexes % na) * nt + gt_id] = True
TypeError: only integer tensors of a single element can be converted to an index

occurs from here:

layer_id = (best_iou_indexes/na)[0]

I think below line should be changed to

layer_id = (best_iou_indexes//na)[0]

Is it right?

what is your version?

/content/drive/My Drive/rotate-yolov3/utils/nms
running install
running bdist_egg
running egg_info
writing r_nms.egg-info/PKG-INFO
writing dependency_links to r_nms.egg-info/dependency_links.txt
writing top-level names to r_nms.egg-info/top_level.txt
/usr/local/lib/python3.6/dist-packages/torch/utils/cpp_extension.py:335: UserWarning: Attempted to use ninja as the BuildExtension backend but we could not find ninja.. Falling back to using the slow distutils backend.
warnings.warn(msg.format('we could not find ninja.'))
writing manifest file 'r_nms.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_ext
building 'r_nms' extension
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/local/lib/python3.6/dist-packages/torch/include -I/usr/local/lib/python3.6/dist-packages/torch/include/torch/csrc/api/include -I/usr/local/lib/python3.6/dist-packages/torch/include/TH -I/usr/local/lib/python3.6/dist-packages/torch/include/THC -I/usr/local/cuda/include -I/usr/include/python3.6m -c src/rotate_polygon_nms.cpp -o build/temp.linux-x86_64-3.6/src/rotate_polygon_nms.o -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=r_nms -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++14
In file included from /usr/local/lib/python3.6/dist-packages/torch/include/ATen/Parallel.h:149:0,
from /usr/local/lib/python3.6/dist-packages/torch/include/torch/csrc/api/include/torch/utils.h:3,
from /usr/local/lib/python3.6/dist-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:5,
from /usr/local/lib/python3.6/dist-packages/torch/include/torch/csrc/api/include/torch/nn.h:3,
from /usr/local/lib/python3.6/dist-packages/torch/include/torch/csrc/api/include/torch/all.h:7,
from /usr/local/lib/python3.6/dist-packages/torch/include/torch/extension.h:4,
from src/rotate_polygon_nms.cpp:1:
/usr/local/lib/python3.6/dist-packages/torch/include/ATen/ParallelOpenMP.h:84:0: warning: ignoring #pragma omp parallel [-Wunknown-pragmas]
#pragma omp parallel for if ((end - begin) >= grain_size)

src/rotate_polygon_nms.cpp: In function ‘at::Tensor r_nms(const at::Tensor&, float)’:
src/rotate_polygon_nms.cpp:3:39: warning: ‘at::DeprecatedTypeProperties& at::Tensor::type() const’ is deprecated: Tensor.type() is deprecated. Instead use Tensor.options(), which in many cases (e.g. in a constructor) is a drop-in replacement. If you were using data from type(), that is now available from Tensor itself, so instead of tensor.type().scalar_type(), use tensor.scalar_type() instead and instead of tensor.type().backend() use tensor.device(). [-Wdeprecated-declarations]
#define CHECK_CUDA(x) AT_CHECK(x.type().is_cuda(), #x, " must be a CUDAtensor ")
^
src/rotate_polygon_nms.cpp:8:3: note: in expansion of macro ‘CHECK_CUDA’
CHECK_CUDA(dets);
^~~~~~~~~~
In file included from /usr/local/lib/python3.6/dist-packages/torch/include/ATen/Tensor.h:3:0,
from /usr/local/lib/python3.6/dist-packages/torch/include/ATen/Context.h:4,
from /usr/local/lib/python3.6/dist-packages/torch/include/ATen/ATen.h:5,
from /usr/local/lib/python3.6/dist-packages/torch/include/torch/csrc/api/include/torch/types.h:3,
from /usr/local/lib/python3.6/dist-packages/torch/include/torch/csrc/api/include/torch/data/dataloader_options.h:4,
from /usr/local/lib/python3.6/dist-packages/torch/include/torch/csrc/api/include/torch/data/dataloader/base.h:3,
from /usr/local/lib/python3.6/dist-packages/torch/include/torch/csrc/api/include/torch/data/dataloader/stateful.h:3,
from /usr/local/lib/python3.6/dist-packages/torch/include/torch/csrc/api/include/torch/data/dataloader.h:3,
from /usr/local/lib/python3.6/dist-packages/torch/include/torch/csrc/api/include/torch/data.h:3,
from /usr/local/lib/python3.6/dist-packages/torch/include/torch/csrc/api/include/torch/all.h:4,
from /usr/local/lib/python3.6/dist-packages/torch/include/torch/extension.h:4,
from src/rotate_polygon_nms.cpp:1:
/usr/local/lib/python3.6/dist-packages/torch/include/ATen/core/TensorBody.h:268:30: note: declared here
DeprecatedTypeProperties & type() const {
^~~~
src/rotate_polygon_nms.cpp:3:23: error: ‘AT_CHECK’ was not declared in this scope
#define CHECK_CUDA(x) AT_CHECK(x.type().is_cuda(), #x, " must be a CUDAtensor ")
^
src/rotate_polygon_nms.cpp:8:3: note: in expansion of macro ‘CHECK_CUDA’
CHECK_CUDA(dets);
^~~~~~~~~~
src/rotate_polygon_nms.cpp:3:23: note: suggested alternative: ‘DCHECK’
#define CHECK_CUDA(x) AT_CHECK(x.type().is_cuda(), #x, " must be a CUDAtensor ")
^
src/rotate_polygon_nms.cpp:8:3: note: in expansion of macro ‘CHECK_CUDA’
CHECK_CUDA(dets);
^~~~~~~~~~
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

I met this when i compile this program

running code error

i download the .pt model file and run with command "python detect.py --wights weights/without-matrix.pt --cfg cfg/***.cfg --source 2".. it doesnt work. i dont know which cfg file is correct. Can you show me a correct command with weights file and cfg file?

two questions

Hi

I have two questions regarding the roated-yolov3

  1. I saw the results achieved from kmeans.py,
    '''
    K anchors:
    [[153.87419355 31.30967742]
    [343.26412214 52.12366412]
    [574.57024793 109.7231405 ]]
    Accuracy: 69.19%
    -----area_cluster-----
    [[ 12130]
    [ 42951]
    [113378]]
    -----ratio_cluster-----
    4.18/1
    6.50/1
    8.75/1
    '''

but in yolov3-416.cfg, the anchor values: 792, 2061, 3870, 6353, 9623, 15803 / 4.18, 6.48, 8.71 / -75, -60, -45, -30, -15 ,0,15, 30,45, 60,75, 90. How did you obtain the first six value? area number : 6 but the ratio number: 3.

2. In terms of HRSC dataset, when using this repo, what  results did you get? such as 'P', 'R',  'mAP',  'F1' .  around 80%? 

thanks.

Could you provide the weight model on HRSC2016 dataset?

Excellent job!
I was trying to train the rotate-yolov3 model with HRSC2016 but the model seems to require a lower version of cuda. However I only have 3090 GPU which only support cuda 10+. I think you have trained it because of what you show in the Detection Results. So could you please provide the trained weight model on HRSC2016 dataset?

weights file

where i can get the weights file for testing?

单图训练loss一直无法收敛

感谢作者用yolo基于pytorch实现倾斜检测,其中丰富的注释对我有很大帮助。

本人目前运行环境已经搭建完毕,本来想跑通测试代码,但是由于作者提供的模型与配置文件不匹配暂时还未跑通。于是打算优先把训练代码跑通。我考虑是在作者提供的1张HRSC训练集上进行训练,然后再在该图片上测试结果。但是loss始终无法收敛,在1.5左右震荡。我目前只修改了配置文件中的学习率,初始为0.001,训练策略如下:
scheduler= lr_scheduler.MultiStepLR(optimizer, milestones=[100,200,300,400, 500, 600,700,800, 900], gamma=0.1)

5}$F%KL2N @`M(Y9D174X$Q

目前有几个问题想向作者请教

  • 在HRSC训练过程中还有哪些比较重要的参数需要调试

  • README.md中展示的军舰检测效果图是旋转Yolov3训练后的测试结果展示图吗

  • 是否可以提供一份预训练模型 HRSC+_raw_best.pt 的配置文件

期待可以在百忙中回复一下,祝顺意。

There is no a r_nms script (ModuleNotFoundError: No module named 'utils.nms.r_nms')

There is no a r_nms script. So cannot go through this package. Where is the r_nms script.

parser.add_argument('--cfg', type=str, default='cfg/ICDAR/yolov3_608_dh_o8_ga.cfg', help='cfg file path')
parser.add_argument('--data', type=str, default='data/tiny.data', help='*.data file path')

But if I want to test HRSC dataset, which one can I choose, yolov3-416.cfg or yolov3-m.cfg? thanks in advance.

旋转的先验框?

大佬请问你是怎么样对先验框进行旋转处理的,在原始的yolov3中,有三种尺度的特征层进行预测,每一种尺度又对应3种不同大小的先验框,他们的大小比例是1:1,1:2,2:1左右,那么我觉得1:2和2:1应该属于同一种类别的先验框,只是他们的旋转角度不一样

Hello

你好!可以加你的微信进行沟通吗😭
最近在研究旋转框的目标检测,看到你的工作非常的优秀。

Running Code

Hi, thanks for the effort.

Could you update readme with some basic steps how to use the scripts?
I'm getting "OSError: utils/kmeans/icdar_608_care.txt not found." error when running test.py, train.py and detect.py.

I am going through code, but some basic info would be very helpful.

Thanks

Ubuntu and win running pipline

Hi Ming71,
This projects is a Creative idea, can you put this project in Ubuntu and Win running pipline, thank you very much. Looking forward to your reply.

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.