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.9k stars 7.8k forks source link

当我在aistudio上进行模型训练时出现了这样一个错误,有人知道怎么解决吗? #3459

Closed haohao2233 closed 2 years ago

haohao2233 commented 3 years ago

这个是aistudio里面的一个项目,我准备学习一下,希望有人能解答一下,谢谢。 /home/aistudio/work/PaddleOCR 2021-07-28 21:26:43,177-INFO: {'Global': {'debug': False, 'algorithm': 'CRNN', 'use_gpu': False, 'epoch_num': 1000, 'log_smooth_window': 20, 'print_batch_step': 10, 'save_model_dir': './output/rec_CRNN', 'save_epoch_step': 3, 'eval_batch_step': 100, 'train_batch_size_per_card': 128, 'test_batch_size_per_card': 128, 'image_shape': [3, 32, 320], 'max_text_length': 128, 'character_type': 'ch', 'character_dict_path': '../../data/vocab.txt', 'loss_type': 'ctc', 'distort': True, 'use_space_char': False, 'reader_yml': './configs/rec/rec_chinese_reader.yml', 'pretrain_weights': './pretrain_models/ch_rec_r34_vd_crnn/best_accuracy', 'checkpoints': './output/rec_CRNN/best_accuracy', 'save_inference_dir': None, 'infer_img': None}, 'Architecture': {'function': 'ppocr.modeling.architectures.rec_model,RecModel'}, 'Backbone': {'function': 'ppocr.modeling.backbones.rec_resnet_vd,ResNet', 'layers': 34}, 'Head': {'function': 'ppocr.modeling.heads.rec_ctc_head,CTCPredict', 'encoder_type': 'rnn', 'SeqRNN': {'hidden_size': 256}}, 'Loss': {'function': 'ppocr.modeling.losses.rec_ctc_loss,CTCLoss'}, 'Optimizer': {'function': 'ppocr.optimizer,AdamDecay', 'base_lr': 0.0005, 'beta1': 0.9, 'beta2': 0.999, 'decay': {'function': 'piecewise_decay', 'boundaries': [50000, 90000, 150000], 'decay_rate': 0.1}}, 'TrainReader': {'reader_function': 'ppocr.data.rec.dataset_traversal,SimpleReader', 'num_workers': 8, 'img_set_dir': '../../data', 'label_file_path': '../../data/train.txt'}, 'EvalReader': {'reader_function': 'ppocr.data.rec.dataset_traversal,SimpleReader', 'img_set_dir': '../../data', 'label_file_path': '../../data/dev.txt'}, 'TestReader': {'reader_function': 'ppocr.data.rec.dataset_traversal,SimpleReader'}} 2021-07-28 21:26:43,516-INFO: If regularizer of a Parameter has been set by 'fluid.ParamAttr' or 'fluid.WeightNormParamAttr' already. The Regularization[L2Decay, regularization_coeff=0.000000] in Optimizer will not take effect, and it will only be applied to other Parameters! 2021-07-28 21:26:44,288-INFO: Distort operation can only support in GPU.Distort will be set to False. 2021-07-28 21:26:44,288-INFO: places would be ommited when DataLoader is not iterable 2021-07-28 21:26:44,288-INFO: Distort operation can only support in GPU.Distort will be set to False. Traceback (most recent call last): File "tools/train.py", line 127, in main() File "tools/train.py", line 84, in main init_model(config, train_program, exe) File "/home/aistudio/work/PaddleOCR/ppocr/utils/save_load.py", line 114, in init_model fluid.load(program, path, exe) File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/fluid/io.py", line 1787, in load v.name, opt_file_name) AssertionError: Can not find [@LR_DECAY_COUNTER@] in model file [./output/rec_CRNN/best_accuracy.pdopt]

下面这个是我的环境: aistudio@jupyter-880330-2228913:~$ pip list Package Version


absl-py 0.8.1
aspy.yaml 1.3.0
astor 0.8.1
astroid 2.4.1
attrs 19.2.0
audioread 2.1.8
autopep8 1.5.3
Babel 2.8.0
backcall 0.1.0
bce-python-sdk 0.8.53
blackhole 0.3.2
bleach 3.1.0
cachetools 4.0.0
certifi 2019.9.11
cffi 1.14.0
cfgv 2.0.1
chardet 3.0.4
Click 7.0
cloudpickle 1.6.0
cma 2.7.0
colorama 0.4.4
colorlog 4.1.0
cycler 0.10.0
Cython 0.29
datatable 1.0.0a0+build.1606902301.jarvis decorator 4.4.0
easydict 1.9
entrypoints 0.3
et-xmlfile 1.0.1
filelock 3.0.12
flake8 3.8.2
Flask 1.1.1
Flask-Babel 1.0.0
Flask-Cors 3.0.8
forbiddenfruit 0.1.3
funcsigs 1.0.2
future 0.18.0
gast 0.3.3
gitdb 4.0.5
GitPython 3.1.14
google-auth 1.10.0
google-auth-oauthlib 0.4.1
graphviz 0.13
grpcio 1.35.0
gunicorn 20.0.4
gym 0.12.1
h2o 3.29.0.99999
h5py 2.9.0
identify 1.4.10
idna 2.8
imageio 2.6.1
imageio-ffmpeg 0.3.0
imgaug 0.4.0
importlib-metadata 0.23
ipykernel 5.1.0
ipython 7.8.0
ipython-genutils 0.2.0
isort 4.3.21
itsdangerous 1.1.0
jdcal 1.4.1
jedi 0.17.0
jieba 0.42.1
Jinja2 2.10.3
joblib 0.14.1
JPype1 0.7.2
json5 0.9.5
jsonschema 3.1.1
jupyter-client 5.3.4
jupyter-core 4.6.0
jupyter-lsp 0.8.0
jupyterlab 2.1.3
jupyterlab-server 1.1.5
kiwisolver 1.1.0
lazy-object-proxy 1.4.3
librosa 0.7.2
lightgbm 3.1.1
llvmlite 0.31.0
lmdb 1.2.1
Markdown 3.1.1
MarkupSafe 1.1.1
matplotlib 2.2.3
mccabe 0.6.1
mistune 0.8.4
more-itertools 7.2.0
moviepy 1.0.1
nbconvert 5.3.1
nbformat 4.4.0
networkx 2.4
nltk 3.4.5
nodeenv 1.3.4
notebook 5.7.8
numba 0.48.0
numpy 1.16.4
oauthlib 3.1.0
objgraph 3.4.1
opencv-python 4.1.1.26
openpyxl 3.0.5
packaging 20.9
paddlehub 2.0.4
paddlenlp 2.0.0rc7
paddlepaddle 1.8.4
pandas 1.1.5
pandocfilters 1.4.2
parl 1.4.1
parso 0.7.0
pathlib 1.0.1
pexpect 4.7.0
pickleshare 0.7.5
Pillow 7.1.2
pip 19.2.3
pluggy 0.13.1
pre-commit 1.21.0
prettytable 0.7.2
proglog 0.1.9
prometheus-client 0.5.0
prompt-toolkit 2.0.10
protobuf 3.14.0
psutil 5.7.2
ptyprocess 0.6.0
pyarrow 2.0.0
pyasn1 0.4.8
pyasn1-modules 0.2.7
pyclipper 1.3.0
pycodestyle 2.6.0
pycparser 2.19
pycryptodome 3.9.9
pydocstyle 5.0.2
pyflakes 2.2.0
pyglet 1.4.5
Pygments 2.4.2
pylint 2.5.2
pynvml 8.0.4
pyparsing 2.4.2
pyrsistent 0.15.4
python-dateutil 2.8.0
python-jsonrpc-server 0.3.4
python-language-server 0.33.0
pytz 2019.3
PyWavelets 1.1.1
PyYAML 5.1.2
pyzmq 18.1.1
rarfile 3.1
recordio 0.1.7
requests 2.22.0
requests-oauthlib 1.3.0
resampy 0.2.2
rope 0.17.0
rsa 4.0
scikit-image 0.18.2
scikit-learn 0.22.1
scipy 1.3.0
seaborn 0.10.0
Send2Trash 1.5.0
sentencepiece 0.1.85
seqeval 1.2.2
setuptools 41.4.0
Shapely 1.7.1
shellcheck-py 0.7.1.1
six 1.15.0
sklearn 0.0
smmap 3.0.5
snowballstemmer 2.0.0
SoundFile 0.10.3.post1
tabulate 0.8.3
tb-nightly 1.15.0a20190801
tb-paddle 0.3.6
tensorboard 2.1.0
tensorboardX 1.8
termcolor 1.1.0
terminado 0.8.2
testpath 0.4.2
tifffile 2021.7.2
toml 0.10.0
tornado 6.0.3
tqdm 4.36.1
traitlets 4.3.3
typed-ast 1.4.1
ujson 1.35
urllib3 1.25.6
virtualenv 16.7.9
visualdl 2.1.1
wcwidth 0.1.7
webencodings 0.5.1
Werkzeug 0.16.0
wheel 0.33.6
wrapt 1.12.1
xarray 0.16.2
xgboost 1.3.3
xlrd 1.2.0
yapf 0.26.0
zipp 0.6.0

