yomitoku 0.7.4__tar.gz → 0.8.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (214) hide show
  1. yomitoku-0.8.1/.github/FUNDING.yml +15 -0
  2. {yomitoku-0.7.4 → yomitoku-0.8.1}/PKG-INFO +2 -3
  3. {yomitoku-0.7.4 → yomitoku-0.8.1}/README.md +1 -2
  4. {yomitoku-0.7.4 → yomitoku-0.8.1}/README_EN.md +0 -1
  5. {yomitoku-0.7.4 → yomitoku-0.8.1}/docs/index.en.md +0 -4
  6. {yomitoku-0.7.4 → yomitoku-0.8.1}/docs/index.ja.md +1 -5
  7. {yomitoku-0.7.4 → yomitoku-0.8.1}/gallery.md +1 -0
  8. {yomitoku-0.7.4 → yomitoku-0.8.1}/scripts/register_hugging_face_hub.py +22 -10
  9. {yomitoku-0.7.4 → yomitoku-0.8.1}/src/yomitoku/configs/__init__.py +7 -0
  10. yomitoku-0.8.1/src/yomitoku/configs/cfg_layout_parser_rtdtrv2_v2.py +89 -0
  11. {yomitoku-0.7.4 → yomitoku-0.8.1}/src/yomitoku/configs/cfg_text_detector_dbnet.py +1 -1
  12. yomitoku-0.8.1/src/yomitoku/configs/cfg_text_detector_dbnet_v2.py +49 -0
  13. yomitoku-0.8.1/src/yomitoku/configs/cfg_text_recognizer_parseq_v2.py +51 -0
  14. {yomitoku-0.7.4 → yomitoku-0.8.1}/src/yomitoku/layout_parser.py +3 -2
  15. {yomitoku-0.7.4 → yomitoku-0.8.1}/src/yomitoku/postprocessor/rtdetr_postprocessor.py +11 -1
  16. {yomitoku-0.7.4 → yomitoku-0.8.1}/src/yomitoku/text_detector.py +6 -2
  17. {yomitoku-0.7.4 → yomitoku-0.8.1}/src/yomitoku/text_recognizer.py +7 -2
  18. yomitoku-0.8.1/static/in/gallery7.jpeg +0 -0
  19. yomitoku-0.8.1/static/out/figures/in_gallery1_p1_figure_0.png +0 -0
  20. yomitoku-0.8.1/static/out/figures/in_gallery1_p1_figure_1.png +0 -0
  21. yomitoku-0.8.1/static/out/figures/in_gallery1_p1_figure_2.png +0 -0
  22. yomitoku-0.8.1/static/out/figures/in_gallery1_p1_figure_3.png +0 -0
  23. yomitoku-0.8.1/static/out/figures/in_gallery1_p1_figure_4.png +0 -0
  24. yomitoku-0.8.1/static/out/figures/in_gallery1_p1_figure_5.png +0 -0
  25. yomitoku-0.8.1/static/out/figures/in_gallery1_p1_figure_6.png +0 -0
  26. yomitoku-0.8.1/static/out/figures/in_gallery1_p1_figure_7.png +0 -0
  27. yomitoku-0.8.1/static/out/figures/in_gallery1_p1_figure_8.png +0 -0
  28. yomitoku-0.8.1/static/out/figures/in_gallery1_p1_figure_9.png +0 -0
  29. yomitoku-0.8.1/static/out/figures/in_gallery3_p1_figure_0.png +0 -0
  30. yomitoku-0.8.1/static/out/figures/in_gallery3_p1_figure_1.png +0 -0
  31. yomitoku-0.8.1/static/out/figures/in_gallery5_p1_figure_0.png +0 -0
  32. yomitoku-0.8.1/static/out/figures/in_gallery6_p1_figure_0.png +0 -0
  33. yomitoku-0.8.1/static/out/figures/in_gallery7_p1_figure_0.png +0 -0
  34. {yomitoku-0.7.4 → yomitoku-0.8.1}/static/out/in_demo_p1.html +26 -26
  35. yomitoku-0.8.1/static/out/in_demo_p1.md +38 -0
  36. yomitoku-0.8.1/static/out/in_demo_p1_layout.jpg +0 -0
  37. yomitoku-0.8.1/static/out/in_demo_p1_ocr.jpg +0 -0
  38. {yomitoku-0.7.4 → yomitoku-0.8.1}/static/out/in_gallery1_p1.html +19 -24
  39. {yomitoku-0.7.4 → yomitoku-0.8.1}/static/out/in_gallery1_p1.md +16 -28
  40. yomitoku-0.8.1/static/out/in_gallery1_p1_layout.jpg +0 -0
  41. yomitoku-0.8.1/static/out/in_gallery1_p1_ocr.jpg +0 -0
  42. {yomitoku-0.7.4 → yomitoku-0.8.1}/static/out/in_gallery2_p1.html +22 -31
  43. yomitoku-0.8.1/static/out/in_gallery2_p1.md +26 -0
  44. yomitoku-0.8.1/static/out/in_gallery2_p1_layout.jpg +0 -0
  45. yomitoku-0.8.1/static/out/in_gallery2_p1_ocr.jpg +0 -0
  46. {yomitoku-0.7.4 → yomitoku-0.8.1}/static/out/in_gallery3_p1.html +9 -7
  47. {yomitoku-0.7.4 → yomitoku-0.8.1}/static/out/in_gallery3_p1.md +6 -8
  48. yomitoku-0.8.1/static/out/in_gallery3_p1_layout.jpg +0 -0
  49. yomitoku-0.8.1/static/out/in_gallery3_p1_ocr.jpg +0 -0
  50. yomitoku-0.8.1/static/out/in_gallery4_p1.html +30 -0
  51. yomitoku-0.8.1/static/out/in_gallery4_p1.md +51 -0
  52. yomitoku-0.8.1/static/out/in_gallery4_p1_layout.jpg +0 -0
  53. yomitoku-0.8.1/static/out/in_gallery4_p1_ocr.jpg +0 -0
  54. yomitoku-0.8.1/static/out/in_gallery5_p1.html +4 -0
  55. yomitoku-0.8.1/static/out/in_gallery5_p1.md +1 -0
  56. yomitoku-0.8.1/static/out/in_gallery5_p1_layout.jpg +0 -0
  57. yomitoku-0.8.1/static/out/in_gallery5_p1_ocr.jpg +0 -0
  58. {yomitoku-0.7.4 → yomitoku-0.8.1}/static/out/in_gallery6_p1.html +16 -14
  59. yomitoku-0.8.1/static/out/in_gallery6_p1.md +37 -0
  60. yomitoku-0.8.1/static/out/in_gallery6_p1_layout.jpg +0 -0
  61. yomitoku-0.8.1/static/out/in_gallery6_p1_ocr.jpg +0 -0
  62. yomitoku-0.8.1/static/out/in_gallery7_p1.html +25 -0
  63. yomitoku-0.8.1/static/out/in_gallery7_p1_layout.jpg +0 -0
  64. yomitoku-0.8.1/static/out/in_gallery7_p1_ocr.jpg +0 -0
  65. yomitoku-0.8.1/tests/data/invalid.pdf +0 -0
  66. yomitoku-0.7.4/static/out/figures/in_gallery1_p1_figure_0.png +0 -0
  67. yomitoku-0.7.4/static/out/figures/in_gallery1_p1_figure_1.png +0 -0
  68. yomitoku-0.7.4/static/out/figures/in_gallery1_p1_figure_2.png +0 -0
  69. yomitoku-0.7.4/static/out/figures/in_gallery1_p1_figure_3.png +0 -0
  70. yomitoku-0.7.4/static/out/figures/in_gallery1_p1_figure_4.png +0 -0
  71. yomitoku-0.7.4/static/out/figures/in_gallery1_p1_figure_5.png +0 -0
  72. yomitoku-0.7.4/static/out/figures/in_gallery1_p1_figure_6.png +0 -0
  73. yomitoku-0.7.4/static/out/figures/in_gallery1_p1_figure_7.png +0 -0
  74. yomitoku-0.7.4/static/out/figures/in_gallery1_p1_figure_8.png +0 -0
  75. yomitoku-0.7.4/static/out/figures/in_gallery1_p1_figure_9.png +0 -0
  76. yomitoku-0.7.4/static/out/figures/in_gallery3_p1_figure_0.png +0 -0
  77. yomitoku-0.7.4/static/out/figures/in_gallery3_p1_figure_1.png +0 -0
  78. yomitoku-0.7.4/static/out/figures/in_gallery5_p1_figure_0.png +0 -0
  79. yomitoku-0.7.4/static/out/figures/in_gallery6_p1_figure_0.png +0 -0
  80. yomitoku-0.7.4/static/out/in_demo_p1.md +0 -38
  81. yomitoku-0.7.4/static/out/in_demo_p1_layout.jpg +0 -0
  82. yomitoku-0.7.4/static/out/in_demo_p1_ocr.jpg +0 -0
  83. yomitoku-0.7.4/static/out/in_gallery1_p1_layout.jpg +0 -0
  84. yomitoku-0.7.4/static/out/in_gallery1_p1_ocr.jpg +0 -0
  85. yomitoku-0.7.4/static/out/in_gallery2_p1.md +0 -26
  86. yomitoku-0.7.4/static/out/in_gallery2_p1_layout.jpg +0 -0
  87. yomitoku-0.7.4/static/out/in_gallery2_p1_ocr.jpg +0 -0
  88. yomitoku-0.7.4/static/out/in_gallery3_p1_layout.jpg +0 -0
  89. yomitoku-0.7.4/static/out/in_gallery3_p1_ocr.jpg +0 -0
  90. yomitoku-0.7.4/static/out/in_gallery4_p1.html +0 -42
  91. yomitoku-0.7.4/static/out/in_gallery4_p1.md +0 -23
  92. yomitoku-0.7.4/static/out/in_gallery4_p1_layout.jpg +0 -0
  93. yomitoku-0.7.4/static/out/in_gallery4_p1_ocr.jpg +0 -0
  94. yomitoku-0.7.4/static/out/in_gallery5_p1.html +0 -42
  95. yomitoku-0.7.4/static/out/in_gallery5_p1.md +0 -39
  96. yomitoku-0.7.4/static/out/in_gallery5_p1_layout.jpg +0 -0
  97. yomitoku-0.7.4/static/out/in_gallery5_p1_ocr.jpg +0 -0
  98. yomitoku-0.7.4/static/out/in_gallery6_p1.md +0 -33
  99. yomitoku-0.7.4/static/out/in_gallery6_p1_layout.jpg +0 -0
  100. yomitoku-0.7.4/static/out/in_gallery6_p1_ocr.jpg +0 -0
  101. {yomitoku-0.7.4 → yomitoku-0.8.1}/.github/release-drafter.yml +0 -0
  102. {yomitoku-0.7.4 → yomitoku-0.8.1}/.github/workflows/build-and-publish-docs.yaml +0 -0
  103. {yomitoku-0.7.4 → yomitoku-0.8.1}/.github/workflows/build-and-publish.yml +0 -0
  104. {yomitoku-0.7.4 → yomitoku-0.8.1}/.github/workflows/create-release.yml +0 -0
  105. {yomitoku-0.7.4 → yomitoku-0.8.1}/.github/workflows/lint-and-test.yml +0 -0
  106. {yomitoku-0.7.4 → yomitoku-0.8.1}/.gitignore +0 -0
  107. {yomitoku-0.7.4 → yomitoku-0.8.1}/.pre-commit-config.yaml +0 -0
  108. {yomitoku-0.7.4 → yomitoku-0.8.1}/.python-version +0 -0
  109. {yomitoku-0.7.4 → yomitoku-0.8.1}/configs/yomitoku-layout-parser-rtdtrv2-open-beta.yaml +0 -0
  110. {yomitoku-0.7.4 → yomitoku-0.8.1}/configs/yomitoku-table-structure-recognizer-rtdtrv2-open-beta.yaml +0 -0
  111. {yomitoku-0.7.4 → yomitoku-0.8.1}/configs/yomitoku-text-detector-dbnet-open-beta.yaml +0 -0
  112. {yomitoku-0.7.4 → yomitoku-0.8.1}/configs/yomitoku-text-recognizer-parseq-open-beta.yaml +0 -0
  113. {yomitoku-0.7.4 → yomitoku-0.8.1}/configs/yomitoku-text-recognizer-parseq-small-open-beta.yaml +0 -0
  114. {yomitoku-0.7.4 → yomitoku-0.8.1}/demo/sample.pdf +0 -0
  115. {yomitoku-0.7.4 → yomitoku-0.8.1}/demo/setting_document_anaysis.py +0 -0
  116. {yomitoku-0.7.4 → yomitoku-0.8.1}/demo/simple_document_analysis.py +0 -0
  117. {yomitoku-0.7.4 → yomitoku-0.8.1}/demo/simple_layout.py +0 -0
  118. {yomitoku-0.7.4 → yomitoku-0.8.1}/demo/simple_ocr.py +0 -0
  119. {yomitoku-0.7.4 → yomitoku-0.8.1}/demo/text_detector.yaml +0 -0
  120. {yomitoku-0.7.4 → yomitoku-0.8.1}/dockerfile +0 -0
  121. {yomitoku-0.7.4 → yomitoku-0.8.1}/docs/assets/logo.svg +0 -0
  122. {yomitoku-0.7.4 → yomitoku-0.8.1}/docs/cli.en.md +0 -0
  123. {yomitoku-0.7.4 → yomitoku-0.8.1}/docs/cli.ja.md +0 -0
  124. {yomitoku-0.7.4 → yomitoku-0.8.1}/docs/configuration.en.md +0 -0
  125. {yomitoku-0.7.4 → yomitoku-0.8.1}/docs/configuration.ja.md +0 -0
  126. {yomitoku-0.7.4 → yomitoku-0.8.1}/docs/installation.en.md +0 -0
  127. {yomitoku-0.7.4 → yomitoku-0.8.1}/docs/installation.ja.md +0 -0
  128. {yomitoku-0.7.4 → yomitoku-0.8.1}/docs/module.en.md +0 -0
  129. {yomitoku-0.7.4 → yomitoku-0.8.1}/docs/module.ja.md +0 -0
  130. {yomitoku-0.7.4 → yomitoku-0.8.1}/mkdocs.yml +0 -0
  131. {yomitoku-0.7.4 → yomitoku-0.8.1}/pyproject.toml +0 -0
  132. {yomitoku-0.7.4 → yomitoku-0.8.1}/pytest.ini +0 -0
  133. {yomitoku-0.7.4 → yomitoku-0.8.1}/src/yomitoku/__init__.py +0 -0
  134. {yomitoku-0.7.4 → yomitoku-0.8.1}/src/yomitoku/base.py +0 -0
  135. {yomitoku-0.7.4 → yomitoku-0.8.1}/src/yomitoku/cli/__init__.py +0 -0
  136. {yomitoku-0.7.4 → yomitoku-0.8.1}/src/yomitoku/cli/main.py +0 -0
  137. {yomitoku-0.7.4 → yomitoku-0.8.1}/src/yomitoku/configs/cfg_layout_parser_rtdtrv2.py +0 -0
  138. {yomitoku-0.7.4 → yomitoku-0.8.1}/src/yomitoku/configs/cfg_table_structure_recognizer_rtdtrv2.py +0 -0
  139. {yomitoku-0.7.4 → yomitoku-0.8.1}/src/yomitoku/configs/cfg_text_recognizer_parseq.py +0 -0
  140. {yomitoku-0.7.4 → yomitoku-0.8.1}/src/yomitoku/configs/cfg_text_recognizer_parseq_small.py +0 -0
  141. {yomitoku-0.7.4 → yomitoku-0.8.1}/src/yomitoku/constants.py +0 -0
  142. {yomitoku-0.7.4 → yomitoku-0.8.1}/src/yomitoku/data/__init__.py +0 -0
  143. {yomitoku-0.7.4 → yomitoku-0.8.1}/src/yomitoku/data/dataset.py +0 -0
  144. {yomitoku-0.7.4 → yomitoku-0.8.1}/src/yomitoku/data/functions.py +0 -0
  145. {yomitoku-0.7.4 → yomitoku-0.8.1}/src/yomitoku/document_analyzer.py +0 -0
  146. {yomitoku-0.7.4 → yomitoku-0.8.1}/src/yomitoku/export/__init__.py +0 -0
  147. {yomitoku-0.7.4 → yomitoku-0.8.1}/src/yomitoku/export/export_csv.py +0 -0
  148. {yomitoku-0.7.4 → yomitoku-0.8.1}/src/yomitoku/export/export_html.py +0 -0
  149. {yomitoku-0.7.4 → yomitoku-0.8.1}/src/yomitoku/export/export_json.py +0 -0
  150. {yomitoku-0.7.4 → yomitoku-0.8.1}/src/yomitoku/export/export_markdown.py +0 -0
  151. {yomitoku-0.7.4 → yomitoku-0.8.1}/src/yomitoku/layout_analyzer.py +0 -0
  152. {yomitoku-0.7.4 → yomitoku-0.8.1}/src/yomitoku/models/__init__.py +0 -0
  153. {yomitoku-0.7.4 → yomitoku-0.8.1}/src/yomitoku/models/dbnet_plus.py +0 -0
  154. {yomitoku-0.7.4 → yomitoku-0.8.1}/src/yomitoku/models/layers/__init__.py +0 -0
  155. {yomitoku-0.7.4 → yomitoku-0.8.1}/src/yomitoku/models/layers/activate.py +0 -0
  156. {yomitoku-0.7.4 → yomitoku-0.8.1}/src/yomitoku/models/layers/dbnet_feature_attention.py +0 -0
  157. {yomitoku-0.7.4 → yomitoku-0.8.1}/src/yomitoku/models/layers/parseq_transformer.py +0 -0
  158. {yomitoku-0.7.4 → yomitoku-0.8.1}/src/yomitoku/models/layers/rtdetr_backbone.py +0 -0
  159. {yomitoku-0.7.4 → yomitoku-0.8.1}/src/yomitoku/models/layers/rtdetr_hybrid_encoder.py +0 -0
  160. {yomitoku-0.7.4 → yomitoku-0.8.1}/src/yomitoku/models/layers/rtdetrv2_decoder.py +0 -0
  161. {yomitoku-0.7.4 → yomitoku-0.8.1}/src/yomitoku/models/parseq.py +0 -0
  162. {yomitoku-0.7.4 → yomitoku-0.8.1}/src/yomitoku/models/rtdetr.py +0 -0
  163. {yomitoku-0.7.4 → yomitoku-0.8.1}/src/yomitoku/ocr.py +0 -0
  164. {yomitoku-0.7.4 → yomitoku-0.8.1}/src/yomitoku/onnx/.gitkeep +0 -0
  165. {yomitoku-0.7.4 → yomitoku-0.8.1}/src/yomitoku/postprocessor/__init__.py +0 -0
  166. {yomitoku-0.7.4 → yomitoku-0.8.1}/src/yomitoku/postprocessor/dbnet_postporcessor.py +0 -0
  167. {yomitoku-0.7.4 → yomitoku-0.8.1}/src/yomitoku/postprocessor/parseq_tokenizer.py +0 -0
  168. {yomitoku-0.7.4 → yomitoku-0.8.1}/src/yomitoku/reading_order.py +0 -0
  169. {yomitoku-0.7.4 → yomitoku-0.8.1}/src/yomitoku/resource/MPLUS1p-Medium.ttf +0 -0
  170. {yomitoku-0.7.4 → yomitoku-0.8.1}/src/yomitoku/resource/charset.txt +0 -0
  171. {yomitoku-0.7.4 → yomitoku-0.8.1}/src/yomitoku/table_structure_recognizer.py +0 -0
  172. {yomitoku-0.7.4 → yomitoku-0.8.1}/src/yomitoku/utils/__init__.py +0 -0
  173. {yomitoku-0.7.4 → yomitoku-0.8.1}/src/yomitoku/utils/graph.py +0 -0
  174. {yomitoku-0.7.4 → yomitoku-0.8.1}/src/yomitoku/utils/logger.py +0 -0
  175. {yomitoku-0.7.4 → yomitoku-0.8.1}/src/yomitoku/utils/misc.py +0 -0
  176. {yomitoku-0.7.4 → yomitoku-0.8.1}/src/yomitoku/utils/visualizer.py +0 -0
  177. {yomitoku-0.7.4 → yomitoku-0.8.1}/static/in/demo.jpg +0 -0
  178. {yomitoku-0.7.4 → yomitoku-0.8.1}/static/in/gallery1.jpg +0 -0
  179. {yomitoku-0.7.4 → yomitoku-0.8.1}/static/in/gallery2.jpg +0 -0
  180. {yomitoku-0.7.4 → yomitoku-0.8.1}/static/in/gallery3.jpg +0 -0
  181. {yomitoku-0.7.4 → yomitoku-0.8.1}/static/in/gallery4.jpg +0 -0
  182. {yomitoku-0.7.4 → yomitoku-0.8.1}/static/in/gallery5.jpg +0 -0
  183. {yomitoku-0.7.4 → yomitoku-0.8.1}/static/in/gallery6.jpg +0 -0
  184. {yomitoku-0.7.4 → yomitoku-0.8.1}/static/logo/horizontal.png +0 -0
  185. {yomitoku-0.7.4 → yomitoku-0.8.1}/static/out/demo_html.png +0 -0
  186. {yomitoku-0.7.4 → yomitoku-0.8.1}/static/out/figures/in_demo_p1_figure_0.png +0 -0
  187. {yomitoku-0.7.4 → yomitoku-0.8.1}/static/out/figures/in_gallery1_p1_figure_10.png +0 -0
  188. {yomitoku-0.7.4 → yomitoku-0.8.1}/static/out/figures/in_gallery5_p1_figure_1.png +0 -0
  189. {yomitoku-0.7.4 → yomitoku-0.8.1}/static/out/figures/in_gallery6_p1_figure_1.png +0 -0
  190. /yomitoku-0.7.4/tests/data/invalid.jpg → /yomitoku-0.8.1/static/out/in_gallery7_p1.md +0 -0
  191. /yomitoku-0.7.4/tests/data/invalid.pdf → /yomitoku-0.8.1/tests/data/invalid.jpg +0 -0
  192. {yomitoku-0.7.4 → yomitoku-0.8.1}/tests/data/rgba.png +0 -0
  193. {yomitoku-0.7.4 → yomitoku-0.8.1}/tests/data/sampldoc.tif +0 -0
  194. {yomitoku-0.7.4 → yomitoku-0.8.1}/tests/data/small.jpg +0 -0
  195. {yomitoku-0.7.4 → yomitoku-0.8.1}/tests/data/subdir/test.jpg +0 -0
  196. {yomitoku-0.7.4 → yomitoku-0.8.1}/tests/data/test.bmp +0 -0
  197. {yomitoku-0.7.4 → yomitoku-0.8.1}/tests/data/test.jpg +0 -0
  198. {yomitoku-0.7.4 → yomitoku-0.8.1}/tests/data/test.pdf +0 -0
  199. {yomitoku-0.7.4 → yomitoku-0.8.1}/tests/data/test.png +0 -0
  200. {yomitoku-0.7.4 → yomitoku-0.8.1}/tests/data/test.tiff +0 -0
  201. {yomitoku-0.7.4 → yomitoku-0.8.1}/tests/data/test.txt +0 -0
  202. {yomitoku-0.7.4 → yomitoku-0.8.1}/tests/data/test_gray.jpg +0 -0
  203. {yomitoku-0.7.4 → yomitoku-0.8.1}/tests/test_base.py +0 -0
  204. {yomitoku-0.7.4 → yomitoku-0.8.1}/tests/test_cli.py +0 -0
  205. {yomitoku-0.7.4 → yomitoku-0.8.1}/tests/test_data.py +0 -0
  206. {yomitoku-0.7.4 → yomitoku-0.8.1}/tests/test_document_analyzer.py +0 -0
  207. {yomitoku-0.7.4 → yomitoku-0.8.1}/tests/test_export.py +0 -0
  208. {yomitoku-0.7.4 → yomitoku-0.8.1}/tests/test_layout_analyzer.py +0 -0
  209. {yomitoku-0.7.4 → yomitoku-0.8.1}/tests/test_ocr.py +0 -0
  210. {yomitoku-0.7.4 → yomitoku-0.8.1}/tests/yaml/layout_parser.yaml +0 -0
  211. {yomitoku-0.7.4 → yomitoku-0.8.1}/tests/yaml/table_structure_recognizer.yaml +0 -0
  212. {yomitoku-0.7.4 → yomitoku-0.8.1}/tests/yaml/text_detector.yaml +0 -0
  213. {yomitoku-0.7.4 → yomitoku-0.8.1}/tests/yaml/text_recognizer.yaml +0 -0
  214. {yomitoku-0.7.4 → yomitoku-0.8.1}/uv.lock +0 -0
@@ -0,0 +1,15 @@
1
+ # These are supported funding model platforms
2
+
3
+ github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
4
+ patreon: # Replace with a single Patreon username
5
+ open_collective: # Replace with a single Open Collective username
6
+ ko_fi: # Replace with a single Ko-fi username
7
+ tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8
+ community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9
+ liberapay: # Replace with a single Liberapay username
10
+ issuehunt: # Replace with a single IssueHunt username
11
+ lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
12
+ polar: # Replace with a single Polar username
13
+ buy_me_a_coffee: # Replace with a single Buy Me a Coffee username
14
+ thanks_dev: # Replace with a single thanks.dev username
15
+ custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: yomitoku
3
- Version: 0.7.4
3
+ Version: 0.8.1
4
4
  Summary: Yomitoku is an AI-powered document image analysis package designed specifically for the Japanese language.
5
5
  Author-email: Kotaro Kinoshita <kotaro.kinoshita@mlism.com>
6
6
  License: CC BY-NC-SA 4.0
@@ -37,7 +37,7 @@ Description-Content-Type: text/markdown
37
37
  YomiToku は日本語に特化した AI 文章画像解析エンジン(Document AI)です。画像内の文字の全文 OCR およびレイアウト解析機能を有しており、画像内の文字情報や図表を認識、抽出、変換します。
38
38
 
39
39
  - 🤖 日本語データセットで学習した 4 種類(文字位置の検知、文字列認識、レイアウト解析、表の構造認識)の AI モデルを搭載しています。4 種類のモデルはすべて独自に学習されたモデルで日本語文書に対して、高精度に推論可能です。
40
- - 🇯🇵 各モデルは日本語の文書画像に特化して学習されており、7000 文字を超える日本語文字の認識をサーポート、縦書きなど日本語特有のレイアウト構造の文書画像の解析も可能です。(日本語以外にも英語の文書に対しても対応しています)。
40
+ - 🇯🇵 各モデルは日本語の文書画像に特化して学習されており、7000 文字を超える日本語文字の認識をサーポート、手書き文字、縦書きなど日本語特有のレイアウト構造の文書画像の解析も可能です。(日本語以外にも英語の文書に対しても対応しています)。
41
41
  - 📈 レイアウト解析、表の構造解析, 読み順推定機能により、文書画像のレイアウトの意味的構造を壊さずに情報を抽出することが可能です。
42
42
  - 📄 多様な出力形式をサポートしています。html やマークダウン、json、csv のいずれかのフォーマットに変換可能です。また、文書内に含まれる図表、画像の抽出の出力も可能です。
43
43
  - ⚡ GPU 環境で高速に動作し、効率的に文書の文字起こし解析が可能です。また、VRAM も 8GB 以内で動作し、ハイエンドな GPU を用意する必要はありません。
