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

识别模型转inference模型报错 #1909

Closed sifanlook closed 3 years ago

sifanlook commented 3 years ago

F:\baiduai\PaddleOCR>python tools/export_model.py -c configs/rec/ch_ppocr_v1.1/rec_chinese_lite_train_v1.1.yml -o Global.checkpoints=./output/rec_CRNN3/best_accuracy Global.save_inference_dir=./inference/rec_crnn/ 2021-02-02 10:36:02,710-INFO: {'Global': {'debug': False, 'algorithm': 'CRNN', 'use_gpu': True, 'epoch_num': 500, 'log_smooth_window': 20, 'print_batch_step': 10, 'save_model_dir': './output/rec_CRNN', 'save_epoch_step': 3, 'eval_batch_step': 2000, 'train_batch_size_per_card': 256, 'test_batch_size_per_card': 256, 'image_shape': [3, 32, 320], 'max_text_length': 25, 'character_type': 'ch', 'character_dict_path': './ppocr/utils/ppocr_keys_v1.txt', 'loss_type': 'ctc', 'distort': True, 'use_space_char': True, 'reader_yml': './configs/rec/rec_chinese_reader.yml', 'pretrain_weights': None, 'checkpoints': './output/rec_CRNN3/best_accuracy', 'save_inference_dir': './inference/rec_crnn/', 'infer_img': None}, 'Architecture': {'function': 'ppocr.modeling.architectures.rec_model,RecModel'}, 'Backbone': {'function': 'ppocr.modeling.backbones.rec_mobilenet_v3,MobileNetV3', 'scale': 0.5, 'model_name': 'small', 'small_stride': [1, 2, 2, 2]}, 'Head': {'function': 'ppocr.modeling.heads.rec_ctc_head,CTCPredict', 'encoder_type': 'rnn', 'fc_decay': 1e-05, 'SeqRNN': {'hidden_size': 48}}, 'Loss': {'function': 'ppocr.modeling.losses.rec_ctc_loss,CTCLoss'}, 'Optimizer': {'function': 'ppocr.optimizer,AdamDecay', 'base_lr': 0.0005, 'l2_decay': 1e-05, 'beta1': 0.9, 'beta2': 0.999, 'decay': {'function': 'cosine_decay_warmup', 'step_each_epoch': 254, 'total_epoch': 500, 'warmup_minibatch': 1000}}, 'TrainReader': {'reader_function': 'ppocr.data.rec.dataset_traversal,SimpleReader', 'num_workers': 4, 'img_set_dir': './train_data/rec_train_pic', 'label_file_path': './train_data/rec_train_pic/rec_gt.txt'}, 'EvalReader': {'reader_function': 'ppocr.data.rec.dataset_traversal,SimpleReader', 'img_set_dir': './train_data/rec_train_pic', 'label_file_path': './train_data/rec_train_pic/rec_gt_test.txt'}, 'TestReader': {'reader_function': 'ppocr.data.rec.dataset_traversal,SimpleReader'}} W0202 10:36:04.848502 8104 device_context.cc:362] Please NOTE: device: 0, GPU Compute Capability: 6.1, Driver API Version: 11.1, Runtime API Version: 10.0 W0202 10:36:04.878502 8104 device_context.cc:372] device: 0, cuDNN Version: 7.6. Traceback (most recent call last): File "tools/export_model.py", line 77, in main() File "tools/export_model.py", line 57, in main init_model(config, eval_program, exe) File "F:\baiduai\PaddleOCR\ppocr\utils\save_load.py", line 114, in init_model fluid.load(program, path, exe) File "", line 2, in load File "F:\Python3.7.9\lib\site-packages\paddle\fluid\wrapped_decorator.py", line 25, in impl return wrapped_func(*args, *kwargs) File "F:\Python3.7.9\lib\site-packages\paddle\fluid\framework.py", line 234, in impl return func(args, **kwargs) File "F:\Python3.7.9\lib\site-packages\paddle\fluid\io.py", line 2007, in load v.name, parameter_file_name) AssertionError: Can not find [conv3_depthwise_bn_scale] in model file [./output/rec_CRNN3/best_accuracy.pdparams]

sifanlook commented 3 years ago

导出检测模型是正常的,但是导出识别模型一直出错,请问是什么原因

sifanlook commented 3 years ago

大佬帮忙看一下,急!><

sifanlook commented 3 years ago

` Global: algorithm: CRNN use_gpu: true epoch_num: 5 log_smooth_window: 20 print_batch_step: 10 save_model_dir: ./output/rec_CRNN3 save_epoch_step: 3 eval_batch_step: 2000 train_batch_size_per_card: 4 test_batch_size_per_card: 4 image_shape: [3, 160, 320] max_text_length: 25 character_type: ch character_dict_path: ./ppocr/utils/ppocr_keys_v1.txt loss_type: ctc distort: true use_space_char: true reader_yml: ./configs/rec/rec_chinese_reader.yml pretrain_weights: checkpoints: save_inference_dir: infer_img:

Architecture: function: ppocr.modeling.architectures.rec_model,RecModel

Backbone: function: ppocr.modeling.backbones.rec_resnet_vd,ResNet layers: 34

Head: function: ppocr.modeling.heads.rec_ctc_head,CTCPredict encoder_type: rnn fc_decay: 0.00004 SeqRNN: hidden_size: 256

Loss: function: ppocr.modeling.losses.rec_ctc_loss,CTCLoss

Optimizer: function: ppocr.optimizer,AdamDecay base_lr: 0.0005 l2_decay: 0.00004 beta1: 0.9 beta2: 0.999 decay: function: cosine_decay_warmup step_each_epoch: 254 total_epoch: 500 warmup_minibatch: 1000 `

sifanlook commented 3 years ago

已经解决,pretrain_weights:参数必须配置,不能为空!