littletomatodonkey commented 3 years ago

checkpoints那个地方的参数去掉,预训练是从prertained model这个参数中加载的

haohao2233 commented 3 years ago

checkpoints那个地方的参数去掉,预训练是从prertained model这个参数中加载的

checkpoints这个地方没写参数。 Global: algorithm: CRNN use_gpu: false epoch_num: 1000 log_smooth_window: 20 print_batch_step: 10 save_model_dir: ./output/rec_CRNN save_epoch_step: 3 eval_batch_step: 100 train_batch_size_per_card: 128 test_batch_size_per_card: 128 image_shape: [3, 32, 320] max_text_length: 128 character_type: ch character_dict_path: ../../data/vocab.txt loss_type: ctc distort: true use_space_char: false reader_yml: ./configs/rec/rec_chinese_reader.yml pretrain_weights: ./pretrain_models/ch_rec_r34_vd_crnn/best_accuracy checkpoints: save_inference_dir: infer_img:

littletomatodonkey commented 3 years ago
6587aacdd78a6b5cf7266b2820e0ea63
haohao2233 commented 3 years ago

@littletomatodonkey 你截图的这个output路径下不是输出的模型吗?我在notebook下不能打开best_accuracy.pdopt这个文件。

haohao2233 commented 3 years ago

有人能解答一下吗?

ioracion commented 3 years ago

checkpoints那个地方的参数去掉,预训练是从prertained model这个参数中加载的

checkpoints这个地方没写参数。 Global: algorithm: CRNN use_gpu: false epoch_num: 1000 log_smooth_window: 20 print_batch_step: 10 save_model_dir: ./output/rec_CRNN save_epoch_step: 3 eval_batch_step: 100 train_batch_size_per_card: 128 test_batch_size_per_card: 128 image_shape: [3, 32, 320] max_text_length: 128 character_type: ch character_dict_path: ../../data/vocab.txt loss_type: ctc distort: true use_space_char: false reader_yml: ./configs/rec/rec_chinese_reader.yml pretrain_weights: ./pretrain_models/ch_rec_r34_vd_crnn/best_accuracy checkpoints: save_inference_dir: infer_img:

没写那你报错的checkpoints': './output/rec_CRNN/best_accuracy' 这个是哪来的

paddle-bot-old[bot] commented 2 years ago

Since you haven\'t replied for more than 3 months, we have closed this issue/pr. If the problem is not solved or there is a follow-up one, please reopen it at any time and we will continue to follow up. It is recommended to pull and try the latest code first. 由于您超过三个月未回复,我们将关闭这个issue/pr。 若问题未解决或有后续问题,请随时重新打开(建议先拉取最新代码进行尝试),我们会继续跟进。