yomitoku 0.5.3__tar.gz → 0.7.4__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.
- {yomitoku-0.5.3 → yomitoku-0.7.4}/.github/workflows/lint-and-test.yml +3 -1
- {yomitoku-0.5.3 → yomitoku-0.7.4}/.gitignore +3 -1
- yomitoku-0.7.4/.python-version +1 -0
- {yomitoku-0.5.3 → yomitoku-0.7.4}/PKG-INFO +17 -9
- {yomitoku-0.5.3 → yomitoku-0.7.4}/README.md +12 -6
- {yomitoku-0.5.3 → yomitoku-0.7.4}/README_EN.md +12 -8
- yomitoku-0.5.3/configs/layout_parser_rtdetrv2.yaml → yomitoku-0.7.4/configs/yomitoku-layout-parser-rtdtrv2-open-beta.yaml +35 -28
- yomitoku-0.7.4/configs/yomitoku-table-structure-recognizer-rtdtrv2-open-beta.yaml +67 -0
- yomitoku-0.5.3/configs/text_detector.yaml → yomitoku-0.7.4/configs/yomitoku-text-detector-dbnet-open-beta.yaml +9 -9
- yomitoku-0.7.4/configs/yomitoku-text-recognizer-parseq-open-beta.yaml +32 -0
- yomitoku-0.7.4/configs/yomitoku-text-recognizer-parseq-small-open-beta.yaml +32 -0
- yomitoku-0.7.4/demo/setting_document_anaysis.py +6 -0
- {yomitoku-0.5.3 → yomitoku-0.7.4}/demo/simple_document_analysis.py +4 -7
- {yomitoku-0.5.3 → yomitoku-0.7.4}/demo/simple_layout.py +1 -1
- {yomitoku-0.5.3 → yomitoku-0.7.4}/demo/simple_ocr.py +1 -1
- yomitoku-0.7.4/docs/cli.en.md +110 -0
- yomitoku-0.7.4/docs/cli.ja.md +107 -0
- yomitoku-0.7.4/docs/configuration.en.md +94 -0
- yomitoku-0.7.4/docs/configuration.ja.md +96 -0
- {yomitoku-0.5.3 → yomitoku-0.7.4}/docs/index.en.md +4 -1
- {yomitoku-0.5.3 → yomitoku-0.7.4}/docs/index.ja.md +2 -2
- {yomitoku-0.5.3 → yomitoku-0.7.4}/docs/installation.en.md +6 -1
- {yomitoku-0.5.3 → yomitoku-0.7.4}/docs/installation.ja.md +6 -1
- yomitoku-0.5.3/docs/usage.en.md → yomitoku-0.7.4/docs/module.en.md +42 -110
- yomitoku-0.5.3/docs/usage.ja.md → yomitoku-0.7.4/docs/module.ja.md +36 -98
- {yomitoku-0.5.3 → yomitoku-0.7.4}/mkdocs.yml +3 -1
- {yomitoku-0.5.3 → yomitoku-0.7.4}/pyproject.toml +8 -4
- {yomitoku-0.5.3 → yomitoku-0.7.4}/scripts/register_hugging_face_hub.py +1 -1
- {yomitoku-0.5.3 → yomitoku-0.7.4}/src/yomitoku/base.py +1 -1
- yomitoku-0.7.4/src/yomitoku/cli/main.py +422 -0
- {yomitoku-0.5.3 → yomitoku-0.7.4}/src/yomitoku/configs/__init__.py +2 -0
- yomitoku-0.7.4/src/yomitoku/configs/cfg_text_recognizer_parseq_small.py +51 -0
- {yomitoku-0.5.3 → yomitoku-0.7.4}/src/yomitoku/data/functions.py +35 -17
- {yomitoku-0.5.3 → yomitoku-0.7.4}/src/yomitoku/document_analyzer.py +243 -35
- yomitoku-0.7.4/src/yomitoku/export/__init__.py +19 -0
- {yomitoku-0.5.3 → yomitoku-0.7.4}/src/yomitoku/export/export_csv.py +71 -2
- {yomitoku-0.5.3 → yomitoku-0.7.4}/src/yomitoku/export/export_html.py +46 -12
- yomitoku-0.7.4/src/yomitoku/export/export_json.py +97 -0
- {yomitoku-0.5.3 → yomitoku-0.7.4}/src/yomitoku/export/export_markdown.py +42 -6
- {yomitoku-0.5.3 → yomitoku-0.7.4}/src/yomitoku/layout_analyzer.py +1 -5
- {yomitoku-0.5.3 → yomitoku-0.7.4}/src/yomitoku/layout_parser.py +58 -4
- {yomitoku-0.5.3 → yomitoku-0.7.4}/src/yomitoku/models/layers/rtdetr_backbone.py +5 -15
- {yomitoku-0.5.3 → yomitoku-0.7.4}/src/yomitoku/models/layers/rtdetr_hybrid_encoder.py +6 -18
- {yomitoku-0.5.3 → yomitoku-0.7.4}/src/yomitoku/models/layers/rtdetrv2_decoder.py +17 -42
- {yomitoku-0.5.3 → yomitoku-0.7.4}/src/yomitoku/models/parseq.py +15 -9
- {yomitoku-0.5.3 → yomitoku-0.7.4}/src/yomitoku/ocr.py +24 -27
- {yomitoku-0.5.3 → yomitoku-0.7.4}/src/yomitoku/postprocessor/rtdetr_postprocessor.py +4 -13
- {yomitoku-0.5.3 → yomitoku-0.7.4}/src/yomitoku/table_structure_recognizer.py +82 -9
- {yomitoku-0.5.3 → yomitoku-0.7.4}/src/yomitoku/text_detector.py +57 -7
- {yomitoku-0.5.3 → yomitoku-0.7.4}/src/yomitoku/text_recognizer.py +81 -16
- {yomitoku-0.5.3 → yomitoku-0.7.4}/src/yomitoku/utils/misc.py +20 -13
- {yomitoku-0.5.3 → yomitoku-0.7.4}/src/yomitoku/utils/visualizer.py +5 -5
- yomitoku-0.7.4/static/out/in_demo_p1.html +84 -0
- yomitoku-0.7.4/static/out/in_demo_p1.md +38 -0
- yomitoku-0.7.4/static/out/in_demo_p1_ocr.jpg +0 -0
- yomitoku-0.7.4/static/out/in_gallery1_p1.html +71 -0
- yomitoku-0.7.4/static/out/in_gallery1_p1.md +70 -0
- yomitoku-0.7.4/static/out/in_gallery1_p1_layout.jpg +0 -0
- yomitoku-0.7.4/static/out/in_gallery1_p1_ocr.jpg +0 -0
- yomitoku-0.7.4/static/out/in_gallery2_p1.html +229 -0
- {yomitoku-0.5.3 → yomitoku-0.7.4}/static/out/in_gallery2_p1.md +12 -10
- yomitoku-0.7.4/static/out/in_gallery2_p1_layout.jpg +0 -0
- yomitoku-0.7.4/static/out/in_gallery2_p1_ocr.jpg +0 -0
- yomitoku-0.7.4/static/out/in_gallery3_p1.html +29 -0
- yomitoku-0.7.4/static/out/in_gallery3_p1.md +47 -0
- {yomitoku-0.5.3 → yomitoku-0.7.4}/static/out/in_gallery3_p1_layout.jpg +0 -0
- yomitoku-0.7.4/static/out/in_gallery3_p1_ocr.jpg +0 -0
- yomitoku-0.7.4/static/out/in_gallery4_p1.html +42 -0
- yomitoku-0.7.4/static/out/in_gallery4_p1.md +23 -0
- yomitoku-0.7.4/static/out/in_gallery4_p1_ocr.jpg +0 -0
- yomitoku-0.7.4/static/out/in_gallery5_p1.html +42 -0
- yomitoku-0.7.4/static/out/in_gallery5_p1.md +39 -0
- yomitoku-0.7.4/static/out/in_gallery5_p1_layout.jpg +0 -0
- yomitoku-0.7.4/static/out/in_gallery5_p1_ocr.jpg +0 -0
- yomitoku-0.7.4/static/out/in_gallery6_p1.html +76 -0
- yomitoku-0.7.4/static/out/in_gallery6_p1.md +33 -0
- yomitoku-0.7.4/static/out/in_gallery6_p1_layout.jpg +0 -0
- yomitoku-0.7.4/static/out/in_gallery6_p1_ocr.jpg +0 -0
- yomitoku-0.7.4/tests/data/invalid.pdf +0 -0
- yomitoku-0.7.4/tests/data/sampldoc.tif +0 -0
- {yomitoku-0.5.3 → yomitoku-0.7.4}/tests/test_cli.py +17 -0
- {yomitoku-0.5.3 → yomitoku-0.7.4}/tests/test_data.py +6 -4
- yomitoku-0.7.4/tests/test_document_analyzer.py +612 -0
- {yomitoku-0.5.3 → yomitoku-0.7.4}/tests/test_export.py +159 -14
- {yomitoku-0.5.3 → yomitoku-0.7.4}/tests/test_layout_analyzer.py +0 -9
- {yomitoku-0.5.3 → yomitoku-0.7.4}/tests/test_ocr.py +0 -9
- {yomitoku-0.5.3 → yomitoku-0.7.4}/uv.lock +346 -339
- yomitoku-0.5.3/.python-version +0 -1
- yomitoku-0.5.3/configs/table_structure_recognitizer.yaml +0 -2
- yomitoku-0.5.3/configs/text_recognizer.yaml +0 -14
- yomitoku-0.5.3/demo/setting_document_anaysis.py +0 -23
- yomitoku-0.5.3/src/yomitoku/cli/main.py +0 -230
- yomitoku-0.5.3/src/yomitoku/export/__init__.py +0 -6
- yomitoku-0.5.3/src/yomitoku/export/export_json.py +0 -34
- yomitoku-0.5.3/static/out/in_demo_p1.html +0 -86
- yomitoku-0.5.3/static/out/in_demo_p1.md +0 -38
- yomitoku-0.5.3/static/out/in_demo_p1_ocr.jpg +0 -0
- yomitoku-0.5.3/static/out/in_gallery1_p1.html +0 -92
- yomitoku-0.5.3/static/out/in_gallery1_p1.md +0 -78
- yomitoku-0.5.3/static/out/in_gallery1_p1_layout.jpg +0 -0
- yomitoku-0.5.3/static/out/in_gallery1_p1_ocr.jpg +0 -0
- yomitoku-0.5.3/static/out/in_gallery2_p1.html +0 -230
- yomitoku-0.5.3/static/out/in_gallery2_p1_layout.jpg +0 -0
- yomitoku-0.5.3/static/out/in_gallery2_p1_ocr.jpg +0 -0
- yomitoku-0.5.3/static/out/in_gallery3_p1.html +0 -36
- yomitoku-0.5.3/static/out/in_gallery3_p1.md +0 -49
- yomitoku-0.5.3/static/out/in_gallery3_p1_ocr.jpg +0 -0
- yomitoku-0.5.3/static/out/in_gallery4_p1.html +0 -44
- yomitoku-0.5.3/static/out/in_gallery4_p1.md +0 -23
- yomitoku-0.5.3/static/out/in_gallery4_p1_ocr.jpg +0 -0
- yomitoku-0.5.3/static/out/in_gallery5_p1.html +0 -50
- yomitoku-0.5.3/static/out/in_gallery5_p1.md +0 -45
- yomitoku-0.5.3/static/out/in_gallery5_p1_layout.jpg +0 -0
- yomitoku-0.5.3/static/out/in_gallery5_p1_ocr.jpg +0 -0
- yomitoku-0.5.3/static/out/in_gallery6_p1.html +0 -79
- yomitoku-0.5.3/static/out/in_gallery6_p1.md +0 -32
- yomitoku-0.5.3/static/out/in_gallery6_p1_layout.jpg +0 -0
- yomitoku-0.5.3/static/out/in_gallery6_p1_ocr.jpg +0 -0
- yomitoku-0.5.3/tests/test_document_analyzer.py +0 -88
- {yomitoku-0.5.3 → yomitoku-0.7.4}/.github/release-drafter.yml +0 -0
- {yomitoku-0.5.3 → yomitoku-0.7.4}/.github/workflows/build-and-publish-docs.yaml +0 -0
- {yomitoku-0.5.3 → yomitoku-0.7.4}/.github/workflows/build-and-publish.yml +0 -0
- {yomitoku-0.5.3 → yomitoku-0.7.4}/.github/workflows/create-release.yml +0 -0
- {yomitoku-0.5.3 → yomitoku-0.7.4}/.pre-commit-config.yaml +0 -0
- {yomitoku-0.5.3 → yomitoku-0.7.4}/demo/sample.pdf +0 -0
- {yomitoku-0.5.3 → yomitoku-0.7.4}/demo/text_detector.yaml +0 -0
- {yomitoku-0.5.3 → yomitoku-0.7.4}/dockerfile +0 -0
- {yomitoku-0.5.3 → yomitoku-0.7.4}/docs/assets/logo.svg +0 -0
- {yomitoku-0.5.3 → yomitoku-0.7.4}/gallery.md +0 -0
- {yomitoku-0.5.3 → yomitoku-0.7.4}/pytest.ini +0 -0
- {yomitoku-0.5.3 → yomitoku-0.7.4}/src/yomitoku/__init__.py +0 -0
- {yomitoku-0.5.3 → yomitoku-0.7.4}/src/yomitoku/cli/__init__.py +0 -0
- {yomitoku-0.5.3 → yomitoku-0.7.4}/src/yomitoku/configs/cfg_layout_parser_rtdtrv2.py +0 -0
- {yomitoku-0.5.3 → yomitoku-0.7.4}/src/yomitoku/configs/cfg_table_structure_recognizer_rtdtrv2.py +0 -0
- {yomitoku-0.5.3 → yomitoku-0.7.4}/src/yomitoku/configs/cfg_text_detector_dbnet.py +0 -0
- {yomitoku-0.5.3 → yomitoku-0.7.4}/src/yomitoku/configs/cfg_text_recognizer_parseq.py +0 -0
- {yomitoku-0.5.3 → yomitoku-0.7.4}/src/yomitoku/constants.py +0 -0
- {yomitoku-0.5.3 → yomitoku-0.7.4}/src/yomitoku/data/__init__.py +0 -0
- {yomitoku-0.5.3 → yomitoku-0.7.4}/src/yomitoku/data/dataset.py +0 -0
- {yomitoku-0.5.3 → yomitoku-0.7.4}/src/yomitoku/models/__init__.py +0 -0
- {yomitoku-0.5.3 → yomitoku-0.7.4}/src/yomitoku/models/dbnet_plus.py +0 -0
- {yomitoku-0.5.3 → yomitoku-0.7.4}/src/yomitoku/models/layers/__init__.py +0 -0
- {yomitoku-0.5.3 → yomitoku-0.7.4}/src/yomitoku/models/layers/activate.py +0 -0
- {yomitoku-0.5.3 → yomitoku-0.7.4}/src/yomitoku/models/layers/dbnet_feature_attention.py +0 -0
- {yomitoku-0.5.3 → yomitoku-0.7.4}/src/yomitoku/models/layers/parseq_transformer.py +0 -0
- {yomitoku-0.5.3 → yomitoku-0.7.4}/src/yomitoku/models/rtdetr.py +0 -0
- /yomitoku-0.5.3/src/yomitoku/utils/__init__.py → /yomitoku-0.7.4/src/yomitoku/onnx/.gitkeep +0 -0
- {yomitoku-0.5.3 → yomitoku-0.7.4}/src/yomitoku/postprocessor/__init__.py +0 -0
- {yomitoku-0.5.3 → yomitoku-0.7.4}/src/yomitoku/postprocessor/dbnet_postporcessor.py +0 -0
- {yomitoku-0.5.3 → yomitoku-0.7.4}/src/yomitoku/postprocessor/parseq_tokenizer.py +0 -0
- {yomitoku-0.5.3 → yomitoku-0.7.4}/src/yomitoku/reading_order.py +0 -0
- {yomitoku-0.5.3 → yomitoku-0.7.4}/src/yomitoku/resource/MPLUS1p-Medium.ttf +0 -0
- {yomitoku-0.5.3 → yomitoku-0.7.4}/src/yomitoku/resource/charset.txt +0 -0
- /yomitoku-0.5.3/tests/data/invalid.jpg → /yomitoku-0.7.4/src/yomitoku/utils/__init__.py +0 -0
- {yomitoku-0.5.3 → yomitoku-0.7.4}/src/yomitoku/utils/graph.py +0 -0
- {yomitoku-0.5.3 → yomitoku-0.7.4}/src/yomitoku/utils/logger.py +0 -0
- {yomitoku-0.5.3 → yomitoku-0.7.4}/static/in/demo.jpg +0 -0
- {yomitoku-0.5.3 → yomitoku-0.7.4}/static/in/gallery1.jpg +0 -0
- {yomitoku-0.5.3 → yomitoku-0.7.4}/static/in/gallery2.jpg +0 -0
- {yomitoku-0.5.3 → yomitoku-0.7.4}/static/in/gallery3.jpg +0 -0
- {yomitoku-0.5.3 → yomitoku-0.7.4}/static/in/gallery4.jpg +0 -0
- {yomitoku-0.5.3 → yomitoku-0.7.4}/static/in/gallery5.jpg +0 -0
- {yomitoku-0.5.3 → yomitoku-0.7.4}/static/in/gallery6.jpg +0 -0
- {yomitoku-0.5.3 → yomitoku-0.7.4}/static/logo/horizontal.png +0 -0
- {yomitoku-0.5.3 → yomitoku-0.7.4}/static/out/demo_html.png +0 -0
- {yomitoku-0.5.3 → yomitoku-0.7.4}/static/out/figures/in_demo_p1_figure_0.png +0 -0
- {yomitoku-0.5.3 → yomitoku-0.7.4}/static/out/figures/in_gallery1_p1_figure_0.png +0 -0
- {yomitoku-0.5.3 → yomitoku-0.7.4}/static/out/figures/in_gallery1_p1_figure_1.png +0 -0
- {yomitoku-0.5.3 → yomitoku-0.7.4}/static/out/figures/in_gallery1_p1_figure_10.png +0 -0
- {yomitoku-0.5.3 → yomitoku-0.7.4}/static/out/figures/in_gallery1_p1_figure_2.png +0 -0
- {yomitoku-0.5.3 → yomitoku-0.7.4}/static/out/figures/in_gallery1_p1_figure_3.png +0 -0
- {yomitoku-0.5.3 → yomitoku-0.7.4}/static/out/figures/in_gallery1_p1_figure_4.png +0 -0
- {yomitoku-0.5.3 → yomitoku-0.7.4}/static/out/figures/in_gallery1_p1_figure_5.png +0 -0
- {yomitoku-0.5.3 → yomitoku-0.7.4}/static/out/figures/in_gallery1_p1_figure_6.png +0 -0
- {yomitoku-0.5.3 → yomitoku-0.7.4}/static/out/figures/in_gallery1_p1_figure_7.png +0 -0
- {yomitoku-0.5.3 → yomitoku-0.7.4}/static/out/figures/in_gallery1_p1_figure_8.png +0 -0
- {yomitoku-0.5.3 → yomitoku-0.7.4}/static/out/figures/in_gallery1_p1_figure_9.png +0 -0
- {yomitoku-0.5.3 → yomitoku-0.7.4}/static/out/figures/in_gallery3_p1_figure_0.png +0 -0
- {yomitoku-0.5.3 → yomitoku-0.7.4}/static/out/figures/in_gallery3_p1_figure_1.png +0 -0
- {yomitoku-0.5.3 → yomitoku-0.7.4}/static/out/figures/in_gallery5_p1_figure_0.png +0 -0
- {yomitoku-0.5.3 → yomitoku-0.7.4}/static/out/figures/in_gallery5_p1_figure_1.png +0 -0
- {yomitoku-0.5.3 → yomitoku-0.7.4}/static/out/figures/in_gallery6_p1_figure_0.png +0 -0
- {yomitoku-0.5.3 → yomitoku-0.7.4}/static/out/figures/in_gallery6_p1_figure_1.png +0 -0
- {yomitoku-0.5.3 → yomitoku-0.7.4}/static/out/in_demo_p1_layout.jpg +0 -0
- {yomitoku-0.5.3 → yomitoku-0.7.4}/static/out/in_gallery4_p1_layout.jpg +0 -0
- /yomitoku-0.5.3/tests/data/invalid.pdf → /yomitoku-0.7.4/tests/data/invalid.jpg +0 -0
- {yomitoku-0.5.3 → yomitoku-0.7.4}/tests/data/rgba.png +0 -0
- {yomitoku-0.5.3 → yomitoku-0.7.4}/tests/data/small.jpg +0 -0
- {yomitoku-0.5.3 → yomitoku-0.7.4}/tests/data/subdir/test.jpg +0 -0
- {yomitoku-0.5.3 → yomitoku-0.7.4}/tests/data/test.bmp +0 -0
- {yomitoku-0.5.3 → yomitoku-0.7.4}/tests/data/test.jpg +0 -0
- {yomitoku-0.5.3 → yomitoku-0.7.4}/tests/data/test.pdf +0 -0
- {yomitoku-0.5.3 → yomitoku-0.7.4}/tests/data/test.png +0 -0
- {yomitoku-0.5.3 → yomitoku-0.7.4}/tests/data/test.tiff +0 -0
- {yomitoku-0.5.3 → yomitoku-0.7.4}/tests/data/test.txt +0 -0
- {yomitoku-0.5.3 → yomitoku-0.7.4}/tests/data/test_gray.jpg +0 -0
- {yomitoku-0.5.3 → yomitoku-0.7.4}/tests/test_base.py +0 -0
- {yomitoku-0.5.3 → yomitoku-0.7.4}/tests/yaml/layout_parser.yaml +0 -0
- {yomitoku-0.5.3 → yomitoku-0.7.4}/tests/yaml/table_structure_recognizer.yaml +0 -0
- {yomitoku-0.5.3 → yomitoku-0.7.4}/tests/yaml/text_detector.yaml +0 -0
- {yomitoku-0.5.3 → yomitoku-0.7.4}/tests/yaml/text_recognizer.yaml +0 -0
@@ -30,6 +30,8 @@ jobs:
|
|
30
30
|
enable-cache: true
|
31
31
|
- name: pin python version
|
32
32
|
run: uv python pin 3.12
|
33
|
+
- name: Update apt
|
34
|
+
run: sudo apt update
|
33
35
|
- name: Install dependencies
|
34
36
|
run: sudo apt install -y libopencv-dev poppler-utils
|
35
37
|
- name: Install tox-uv
|
@@ -37,4 +39,4 @@ jobs:
|
|
37
39
|
- name: Run linter
|
38
40
|
run: tox -e lint
|
39
41
|
- name: Run tests
|
40
|
-
run:
|
42
|
+
run: tox -p -e py310,py311,py312
|
@@ -0,0 +1 @@
|
|
1
|
+
3.10
|
@@ -1,14 +1,16 @@
|
|
1
|
-
Metadata-Version: 2.
|
1
|
+
Metadata-Version: 2.4
|
2
2
|
Name: yomitoku
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.7.4
|
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
|
7
7
|
Keywords: Deep Learning,Japanese,OCR
|
8
|
-
Requires-Python: <3.13,>=3.
|
8
|
+
Requires-Python: <3.13,>=3.10
|
9
9
|
Requires-Dist: huggingface-hub>=0.26.1
|
10
10
|
Requires-Dist: lxml>=5.3.0
|
11
11
|
Requires-Dist: omegaconf>=2.3.0
|
12
|
+
Requires-Dist: onnx>=1.17.0
|
13
|
+
Requires-Dist: onnxruntime>=1.20.1
|
12
14
|
Requires-Dist: opencv-python>=4.10.0.84
|
13
15
|
Requires-Dist: pyclipper>=1.3.0.post6
|
14
16
|
Requires-Dist: pydantic>=2.9.2
|
@@ -23,11 +25,12 @@ Description-Content-Type: text/markdown
|
|
23
25
|
|
24
26
|
<img src="static/logo/horizontal.png" width="800px">
|
25
27
|
|
26
|
-