@@ -103,7 +103,6 @@ yomitoku --help
103
103
  **NOTE**
104
104
 
105
105
  - GPU での実行を推奨します。CPU を用いての推論向けに最適化されておらず、処理時間が長くなります。
106
- - 活字のみ識別をサポートしております。手書き文字に関しては、読み取れる場合もありますが、公式にはサポートしておりません。
107
106
  - Yomitoku は文書 OCR 向けに最適化されており、情景 OCR(看板など紙以外にプリントされた文字の読み取り)向けには最適化されていません。
108
107
  - AI-OCR の識別精度を高めるために、入力画像の解像度が重要です。低解像度画像では識別精度が低下します。最低でも画像の短辺を 720px 以上の画像で推論することをお勧めします。
109
108
 
@@ -14,7 +14,7 @@
14
14
  YomiToku は日本語に特化した AI 文章画像解析エンジン(Document AI)です。画像内の文字の全文 OCR およびレイアウト解析機能を有しており、画像内の文字情報や図表を認識、抽出、変換します。
15
15
 
16
16
  - 🤖 日本語データセットで学習した 4 種類(文字位置の検知、文字列認識、レイアウト解析、表の構造認識)の AI モデルを搭載しています。4 種類のモデルはすべて独自に学習されたモデルで日本語文書に対して、高精度に推論可能です。
