Explorar o código

Make bbox_detection/labelme2voc.py more robust

Kentaro Wada %!s(int64=5) %!d(string=hai) anos
pai
achega
eb010f2aea
Modificáronse 1 ficheiros con 4 adicións e 0 borrados
  1. 4 0
      examples/bbox_detection/labelme2voc.py

+ 4 - 0
examples/bbox_detection/labelme2voc.py

@@ -101,6 +101,10 @@ def main():
             class_id = class_names.index(class_name)
 
             (xmin, ymin), (xmax, ymax) = shape['points']
+            # swap if min is larger than max.
+            xmin, xmax = sorted([xmin, xmax])
+            ymin, ymax = sorted([ymin, ymax])
+
             bboxes.append([xmin, ymin, xmax, ymax])
             labels.append(class_id)