Skip to content

Commit

Permalink
add data_preprocessor ut
Browse files Browse the repository at this point in the history
  • Loading branch information
xiexinch committed Nov 17, 2022
1 parent d33af52 commit 8fed7f5
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/test_models/test_data_preprocessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,19 @@ def test_forward(self):
out = processor(data, training=True)
self.assertEqual(out['inputs'].shape, (2, 3, 20, 20))
self.assertEqual(len(out['data_samples']), 2)

# test predict with padding
processor = SegDataPreProcessor(
mean=[0, 0, 0],
std=[1, 1, 1],
size=(20, 20),
test_cfg=dict(size_divisor=15))
data = {
'inputs': [
torch.randint(0, 256, (3, 11, 10)),
],
'data_samples': [data_sample]
}
out = processor(data, training=False)
self.assertEqual(out['inputs'].shape[2] % 15, 0)
self.assertEqual(out['inputs'].shape[3] % 15, 0)

0 comments on commit 8fed7f5

Please sign in to comment.