17
- - 🇯🇵 各モデルは日本語の文書画像に特化して学習されており、7000 文字を超える日本語文字の認識をサーポート、縦書きなど日本語特有のレイアウト構造の文書画像の解析も可能です。(日本語以外にも英語の文書に対しても対応しています)。
17
+ - 🇯🇵 各モデルは日本語の文書画像に特化して学習されており、7000 文字を超える日本語文字の認識をサーポート、手書き文字、縦書きなど日本語特有のレイアウト構造の文書画像の解析も可能です。(日本語以外にも英語の文書に対しても対応しています)。
18
18
  - 📈 レイアウト解析、表の構造解析, 読み順推定機能により、文書画像のレイアウトの意味的構造を壊さずに情報を抽出することが可能です。
19
19
  - 📄 多様な出力形式をサポートしています。html やマークダウン、json、csv のいずれかのフォーマットに変換可能です。また、文書内に含まれる図表、画像の抽出の出力も可能です。
20
20
  - ⚡ GPU 環境で高速に動作し、効率的に文書の文字起こし解析が可能です。また、VRAM も 8GB 以内で動作し、ハイエンドな GPU を用意する必要はありません。
@@ -80,7 +80,6 @@ yomitoku --help
80
80
  **NOTE**
81
81
 
82
82
  - GPU での実行を推奨します。CPU を用いての推論向けに最適化されておらず、処理時間が長くなります。
83
- - 活字のみ識別をサポートしております。手書き文字に関しては、読み取れる場合もありますが、公式にはサポートしておりません。
84
83
  - Yomitoku は文書 OCR 向けに最適化されており、情景 OCR(看板など紙以外にプリントされた文字の読み取り)向けには最適化されていません。
85
84
  - AI-OCR の識別精度を高めるために、入力画像の解像度が重要です。低解像度画像では識別精度が低下します。最低でも画像の短辺を 720px 以上の画像で推論することをお勧めします。
86
85
 
@@ -80,7 +80,6 @@ yomitoku --help
80
80
  **NOTE**
81
81
 
82
82
  - It is recommended to run on a GPU. The system is not optimized for inference on CPUs, which may result in significantly longer processing times.
83
- - Only printed text recognition is supported. While it may occasionally read handwritten text, official support is not provided.
84
83
  - YomiToku is optimized for document OCR and is not designed for scene OCR (e.g., text printed on non-paper surfaces like signs).
85
84
  - The resolution of input images is critical for improving the accuracy of AI-OCR recognition. Low-resolution images may lead to reduced recognition accuracy. It is recommended to use images with a minimum short side resolution of 720px for inference.
86
85
 
@@ -18,7 +18,3 @@ YomiToku connects to Hugging Face Hub to automatically download model files duri
18
18
  ### Q. Is commercial use allowed?
19
19
 
20
20
  A. This package is licensed under CC BY-NC 4.0. It is available for free for personal and research purposes. For commercial use, a paid commercial license is required. Please contact the developers for further details.
21
-
22
- ### Q. Can handwritten text be recognized?
23
-
24
- A. Only printed text recognition is supported. While handwritten text may occasionally be recognized, it is not officially supported.
@@ -3,7 +3,7 @@
3
3
  YomiToku は日本語に特化した AI 文章画像解析エンジン(Document AI)です。画像内の文字の全文 OCR およびレイアウト解析機能を有しており、画像内の文字情報や図表を認識、抽出、変換します。
4
4
 
5
5
  - 🤖 日本語データセットで学習した 4 種類(文字位置の検知、文字列認識、レイアウト解析、表の構造認識)の AI モデルを搭載しています。4 種類のモデルはすべて独自に学習されたモデルで日本語文書に対して、高精度に推論可能です。
6
- - 🇯🇵 各モデルは日本語の文書画像に特化して学習されており、7000 文字を超える日本語文字の認識をサーポート、縦書きなど日本語特有のレイアウト構造の文書画像の解析も可能です。(日本語以外にも英語の文書に対しても対応しています)。
6
+ - 🇯🇵 各モデルは日本語の文書画像に特化して学習されており、7000 文字を超える日本語文字の認識をサーポート、手書き文字、縦書きなど日本語特有のレイアウト構造の文書画像の解析も可能です。(日本語以外にも英語の文書に対しても対応しています)。
7
7
  - 📈 レイアウト解析、表の構造解析, 読み順推定機能により、文書画像のレイアウトの意味的構造を壊さずに情報を抽出することが可能です。
