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

关于ch_ppocr_server_v1.1_det #775

Closed
JawerZ opened this issue Sep 21, 2020 · 13 comments
Closed

关于ch_ppocr_server_v1.1_det #775

JawerZ opened this issue Sep 21, 2020 · 13 comments

Comments

@JawerZ
Copy link

JawerZ commented Sep 21, 2020

ch_ppocr_server_v1.1_det模型能进行finetune吗 可以的话要用哪个配置文件

@LDOUBLEV
Copy link
Collaborator

ch_ppocr_server_v1.1_det模型能进行finetune吗 可以的话要用哪个配置文件

该配置使用的是resnet18作为backbone训练,
这个配置文件刚提交了,在这个PR里:#778

@JawerZ
Copy link
Author

JawerZ commented Sep 21, 2020

~/work/PaddleOCR-develop$ python tools/train.py -c configs/det/det_r18_vd_db.yml
2020-09-21 14:22:52,077-INFO: {'Global': {'debug': False, 'algorithm': 'DB', 'use_gpu': True, 'epoch_num': 1200, 'log_smooth_window': 20, 'print_batch_step': 2, 'save_model_dir': './output/det_r_18_vd_db/', 'save_epoch_step': 200, 'eval_batch_step': [3000, 2000], 'train_batch_size_per_card': 8, 'test_batch_size_per_card': 2, 'image_shape': [3, 640, 640], 'reader_yml': './configs/det/det_db_icdar15_reader.yml', 'pretrain_weights': './pretrain_models/ResNet18_vd_pretrained/', 'save_res_path': './output/det_r18_vd_db/predicts_db.txt', 'checkpoints': './pretrain_models/ch_ppocr_server_v1.1_det_train/best_accuracy', 'save_inference_dir': './inference/new_server/'}, 'Architecture': {'function': 'ppocr.modeling.architectures.det_model,DetModel'}, 'Backbone': {'function': 'ppocr.modeling.backbones.det_resnet_vd,ResNet', 'layers': 18}, 'Head': {'function': 'ppocr.modeling.heads.det_db_head,DBHead', 'model_name': 'large', 'k': 50, 'inner_channels': 256, 'out_channels': 2}, 'Loss': {'function': 'ppocr.modeling.losses.det_db_loss,DBLoss', 'balance_loss': True, 'main_loss_type': 'DiceLoss', 'alpha': 5, 'beta': 10, 'ohem_ratio': 3}, 'Optimizer': {'function': 'ppocr.optimizer,AdamDecay', 'base_lr': 0.001, 'beta1': 0.9, 'beta2': 0.999}, 'PostProcess': {'function': 'ppocr.postprocess.db_postprocess,DBPostProcess', 'thresh': 0.3, 'box_thresh': 0.6, 'max_candidates': 1000, 'unclip_ratio': 1.5}, 'TrainReader': {'reader_function': 'ppocr.data.det.dataset_traversal,TrainReader', 'process_function': 'ppocr.data.det.db_process,DBProcessTrain', 'num_workers': 8, 'img_set_dir': './train_data/', 'label_file_path': ['./train_data/icdar2013/train_label_json.txt', './train_data/icdar2015/train_label_json.txt', './train_data/icdar17_mlt_latin/train_label_json.txt', './train_data/coco_text_icdar_4pts/train_label_json.txt', './train_data/train_det_label.txt'], 'data_ratio_list': [0.1, 0.3, 0.3, 0.1, 0.2], 'background_ratio': 0.125, 'min_crop_side_ratio': 0.3, 'min_crop_size': 24, 'min_text_size': 4, 'max_text_size': 512}, 'EvalReader': {'reader_function': 'ppocr.data.det.dataset_traversal,EvalTestReader', 'process_function': 'ppocr.data.det.db_process,DBProcessTest', 'img_set_dir': './train_data/', 'label_file_path': './train_data/test_det_label.txt', 'test_image_shape': [640, 640]}, 'TestReader': {'reader_function': 'ppocr.data.det.dataset_traversal,EvalTestReader', 'process_function': 'ppocr.data.det.db_process,DBProcessTest', 'infer_img': None, 'img_set_dir': './train_data/', 'label_file_path': './train_data/test_det_label.txt', 'test_image_shape': [640, 640], 'do_eval': True}}
3 640 640
2020-09-21 14:22:52,320-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!
3 640 640
['./train_data/icdar2013/train_label_json.txt', './train_data/icdar2015/train_label_json.txt', './train_data/icdar17_mlt_latin/train_label_json.txt', './train_data/coco_text_icdar_4pts/train_label_json.txt', './train_data/train_det_label.txt']
2020-09-21 14:22:52,865-INFO: places would be ommited when DataLoader is not iterable
W0921 14:22:52.893616 5904 device_context.cc:252] Please NOTE: device: 0, CUDA Capability: 70, Driver API Version: 9.2, Runtime API Version: 9.0
W0921 14:22:52.898079 5904 device_context.cc:260] device: 0, cuDNN Version: 7.6.
Traceback (most recent call last):
File "tools/train.py", line 131, in
main()
File "tools/train.py", line 88, in main
init_model(config, train_program, exe)
File "/home/aistudio/work/PaddleOCR-develop/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 1786, in load
v.name, opt_file_name)
AssertionError: Can not find [learning_rate_0] in model file [./pretrain_models/ch_ppocr_server_v1.1_det_train/best_accuracy.pdopt]

