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
44.54k stars 7.85k forks source link

Paddleocr Training - AssertionError: The None.pdparams does not exists! #14248

Open brookscar opened 6 days ago

brookscar commented 6 days ago

๐Ÿ”Ž Search before asking

๐Ÿ› Bug (้—ฎ้ข˜ๆ่ฟฐ)

Trying to train a model based off of a custom image set, have set up dataset > eval , train folders and used path in config. I keep getting the error:

Traceback (most recent call last): File "/home/OCRServer/OCR/PaddleOCR/tools/train.py", line 269, in main(config, device, logger, vdl_writer, seed) File "/home/OCRServer/OCR/PaddleOCR/tools/train.py", line 215, in main pre_best_model_dict = load_model( File "/home/OCRServer/OCR/PaddleOCR/ppocr/utils/save_load.py", line 95, in load_model assert os.path.exists( AssertionError: The None.pdparams does not exists!

I also tried using the pretrained en_PP-OCRv3_det_slim_distill_train best_recall.pdparams as a pretrained model to get around the issue and it still did not work.

Config file below: Global: debug: true use_gpu: false # Change to true if using GPU is_float16: true epoch_num: 200 log_smooth_window: 20 print_batch_step: 10 save_model_dir: ./output/det_ppocr_v4 save_epoch_step: 10 eval_batch_step: [0, 2000] cal_metric_during_train: true pretrained_model: '/home/OCRServer/en_PP-OCRv3_det_slim_distill_train/best_recall.pdparams' # Path to pretrained model checkpoints: None save_inference_dir: None use_visualdl: false infer_img: doc/imgs_words/ch/word_1.jpg distributed: true save_res_path: ./output/det/predicts_ppocrv3.txt

Optimizer: name: Adam beta1: 0.9 beta2: 0.999 lr: name: Cosine learning_rate: 0.001 warmup_epoch: 5 regularizer: name: L2 factor: 3.0e-05

Architecture: model_type: det # Text detection model type algorithm: DB # Use 'DB' for DBNet (common for detection tasks) Backbone: name: MobileNetV3 Neck: name: DBFPN out_channels: 256 Head: name: DBHead out_channels: 2 k: 50

Loss: name: DBLoss # Change to DBLoss for DBNet balance_loss: true main_loss_type: DiceLoss alpha: 5.0 beta: 10.0 ohem_ratio: 3

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

Metric: name: DetMetric main_indicator: hmean

Train: dataset: name: SimpleDataSet data_dir: /home/OCRServer/OCR/dataset/train/test_images label_file_list:

Eval: dataset: name: SimpleDataSet data_dir: /home/OCRServer/OCR/dataset/eval/images label_file_list:

๐Ÿƒโ€โ™‚๏ธ Environment (่ฟ่กŒ็Žฏๅขƒ)

Ubuntu 22.04.5 LTS, Python 3.10.12, paddleocr 2.9.1, paddlepaddle 2.6.2

๐ŸŒฐ Minimal Reproducible Example (ๆœ€ๅฐๅฏๅค็Žฐ้—ฎ้ข˜็š„Demo)

python PaddleOCR/tools/train.py -c dataset/flightrec_config.yml

GreatV commented 5 days ago

The error might be caused by an incorrect checkpoints configuration. Since you have set:

checkpoints: None

Make sure this is correct. If you are resuming training from a checkpoint, this should point to the .pdparams file of the checkpoint. Otherwise, keep it as null.

brookscar commented 5 days ago

The error might be caused by an incorrect checkpoints configuration. Since you have set:

checkpoints: None

Make sure this is correct. If you are resuming training from a checkpoint, this should point to the .pdparams file of the checkpoint. Otherwise, keep it as null.

I have been trying to train the model off of custom image set and did not use a pretrained model or use checkpoints, so I set them to 'None'. This seems to be the issue, but do not know why I would get the Assertion error when I have set both parameters 'None'.