Skip to content

Commit 768f704

Browse files
authored
[Enhance] Replace data_dict calling 'img' key to support MMDet3D (open-mmlab#514)
* remove dict calling img key for compatibility * fix unit test * infer batch size using len(result) to be consistent with mmcv
1 parent bdf5adf commit 768f704

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

mmseg/apis/test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ def single_gpu_test(model,
9797
result = np2tmp(result)
9898
results.append(result)
9999

100-
batch_size = data['img'][0].size(0)
100+
batch_size = len(result)
101101
for _ in range(batch_size):
102102
prog_bar.update()
103103
return results

mmseg/models/segmentors/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ def train_step(self, data_batch, optimizer, **kwargs):
155155
outputs = dict(
156156
loss=loss,
157157
log_vars=log_vars,
158-
num_samples=len(data_batch['img'].data))
158+
num_samples=len(data_batch['img_metas']))
159159

160160
return outputs
161161

0 commit comments

Comments
 (0)