Skip to content

Commit

Permalink
[Feature] File I/O migration and reconstruction (#783)
Browse files Browse the repository at this point in the history
* update

* Update dota_coco.py

* update

* fix
  • Loading branch information
zytx121 authored Mar 28, 2023
1 parent 0d5a004 commit d92844a
Show file tree
Hide file tree
Showing 43 changed files with 175 additions and 187 deletions.
14 changes: 8 additions & 6 deletions configs/_base_/datasets/dior.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# dataset settings
dataset_type = 'DIORDataset'
data_root = 'data/DIOR/'
file_client_args = dict(backend='disk')
backend_args = None

train_pipeline = [
dict(type='mmdet.LoadImageFromFile', file_client_args=file_client_args),
dict(type='mmdet.LoadImageFromFile', backend_args=backend_args),
dict(type='mmdet.LoadAnnotations', with_bbox=True, box_type='qbox'),
dict(type='ConvertBoxType', box_type_mapping=dict(gt_bboxes='rbox')),
dict(type='mmdet.Resize', scale=(800, 800), keep_ratio=True),
Expand All @@ -15,7 +15,7 @@
dict(type='mmdet.PackDetInputs')
]
val_pipeline = [
dict(type='mmdet.LoadImageFromFile', file_client_args=file_client_args),
dict(type='mmdet.LoadImageFromFile', backend_args=backend_args),
dict(type='mmdet.Resize', scale=(800, 800), keep_ratio=True),
# avoid bboxes being resized
dict(type='mmdet.LoadAnnotations', with_bbox=True, box_type='qbox'),
Expand All @@ -26,7 +26,7 @@
'scale_factor'))
]
test_pipeline = [
dict(type='mmdet.LoadImageFromFile', file_client_args=file_client_args),
dict(type='mmdet.LoadImageFromFile', backend_args=backend_args),
dict(type='mmdet.Resize', scale=(800, 800), keep_ratio=True),
dict(
type='mmdet.PackDetInputs',
Expand Down Expand Up @@ -56,7 +56,8 @@
ann_file='ImageSets/Main/val.txt',
data_prefix=dict(img_path='JPEGImages-trainval'),
filter_cfg=dict(filter_empty_gt=True),
pipeline=train_pipeline)
pipeline=train_pipeline,
backend_args=backend_args)
]))
val_dataloader = dict(
batch_size=1,
Expand All @@ -70,7 +71,8 @@
ann_file='ImageSets/Main/test.txt',
data_prefix=dict(img_path='JPEGImages-test'),
test_mode=True,
pipeline=val_pipeline))
pipeline=val_pipeline,
backend_args=backend_args))
test_dataloader = val_dataloader

val_evaluator = dict(type='DOTAMetric', metric='mAP')
Expand Down
8 changes: 4 additions & 4 deletions configs/_base_/datasets/dota.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# dataset settings
dataset_type = 'DOTADataset'
data_root = 'data/split_ss_dota/'
file_client_args = dict(backend='disk')
backend_args = None

train_pipeline = [
dict(type='mmdet.LoadImageFromFile', file_client_args=file_client_args),
dict(type='mmdet.LoadImageFromFile', backend_args=backend_args),
dict(type='mmdet.LoadAnnotations', with_bbox=True, box_type='qbox'),
dict(type='ConvertBoxType', box_type_mapping=dict(gt_bboxes='rbox')),
dict(type='mmdet.Resize', scale=(1024, 1024), keep_ratio=True),
Expand All @@ -15,7 +15,7 @@
dict(type='mmdet.PackDetInputs')
]
val_pipeline = [
dict(type='mmdet.LoadImageFromFile', file_client_args=file_client_args),
dict(type='mmdet.LoadImageFromFile', backend_args=backend_args),
dict(type='mmdet.Resize', scale=(1024, 1024), keep_ratio=True),
# avoid bboxes being resized
dict(type='mmdet.LoadAnnotations', with_bbox=True, box_type='qbox'),
Expand All @@ -26,7 +26,7 @@
'scale_factor'))
]
test_pipeline = [
dict(type='mmdet.LoadImageFromFile', file_client_args=file_client_args),
dict(type='mmdet.LoadImageFromFile', backend_args=backend_args),
dict(type='mmdet.Resize', scale=(1024, 1024), keep_ratio=True),
dict(
type='mmdet.PackDetInputs',
Expand Down
20 changes: 13 additions & 7 deletions configs/_base_/datasets/dota_coco.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# dataset settings
dataset_type = 'mmdet.CocoDataset'
data_root = 'data/split_ms_dota/'
file_client_args = dict(backend='disk')
backend_args = None

train_pipeline = [
dict(type='mmdet.LoadImageFromFile', file_client_args=file_client_args),
dict(type='mmdet.LoadImageFromFile', backend_args=backend_args),
dict(
type='mmdet.LoadAnnotations',
with_bbox=True,
Expand All @@ -19,7 +19,7 @@
dict(type='mmdet.PackDetInputs')
]
val_pipeline = [
dict(type='mmdet.LoadImageFromFile', file_client_args=file_client_args),
dict(type='mmdet.LoadImageFromFile', backend_args=backend_args),
dict(type='mmdet.Resize', scale=(1024, 1024), keep_ratio=True),
# avoid bboxes being resized
dict(
Expand All @@ -34,7 +34,7 @@
'scale_factor', 'instances'))
]
test_pipeline = [
dict(type='mmdet.LoadImageFromFile', file_client_args=file_client_args),
dict(type='mmdet.LoadImageFromFile', backend_args=backend_args),
dict(type='mmdet.Resize', scale=(1024, 1024), keep_ratio=True),
dict(
type='mmdet.PackDetInputs',
Expand All @@ -61,7 +61,8 @@
ann_file='train/train.json',
data_prefix=dict(img='train/images/'),
filter_cfg=dict(filter_empty_gt=True),
pipeline=train_pipeline))
pipeline=train_pipeline,
backend_args=backend_args))
val_dataloader = dict(
batch_size=1,
num_workers=2,
Expand All @@ -75,10 +76,15 @@
ann_file='val/val.json',
data_prefix=dict(img='val/images/'),
test_mode=True,
pipeline=val_pipeline))
pipeline=val_pipeline,
backend_args=backend_args))
test_dataloader = val_dataloader

val_evaluator = dict(type='RotatedCocoMetric', metric='bbox', classwise=True)
val_evaluator = dict(
type='RotatedCocoMetric',
metric='bbox',
classwise=True,
backend_args=backend_args)

test_evaluator = val_evaluator

Expand Down
8 changes: 4 additions & 4 deletions configs/_base_/datasets/dota_ms.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# dataset settings
dataset_type = 'DOTADataset'
data_root = 'data/split_ms_dota/'
file_client_args = dict(backend='disk')
backend_args = None

train_pipeline = [
dict(type='mmdet.LoadImageFromFile', file_client_args=file_client_args),
dict(type='mmdet.LoadImageFromFile', backend_args=backend_args),
dict(type='mmdet.LoadAnnotations', with_bbox=True, box_type='qbox'),
dict(type='ConvertBoxType', box_type_mapping=dict(gt_bboxes='rbox')),
dict(type='mmdet.Resize', scale=(1024, 1024), keep_ratio=True),
Expand All @@ -20,7 +20,7 @@
dict(type='mmdet.PackDetInputs')
]
val_pipeline = [
dict(type='mmdet.LoadImageFromFile', file_client_args=file_client_args),
dict(type='mmdet.LoadImageFromFile', backend_args=backend_args),
dict(type='mmdet.Resize', scale=(1024, 1024), keep_ratio=True),
# avoid bboxes being resized
dict(type='mmdet.LoadAnnotations', with_bbox=True, box_type='qbox'),
Expand All @@ -31,7 +31,7 @@
'scale_factor'))
]
test_pipeline = [
dict(type='mmdet.LoadImageFromFile', file_client_args=file_client_args),
dict(type='mmdet.LoadImageFromFile', backend_args=backend_args),
dict(type='mmdet.Resize', scale=(1024, 1024), keep_ratio=True),
dict(
type='mmdet.PackDetInputs',
Expand Down
8 changes: 4 additions & 4 deletions configs/_base_/datasets/dota_qbox.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# dataset settings
dataset_type = 'DOTADataset'
data_root = 'data/split_ss_dota/'
file_client_args = dict(backend='disk')
backend_args = None

train_pipeline = [
dict(type='mmdet.LoadImageFromFile', file_client_args=file_client_args),
dict(type='mmdet.LoadImageFromFile', backend_args=backend_args),
dict(type='mmdet.LoadAnnotations', with_bbox=True, box_type='qbox'),
dict(type='mmdet.Resize', scale=(1024, 1024), keep_ratio=True),
dict(
Expand All @@ -14,7 +14,7 @@
dict(type='mmdet.PackDetInputs')
]
val_pipeline = [
dict(type='mmdet.LoadImageFromFile', file_client_args=file_client_args),
dict(type='mmdet.LoadImageFromFile', backend_args=backend_args),
dict(type='mmdet.Resize', scale=(1024, 1024), keep_ratio=True),
# avoid bboxes being resized
dict(type='mmdet.LoadAnnotations', with_bbox=True, box_type='qbox'),
Expand All @@ -24,7 +24,7 @@
'scale_factor'))
]
test_pipeline = [
dict(type='mmdet.LoadImageFromFile', file_client_args=file_client_args),
dict(type='mmdet.LoadImageFromFile', backend_args=backend_args),
dict(type='mmdet.Resize', scale=(1024, 1024), keep_ratio=True),
dict(
type='mmdet.PackDetInputs',
Expand Down
8 changes: 4 additions & 4 deletions configs/_base_/datasets/dotav15.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# dataset settings
dataset_type = 'DOTAv15Dataset'
data_root = 'data/split_ss_dota1_5/'
file_client_args = dict(backend='disk')
backend_args = None

train_pipeline = [
dict(type='mmdet.LoadImageFromFile', file_client_args=file_client_args),
dict(type='mmdet.LoadImageFromFile', backend_args=backend_args),
dict(type='mmdet.LoadAnnotations', with_bbox=True, box_type='qbox'),
dict(type='ConvertBoxType', box_type_mapping=dict(gt_bboxes='rbox')),
dict(type='mmdet.Resize', scale=(1024, 1024), keep_ratio=True),
Expand All @@ -15,7 +15,7 @@
dict(type='mmdet.PackDetInputs')
]
val_pipeline = [
dict(type='mmdet.LoadImageFromFile', file_client_args=file_client_args),
dict(type='mmdet.LoadImageFromFile', backend_args=backend_args),
dict(type='mmdet.Resize', scale=(1024, 1024), keep_ratio=True),
# avoid bboxes being resized
dict(type='mmdet.LoadAnnotations', with_bbox=True, box_type='qbox'),
Expand All @@ -26,7 +26,7 @@
'scale_factor'))
]
test_pipeline = [
dict(type='mmdet.LoadImageFromFile', file_client_args=file_client_args),
dict(type='mmdet.LoadImageFromFile', backend_args=backend_args),
dict(type='mmdet.Resize', scale=(1024, 1024), keep_ratio=True),
dict(
type='mmdet.PackDetInputs',
Expand Down
8 changes: 4 additions & 4 deletions configs/_base_/datasets/dotav2.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# dataset settings
dataset_type = 'DOTAv2Dataset'
data_root = 'data/split_ss_dota2_0/'
file_client_args = dict(backend='disk')
backend_args = None

train_pipeline = [
dict(type='mmdet.LoadImageFromFile', file_client_args=file_client_args),
dict(type='mmdet.LoadImageFromFile', backend_args=backend_args),
dict(type='mmdet.LoadAnnotations', with_bbox=True, box_type='qbox'),
dict(type='ConvertBoxType', box_type_mapping=dict(gt_bboxes='rbox')),
dict(type='mmdet.Resize', scale=(1024, 1024), keep_ratio=True),
Expand All @@ -15,7 +15,7 @@
dict(type='mmdet.PackDetInputs')
]
val_pipeline = [
dict(type='mmdet.LoadImageFromFile', file_client_args=file_client_args),
dict(type='mmdet.LoadImageFromFile', backend_args=backend_args),
dict(type='mmdet.Resize', scale=(1024, 1024), keep_ratio=True),
# avoid bboxes being resized
dict(type='mmdet.LoadAnnotations', with_bbox=True, box_type='qbox'),
Expand All @@ -26,7 +26,7 @@
'scale_factor'))
]
test_pipeline = [
dict(type='mmdet.LoadImageFromFile', file_client_args=file_client_args),
dict(type='mmdet.LoadImageFromFile', backend_args=backend_args),
dict(type='mmdet.Resize', scale=(1024, 1024), keep_ratio=True),
dict(
type='mmdet.PackDetInputs',
Expand Down
14 changes: 8 additions & 6 deletions configs/_base_/datasets/hrsc.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# dataset settings
dataset_type = 'HRSCDataset'
data_root = 'data/hrsc/'
file_client_args = dict(backend='disk')
backend_args = None

train_pipeline = [
dict(type='mmdet.LoadImageFromFile', file_client_args=file_client_args),
dict(type='mmdet.LoadImageFromFile', backend_args=backend_args),
dict(type='mmdet.LoadAnnotations', with_bbox=True, box_type='qbox'),
dict(type='ConvertBoxType', box_type_mapping=dict(gt_bboxes='rbox')),
dict(type='mmdet.Resize', scale=(800, 512), keep_ratio=True),
Expand All @@ -15,7 +15,7 @@
dict(type='mmdet.PackDetInputs')
]
val_pipeline = [
dict(type='mmdet.LoadImageFromFile', file_client_args=file_client_args),
dict(type='mmdet.LoadImageFromFile', backend_args=backend_args),
dict(type='mmdet.Resize', scale=(800, 512), keep_ratio=True),
# avoid bboxes being resized
dict(type='mmdet.LoadAnnotations', with_bbox=True, box_type='qbox'),
Expand All @@ -26,7 +26,7 @@
'scale_factor'))
]
test_pipeline = [
dict(type='mmdet.LoadImageFromFile', file_client_args=file_client_args),
dict(type='mmdet.LoadImageFromFile', backend_args=backend_args),
dict(type='mmdet.Resize', scale=(800, 512), keep_ratio=True),
dict(
type='mmdet.PackDetInputs',
Expand All @@ -45,7 +45,8 @@
ann_file='ImageSets/trainval.txt',
data_prefix=dict(sub_data_root='FullDataSet/'),
filter_cfg=dict(filter_empty_gt=True),
pipeline=train_pipeline))
pipeline=train_pipeline,
backend_args=backend_args))
val_dataloader = dict(
batch_size=1,
num_workers=2,
Expand All @@ -58,7 +59,8 @@
ann_file='ImageSets/test.txt',
data_prefix=dict(sub_data_root='FullDataSet/'),
test_mode=True,
pipeline=val_pipeline))
pipeline=val_pipeline,
backend_args=backend_args))
test_dataloader = val_dataloader

val_evaluator = dict(type='DOTAMetric', metric='mAP')
Expand Down
14 changes: 8 additions & 6 deletions configs/_base_/datasets/hrsid.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# dataset settings
dataset_type = 'mmdet.CocoDataset'
data_root = 'data/HRSID_JPG/'
file_client_args = dict(backend='disk')
backend_args = None

train_pipeline = [
dict(type='mmdet.LoadImageFromFile', file_client_args=file_client_args),
dict(type='mmdet.LoadImageFromFile', backend_args=backend_args),
dict(
type='mmdet.LoadAnnotations',
with_bbox=True,
Expand All @@ -20,7 +20,7 @@
dict(type='mmdet.PackDetInputs')
]
val_pipeline = [
dict(type='mmdet.LoadImageFromFile', file_client_args=file_client_args),
dict(type='mmdet.LoadImageFromFile', backend_args=backend_args),
dict(type='mmdet.Resize', scale=(800, 800), keep_ratio=True),
# avoid bboxes being resized
dict(
Expand All @@ -35,7 +35,7 @@
'scale_factor', 'instances'))
]
test_pipeline = [
dict(type='mmdet.LoadImageFromFile', file_client_args=file_client_args),
dict(type='mmdet.LoadImageFromFile', backend_args=backend_args),
dict(type='mmdet.Resize', scale=(800, 800), keep_ratio=True),
dict(
type='mmdet.PackDetInputs',
Expand All @@ -58,7 +58,8 @@
ann_file='annotations/train2017.json',
data_prefix=dict(img='JPEGImages/'),
filter_cfg=dict(filter_empty_gt=True),
pipeline=train_pipeline))
pipeline=train_pipeline,
backend_args=backend_args))
val_dataloader = dict(
batch_size=1,
num_workers=2,
Expand All @@ -72,7 +73,8 @@
ann_file='annotations/test2017.json',
data_prefix=dict(img='JPEGImages/'),
test_mode=True,
pipeline=val_pipeline))
pipeline=val_pipeline,
backend_args=backend_args))
test_dataloader = val_dataloader

val_evaluator = dict(type='RotatedCocoMetric', metric='bbox')
Expand Down
Loading

0 comments on commit d92844a

Please sign in to comment.