1、数据目录结构
mmrotate
├── mmrotate
├── tools
├── configs
├── data
│ ├── hrsc
│ │ ├── FullDataSet
│ │ │ ├─ AllImages
│ │ │ ├─ Annotations
│ │ │ ├─ LandMask
│ │ │ ├─ Segmentations
│ │ ├── ImageSets
2、生成模型配置文件到指定文件夹
python tools/train.py configs/redet/redet_re50_refpn_3x_hrsc_le90.py --work-dir work_dirs/runs/redet_hrsc/
dataset_type = 'HRSCDataset'
data_root = 'data/hrsc/'
img_norm_cfg = dict(
mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True)
train_pipeline = [
dict(type='LoadImageFromFile'),
dict(type='LoadAnnotations', with_bbox=True),
dict(type='RResize', img_scale=(800, 512)),
dict(type='RRandomFlip', flip_ratio=0.5),
dict(
type='Normalize',
mean=[123.675, 116.28, 103.53],
std=[58.395, 57.12, 57.375],
to_rgb=True),
dict(type='Pad', size_divisor=32),
dict(type='DefaultFormatBundle'),
dict(type='Collect', keys=['img', 'gt_bboxes', 'gt_labels'])
]
test_pipeline = [
dict(type='LoadImageFromFile'),
dict(
type='MultiScaleFlipAug',
img_scale=(800, 512),
flip=False,
transforms=[
dict(type='RResize'),
dict(
type='Normalize',
mean=[123.675, 116.28, 103.53],
std=[58.395, 57.12, 57.375],
to_rgb=True),
dict(type='Pad', size_divisor=32),
dict(type='DefaultFormatBundle'),
dict(type='Collect', keys=['img'])
])
]
data = dict(
samples_per_gpu=2,
workers_per_gpu=2,
train=dict(
type='HRSCDataset',
classwise=True,
ann_file='data/hrsc/ImageSets/trainval.txt',
ann_subdir='data/hrsc/FullDataSet/Annotations/',
img_subdir='data/hrsc/FullDataSet/AllImages/',
img_prefix='data/hrsc/FullDataSet/AllImages/',
pipeline=[
dict(type='LoadImageFromFile'),
dict(type='LoadAnnotations', with_bbox=True),
dict(type='RResize', img_scale=(800, 512)),
dict(type='RRandomFlip', flip_ratio=0.5),
dict(
type='Normalize',
mean=[123.675, 116.28, 103.53],
std=[58.395, 57.12, 57.375],
to_rgb=True),
dict(type='Pad', size_divisor=32),
dict(type='DefaultFormatBundle'),
dict(type='Collect', keys=['img', 'gt_bboxes', 'gt_labels'])
]),
val=dict(
type='HRSCDataset',
classwise=True,
ann_file='data/hrsc/ImageSets/test.txt',
ann_subdir='data/hrsc/FullDataSet/Annotations/',
img_subdir='data/hrsc/FullDataSet/AllImages/',
img_prefix='data/hrsc/FullDataSet/AllImages/',
pipeline=[
dict(type='LoadImageFromFile'),
dict(
type='MultiScaleFlipAug',
img_scale=(800, 512),
flip=False,
transforms=[
dict(type='RResize'),
dict(
type='Normalize',
mean=[123.675, 116.28, 103.53],
std=[58.395, 57.12, 57.375],
to_rgb=True),
dict(type='Pad', size_divisor=32),
dict(type='DefaultFormatBundle'),
dict(type='Collect', keys=['img'])
])
]),
test=dict(
type='HRSCDataset',
classwise=True,
ann_file='data/hrsc/ImageSets/test.txt',
ann_subdir='data/hrsc/FullDataSet/Annotations/',
img_subdir='data/hrsc/FullDataSet/AllImages/',
img_prefix='data/hrsc/FullDataSet/AllImages/',
pipeline=[
dict(type='LoadImageFromFile'),
dict(
type='MultiScaleFlipAug',
img_scale=(800, 512),
flip=False,
transforms=[
dict(type='RResize'),
dict(
type='Normalize',
mean=[