Test augment update

This commit is contained in:
Glenn Jocher 2020-03-26 16:20:06 -07:00
parent a4721e90f8
commit 470371ba59
1 changed files with 2 additions and 1 deletions

View File

@ -91,7 +91,7 @@ def test(cfg,
# Augment images # Augment images
if augment: # https://github.com/ultralytics/yolov3/issues/931 if augment: # https://github.com/ultralytics/yolov3/issues/931
imgs = torch.cat((imgs, imgs = torch.cat((imgs,
imgs.flip(3), # flip-lr torch_utils.scale_img(imgs.flip(3), 0.9), # flip-lr and scale
torch_utils.scale_img(imgs, 0.7), # scale torch_utils.scale_img(imgs, 0.7), # scale
), 0) ), 0)
@ -103,6 +103,7 @@ def test(cfg,
# De-augment results # De-augment results
if augment: if augment:
x = torch.split(inf_out, nb, dim=0) x = torch.split(inf_out, nb, dim=0)
x[1][..., :4] /= 0.9 # scale
x[1][..., 0] = width - x[1][..., 0] # flip lr x[1][..., 0] = width - x[1][..., 0] # flip lr
x[2][..., :4] /= 0.7 # scale x[2][..., :4] /= 0.7 # scale
inf_out = torch.cat(x, 1) inf_out = torch.cat(x, 1)