Closed zjykzj closed 4 years ago
it looks probably solved problem by me !!! I try to do something different
$ mv best_accuracy.pdparams .pdparams
$ mv best_accuracy.pdopt .pdopt
$ mv best_accuracy.pdmodel .pdmodel
$ ls -al
total 576188
drwxrwxr-x 2 zj zj 4096 8月 17 11:22 .
drwxrwxr-x 3 zj zj 4096 8月 17 11:08 ..
-rw-r--r-- 1 zj zj 120 6月 10 14:10 ._.DS_Store
-rw-r--r-- 1 zj zj 6148 6月 10 14:10 .DS_Store
-rw-r--r-- 1 zj zj 309172 5月 21 15:47 model
-rw-r--r-- 1 zj zj 109418179 5月 21 15:47 params
-rw-r--r-- 1 zj zj 1002504 5月 20 19:47 .pdmodel
-rw-r--r-- 1 zj zj 314376719 5月 20 19:47 .pdopt
-rw-r--r-- 1 zj zj 164864866 5月 20 19:47 .pdparams
then everything is fine, the program works
$ CUDA_VISIBLE_DEVICES=1 python3 tools/train.py -c configs/rec/rec_chinese_common_train_zhonglian.yml -o Global.pretrain_weights=./pretrain_models/ch_rec_r34_vd_crnn/
2020-08-17 11:23:08,667-INFO: {'Global': {'debug': False, 'algorithm': 'CRNN', 'use_gpu': True, 'epoch_num': 3000, 'log_smooth_window': 20, 'print_batch_step': 10, 'save_model_dir': './output/rec_CRNN_zhonglian', 'save_epoch_step': 3, 'eval_batch_step': 2000, 'train_batch_size_per_card': 128, 'test_batch_size_per_card': 128, 'image_shape': [3, 32, 320], 'max_text_length': 25, 'character_type': 'ch', 'character_dict_path': './ppocr/utils/ppocr_keys_v1.txt', 'loss_type': 'ctc', 'reader_yml': './configs/rec/rec_chinese_reader.yml', 'pretrain_weights': './pretrain_models/ch_rec_r34_vd_crnn/', 'checkpoints': None, 'save_inference_dir': None, 'infer_img': None, 'distort': True}, '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}, 'TrainReader': {'reader_function': 'ppocr.data.rec.dataset_traversal,SimpleReader', 'num_workers': 8, 'img_set_dir': './train_data', 'label_file_path': './train_data/rec_gt_train.txt'}, 'EvalReader': {'reader_function': 'ppocr.data.rec.dataset_traversal,SimpleReader', 'img_set_dir': './train_data', 'label_file_path': './train_data/rec_gt_test.txt'}, 'TestReader': {'reader_function': 'ppocr.data.rec.dataset_traversal,SimpleReader'}}
2020-08-17 11:23:10,885-INFO: places would be ommited when DataLoader is not iterable
W0817 11:23:11.969848 13241 device_context.cc:237] Please NOTE: device: 0, CUDA Capability: 75, Driver API Version: 10.2, Runtime API Version: 10.0
W0817 11:23:11.975134 13241 device_context.cc:245] device: 0, cuDNN Version: 7.6.
2020-08-17 11:23:14,579-INFO: Loading parameters from ./pretrain_models/ch_rec_r34_vd_crnn/...
2020-08-17 11:23:16,366-INFO: Finish initing model from ./pretrain_models/ch_rec_r34_vd_crnn/
I0817 11:23:16.393851 13241 parallel_executor.cc:440] The Program will be executed on CUDA using ParallelExecutor, 1 cards are used, so 1 programs are executed in parallel.
I0817 11:23:16.425503 13241 build_strategy.cc:365] SeqOnlyAllReduceOps:0, num_trainers:1
I0817 11:23:16.490049 13241 parallel_executor.cc:307] Inplace strategy is enabled, when build_strategy.enable_inplace = True
I0817 11:23:16.526840 13241 parallel_executor.cc:375] Garbage collection strategy is enabled, when FLAGS_eager_delete_tensor_gb = 0
2020-08-17 11:23:32,039-INFO: epoch: 1, iter: 10, lr: 0.000500, 'loss': 153.48695, 'acc': 0.78125, time: 0.983
2020-08-17 11:23:44,815-INFO: epoch: 2, iter: 20, lr: 0.000500, 'loss': 18.81405, 'acc': 0.960938, time: 0.976
2020-08-17 11:23:57,764-INFO: epoch: 3, iter: 30, lr: 0.000500, 'loss': 6.24672, 'acc': 0.992188, time: 0.982
2020-08-17 11:24:09,334-INFO: Already save model in ./output/rec_CRNN_zhonglian/iter_epoch_3
2020-08-17 11:24:25,794-INFO: epoch: 5, iter: 40, lr: 0.000500, 'loss': 2.217144, 'acc': 0.992188, time: 4.912
2020-08-17 11:24:38,837-INFO: epoch: 6, iter: 50, lr: 0.000500, 'loss': 2.046174, 'acc': 0.992188, time: 0.986
2020-08-17 11:24:49,385-INFO: Already save model in ./output/rec_CRNN_zhonglian/iter_epoch_6
2020-08-17 11:24:57,087-INFO: epoch: 7, iter: 60, lr: 0.000500, 'loss': 1.977265, 'acc': 0.996094, time: 1.010
2020-08-17 11:25:10,721-INFO: epoch: 8, iter: 70, lr: 0.000500, 'loss': 1.150095, 'acc': 1.0, time: 0.981
...
...
i found another way to use it: try to specify the model's name
-o Global.checkpoints=output/rec_CRNN_zhonglian/best_accuracy
The complete code is as follows
$ CUDA_VISIBLE_DEVICES=1 python3 tools/eval.py -c configs/rec/rec_chinese_common_train_zhonglian.yml -o Global.checkpoints=output/rec_CRNN_zhonglian/best_accuracy
2020-08-17 13:49:35,256-INFO: {'Global': {'debug': False, 'algorithm': 'CRNN', 'use_gpu': True, 'epoch_num': 1, 'log_smooth_window': 20, 'print_batch_step': 10, 'save_model_dir': './output/rec_CRNN_zhonglian', 'save_epoch_step': 5, 'eval_batch_step': 100, 'train_batch_size_per_card': 128, 'test_batch_size_per_card': 128, 'image_shape': [3, 32, 320], 'max_text_length': 25, 'character_type': 'ch', 'character_dict_path': './ppocr/utils/ppocr_keys_v1.txt', 'loss_type': 'ctc', 'reader_yml': './configs/rec/rec_chinese_reader.yml', 'pretrain_weights': None, 'checkpoints': 'output/rec_CRNN_zhonglian/best_accuracy', 'save_inference_dir': None, 'infer_img': None, 'distort': True}, '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}, 'TrainReader': {'reader_function': 'ppocr.data.rec.dataset_traversal,SimpleReader', 'num_workers': 8, 'img_set_dir': './train_data', 'label_file_path': './train_data/rec_gt_train.txt'}, 'EvalReader': {'reader_function': 'ppocr.data.rec.dataset_traversal,SimpleReader', 'img_set_dir': './train_data', 'label_file_path': './train_data/rec_gt_test.txt'}, 'TestReader': {'reader_function': 'ppocr.data.rec.dataset_traversal,SimpleReader'}}
W0817 13:49:36.792258 25075 device_context.cc:237] Please NOTE: device: 0, CUDA Capability: 75, Driver API Version: 10.2, Runtime API Version: 10.0
W0817 13:49:36.796207 25075 device_context.cc:245] device: 0, cuDNN Version: 7.6.
2020-08-17 13:49:40,461-INFO: Finish initing model from output/rec_CRNN_zhonglian/best_accuracy
2020-08-17 13:49:41,414-INFO: eval batch id: 0, acc: 1.0
2020-08-17 13:49:42,281-INFO: eval batch id: 1, acc: 1.0
2020-08-17 13:49:42,843-INFO: eval batch id: 2, acc: 1.0
2020-08-17 13:49:43,435-INFO: eval batch id: 3, acc: 1.0
2020-08-17 13:49:44,064-INFO: eval batch id: 4, acc: 1.0
2020-08-17 13:49:44,807-INFO: eval batch id: 5, acc: 1.0
2020-08-17 13:49:45,470-INFO: eval batch id: 6, acc: 1.0
2020-08-17 13:49:46,074-INFO: eval batch id: 7, acc: 1.0
2020-08-17 13:49:46,075-INFO: Eval result: {'avg_acc': 1.0, 'total_acc_num': 1000, 'total_sample_num': 1000}
Hi PaddleOCR, i want to finetune pretrained model using rec_chinese_common_train.yml, but error happens
environment
I just downloaded the latest repo in gitee.com and downloaded the pretrained model
and install requirements
reproduce
put the pretrained model into PaddleOCR, like this
use
tar xf ...
to extract itrun the command like this:
i don't know what's wrong and how to fix it. Looking forward to your help