Forráskód Böngészése

Fix segmentation generation for rectangles

Shannon 5 éve
szülő
commit
ecf6362a37
1 módosított fájl, 5 hozzáadás és 0 törlés
  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)