PaddleOCR icon indicating copy to clipboard operation
PaddleOCR copied to clipboard

无法使用ch_PP-OCRv3_det_student.yml进行训练

Open LUOQING1994 opened this issue 2 years ago • 1 comments

请提供下述完整信息以便快速定位问题/Please provide the following information to quickly locate the problem

  • 系统环境/System Environment:ubentu 18.04
  • 版本号/Version:Paddle:2.3.2 gpu版本 PaddleOCR: 2.6 问题相关组件/Related components:ch_PP-OCRv3_det_student.yml
  • 运行指令/Command Code: 参考此处 进行的复现 python3 tools/train.py -c configs/det/ch_PP-OCRv3/ch_PP-OCRv3_det_student.yml 其中,数据集使用paddleLabel标注,并使用gen_ocr_train_val_test.py脚本进行数据集划分
  • 完整报错/Complete Error Message: [2022/11/01 20:08:24] ppocr INFO: Architecture : [2022/11/01 20:08:24] ppocr INFO: Backbone : [2022/11/01 20:08:24] ppocr INFO: disable_se : True [2022/11/01 20:08:24] ppocr INFO: model_name : large [2022/11/01 20:08:24] ppocr INFO: name : MobileNetV3 [2022/11/01 20:08:24] ppocr INFO: scale : 0.5 [2022/11/01 20:08:24] ppocr INFO: Head : [2022/11/01 20:08:24] ppocr INFO: k : 50 [2022/11/01 20:08:24] ppocr INFO: name : DBHead [2022/11/01 20:08:24] ppocr INFO: Neck : [2022/11/01 20:08:24] ppocr INFO: name : RSEFPN [2022/11/01 20:08:24] ppocr INFO: out_channels : 96 [2022/11/01 20:08:24] ppocr INFO: shortcut : True [2022/11/01 20:08:24] ppocr INFO: Transform : None [2022/11/01 20:08:24] ppocr INFO: algorithm : DB [2022/11/01 20:08:24] ppocr INFO: model_type : det [2022/11/01 20:08:24] ppocr INFO: Eval : [2022/11/01 20:08:24] ppocr INFO: dataset : [2022/11/01 20:08:24] ppocr INFO: data_dir : /home/ysq/Public/PaddleOCR/train_data/ [2022/11/01 20:08:24] ppocr INFO: label_file_list : ['/home/ysq/Public/PaddleOCR/train_data/det/test.txt'] [2022/11/01 20:08:24] ppocr INFO: name : SimpleDataSet [2022/11/01 20:08:24] ppocr INFO: transforms : [2022/11/01 20:08:24] ppocr INFO: DecodeImage : [2022/11/01 20:08:24] ppocr INFO: channel_first : False [2022/11/01 20:08:24] ppocr INFO: img_mode : BGR [2022/11/01 20:08:24] ppocr INFO: DetLabelEncode : None [2022/11/01 20:08:24] ppocr INFO: DetResizeForTest : None [2022/11/01 20:08:24] ppocr INFO: NormalizeImage : [2022/11/01 20:08:24] ppocr INFO: mean : [0.485, 0.456, 0.406] [2022/11/01 20:08:24] ppocr INFO: order : hwc [2022/11/01 20:08:24] ppocr INFO: scale : 1./255. [2022/11/01 20:08:24] ppocr INFO: std : [0.229, 0.224, 0.225] [2022/11/01 20:08:24] ppocr INFO: ToCHWImage : None [2022/11/01 20:08:24] ppocr INFO: KeepKeys : [2022/11/01 20:08:24] ppocr INFO: keep_keys : ['image', 'shape', 'polys', 'ignore_tags'] [2022/11/01 20:08:24] ppocr INFO: loader : [2022/11/01 20:08:24] ppocr INFO: batch_size_per_card : 1 [2022/11/01 20:08:24] ppocr INFO: drop_last : False [2022/11/01 20:08:24] ppocr INFO: num_workers : 2 [2022/11/01 20:08:24] ppocr INFO: shuffle : False [2022/11/01 20:08:24] ppocr INFO: Global : [2022/11/01 20:08:24] ppocr INFO: cal_metric_during_train : False [2022/11/01 20:08:24] ppocr INFO: checkpoints : None [2022/11/01 20:08:24] ppocr INFO: debug : False [2022/11/01 20:08:24] ppocr INFO: distributed : False [2022/11/01 20:08:24] ppocr INFO: epoch_num : 100 [2022/11/01 20:08:24] ppocr INFO: eval_batch_step : [0, 10] [2022/11/01 20:08:24] ppocr INFO: infer_img : doc/imgs_en/img_10.jpg [2022/11/01 20:08:24] ppocr INFO: log_smooth_window : 20 [2022/11/01 20:08:24] ppocr INFO: pretrained_model : None [2022/11/01 20:08:24] ppocr INFO: print_batch_step : 10 [2022/11/01 20:08:24] ppocr INFO: save_epoch_step : 10 [2022/11/01 20:08:24] ppocr INFO: save_inference_dir : None [2022/11/01 20:08:24] ppocr INFO: save_model_dir : ./output/ch_PP-OCR_V3_det/ [2022/11/01 20:08:24] ppocr INFO: save_res_path : ./checkpoints/det_db/predicts_db.txt [2022/11/01 20:08:24] ppocr INFO: use_gpu : True [2022/11/01 20:08:24] ppocr INFO: use_visualdl : False [2022/11/01 20:08:24] ppocr INFO: Loss : [2022/11/01 20:08:24] ppocr INFO: alpha : 5 [2022/11/01 20:08:24] ppocr INFO: balance_loss : True [2022/11/01 20:08:24] ppocr INFO: beta : 10 [2022/11/01 20:08:24] ppocr INFO: main_loss_type : DiceLoss [2022/11/01 20:08:24] ppocr INFO: name : DBLoss [2022/11/01 20:08:24] ppocr INFO: ohem_ratio : 3 [2022/11/01 20:08:24] ppocr INFO: Metric : [2022/11/01 20:08:24] ppocr INFO: main_indicator : hmean [2022/11/01 20:08:24] ppocr INFO: name : DetMetric [2022/11/01 20:08:24] ppocr INFO: Optimizer : [2022/11/01 20:08:24] ppocr INFO: beta1 : 0.9 [2022/11/01 20:08:24] ppocr INFO: beta2 : 0.999 [2022/11/01 20:08:24] ppocr INFO: lr : [2022/11/01 20:08:24] ppocr INFO: learning_rate : 0.0005 [2022/11/01 20:08:24] ppocr INFO: name : Cosine [2022/11/01 20:08:24] ppocr INFO: warmup_epoch : 2 [2022/11/01 20:08:24] ppocr INFO: name : Adam [2022/11/01 20:08:24] ppocr INFO: regularizer : [2022/11/01 20:08:24] ppocr INFO: factor : 5e-05 [2022/11/01 20:08:24] ppocr INFO: name : L2 [2022/11/01 20:08:24] ppocr INFO: PostProcess : [2022/11/01 20:08:24] ppocr INFO: box_thresh : 0.6 [2022/11/01 20:08:24] ppocr INFO: max_candidates : 1000 [2022/11/01 20:08:24] ppocr INFO: name : DBPostProcess [2022/11/01 20:08:24] ppocr INFO: thresh : 0.3 [2022/11/01 20:08:24] ppocr INFO: unclip_ratio : 1.5 [2022/11/01 20:08:24] ppocr INFO: Train : [2022/11/01 20:08:24] ppocr INFO: dataset : [2022/11/01 20:08:24] ppocr INFO: data_dir : /home/ysq/Public/PaddleOCR/train_data/ [2022/11/01 20:08:24] ppocr INFO: label_file_list : ['/home/ysq/Public/PaddleOCR/train_data/det/train.txt'] [2022/11/01 20:08:24] ppocr INFO: name : SimpleDataSet [2022/11/01 20:08:24] ppocr INFO: ratio_list : [1.0] [2022/11/01 20:08:24] ppocr INFO: transforms : [2022/11/01 20:08:24] ppocr INFO: DecodeImage : [2022/11/01 20:08:24] ppocr INFO: channel_first : False [2022/11/01 20:08:24] ppocr INFO: img_mode : BGR [2022/11/01 20:08:24] ppocr INFO: DetLabelEncode : None [2022/11/01 20:08:24] ppocr INFO: IaaAugment : [2022/11/01 20:08:24] ppocr INFO: augmenter_args : [2022/11/01 20:08:24] ppocr INFO: args : [2022/11/01 20:08:24] ppocr INFO: p : 0.5 [2022/11/01 20:08:24] ppocr INFO: type : Fliplr [2022/11/01 20:08:24] ppocr INFO: args : [2022/11/01 20:08:24] ppocr INFO: rotate : [-10, 10] [2022/11/01 20:08:24] ppocr INFO: type : Affine [2022/11/01 20:08:24] ppocr INFO: args : [2022/11/01 20:08:24] ppocr INFO: size : [0.5, 3] [2022/11/01 20:08:24] ppocr INFO: type : Resize [2022/11/01 20:08:24] ppocr INFO: EastRandomCropData : [2022/11/01 20:08:24] ppocr INFO: keep_ratio : True [2022/11/01 20:08:24] ppocr INFO: max_tries : 50 [2022/11/01 20:08:24] ppocr INFO: size : [960, 960] [2022/11/01 20:08:24] ppocr INFO: MakeBorderMap : [2022/11/01 20:08:24] ppocr INFO: shrink_ratio : 0.4 [2022/11/01 20:08:24] ppocr INFO: thresh_max : 0.7 [2022/11/01 20:08:24] ppocr INFO: thresh_min : 0.3 [2022/11/01 20:08:24] ppocr INFO: MakeShrinkMap : [2022/11/01 20:08:24] ppocr INFO: min_text_size : 8 [2022/11/01 20:08:24] ppocr INFO: shrink_ratio : 0.4 [2022/11/01 20:08:24] ppocr INFO: NormalizeImage : [2022/11/01 20:08:24] ppocr INFO: mean : [0.485, 0.456, 0.406] [2022/11/01 20:08:24] ppocr INFO: order : hwc [2022/11/01 20:08:24] ppocr INFO: scale : 1./255. [2022/11/01 20:08:24] ppocr INFO: std : [0.229, 0.224, 0.225] [2022/11/01 20:08:24] ppocr INFO: ToCHWImage : None [2022/11/01 20:08:24] ppocr INFO: KeepKeys : [2022/11/01 20:08:24] ppocr INFO: keep_keys : ['image', 'threshold_map', 'threshold_mask', 'shrink_map', 'shrink_mask'] [2022/11/01 20:08:24] ppocr INFO: loader : [2022/11/01 20:08:24] ppocr INFO: batch_size_per_card : 1 [2022/11/01 20:08:24] ppocr INFO: drop_last : False [2022/11/01 20:08:24] ppocr INFO: num_workers : 2 [2022/11/01 20:08:24] ppocr INFO: shuffle : True [2022/11/01 20:08:24] ppocr INFO: profiler_options : None [2022/11/01 20:08:24] ppocr INFO: train with paddle 2.3.2 and device Place(gpu:0) [2022/11/01 20:08:24] ppocr INFO: Initialize indexs of datasets:['/home/ysq/Public/PaddleOCR/train_data/det/train.txt'] [2022/11/01 20:08:24] ppocr INFO: Initialize indexs of datasets:['/home/ysq/Public/PaddleOCR/train_data/det/test.txt'] W1101 20:08:24.671679 5430 gpu_resources.cc:61] Please NOTE: device: 0, GPU Compute Capability: 8.6, Driver API Version: 11.6, Runtime API Version: 10.2 W1101 20:08:24.674626 5430 gpu_resources.cc:91] device: 0, cuDNN Version: 8.4. [2022/11/01 20:08:24] ppocr INFO: train dataloader has 6 iters [2022/11/01 20:08:24] ppocr INFO: valid dataloader has 2 iters [2022/11/01 20:08:24] ppocr INFO: train from scratch [2022/11/01 20:08:24] ppocr INFO: During the training process, after the 0th iteration, an evaluation is run every 10 iterations Traceback (most recent call last): File "tools/train.py", line 208, in main(config, device, logger, vdl_writer) File "tools/train.py", line 183, in main amp_level, amp_custom_black_list) File "/home/ysq/Public/PaddleOCR/tools/program.py", line 295, in train loss = loss_class(preds, batch) File "/home/ysq/anaconda3/envs/python3/lib/python3.7/site-packages/paddle/fluid/dygraph/layers.py", line 930, in call return self._dygraph_call_func(*inputs, **kwargs) File "/home/ysq/anaconda3/envs/python3/lib/python3.7/site-packages/paddle/fluid/dygraph/layers.py", line 915, in _dygraph_call_func outputs = self.forward(*inputs, **kwargs) File "/home/ysq/Public/PaddleOCR/ppocr/losses/det_db_loss.py", line 62, in forward label_shrink_mask) File "/home/ysq/anaconda3/envs/python3/lib/python3.7/site-packages/paddle/fluid/dygraph/layers.py", line 930, in call return self._dygraph_call_func(*inputs, **kwargs) File "/home/ysq/anaconda3/envs/python3/lib/python3.7/site-packages/paddle/fluid/dygraph/layers.py", line 915, in _dygraph_call_func outputs = self.forward(*inputs, **kwargs) File "/home/ysq/Public/PaddleOCR/ppocr/losses/det_basic_loss.py", line 87, in forward loss = self.loss(pred, gt, mask=mask) File "/home/ysq/anaconda3/envs/python3/lib/python3.7/site-packages/paddle/fluid/dygraph/layers.py", line 930, in call return self._dygraph_call_func(*inputs, **kwargs) File "/home/ysq/anaconda3/envs/python3/lib/python3.7/site-packages/paddle/fluid/dygraph/layers.py", line 915, in _dygraph_call_func outputs = self.forward(*inputs, **kwargs) File "/home/ysq/Public/PaddleOCR/ppocr/losses/det_basic_loss.py", line 128, in forward assert loss <= 1 AssertionError

LUOQING1994 avatar Nov 01 '22 12:11 LUOQING1994

检查用你的数据为什么会出现 loss>1的情况 https://github.com/PaddlePaddle/PaddleOCR/blob/5f06a8068eed3e1755b8ca56004cd46c95ac268d/ppocr/losses/det_basic_loss.py#L128

LDOUBLEV avatar Nov 04 '22 06:11 LDOUBLEV