diff --git a/configs/_base_/datasets/dota.py b/configs/_base_/datasets/dota.py index e0a6c50d9..640f31b94 100644 --- a/configs/_base_/datasets/dota.py +++ b/configs/_base_/datasets/dota.py @@ -44,7 +44,6 @@ data_root=data_root, ann_file='trainval/annfiles/', data_prefix=dict(img_path='trainval/images/'), - img_shape=(1024, 1024), filter_cfg=dict(filter_empty_gt=True), pipeline=train_pipeline)) val_dataloader = dict( @@ -58,7 +57,6 @@ data_root=data_root, ann_file='trainval/annfiles/', data_prefix=dict(img_path='trainval/images/'), - img_shape=(1024, 1024), test_mode=True, pipeline=val_pipeline)) test_dataloader = val_dataloader @@ -78,7 +76,6 @@ # type=dataset_type, # data_root=data_root, # data_prefix=dict(img_path='test/images/'), -# img_shape=(1024, 1024), # test_mode=True, # pipeline=test_pipeline)) # test_evaluator = dict( diff --git a/configs/_base_/datasets/dota_ms.py b/configs/_base_/datasets/dota_ms.py index be85328d8..00a4a1df6 100644 --- a/configs/_base_/datasets/dota_ms.py +++ b/configs/_base_/datasets/dota_ms.py @@ -49,7 +49,6 @@ data_root=data_root, ann_file='trainval/annfiles/', data_prefix=dict(img_path='trainval/images/'), - img_shape=(1024, 1024), filter_cfg=dict(filter_empty_gt=True), pipeline=train_pipeline)) val_dataloader = dict( @@ -63,7 +62,6 @@ data_root=data_root, ann_file='trainval/annfiles/', data_prefix=dict(img_path='trainval/images/'), - img_shape=(1024, 1024), test_mode=True, pipeline=val_pipeline)) test_dataloader = val_dataloader @@ -83,7 +81,6 @@ # type=dataset_type, # data_root=data_root, # data_prefix=dict(img_path='test/images/'), -# img_shape=(1024, 1024), # test_mode=True, # pipeline=test_pipeline)) # test_evaluator = dict( diff --git a/configs/_base_/datasets/dota_qbox.py b/configs/_base_/datasets/dota_qbox.py index 3bc387bc9..df2c9a2d4 100644 --- a/configs/_base_/datasets/dota_qbox.py +++ b/configs/_base_/datasets/dota_qbox.py @@ -42,7 +42,6 @@ data_root=data_root, ann_file='trainval/annfiles/', data_prefix=dict(img_path='trainval/images/'), - img_shape=(1024, 1024), filter_cfg=dict(filter_empty_gt=True), pipeline=train_pipeline)) val_dataloader = dict( @@ -56,7 +55,6 @@ data_root=data_root, ann_file='trainval/annfiles/', data_prefix=dict(img_path='trainval/images/'), - img_shape=(1024, 1024), test_mode=True, pipeline=val_pipeline)) test_dataloader = val_dataloader @@ -77,7 +75,6 @@ # type=dataset_type, # data_root=data_root, # data_prefix=dict(img_path='test/images/'), -# img_shape=(1024, 1024), # test_mode=True, # pipeline=test_pipeline)) # test_evaluator = dict( diff --git a/configs/_base_/datasets/dotav15.py b/configs/_base_/datasets/dotav15.py index c41d10b51..32b8673b0 100644 --- a/configs/_base_/datasets/dotav15.py +++ b/configs/_base_/datasets/dotav15.py @@ -44,7 +44,6 @@ data_root=data_root, ann_file='trainval/annfiles/', data_prefix=dict(img_path='trainval/images/'), - img_shape=(1024, 1024), filter_cfg=dict(filter_empty_gt=True), pipeline=train_pipeline)) val_dataloader = dict( @@ -58,7 +57,6 @@ data_root=data_root, ann_file='trainval/annfiles/', data_prefix=dict(img_path='trainval/images/'), - img_shape=(1024, 1024), test_mode=True, pipeline=val_pipeline)) test_dataloader = val_dataloader @@ -78,7 +76,6 @@ # type=dataset_type, # data_root=data_root, # data_prefix=dict(img_path='test/images/'), -# img_shape=(1024, 1024), # test_mode=True, # pipeline=test_pipeline)) # test_evaluator = dict( diff --git a/configs/_base_/datasets/dotav2.py b/configs/_base_/datasets/dotav2.py index 8763e4522..9525bd3b0 100644 --- a/configs/_base_/datasets/dotav2.py +++ b/configs/_base_/datasets/dotav2.py @@ -44,7 +44,6 @@ data_root=data_root, ann_file='trainval/annfiles/', data_prefix=dict(img_path='trainval/images/'), - img_shape=(1024, 1024), filter_cfg=dict(filter_empty_gt=True), pipeline=train_pipeline)) val_dataloader = dict( @@ -58,7 +57,6 @@ data_root=data_root, ann_file='trainval/annfiles/', data_prefix=dict(img_path='trainval/images/'), - img_shape=(1024, 1024), test_mode=True, pipeline=val_pipeline)) test_dataloader = val_dataloader @@ -78,7 +76,6 @@ # type=dataset_type, # data_root=data_root, # data_prefix=dict(img_path='test/images/'), -# img_shape=(1024, 1024), # test_mode=True, # pipeline=test_pipeline)) # test_evaluator = dict( diff --git a/configs/rotated_rtmdet/_base_/dota_rr.py b/configs/rotated_rtmdet/_base_/dota_rr.py index dbc854e3b..6fd455224 100644 --- a/configs/rotated_rtmdet/_base_/dota_rr.py +++ b/configs/rotated_rtmdet/_base_/dota_rr.py @@ -60,7 +60,6 @@ data_root=data_root, ann_file='trainval/annfiles/', data_prefix=dict(img_path='trainval/images/'), - img_shape=(1024, 1024), filter_cfg=dict(filter_empty_gt=True), pipeline=train_pipeline)) val_dataloader = dict( @@ -74,7 +73,6 @@ data_root=data_root, ann_file='trainval/annfiles/', data_prefix=dict(img_path='trainval/images/'), - img_shape=(1024, 1024), test_mode=True, pipeline=val_pipeline)) test_dataloader = val_dataloader @@ -94,7 +92,6 @@ # type=dataset_type, # data_root=data_root, # data_prefix=dict(img_path='test/images/'), -# img_shape=(1024, 1024), # test_mode=True, # pipeline=test_pipeline)) # test_evaluator = dict( diff --git a/configs/rotated_rtmdet/_base_/dota_rr_ms.py b/configs/rotated_rtmdet/_base_/dota_rr_ms.py index c75bb2c8f..ba0b234b9 100644 --- a/configs/rotated_rtmdet/_base_/dota_rr_ms.py +++ b/configs/rotated_rtmdet/_base_/dota_rr_ms.py @@ -59,7 +59,6 @@ data_root=data_root, ann_file='trainval/annfiles/', data_prefix=dict(img_path='trainval/images/'), - img_shape=(1024, 1024), filter_cfg=dict(filter_empty_gt=True), pipeline=train_pipeline)) val_dataloader = dict( @@ -73,7 +72,6 @@ data_root=data_root, ann_file='trainval/annfiles/', data_prefix=dict(img_path='trainval/images/'), - img_shape=(1024, 1024), test_mode=True, pipeline=val_pipeline)) test_dataloader = val_dataloader @@ -93,7 +91,6 @@ # type=dataset_type, # data_root=data_root, # data_prefix=dict(img_path='test/images/'), -# img_shape=(1024, 1024), # test_mode=True, # pipeline=test_pipeline)) # test_evaluator = dict( diff --git a/mmrotate/datasets/dota.py b/mmrotate/datasets/dota.py index c32e1d8e7..cc38b2697 100644 --- a/mmrotate/datasets/dota.py +++ b/mmrotate/datasets/dota.py @@ -1,7 +1,7 @@ # Copyright (c) OpenMMLab. All rights reserved. import glob import os.path as osp -from typing import List, Tuple +from typing import List from mmengine.dataset import BaseDataset @@ -17,12 +17,10 @@ class DOTADataset(BaseDataset): it is the path of a folder containing XML files. Args: - img_shape (tuple[int]): The shape of images. Due to the huge size - of the remote sensing image, we will cut it into slices with - the same shape. Defaults to (1024, 1024). diff_thr (int): The difficulty threshold of ground truth. Bboxes with difficulty higher than it will be ignored. The range of this value should be non-negative integer. Defaults to 100. + img_suffix (str): The suffix of images. Defaults to 'png'. """ METAINFO = { @@ -40,11 +38,11 @@ class DOTADataset(BaseDataset): } def __init__(self, - img_shape: Tuple[int, int] = (1024, 1024), diff_thr: int = 100, + img_suffix: str = 'png', **kwargs) -> None: - self.img_shape = img_shape self.diff_thr = diff_thr + self.img_suffix = img_suffix super().__init__(**kwargs) def load_data_list(self) -> List[dict]: @@ -58,7 +56,7 @@ def load_data_list(self) -> List[dict]: data_list = [] if self.ann_file == '': img_files = glob.glob( - osp.join(self.data_prefix['img_path'], '*.png')) + osp.join(self.data_prefix['img_path'], f'*.{self.img_suffix}')) for img_path in img_files: data_info = {} data_info['img_path'] = img_path @@ -66,8 +64,6 @@ def load_data_list(self) -> List[dict]: data_info['file_name'] = img_name img_id = img_name[:-4] data_info['img_id'] = img_id - data_info['height'] = self.img_shape[0] - data_info['width'] = self.img_shape[1] instance = dict(bbox=[], bbox_label=[], ignore_flag=0) data_info['instances'] = [instance] @@ -83,12 +79,10 @@ def load_data_list(self) -> List[dict]: data_info = {} img_id = osp.split(txt_file)[1][:-4] data_info['img_id'] = img_id - img_name = img_id + '.png' + img_name = img_id + f'.{self.img_suffix}' data_info['file_name'] = img_name data_info['img_path'] = osp.join(self.data_prefix['img_path'], img_name) - data_info['height'] = self.img_shape[0] - data_info['width'] = self.img_shape[1] instances = [] with open(txt_file) as f: