Do not create .pdmodel file when exporting trained model with python tools/export_model.py #15495
-
Hello, I decided to try to retrain the finished en_PP-OCRv4-rec model on a small dataset. I used a simple guide for retraining via tools/train.py. Everything went well, but for some reason after exporting the model, I don't have the pdmodel file. At the same time, the logs say that the model is saved to the directory, but it is nowhere to be found. python tools\export_model.py -c "C:\Users\Andrew\anaconda3\envs\train\Lib\site-packages\PaddleOCR\output\rec_ppocr_v4\config.yml" -o Global.pretrained_model="C:\Users\Andrew\anaconda3\envs\train\Lib\site-packages\PaddleOCR\output\rec_ppocr_v4\latest.pdparams" Global.save_inference_dir="C:\Users\Andrew\anaconda3\envs\train\Lib\site-packages\PaddleOCR\output" as you can see on screen there is no .pdmodel file here. What im doing wrong? Global:
debug: false
use_gpu: true
epoch_num: 50
log_smooth_window: 20
print_batch_step: 10
save_model_dir: ./output/rec_ppocr_v4
save_epoch_step: 10
eval_batch_step:
- 0
- 2000
cal_metric_during_train: true
pretrained_model: C:/Users/Andrew/anaconda3/envs/train/Lib/site-packages/PaddleOCR/pretrain_model/en_PP-OCRv4_rec_train/best_accuracy
checkpoints: null
save_inference_dir: null
use_visualdl: false
infer_img: doc/imgs_words/ch/word_1.jpg
character_dict_path: ppocr/utils/en_dict.txt
max_text_length: 25
infer_mode: false
use_space_char: true
distributed: true
save_res_path: ./output/rec/predicts_ppocrv4.txt
Optimizer:
name: Adam
beta1: 0.9
beta2: 0.999
lr:
name: Cosine
learning_rate: 0.0005
warmup_epoch: 5
regularizer:
name: L2
factor: 3.0e-05
Architecture:
model_type: rec
algorithm: SVTR_LCNet
Transform: null
Backbone:
name: PPLCNetV3
scale: 0.95
Head:
name: MultiHead
head_list:
- CTCHead:
Neck:
name: svtr
dims: 120
depth: 2
hidden_dims: 120
kernel_size:
- 1
- 3
use_guide: true
Head:
fc_decay: 1.0e-05
- NRTRHead:
nrtr_dim: 384
max_text_length: 25
Loss:
name: MultiLoss
loss_config_list:
- CTCLoss: null
- NRTRLoss: null
PostProcess:
name: CTCLabelDecode
Metric:
name: RecMetric
main_indicator: acc
ignore_space: false
Train:
dataset:
name: MultiScaleDataSet
ds_width: false
data_dir: C:/Users/Andrew/anaconda3/envs/train/Lib/site-packages/PaddleOCR/pretrain_model/train_data
ext_op_transform_idx: 1
label_file_list:
- C:/Users/Andrew/anaconda3/envs/train/Lib/site-packages/PaddleOCR/pretrain_model/train_data/train_list.txt
transforms:
- DecodeImage:
img_mode: BGR
channel_first: false
- RecConAug:
prob: 0.5
ext_data_num: 2
image_shape:
- 48
- 320
- 3
max_text_length: 25
- RecAug: null
- MultiLabelEncode:
gtc_encode: NRTRLabelEncode
- KeepKeys:
keep_keys:
- image
- label_ctc
- label_gtc
- length
- valid_ratio
sampler:
name: MultiScaleSampler
scales:
- - 320
- 32
- - 320
- 48
- - 320
- 64
first_bs: 96
fix_bs: false
divided_factor:
- 8
- 16
is_training: true
loader:
shuffle: true
batch_size_per_card: 23
drop_last: true
num_workers: 8
Eval:
dataset:
name: SimpleDataSet
data_dir: C:/Users/Andrew/anaconda3/envs/train/Lib/site-packages/PaddleOCR/pretrain_model/train_data
label_file_list:
- C:/Users/Andrew/anaconda3/envs/train/Lib/site-packages/PaddleOCR/pretrain_model/train_data/val_list.txt
transforms:
- DecodeImage:
img_mode: BGR
channel_first: false
- MultiLabelEncode:
gtc_encode: NRTRLabelEncode
- RecResizeImg:
image_shape:
- 3
- 48
- 320
- KeepKeys:
keep_keys:
- image
- label_ctc
- label_gtc
- length
- valid_ratio
loader:
shuffle: false
drop_last: false
batch_size_per_card: 23
num_workers: 4
profiler_options: null |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
Hello, it’s correct that there’s no output for pdmodel. By default, Paddle 3.0 exports models in the JSON format, and JSON models do not include a pdmodel, but they can still be loaded and used normally. If you want to export in the pdmodel format, you can try using the following command: |
Beta Was this translation helpful? Give feedback.
Hello, it’s correct that there’s no output for pdmodel. By default, Paddle 3.0 exports models in the JSON format, and JSON models do not include a pdmodel, but they can still be loaded and used normally. If you want to export in the pdmodel format, you can try using the following command:
export FLAGS_enable_pir_api=0
python tools/export_model.py -c "C:\Users\Andrew\anaconda3\envs\train\Lib\site-packages\PaddleOCR\output\rec_ppocr_v4\config.yml" -o Global.pretrained_model="C:\Users\Andrew\anaconda3\envs\train\Lib\site-packages\PaddleOCR\output\rec_ppocr_v4\latest.pdparams" Global.export_with_pir=False