Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
3 tasks done
brookscar opened this issue Nov 19, 2024 · 2 comments
Open
3 tasks done

Comments

@brookscar
Copy link

🔎 Search before asking

  • I have searched the PaddleOCR Docs and found no similar bug report.
  • I have searched the PaddleOCR Issues and found no similar bug report.
  • I have searched the PaddleOCR Discussions and found no similar bug report.

🐛 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:
- /home/OCRServer/OCR/dataset/train_list.txt
transforms:
- DecodeImage:
img_mode: BGR
channel_first: false
- DetLabelEncode: {}
- DetResizeForTest:
image_shape: [640, 640] # Resize image for detection
- KeepKeys:
keep_keys:
- image
- shape
- polygons
- ignore_tags
loader:
shuffle: true
batch_size_per_card: 16 # Adjust based on available resources
drop_last: true
num_workers: 8

Eval:
dataset:
name: SimpleDataSet
data_dir: /home/OCRServer/OCR/dataset/eval/images
label_file_list:
- /home/OCRServer/OCR/dataset/eval_list.txt
transforms:
- DecodeImage:
img_mode: BGR
channel_first: false
- DetLabelEncode: {}
- DetResizeForTest:
image_shape: [640, 640]
- KeepKeys:
keep_keys:
- image
- shape
- polygons
- ignore_tags
loader:
shuffle: false
drop_last: false
batch_size_per_card: 16
num_workers: 4

🏃‍♂️ 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
Copy link
Collaborator

GreatV commented Nov 21, 2024

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
Copy link
Author

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'.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants