stephanecharette / DarkMark

Marking up images for use with Darknet.
https://www.ccoderun.ca/darkmark/Summary.html
Other
175 stars 22 forks source link

Warning from Scrollfield #4

Closed vledoze closed 3 years ago

vledoze commented 3 years ago

Hi,

I got this kind of warning when running DarkMark on my data:

ScrollField: error detected at idx #202 (.../IMG_20200708_0938010.jpg): vector::_M_range_check: __n (which is 39) >= this->size() (which is 25)

I found a quickfix for this in src-wnd/ScrollField.cpp, line 169.
I replaced

cv::line(field, p1, p2, content.annotation_colours.at(class_idx), 1, cv::LINE_4);

with

cv::line(field, p1, p2, content.annotation_colours.at(class_idx%25), 1, cv::LINE_4);

but there might be a better solution.

Regards, Vincent

stephanecharette commented 3 years ago

Why would you add %25 there? How many classes do you have, and are some of your images annotated with classes beyond the maximum index?

vledoze commented 3 years ago

In this case I have 60 classes. So when the class id was beyond 25 I had this kind of warning message.

stephanecharette commented 3 years ago

I didn't fully understand this when you reported it back in March, but eventually I ran into the same problem. There were places where DarkMark would index the colour vector without taking into account that you can have more classes than colours.

Several places in the code had to be fixed due to this error. Ran into it when I did the DarkPlate project earlier this year which had classes A-Z, 0-9, and plate for a total of 37 classes. I'm fairly confident I found and fixed all instances of this bug. If you still see it in a recent version of DarkMark, please re-open or create a new issue.