소스 검색

Make bbox_detection/labelme2voc.py more robust

Kentaro Wada 5 년 전
부모
커밋
eb010f2aea
1개의 변경된 파일4개의 추가작업 그리고 0개의 파일을 삭제
  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)