Skip to content

Commit

Permalink
πŸ”€ [Merge] branch 'DATASET' into TEST
Browse files Browse the repository at this point in the history
  • Loading branch information
henrytsui000 committed Jul 24, 2024
2 parents 9c96910 + d2d621f commit 868c821
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion yolo/utils/dataset_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,10 @@ def scale_segmentation(
h, w = image_dimensions["height"], image_dimensions["width"]
for anno in annotations:
category_id = anno["category_id"]
seg_list = [item for sublist in anno["segmentation"] for item in sublist]
if "segmentation" in anno:
seg_list = [item for sublist in anno["segmentation"] for item in sublist]
elif "bbox" in anno:
seg_list = anno["bbox"]
scaled_seg_data = (
np.array(seg_list).reshape(-1, 2) / [w, h]
).tolist() # make the list group in x, y pairs and scaled with image width, height
Expand Down

0 comments on commit 868c821

Please sign in to comment.