使用训练好的识别模型进行预测, 报错
Created by: NextGuido
你好, 非常感谢您的项目, 很棒! 我先后跑了检测和识别模型, 当识别模型训练完毕之后, 打算进行单张图片的预测, 因此执行提供的命令, python3 tools/infer_rec.py -c configs/rec/rec_chinese_lite_train.yml -o Global.checkpoints=./output/rec_CRNN/best_accuracy TestReader.infer_img=./doc/imgs_word/word_1.jpg
, 但是发生了下面的报错, 可以麻烦帮我看一下原因吗?感谢
2020-05-15 23:06:04,952-INFO: {'Global': {'algorithm': 'CRNN', 'use_gpu': True, 'epoch_num': 3000, '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, 100], 'max_text_length': 25, 'character_type': 'ch', 'character_dict_path': './ppocr/utils/ppocr_keys_v1.txt', 'loss_type': 'ctc', 'reader_yml': './configs/rec/rec_chinese_reader.yml', 'pretrain_weights': './pretrain_models/CRNN/best_accuracy', 'checkpoints': './output/rec_CRNN/best_accuracy', 'save_inference_dir': None}, 'Architecture': {'function': 'ppocr.modeling.architectures.rec_model,RecModel'}, 'Backbone': {'function': 'ppocr.modeling.backbones.rec_mobilenet_v3,MobileNetV3', 'scale': 0.5, 'model_name': 'small'}, 'Head': {'function': 'ppocr.modeling.heads.rec_ctc_head,CTCPredict', 'encoder_type': 'rnn', 'SeqRNN': {'hidden_size': 48}}, 'Loss': {'function': 'ppocr.modeling.losses.rec_ctc_loss,CTCLoss'}, 'Optimizer': {'function': 'ppocr.optimizer,AdamDecay', 'base_lr': 0.0005, 'beta1': 0.9, 'beta2': 0.999}, 'TrainReader': {'reader_function': 'ppocr.data.rec.dataset_traversal,SimpleReader', 'num_workers': 8, 'img_set_dir': './train_data', 'label_file_path': './train_data/rec_gt_train.txt'}, 'EvalReader': {'reader_function': 'ppocr.data.rec.dataset_traversal,SimpleReader', 'img_set_dir': './train_data', 'label_file_path': './train_data/rec_gt_test.txt'}, 'TestReader': {'reader_function': 'ppocr.data.rec.dataset_traversal,SimpleReader', 'infer_img': './doc/imgs_word/word_1.jpg'}} W0515 23:06:05.985396 31885 device_context.cc:237] Please NOTE: device: 0, CUDA Capability: 70, Driver API Version: 10.1, Runtime API Version: 9.0 W0515 23:06:05.989531 31885 device_context.cc:245] device: 0, cuDNN Version: 7.3. Traceback (most recent call last): File "tools/infer_rec.py", line 130, in <module> main() File "tools/infer_rec.py", line 79, in main init_model(config, eval_prog, exe) File "/home/aistudio/ppocr/utils/save_load.py", line 114, in init_model fluid.load(program, path, exe) File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/fluid/io.py", line 1740, in load v.name, parameter_file_name) AssertionError: Can not find [conv11_se_1_offset] in model file [./output/rec_CRNN/best_accuracy.pdparams]