There have been already some similar style questions asked before (1, 2) However, none have mentioned the new Yolov5
style annotations.
Is there a simple function that takes in a normalized Yolov5
bounding box like:-
test = [0.436523 0.535156 0.587891 0.484375]
def some_function(test):
...
return pascal_coords
And returns it in Pascal-VOC format?
I have tried plenty of online scripts - like https://dbuscombe-usgs.github.io/MLMONDAYS/blog/2020/08/17/blog-post and https://blog.roboflow.com/how-to-convert-annotations-from-pascal-voc-to-yolo-darknet/
But they aim for full dataset conversion including the xml
, and some don't accept normalized boxes
This is the format:-
Yolov5 [<x-center> <y-center> <width> <height>]
|---> Converted to <-----|
Pascal VOC [x-top-left, y-top-left, x-bottom-right, y-bottom-right]
I simply want the converted bounding box :) TIA!
After a bit of digging, I found this excellent little package hidden away under piles of google searches https://github.com/tensorturtle/rebox by @tensorturtle. Kudos to the author for providing such a useful and simple-to-use repository!
It provides a way to quickly convert bboxes as well as calculate basic ops like IOU
. Really lovely work :)