[PaddlePaddle/PaddleOCR]使用 ch_PP-OCRv4_rec 微调识别模型,loss最低 4.8 左右,acc 最高 0.8 左右,如何降低LOSS、提高ACC?

2024-05-10 423 views
7

请提供下述完整信息以便快速定位问题/Please provide the following information to quickly locate the problem

  • 系统环境/System Environment: PRETTY_NAME="Debian GNU/Linux 11 (bullseye)" NAME="Debian GNU/Linux" VERSION_ID="11" VERSION="11 (bullseye)" VERSION_CODENAME=bullseye ID=debian Python 3.10.14 GPU Compute Capability: 8.6, Driver API Version: 12.2, Runtime API Version: 12.0

  • 版本号/Version:Paddle: PaddleOCR: 问题相关组件/Related components: paddle-bfloat 0.1.7 paddle2onnx 1.2.0 paddlefsl 1.1.0 paddlenlp 2.7.2 paddlepaddle-gpu 2.6.1.post120 PaddleOCR 2.7.0

  • 运行指令/Command Code: python tools/train.py -c ch_PP-OCRv4_rec.yml

  • 完整报错/Complete Error Message: 微调数据:大约 18000 个 crop img,全部为真实的垂直领域数据 learning_rate : 5e-05 Train.sampler.scales : [[480, 32], [480, 48], [480, 64]] max_text_length : 60 batch_size_per_card : 96

[2024/05/05 20:36:27] ppocr INFO: epoch: [100/100], global_step: 16200, lr: 0.000000, acc: 0.781250, norm_edit_dis: 0.929588, CTCLoss: 4.331411, NRTRLoss: 1.337142, loss: 5.722537, avg_reader_cost: 0.00012 s, avg_batch_cost: 0.84782 s, avg_samples: 64.0, ips: 75.48803 samples/s, eta: 0:00:00 [2024/05/05 20:36:42] ppocr INFO: cur metric, acc: 0.7907482971680319, norm_edit_dis: 0.9605701758477495, fps: 304.4467098221716 [2024/05/05 20:36:42] ppocr INFO: best metric, acc: 0.803265303936693, is_float16: False, norm_edit_dis: 0.9638480089006147, fps: 303.77989703218935, best_epoch: 7

对于这种场景,如何降低 LOSS,提高 ACC ?

回答

0

norm_edit_dis: 0.9605701758477495,说明模型输出结果与label很接近,但是存在细微差别,导致acc降低,因此可以查看模型推理结果,找到hard cases通过增加这类场景的数据进一步提高模型性能。

1

norm_edit_dis: 0.9605701758477495,说明模型输出结果与label很接近,但是存在细微差别,导致acc降低,因此可以查看模型推理结果,找到hard cases通过增加这类场景的数据进一步提高模型性能。

norm_edit_dis: 我这个结果可以设置lr为多少?进行hard case微调?

[2024/05/06 13:33:47] ppocr INFO: epoch: [1/2], global_step: 58100, lr: 0.000500, acc: 0.437499, norm_edit_dis: 0.817307, loss: 10.885052, avg_reader_cost: 0.23835 s, avg_batch_cost: 1.03446 s, avg_samples: 8.0, ips: 7.73348 samples/s, eta: 4 days, 22:08:14 [2024/05/06 13:35:41] ppocr INFO: epoch: [1/2], global_step: 58200, lr: 0.000500, acc: 0.437499, norm_edit_dis: 0.773175, loss: 11.013021, avg_reader_cost: 0.18558 s, avg_batch_cost: 1.13296 s, avg_samples: 8.0, ips: 7.06118 samples/s, eta: 4 days, 22:07:55

2

norm_edit_dis: 0.9605701758477495,说明模型输出结果与label很接近,但是存在细微差别,导致acc降低,因此可以查看模型推理结果,找到hard cases通过增加这类场景的数据进一步提高模型性能。

norm_edit_dis: 我这个结果可以设置lr为多少?进行hard case微调?

[2024/05/06 13:33:47] ppocr INFO: epoch: [1/2], global_step: 58100, lr: 0.000500, acc: 0.437499, norm_edit_dis: 0.817307, loss: 10.885052, avg_reader_cost: 0.23835 s, avg_batch_cost: 1.03446 s, avg_samples: 8.0, ips: 7.73348 samples/s, eta: 4 days, 22:08:14 [2024/05/06 13:35:41] ppocr INFO: epoch: [1/2], global_step: 58200, lr: 0.000500, acc: 0.437499, norm_edit_dis: 0.773175, loss: 11.013021, avg_reader_cost: 0.18558 s, avg_batch_cost: 1.13296 s, avg_samples: 8.0, ips: 7.06118 samples/s, eta: 4 days, 22:07:55

