WenmuZhou / PytorchOCR

基于Pytorch的OCR工具库,支持常用的文字检测和识别算法

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

请问,在检测模型det_db_mbv3_new.pth上微调,为什么越训越差呢?

LinXin04 opened this issue · comments

commented

image

commented

from addict import Dict

config = Dict()
config.exp_name = 'DBNet'
config.train_options = {
# for train
'resume_from': '/workspace/bin/latin_det_weights/det_db_mbv3_new.pth', # 继续训练地址
'third_party_name': '', # 加载paddle模型可选
'checkpoint_save_dir': f"/workspace/bin/det_latin_output/{config.exp_name}/checkpoint", # 模型保存地址,log文件也保存在这里
'device': 'cuda:0', # 不建议修改
'epochs': 10,
'fine_tune_stage': ['backbone', 'neck', 'head'],
'print_interval': 1, # step为单位
'val_interval': 1, # epoch为单位
'ckpt_save_type': 'HighestAcc', # HighestAcc:只保存最高准确率模型 ;FixedEpochStep:每隔ckpt_save_epoch个epoch保存一个
'ckpt_save_epoch': 4, # epoch为单位, 只有ckpt_save_type选择FixedEpochStep时,该参数才有效
}

config.SEED = 927
config.optimizer = {
'type': 'Adam',
'lr': 0.001,
'weight_decay': 1e-4,
}
config.model = {
# backbone 可以设置'pretrained': False/True
'type': "DetModel",
'backbone': {"type": "MobileNetV3", 'pretrained': True}, # ResNet or MobileNetV3
#'backbone': {"type": "ResNet", 'layers': 50, 'pretrained': True}, # ResNet or MobileNetV3
# 'backbone': {"type": "SwinTransformer", 'pretrained': True},#swin_transformer
# 'backbone': {"type": "ConvNeXt", 'pretrained': True},
'neck': {"type": 'DB_fpn', 'out_channels': 96},
'head': {"type": "DBHead"},
'in_channels': 3,
}

config.loss = {
'type': 'DBLoss',
'alpha': 1,
'beta': 10
}

config.post_process = {
'type': 'DBPostProcess',
'thresh': 0.3, # 二值化输出map的阈值
'box_thresh': 0.7, # 低于此阈值的box丢弃
'unclip_ratio': 1.5 # 扩大框的比例
}

eval和train非同分布,在训练集过拟合了