PaddlePaddle / PaddleOCR

Awesome multilingual OCR toolkits based on PaddlePaddle (practical ultra lightweight OCR system, support 80+ languages recognition, provide data annotation and synthesis tools, support training and deployment among server, mobile, embedded and IoT devices)
https://paddlepaddle.github.io/PaddleOCR/
Apache License 2.0
43.9k stars 7.8k forks source link

识别改训练图片参数 #5850

Closed 2205825969 closed 2 years ago

2205825969 commented 2 years ago

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

andyjiang1116 commented 2 years ago

改配置文件就可以了

2205825969 commented 2 years ago

大佬,我直接改配置文件如下
Global: debug: true use_gpu: false epoch_num: 1200 log_smooth_window: 20 print_batch_step: 1000 save_model_dir: F:\pythonProject\PaddleOCR-release-2.4/output/rec/mv3_none_bilstm_ctc_punctuation/ save_epoch_step: 100 eval_batch_step:

andyjiang1116 commented 2 years ago

高度变为64后,需要增大最后一层卷积的stride,在这里https://github.com/PaddlePaddle/PaddleOCR/blob/release/2.4/ppocr/modeling/backbones/rec_mv1_enhance.py#L203 把stride=1改为stride=(2, 1)

2205825969 commented 2 years ago

大佬我修改了,但是还是出现这个错误

    conv6 = DepthwiseSeparable(
        num_channels=int(1024 * scale),
        num_filters1=1024,
        num_filters2=1024,
        num_groups=1024,
        stride=(2, 1),
        dw_size=5,
        padding=2,
        use_se=True,
        scale=scale)
    self.block_list.append(conv6)

                           ......
                           ......
                           ......

[2022/03/31 20:19:48] root INFO: train from scratch [2022/03/31 20:19:48] root INFO: train dataloader has 62 iters [2022/03/31 20:19:48] root INFO: valid dataloader has 7 iters [2022/03/31 20:19:48] root INFO: During the training process, after the 0th iteration, an evaluation is run every 2000 iterations [2022/03/31 20:19:48] root INFO: Initialize indexs of datasets:['F:\pythonProject\PaddleOCR-release-2.4/traindata/test_rec/train_label.txt'] Traceback (most recent call last): File "F:/pythonProject/PaddleOCR-release-2.4/tools/train.py", line 149, in main(config, device, logger, vdl_writer) File "F:/pythonProject/PaddleOCR-release-2.4/tools/train.py", line 124, in main program.train(config, train_dataloader, valid_dataloader, device, model, File "F:\pythonProject\PaddleOCR-release-2.4\tools\program.py", line 245, in train preds = model(images) File "D:\anaconda3\envs\ocr\lib\site-packages\paddle\fluid\dygraph\layers.py", line 917, in call return self._dygraph_call_func(*inputs, kwargs) File "D:\anaconda3\envs\ocr\lib\site-packages\paddle\fluid\dygraph\layers.py", line 907, in _dygraph_call_func outputs = self.forward(*inputs, *kwargs) File "F:\pythonProject\PaddleOCR-release-2.4\ppocr\modeling\architectures\base_model.py", line 78, in forward x = self.neck(x) File "D:\anaconda3\envs\ocr\lib\site-packages\paddle\fluid\dygraph\layers.py", line 917, in call return self._dygraph_call_func(inputs, kwargs) File "D:\anaconda3\envs\ocr\lib\site-packages\paddle\fluid\dygraph\layers.py", line 907, in _dygraph_call_func outputs = self.forward(*inputs, kwargs) File "F:\pythonProject\PaddleOCR-release-2.4\ppocr\modeling\necks\rnn.py", line 89, in forward x = self.encoder_reshape(x) File "D:\anaconda3\envs\ocr\lib\site-packages\paddle\fluid\dygraph\layers.py", line 917, in call return self._dygraph_call_func(*inputs, *kwargs) File "D:\anaconda3\envs\ocr\lib\site-packages\paddle\fluid\dygraph\layers.py", line 907, in _dygraph_call_func outputs = self.forward(inputs, kwargs) File "F:\pythonProject\PaddleOCR-release-2.4\ppocr\modeling\necks\rnn.py", line 31, in forward assert H == 1 AssertionError

Process finished with exit code 1

andyjiang1116 commented 2 years ago

抱歉,刚才看错了,你用的backbone是MobileNetV3,改一下这里的stride https://github.com/PaddlePaddle/PaddleOCR/blob/release/2.4/ppocr/modeling/backbones/rec_mobilenet_v3.py#L124

Sarayue00 commented 2 years ago

预训练模型要与配置文件相匹配:https://github.com/PaddlePaddle/PaddleOCR/blob/release/2.4/doc/doc_ch/models_list.md