@@ -72,8 +72,8 @@ class Model(nn.Module): | |||
s = [0.83, 0.67] # scales | |||
y = [] | |||
for i, xi in enumerate((x, | |||
torch_utils.scale_img(x.flip(3), s[0], same_shape=False), # flip-lr and scale | |||
torch_utils.scale_img(x, s[1], same_shape=False), # scale | |||
torch_utils.scale_img(x.flip(3), s[0]), # flip-lr and scale | |||
torch_utils.scale_img(x, s[1]), # scale | |||
)): | |||
# cv2.imwrite('img%g.jpg' % i, 255 * xi[0].numpy().transpose((1, 2, 0))[:, :, ::-1]) | |||
y.append(self.forward_once(xi)[0]) |
@@ -135,7 +135,7 @@ def load_classifier(name='resnet101', n=2): | |||
return model | |||
def scale_img(img, ratio=1.0, same_shape=True): # img(16,3,256,416), r=ratio | |||
def scale_img(img, ratio=1.0, same_shape=False): # img(16,3,256,416), r=ratio | |||
# scales img(bs,3,y,x) by ratio | |||
h, w = img.shape[2:] | |||
s = (int(h * ratio), int(w * ratio)) # new size |