PP-ChatOCRv4-doc.yaml 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. pipeline_name: PP-ChatOCRv4-doc
  2. use_layout_parser: True
  3. use_mllm_predict: True
  4. SubModules:
  5. LLM_Chat:
  6. module_name: chat_bot
  7. model_name: ernie-3.5-8k
  8. base_url: "https://qianfan.baidubce.com/v2"
  9. api_type: openai
  10. api_key: "api_key" # Set this to a real API key
  11. LLM_Retriever:
  12. module_name: retriever
  13. model_name: embedding-v1
  14. base_url: "https://qianfan.baidubce.com/v2"
  15. api_type: qianfan
  16. api_key: "api_key" # Set this to a real API key
  17. MLLM_Chat:
  18. module_name: chat_bot
  19. model_name: PP-DocBee
  20. base_url: "http://127.0.0.1:8080/v1/chat/completions"
  21. api_type: openai
  22. api_key: "api_key"
  23. PromptEngneering:
  24. KIE_CommonText:
  25. module_name: prompt_engneering
  26. task_type: text_kie_prompt_v2
  27. task_description: '你现在的任务是从OCR结果中提取问题列表中每一个问题的答案。
  28. OCR的文字识别结果使用```符号包围,包含所识别出来的文字,顺序在原始图片中从左至右、从上至下。
  29. 我指定的问题列表使用[]符号包围。请注意OCR的文字识别结果可能存在长句子换行被切断、不合理的分词、
  30. 文字被错误合并等问题,你需要结合上下文语义进行综合判断,以获取准确的答案。'
  31. output_format: '在返回结果时使用JSON格式,包含多个key-value对,key值为我指定的问题,value值为该问题对应的答案。
  32. 如果认为OCR识别结果中,对于问题key,没有答案,则将value赋值为"未知"。请只输出json格式的结果,
  33. 并做json格式校验后返回,不要包含其它多余文字!'
  34. rules_str: '请依次确认满足下面要求。(1)每个问题的答案用OCR结果的内容回答,针对问题回答尽可能详细和完整,
  35. 并保持格式、数字、正负号、单位、符号和标点都与OCR结果中的内容完全一致。
  36. (2)如果答案的句末有标点符号,请添加标点符号。
  37. (3)对于答案中的数字,如果可以推断出单位,请补充相应的单位。'
  38. few_shot_demo_text_content:
  39. few_shot_demo_key_value_list:
  40. KIE_Table:
  41. module_name: prompt_engneering
  42. task_type: table_kie_prompt_v2
  43. task_description: '你现在的任务是从输入的html格式的表格内容中提取问题列表中每一个问题的答案。
  44. 表格内容使用```符号包围,我指定的问题列表使用[]符号包围。'
  45. output_format: '在返回结果时使用JSON格式,包含多个key-value对,key值为我指定的问题,value值为该问题对应的答案。
  46. 如果认为表格内容中,对于问题key,没有答案,则将value赋值为"未知"。请只输出json格式的结果,
  47. 并做json格式校验后返回,不要包含其它多余文字!'
  48. rules_str: '请依次确认满足下面要求。(1)每个问题的答案用表格内容回答,针对问题回答尽可能详细和完整,
  49. 并保持格式、数字、正负号、单位、符号和标点都与表格内容完全一致。
  50. (2)对于答案中的数字,如果可以推断出单位,请补充相应的单位。
  51. (3)如果答案是百分比,请添加百分号。'
  52. few_shot_demo_text_content:
  53. few_shot_demo_key_value_list:
  54. Ensemble:
  55. module_name: prompt_engneering
  56. task_type: ensemble_prompt
  57. task_description: '你现在的任务是,对于一个问题,对比方法A和方法B的结果,选择更准确的一个回答。
  58. 问题用```符号包围。'
  59. output_format: '请返回JSON格式的结果,包含多个key-value对,key值为我指定的问题,
  60. value值为`方法A`或`方法B`。如果对于问题key,没有找到答案,将value赋值为"未知"。
  61. 请只输出json格式的结果,并做json格式校验后返回,不要包含其它多余文字!'
  62. rules_str: '对于涉及数字的问题,请返回与问题描述最相关且数字表述正确的答案。
  63. 请特别注意数字中的标点使用是否合理。'
  64. few_shot_demo_text_content:
  65. few_shot_demo_key_value_list:
  66. SubPipelines:
  67. LayoutParser:
  68. pipeline_name: layout_parsing
  69. use_doc_preprocessor: True
  70. use_general_ocr: True
  71. use_seal_recognition: True
  72. use_table_recognition: True
  73. use_formula_recognition: False
  74. SubModules:
  75. LayoutDetection:
  76. module_name: layout_detection
  77. model_name: RT-DETR-H_layout_3cls
  78. model_dir: null
  79. SubPipelines:
  80. DocPreprocessor:
  81. pipeline_name: doc_preprocessor
  82. use_doc_orientation_classify: True
  83. use_doc_unwarping: True
  84. SubModules:
  85. DocOrientationClassify:
  86. module_name: doc_text_orientation
  87. model_name: PP-LCNet_x1_0_doc_ori
  88. model_dir: null
  89. DocUnwarping:
  90. module_name: image_unwarping
  91. model_name: UVDoc
  92. model_dir: null
  93. GeneralOCR:
  94. pipeline_name: OCR
  95. text_type: general
  96. use_doc_preprocessor: False
  97. use_textline_orientation: False
  98. SubModules:
  99. TextDetection:
  100. module_name: text_detection
  101. model_name: PP-OCRv4_server_det
  102. model_dir: null
  103. limit_side_len: 960
  104. limit_type: max
  105. max_side_limit: 4000
  106. thresh: 0.3
  107. box_thresh: 0.6
  108. unclip_ratio: 1.5
  109. TextRecognition:
  110. module_name: text_recognition
  111. model_name: PP-OCRv4_server_rec_doc
  112. model_dir: null
  113. batch_size: 6
  114. score_thresh: 0.0
  115. TableRecognition:
  116. pipeline_name: table_recognition
  117. use_layout_detection: False
  118. use_doc_preprocessor: False
  119. use_ocr_model: False
  120. SubModules:
  121. TableStructureRecognition:
  122. module_name: table_structure_recognition
  123. model_name: SLANet_plus
  124. model_dir: null
  125. SealRecognition:
  126. pipeline_name: seal_recognition
  127. use_layout_detection: False
  128. use_doc_preprocessor: False
  129. SubPipelines:
  130. SealOCR:
  131. pipeline_name: OCR
  132. text_type: seal
  133. use_doc_preprocessor: False
  134. use_textline_orientation: False
  135. SubModules:
  136. TextDetection:
  137. module_name: seal_text_detection
  138. model_name: PP-OCRv4_server_seal_det
  139. model_dir: null
  140. limit_side_len: 736
  141. limit_type: min
  142. max_side_limit: 4000
  143. thresh: 0.2
  144. box_thresh: 0.6
  145. unclip_ratio: 0.5
  146. TextRecognition:
  147. module_name: text_recognition
  148. model_name: PP-OCRv4_server_rec_doc
  149. model_dir: null
  150. batch_size: 1
  151. score_thresh: 0