Skip to content

Instantly share code, notes, and snippets.

@AlessandroMondin
Created December 28, 2022 11:12
Show Gist options
  • Save AlessandroMondin/df82d965560ea1dd829b401a262cbea4 to your computer and use it in GitHub Desktop.
Save AlessandroMondin/df82d965560ea1dd829b401a262cbea4 to your computer and use it in GitHub Desktop.
if self.ultralytics_loss:
labels = torch.from_numpy(labels)
out_bboxes = torch.zeros((labels.shape[0], 6))
if len(labels):
out_bboxes[..., 1:] = labels
img = img.transpose((2, 0, 1))
img = np.ascontiguousarray(img)
return torch.from_numpy(img), out_bboxes if self.ultralytics_loss else labels
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment