-
Notifications
You must be signed in to change notification settings - Fork 974
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 PP-ChatOCRv4 and support PDF #2734
Conversation
Thanks for your contribution! |
use_table_recognition=True, | ||
) | ||
|
||
# ####[TODO] 增加类别信息 |
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.
这里是后续再改么?
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.
应该不会改了
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.
TODO: 其他CV模块需要同步修改。
Returns: | ||
OCRResult: The predicted OCR result with updated dt_boxes. | ||
""" | ||
overall_ocr_res = next(self.general_ocr_pipeline(image_array)) |
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.
这里及之前用next的原因是因为batch_size为1么?
|
||
class TableRecognitionResult(CVResult, HtmlMixin, XlsxMixin): | ||
class TableRecognitionResult(BaseCVResult, HtmlMixin, XlsxMixin): |
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.
是否应该将HtmlMixin和XlsxMixin合并为TableMixin,TableMixin提供html、xlsx相关方法。
class PP_ChatOCR_Pipeline(BasePipeline): | ||
"""PP-ChatOCR Pipeline""" | ||
|
||
entities = ["PP-ChatOCRv3-doc", "PP-ChatOCRv4-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.
后续ChatOCR迭代的话,仍然会沿用这一逻辑吗,如果后续版本有大的变更,那是否应该分开写?
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.
目前看大的逻辑不会变了
layout_parsing_config = config["SubPipelines"]["LayoutParser"] | ||
self.layout_parsing_pipeline = self.create_pipeline(layout_parsing_config) | ||
layout_parsing_config = config["SubPipelines"]["LayoutParser"] | ||
self.layout_parsing_pipeline = self.create_pipeline(layout_parsing_config) | ||
|
||
from .. import create_chat_bot |
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.
这里是否要移到上面?
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.
移到上面会循环应用
all_table_text_list, | ||
all_table_html_list, | ||
all_table_nei_text_list, | ||
) = all_visual_info | ||
|
||
final_results = {} | ||
failed_results = ["大模型调用失败", "未知", "未找到关键信息", "None", ""] |
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.
看上面的代码,failed_results应该是dict?
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.
修改了
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.
def generate_and_merge_chat_results(self, prompt: str, key_list: list, final_results: dict, failed_results: dict)中,failed_results好像是list
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.
修改了
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.
# print(prompt, llm_result)
这里可以删掉
https://github.com/PaddlePaddle/PaddleX/pull/2734/files#diff-6a1b32b7567e8a063375343e919c35d78242c535f36a551f01c4e9f67df77f1aR462
assert ( | ||
BaseCVResult.INPUT_IMG_KEY in data | ||
), f"`{BaseCVResult.INPUT_IMG_KEY}` is needed, but not found in `{list(data.keys())}`!" | ||
self._input_img = data.pop("input_img", None) |
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.
这里建议先不删除吧,我后续提PR删除,因为要配合CV其他模块一起改,其他模块都是依赖self._input_img的,会导致CI挂。
No description provided.