提交 c85036dd 编写于 作者: T tink2123

change pretrain and label path

上级 7be2882f
...@@ -12,18 +12,18 @@ ...@@ -12,18 +12,18 @@
| 字段 | 用途 | 默认值 | 备注 | | 字段 | 用途 | 默认值 | 备注 |
| :----------------------: | :---------------------: | :--------------: | :--------------------: | | :----------------------: | :---------------------: | :--------------: | :--------------------: |
| algorithm | 设置算法 | CRNN | 选择模型,支持模型请参考[简介]() | | algorithm | 设置算法 | CRNN | 选择模型,支持模型请参考[简介](../../README.md) |
| use_gpu | 设置代码运行场所 | true | \ | | use_gpu | 设置代码运行场所 | true | \ |
| epoch_num | 最大训练epoch数 | 3000 | \ | | epoch_num | 最大训练epoch数 | 3000 | \ |
| log_smooth_window | 滑动窗口大小 | 20 | \ | | log_smooth_window | 滑动窗口大小 | 20 | \ |
| print_batch_step | 设置打印log间隔 | 10 | \ | | print_batch_step | 设置打印log间隔 | 10 | \ |
| save_model_dir | 设置模型保存路径 | output/rec_CRNN | \ | | save_model_dir | 设置模型保存路径 | output/rec_CRNN | \ |
| save_epoch_step | 设置模型保存间隔 | 3 | \ | | save_epoch_step | 设置模型保存间隔 | 3 | \ |
| eval_batch_step | 设置模型评估间隔 | 2000 | \ | | eval_batch_step | 设置模型评估间隔 | 2000 | \ |
|train_batch_size_per_card | 设置训练时单卡batch size | 256 | \ | |train_batch_size_per_card | 设置训练时单卡batch size | 256 | \ |
| test_batch_size_per_card | 设置评估时单卡batch size | 256 | \ | | test_batch_size_per_card | 设置评估时单卡batch size | 256 | \ |
| image_shape | 设置输入图片尺寸 | [3, 32, 100] | \ | | image_shape | 设置输入图片尺寸 | [3, 32, 100] | \ |
| max_text_length | 设置文本最大长度 | 25 | \ | | max_text_length | 设置文本最大长度 | 25 | \ |
| character_type | 设置字符类型 | ch | en/ch, en时将使用默认dict,ch时使用自定义dict| | character_type | 设置字符类型 | ch | en/ch, en时将使用默认dict,ch时使用自定义dict|
| character_dict_path | 设置字典路径 | ./ppocr/utils/ic15_dict.txt | \ | | character_dict_path | 设置字典路径 | ./ppocr/utils/ic15_dict.txt | \ |
| loss_type | 设置 loss 类型 | ctc | 支持两种loss: ctc / attention | | loss_type | 设置 loss 类型 | ctc | 支持两种loss: ctc / attention |
......
...@@ -98,6 +98,18 @@ word_dict.txt 每行有一个单字,将字符与数字索引映射在一起, ...@@ -98,6 +98,18 @@ word_dict.txt 每行有一个单字,将字符与数字索引映射在一起,
PaddleOCR提供了训练脚本、评估脚本和预测脚本,本节将以 CRNN 识别模型为例: PaddleOCR提供了训练脚本、评估脚本和预测脚本,本节将以 CRNN 识别模型为例:
首先下载pretrain model,您可以下载训练好的模型在 icdar2015 数据上进行finetune
``
cd PaddleOCR/
# 下载MobileNetV3的预训练模型
wget -P ./pretrain_models/ https://paddleocr.bj.bcebos.com/rec_mv3_none_bilstm_ctc.tar
# 解压模型参数
cd pretrain_models
tar -xf rec_mv3_none_bilstm_ctc.tar && rm -rf rec_mv3_none_bilstm_ctc.tar
```
开始训练:
``` ```
# 设置PYTHONPATH路径 # 设置PYTHONPATH路径
export PYTHONPATH=$PYTHONPATH:. export PYTHONPATH=$PYTHONPATH:.
...@@ -106,7 +118,7 @@ export CUDA_VISIBLE_DEVICES=0,1,2,3 ...@@ -106,7 +118,7 @@ export CUDA_VISIBLE_DEVICES=0,1,2,3
python3 tools/train.py -c configs/rec/rec_icdar15_train.yml python3 tools/train.py -c configs/rec/rec_icdar15_train.yml
``` ```
PaddleOCR支持训练和评估交替进行, 可以在 `configs/rec/rec_icdar15_train.yml` 中修改 `eval_batch_step` 设置评估频率,默认每2000个iter评估一次。评估过程中默认将最佳acc模型,保存为 `output/rec_CRNN/best_accuracy` PaddleOCR支持训练和评估交替进行, 可以在 `configs/rec/rec_icdar15_train.yml` 中修改 `eval_batch_step` 设置评估频率,默认每500个iter评估一次。评估过程中默认将最佳acc模型,保存为 `output/rec_CRNN/best_accuracy` 。
如果验证集很大,测试将会比较耗时,建议减少评估次数,或训练完再进行评估。 如果验证集很大,测试将会比较耗时,建议减少评估次数,或训练完再进行评估。
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册