mirror of
https://github.com/open-mmlab/mmsegmentation.git
synced 2025-06-03 22:03:48 +08:00
[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>
This commit is contained in:
parent
3d58196e62
commit
079c520e58
@ -90,19 +90,6 @@ def single_gpu_test(model,
|
|||||||
with torch.no_grad():
|
with torch.no_grad():
|
||||||
result = model(return_loss=False, **data)
|
result = model(return_loss=False, **data)
|
||||||
|
|
||||||
if efficient_test:
|
|
||||||
result = [np2tmp(_, tmpdir='.efficient_test') for _ in result]
|
|
||||||
|
|
||||||
if format_only:
|
|
||||||
result = dataset.format_results(
|
|
||||||
result, indices=batch_indices, **format_args)
|
|
||||||
if pre_eval:
|
|
||||||
# TODO: adapt samples_per_gpu > 1.
|
|
||||||
# only samples_per_gpu=1 valid now
|
|
||||||
result = dataset.pre_eval(result, indices=batch_indices)
|
|
||||||
|
|
||||||
results.extend(result)
|
|
||||||
|
|
||||||
if show or out_dir:
|
if show or out_dir:
|
||||||
img_tensor = data['img'][0]
|
img_tensor = data['img'][0]
|
||||||
img_metas = data['img_metas'][0].data[0]
|
img_metas = data['img_metas'][0].data[0]
|
||||||
@ -129,6 +116,20 @@ def single_gpu_test(model,
|
|||||||
out_file=out_file,
|
out_file=out_file,
|
||||||
opacity=opacity)
|
opacity=opacity)
|
||||||
|
|
||||||
|
if efficient_test:
|
||||||
|
result = [np2tmp(_, tmpdir='.efficient_test') for _ in result]
|
||||||
|
|
||||||
|
if format_only:
|
||||||
|
result = dataset.format_results(
|
||||||
|
result, indices=batch_indices, **format_args)
|
||||||
|
if pre_eval:
|
||||||
|
# TODO: adapt samples_per_gpu > 1.
|
||||||
|
# only samples_per_gpu=1 valid now
|
||||||
|
result = dataset.pre_eval(result, indices=batch_indices)
|
||||||
|
results.extend(result)
|
||||||
|
else:
|
||||||
|
results.extend(result)
|
||||||
|
|
||||||
batch_size = len(result)
|
batch_size = len(result)
|
||||||
for _ in range(batch_size):
|
for _ in range(batch_size):
|
||||||
prog_bar.update()
|
prog_bar.update()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user