Fix input shape and norm, and target norm in testing

This commit is contained in:
Yin Li 2019-12-10 14:53:05 -05:00
parent 7b6ff73be1
commit 0c4a551354

View File

@ -46,8 +46,10 @@ def test(args):
output = model(input) output = model(input)
if args.pad_or_crop > 0: # FIXME if args.pad_or_crop > 0: # FIXME
output = narrow_like(output, target) output = narrow_like(output, target)
input = narrow_like(input, target)
else: else:
target = narrow_like(target, output) target = narrow_like(target, output)
input = narrow_like(input, output)
loss = criterion(output, target) loss = criterion(output, target)
@ -55,7 +57,9 @@ def test(args):
if args.norms is not None: if args.norms is not None:
norm = test_dataset.norms[0] # FIXME norm = test_dataset.norms[0] # FIXME
norm(input, undo=True)
norm(output, undo=True) norm(output, undo=True)
norm(target, undo=True)
np.savez('{}.npz'.format(i), input=input.numpy(), np.savez('{}.npz'.format(i), input=input.numpy(),
output=output.numpy(), target=target.numpy()) output=output.numpy(), target=target.numpy())