henry000 commited on
Commit
868c821
Β·
2 Parent(s): 9c96910 d2d621f

πŸ”€ [Merge] branch 'DATASET' into TEST

Browse files
Files changed (1) hide show
  1. yolo/utils/dataset_utils.py +4 -1
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
- seg_list = [item for sublist in anno["segmentation"] for item in sublist]
 
 
 
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