PP-DocTranslation.yaml 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  1. pipeline_name: PP-DocTranslation
  2. use_layout_parser: True
  3. SubModules:
  4. LLM_Chat:
  5. module_name: chat_bot
  6. model_name: ernie-3.5-8k
  7. base_url: "https://qianfan.baidubce.com/v2"
  8. api_type: openai
  9. api_key: "api_key" # Set this to a real API key
  10. PromptEngneering:
  11. Translate_CommonText:
  12. module_name: prompt_engneering
  13. task_type: translate_prompt
  14. task_description: '你是一位资深的多语种语言翻译专家,精通多种语言的语法、词汇、文化背景以及语言风格。你的任务是将文本从一种语言准确地转换为另一种语言,同时精准地保留原文的语义、风格和语调,确保翻译内容在目标语言中自然流畅且富有文化适应性。'
  15. output_format: '输出应为翻译后的文本,并与原文保持格式一致,包括标点符号和段落结构。如果原文中包含特定的格式(如表格、公式、列表等),翻译后的文本也应保持相同的格式。'
  16. rules_str: '通用规则:
  17. 1. 翻译应确保语义准确完整,并符合目标语言的表达习惯。
  18. 2. 保留原文的风格和语调,以传达相同的情感和意图。
  19. 3. 专有名词(如人名、地名、品牌名等)应保持不变,除非它们在目标语言中有公认的翻译。
  20. 4. 文化特定的表达或成语需根据目标语言的文化背景进行适当的转换或解释。
  21. 5. 避免使用机器翻译工具的简单直译,需根据上下文进行调整和优化。
  22. 6. 原文中可能包含的非文本元素(如HTML语法中的图片、表格、公式等)应保持不变。
  23. 7. 原文中可能包含的代码块,如编程语言代码等,应保持代码块的完整性,不要对代码进行调整。
  24. 8. 翻译完成后,应仔细校对,确保没有语法和拼写错误。'
  25. few_shot_demo_text_content:
  26. few_shot_demo_key_value_list:
  27. SubPipelines:
  28. LayoutParser:
  29. pipeline_name: PP-StructureV3
  30. batch_size: 8
  31. use_doc_preprocessor: False
  32. use_seal_recognition: False
  33. use_table_recognition: True
  34. use_formula_recognition: True
  35. use_chart_recognition: False
  36. use_region_detection: True
  37. SubModules:
  38. LayoutDetection:
  39. module_name: layout_detection
  40. model_name: PP-DocLayout_plus-L
  41. model_dir: null
  42. batch_size: 8
  43. threshold:
  44. 0: 0.3 # paragraph_title
  45. 1: 0.5 # image
  46. 2: 0.4 # text
  47. 3: 0.5 # number
  48. 4: 0.5 # abstract
  49. 5: 0.5 # content
  50. 6: 0.5 # figure_table_chart_title
  51. 7: 0.3 # formula
  52. 8: 0.5 # table
  53. 9: 0.5 # reference
  54. 10: 0.5 # doc_title
  55. 11: 0.5 # footnote
  56. 12: 0.5 # header
  57. 13: 0.5 # algorithm
  58. 14: 0.5 # footer
  59. 15: 0.45 # seal
  60. 16: 0.5 # chart
  61. 17: 0.5 # formula_number
  62. 18: 0.5 # aside_text
  63. 19: 0.5 # reference_content
  64. layout_nms: True
  65. layout_unclip_ratio: [1.0, 1.0]
  66. layout_merge_bboxes_mode:
  67. 0: "large" # paragraph_title
  68. 1: "large" # image
  69. 2: "union" # text
  70. 3: "union" # number
  71. 4: "union" # abstract
  72. 5: "union" # content
  73. 6: "union" # figure_table_chart_title
  74. 7: "large" # formula
  75. 8: "union" # table
  76. 9: "union" # reference
  77. 10: "union" # doc_title
  78. 11: "union" # footnote
  79. 12: "union" # header
  80. 13: "union" # algorithm
  81. 14: "union" # footer
  82. 15: "union" # seal
  83. 16: "large" # chart
  84. 17: "union" # formula_number
  85. 18: "union" # aside_text
  86. 19: "union" # reference_content
  87. ChartRecognition:
  88. module_name: chart_recognition
  89. model_name: PP-Chart2Table
  90. model_dir: null
  91. batch_size: 1
  92. RegionDetection:
  93. module_name: layout_detection
  94. model_name: PP-DocBlockLayout
  95. model_dir: null
  96. layout_nms: True
  97. layout_merge_bboxes_mode: "small"
  98. SubPipelines:
  99. DocPreprocessor:
  100. pipeline_name: doc_preprocessor
  101. batch_size: 8
  102. use_doc_orientation_classify: True
  103. use_doc_unwarping: True
  104. SubModules:
  105. DocOrientationClassify:
  106. module_name: doc_text_orientation
  107. model_name: PP-LCNet_x1_0_doc_ori
  108. model_dir: null
  109. batch_size: 8
  110. DocUnwarping:
  111. module_name: image_unwarping
  112. model_name: UVDoc
  113. model_dir: null
  114. GeneralOCR:
  115. pipeline_name: OCR
  116. batch_size: 8
  117. text_type: general
  118. use_doc_preprocessor: False
  119. use_textline_orientation: True
  120. SubModules:
  121. TextDetection:
  122. module_name: text_detection
  123. model_name: PP-OCRv5_server_det
  124. model_dir: null
  125. limit_side_len: 736
  126. limit_type: min
  127. max_side_limit: 4000
  128. thresh: 0.3
  129. box_thresh: 0.6
  130. unclip_ratio: 1.5
  131. TextLineOrientation:
  132. module_name: textline_orientation
  133. model_name: PP-LCNet_x1_0_textline_ori
  134. model_dir: null
  135. batch_size: 8
  136. TextRecognition:
  137. module_name: text_recognition
  138. model_name: PP-OCRv5_server_rec
  139. model_dir: null
  140. batch_size: 8
  141. score_thresh: 0.0
  142. TableRecognition:
  143. pipeline_name: table_recognition_v2
  144. use_layout_detection: False
  145. use_doc_preprocessor: False
  146. use_ocr_model: False
  147. SubModules:
  148. TableClassification:
  149. module_name: table_classification
  150. model_name: PP-LCNet_x1_0_table_cls
  151. model_dir: null
  152. WiredTableStructureRecognition:
  153. module_name: table_structure_recognition
  154. model_name: SLANeXt_wired
  155. model_dir: null
  156. WirelessTableStructureRecognition:
  157. module_name: table_structure_recognition
  158. model_name: SLANet_plus
  159. model_dir: null
  160. WiredTableCellsDetection:
  161. module_name: table_cells_detection
  162. model_name: RT-DETR-L_wired_table_cell_det
  163. model_dir: null
  164. WirelessTableCellsDetection:
  165. module_name: table_cells_detection
  166. model_name: RT-DETR-L_wireless_table_cell_det
  167. model_dir: null
  168. TableOrientationClassify:
  169. module_name: doc_text_orientation
  170. model_name: PP-LCNet_x1_0_doc_ori
  171. model_dir: null
  172. SubPipelines:
  173. GeneralOCR:
  174. pipeline_name: OCR
  175. text_type: general
  176. use_doc_preprocessor: False
  177. use_textline_orientation: True
  178. SubModules:
  179. TextDetection:
  180. module_name: text_detection
  181. model_name: PP-OCRv5_server_det
  182. model_dir: null
  183. limit_side_len: 736
  184. limit_type: min
  185. max_side_limit: 4000
  186. thresh: 0.3
  187. box_thresh: 0.4
  188. unclip_ratio: 1.5
  189. TextLineOrientation:
  190. module_name: textline_orientation
  191. model_name: PP-LCNet_x1_0_textline_ori
  192. model_dir: null
  193. batch_size: 8
  194. TextRecognition:
  195. module_name: text_recognition
  196. model_name: PP-OCRv5_server_rec
  197. model_dir: null
  198. batch_size: 8
  199. score_thresh: 0.0
  200. SealRecognition:
  201. pipeline_name: seal_recognition
  202. batch_size: 8
  203. use_layout_detection: False
  204. use_doc_preprocessor: False
  205. SubPipelines:
  206. SealOCR:
  207. pipeline_name: OCR
  208. batch_size: 8
  209. text_type: seal
  210. use_doc_preprocessor: False
  211. use_textline_orientation: False
  212. SubModules:
  213. TextDetection:
  214. module_name: seal_text_detection
  215. model_name: PP-OCRv4_server_seal_det
  216. model_dir: null
  217. limit_side_len: 736
  218. limit_type: min
  219. max_side_limit: 4000
  220. thresh: 0.2
  221. box_thresh: 0.6
  222. unclip_ratio: 0.5
  223. TextRecognition:
  224. module_name: text_recognition
  225. model_name: PP-OCRv5_server_rec
  226. model_dir: null
  227. batch_size: 8
  228. score_thresh: 0
  229. FormulaRecognition:
  230. pipeline_name: formula_recognition
  231. batch_size: 8
  232. use_layout_detection: False
  233. use_doc_preprocessor: False
  234. SubModules:
  235. FormulaRecognition:
  236. module_name: formula_recognition
  237. model_name: PP-FormulaNet_plus-L
  238. model_dir: null
  239. batch_size: 8