预训练模型作为checkpoints训练会报错

@alex152738
Copy link

ch_ppocr_server_v1.1_det模型能进行finetune吗 可以的话要用哪个配置文件

该配置使用的是resnet18作为backbone训练,
这个配置文件刚提交了,在这个PR里:#778

请问新版本多出来的文本分类器是从原版本内容中分离出来的吗?感觉更麻烦了。重训练有变化吗?

@MissPenguin
Copy link
Collaborator

~/work/PaddleOCR-develop$ python tools/train.py -c configs/det/det_r18_vd_db.yml
2020-09-21 14:22:52,077-INFO: {'Global': {'debug': False, 'algorithm': 'DB', 'use_gpu': True, 'epoch_num': 1200, 'log_smooth_window': 20, 'print_batch_step': 2, 'save_model_dir': './output/det_r_18_vd_db/', 'save_epoch_step': 200, 'eval_batch_step': [3000, 2000], 'train_batch_size_per_card': 8, 'test_batch_size_per_card': 2, 'image_shape': [3, 640, 640], 'reader_yml': './configs/det/det_db_icdar15_reader.yml', 'pretrain_weights': './pretrain_models/ResNet18_vd_pretrained/', 'save_res_path': './output/det_r18_vd_db/predicts_db.txt', 'checkpoints': './pretrain_models/ch_ppocr_server_v1.1_det_train/best_accuracy', 'save_inference_dir': './inference/new_server/'}, 'Architecture': {'function': 'ppocr.modeling.architectures.det_model,DetModel'}, 'Backbone': {'function': 'ppocr.modeling.backbones.det_resnet_vd,ResNet', 'layers': 18}, 'Head': {'function': 'ppocr.modeling.heads.det_db_head,DBHead', 'model_name': 'large', 'k': 50, 'inner_channels': 256, 'out_channels': 2}, 'Loss': {'function': 'ppocr.modeling.losses.det_db_loss,DBLoss', 'balance_loss': True, 'main_loss_type': 'DiceLoss', 'alpha': 5, 'beta': 10, 'ohem_ratio': 3}, 'Optimizer': {'function': 'ppocr.optimizer,AdamDecay', 'base_lr': 0.001, 'beta1': 0.9, 'beta2': 0.999}, 'PostProcess': {'function': 'ppocr.postprocess.db_postprocess,DBPostProcess', 'thresh': 0.3, 'box_thresh': 0.6, 'max_candidates': 1000, 'unclip_ratio': 1.5}, 'TrainReader': {'reader_function': 'ppocr.data.det.dataset_traversal,TrainReader', 'process_function': 'ppocr.data.det.db_process,DBProcessTrain', 'num_workers': 8, 'img_set_dir': './train_data/', 'label_file_path': ['./train_data/icdar2013/train_label_json.txt', './train_data/icdar2015/train_label_json.txt', './train_data/icdar17_mlt_latin/train_label_json.txt', './train_data/coco_text_icdar_4pts/train_label_json.txt', './train_data/train_det_label.txt'], 'data_ratio_list': [0.1, 0.3, 0.3, 0.1, 0.2], 'background_ratio': 0.125, 'min_crop_side_ratio': 0.3, 'min_crop_size': 24, 'min_text_size': 4, 'max_text_size': 512}, 'EvalReader': {'reader_function': 'ppocr.data.det.dataset_traversal,EvalTestReader', 'process_function': 'ppocr.data.det.db_process,DBProcessTest', 'img_set_dir': './train_data/', 'label_file_path': './train_data/test_det_label.txt', 'test_image_shape': [640, 640]}, 'TestReader': {'reader_function': 'ppocr.data.det.dataset_traversal,EvalTestReader', 'process_function': 'ppocr.data.det.db_process,DBProcessTest', 'infer_img': None, 'img_set_dir': './train_data/', 'label_file_path': './train_data/test_det_label.txt', 'test_image_shape': [640, 640], 'do_eval': True}}
3 640 640
2020-09-21 14:22:52,320-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!
3 640 640
['./train_data/icdar2013/train_label_json.txt', './train_data/icdar2015/train_label_json.txt', './train_data/icdar17_mlt_latin/train_label_json.txt', './train_data/coco_text_icdar_4pts/train_label_json.txt', './train_data/train_det_label.txt']
2020-09-21 14:22:52,865-INFO: places would be ommited when DataLoader is not iterable
W0921 14:22:52.893616 5904 device_context.cc:252] Please NOTE: device: 0, CUDA Capability: 70, Driver API Version: 9.2, Runtime API Version: 9.0
W0921 14:22:52.898079 5904 device_context.cc:260] device: 0, cuDNN Version: 7.6.
Traceback (most recent call last):
File "tools/train.py", line 131, in
main()
File "tools/train.py", line 88, in main
init_model(config, train_program, exe)
File "/home/aistudio/work/PaddleOCR-develop/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 1786, in load
v.name, opt_file_name)
AssertionError: Can not find [learning_rate_0] in model file [./pretrain_models/ch_ppocr_server_v1.1_det_train/best_accuracy.pdopt]

