Translate YOLO annotations

Hello good people,

I’m new to opencv and currently training a haar cascade for my first steps. While I’m very aware that I could use the opencv_annotation tool to, I don’t find it very good. I’ve tried it and it seems to annotate the images with the amount and box and 4 int values - now since I draw boxes I imagine them being (x,y). I also found CVAT, which seemed a lot better. Now the export of it seems only for deep learning networks but when I did the export for YOLO it somewhat had the same structure with the amount and 4 floats normalized from 0.0 - 1.0
could I translate those numbers to use in training a haar cascade and how would I do so?

can you show a few lines of the generated yolo annotations ?

also, what are you trying to detect later ?
(maybe training cascadades for that is a bad idea …)

export name-yolo



1.txt example:

1 0.478464 0.391468 0.015552 0.026509

I try to train it on to detect a small logo, with very small changes inside the logo (different numbers from different years) on different backgrounds.

yea, might work, gl :slight_smile:

so, that is [classid CX CY w h] (in [0…1] coords)

and you need to translate each txt file to a line like:

/path/to/img Nrects  L T w h  L T w h  ....


L = (CX - w/2) * W
T = (CY - h/2) * H 
w = w * W
h = h * H

(W,H are the image dims)

1 Like

One more question, since the numbers that come out are floats I have to cut them to ints.
Since some numbers are rounded up and some are rounded down and they seem to relate to each other, does that create any issue for the algorithm?

i dont think so.
human error while annotating will exceed your rounding errors by far

1 Like