|
27
29
|

|
28
30
|

|
29
31
|

|
30
32
|
[](https://kotaro-kinoshita.github.io/yomitoku/)
|
33
|
+
[](https://pepy.tech/projects/yomitoku)
|
31
34
|
|
32
35
|
## 🌟 概要
|
33
36
|
|
@@ -69,23 +72,27 @@ Markdown でエクスポートした結果は関してはリポジトリ内の[s
|
|
69
72
|
pip install yomitoku
|
70
73
|
```
|
71
74
|
|
72
|
-
- pytorch はご自身の CUDAのバージョンにあったものをインストールしてください。デフォルトではCUDA12.4以上に対応したものがインストールされます。
|
73
|
-
- pytorch は2.5以上のバージョンに対応しています。その関係でCUDA11.8以上のバージョンが必要になります。対応できない場合は、リポジトリ内のDockerfileを利用してください。
|
75
|
+
- pytorch はご自身の CUDA のバージョンにあったものをインストールしてください。デフォルトでは CUDA12.4 以上に対応したものがインストールされます。
|
76
|
+
- pytorch は 2.5 以上のバージョンに対応しています。その関係で CUDA11.8 以上のバージョンが必要になります。対応できない場合は、リポジトリ内の Dockerfile を利用してください。
|
74
77
|
|
75
78
|
## 🚀 実行方法
|
76
79
|
|
77
80
|
```
|
78
|
-
yomitoku ${path_data} -f md -o results -v --figure
|
81
|
+
yomitoku ${path_data} -f md -o results -v --figure --lite
|
79
82
|
```
|
80
83
|
|
81
84
|
- `${path_data}` 解析対象の画像が含まれたディレクトリか画像ファイルのパスを直接して指定してください。ディレクトリを対象とした場合はディレクトリのサブディレクトリ内の画像も含めて処理を実行します。
|
82
85
|
- `-f`, `--format` 出力形式のファイルフォーマットを指定します。(json, csv, html, md をサポート)
|
83
86
|
- `-o`, `--outdir` 出力先のディレクトリ名を指定します。存在しない場合は新規で作成されます。
|
84
87
|
- `-v`, `--vis` を指定すると解析結果を可視化した画像を出力します。
|
88
|
+
- `-l`, `--lite` を指定すると軽量モデルで推論を実行します。通常より高速に推論できますが、若干、精度が低下する可能性があります。
|
85
89
|
- `-d`, `--device` モデルを実行するためのデバイスを指定します。gpu が利用できない場合は cpu で推論が実行されます。(デフォルト: cuda)
|
86
90
|
- `--ignore_line_break` 画像の改行位置を無視して、段落内の文章を連結して返します。(デフォルト:画像通りの改行位置位置で改行します。)
|
87
91
|
- `--figure_letter` 検出した図表に含まれる文字も出力ファイルにエクスポートします。
|
88
|
-
- `--figure` 検出した図、画像を出力ファイルにエクスポートします。
|
92
|
+
- `--figure` 検出した図、画像を出力ファイルにエクスポートします。
|
93
|
+
- `--encoding` エクスポートする出力ファイルの文字エンコーディングを指定します。サポートされていない文字コードが含まれる場合は、その文字を無視します。(utf-8, utf-8-sig, shift-jis, enc-jp, cp932)
|
94
|
+
- `--combine` PDFを入力に与えたときに、複数ページが含まれる場合に、それらの予測結果を一つのファイルに統合してエクスポートします。
|
95
|
+
- `--ignore_meta` 文章のheater, fotterなどの文字情報を出力ファイルに含めません。
|
89
96
|
|
90
97
|
その他のオプションに関しては、ヘルプを参照
|
91
98
|
|
@@ -94,6 +101,7 @@ yomitoku --help
|
|
94
101
|
```
|
95
102
|
|
96
103
|
**NOTE**
|
104
|
+
|
97
105
|
- GPU での実行を推奨します。CPU を用いての推論向けに最適化されておらず、処理時間が長くなります。
|
98
106
|
- 活字のみ識別をサポートしております。手書き文字に関しては、読み取れる場合もありますが、公式にはサポートしておりません。
|
99
107
|
- Yomitoku は文書 OCR 向けに最適化されており、情景 OCR(看板など紙以外にプリントされた文字の読み取り)向けには最適化されていません。
|
@@ -107,6 +115,6 @@ yomitoku --help
|
|
107
115
|
|
108
116
|
本リポジトリ内に格納されているソースコードおよび本プロジェクトに関連する HuggingFaceHub 上のモデルの重みファイルのライセンスは CC BY-NC-SA 4.0 に従います。
|
109
117
|
非商用での個人利用、研究目的での利用はご自由にお使いください。
|
110
|
-
|
118
|
+
商用目的での利用に関しては、別途、商用ライセンスを提供しますので、https://www.mlism.com/ にお問い合わせください。
|
111
119
|
|
112
120
|
YomiToku © 2024 by Kotaro Kinoshita is licensed under CC BY-NC-SA 4.0. To view a copy of this license, visit https://creativecommons.org/licenses/by-nc-sa/4.0/
|
@@ -2,11 +2,12 @@
|
|
2
2
|
|
3
3
|
<img src="static/logo/horizontal.png" width="800px">
|
4
4
|
|
5
|
-

|
6
6
|

|
7
7
|

|
8
8
|

|
9
9
|
[](https://kotaro-kinoshita.github.io/yomitoku/)
|
10
|
+
[](https://pepy.tech/projects/yomitoku)
|
10
11
|
|
11
12
|
## 🌟 概要
|
12
13
|
|
@@ -48,23 +49,27 @@ Markdown でエクスポートした結果は関してはリポジトリ内の[s
|
|
48
49
|
pip install yomitoku
|
49
50
|
```
|
50
51
|
|
51
|
-
- pytorch はご自身の CUDAのバージョンにあったものをインストールしてください。デフォルトではCUDA12.4以上に対応したものがインストールされます。
|
52
|
-
- pytorch は2.5以上のバージョンに対応しています。その関係でCUDA11.8以上のバージョンが必要になります。対応できない場合は、リポジトリ内のDockerfileを利用してください。
|
52
|
+
- pytorch はご自身の CUDA のバージョンにあったものをインストールしてください。デフォルトでは CUDA12.4 以上に対応したものがインストールされます。
|
53
|
+
- pytorch は 2.5 以上のバージョンに対応しています。その関係で CUDA11.8 以上のバージョンが必要になります。対応できない場合は、リポジトリ内の Dockerfile を利用してください。
|
53
54
|
|
54
55
|
## 🚀 実行方法
|
55
56
|
|
56
57
|
```
|
57
|
-
yomitoku ${path_data} -f md -o results -v --figure
|
58
|
+
yomitoku ${path_data} -f md -o results -v --figure --lite
|
58
59
|
```
|
59
60
|
|
60
61
|
- `${path_data}` 解析対象の画像が含まれたディレクトリか画像ファイルのパスを直接して指定してください。ディレクトリを対象とした場合はディレクトリのサブディレクトリ内の画像も含めて処理を実行します。
|
61
62
|
- `-f`, `--format` 出力形式のファイルフォーマットを指定します。(json, csv, html, md をサポート)
|
62
63
|
- `-o`, `--outdir` 出力先のディレクトリ名を指定します。存在しない場合は新規で作成されます。
|
63
64
|
- `-v`, `--vis` を指定すると解析結果を可視化した画像を出力します。
|
65
|
+
- `-l`, `--lite` を指定すると軽量モデルで推論を実行します。通常より高速に推論できますが、若干、精度が低下する可能性があります。
|
64
66
|
- `-d`, `--device` モデルを実行するためのデバイスを指定します。gpu が利用できない場合は cpu で推論が実行されます。(デフォルト: cuda)
|
65
67
|
- `--ignore_line_break` 画像の改行位置を無視して、段落内の文章を連結して返します。(デフォルト:画像通りの改行位置位置で改行します。)
|
66
68
|
- `--figure_letter` 検出した図表に含まれる文字も出力ファイルにエクスポートします。
|
67
|
-
- `--figure` 検出した図、画像を出力ファイルにエクスポートします。
|
69
|
+
- `--figure` 検出した図、画像を出力ファイルにエクスポートします。
|
70
|
+
- `--encoding` エクスポートする出力ファイルの文字エンコーディングを指定します。サポートされていない文字コードが含まれる場合は、その文字を無視します。(utf-8, utf-8-sig, shift-jis, enc-jp, cp932)
|
71
|
+
- `--combine` PDFを入力に与えたときに、複数ページが含まれる場合に、それらの予測結果を一つのファイルに統合してエクスポートします。
|
72
|
+
- `--ignore_meta` 文章のheater, fotterなどの文字情報を出力ファイルに含めません。
|
68
73
|
|
69
74
|
その他のオプションに関しては、ヘルプを参照
|
70
75
|
|
@@ -73,6 +78,7 @@ yomitoku --help
|
|
73
78
|
```
|
74
79
|
|
75
80
|
**NOTE**
|
81
|
+
|
76
82
|
- GPU での実行を推奨します。CPU を用いての推論向けに最適化されておらず、処理時間が長くなります。
|
77
83
|
- 活字のみ識別をサポートしております。手書き文字に関しては、読み取れる場合もありますが、公式にはサポートしておりません。
|
78
84
|
- Yomitoku は文書 OCR 向けに最適化されており、情景 OCR(看板など紙以外にプリントされた文字の読み取り)向けには最適化されていません。
|
@@ -86,6 +92,6 @@ yomitoku --help
|
|
86
92
|
|
87
93
|
本リポジトリ内に格納されているソースコードおよび本プロジェクトに関連する HuggingFaceHub 上のモデルの重みファイルのライセンスは CC BY-NC-SA 4.0 に従います。
|
88
94
|
非商用での個人利用、研究目的での利用はご自由にお使いください。
|
89
|
-
|
95
|
+
商用目的での利用に関しては、別途、商用ライセンスを提供しますので、https://www.mlism.com/ にお問い合わせください。
|
90
96
|
|
91
97
|
YomiToku © 2024 by Kotaro Kinoshita is licensed under CC BY-NC-SA 4.0. To view a copy of this license, visit https://creativecommons.org/licenses/by-nc-sa/4.0/
|
@@ -2,11 +2,12 @@
|
|
2
2
|
|
3
3
|
<img src="static/logo/horizontal.png" width="800px">
|
4
4
|
|
5
|
-

|
6
6
|

|
7
7
|

|
8
8
|

|
9
9
|
[](https://kotaro-kinoshita.github.io/yomitoku-dev/)
|
10
|
+
[](https://pepy.tech/projects/yomitoku)
|
10
11
|
|
11
12
|
## 🌟 Introduction
|
12
13
|
|
@@ -22,13 +23,12 @@ YomiToku is a Document AI engine specialized in Japanese document image analysis
|
|
22
23
|
|
23
24
|
The verification results for various types of images are also included in [gallery.md](gallery.md)
|
24
25
|
|
25
|
-
|
|
26
|
+
| Input | Results of OCR |
|
26
27
|
| :--------------------------------------------------------: | :-----------------------------------------------------: |
|
27
28
|
| <img src="static/in/demo.jpg" width="400px"> | <img src="static/out/in_demo_p1_ocr.jpg" width="400px"> |
|
28
|
-
|
|
29
|
+
| Results of Layout Analysis | Results of HTML Export |
|
29
30
|
| <img src="static/out/in_demo_p1_layout.jpg" width="400px"> | <img src="static/out/demo_html.png" width="400px"> |
|
30
31
|
|
31
|
-
|
32
32
|
For the results exported in Markdown, please refer to [static/out/in_demo_p1.md](static/out/in_demo_p1.md) in the repository.
|
33
33
|
|
34
34
|
- `Red Frame`: Positions of figures and images
|
@@ -49,32 +49,36 @@ Source of the image: Created by processing content from “Reiwa 6 Edition Infor
|
|
49
49
|
pip install yomitoku
|
50
50
|
```
|
51
51
|
|
52
|
-
|
53
52
|
- Please install the version of PyTorch that matches your CUDA version. By default, a version compatible with CUDA 12.4 or higher will be installed.
|
54
53
|
- PyTorch versions 2.5 and above are supported. As a result, CUDA version 11.8 or higher is required. If this is not feasible, please use the Dockerfile provided in the repository.
|
55
54
|
|
56
55
|
## 🚀 Usage
|
57
56
|
|
58
57
|
```
|
59
|
-
yomitoku ${path_data} -f md -o results -v --figure
|
58
|
+
yomitoku ${path_data} -f md -o results -v --figure --lite
|
60
59
|
```
|
61
60
|
|
62
61
|
- `${path_data}`: Specify the path to a directory containing images to be analyzed or directly provide the path to an image file. If a directory is specified, images in its subdirectories will also be processed.
|
63
62
|
- `-f`, `--format`: Specify the output file format. Supported formats are json, csv, html, and md.
|
64
63
|
- `-o`, `--outdir`: Specify the name of the output directory. If it does not exist, it will be created.
|
65
64
|
- `-v`, `--vis`: If specified, outputs visualized images of the analysis results.
|
65
|
+
- `-l`, `--lite`: inference is performed using a lightweight model. This enables fast inference even on a CPU.
|
66
66
|
- `-d`, `--device`: Specify the device for running the model. If a GPU is unavailable, inference will be executed on the CPU. (Default: cuda)
|
67
67
|
- `--ignore_line_break`: Ignores line breaks in the image and concatenates sentences within a paragraph. (Default: respects line breaks as they appear in the image.)
|
68
68
|
- `--figure_letter`: Exports characters contained within detected figures and tables to the output file.
|
69
|
-
- `--figure`: Exports detected figures and images to the output file
|
70
|
-
|
69
|
+
- `--figure`: Exports detected figures and images to the output file
|
70
|
+
- `--encoding` Specifies the character encoding for the output file to be exported. If unsupported characters are included, they will be ignored. (utf-8, utf-8-sig, shift-jis, enc-jp, cp932)
|
71
|
+
- `--combine` When a PDF is provided as input and contains multiple pages, this option combines their prediction results into a single file for export.
|
72
|
+
- `--ignore_meta` Excludes text information such as headers and footers from the output file.
|
71
73
|
|
72
74
|
For other options, please refer to the help documentation.
|
75
|
+
|
73
76
|
```
|
74
77
|
yomitoku --help
|
75
78
|
```
|
76
79
|
|
77
80
|
**NOTE**
|
81
|
+
|
78
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.
|
79
83
|
- Only printed text recognition is supported. While it may occasionally read handwritten text, official support is not provided.
|
80
84
|
- YomiToku is optimized for document OCR and is not designed for scene OCR (e.g., text printed on non-paper surfaces like signs).
|
@@ -1,31 +1,31 @@
|
|
1
1
|
hf_hub_repo: KotaroKinoshita/yomitoku-layout-parser-rtdtrv2-open-beta
|
2
|
-
thresh_score: 0.
|
2
|
+
thresh_score: 0.5
|
3
3
|
data:
|
4
4
|
img_size:
|
5
|
-
|
6
|
-
|
5
|
+
- 640
|
6
|
+
- 640
|
7
7
|
PResNet:
|
8
8
|
depth: 50
|
9
9
|
variant: d
|
10
10
|
freeze_at: 0
|
11
11
|
return_idx:
|
12
|
-
|
13
|
-
|
14
|
-
|
12
|
+
- 1
|
13
|
+
- 2
|
14
|
+
- 3
|
15
15
|
num_stages: 4
|
16
16
|
freeze_norm: true
|
17
17
|
HybridEncoder:
|
18
18
|
in_channels:
|
19
|
-
|
20
|
-
|
21
|
-
|
19
|
+
- 512
|
20
|
+
- 1024
|
21
|
+
- 2048
|
22
22
|
feat_strides:
|
23
|
-
|
24
|
-
|
25
|
-
|
23
|
+
- 8
|
24
|
+
- 16
|
25
|
+
- 32
|
26
26
|
hidden_dim: 256
|
27
27
|
use_encoder_idx:
|
28
|
-
|
28
|
+
- 2
|
29
29
|
num_encoder_layers: 1
|
30
30
|
nhead: 8
|
31
31
|
dim_feedforward: 1024
|
@@ -35,15 +35,15 @@ HybridEncoder:
|
|
35
35
|
depth_mult: 1
|
36
36
|
act: silu
|
37
37
|
RTDETRTransformerv2:
|
38
|
-
num_classes:
|
38
|
+
num_classes: 6
|
39
39
|
feat_channels:
|
40
|
-
|
41
|
-
|
42
|
-
|
40
|
+
- 256
|
41
|
+
- 256
|
42
|
+
- 256
|
43
43
|
feat_strides:
|
44
|
-
|
45
|
-
|
46
|
-
|
44
|
+
- 8
|
45
|
+
- 16
|
46
|
+
- 32
|
47
47
|
hidden_dim: 256
|
48
48
|
num_levels: 3
|
49
49
|
num_layers: 6
|
@@ -52,16 +52,23 @@ RTDETRTransformerv2:
|
|
52
52
|
label_noise_ratio: 0.5
|
53
53
|
box_noise_scale: 1.0
|
54
54
|
eval_spatial_size:
|
55
|
-
|
56
|
-
|
55
|
+
- 640
|
56
|
+
- 640
|
57
57
|
eval_idx: -1
|
58
58
|
num_points:
|
59
|
-
|
60
|
-
|
61
|
-
|
59
|
+
- 4
|
60
|
+
- 4
|
61
|
+
- 4
|
62
62
|
cross_attn_method: default
|
63
63
|
query_select_method: default
|
64
64
|
category:
|
65
|
-
|
66
|
-
|
67
|
-
|
65
|
+
- tables
|
66
|
+
- figures
|
67
|
+
- paragraphs
|
68
|
+
- section_headings
|
69
|
+
- page_header
|
70
|
+
- page_footer
|
71
|
+
role:
|
72
|
+
- section_headings
|
73
|
+
- page_header
|
74
|
+
- page_footer
|
@@ -0,0 +1,67 @@
|
|
1
|
+
hf_hub_repo: KotaroKinoshita/yomitoku-table-structure-recognizer-rtdtrv2-open-beta
|
2
|
+
thresh_score: 0.4
|
3
|
+
data:
|
4
|
+
img_size:
|
5
|
+
- 640
|
6
|
+
- 640
|
7
|
+
PResNet:
|
8
|
+
depth: 50
|
9
|
+
variant: d
|
10
|
+
freeze_at: 0
|
11
|
+
return_idx:
|
12
|
+
- 1
|
13
|
+
- 2
|
14
|
+
- 3
|
15
|
+
num_stages: 4
|
16
|
+
freeze_norm: true
|
17
|
+
HybridEncoder:
|
18
|
+
in_channels:
|
19
|
+
- 512
|
20
|
+
- 1024
|
21
|
+
- 2048
|
22
|
+
feat_strides:
|
23
|
+
- 8
|
24
|
+
- 16
|
25
|
+
- 32
|
26
|
+
hidden_dim: 256
|
27
|
+
use_encoder_idx:
|
28
|
+
- 2
|
29
|
+
num_encoder_layers: 1
|
30
|
+
nhead: 8
|
31
|
+
dim_feedforward: 1024
|
32
|
+
dropout: 0.0
|
33
|
+
enc_act: gelu
|
34
|
+
expansion: 1.0
|
35
|
+
depth_mult: 1
|
36
|
+
act: silu
|
37
|
+
RTDETRTransformerv2:
|
38
|
+
num_classes: 3
|
39
|
+
feat_channels:
|
40
|
+
- 256
|
41
|
+
- 256
|
42
|
+
- 256
|
43
|
+
feat_strides:
|
44
|
+
- 8
|
45
|
+
- 16
|
46
|
+
- 32
|
47
|
+
hidden_dim: 256
|
48
|
+
num_levels: 3
|
49
|
+
num_layers: 6
|
50
|
+
num_queries: 300
|
51
|
+
num_denoising: 100
|
52
|
+
label_noise_ratio: 0.5
|
53
|
+
box_noise_scale: 1.0
|
54
|
+
eval_spatial_size:
|
55
|
+
- 640
|
56
|
+
- 640
|
57
|
+
eval_idx: -1
|
58
|
+
num_points:
|
59
|
+
- 4
|
60
|
+
- 4
|
61
|
+
- 4
|
62
|
+
cross_attn_method: default
|
63
|
+
query_select_method: default
|
64
|
+
category:
|
65
|
+
- row
|
66
|
+
- col
|
67
|
+
- span
|
@@ -4,10 +4,10 @@ backbone:
|
|
4
4
|
dilation: true
|
5
5
|
decoder:
|
6
6
|
in_channels:
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
7
|
+
- 256
|
8
|
+
- 512
|
9
|
+
- 1024
|
10
|
+
- 2048
|
11
11
|
hidden_dim: 256
|
12
12
|
adaptive: true
|
13
13
|
serial: true
|
@@ -21,10 +21,10 @@ post_process:
|
|
21
21
|
thresh: 0.2
|
22
22
|
box_thresh: 0.5
|
23
23
|
max_candidates: 1500
|
24
|
-
unclip_ratio:
|
24
|
+
unclip_ratio: 7.0
|
25
25
|
visualize:
|
26
26
|
color:
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
heatmap: false
|
27
|
+
- 0
|
28
|
+
- 255
|
29
|
+
- 0
|
30
|
+
heatmap: false
|
@@ -0,0 +1,32 @@
|
|
1
|
+
hf_hub_repo: KotaroKinoshita/yomitoku-text-recognizer-parseq-open-beta
|
2
|
+
charset: /home/kinoshita/Projects/know-how/yomitoku/src/yomitoku/resource/charset.txt
|
3
|
+
num_tokens: 7312
|
4
|
+
max_label_length: 100
|
5
|
+
decode_ar: 1
|
6
|
+
refine_iters: 1
|
7
|
+
data:
|
8
|
+
num_workers: 4
|
9
|
+
batch_size: 128
|
10
|
+
img_size:
|
11
|
+
- 32
|
12
|
+
- 800
|
13
|
+
encoder:
|
14
|
+
patch_size:
|
15
|
+
- 8
|
16
|
+
- 8
|
17
|
+
num_heads: 8
|
18
|
+
embed_dim: 512
|
19
|
+
mlp_ratio: 4
|
20
|
+
depth: 12
|
21
|
+
decoder:
|
22
|
+
embed_dim: 512
|
23
|
+
num_heads: 8
|
24
|
+
mlp_ratio: 4
|
25
|
+
depth: 1
|
26
|
+
visualize:
|
27
|
+
font: src/yomitoku/resource/MPLUS1p-Medium.ttf
|
28
|
+
color:
|
29
|
+
- 0
|
30
|
+
- 0
|
31
|
+
- 255
|
32
|
+
font_size: 18
|
@@ -0,0 +1,32 @@
|
|
1
|
+
hf_hub_repo: KotaroKinoshita/yomitoku-text-recognizer-parseq-small-open-beta
|
2
|
+
charset: /home/kinoshita/Projects/know-how/yomitoku/src/yomitoku/resource/charset.txt
|
3
|
+
num_tokens: 7312
|
4
|
+
max_label_length: 100
|
5
|
+
decode_ar: 1
|
6
|
+
refine_iters: 1
|
7
|
+
data:
|
8
|
+
num_workers: 4
|
9
|
+
batch_size: 128
|
10
|
+
img_size:
|
11
|
+
- 32
|
12
|
+
- 800
|
13
|
+
encoder:
|
14
|
+
patch_size:
|
15
|
+
- 16
|
16
|
+
- 16
|
17
|
+
num_heads: 8
|
18
|
+
embed_dim: 384
|
19
|
+
mlp_ratio: 4
|
20
|
+
depth: 9
|
21
|
+
decoder:
|
22
|
+
embed_dim: 384
|
23
|
+
num_heads: 8
|
24
|
+
mlp_ratio: 4
|
25
|
+
depth: 1
|
26
|
+
visualize:
|
27
|
+
font: src/yomitoku/resource/MPLUS1p-Medium.ttf
|
28
|
+
color:
|
29
|
+
- 0
|
30
|
+
- 0
|
31
|
+
- 255
|
32
|
+
font_size: 18
|
@@ -4,17 +4,14 @@ from yomitoku import DocumentAnalyzer
|
|
4
4
|
from yomitoku.data.functions import load_pdf
|
5
5
|
|
6
6
|
if __name__ == "__main__":
|
7
|
-
PATH_IMGE = ""
|
8
|
-
|
9
|
-
analyzer = DocumentAnalyzer(configs=None, visualize=True, device="cuda")
|
7
|
+
PATH_IMGE = "demo/sample.pdf"
|
8
|
+
analyzer = DocumentAnalyzer(visualize=True, device="cuda")
|
10
9
|
# PDFファイルを読み込み
|
11
|
-
imgs = load_pdf(
|
10
|
+
imgs = load_pdf(PATH_IMGE)
|
12
11
|
for i, img in enumerate(imgs):
|
13
12
|
results, ocr_vis, layout_vis = analyzer(img)
|
14
|
-
|
15
13
|
# HTML形式で解析結果をエクスポート
|
16
|
-
results.to_html(f"output_{i}.html")
|
17
|
-
|
14
|
+
results.to_html(f"output_{i}.html", img=img)
|
18
15
|
# 可視化画像を保存
|
19
16
|
cv2.imwrite(f"output_ocr_{i}.jpg", ocr_vis)
|
20
17
|
cv2.imwrite(f"output_layout_{i}.jpg", layout_vis)
|
@@ -4,7 +4,7 @@ from yomitoku import LayoutAnalyzer
|
|
4
4
|
from yomitoku.data.functions import load_pdf
|
5
5
|
|
6
6
|
if __name__ == "__main__":
|
7
|
-
analyzer = LayoutAnalyzer(
|
7
|
+
analyzer = LayoutAnalyzer(visualize=True, device="cuda")
|
8
8
|
# PDFファイルを読み込み
|
9
9
|
imgs = load_pdf("demo/sample.pdf")
|
10
10
|
for i, img in enumerate(imgs):
|
@@ -4,7 +4,7 @@ from yomitoku import OCR
|
|
4
4
|
from yomitoku.data.functions import load_pdf
|
5
5
|
|
6
6
|
if __name__ == "__main__":
|
7
|
-
ocr = OCR(
|
7
|
+
ocr = OCR(visualize=True, device="cpu")
|
8
8
|
# PDFファイルを読み込み
|
9
9
|
imgs = load_pdf("demo/sample.pdf")
|
10
10
|
for i, img in enumerate(imgs):
|
@@ -0,0 +1,110 @@
|
|
1
|
+
# CLI Usage
|
2
|
+
|
3
|
+
The model weight files are downloaded from Hugging Face Hub only during the first execution.
|
4
|
+
|
5
|
+
```
|
6
|
+
yomitoku ${path_data} -v -o results
|
7
|
+
```
|
8
|
+
|
9
|
+
- `${path_data}`: Specify the path to a directory containing images to be analyzed or directly provide the path to an image file. If a directory is specified, images in its subdirectories will also be processed.
|
10
|
+
- `-f`, `--format`: Specify the output file format. Supported formats are json, csv, html, and md.
|
11
|
+
- `-o`, `--outdir`: Specify the name of the output directory. If it does not exist, it will be created.
|
12
|
+
- `-v`, `--vis`: If specified, outputs visualized images of the analysis results.
|
13
|
+
|
14
|
+
**NOTE**
|
15
|
+
|
16
|
+
- Only printed text recognition is supported. While it may occasionally read handwritten text, official support is not provided.
|
17
|
+
- YomiToku is optimized for document OCR and is not designed for scene OCR (e.g., text printed on non-paper surfaces like signs).
|
18
|
+
- 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.
|
19
|
+
|
20
|
+
## Reference for Help
|
21
|
+
|
22
|
+
Displays the options available for the CLI using `--help`, `-h`
|
23
|
+
|
24
|
+
```
|
25
|
+
yomitoku -h
|
26
|
+
```
|
27
|
+
|
28
|
+
## Running in Lightweight Mode
|
29
|
+
|
30
|
+
By using the --lite option, it is possible to perform inference with a lightweight model. This enables faster analysis compared to the standard mode. However, the accuracy of character recognition may decrease.
|
31
|
+
|
32
|
+
```
|
33
|
+
yomitoku ${path_data} --lite -v
|
34
|
+
```
|
35
|
+
|
36
|
+
## Specifying Output Format
|
37
|
+
|
38
|
+
You can specify the output format of the analysis results using the --format or -f option. Supported output formats include JSON, CSV, HTML, and MD (Markdown).
|
39
|
+
|
40
|
+
```
|
41
|
+
yomitoku ${path_data} -f md
|
42
|
+
```
|
43
|
+
|
44
|
+
## Specifying the Output Device
|
45
|
+
|
46
|
+
You can specify the device for running the model using the -d or --device option. Supported options are cuda, cpu, and mps. If a GPU is not available, inference will be performed on the CPU. (Default: cuda)
|
47
|
+
|
48
|
+
```
|
49
|
+
yomitoku ${path_data} -d cpu
|
50
|
+
```
|
51
|
+
|
52
|
+
## Ignoring Line Breaks
|
53
|
+
|
54
|
+
In the normal mode, line breaks are applied based on the information described in the image. By using the --ignore_line_break option, you can ignore the line break positions in the image and return the same sentence within a paragraph as a single connected output.
|
55
|
+
|
56
|
+
```
|
57
|
+
yomitoku ${path_data} --ignore_line_break
|
58
|
+
```
|
59
|
+
|
60
|
+
## Outputting Figures and Graph Images
|
61
|
+
|
62
|
+
In the normal mode, information about figures or images contained in document images is not output. By using the --figure option, you can extract figures and images included in the document image, save them as separate image files, and include links to the detected individual images in the output file.
|
63
|
+
|
64
|
+
```
|
65
|
+
yomitoku ${path_data} --figure
|
66
|
+
```
|
67
|
+
|
68
|
+
## Outputting Text Contained in Figures and Images
|
69
|
+
|
70
|
+
In normal mode, text information contained within figures or images is not included in the output file. By using the --figure_letter option, text information within figures and images will also be included in the output file.
|
71
|
+
|
72
|
+
```
|
73
|
+
yomitoku ${path_data} --figure_letter
|
74
|
+
```
|
75
|
+
|
76
|
+
## Specifying the Character Encoding of the Output File
|
77
|
+
|
78
|
+
You can specify the character encoding of the output file using the --encoding option. Supported encodings include `utf-8`, `utf-8-sig`, `shift-jis`, `enc-jp`, and `cp932`. If unsupported characters are encountered, they will be ignored and not included in the output.
|
79
|
+
|
80
|
+
```
|
81
|
+
yomitoku ${path_data} --encoding utf-8-sig
|
82
|
+
```
|
83
|
+
|
84
|
+
## Specifying the Path to Config Files
|
85
|
+
|
86
|
+
Specify the path to the config files for each module as follows:
|
87
|
+
|
88
|
+
- `--td_cfg`: Path to the YAML file containing the config for the Text Detector
|
89
|
+
- `--tr_cfg`: Path to the YAML file containing the config for the Text Recognizer
|
90
|
+
- `--lp_cfg`: Path to the YAML file containing the config for the Layout Parser
|
91
|
+
- `--tsr_cfg`: Path to the YAML file containing the config for the Table Structure Recognizer
|
92
|
+
|
93
|
+
```
|
94
|
+
yomitoku ${path_data} --td_cfg ${path_yaml}
|
95
|
+
```
|
96
|
+
|
97
|
+
## Do not include metadata in the output file
|
98
|
+
|
99
|
+
You can exclude metadata such as headers and footers from the output file.
|
100
|
+
```
|
101
|
+
yomitoku ${path_data} --ignore_meta
|
102
|
+
```
|
103
|
+
|
104
|
+
## Combine multiple pages
|
105
|
+
|
106
|
+
If the PDF contains multiple pages, you can export them as a single file.
|
107
|
+
|
108
|
+
```
|
109
|
+
yomitoku ${path_data} -f md --combine
|
110
|
+
```
|