Skip to content

Commit

Permalink
fix format
Browse files Browse the repository at this point in the history
  • Loading branch information
zhaoxin111 committed Nov 18, 2021
1 parent 3953e27 commit e0ae8f5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
4 changes: 2 additions & 2 deletions mmdet/datasets/dataset_wrappers.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def __init__(self, datasets, separate_eval=True):

def get_cat_ids(self, idx):
"""Get category ids of concatenated dataset by index.
Args:
idx (int): Index of data.
Expand All @@ -75,7 +75,7 @@ def get_ann_info(self, idx):
Args:
idx (int): Index of data.
Returns:
dict: Annotation info of specified index.
"""
Expand Down
12 changes: 7 additions & 5 deletions tests/test_data/test_datasets/test_dataset_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ def test_dataset_wrapper():
],
axis=1)
gt_labels = np.random.randint(0, 80, 2)
ann_info_list_a.append(dict(gt_bboxes=gt_bbox, gt_labels=gt_labels, img=img))
ann_info_list_a.append(
dict(gt_bboxes=gt_bbox, gt_labels=gt_labels, img=img))
dataset_a.data_infos = MagicMock()
dataset_a.data_infos.__len__.return_value = len_a
dataset_a.get_cat_ids = MagicMock(
Expand All @@ -56,7 +57,8 @@ def test_dataset_wrapper():
],
axis=1)
gt_labels = np.random.randint(0, 80, 2)
ann_info_list_b.append(dict(gt_bboxes=gt_bbox, gt_labels=gt_labels, img=img))
ann_info_list_b.append(
dict(gt_bboxes=gt_bbox, gt_labels=gt_labels, img=img))
dataset_b.data_infos = MagicMock()
dataset_b.data_infos.__len__.return_value = len_b
dataset_b.get_cat_ids = MagicMock(
Expand Down Expand Up @@ -112,8 +114,8 @@ def test_dataset_wrapper():
for idx in np.random.randint(0, len(repeat_factor_dataset), 3):
assert repeat_factor_dataset[idx] == bisect.bisect_right(
repeat_factors_cumsum, idx)
assert repeat_factor_dataset.get_ann_info(idx) == ann_info_list_a[bisect.bisect_right(
repeat_factors_cumsum, idx)]
assert repeat_factor_dataset.get_ann_info(idx) == ann_info_list_a[
bisect.bisect_right(repeat_factors_cumsum, idx)]

img_scale = (60, 60)
dynamic_scale = (80, 80)
Expand Down Expand Up @@ -174,4 +176,4 @@ def test_dataset_wrapper():
skip_type_keys=('MixUp', 'RandomFlip', 'Resize', 'Pad'))
for idx in range(len_a):
results_ = multi_image_mix_dataset[idx]
assert results_['img'].shape == (img_scale[0], img_scale[1], 3)
assert results_['img'].shape == (img_scale[0], img_scale[1], 3)

0 comments on commit e0ae8f5

Please sign in to comment.