预训练模型作为checkpoints训练会报错

感谢反馈,新模型训练用了cosine decay,配置没有加所以报错,稍后会修正,可以先用pretrain_weights加载,不要用checkpoints

@MissPenguin
Copy link
Collaborator

ch_ppocr_server_v1.1_det模型能进行finetune吗 可以的话要用哪个配置文件

该配置使用的是resnet18作为backbone训练,
这个配置文件刚提交了,在这个PR里:#778

请问新版本多出来的文本分类器是从原版本内容中分离出来的吗?感觉更麻烦了。重训练有变化吗?

方向分类器是可选的,如果你的场景不需要的话可以不用。

@zcswdt
Copy link

zcswdt commented Sep 21, 2020

ch_ppocr_server_v1.1_det模型能进行finetune吗 可以的话要用哪个配置文件

该配置使用的是resnet18作为backbone训练,
这个配置文件刚提交了,在这个PR里:#778

请问新版本多出来的文本分类器是从原版本内容中分离出来的吗?感觉更麻烦了。重训练有变化吗?

方向分类器是可选的,如果你的场景不需要的话可以不用。

我想学习一下方向分类器的原理,请问有这方面训练和识别的原理文档吗?

@alex152738
Copy link

ch_ppocr_server_v1.1_det模型能进行finetune吗 可以的话要用哪个配置文件

该配置使用的是resnet18作为backbone训练,
这个配置文件刚提交了,在这个PR里:#778

请问新版本多出来的文本分类器是从原版本内容中分离出来的吗?感觉更麻烦了。重训练有变化吗?

方向分类器是可选的,如果你的场景不需要的话可以不用。

分类器只是检测小图片的方向0-180°,并不检测图片中文本的方向?而且刚在新发布的权重上测试时候使用和不使用不影响竖排文字的最终检测结果,并且测试结果不如之前的好。请问不是很理解这个分类器的作用?

