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

optimize PaddleOCR #3

Merged
merged 9 commits into from
May 12, 2020
Merged

optimize PaddleOCR #3

merged 9 commits into from
May 12, 2020

Conversation

LDOUBLEV
Copy link
Collaborator

@LDOUBLEV LDOUBLEV commented May 11, 2020

  • add checkpoints in yml
  • add doc directory
  • supporting sort predict box
  • add detection fluid inference
  • masked memory optimization and ir optimization options in utility.py

doc/detection.md Outdated

## 3.2 快速启动训练

首先下载pretrain model,目前支持两种backbone,分别是MobileNetV3、ResNet50,您可以根据需求使用PaddleClas中的模型更换
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

需要再详细说明下网络结构,MobileNetV3有10个,ResNet50是ResNet50_vd


PaddleOCR计算三个OCR检测相关的指标,分别是:Precision、Recall、Hmean。

运行如下代码,根据配置文件det_db_mv3.yml中save_res_path指定的测试集检测结果文件,计算评估指标。
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

代码里面需要注明评估来源于DB repo

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

doc/detection.md Outdated
运行如下代码,根据配置文件det_db_mv3.yml中save_res_path指定的测试集检测结果文件,计算评估指标。

```
python3 tools/eval.py -c configs/det/det_db_mv3.yml -o checkpoints ./output/best_accuracy
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这块为什么使用checkpoints,而不是pretrainedweights?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pretrained weights是加载的backbone的模型参数,在评估或者测试时要加载训练好的参数文件,换成checkpoints是不是更能区分些?


我们提供了PaddleOCR开发环境的docker,您可以pull我们提供的docker运行PaddleOCR的环境。

1. 准备docker环境。第一次使用这个镜像,会自动下载该镜像,请耐心等待。
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

自动下载删掉,需要让用户操作下载吧

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

换了一个官方镜像,测试了可以PaddleOCR可以正常运行,不需要用户再去手动下载。

@@ -99,14 +99,15 @@ def create_predictor(args, mode):
config.disable_gpu()

config.disable_glog_info()
config.switch_ir_optim(args.ir_optim)
# config.switch_ir_optim(args.ir_optim)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

直接删了吧,包括trt和fp16的参数

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

好的

@LDOUBLEV LDOUBLEV changed the title optimizer PaddleOCR optimize PaddleOCR May 12, 2020
README.md Outdated
OCR algorithms with PaddlePaddle (still under develop)

# 简介
PaddleOCR旨在打造一套丰富、领先、且实用的文字检测、识别模型/工具库,助力使用者训练出更好的模型,并应用落地。
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OCR工具库

README.md Outdated

## 文档教程
- [快速安装](./doc/installation.md)
- [文本识别模型训练/评估/预测](./doc/detection.md)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

修改目录

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

添加快速开始
export model

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

README.md Outdated
- [文本识别模型训练/评估/预测](./doc/detection.md)
- [文本预测模型训练/评估/预测](./doc/recognition.md)

## 特性:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

特性上移

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

README.md Outdated
- [SAST](https://arxiv.org/abs/1908.05498)

算法效果:
|模型|骨干网络|数据集|Hmean|
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

表格里添加模型引用,然后todo

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

数据集去掉

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@@ -12,6 +12,7 @@ Global:
image_shape: [3, 640, 640]
reader_yml: ./configs/det/det_db_icdar15_reader.yml
pretrain_weights: ./pretrain_models/MobileNetV3_pretrained/MobileNetV3_large_x0_5_pretrained/
checkpoints:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

确认对不对?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

doc/detection.md Outdated
@@ -0,0 +1,78 @@
# 文字检测

本节以icdar15数据集为例,介绍PaddleOCR中检测模型的使用方式。
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

使用方式展开

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

好的

doc/detection.md Outdated
" 图像文件名 json.dumps编码的图像标注信息"
ch4_test_images/img_61.jpg [{"transcription": "MASA", "points": [[310, 104], [416, 141], [418, 216], [312, 179]], ...}]
```
json.dumps编码前的图像标注信息是包含多个字典的list,字典中的points表示文本框的位置,如果您想在其他数据集上训练PaddleOCR,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

说明检测不需要文本信息,points 四点

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

x1,y1,x2,y2

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

pip3 install -r requirements.txt
```

## 快速运行
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

快速运行删掉

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

# NOTE(paddle-dev): All of these flags should be
# set before `import paddle`. Otherwise, it would
# not take any effect.
set_paddle_flags(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

删掉

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

暂定不删,等更新1.8代码时更新



def simple_reader(img_file, config):
imgs_lists = []
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

读图使用utility的独立函数

Copy link
Collaborator Author

@LDOUBLEV LDOUBLEV May 12, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done,读图函数封装了一个函数,位置在tools/infer/utility.py-get_image_file_list()

@dyning dyning merged commit ed4b270 into PaddlePaddle:develop May 12, 2020
dyning pushed a commit that referenced this pull request Jul 24, 2020
@rp-koayst rp-koayst mentioned this pull request Jan 26, 2021
BillDior pushed a commit to BillDior/PaddleOCR that referenced this pull request Aug 13, 2021
@linkewei0580 linkewei0580 mentioned this pull request Mar 4, 2022
an1018 pushed a commit to an1018/PaddleOCR that referenced this pull request Aug 17, 2022
* update code & doc
ChenNima added a commit to ChenNima/PaddleOCR that referenced this pull request May 19, 2023
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

Successfully merging this pull request may close these issues.

2 participants