8
8
  - 📄 多様な出力形式をサポートしています。html やマークダウン、json、csv のいずれかのフォーマットに変換可能です。また、文書内に含まれる図表、画像の抽出の出力も可能です。
9
9
  - ⚡ GPU 環境で高速に動作し、効率的に文書の文字起こし解析が可能です。また、VRAM も 8GB 以内で動作し、ハイエンドな GPU を用意する必要はありません。
@@ -17,7 +17,3 @@ A. 可能です。Yomitoku は初回実行時に HuggingFaceHub にアクセス
17
17
  ### Q. 商用利用は可能ですか?
18
18
 
19
19
  A. 本パッケージは [CC BY-NC 4.0](https://creativecommons.org/licenses/by-nc/4.0/) に従います。個人の利用や研究利用に関しては無償でご利用いただけます。商用利用に関しては、別途、有償の商用ライセンスを発行しますので、開発者まで問い合わせください。
20
-
21
- ### Q. 手書き文字は認識できますか?
22
-
23
- A. 活字のみの識別をサポートしております。手書き文字に関しては、読み取れる場合もありますが、公式にはサポートしておりません。
@@ -6,6 +6,7 @@
6
6
  | <img src="static/in/gallery5.jpg" width="400px"> ※4 | <img src="static/out/in_gallery5_p1_ocr.jpg" width="400px"> ※4 | <img src="static/out/in_gallery5_p1_layout.jpg" width="400px"> ※4 | [results4](static/out/in_gallery5_p1.md) |
7
7
  | <img src="static/in/gallery4.jpg" width="400px"> | <img src="static/out/in_gallery4_p1_ocr.jpg" width="400px"> | <img src="static/out/in_gallery4_p1_layout.jpg" width="400px"> | [results5](static/out/in_gallery4_p1.md) |
8
8
  | <img src="static/in/gallery6.jpg" width="400px"> | <img src="static/out/in_gallery6_p1_ocr.jpg" width="400px"> | <img src="static/out/in_gallery6_p1_layout.jpg" width="400px"> | [results6](static/out/in_gallery6_p1.md) |
9
+ | <img src="static/in/gallery7.jpeg" width="400px"> | <img src="static/out/in_gallery7_p1_ocr.jpg" width="400px"> | <img src="static/out/in_gallery7_p1_layout.jpg" width="400px"> | [results7](static/out/in_gallery7_p1.md) |
9
10
 
10
11
  - ※1 出典:[「広報誌 令和 6 年 11 月号」](https://www.soumu.go.jp/menu_news/kouhoushi/koho/2411.html):(総務省) を加工して作成
11
12
  - ※2 出典:[「令和 7 年度歳出予算概算要求書(東日本大震災復興特別会計)」](https://www.soumu.go.jp/main_content/000967305.pdf):(総務省) を加工して作成
@@ -1,6 +1,5 @@
1
1
  import argparse
2
2
 
3
- import torch
4
3
 
5
4
  from yomitoku.layout_parser import LayoutParser
6
5
  from yomitoku.table_structure_recognizer import TableStructureRecognizer
@@ -8,31 +7,43 @@ from yomitoku.text_detector import TextDetector
8
7
  from yomitoku.text_recognizer import TextRecognizer
9
8
 
10
9
 
11
- def get_module(module_name):
10
+ def get_module(module_name, device):
12
11
  if module_name == "text_detector":
13
- module = TextDetector(from_pretrained=False)
12
+ module = TextDetector(
13
+ from_pretrained=True,
14
+ device=device,
15
+ )
14
16
  return module
15
17
 
16
18
  elif module_name == "text_recognizer":
17
- module = TextRecognizer(from_pretrained=False, model_name="parseq-small")
19
+ module = TextRecognizer(
20
+ from_pretrained=True,
21
+ device=device,
22
+ )
18
23
  return module
19
24
 
20
25
  elif module_name == "layout_parser":
21
- module = LayoutParser(from_pretrained=False)
26
+ module = LayoutParser(
27
+ from_pretrained=True,
28
+ device=device,
29
+ )
22
30
  return module
23
31
 
24
32
  elif module_name == "table_structure_recognizer":
25
- module = TableStructureRecognizer(from_pretrained=False)
33
+ module = TableStructureRecognizer(
34
+ from_pretrained=False,
35
+ device=device,
36
+ )
26
37
  return module
27
38
 
28
39
  raise ValueError(f"Invalid module name: {module_name}")
29
40
 
30
41
 
31
42
  def main(args):
32
- module = get_module(args.module)
33
- module.model.load_state_dict(
34
- torch.load(args.checkpoint, map_location="cpu")["model"]
35
- )
43
+ module = get_module(args.module, args.device)
44
+ # module.model.load_state_dict(
45
+ # torch.load(args.checkpoint, map_location="cpu")["model"]
46
+ # )
36
47
 
37
48
  module.model.save_pretrained(args.name)
38
49
  module.model.push_to_hub(f"{args.owner}/{args.name}")
@@ -44,6 +55,7 @@ if __name__ == "__main__":
44
55
  parser.add_argument("--checkpoint", type=str)
45
56
  parser.add_argument("--owner", type=str)
46
57
  parser.add_argument("--name", type=str)
58
+ parser.add_argument("--device", type=str, default="cuda")
47
59
  args = parser.parse_args()
48
60
 
49
61
  main(args)
@@ -1,10 +1,14 @@
1
1
  from .cfg_layout_parser_rtdtrv2 import LayoutParserRTDETRv2Config
2
+ from .cfg_layout_parser_rtdtrv2_v2 import LayoutParserRTDETRv2V2Config
2
3
  from .cfg_table_structure_recognizer_rtdtrv2 import (
3
4
  TableStructureRecognizerRTDETRv2Config,
4
5
  )
5
6
  from .cfg_text_detector_dbnet import TextDetectorDBNetConfig
7
+ from .cfg_text_detector_dbnet_v2 import TextDetectorDBNetV2Config
6
8
  from .cfg_text_recognizer_parseq import TextRecognizerPARSeqConfig
7
9
  from .cfg_text_recognizer_parseq_small import TextRecognizerPARSeqSmallConfig
10
+ from .cfg_text_recognizer_parseq_v2 import TextRecognizerPARSeqV2Config
11
+
8
12
 
9
13
  __all__ = [
10
14
  "TextDetectorDBNetConfig",
@@ -12,4 +16,7 @@ __all__ = [
12
16
  "LayoutParserRTDETRv2Config",
13
17
  "TableStructureRecognizerRTDETRv2Config",
14
18
  "TextRecognizerPARSeqSmallConfig",
19
+ "LayoutParserRTDETRv2V2Config",
20
+ "TextDetectorDBNetV2Config",
21
+ "TextRecognizerPARSeqV2Config",
15
22
  ]
@@ -0,0 +1,89 @@
1
+ from dataclasses import dataclass, field
2
+ from typing import List
3
+
4
+
5
+ @dataclass
6
+ class Data:
7
+ img_size: List[int] = field(default_factory=lambda: [640, 640])
8
+
9
+
10
+ @dataclass
11
+ class BackBone:
12
+ depth: int = 50
13
+ variant: str = "d"
14
+ freeze_at: int = 0
15
+ return_idx: List[int] = field(default_factory=lambda: [1, 2, 3])
16
+ num_stages: int = 4
17
+ freeze_norm: bool = True
18
+
19
+
20
+ @dataclass
21
+ class Encoder:
22
+ in_channels: List[int] = field(default_factory=lambda: [512, 1024, 2048])
23
+ feat_strides: List[int] = field(default_factory=lambda: [8, 16, 32])
24
+
25
+ # intra
26
+ hidden_dim: int = 256
27
+ use_encoder_idx: List[int] = field(default_factory=lambda: [2])
28
+ num_encoder_layers: int = 1
29
+ nhead: int = 8
30
+ dim_feedforward: int = 1024
31
+ dropout: float = 0.0
32
+ enc_act: str = "gelu"
33
+
34
+ # cross
35
+ expansion: float = 1.0
36
+ depth_mult: int = 1
37
+ act: str = "silu"
38
+
39
+
40
+ @dataclass
41
+ class Decoder:
42
+ num_classes: int = 6
43
+ feat_channels: List[int] = field(default_factory=lambda: [256, 256, 256])
44
+ feat_strides: List[int] = field(default_factory=lambda: [8, 16, 32])
45
+ hidden_dim: int = 256
46
+ num_levels: int = 3
47
+
48
+ num_layers: int = 6
49
+ num_queries: int = 300
50
+
51
+ num_denoising: int = 100
52
+ label_noise_ratio: float = 0.5
53
+ box_noise_scale: float = 1.0
54
+ eval_spatial_size: List[int] = field(default_factory=lambda: [640, 640])
55
+
56
+ eval_idx: int = -1
57
+
58
+ num_points: List[int] = field(default_factory=lambda: [4, 4, 4])
59
+ cross_attn_method: str = "default"
60
+ query_select_method: str = "default"
61
+
62
+
63
+ @dataclass
64
+ class LayoutParserRTDETRv2V2Config:
65
+ hf_hub_repo: str = "KotaroKinoshita/yomitoku-layout-parser-rtdtrv2-v2"
66
+ thresh_score: float = 0.5
67
+ data: Data = field(default_factory=Data)
68
+ PResNet: BackBone = field(default_factory=BackBone)
69
+ HybridEncoder: Encoder = field(default_factory=Encoder)
70
+ RTDETRTransformerv2: Decoder = field(default_factory=Decoder)
71
+
72
+ category: List[str] = field(
73
+ default_factory=lambda: [
74
+ "tables",
75
+ "figures",
76
+ "paragraphs",
77
+ "section_headings",
78
+ "page_header",
79
+ "page_footer",
80
+ ]
81
+ )
82
+
83
+ role: List[str] = field(
84
+ default_factory=lambda: [
85
+ "section_headings",
86
+ "page_header",
87
+ "page_footer",
88
+ ]
89
+ )
@@ -27,7 +27,7 @@ class Data:
27
27
  @dataclass
28
28
  class PostProcess:
29
29
  min_size: int = 2
30
- thresh: float = 0.2
30
+ thresh: float = 0.15
31
31
  box_thresh: float = 0.5
32
32
  max_candidates: int = 1500
33
33
  unclip_ratio: float = 7.0
@@ -0,0 +1,49 @@
1
+ from dataclasses import dataclass, field
2
+ from typing import List
3
+
4
+
5
+ @dataclass
6
+ class BackBone:
7
+ name: str = "resnet50"
8
+ dilation: bool = True
9
+
10
+
11
+ @dataclass
12
+ class Decoder:
13
+ in_channels: list[int] = field(default_factory=lambda: [256, 512, 1024, 2048])
14
+ hidden_dim: int = 256
15
+ adaptive: bool = True
16
+ serial: bool = True
17
+ smooth: bool = False
18
+ k: int = 50
19
+
20
+
21
+ @dataclass
22
+ class Data:
23
+ shortest_size: int = 1280
24
+ limit_size: int = 1600
25
+
26
+
27
+ @dataclass
28
+ class PostProcess:
29
+ min_size: int = 2
30
+ thresh: float = 0.2
31
+ box_thresh: float = 0.5
32
+ max_candidates: int = 1500
33
+ unclip_ratio: float = 5.0
34
+
35
+
36
+ @dataclass
37
+ class Visualize:
38
+ color: List[int] = field(default_factory=lambda: [0, 255, 0])
39
+ heatmap: bool = False
40
+
41
+
42
+ @dataclass
43
+ class TextDetectorDBNetV2Config:
44
+ hf_hub_repo: str = "KotaroKinoshita/yomitoku-text-detector-dbnet-v2"
45
+ backbone: BackBone = field(default_factory=BackBone)
46
+ decoder: Decoder = field(default_factory=Decoder)
47
+ data: Data = field(default_factory=Data)
48
+ post_process: PostProcess = field(default_factory=PostProcess)
49
+ visualize: Visualize = field(default_factory=Visualize)
@@ -0,0 +1,51 @@
1
+ from dataclasses import dataclass, field
2
+ from typing import List
3
+
4
+ from ..constants import ROOT_DIR
5
+
6
+
7
+ @dataclass
8
+ class Data:
9
+ num_workers: int = 4
10
+ batch_size: int = 128
11
+ img_size: List[int] = field(default_factory=lambda: [32, 800])
12
+
13
+
14
+ @dataclass
15
+ class Encoder:
16
+ patch_size: List[int] = field(default_factory=lambda: [8, 8])
17
+ num_heads: int = 8
18
+ embed_dim: int = 512
19
+ mlp_ratio: int = 4
20
+ depth: int = 12
21
+
22
+
23
+ @dataclass
24
+ class Decoder:
25
+ embed_dim: int = 512
26
+ num_heads: int = 8
27
+ mlp_ratio: int = 4
28
+ depth: int = 1
29
+
30
+
31
+ @dataclass
32
+ class Visualize:
33
+ font: str = str(ROOT_DIR + "/resource/MPLUS1p-Medium.ttf")
34
+ color: List[int] = field(default_factory=lambda: [0, 0, 255]) # RGB
35
+ font_size: int = 18
36
+
37
+
38
+ @dataclass
39
+ class TextRecognizerPARSeqV2Config:
40
+ hf_hub_repo: str = "KotaroKinoshita/yomitoku-text-recognizer-parseq-middle-v2"
41
+ charset: str = str(ROOT_DIR + "/resource/charset.txt")
42
+ num_tokens: int = 7312
43
+ max_label_length: int = 100
44
+ decode_ar: int = 1
45
+ refine_iters: int = 1
46
+
47
+ data: Data = field(default_factory=Data)
48
+ encoder: Encoder = field(default_factory=Encoder)
49
+ decoder: Decoder = field(default_factory=Decoder)
50
+
51
+ visualize: Visualize = field(default_factory=Visualize)
@@ -12,7 +12,7 @@ from pydantic import conlist
12
12
  from .constants import ROOT_DIR
13
13
 
14
14
  from .base import BaseModelCatalog, BaseModule, BaseSchema
15
- from .configs import LayoutParserRTDETRv2Config
15
+ from .configs import LayoutParserRTDETRv2Config, LayoutParserRTDETRv2V2Config
16
16
  from .models import RTDETRv2
17
17
  from .postprocessor import RTDETRPostProcessor
18
18
  from .utils.misc import filter_by_flag, is_contained
@@ -35,6 +35,7 @@ class LayoutParserModelCatalog(BaseModelCatalog):
35
35
  def __init__(self):
36
36
  super().__init__()
37
37
  self.register("rtdetrv2", LayoutParserRTDETRv2Config, RTDETRv2)
38
+ self.register("rtdetrv2v2", LayoutParserRTDETRv2V2Config, RTDETRv2)
38
39
 
39
40
 
40
41
  def filter_contained_rectangles_within_category(category_elements):
@@ -91,7 +92,7 @@ class LayoutParser(BaseModule):
91
92
 
92
93
  def __init__(
93
94
  self,
94
- model_name="rtdetrv2",
95
+ model_name="rtdetrv2v2",
95
96
  path_cfg=None,
96
97
  device="cuda",
97
98
  visualize=False,
@@ -49,6 +49,13 @@ class RTDETRPostProcessor(nn.Module):
49
49
  def extra_repr(self) -> str:
50
50
  return f"use_focal_loss={self.use_focal_loss}, num_classes={self.num_classes}, num_top_queries={self.num_top_queries}"
51
51
 
52
+ def clamp(self, boxes, h, w):
53
+ boxes[:, 0] = torch.clamp(boxes[:, 0], min=torch.Tensor([0]), max=None)
54
+ boxes[:, 1] = torch.clamp(boxes[:, 1], min=torch.Tensor([0]), max=None)
55
+ boxes[:, 2] = torch.clamp(boxes[:, 2], min=torch.Tensor([0]), max=w)
56
+ boxes[:, 3] = torch.clamp(boxes[:, 3], min=torch.Tensor([0]), max=h)
57
+ return boxes
58
+
52
59
  # def forward(self, outputs, orig_target_sizes):
53
60
  def forward(self, outputs, orig_target_sizes: torch.Tensor, threshold):
54
61
  logits, boxes = outputs["pred_logits"], outputs["pred_boxes"]
@@ -57,6 +64,8 @@ class RTDETRPostProcessor(nn.Module):
57
64
  bbox_pred = torchvision.ops.box_convert(boxes, in_fmt="cxcywh", out_fmt="xyxy")
58
65
  bbox_pred *= orig_target_sizes.repeat(1, 2).unsqueeze(1)
59
66
 
67
+ w, h = orig_target_sizes.unbind(1)
68
+
60
69
  if self.use_focal_loss:
61
70
  scores = F.sigmoid(logits)
62
71
  scores, index = torch.topk(scores.flatten(1), self.num_top_queries, dim=-1)
@@ -104,9 +113,10 @@ class RTDETRPostProcessor(nn.Module):
104
113
  sco = sco[sco > threshold]
105
114
 
106
115
  lab = lab.cpu().numpy()
107
- box = box.cpu().numpy()
108
116
  sco = sco.cpu().numpy()
109
117
 
118
+ box = self.clamp(box.cpu(), h.cpu(), w.cpu()).numpy()
119
+
110
120
  result = dict(labels=lab, boxes=box, scores=sco)
111
121
  results.append(result)
112
122
 
@@ -6,7 +6,10 @@ import os
6
6
  from pydantic import conlist
7
7
 
8
8
  from .base import BaseModelCatalog, BaseModule, BaseSchema
9
- from .configs import TextDetectorDBNetConfig
9
+ from .configs import (
10
+ TextDetectorDBNetConfig,
11
+ TextDetectorDBNetV2Config,
12
+ )
10
13
  from .data.functions import (
11
14
  array_to_tensor,
12
15
  resize_shortest_edge,
@@ -25,6 +28,7 @@ class TextDetectorModelCatalog(BaseModelCatalog):
25
28
  def __init__(self):
26
29
  super().__init__()
27
30
  self.register("dbnet", TextDetectorDBNetConfig, DBNet)
31
+ self.register("dbnetv2", TextDetectorDBNetV2Config, DBNet)
28
32
 
29
33
 
30
34
  class TextDetectorSchema(BaseSchema):
@@ -43,7 +47,7 @@ class TextDetector(BaseModule):
43
47
 
44
48
  def __init__(
45
49
  self,
46
- model_name="dbnet",
50
+ model_name="dbnetv2",
47
51
  path_cfg=None,
48
52
  device="cuda",
49
53
  visualize=False,
@@ -7,7 +7,11 @@ import unicodedata
7
7
  from pydantic import conlist
8
8
 
9
9
  from .base import BaseModelCatalog, BaseModule, BaseSchema
10
- from .configs import TextRecognizerPARSeqConfig, TextRecognizerPARSeqSmallConfig
10
+ from .configs import (
11
+ TextRecognizerPARSeqConfig,
12
+ TextRecognizerPARSeqSmallConfig,
13
+ TextRecognizerPARSeqV2Config,
14
+ )
11
15
  from .data.dataset import ParseqDataset
12
16
  from .models import PARSeq
13
17
  from .postprocessor import ParseqTokenizer as Tokenizer
@@ -23,6 +27,7 @@ class TextRecognizerModelCatalog(BaseModelCatalog):
23
27
  def __init__(self):
24
28
  super().__init__()
25
29
  self.register("parseq", TextRecognizerPARSeqConfig, PARSeq)
30
+ self.register("parseqv2", TextRecognizerPARSeqV2Config, PARSeq)
26
31
  self.register("parseq-small", TextRecognizerPARSeqSmallConfig, PARSeq)
27
32
 
28
33
 
@@ -44,7 +49,7 @@ class TextRecognizer(BaseModule):
44
49
 
45
50
  def __init__(
46
51
  self,
47
- model_name="parseq",
52
+ model_name="parseqv2",
48
53
  path_cfg=None,
49
54
  device="cuda",
50
55
  visualize=False,
Binary file