@wangleiai
Copy link

~/work/PaddleOCR-develop$ python tools/train.py -c configs/det/det_r18_vd_db.yml
2020-09-21 14:22:52,077-INFO: {'Global': {'debug': False, 'algorithm': 'DB', 'use_gpu': True, 'epoch_num': 1200, 'log_smooth_window': 20, 'print_batch_step': 2, 'save_model_dir': './output/det_r_18_vd_db/', 'save_epoch_step': 200, 'eval_batch_step': [3000, 2000], 'train_batch_size_per_card': 8, 'test_batch_size_per_card': 2, 'image_shape': [3, 640, 640], 'reader_yml': './configs/det/det_db_icdar15_reader.yml', 'pretrain_weights': './pretrain_models/ResNet18_vd_pretrained/', 'save_res_path': './output/det_r18_vd_db/predicts_db.txt', 'checkpoints': './pretrain_models/ch_ppocr_server_v1.1_det_train/best_accuracy', 'save_inference_dir': './inference/new_server/'}, 'Architecture': {'function': 'ppocr.modeling.architectures.det_model,DetModel'}, 'Backbone': {'function': 'ppocr.modeling.backbones.det_resnet_vd,ResNet', 'layers': 18}, 'Head': {'function': 'ppocr.modeling.heads.det_db_head,DBHead', 'model_name': 'large', 'k': 50, 'inner_channels': 256, 'out_channels': 2}, 'Loss': {'function': 'ppocr.modeling.losses.det_db_loss,DBLoss', 'balance_loss': True, 'main_loss_type': 'DiceLoss', 'alpha': 5, 'beta': 10, 'ohem_ratio': 3}, 'Optimizer': {'function': 'ppocr.optimizer,AdamDecay', 'base_lr': 0.001, 'beta1': 0.9, 'beta2': 0.999}, 'PostProcess': {'function': 'ppocr.postprocess.db_postprocess,DBPostProcess', 'thresh': 0.3, 'box_thresh': 0.6, 'max_candidates': 1000, 'unclip_ratio': 1.5}, 'TrainReader': {'reader_function': 'ppocr.data.det.dataset_traversal,TrainReader', 'process_function': 'ppocr.data.det.db_process,DBProcessTrain', 'num_workers': 8, 'img_set_dir': './train_data/', 'label_file_path': ['./train_data/icdar2013/train_label_json.txt', './train_data/icdar2015/train_label_json.txt', './train_data/icdar17_mlt_latin/train_label_json.txt', './train_data/coco_text_icdar_4pts/train_label_json.txt', './train_data/train_det_label.txt'], 'data_ratio_list': [0.1, 0.3, 0.3, 0.1, 0.2], 'background_ratio': 0.125, 'min_crop_side_ratio': 0.3, 'min_crop_size': 24, 'min_text_size': 4, 'max_text_size': 512}, 'EvalReader': {'reader_function': 'ppocr.data.det.dataset_traversal,EvalTestReader', 'process_function': 'ppocr.data.det.db_process,DBProcessTest', 'img_set_dir': './train_data/', 'label_file_path': './train_data/test_det_label.txt', 'test_image_shape': [640, 640]}, 'TestReader': {'reader_function': 'ppocr.data.det.dataset_traversal,EvalTestReader', 'process_function': 'ppocr.data.det.db_process,DBProcessTest', 'infer_img': None, 'img_set_dir': './train_data/', 'label_file_path': './train_data/test_det_label.txt', 'test_image_shape': [640, 640], 'do_eval': True}}
3 640 640
2020-09-21 14:22:52,320-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!
3 640 640
['./train_data/icdar2013/train_label_json.txt', './train_data/icdar2015/train_label_json.txt', './train_data/icdar17_mlt_latin/train_label_json.txt', './train_data/coco_text_icdar_4pts/train_label_json.txt', './train_data/train_det_label.txt']
2020-09-21 14:22:52,865-INFO: places would be ommited when DataLoader is not iterable
W0921 14:22:52.893616 5904 device_context.cc:252] Please NOTE: device: 0, CUDA Capability: 70, Driver API Version: 9.2, Runtime API Version: 9.0
W0921 14:22:52.898079 5904 device_context.cc:260] device: 0, cuDNN Version: 7.6.
Traceback (most recent call last):
File "tools/train.py", line 131, in
main()
File "tools/train.py", line 88, in main
init_model(config, train_program, exe)
File "/home/aistudio/work/PaddleOCR-develop/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 1786, in load
v.name, opt_file_name)
AssertionError: Can not find [learning_rate_0] in model file [./pretrain_models/ch_ppocr_server_v1.1_det_train/best_accuracy.pdopt]
预训练模型作为checkpoints训练会报错

