旋转框目标检测mmrotate v0.3.1 训练HRSC2016数据集(二)

本文介绍了如何利用mmrotate v0.3.1进行旋转框目标检测,详细步骤包括:设置HRSC2016数据集目录结构,生成模型配置文件,数据标签可视化,模型训练,通过tensorboard监控训练过程,使用analyze_logs.py进行日志分析,模型测试及结果保存。同时,文中还列举了常见错误及其解决方案。
摘要由CSDN通过智能技术生成

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=[
评论 9
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值