1.tools/train.py
修改训练所需的模型 和 训练获得权重的目标文件夹(文件夹会自动创建)
parser.add_argument('--config', defualt='/home/zhh/download/mmrotate-main/tools/train-/s2anet_r50_fpn_1x_dota_le135.py', help='train config file path')
parser.add_argument('--work-dir', default='/home/zhh/download/mmrotate-main/tools/train-/run', help='the dir to save logs and models')
2.s2anet_r50_fpn_1x_dota_le135.py
改为绝对路径
--------------------------------------------------------------------------------------------------------------------------------
模型选择
--------------------------------------------------------------------------------------------------------------------------------
想要训练成几类,就改成几
--------------------------------------------------------------------------------------------------------------------------------
3.mmrotate-main/mmrotate/datasets/dota.py
修改文件中的类别名字(CLASSES)
4._base_/datasets/dotav1.py
选择裁剪好的三个文件夹train、val、test的父文件夹
--------------------------------------------------------------------------------------------------------------------------------
分别填写刚刚父文件夹下的路径
5._base_/schedules/schedule_1x.py
# evaluation
evaluation = dict(interval=1, metric='mAP') #每训练1轮报一遍mAP
# optimizer
optimizer = dict(type='SGD', lr=0.0025, momentum=0.9, weight_decay=0.0001) # 调整学习率
optimizer_config = dict(grad_clip=dict(max_norm=35, norm_type=2))
# learning policy
lr_config = dict(
policy='step',
warmup='linear',
warmup_iters=500,
warmup_ratio=1.0 / 3,
step=[130, 180]) # 在第130轮降低一次学习率,在第180轮再降低一次学习率
runner = dict(type='EpochBasedRunner', max_epochs=200) # 训练200轮
checkpoint_config = dict(interval=10) # 模型每10轮保存一次