感谢反馈,新模型训练用了cosine decay,配置没有加所以报错,稍后会修正,可以先用pretrain_weights加载,不要用checkpoints

请问,最近几天会加上cosine decay吗?

@MissPenguin
Copy link
Collaborator

ch_ppocr_server_v1.1_det模型能进行finetune吗 可以的话要用哪个配置文件

该配置使用的是resnet18作为backbone训练,
这个配置文件刚提交了,在这个PR里:#778

请问新版本多出来的文本分类器是从原版本内容中分离出来的吗?感觉更麻烦了。重训练有变化吗?

方向分类器是可选的,如果你的场景不需要的话可以不用。

我想学习一下方向分类器的原理,请问有这方面训练和识别的原理文档吗?

方向分类器的文档:https://github.com/PaddlePaddle/PaddleOCR/blob/develop/doc/doc_ch/angle_class.md

@MissPenguin
Copy link
Collaborator

~/work/PaddleOCR-develop$ python tools/train.py -c configs/det/det_r18_vd_db.yml
2020-09-21 14:22:52,077-INFO: {'Global': {'debug': False, 'algorithm': 'DB', 'use_gpu': True, 'epoch_num': 1200, 'log_smooth_window': 20, 'print_batch_step': 2, 'save_model_dir': './output/det_r_18_vd_db/', 'save_epoch_step': 200, 'eval_batch_step': [3000, 2000], 'train_batch_size_per_card': 8, 'test_batch_size_per_card': 2, 'image_shape': [3, 640, 640], 'reader_yml': './configs/det/det_db_icdar15_reader.yml', 'pretrain_weights': './pretrain_models/ResNet18_vd_pretrained/', 'save_res_path': './output/det_r18_vd_db/predicts_db.txt', 'checkpoints': './pretrain_models/ch_ppocr_server_v1.1_det_train/best_accuracy', 'save_inference_dir': './inference/new_server/'}, 'Architecture': {'function': 'ppocr.modeling.architectures.det_model,DetModel'}, 'Backbone': {'function': 'ppocr.modeling.backbones.det_resnet_vd,ResNet', 'layers': 18}, 'Head': {'function': 'ppocr.modeling.heads.det_db_head,DBHead', 'model_name': 'large', 'k': 50, 'inner_channels': 256, 'out_channels': 2}, 'Loss': {'function': 'ppocr.modeling.losses.det_db_loss,DBLoss', 'balance_loss': True, 'main_loss_type': 'DiceLoss', 'alpha': 5, 'beta': 10, 'ohem_ratio': 3}, 'Optimizer': {'function': 'ppocr.optimizer,AdamDecay', 'base_lr': 0.001, 'beta1': 0.9, 'beta2': 0.999}, 'PostProcess': {'function': 'ppocr.postprocess.db_postprocess,DBPostProcess', 'thresh': 0.3, 'box_thresh': 0.6, 'max_candidates': 1000, 'unclip_ratio': 1.5}, 'TrainReader': {'reader_function': 'ppocr.data.det.dataset_traversal,TrainReader', 'process_function': 'ppocr.data.det.db_process,DBProcessTrain', 'num_workers': 8, 'img_set_dir': './train_data/', 'label_file_path': ['./train_data/icdar2013/train_label_json.txt', './train_data/icdar2015/train_label_json.txt', './train_data/icdar17_mlt_latin/train_label_json.txt', './train_data/coco_text_icdar_4pts/train_label_json.txt', './train_data/train_det_label.txt'], 'data_ratio_list': [0.1, 0.3, 0.3, 0.1, 0.2], 'background_ratio': 0.125, 'min_crop_side_ratio': 0.3, 'min_crop_size': 24, 'min_text_size': 4, 'max_text_size': 512}, 'EvalReader': {'reader_function': 'ppocr.data.det.dataset_traversal,EvalTestReader', 'process_function': 'ppocr.data.det.db_process,DBProcessTest', 'img_set_dir': './train_data/', 'label_file_path': './train_data/test_det_label.txt', 'test_image_shape': [640, 640]}, 'TestReader': {'reader_function': 'ppocr.data.det.dataset_traversal,EvalTestReader', 'process_function': 'ppocr.data.det.db_process,DBProcessTest', 'infer_img': None, 'img_set_dir': './train_data/', 'label_file_path': './train_data/test_det_label.txt', 'test_image_shape': [640, 640], 'do_eval': True}}
3 640 640
2020-09-21 14:22:52,320-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!
3 640 640
['./train_data/icdar2013/train_label_json.txt', './train_data/icdar2015/train_label_json.txt', './train_data/icdar17_mlt_latin/train_label_json.txt', './train_data/coco_text_icdar_4pts/train_label_json.txt', './train_data/train_det_label.txt']
2020-09-21 14:22:52,865-INFO: places would be ommited when DataLoader is not iterable
W0921 14:22:52.893616 5904 device_context.cc:252] Please NOTE: device: 0, CUDA Capability: 70, Driver API Version: 9.2, Runtime API Version: 9.0
W0921 14:22:52.898079 5904 device_context.cc:260] device: 0, cuDNN Version: 7.6.
Traceback (most recent call last):
File "tools/train.py", line 131, in
main()
File "tools/train.py", line 88, in main
init_model(config, train_program, exe)
File "/home/aistudio/work/PaddleOCR-develop/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 1786, in load
v.name, opt_file_name)
AssertionError: Can not find [learning_rate_0] in model file [./pretrain_models/ch_ppocr_server_v1.1_det_train/best_accuracy.pdopt]
预训练模型作为checkpoints训练会报错

