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.55k stars 7.77k forks source link

Max_Text_Length Change Error when using ABINET??? When I change the glabal.max_text_length of modle ABINET to 100 and this error happen. Please Help me fix this error. #11245

Closed VanQuyen02 closed 4 months ago

VanQuyen02 commented 11 months ago

Here is my config /content/PaddleOCR [2023/11/12 01:54:24] ppocr INFO: Architecture : [2023/11/12 01:54:24] ppocr INFO: Backbone : [2023/11/12 01:54:24] ppocr INFO: model_name : large [2023/11/12 01:54:24] ppocr INFO: name : MobileNetV3 [2023/11/12 01:54:24] ppocr INFO: scale : 0.5 [2023/11/12 01:54:24] ppocr INFO: Head : [2023/11/12 01:54:24] ppocr INFO: iter_size : 3 [2023/11/12 01:54:24] ppocr INFO: name : ABINetHead [2023/11/12 01:54:24] ppocr INFO: use_lang : True [2023/11/12 01:54:24] ppocr INFO: Transform : None [2023/11/12 01:54:24] ppocr INFO: algorithm : ABINet [2023/11/12 01:54:24] ppocr INFO: in_channels : 3 [2023/11/12 01:54:24] ppocr INFO: model_type : rec [2023/11/12 01:54:24] ppocr INFO: Eval : [2023/11/12 01:54:24] ppocr INFO: dataset : [2023/11/12 01:54:24] ppocr INFO: data_dir : /content/Synthetic_Data/ [2023/11/12 01:54:24] ppocr INFO: label_file_list : ['/content/drive/MyDrive/synthetic_label/val.txt'] [2023/11/12 01:54:24] ppocr INFO: name : SimpleDataSet [2023/11/12 01:54:24] ppocr INFO: transforms : [2023/11/12 01:54:24] ppocr INFO: DecodeImage : [2023/11/12 01:54:24] ppocr INFO: channel_first : False [2023/11/12 01:54:24] ppocr INFO: img_mode : RGB [2023/11/12 01:54:24] ppocr INFO: ABINetLabelEncode : [2023/11/12 01:54:24] ppocr INFO: ignore_index : 100 [2023/11/12 01:54:24] ppocr INFO: ABINetRecResizeImg : [2023/11/12 01:54:24] ppocr INFO: image_shape : [3, 32, 128] [2023/11/12 01:54:24] ppocr INFO: KeepKeys : [2023/11/12 01:54:24] ppocr INFO: keep_keys : ['image', 'label', 'length'] [2023/11/12 01:54:24] ppocr INFO: loader : [2023/11/12 01:54:24] ppocr INFO: batch_size_per_card : 256 [2023/11/12 01:54:24] ppocr INFO: drop_last : False [2023/11/12 01:54:24] ppocr INFO: num_workers : 4 [2023/11/12 01:54:24] ppocr INFO: shuffle : False [2023/11/12 01:54:24] ppocr INFO: use_shared_memory : False [2023/11/12 01:54:24] ppocr INFO: Global : [2023/11/12 01:54:24] ppocr INFO: cal_metric_during_train : True [2023/11/12 01:54:24] ppocr INFO: character_dict_path : ppocr/utils/dict/vi_dict.txt [2023/11/12 01:54:24] ppocr INFO: character_type : en [2023/11/12 01:54:24] ppocr INFO: checkpoints : None [2023/11/12 01:54:24] ppocr INFO: distributed : False [2023/11/12 01:54:24] ppocr INFO: epoch_num : 80 [2023/11/12 01:54:24] ppocr INFO: eval_batch_step : [0, 2000] [2023/11/12 01:54:24] ppocr INFO: infer_img : doc/imgs_words_en/word_10.png [2023/11/12 01:54:24] ppocr INFO: infer_mode : False [2023/11/12 01:54:24] ppocr INFO: log_smooth_window : 20 [2023/11/12 01:54:24] ppocr INFO: max_text_length : 100 [2023/11/12 01:54:24] ppocr INFO: pretrained_model : None [2023/11/12 01:54:24] ppocr INFO: print_batch_step : 10 [2023/11/12 01:54:24] ppocr INFO: save_epoch_step : 1 [2023/11/12 01:54:24] ppocr INFO: save_inference_dir : None [2023/11/12 01:54:24] ppocr INFO: save_model_dir : /content/drive/MyDrive/output/rec/rec_r45_abinet/ [2023/11/12 01:54:24] ppocr INFO: save_res_path : ./output/rec/predict.txt [2023/11/12 01:54:24] ppocr INFO: use_gpu : True [2023/11/12 01:54:24] ppocr INFO: use_space_char : True [2023/11/12 01:54:24] ppocr INFO: use_visualdl : False [2023/11/12 01:54:24] ppocr INFO: Loss : [2023/11/12 01:54:24] ppocr INFO: ignore_index : 100 [2023/11/12 01:54:24] ppocr INFO: name : CELoss [2023/11/12 01:54:24] ppocr INFO: Metric : [2023/11/12 01:54:24] ppocr INFO: main_indicator : acc [2023/11/12 01:54:24] ppocr INFO: name : RecMetric [2023/11/12 01:54:24] ppocr INFO: Optimizer : [2023/11/12 01:54:24] ppocr INFO: beta1 : 0.9 [2023/11/12 01:54:24] ppocr INFO: beta2 : 0.99 [2023/11/12 01:54:24] ppocr INFO: clip_norm : 20.0 [2023/11/12 01:54:24] ppocr INFO: lr : [2023/11/12 01:54:24] ppocr INFO: decay_epochs : [6] [2023/11/12 01:54:24] ppocr INFO: name : Piecewise [2023/11/12 01:54:24] ppocr INFO: values : [0.0001, 1e-05] [2023/11/12 01:54:24] ppocr INFO: name : Adam [2023/11/12 01:54:24] ppocr INFO: regularizer : [2023/11/12 01:54:24] ppocr INFO: factor : 0.0 [2023/11/12 01:54:24] ppocr INFO: name : L2 [2023/11/12 01:54:24] ppocr INFO: PostProcess : [2023/11/12 01:54:24] ppocr INFO: name : ABINetLabelDecode [2023/11/12 01:54:24] ppocr INFO: Train : [2023/11/12 01:54:24] ppocr INFO: dataset : [2023/11/12 01:54:24] ppocr INFO: data_dir : /content/Synthetic_Data/ [2023/11/12 01:54:24] ppocr INFO: label_file_list : ['/content/drive/MyDrive/synthetic_label/train.txt'] [2023/11/12 01:54:24] ppocr INFO: name : SimpleDataSet [2023/11/12 01:54:24] ppocr INFO: transforms : [2023/11/12 01:54:24] ppocr INFO: DecodeImage : [2023/11/12 01:54:24] ppocr INFO: channel_first : False [2023/11/12 01:54:24] ppocr INFO: img_mode : RGB [2023/11/12 01:54:24] ppocr INFO: ABINetRecAug : None [2023/11/12 01:54:24] ppocr INFO: ABINetLabelEncode : [2023/11/12 01:54:24] ppocr INFO: ignore_index : 100 [2023/11/12 01:54:24] ppocr INFO: ABINetRecResizeImg : [2023/11/12 01:54:24] ppocr INFO: image_shape : [3, 32, 128] [2023/11/12 01:54:24] ppocr INFO: KeepKeys : [2023/11/12 01:54:24] ppocr INFO: keep_keys : ['image', 'label', 'length'] [2023/11/12 01:54:24] ppocr INFO: loader : [2023/11/12 01:54:24] ppocr INFO: batch_size_per_card : 256 [2023/11/12 01:54:24] ppocr INFO: drop_last : True [2023/11/12 01:54:24] ppocr INFO: num_workers : 4 [2023/11/12 01:54:24] ppocr INFO: shuffle : True [2023/11/12 01:54:24] ppocr INFO: profiler_options : None [2023/11/12 01:54:24] ppocr INFO: train with paddle 2.5.2 and device Place(gpu:0) [2023/11/12 01:54:24] ppocr INFO: Initialize indexs of datasets:['/content/drive/MyDrive/synthetic_label/train.txt'] list index out of range [2023/11/12 01:54:24] ppocr INFO: Initialize indexs of datasets:['/content/drive/MyDrive/synthetic_label/val.txt'] W1112 01:54:24.818734 4108 gpu_resources.cc:119] Please NOTE: device: 0, GPU Compute Capability: 7.5, Driver API Version: 12.0, Runtime API Version: 11.8 W1112 01:54:24.841948 4108 gpu_resources.cc:149] device: 0, cuDNN Version: 8.9. [2023/11/12 01:54:27] ppocr INFO: train dataloader has 312 iters [2023/11/12 01:54:27] ppocr INFO: valid dataloader has 79 iters [2023/11/12 01:54:27] ppocr INFO: train from scratch [2023/11/12 01:54:27] ppocr INFO: During the training process, after the 0th iteration, an evaluation is run every 2000 iterations Traceback (most recent call last): File "/content/PaddleOCR/tools/train.py", line 227, in main(config, device, logger, vdl_writer) File "/content/PaddleOCR/tools/train.py", line 198, in main program.train(config, train_dataloader, valid_dataloader, device, model, File "/content/PaddleOCR/tools/program.py", line 307, in train preds = model(images) File "/usr/local/lib/python3.10/dist-packages/paddle/nn/layer/layers.py", line 1254, in call return self.forward(*inputs, kwargs) File "/content/PaddleOCR/ppocr/modeling/architectures/base_model.py", line 100, in forward x = self.head(x, targets=data) File "/usr/local/lib/python3.10/dist-packages/paddle/nn/layer/layers.py", line 1254, in call return self.forward(*inputs, *kwargs) File "/content/PaddleOCR/ppocr/modeling/heads/rec_abinet_head.py", line 224, in forward feature = self.pos_encoder(feature) File "/usr/local/lib/python3.10/dist-packages/paddle/nn/layer/layers.py", line 1254, in call return self.forward(inputs, kwargs) File "/content/PaddleOCR/ppocr/modeling/heads/rec_nrtr_head.py", line 505, in forward x = x + self.pe[:paddle.shape(x)[0], :] ValueError: (InvalidArgument) Broadcast dimension mismatch. Operands could not be broadcast together with the shape of X = [32, 256, 480] and the shape of Y = [32, 1, 512]. Received [480] in X is not equal to [512] in Y at i:2. [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 ../paddle/phi/kernels/funcs/common_shape.h:86)

dat080399 commented 7 months ago

How to fix @VanQuyen02 ?