学习率设置是个经验值,具体根据数据集和训练环境,多做几组实验探究一下

1

norm_edit_dis: 0.9605701758477495,说明模型输出结果与label很接近,但是存在细微差别,导致acc降低,因此可以查看模型推理结果,找到hard cases通过增加这类场景的数据进一步提高模型性能。

norm_edit_dis: 我这个结果可以设置lr为多少?进行hard case微调? [2024/05/06 13:33:47] ppocr INFO: epoch: [1/2], global_step: 58100, lr: 0.000500, acc: 0.437499, norm_edit_dis: 0.817307, loss: 10.885052, avg_reader_cost: 0.23835 s, avg_batch_cost: 1.03446 s, avg_samples: 8.0, ips: 7.73348 samples/s, eta: 4 days, 22:08:14 [2024/05/06 13:35:41] ppocr INFO: epoch: [1/2], global_step: 58200, lr: 0.000500, acc: 0.437499, norm_edit_dis: 0.773175, loss: 11.013021, avg_reader_cost: 0.18558 s, avg_batch_cost: 1.13296 s, avg_samples: 8.0, ips: 7.06118 samples/s, eta: 4 days, 22:07:55

学习率设置是个经验值,具体根据数据集和训练环境,多做几组实验探究一下

比如我只微调hard case, 将lr设为很低,可以设为多少?

3

norm_edit_dis: 0.9605701758477495,说明模型输出结果与label很接近,但是存在细微差别,导致acc降低,因此可以查看模型推理结果,找到hard cases通过增加这类场景的数据进一步提高模型性能。

norm_edit_dis: 我这个结果可以设置lr为多少?进行hard case微调? [2024/05/06 13:33:47] ppocr INFO: epoch: [1/2], global_step: 58100, lr: 0.000500, acc: 0.437499, norm_edit_dis: 0.817307, loss: 10.885052, avg_reader_cost: 0.23835 s, avg_batch_cost: 1.03446 s, avg_samples: 8.0, ips: 7.73348 samples/s, eta: 4 days, 22:08:14 [2024/05/06 13:35:41] ppocr INFO: epoch: [1/2], global_step: 58200, lr: 0.000500, acc: 0.437499, norm_edit_dis: 0.773175, loss: 11.013021, avg_reader_cost: 0.18558 s, avg_batch_cost: 1.13296 s, avg_samples: 8.0, ips: 7.06118 samples/s, eta: 4 days, 22:07:55

学习率设置是个经验值,具体根据数据集和训练环境,多做几组实验探究一下

比如我只微调hard case, 将lr设为很低,可以设为多少?

我看到你提issue了,因此就关闭该issue,在你的issue下回复

7

根据 @UserWangZz 的问题做了 close处理,但issue并未解决。

{ "img": "202312070001_crop_13.jpg", "gen": [ "送检医师:柏维昌", 0.9480968117713928 ], "label": "送检医师:柏继昌" } 您好,对于微调后的模型,预测错误的 case,增加那些数据效果更好? 比如:202312070001_crop_13.jpg 做一些数据增广,还是识别错误:“柏继昌” ,必须使用更多的真实数据?

8

这个返回格式怎么得到的?

9

这是批量验证,人工处理后的结果

3

训练图片是怎么样的?


------------------ 原始邮件 ------------------

发件人: yilong2001 @.***>

发送时间: 2024-05-06 19:04:18

收件人:PaddlePaddle/PaddleOCR @.***>

抄送:nissanjp @.>,Comment @.>

主题: Re: [PaddlePaddle/PaddleOCR] 使用 ch_PP-OCRv4_rec 微调识别模型,loss最低 4.8 左右,acc 最高 0.8 左右,如何降低LOSS、提高ACC? (Issue #12052)

这是批量验证,人工处理后的结果

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

2

dlds-202312070001_crop_13 这是原始图片

1

检测模型用的哪个?

6

检测模型用的 ch_PP-OCRv4_det_infer

5

@UserWangZz 帮忙看看问题

6

@UserWangZz 对于这些不易识别的数据,样本数量或者比例是否有要求?

6

@UserWangZz 对于这些不易识别的数据,样本数量或者比例是否有要求?

这个是一个经验性的问题,没有一个具体的要求的

5

@yilong2001 我想问一下,像这样医学表格,它有点褶皱,每行都不怎么平整,您是怎么解决的呢

5

对于褶皱这个问题我们还没有好的解决方案

9

本issue暂时关闭,如有新的问题,请提新issue