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
42.74k stars 7.68k forks source link

生成的训练数据不能直接使用么 #2588

Closed DarkSQL9527 closed 3 years ago

DarkSQL9527 commented 3 years ago

先用标注文件标注了一个图片生成label.txt 对label.txt进行训练生成了三个文件iter_epoch_1.pdopt,iter_epoch_1.pdparrams,iter_epoch_1.states 用export_modle加上参数 -c ./configs/det/det_mv3_db.yml -o Global.checkpoints="./output/db_mv3/iter_epoch_7" Global.save_inference_dir="./output/db_mv3/expor_model 对这3个文件转化成inference" 然后ocr是别的时候指定这三个文件 ocr = PaddleOCR(use_angle_cls=False,use_gpu=False,rec_model_dir="./inference/rec_crnn/",det_model_dir="./inference/rec_crnn/")#det_model_dir='{your_det_model_dir}', rec_model_dir='{your_rec_model_dir}', rec_char_dict_path='{your_rec_char_dict_path}', cls_model_dir='{your_cls_model_dir}', use_angle_cls=True img_path = './train_pic/1.png' result = ocr.ocr(img_path, cls=False) 结果识别的时候报了个错误,.. InvalidArgumentError: Broadcast dimension mismatch. Operands could not be broadcast together with the shape of X = [30, 256, 2, 3] and the shape of Y = [30, 256, 2, 4]. Received [3] in X is not equal to [4] in Y at i:3. [Hint: Expected x_dims_array[i] == y_dims_array[i] || x_dims_array[i] <= 1 || y_dims_array[i] <= 1 == true, but received x_dims_array[i] == y_dims_array[i] || x_dims_array[i] <= 1 || y_dims_array[i] <= 1:0 != true:1.] (at D:\v2.0.2\paddle\paddle/fluid/operators/elementwise/elementwise_op_function.h:160) [operator < elementwise_add > error] 完全不知道为什么呀.......具体资料找了好久也没有找到类似的 我的配置文件是. Global: use_gpu: false epoch_num: 5 log_smooth_window: 20 print_batch_step: 5 save_model_dir: ./output/db_mv3/ save_epoch_step: 1

evaluation is run every 2000 iterations

eval_batch_step: [0, 2000]

if pretrained_model is saved in static mode, load_static_weights must set to True

load_static_weights: True cal_metric_during_train: False pretrained_model: ./pretrain_models/MobileNetV3_large_x0_5_pretrained checkpoints: save_inference_dir: use_visualdl: False infer_img: doc/imgs_en/img_10.jpg save_res_path: ./output/det_db/predicts_db.txt

Architecture: model_type: det algorithm: DB Transform: Backbone: name: MobileNetV3 scale: 0.5 model_name: large Neck: name: DBFPN out_channels: 256 Head: name: DBHead k: 50

Loss: name: DBLoss balance_loss: true main_loss_type: DiceLoss alpha: 5 beta: 10 ohem_ratio: 3

Optimizer: name: Adam beta1: 0.9 beta2: 0.999 lr: learning_rate: 0.001 regularizer: name: 'L2' factor: 0

PostProcess: name: DBPostProcess thresh: 0.3 box_thresh: 0.6 max_candidates: 1000 unclip_ratio: 1.5

Metric: name: DetMetric main_indicator: hmean

Train: dataset: name: SimpleDataSet data_dir: ./ label_file_list:

Eval: dataset: name: SimpleDataSet data_dir: ./train_data/test_imgs/ label_file_list:

tink2123 commented 3 years ago

看报错是image shape不匹配导致的,重新check下 训练的image shape,和 预测的image shape 是否一致。

paddle-bot-old[bot] commented 3 years ago

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。 若问题未解决或有后续问题,请随时重新打开(建议先拉取最新代码进行尝试),我们会继续跟进。