Skip to content

Instantly share code, notes, and snippets.

@AlessandroMondin
Created December 28, 2022 09:55
Show Gist options
  • Save AlessandroMondin/e2208a9e24eae45e4faa3014659ba9a9 to your computer and use it in GitHub Desktop.
Save AlessandroMondin/e2208a9e24eae45e4faa3014659ba9a9 to your computer and use it in GitHub Desktop.
if self.bboxes_format == "coco":
labels[:, -1] -= 1 # 0-indexing the classes of coco labels (1-80 --> 0-79)
labels = np.roll(labels, axis=1, shift=1)
# normalized coordinates are scale invariant, hence after resizing the img we don't resize labels
labels[:, 1:] = coco_to_yolo_tensors(labels[:, 1:], w0=img.shape[1], h0=img.shape[0])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment