diff --git a/tests/test_detection_data/test_datasets/test_few_shot_coco_dataset.py b/tests/test_detection_data/test_datasets/test_few_shot_coco_dataset.py index 0711cc8..ecc8da8 100644 --- a/tests/test_detection_data/test_datasets/test_few_shot_coco_dataset.py +++ b/tests/test_detection_data/test_datasets/test_few_shot_coco_dataset.py @@ -1,5 +1,6 @@ # Copyright (c) OpenMMLab. All rights reserved. import copy +import os import tempfile import numpy as np @@ -144,10 +145,10 @@ def test_few_shot_coco_dataset(): # test save and load dataset with tempfile.TemporaryDirectory() as tmpdir: - dataset.save_data_infos(tmpdir + 'ann.json') + dataset.save_data_infos(tmpdir + f'{os.sep}ann.json') data_config['ann_cfg'] = [{ 'type': 'saved_dataset', - 'ann_file': tmpdir + 'ann.json' + 'ann_file': tmpdir + f'{os.sep}ann.json' }] dataset = FewShotCocoDataset(**data_config) count = 0 diff --git a/tests/test_detection_data/test_datasets/test_few_shot_voc_dataset.py b/tests/test_detection_data/test_datasets/test_few_shot_voc_dataset.py index ccf955a..6ca11d8 100644 --- a/tests/test_detection_data/test_datasets/test_few_shot_voc_dataset.py +++ b/tests/test_detection_data/test_datasets/test_few_shot_voc_dataset.py @@ -1,5 +1,6 @@ # Copyright (c) OpenMMLab. All rights reserved. import copy +import os import tempfile import numpy as np @@ -108,10 +109,10 @@ def test_few_shot_voc_dataset(): dataset.data_infos[1]['ann']['bboxes_ignore'] = np.array( [[11, 11, 100, 100]]) dataset.data_infos[1]['ann']['labels_ignore'] = np.array([0]) - dataset.save_data_infos(tmpdir + 'ann.json') + dataset.save_data_infos(tmpdir + f'{os.sep}ann.json') data_config['ann_cfg'] = [{ 'type': 'saved_dataset', - 'ann_file': tmpdir + 'ann.json' + 'ann_file': tmpdir + f'{os.sep}ann.json' }] dataset = FewShotVOCDataset(**data_config) count = 0 diff --git a/tests/test_detection_data/test_datasets/test_nway_kshot_dataset.py b/tests/test_detection_data/test_datasets/test_nway_kshot_dataset.py index ae663cd..eaf6762 100644 --- a/tests/test_detection_data/test_datasets/test_nway_kshot_dataset.py +++ b/tests/test_detection_data/test_datasets/test_nway_kshot_dataset.py @@ -1,4 +1,5 @@ # Copyright (c) OpenMMLab. All rights reserved. +import os import tempfile import numpy as np @@ -85,4 +86,4 @@ def test_nway_kshot_dataset(): assert count <= 1 # test save dataset with tempfile.TemporaryDirectory() as tmpdir: - nway_kshot_dataset.save_data_infos(tmpdir + 'ann.json') + nway_kshot_dataset.save_data_infos(tmpdir + f'{os.sep}ann.json') diff --git a/tests/test_detection_data/test_datasets/test_query_aware_dataset.py b/tests/test_detection_data/test_datasets/test_query_aware_dataset.py index 798f795..816bd33 100644 --- a/tests/test_detection_data/test_datasets/test_query_aware_dataset.py +++ b/tests/test_detection_data/test_datasets/test_query_aware_dataset.py @@ -1,4 +1,5 @@ # Copyright (c) OpenMMLab. All rights reserved. +import os import tempfile import numpy as np @@ -115,4 +116,4 @@ def test_query_aware_dataset(): # test save dataset with tempfile.TemporaryDirectory() as tmpdir: - query_aware_dataset.save_data_infos(tmpdir + 'ann.json') + query_aware_dataset.save_data_infos(tmpdir + f'{os.sep}ann.json') diff --git a/tests/test_detection_data/test_datasets/test_two_branch_dataset.py b/tests/test_detection_data/test_datasets/test_two_branch_dataset.py index 5bf24e4..8632ced 100644 --- a/tests/test_detection_data/test_datasets/test_two_branch_dataset.py +++ b/tests/test_detection_data/test_datasets/test_two_branch_dataset.py @@ -1,4 +1,5 @@ # Copyright (c) OpenMMLab. All rights reserved. +import os import tempfile from mmdet.apis import set_random_seed @@ -45,4 +46,4 @@ def test_two_branch_dataset(): assert len(two_branch_dataset) == 25 # test save dataset with tempfile.TemporaryDirectory() as tmpdir: - two_branch_dataset.save_data_infos(tmpdir + 'ann.json') + two_branch_dataset.save_data_infos(tmpdir + f'{os.sep}ann.json')