Skip to content

Commit d3e11cc

Browse files
zergzzlunxvjiarui
andauthoredDec 6, 2021
[Fix] Fix test error when using --show-dir (#1091)
* Fix test error when using --show-dir * Move show before test Co-authored-by: Jiarui XU <xvjiarui0826@gmail.com>

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed
 

‎mmseg/apis/test.py

+14-13
Original file line numberDiff line numberDiff line change
@@ -90,19 +90,6 @@ def single_gpu_test(model,
9090
with torch.no_grad():
9191
result = model(return_loss=False, **data)
9292

93-
if efficient_test:
94-
result = [np2tmp(_, tmpdir='.efficient_test') for _ in result]
95-
96-
if format_only:
97-
result = dataset.format_results(
98-
result, indices=batch_indices, **format_args)
99-
if pre_eval:
100-
# TODO: adapt samples_per_gpu > 1.
101-
# only samples_per_gpu=1 valid now
102-
result = dataset.pre_eval(result, indices=batch_indices)
103-
104-
results.extend(result)
105-
10693
if show or out_dir:
10794
img_tensor = data['img'][0]
10895
img_metas = data['img_metas'][0].data[0]
@@ -129,6 +116,20 @@ def single_gpu_test(model,
129116
out_file=out_file,
130117
opacity=opacity)
131118

119+
if efficient_test:
120+
result = [np2tmp(_, tmpdir='.efficient_test') for _ in result]
121+
122+
if format_only:
123+
result = dataset.format_results(
124+
result, indices=batch_indices, **format_args)
125+
if pre_eval:
126+
# TODO: adapt samples_per_gpu > 1.
127+
# only samples_per_gpu=1 valid now
128+
result = dataset.pre_eval(result, indices=batch_indices)
129+
results.extend(result)
130+
else:
131+
results.extend(result)
132+
132133
batch_size = len(result)
133134
for _ in range(batch_size):
134135
prog_bar.update()

0 commit comments

Comments
 (0)
Please sign in to comment.