Skip to content

Commit 3dfad1e

Browse files
authored
Update function.py
conduct flip operation with pytorch
1 parent 51638bf commit 3dfad1e

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

lib/core/function.py

+1-4
Original file line numberDiff line numberDiff line change
@@ -124,10 +124,7 @@ def validate(config, val_loader, val_dataset, model, criterion, output_dir,
124124
output = outputs
125125

126126
if config.TEST.FLIP_TEST:
127-
# this part is ugly, because pytorch has not supported negative index
128-
# input_flipped = model(input[:, :, :, ::-1])
129-
input_flipped = np.flip(input.cpu().numpy(), 3).copy()
130-
input_flipped = torch.from_numpy(input_flipped).cuda()
127+
input_flipped = input.flip(3)
131128
outputs_flipped = model(input_flipped)
132129

133130
if isinstance(outputs_flipped, list):

0 commit comments

Comments
 (0)