Giter VIP home page Giter VIP logo

Comments (4)

hukaixuan19970627 avatar hukaixuan19970627 commented on August 16, 2024

确实有这个问题,不过我暂时也不清楚如何解决。
我先是利用cv2.minAreaRect()函数将 [x1 y1 x2 y2 x3 y3 x4 y4 ] 任意四边形的格式转为最小外接矩形 [x y w h θ] 格式,再接着转为[x y longside shortside θ] 长边表示法。
为了验证格式转换正确,绘制YOLO格式的旋转矩形框时,会将[x y longside shortside θ]格式转回[x y w h θ]格式,再利用cv2.boxPoints()函数返回最小外接旋转矩形的四个点,并绘制出来。
中间过程坐标数据可能会产生些许变化,由于大部分代码我都是调用的cv库,所以暂时也不知道是哪一个步骤出了问题;
但detect的结果图却显示正常(detect的可视化就是将长边表示法转为opencv表示法,再求得四点坐标进行绘制),所以问题可能发生在cv2.minAreaRect()这个函数中。
可能的解决办法就是改变opencv的版本吧,但是opencv升级的话又可能带来新的问题(θ的定义范围改变),我嫌麻烦就没改,因为根据我自己的测试结果来看,这点差异在DOTA数据集上没有多大影响

from dota_devkit_yolo.

XiaoXiLe2023 avatar XiaoXiLe2023 commented on August 16, 2024

确实有这个问题,不过我暂时也不清楚如何解决。
我先是利用cv2.minAreaRect()函数将 [x1 y1 x2 y2 x3 y3 x4 y4 ] 任意四边形的格式转为最小外接矩形 [x y w h θ] 格式,再接着转为[x y longside shortside θ] 长边表示法。
为了验证格式转换正确,绘制YOLO格式的旋转矩形框时,会将[x y longside shortside θ]格式转回[x y w h θ]格式,再利用cv2.boxPoints()函数返回最小外接旋转矩形的四个点,并绘制出来。
中间过程坐标数据可能会产生些许变化,由于大部分代码我都是调用的cv库,所以暂时也不知道是哪一个步骤出了问题;
但detect的结果图却显示正常(detect的可视化就是将长边表示法转为opencv表示法,再求得四点坐标进行绘制),所以问题可能发生在cv2.minAreaRect()这个函数中。
可能的解决办法就是改变opencv的版本吧,但是opencv升级的话又可能带来新的问题(θ的定义范围改变),我嫌麻烦就没改,因为根据我自己的测试结果来看,这点差异在DOTA数据集上没有多大影响

感谢回复。
Before you put x1 y1 x2 y2 x3 y3 x4 y4 into cv2.minAreaRect(), you did NORMALIZATION with them. I haven't met the operation before neither seen it in any instance online. Maybe errors came from this. I'll try to train first and see what will happend.
Thanks.

from dota_devkit_yolo.

hukaixuan19970627 avatar hukaixuan19970627 commented on August 16, 2024

https://zhuanlan.zhihu.com/p/385701722
可以试试这个

from dota_devkit_yolo.

hukaixuan19970627 avatar hukaixuan19970627 commented on August 16, 2024

https://github.com/hukaixuan19970627/yolov5_obb
我更新了一版代码,重构了一遍yolo预处理的逻辑,这个问题以后不会再出现了。
不过DOTA_devkit_YOLO这个repo也就没啥用了,poly与rbox之间的转换由内部代码自动完成

from dota_devkit_yolo.

Related Issues (20)

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.