|
1 | 1 | import pytest
|
2 | 2 |
|
3 |
| -from mmdet.datasets import replace_ImageToTensor |
| 3 | +from mmdet.datasets import get_loading_pipeline, replace_ImageToTensor |
4 | 4 |
|
5 | 5 |
|
6 | 6 | def test_replace_ImageToTensor():
|
@@ -59,3 +59,21 @@ def test_replace_ImageToTensor():
|
59 | 59 | ]
|
60 | 60 | with pytest.warns(UserWarning):
|
61 | 61 | assert expected_pipelines == replace_ImageToTensor(pipelines)
|
| 62 | + |
| 63 | + |
| 64 | +def test_get_loading_pipeline(): |
| 65 | + pipelines = [ |
| 66 | + dict(type='LoadImageFromFile'), |
| 67 | + dict(type='LoadAnnotations', with_bbox=True), |
| 68 | + dict(type='Resize', img_scale=(1333, 800), keep_ratio=True), |
| 69 | + dict(type='RandomFlip', flip_ratio=0.5), |
| 70 | + dict(type='Pad', size_divisor=32), |
| 71 | + dict(type='DefaultFormatBundle'), |
| 72 | + dict(type='Collect', keys=['img', 'gt_bboxes', 'gt_labels']) |
| 73 | + ] |
| 74 | + expected_pipelines = [ |
| 75 | + dict(type='LoadImageFromFile'), |
| 76 | + dict(type='LoadAnnotations', with_bbox=True) |
| 77 | + ] |
| 78 | + assert expected_pipelines == \ |
| 79 | + get_loading_pipeline(pipelines) |
0 commit comments