Last active
December 28, 2022 10:40
-
-
Save AlessandroMondin/5d9220c664bb76d9bbf0320b99b09fab to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if self.transform: | |
batch_n = idx // self.bs | |
if batch_n % 2 == 0: | |
self.transform[1].p = 1 | |
else: | |
self.transform[1].p = 0 | |
# albumentations requires bboxes to be (x,y,w,h,class_idx) | |
augmentations = self.transform(image=img, | |
bboxes=np.roll(labels, axis=1, shift=4) | |
) | |
img = augmentations["image"] | |
# loss fx requires bboxes to be (class_idx,x,y,w,h) | |
labels = np.array(augmentations["bboxes"]) | |
if len(labels): | |
labels = np.roll(labels, axis=1, shift=1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment