Skip to content

Commit 6a22c42

Browse files
lkm2835Younghoon-LeeMeowZheng
authored
[Fix] Improve MultiImageMixDataset unittests coverage (#1197)
* 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>
1 parent 5b310a0 commit 6a22c42

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

tests/test_data/test_dataset.py

+3-10
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,7 @@ def test_dataset_wrapper():
105105

106106
img_scale = (60, 60)
107107
pipeline = [
108-
# dict(type='Mosaic', img_scale=img_scale, pad_val=255),
109-
# need to merge mosaic
108+
dict(type='RandomMosaic', prob=1, img_scale=img_scale),
110109
dict(type='RandomFlip', prob=0.5),
111110
dict(type='Resize', img_scale=img_scale, keep_ratio=False),
112111
]
@@ -130,14 +129,8 @@ def test_dataset_wrapper():
130129
classes=classes,
131130
palette=palette)
132131
len_a = 2
133-
cat_ids_list_a = [
134-
np.random.randint(0, 80, num).tolist()
135-
for num in np.random.randint(1, 20, len_a)
136-
]
137-
dataset_a.data_infos = MagicMock()
138-
dataset_a.data_infos.__len__.return_value = len_a
139-
dataset_a.get_cat_ids = MagicMock(
140-
side_effect=lambda idx: cat_ids_list_a[idx])
132+
dataset_a.img_infos = MagicMock()
133+
dataset_a.img_infos.__len__.return_value = len_a
141134

142135
multi_image_mix_dataset = MultiImageMixDataset(dataset_a, pipeline)
143136
assert len(multi_image_mix_dataset) == len(dataset_a)

0 commit comments

Comments
 (0)