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

Add new recognition method "ParseQ" #10836

Merged
merged 27 commits into from
Sep 7, 2023
Merged

Conversation

ToddBear
Copy link
Collaborator

@ToddBear ToddBear commented Sep 6, 2023

No description provided.

tink2123 and others added 11 commits August 11, 2023 16:20
* Update PP-OCRv4_introduction.md

* Update PP-OCRv4_introduction.md

* Update PP-OCRv4_introduction.md
…Paddle:Release/2.7 (PaddlePaddle#10655)

* Don't break overall processing on a bad image

* Add preprocessing common to OCR tasks
Add preprocessing to options
added missing pyyaml library
Co-authored-by: Dennis <dvorst@users.noreply.github.com>
Co-authored-by: shiyutang <34859558+shiyutang@users.noreply.github.com>
* 修改数据增强导致的DSR报错

* 错误修改回滚
@paddle-bot
Copy link

paddle-bot bot commented Sep 6, 2023

Thanks for your contribution!

@ToddBear
Copy link
Collaborator Author

ToddBear commented Sep 6, 2023

与Torch模型在Real(COCO-Text, RCTW17, Uber-Text, ArT, LSVT, MLT19, ReCTS, TextOCR and OpenVINO)数据集下训练,在IIIT5k, SVT, IC13,IC15,SVTP,CUTE数据集下测试结果对比:
image

@ToddBear
Copy link
Collaborator Author

ToddBear commented Sep 6, 2023

静态图模型导出成功:
image
Python部署推理结果验证通过:
image

Copy link
Collaborator

@tink2123 tink2123 left a comment

Choose a reason for hiding this comment

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

另外新增算法请提交至 dygraph 分支

use_visualdl: False
infer_img: doc/imgs_words_en/word_10.png
# for data or label process
character_dict_path: /ssd3/suzejia/newAlgOCR/ppocr/utils/dict/parseq_dict.txt
Copy link
Collaborator

Choose a reason for hiding this comment

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

请上传字典,并提供github上的相对路径

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

字典已上传,并相应修改configs中的路径

self.image_shape = image_shape
self.dst_h, self.dst_w = image_shape[1], image_shape[2]

def __call__(self, data):
Copy link
Collaborator

Choose a reason for hiding this comment

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

没有特殊的操作,可以看下能否复用之前的resize呢?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

已复用SVTR的resize

ones_(m.weight)

def forward_features(self, x):
# B = x.shape[0]
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.

嗯嗯,已删除

from typing import Optional
import copy
from itertools import permutations

Copy link
Collaborator

Choose a reason for hiding this comment

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

如果代码参考了其他repo,加一下 code refer, 参考:

This code is refer from:
https://github.com/PaddlePaddle/PaddleClas/blob/release%2F2.5/ppcls/arch/backbone/model_zoo/vision_transformer.py

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

已增加code refer

sz = perm.shape[0]
mask = paddle.zeros(shape=(sz, sz))
for i in range(sz):
query_idx = perm[i].cpu().numpy().tolist()
Copy link
Collaborator

Choose a reason for hiding this comment

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

必须要转numpy吗?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

嗯嗯,如果不转成list,直接用tensor的话,下面的mask索引会出bug

image

@@ -348,6 +354,17 @@ def resize_norm_img_svtr(self, img, image_shape):
resized_image /= 0.5
return resized_image

def resize_norm_img_parseq(self, img, image_shape):
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.

已复用SVTR的resize

@ToddBear ToddBear changed the base branch from release/2.7 to dygraph September 7, 2023 07:15
@ToddBear
Copy link
Collaborator Author

ToddBear commented Sep 7, 2023

另外新增算法请提交至 dygraph 分支

已修改至dygraph分支

Copy link
Collaborator

@tink2123 tink2123 left a comment

Choose a reason for hiding this comment

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

LGTM

@tink2123 tink2123 merged commit 75d1661 into PaddlePaddle:dygraph Sep 7, 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.