소스 검색

Fix segmentation generation for rectangles

Shannon 5 년 전
부모
커밋
ecf6362a37
1개의 변경된 파일5개의 추가작업 그리고 0개의 파일을 삭제
  1. 5 0
      examples/instance_segmentation/labelme2coco.py

+ 5 - 0
examples/instance_segmentation/labelme2coco.py

@@ -126,6 +126,11 @@ def main():
                 masks[instance] = mask
 
             points = np.asarray(points).flatten().tolist()
+            
+            if shape['shape_type'] == 'rectangle':
+                x_1, y_1, x_2, y_2 = points
+                points = [x_1, y_1, x_2, y_1, x_2, y_2, x_1, y_2]
+            
             segmentations[instance].append(points)
         segmentations = dict(segmentations)