diff --git a/utils/augmentations.py b/utils/augmentations.py index 3f764c06ae3b..97506ae25123 100644 --- a/utils/augmentations.py +++ b/utils/augmentations.py @@ -39,8 +39,9 @@ def __init__(self): def __call__(self, im, labels, p=1.0): if self.transform and random.random() < p: - new = self.transform(image=im, bboxes=labels[:, 1:], class_labels=labels[:, 0]) # transformed - im, labels = new['image'], np.array([[c, *b] for c, b in zip(new['class_labels'], new['bboxes'])]) + new = self.transform(image=im[..., ::-1], bboxes=labels[:, 1:], class_labels=labels[:, 0]) # transformed + im = new['image'][..., ::-1] # RGB to BGR + labels = np.array([[c, *b] for c, b in zip(new['class_labels'], new['bboxes'])]) return im, labels