Skip to content

Commit

Permalink
Fix BGR->RGB Bug in albumentations ultralytics#8641
Browse files Browse the repository at this point in the history
  • Loading branch information
UnglvKitDe committed Jul 23, 2022
1 parent b510957 commit 429238f
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions utils/augmentations.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,10 @@ def __init__(self):

def __call__(self, im, labels, p=1.0):
if self.transform and random.random() < p:
im = cv2.cvtColor(im, cv2.COLOR_BGR2RGB)
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'])])
im = cv2.cvtColor(im, cv2.COLOR_RGB2BGR)
return im, labels


Expand Down

0 comments on commit 429238f

Please sign in to comment.