π [Merge] branch 'DATASET' into TEST
Browse files
yolo/utils/dataset_utils.py
CHANGED
@@ -100,7 +100,10 @@ def scale_segmentation(
|
|
100 |
h, w = image_dimensions["height"], image_dimensions["width"]
|
101 |
for anno in annotations:
|
102 |
category_id = anno["category_id"]
|
103 |
-
|
|
|
|
|
|
|
104 |
scaled_seg_data = (
|
105 |
np.array(seg_list).reshape(-1, 2) / [w, h]
|
106 |
).tolist() # make the list group in x, y pairs and scaled with image width, height
|
|
|
100 |
h, w = image_dimensions["height"], image_dimensions["width"]
|
101 |
for anno in annotations:
|
102 |
category_id = anno["category_id"]
|
103 |
+
if "segmentation" in anno:
|
104 |
+
seg_list = [item for sublist in anno["segmentation"] for item in sublist]
|
105 |
+
elif "bbox" in anno:
|
106 |
+
seg_list = anno["bbox"]
|
107 |
scaled_seg_data = (
|
108 |
np.array(seg_list).reshape(-1, 2) / [w, h]
|
109 |
).tolist() # make the list group in x, y pairs and scaled with image width, height
|