Adam Kunák commited on
Commit
a9e32de
·
unverified ·
1 Parent(s): dea5a8a

🐛 [Fix] MixUp augmentation (#105) (#110)

Browse files

Fixed an issue with the box targets (class_id, x_min, y_min, x_max, y_max) being multiplied by a random float value. fixes #105

Files changed (1) hide show
  1. yolo/tools/data_augmentation.py +3 -3
yolo/tools/data_augmentation.py CHANGED
@@ -174,10 +174,10 @@ class MixUp:
174
  image1, image2 = TF.to_tensor(image), TF.to_tensor(image2)
175
  mixed_image = lam * image1 + (1 - lam) * image2
176
 
177
- # Mix bounding boxes
178
- mixed_boxes = torch.cat([lam * boxes, (1 - lam) * boxes2])
179
 
180
- return TF.to_pil_image(mixed_image), mixed_boxes
181
 
182
 
183
  class RandomCrop:
 
174
  image1, image2 = TF.to_tensor(image), TF.to_tensor(image2)
175
  mixed_image = lam * image1 + (1 - lam) * image2
176
 
177
+ # Merge bounding boxes
178
+ merged_boxes = torch.cat((boxes, boxes2))
179
 
180
+ return TF.to_pil_image(mixed_image), merged_boxes
181
 
182
 
183
  class RandomCrop: