ch_PP-OCRv4_det_train 检测模型训练权重系数警告问题 #12968
Replies: 14 comments 6 replies
-
我也遇到了同样的问题,预训练模型使用ch_PP-OCRv4_det_train,选用ch_PP-OCRv4_det_student.yml出现参数加载不全,使用cml配置改动后不报错,但是这种蒸馏训练我不了解,不知道teacher模型和student模型如何选择 |
Beta Was this translation helpful? Give feedback.
-
ppocr-v4_det没有student模型吗,怎么使用student配置用普通方式微调 |
Beta Was this translation helpful? Give feedback.
-
我补充下相关环境信息:
Architecture: Loss: Optimizer: PostProcess: Metric: Train: Eval: |
Beta Was this translation helpful? Give feedback.
-
我是直接在官网下载的ch_PP-OCRv4_det_train,解压缩后只有一个best_accuracy.pdparams。 而且用以下代码尝试提取student模型,结果为空。 import paddle 加载预训练模型all_params = paddle.load("models/ch_PP-OCRv3_rec_train/best_accuracy.pdparams") 查看权重参数的keysprint(all_params.keys()) 学生模型的权重提取s_params = {key[len("Student."):]: all_params[key] for key in all_params if "Student." in key} 查看学生模型权重参数的keysprint(s_params.keys()) 保存paddle.save(s_params, "models/ch_PP-OCRv3_rec_train/student.pdparams") |
Beta Was this translation helpful? Give feedback.
-
官网也没有找到关于 yml配置文件与模型的对应选取 的指导说明。 |
Beta Was this translation helpful? Give feedback.
-
在issue里,有人修复了ppocr-v4_det使用cml报错的问题,能修复。在两个student里添加 det: true |
Beta Was this translation helpful? Give feedback.
-
具体是哪一个issue还记得吗? |
Beta Was this translation helpful? Give feedback.
-
搜索 det cml,能看到就在前几个问题里 |
Beta Was this translation helpful? Give feedback.
-
报错是修复了,但是 ppocr WARNING: The pretrained params backbone.conv1.hardswish.scale not in model, |
Beta Was this translation helpful? Give feedback.
-
Set unclip_ratio to 0.5 will solved the isse |
Beta Was this translation helpful? Give feedback.
-
unclip_ratio这个参数是设置检测框大小的,我现在是调大了,太小会出现框太小检测不准的问题把、吧 |
Beta Was this translation helpful? Give feedback.
-
大佬你这个问题解决了吗?我也遇到这个问题了 |
Beta Was this translation helpful? Give feedback.
-
请问你也有出现这中情况吗 用配置文件ch_PP-OCRv4_det_cml.yml 模型是官方的ch_PP-OCRv4_det_train/best_accuracy.pdparams |
Beta Was this translation helpful? Give feedback.
-
我自己的数据集训练 用det V4的config训练一直都有问题 我就没用了 用的 det v3 student的
文文
***@***.***
…------------------ 原始邮件 ------------------
发件人: ***@***.***>;
发送时间: 2024年7月8日(星期一) 上午9:50
收件人: ***@***.***>;
抄送: ***@***.***>; ***@***.***>;
主题: Re: [PaddlePaddle/PaddleOCR] ch_PP-OCRv4_det_train 检测模型训练权重系数警告问题 (Discussion #12968)
我的配置文件是这样,这里的teacher和student模型什么意思,加载的不是下载的这个模型吗pretrain_models\ch_PP-OCRv4_det_train\best_accuracy.pdparams
Global:
debug: false
use_gpu: true
epoch_num: 500
log_smooth_window: 20
print_batch_step: 20
save_model_dir: ./output/ch_PP-OCRv4
save_epoch_step: 100
eval_batch_step:
0
100
cal_metric_during_train: false
checkpoints: null
pretrained_model: ./pretrain_models/ch_PP-OCRv4_det_train/best_accuracy.pdparams
save_inference_dir: null
use_visualdl: false
infer_img: doc/imgs_en/img_10.jpg
save_res_path: ./checkpoints/det_db/predicts_db.txt
distributed: true
Architecture:
name: DistillationModel
algorithm: Distillation
model_type: det
Models:
Student:
model_type: det
algorithm: DB
Transform: null
Backbone:
name: PPLCNetV3
scale: 0.75
pretrained: True
det: true
Neck:
name: RSEFPN
out_channels: 96
shortcut: true
Head:
name: DBHead
k: 50
Student2:
pretrained: null
model_type: det
algorithm: DB
Transform: null
Backbone:
name: PPLCNetV3
scale: 0.75
pretrained: True
det: true
Neck:
name: RSEFPN
out_channels: 96
shortcut: true
Head:
name: DBHead
k: 50
Teacher:
pretrained: https://paddleocr.bj.bcebos.com/PP-OCRv4/chinese/ch_PP-OCRv4_det_cml_teacher_pretrained/teacher.pdparams
freeze_params: true
return_all_feats: false
model_type: det
algorithm: DB
Backbone:
name: ResNet_vd
in_channels: 3
layers: 50
Neck:
name: LKPAN
out_channels: 256
Head:
name: DBHead
kernel_list:
- 7
- 2
- 2
k: 50
Loss:
name: CombinedLoss
loss_config_list:
DistillationDilaDBLoss:
weight: 1.0
model_name_pairs:
Student
Teacher
Student2
Teacher
key: maps
balance_loss: true
main_loss_type: DiceLoss
alpha: 5
beta: 10
ohem_ratio: 3
DistillationDMLLoss:
model_name_pairs:
Student
Student2
maps_name: thrink_maps
weight: 1.0
key: maps
DistillationDBLoss:
weight: 1.0
model_name_list:
Student
Student2
balance_loss: true
main_loss_type: DiceLoss
alpha: 5
beta: 10
ohem_ratio: 3
Optimizer:
name: Adam
beta1: 0.9
beta2: 0.999
lr:
name: Cosine
learning_rate: 0.001
warmup_epoch: 2
regularizer:
name: L2
factor: 5.0e-05
PostProcess:
name: DistillationDBPostProcess
model_name:
Student
key: head_out
thresh: 0.3
box_thresh: 0.6
max_candidates: 1000
unclip_ratio: 1.5
Metric:
name: DistillationMetric
base_metric_name: DetMetric
main_indicator: hmean
key: Student
Train:
dataset:
name: SimpleDataSet
data_dir: ./train_data/det/train
label_file_list:
./train_data/det/train.txt
ratio_list: [1.0]
transforms:
DecodeImage:
img_mode: BGR
channel_first: false
DetLabelEncode: null
IaaAugment:
augmenter_args:
type: Fliplr
args:
p: 0.5
type: Affine
args:
rotate:
-10
10
type: Resize
args:
size:
0.5
3
EastRandomCropData:
size:
640
640
max_tries: 50
keep_ratio: true
MakeBorderMap:
shrink_ratio: 0.4
thresh_min: 0.3
thresh_max: 0.7
total_epoch: 500
MakeShrinkMap:
shrink_ratio: 0.4
min_text_size: 8
total_epoch: 500
NormalizeImage:
scale: 1./255.
mean:
0.485
0.456
0.406
std:
0.229
0.224
0.225
order: hwc
ToCHWImage: null
KeepKeys:
keep_keys:
image
threshold_map
threshold_mask
shrink_map
shrink_mask
loader:
shuffle: true
drop_last: false
batch_size_per_card: 2
num_workers: 0
Eval:
dataset:
name: SimpleDataSet
data_dir: ./train_data/det/test
label_file_list:
./train_data/det/test.txt
transforms:
DecodeImage:
img_mode: BGR
channel_first: false
DetLabelEncode: null
DetResizeForTest:
limit_side_len: 960
limit_type: max
NormalizeImage:
scale: 1./255.
mean:
0.485
0.456
0.406
std:
0.229
0.224
0.225
order: hwc
ToCHWImage: null
KeepKeys:
keep_keys:
image
shape
polys
ignore_tags
loader:
shuffle: false
drop_last: false
batch_size_per_card: 1
num_workers: 2
profiler_options: null
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you commented.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
按照官网:
https://github.com/PaddlePaddle/PaddleOCR/blob/release/2.7/applications/%E8%BD%BB%E9%87%8F%E7%BA%A7%E8%BD%A6%E7%89%8C%E8%AF%86%E5%88%AB.md》所述步骤对ch_PP-OCRv4_det_train模型进行车牌数据集fine-tune。
目前官方文档提供的demo是ch_PP-OCRv3_det_distill_train模型。
我们打算选用ch_PP-OCRv4_det_train,在选用配置文件“ch_PP-OCRv4_det_student.yml”时,训练过程中会出现以下报警:
[2024/02/21 10:08:23] ppocr WARNING: The pretrained params backbone.conv1.hardswish.scale not in model
[2024/02/21 10:08:23] ppocr WARNING: The pretrained params backbone.conv1.hardswish.bias not in model
请问需要怎么调整?或者选用哪个配置文件才合适?(PaddleOCR-release-2.7内config文件夹自带的ch_PP-OCRv4_det_teacher.yml与ch_PP-OCRv4_det_cml.yml都尝试过,报错问题更多)
Beta Was this translation helpful? Give feedback.
All reactions