optimizer = dict(type='SGD', lr=0.02, momentum=0.9, weight_decay=0.0001) # 优化参数,lr为学习率,momentum为动量因子,weight_decay为权重衰减因子optimizer_config = dict(grad_clip=dict(max_norm=35, norm_type=2)) # 梯度均衡参数 # learning policy lr_config = dict( policy='step', # 优化策略...
默认情况下,我们使用的是configs/_base_/schedules/schedule_1x.py中的调度设置,这是默认的Step LR调度,在MMCV中为StepLRHook,同时MMDetection也支持其他的调度器,如余弦调度(CosineAnneaing),在配置文件中及那个lr_config字段修改如下即可使用余弦调度。 代码解读 lr_config = dict( policy='CosineAnnealing', warm...
# optimizer类型,lr,momentum是SGD的一种加速超参,weight_decay是权重惩罚参数 optimizer = dict(type='SGD', lr=0.02, momentum=0.9, weight_decay=0.0001)optimizer_config = dict(grad_clip=None) # 是一种防止梯度爆炸的策略 # lr 参数 lr_config = dict( policy='step', # lr decay的方式,其余的还有...
step=[8, 11]) 在上面的代码中,lr=0.02指定了初始学习率为0.02。lr_config字典中则定义了学习率调整策略,包括学习率调整方式(policy)、预热方式(warmup)、预热迭代次数(warmup_iters)、预热比例(warmup_ratio)以及学习率调整步长(step)等。通过调整这些参数,可以灵活地控制学习率的变化。 需要注意的是,在MMDete...
lr_config = dict( # 学习率调整配置,用于注册 LrUpdater hook。 policy='step', # 调度流程(scheduler)的策略,也支持 CosineAnnealing, Cyclic, 等。请从 https://github.com/open-mmlab/mmcv/blob/master/mmcv/runner/hooks/lr_updater.py#L9 参考 LrUpdater 的细节。
lr_config = dict(policy='step',warmup='linear',warmup_iters=500,warmup_ratio=0.001,step=[8, 11]) # 表示初始学习率在第8和11个epoch衰减10倍 还有其他的配置方案: Poly schedule lr_config = dict(policy='poly', power=0.9, min_lr=1e-4, by_epoch=False) ...
lr_config = dict( policy='step', warmup='linear', warmup_iters=500, warmup_ratio=1.0 / 3, step=[8, 11]) checkpoint_config = dict(interval=1) # yapf:disable log_config = dict( interval=50, hooks=[ dict(type='TextLoggerHook'), # dict(type='TensorboardLoggerHook') ]) # yapf:...
lr_config = dict(policy='step', step=[3]) # actual epoch = 3 * 3 = 9 checkpoint_config = dict(interval=1) # yapf:disable log_config = dict( interval=100, hooks=[ dict(type='TextLoggerHook'), # dict(type='TensorboardLoggerHook') ...
Prepare a config The third step is to prepare a config for your own training setting. Assume that we want to addAugFPNandRotateorTranslateaugmentation to existing Cascade Mask R-CNN R50 to train the cityscapes dataset, and assume the config is under directoryconfigs/cityscapes/and named ascascade...
runner.register_training_hooks(cfg.lr_config,optimizer_config,cfg.checkpoint_config,cfg.log_config,cfg.get('momentum_config',None))#5.如果需要 val,则还需要注册 EvalHook runner.register_hook(eval_hook(val_dataloader,**eval_cfg))#6.注册用户自定义 hook ...