Closed zhangyistruggle closed 3 years ago
yml的参数如下: Global: use_gpu: false epoch_num: 500 log_smooth_window: 20 print_batch_step: 10 save_model_dir: ./output/rec_chinese_lite_v2.0 save_epoch_step: 3
eval_batch_step: [0, 1000] cal_metric_during_train: True pretrained_model: ./pretrain_models/rec_mv3_none_bilstm_ctc_v2.0_train/best_accuracy checkpoints: save_inference_dir: use_visualdl: False infer_img: doc/imgs_words/ch/word_1.jpg
character_dict_path: ppocr/utils/ppocr_keys_v1.txt character_type: ch max_text_length: 25 infer_mode: False use_space_char: True save_res_path: ./output/rec/predicts_chinese_lite_v2.0.txt
Optimizer: name: Adam beta1: 0.9 beta2: 0.999 lr: name: Cosine learning_rate: 0.001 regularizer: name: 'L2' factor: 0.00001
Architecture: model_type: rec algorithm: CRNN Transform: Backbone: name: MobileNetV3 scale: 0.5 model_name: small small_stride: [1, 2, 2, 2] Neck: name: SequenceEncoder encoder_type: rnn hidden_size: 48 Head: name: CTCHead fc_decay: 0.00001
Loss: name: CTCLoss
PostProcess: name: CTCLabelDecode
Metric: name: RecMetric main_indicator: acc
Train: dataset: name: SimpleDataSet data_dir: ./train_data/dazhongdianping_rec/train/ label_file_list: ["./train_data/dazhongdianping_rec/train/rec_train_gt.txt"] transforms:
Eval: dataset: name: SimpleDataSet data_dir: ./train_data/dazhongdianping_rec/test/ label_file_list: ["./train_data/dazhongdianping_rec/test/rec_test_gt.txt"] transforms:
图片没有变化。路径是指向同一张图片的,该图片是训练集的图片。
感觉应该是配置文件的问题。rec_mv3_none_bilstm_ctc_v2.0_train这个预训练模型所对应的配置文件应该不是轻量级模型的rec_chinese_lite_train_v2.0.yml。可以查看文件夹里的train.log中记录的配置信息来进行训练。
Since you haven\'t replied for more than 3 months, we have closed this issue/pr. If the problem is not solved or there is a follow-up one, please reopen it at any time and we will continue to follow up. It is recommended to pull and try the latest code first. 由于您超过三个月未回复,我们将关闭这个issue/pr。 若问题未解决或有后续问题,请随时重新打开(建议先拉取最新代码进行尝试),我们会继续跟进。
使用的是rec_mv3_none_bilstm_ctc_v2.0_train预训练模型,配置yml是rec_chinese_lite_train_v2.0.yml。采用了自己的数据集进行识别模型训练。使用的是训练集图片对训练模型进行识别测试,脚本如下: python3 tools/infer_rec.py -c configs/rec/ch_ppocr_v2.0/rec_chinese_lite_train_v2.0.yml -o Global.pretrained_model=./output/rec_chinese_lite_v2.0/best_accuracy Global.infer_img=./rec_test_image/image_1_crop_0.jpg 图片识别结果如下: 使用模型转换脚本: python3 tools/export_model.py -c configs/rec/ch_ppocr_v2.0/rec_chinese_lite_train_v2.0.yml -o Global.pretrained_model=./output/rec_chinese_lite_v2.0/best_accuracy Global.save_inference_dir=./inference/rec_crnn 再次使用转换后的推测模型进行同一张图片的测试,脚本如下: python3 tools/infer/predict_rec.py --image_dir=./rec_test_image/image_1_crop_0.jpg --rec_model_dir=./inference/rec_crnn/ --use_gpu=false 图片结果识别如下:
模型转换前后识别结果差异很大。inference模型识别完全是错误的。 识别的图片如下: