[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>pull/1171/head
parent
5b310a0074
commit
6a22c428c2
|
@ -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),
|
||||
]
|
||||
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue