Kaynağa Gözat

Make bbox_detection/labelme2voc.py more robust

Kentaro Wada 5 yıl önce
ebeveyn
işleme
eb010f2aea
1 değiştirilmiş dosya ile 4 ekleme ve 0 silme
  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)