Skip to content

Commit 8fed7f5

Browse files
committed
add data_preprocessor ut
1 parent d33af52 commit 8fed7f5

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

tests/test_models/test_data_preprocessor.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,19 @@ def test_forward(self):
4646
out = processor(data, training=True)
4747
self.assertEqual(out['inputs'].shape, (2, 3, 20, 20))
4848
self.assertEqual(len(out['data_samples']), 2)
49+
50+
# test predict with padding
51+
processor = SegDataPreProcessor(
52+
mean=[0, 0, 0],
53+
std=[1, 1, 1],
54+
size=(20, 20),
55+
test_cfg=dict(size_divisor=15))
56+
data = {
57+
'inputs': [
58+
torch.randint(0, 256, (3, 11, 10)),
59+
],
60+
'data_samples': [data_sample]
61+
}
62+
out = processor(data, training=False)
63+
self.assertEqual(out['inputs'].shape[2] % 15, 0)
64+
self.assertEqual(out['inputs'].shape[3] % 15, 0)

0 commit comments

Comments
 (0)