[Fix] Fix bug cannot use both '--tta' and '--out' while testing. (#3067)
## Motivation Fix bug cannot use both '--tta' and '--out' while testing. For details, please refer to #3064 . ## Modification Add 'img_path' in TTA predictions. --------- Co-authored-by: xiexinch <xiexinch@outlook.com>pull/3089/head
parent
e8c8b94e8c
commit
13e42cc2ae
|
@ -44,5 +44,6 @@ class SegTTAModel(BaseTTAModel):
|
|||
'pred_sem_seg': PixelData(data=seg_pred),
|
||||
'gt_sem_seg': data_samples[0].gt_sem_seg
|
||||
})
|
||||
data_sample.set_metainfo({'img_path': data_samples[0].img_path})
|
||||
predictions.append(data_sample)
|
||||
return predictions
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
# Copyright (c) OpenMMLab. All rights reserved.
|
||||
import tempfile
|
||||
|
||||
import torch
|
||||
from mmengine import ConfigDict
|
||||
from mmengine.model import BaseTTAModel
|
||||
|
@ -37,7 +39,8 @@ def test_encoder_decoder_tta():
|
|||
ori_shape=(10, 10),
|
||||
img_shape=(10 + i, 10 + i),
|
||||
flip=(i % 2 == 0),
|
||||
flip_direction=flip_direction),
|
||||
flip_direction=flip_direction,
|
||||
img_path=tempfile.mktemp()),
|
||||
gt_sem_seg=PixelData(data=torch.randint(0, 19, (1, 10, 10))))
|
||||
])
|
||||
|
||||
|
|
Loading…
Reference in New Issue