Sfoglia il codice sorgente

Fix segmentation generation for rectangles

Shannon 5 anni fa
parent
commit
ecf6362a37
1 ha cambiato i file con 5 aggiunte e 0 eliminazioni
  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)