-
Notifications
You must be signed in to change notification settings - Fork 60
add det+rec ckpt prediction pipeline #216
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
Conversation
e7ca436
to
f5f92db
Compare
docs/cn/predict_ckpt_cn.md
Outdated
|
||
```bash | ||
cd tools/predict/text | ||
python predict_system.py |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里应该要输入config参数?
另外,最好能支持输入待识别图像文件夹路径
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
已修改。
- 对齐友商接口,现支持传入raw_data_dir,det_ckpt_path,rec_ckpt_path。
- config文件路径可由det_config_path和rec_config_path参数传入,args parser中有默认值。
- 目前待识别图像文件夹=检测后裁剪图片保存文件夹,可由crop_save_dir参数传入,args parser中有默认值。
add det+rec ckpt prediction pipeline add det_rec ckpt prediction pipeline add det+rec ckpt prediction pipeline add det+rec ckpt prediction pipeline add dbnet+crnn ckpt inference add ckpt predict pytest modify st add predict_system doc update predict_system update doc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
post process needs improvement in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这一步后处理固定写的是4点的文字框。这块后续要考虑对弯曲文字的支持,即根据弯曲的多边形crop图后,padding得到长宽图。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
好的
points = sorted(list(cv2.boxPoints(bounding_box)), key=lambda x: x[0]) | ||
|
||
# index_1, index_2, index_3, index_4 = 0, 1, 2, 3 | ||
if points[1][1] > points[0][1]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a need for an explicit sorting? cv2.boxPoints()
method returns an instance of RotatedRect::points
, which in turn returns sorted coordinates is the order of: bottomLeft
, topLeft
, topRight
, bottomRight
.
np.roll(..., -1)
sets the starting coordinate to topLeft
.
__all__ = ['PredictDataset'] | ||
|
||
|
||
class PredictDataset(BaseDataset): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like PredictDataset
should be a part of DetDataset
rather than a separate class. Can set a flag such as prediction
to load images only. Perhaps, we can do the same for RecDataset
.
@@ -148,3 +148,41 @@ eval: | |||
batch_size: 1 # TODO: due to dynamic shape of polygons (num of boxes varies), BS has to be 1 | |||
drop_remainder: False | |||
num_workers: 2 | |||
|
|||
predict: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because of the separate PredictDataset
class, there is many duplicates in the config file. It's easy to make a mistake when there's a lot of repetitions.
add dbnet+crnn ckpt inference
add ckpt predict pytest
Thank you for your contribution to the MindOCR repo.
Before submitting this PR, please make sure:
Motivation
Add detection+recognition end2end ckpt prediction pipeline.
Test Plan
tests/st/test_predict.py will be added later.
Related Issues and PRs
Issue #238