VdLMV Jaap van de Loosdrecht glenn-jocher commited on
Commit
3ff783c
1 Parent(s): 3e560e2

TTA augument boxes one pixel shifted in de-flip ud and lr (#2219)

Browse files

* TTA augument boxes one pixel shifted in de-flip ud and lr

* PEP8 reformat

Co-authored-by: Jaap van de Loosdrecht <[email protected]>
Co-authored-by: Glenn Jocher <[email protected]>

Files changed (1) hide show
  1. models/yolo.py +2 -2
models/yolo.py CHANGED
@@ -110,9 +110,9 @@ class Model(nn.Module):
110
  # cv2.imwrite(f'img_{si}.jpg', 255 * xi[0].cpu().numpy().transpose((1, 2, 0))[:, :, ::-1]) # save
111
  yi[..., :4] /= si # de-scale
112
  if fi == 2:
113
- yi[..., 1] = img_size[0] - yi[..., 1] # de-flip ud
114
  elif fi == 3:
115
- yi[..., 0] = img_size[1] - yi[..., 0] # de-flip lr
116
  y.append(yi)
117
  return torch.cat(y, 1), None # augmented inference, train
118
  else:
 
110
  # cv2.imwrite(f'img_{si}.jpg', 255 * xi[0].cpu().numpy().transpose((1, 2, 0))[:, :, ::-1]) # save
111
  yi[..., :4] /= si # de-scale
112
  if fi == 2:
113
+ yi[..., 1] = img_size[0] - 1 - yi[..., 1] # de-flip ud
114
  elif fi == 3:
115
+ yi[..., 0] = img_size[1] - 1 - yi[..., 0] # de-flip lr
116
  y.append(yi)
117
  return torch.cat(y, 1), None # augmented inference, train
118
  else: