Skip to content

Commit

Permalink
[Fix] Improve MultiImageMixDataset unittests coverage (#1197)
Browse files Browse the repository at this point in the history
* Fix typo in usage example

* original MultiImageMixDataset code in mmdet

* Add MultiImageMixDataset unittests in test_dataset_wrapper

* fix lint error

* fix value name ann_file to ann_dir

* modify retrieve_data_cfg (#1)

* remove dynamic_scale & add palette

* modify retrieve_data_cfg method

* modify retrieve_data_cfg func

* fix error

* improve the unittests coverage

* fix unittests error

* Dataset (#2)

* add cfg-options

* Add unittest in test_build_dataset

* add blank line

* add blank line

* add a blank line

Co-authored-by: Miao Zheng <76149310+MeowZheng@users.noreply.github.com>

* [Fix] Add MultiImageMixDataset unittests

Co-authored-by: Younghoon-Lee <72462227+Younghoon-Lee@users.noreply.github.com>
Co-authored-by: MeowZheng <meowzheng@outlook.com>
Co-authored-by: Miao Zheng <76149310+MeowZheng@users.noreply.github.com>
  • Loading branch information
4 people committed Jan 22, 2022
1 parent 5b310a0 commit 6a22c42
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions tests/test_data/test_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,7 @@ def test_dataset_wrapper():

img_scale = (60, 60)
pipeline = [
# dict(type='Mosaic', img_scale=img_scale, pad_val=255),
# need to merge mosaic
dict(type='RandomMosaic', prob=1, img_scale=img_scale),
dict(type='RandomFlip', prob=0.5),
dict(type='Resize', img_scale=img_scale, keep_ratio=False),
]
Expand All @@ -130,14 +129,8 @@ def test_dataset_wrapper():
classes=classes,
palette=palette)
len_a = 2
cat_ids_list_a = [
np.random.randint(0, 80, num).tolist()
for num in np.random.randint(1, 20, len_a)
]
dataset_a.data_infos = MagicMock()
dataset_a.data_infos.__len__.return_value = len_a
dataset_a.get_cat_ids = MagicMock(
side_effect=lambda idx: cat_ids_list_a[idx])
dataset_a.img_infos = MagicMock()
dataset_a.img_infos.__len__.return_value = len_a

multi_image_mix_dataset = MultiImageMixDataset(dataset_a, pipeline)
assert len(multi_image_mix_dataset) == len(dataset_a)
Expand Down

0 comments on commit 6a22c42

Please sign in to comment.