感谢反馈,新模型训练用了cosine decay,配置没有加所以报错,稍后会修正,可以先用pretrain_weights加载,不要用checkpoints

请问,最近几天会加上cosine decay吗?

已加,见configs/det/det_r18_vd_db_v1.1.yml和configs/det/det_mv3_db_v1.1.yml,注意相关参数可能需要调整,比如step_each_epoch = 训练图像总数/卡数/batch size per card

@wangleiai
Copy link

~/work/PaddleOCR-develop$ python tools/train.py -c configs/det/det_r18_vd_db.yml
2020-09-21 14:22:52,077-INFO: {'Global': {'debug': False, 'algorithm': 'DB', 'use_gpu': True, 'epoch_num': 1200, 'log_smooth_window': 20, 'print_batch_step': 2, 'save_model_dir': './output/det_r_18_vd_db/', 'save_epoch_step': 200, 'eval_batch_step': [3000, 2000], 'train_batch_size_per_card': 8, 'test_batch_size_per_card': 2, 'image_shape': [3, 640, 640], 'reader_yml': './configs/det/det_db_icdar15_reader.yml', 'pretrain_weights': './pretrain_models/ResNet18_vd_pretrained/', 'save_res_path': './output/det_r18_vd_db/predicts_db.txt', 'checkpoints': './pretrain_models/ch_ppocr_server_v1.1_det_train/best_accuracy', 'save_inference_dir': './inference/new_server/'}, 'Architecture': {'function': 'ppocr.modeling.architectures.det_model,DetModel'}, 'Backbone': {'function': 'ppocr.modeling.backbones.det_resnet_vd,ResNet', 'layers': 18}, 'Head': {'function': 'ppocr.modeling.heads.det_db_head,DBHead', 'model_name': 'large', 'k': 50, 'inner_channels': 256, 'out_channels': 2}, 'Loss': {'function': 'ppocr.modeling.losses.det_db_loss,DBLoss', 'balance_loss': True, 'main_loss_type': 'DiceLoss', 'alpha': 5, 'beta': 10, 'ohem_ratio': 3}, 'Optimizer': {'function': 'ppocr.optimizer,AdamDecay', 'base_lr': 0.001, 'beta1': 0.9, 'beta2': 0.999}, 'PostProcess': {'function': 'ppocr.postprocess.db_postprocess,DBPostProcess', 'thresh': 0.3, 'box_thresh': 0.6, 'max_candidates': 1000, 'unclip_ratio': 1.5}, 'TrainReader': {'reader_function': 'ppocr.data.det.dataset_traversal,TrainReader', 'process_function': 'ppocr.data.det.db_process,DBProcessTrain', 'num_workers': 8, 'img_set_dir': './train_data/', 'label_file_path': ['./train_data/icdar2013/train_label_json.txt', './train_data/icdar2015/train_label_json.txt', './train_data/icdar17_mlt_latin/train_label_json.txt', './train_data/coco_text_icdar_4pts/train_label_json.txt', './train_data/train_det_label.txt'], 'data_ratio_list': [0.1, 0.3, 0.3, 0.1, 0.2], 'background_ratio': 0.125, 'min_crop_side_ratio': 0.3, 'min_crop_size': 24, 'min_text_size': 4, 'max_text_size': 512}, 'EvalReader': {'reader_function': 'ppocr.data.det.dataset_traversal,EvalTestReader', 'process_function': 'ppocr.data.det.db_process,DBProcessTest', 'img_set_dir': './train_data/', 'label_file_path': './train_data/test_det_label.txt', 'test_image_shape': [640, 640]}, 'TestReader': {'reader_function': 'ppocr.data.det.dataset_traversal,EvalTestReader', 'process_function': 'ppocr.data.det.db_process,DBProcessTest', 'infer_img': None, 'img_set_dir': './train_data/', 'label_file_path': './train_data/test_det_label.txt', 'test_image_shape': [640, 640], 'do_eval': True}}
3 640 640
2020-09-21 14:22:52,320-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!
3 640 640
['./train_data/icdar2013/train_label_json.txt', './train_data/icdar2015/train_label_json.txt', './train_data/icdar17_mlt_latin/train_label_json.txt', './train_data/coco_text_icdar_4pts/train_label_json.txt', './train_data/train_det_label.txt']
2020-09-21 14:22:52,865-INFO: places would be ommited when DataLoader is not iterable
W0921 14:22:52.893616 5904 device_context.cc:252] Please NOTE: device: 0, CUDA Capability: 70, Driver API Version: 9.2, Runtime API Version: 9.0
W0921 14:22:52.898079 5904 device_context.cc:260] device: 0, cuDNN Version: 7.6.
Traceback (most recent call last):
File "tools/train.py", line 131, in
main()
File "tools/train.py", line 88, in main
init_model(config, train_program, exe)
File "/home/aistudio/work/PaddleOCR-develop/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 1786, in load
v.name, opt_file_name)
AssertionError: Can not find [learning_rate_0] in model file [./pretrain_models/ch_ppocr_server_v1.1_det_train/best_accuracy.pdopt]
预训练模型作为checkpoints训练会报错

感谢反馈,新模型训练用了cosine decay,配置没有加所以报错,稍后会修正,可以先用pretrain_weights加载,不要用checkpoints

请问,最近几天会加上cosine decay吗?

已加,见configs/det/det_r18_vd_db_v1.1.yml和configs/det/det_mv3_db_v1.1.yml,注意相关参数可能需要调整,比如step_each_epoch = 训练图像总数/卡数/batch size per card

好的,感谢

@JawerZ
Copy link
Author

JawerZ commented Sep 22, 2020

请问推理模型是由预训练模型导出的吗,为什么预训练模型的预测和推理模型的预测结果不一致,推理模型训练时输入的图片大小是多少?

@tink2123
Copy link
Collaborator

是的,推理模型是由训练模型导出的,结果不一致可能是由于超参差异导致的,可以参考这个issue:#214

@JawerZ JawerZ closed this as completed Sep 27, 2020
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

7 participants