yomitoku 0.6.0__tar.gz → 0.7.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.
- {yomitoku-0.6.0 → yomitoku-0.7.1}/.github/workflows/lint-and-test.yml +3 -1
- {yomitoku-0.6.0 → yomitoku-0.7.1}/PKG-INFO +11 -4
- {yomitoku-0.6.0 → yomitoku-0.7.1}/README.md +7 -1
- {yomitoku-0.6.0 → yomitoku-0.7.1}/README_EN.md +6 -1
- yomitoku-0.7.1/demo/setting_document_anaysis.py +6 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/demo/simple_document_analysis.py +4 -7
- {yomitoku-0.6.0 → yomitoku-0.7.1}/demo/simple_layout.py +1 -1
- {yomitoku-0.6.0 → yomitoku-0.7.1}/demo/simple_ocr.py +1 -1
- {yomitoku-0.6.0 → yomitoku-0.7.1}/docs/installation.en.md +11 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/docs/installation.ja.md +10 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/docs/usage.en.md +24 -78
- {yomitoku-0.6.0 → yomitoku-0.7.1}/docs/usage.ja.md +27 -74
- {yomitoku-0.6.0 → yomitoku-0.7.1}/mkdocs.yml +1 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/pyproject.toml +8 -2
- {yomitoku-0.6.0 → yomitoku-0.7.1}/src/yomitoku/cli/main.py +34 -2
- {yomitoku-0.6.0 → yomitoku-0.7.1}/src/yomitoku/document_analyzer.py +228 -26
- {yomitoku-0.6.0 → yomitoku-0.7.1}/src/yomitoku/export/export_csv.py +41 -2
- {yomitoku-0.6.0 → yomitoku-0.7.1}/src/yomitoku/export/export_html.py +4 -1
- yomitoku-0.7.1/src/yomitoku/export/export_json.py +74 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/src/yomitoku/export/export_markdown.py +4 -1
- {yomitoku-0.6.0 → yomitoku-0.7.1}/src/yomitoku/layout_analyzer.py +1 -5
- {yomitoku-0.6.0 → yomitoku-0.7.1}/src/yomitoku/layout_parser.py +5 -1
- {yomitoku-0.6.0 → yomitoku-0.7.1}/src/yomitoku/ocr.py +24 -27
- {yomitoku-0.6.0 → yomitoku-0.7.1}/src/yomitoku/table_structure_recognizer.py +24 -7
- {yomitoku-0.6.0 → yomitoku-0.7.1}/src/yomitoku/text_detector.py +8 -3
- {yomitoku-0.6.0 → yomitoku-0.7.1}/src/yomitoku/text_recognizer.py +22 -7
- {yomitoku-0.6.0 → yomitoku-0.7.1}/src/yomitoku/utils/misc.py +20 -13
- {yomitoku-0.6.0 → yomitoku-0.7.1}/src/yomitoku/utils/visualizer.py +5 -5
- {yomitoku-0.6.0 → yomitoku-0.7.1}/tests/test_cli.py +14 -0
- yomitoku-0.7.1/tests/test_document_analyzer.py +596 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/tests/test_export.py +103 -1
- {yomitoku-0.6.0 → yomitoku-0.7.1}/tests/test_layout_analyzer.py +0 -9
- {yomitoku-0.6.0 → yomitoku-0.7.1}/tests/test_ocr.py +0 -9
- {yomitoku-0.6.0 → yomitoku-0.7.1}/uv.lock +247 -120
- yomitoku-0.6.0/demo/setting_document_anaysis.py +0 -23
- yomitoku-0.6.0/src/yomitoku/export/export_json.py +0 -34
- yomitoku-0.6.0/tests/test_document_analyzer.py +0 -88
- {yomitoku-0.6.0 → yomitoku-0.7.1}/.github/release-drafter.yml +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/.github/workflows/build-and-publish-docs.yaml +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/.github/workflows/build-and-publish.yml +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/.github/workflows/create-release.yml +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/.gitignore +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/.pre-commit-config.yaml +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/.python-version +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/configs/layout_parser_rtdetrv2.yaml +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/configs/table_structure_recognitizer.yaml +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/configs/text_detector.yaml +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/configs/text_recognizer.yaml +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/demo/sample.pdf +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/demo/text_detector.yaml +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/dockerfile +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/docs/assets/logo.svg +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/docs/index.en.md +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/docs/index.ja.md +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/gallery.md +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/pytest.ini +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/scripts/register_hugging_face_hub.py +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/src/yomitoku/__init__.py +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/src/yomitoku/base.py +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/src/yomitoku/cli/__init__.py +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/src/yomitoku/configs/__init__.py +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/src/yomitoku/configs/cfg_layout_parser_rtdtrv2.py +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/src/yomitoku/configs/cfg_table_structure_recognizer_rtdtrv2.py +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/src/yomitoku/configs/cfg_text_detector_dbnet.py +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/src/yomitoku/configs/cfg_text_recognizer_parseq.py +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/src/yomitoku/configs/cfg_text_recognizer_parseq_small.py +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/src/yomitoku/constants.py +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/src/yomitoku/data/__init__.py +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/src/yomitoku/data/dataset.py +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/src/yomitoku/data/functions.py +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/src/yomitoku/export/__init__.py +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/src/yomitoku/models/__init__.py +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/src/yomitoku/models/dbnet_plus.py +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/src/yomitoku/models/layers/__init__.py +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/src/yomitoku/models/layers/activate.py +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/src/yomitoku/models/layers/dbnet_feature_attention.py +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/src/yomitoku/models/layers/parseq_transformer.py +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/src/yomitoku/models/layers/rtdetr_backbone.py +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/src/yomitoku/models/layers/rtdetr_hybrid_encoder.py +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/src/yomitoku/models/layers/rtdetrv2_decoder.py +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/src/yomitoku/models/parseq.py +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/src/yomitoku/models/rtdetr.py +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/src/yomitoku/onnx/.gitkeep +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/src/yomitoku/postprocessor/__init__.py +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/src/yomitoku/postprocessor/dbnet_postporcessor.py +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/src/yomitoku/postprocessor/parseq_tokenizer.py +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/src/yomitoku/postprocessor/rtdetr_postprocessor.py +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/src/yomitoku/reading_order.py +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/src/yomitoku/resource/MPLUS1p-Medium.ttf +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/src/yomitoku/resource/charset.txt +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/src/yomitoku/utils/__init__.py +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/src/yomitoku/utils/graph.py +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/src/yomitoku/utils/logger.py +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/static/in/demo.jpg +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/static/in/gallery1.jpg +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/static/in/gallery2.jpg +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/static/in/gallery3.jpg +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/static/in/gallery4.jpg +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/static/in/gallery5.jpg +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/static/in/gallery6.jpg +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/static/logo/horizontal.png +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/static/out/demo_html.png +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/static/out/figures/in_demo_p1_figure_0.png +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/static/out/figures/in_gallery1_p1_figure_0.png +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/static/out/figures/in_gallery1_p1_figure_1.png +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/static/out/figures/in_gallery1_p1_figure_10.png +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/static/out/figures/in_gallery1_p1_figure_2.png +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/static/out/figures/in_gallery1_p1_figure_3.png +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/static/out/figures/in_gallery1_p1_figure_4.png +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/static/out/figures/in_gallery1_p1_figure_5.png +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/static/out/figures/in_gallery1_p1_figure_6.png +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/static/out/figures/in_gallery1_p1_figure_7.png +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/static/out/figures/in_gallery1_p1_figure_8.png +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/static/out/figures/in_gallery1_p1_figure_9.png +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/static/out/figures/in_gallery3_p1_figure_0.png +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/static/out/figures/in_gallery3_p1_figure_1.png +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/static/out/figures/in_gallery5_p1_figure_0.png +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/static/out/figures/in_gallery5_p1_figure_1.png +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/static/out/figures/in_gallery6_p1_figure_0.png +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/static/out/figures/in_gallery6_p1_figure_1.png +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/static/out/in_demo_p1.html +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/static/out/in_demo_p1.md +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/static/out/in_demo_p1_layout.jpg +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/static/out/in_demo_p1_ocr.jpg +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/static/out/in_gallery1_p1.html +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/static/out/in_gallery1_p1.md +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/static/out/in_gallery1_p1_layout.jpg +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/static/out/in_gallery1_p1_ocr.jpg +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/static/out/in_gallery2_p1.html +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/static/out/in_gallery2_p1.md +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/static/out/in_gallery2_p1_layout.jpg +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/static/out/in_gallery2_p1_ocr.jpg +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/static/out/in_gallery3_p1.html +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/static/out/in_gallery3_p1.md +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/static/out/in_gallery3_p1_layout.jpg +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/static/out/in_gallery3_p1_ocr.jpg +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/static/out/in_gallery4_p1.html +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/static/out/in_gallery4_p1.md +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/static/out/in_gallery4_p1_layout.jpg +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/static/out/in_gallery4_p1_ocr.jpg +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/static/out/in_gallery5_p1.html +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/static/out/in_gallery5_p1.md +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/static/out/in_gallery5_p1_layout.jpg +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/static/out/in_gallery5_p1_ocr.jpg +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/static/out/in_gallery6_p1.html +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/static/out/in_gallery6_p1.md +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/static/out/in_gallery6_p1_layout.jpg +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/static/out/in_gallery6_p1_ocr.jpg +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/tests/data/invalid.jpg +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/tests/data/invalid.pdf +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/tests/data/rgba.png +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/tests/data/small.jpg +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/tests/data/subdir/test.jpg +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/tests/data/test.bmp +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/tests/data/test.jpg +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/tests/data/test.pdf +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/tests/data/test.png +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/tests/data/test.tiff +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/tests/data/test.txt +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/tests/data/test_gray.jpg +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/tests/test_base.py +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/tests/test_data.py +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/tests/yaml/layout_parser.yaml +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/tests/yaml/table_structure_recognizer.yaml +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/tests/yaml/text_detector.yaml +0 -0
- {yomitoku-0.6.0 → yomitoku-0.7.1}/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
|
@@ -1,6 +1,6 @@
|
|
1
|
-
Metadata-Version: 2.
|
1
|
+
Metadata-Version: 2.4
|
2
2
|
Name: yomitoku
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.7.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
|
@@ -10,7 +10,6 @@ Requires-Dist: huggingface-hub>=0.26.1
|
|
10
10
|
Requires-Dist: lxml>=5.3.0
|
11
11
|
Requires-Dist: omegaconf>=2.3.0
|
12
12
|
Requires-Dist: onnx>=1.17.0
|
13
|
-
Requires-Dist: onnxruntime-gpu>=1.20.1
|
14
13
|
Requires-Dist: onnxruntime>=1.20.1
|
15
14
|
Requires-Dist: opencv-python>=4.10.0.84
|
16
15
|
Requires-Dist: pyclipper>=1.3.0.post6
|
@@ -20,6 +19,8 @@ Requires-Dist: shapely>=2.0.6
|
|
20
19
|
Requires-Dist: timm>=1.0.11
|
21
20
|
Requires-Dist: torch>=2.5.0
|
22
21
|
Requires-Dist: torchvision>=0.20.0
|
22
|
+
Provides-Extra: gpu
|
23
|
+
Requires-Dist: onnxruntime-gpu>=1.20.1; extra == 'gpu'
|
23
24
|
Description-Content-Type: text/markdown
|
24
25
|
|
25
26
|
日本語版 | [English](README_EN.md)
|
@@ -72,6 +73,11 @@ Markdown でエクスポートした結果は関してはリポジトリ内の[s
|
|
72
73
|
pip install yomitoku
|
73
74
|
```
|
74
75
|
|
76
|
+
onnxruntimeの実行にGPUを使用する場合
|
77
|
+
```
|
78
|
+
pip install yomitoku[gpu]
|
79
|
+
```
|
80
|
+
|
75
81
|
- pytorch はご自身の CUDA のバージョンにあったものをインストールしてください。デフォルトでは CUDA12.4 以上に対応したものがインストールされます。
|
76
82
|
- pytorch は 2.5 以上のバージョンに対応しています。その関係で CUDA11.8 以上のバージョンが必要になります。対応できない場合は、リポジトリ内の Dockerfile を利用してください。
|
77
83
|
|
@@ -89,7 +95,8 @@ yomitoku ${path_data} -f md -o results -v --figure --lite
|
|
89
95
|
- `-d`, `--device` モデルを実行するためのデバイスを指定します。gpu が利用できない場合は cpu で推論が実行されます。(デフォルト: cuda)
|
90
96
|
- `--ignore_line_break` 画像の改行位置を無視して、段落内の文章を連結して返します。(デフォルト:画像通りの改行位置位置で改行します。)
|
91
97
|
- `--figure_letter` 検出した図表に含まれる文字も出力ファイルにエクスポートします。
|
92
|
-
- `--figure` 検出した図、画像を出力ファイルにエクスポートします。
|
98
|
+
- `--figure` 検出した図、画像を出力ファイルにエクスポートします。
|
99
|
+
- `--encoding` エクスポートする出力ファイルの文字エンコーディングを指定します。サポートされていない文字コードが含まれる場合は、その文字を無視します。(utf-8, utf-8-sig, shift-jis, enc-jp, cp932)
|
93
100
|
|
94
101
|
その他のオプションに関しては、ヘルプを参照
|
95
102
|
|
@@ -48,6 +48,11 @@ Markdown でエクスポートした結果は関してはリポジトリ内の[s
|
|
48
48
|
pip install yomitoku
|
49
49
|
```
|
50
50
|
|
51
|
+
onnxruntimeの実行にGPUを使用する場合
|
52
|
+
```
|
53
|
+
pip install yomitoku[gpu]
|
54
|
+
```
|
55
|
+
|
51
56
|
- pytorch はご自身の CUDA のバージョンにあったものをインストールしてください。デフォルトでは CUDA12.4 以上に対応したものがインストールされます。
|
52
57
|
- pytorch は 2.5 以上のバージョンに対応しています。その関係で CUDA11.8 以上のバージョンが必要になります。対応できない場合は、リポジトリ内の Dockerfile を利用してください。
|
53
58
|
|
@@ -65,7 +70,8 @@ yomitoku ${path_data} -f md -o results -v --figure --lite
|
|
65
70
|
- `-d`, `--device` モデルを実行するためのデバイスを指定します。gpu が利用できない場合は cpu で推論が実行されます。(デフォルト: cuda)
|
66
71
|
- `--ignore_line_break` 画像の改行位置を無視して、段落内の文章を連結して返します。(デフォルト:画像通りの改行位置位置で改行します。)
|
67
72
|
- `--figure_letter` 検出した図表に含まれる文字も出力ファイルにエクスポートします。
|
68
|
-
- `--figure` 検出した図、画像を出力ファイルにエクスポートします。
|
73
|
+
- `--figure` 検出した図、画像を出力ファイルにエクスポートします。
|
74
|
+
- `--encoding` エクスポートする出力ファイルの文字エンコーディングを指定します。サポートされていない文字コードが含まれる場合は、その文字を無視します。(utf-8, utf-8-sig, shift-jis, enc-jp, cp932)
|
69
75
|
|
70
76
|
その他のオプションに関しては、ヘルプを参照
|
71
77
|
|
@@ -49,6 +49,10 @@ Source of the image: Created by processing content from “Reiwa 6 Edition Infor
|
|
49
49
|
pip install yomitoku
|
50
50
|
```
|
51
51
|
|
52
|
+
Using GPU with onnxruntime
|
53
|
+
```
|
54
|
+
pip install yomitoku[gpu]
|
55
|
+
```
|
52
56
|
|
53
57
|
- 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
58
|
- 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.
|
@@ -67,7 +71,8 @@ yomitoku ${path_data} -f md -o results -v --figure
|
|
67
71
|
- `-d`, `--device`: Specify the device for running the model. If a GPU is unavailable, inference will be executed on the CPU. (Default: cuda)
|
68
72
|
- `--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.)
|
69
73
|
- `--figure_letter`: Exports characters contained within detected figures and tables to the output file.
|
70
|
-
- `--figure`: Exports detected figures and images to the output file
|
74
|
+
- `--figure`: Exports detected figures and images to the output file
|
75
|
+
- `--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
76
|
|
72
77
|
|
73
78
|
For other options, please refer to the help documentation.
|
@@ -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="cuda")
|
8
8
|
# PDFファイルを読み込み
|
9
9
|
imgs = load_pdf("demo/sample.pdf")
|
10
10
|
for i, img in enumerate(imgs):
|
@@ -9,6 +9,12 @@ This package requires Python 3.10 or later and PyTorch 2.5 or later for executio
|
|
9
9
|
pip install yomitoku
|
10
10
|
```
|
11
11
|
|
12
|
+
Using GPU with onnxruntime
|
13
|
+
```bash
|
14
|
+
pip install yomitoku[gpu]
|
15
|
+
```
|
16
|
+
|
17
|
+
|
12
18
|
## using uv
|
13
19
|
This repository uses the package management tool [uv](https://docs.astral.sh/uv/). After installing uv, clone the repository and execute the following commands:
|
14
20
|
|
@@ -16,6 +22,11 @@ This repository uses the package management tool [uv](https://docs.astral.sh/uv/
|
|
16
22
|
uv sync
|
17
23
|
```
|
18
24
|
|
25
|
+
Using GPU with onnxruntime
|
26
|
+
```bash
|
27
|
+
uv sync --extra gpu
|
28
|
+
```
|
29
|
+
|
19
30
|
When using uv, you need to modify the following part of the pyproject.toml file to match your CUDA version. By default, PyTorch compatible with CUDA 12.4 will be downloaded.
|
20
31
|
|
21
32
|
```pyproject.tom
|
@@ -8,6 +8,11 @@
|
|
8
8
|
pip install yomitoku
|
9
9
|
```
|
10
10
|
|
11
|
+
onnxruntimeの実行にGPUを使用する場合
|
12
|
+
```bash
|
13
|
+
pip install yomitoku[gpu]
|
14
|
+
```
|
15
|
+
|
11
16
|
## uv でのインストール
|
12
17
|
|
13
18
|
本リポジトリはパッケージ管理ツールに [uv](https://docs.astral.sh/uv/) を使用しています。uv をインストール後、リポジトリをクローンし、以下のコマンドを実行してください
|
@@ -16,6 +21,11 @@ pip install yomitoku
|
|
16
21
|
uv sync
|
17
22
|
```
|
18
23
|
|
24
|
+
onnxruntimeの実行にGPUを使用する場合
|
25
|
+
```bash
|
26
|
+
uv sync --extra gpu
|
27
|
+
```
|
28
|
+
|
19
29
|
uvを利用する場合、`pyproject.toml`の以下の部分をご自身のcudaのバージョンに合わせて修正する必要があります。デフォルトではCUDA12.4に対応したpytorchがダウンロードされます。
|
20
30
|
|
21
31
|
```pyproject.tom
|
@@ -16,9 +16,12 @@ yomitoku ${path_data} -f md -o results -v
|
|
16
16
|
- `-d`, `--device`: Specify the device for running the model. If a GPU is unavailable, inference will be executed on the CPU. (Default: cuda)
|
17
17
|
- `--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.)
|
18
18
|
- `--figure_letter`: Exports characters contained within detected figures and tables to the output file.
|
19
|
-
- `--figure`: Exports detected figures and images to the output file
|
19
|
+
- `--figure`: Exports detected figures and images to the output file
|
20
|
+
- `--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)
|
21
|
+
|
20
22
|
|
21
23
|
**NOTE**
|
24
|
+
|
22
25
|
- 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.
|
23
26
|
- Only printed text recognition is supported. While it may occasionally read handwritten text, official support is not provided.
|
24
27
|
- YomiToku is optimized for document OCR and is not designed for scene OCR (e.g., text printed on non-paper surfaces like signs).
|
@@ -30,24 +33,11 @@ yomitoku ${path_data} -f md -o results -v
|
|
30
33
|
|
31
34
|
The Document Analyzer performs OCR and layout analysis, integrating these results into a comprehensive analysis output. It can be used for various use cases, including paragraph and table structure analysis, extraction, and figure/table detection.
|
32
35
|
|
33
|
-
|
34
|
-
import cv2
|
35
|
-
|
36
|
-
from yomitoku import DocumentAnalyzer
|
37
|
-
from yomitoku.data.functions import load_image
|
38
|
-
|
39
|
-
if __name__ == "__main__":
|
40
|
-
img = load_image(PATH_IMAGE)
|
41
|
-
analyzer = DocumentAnalyzer(configs=None, visualize=True, device="cuda")
|
42
|
-
results, ocr_vis, layout_vis = analyzer(img)
|
36
|
+
<!--codeinclude-->
|
43
37
|
|
44
|
-
|
45
|
-
results.to_html(PATH_OUTPUT)
|
38
|
+
[demo/simple_document_analysis.py](../demo/simple_document_analysis.py)
|
46
39
|
|
47
|
-
|
48
|
-
cv2.imwrite("output_ocr.jpg", ocr_vis)
|
49
|
-
cv2.imwrite("output_layout.jpg", layout_vis)
|
50
|
-
```
|
40
|
+
<!--/codeinclude-->
|
51
41
|
|
52
42
|
- Setting `visualize` to True enables the visualization of each processing result. The second and third return values will contain the OCR and layout analysis results, respectively. If set to False, None will be returned. Since visualization adds computational overhead, it is recommended to set it to False unless needed for debugging purposes.
|
53
43
|
- The `device` parameter specifies the computation device to be used. The default is "cuda". If a GPU is unavailable, it automatically switches to CPU mode for processing.
|
@@ -55,31 +45,20 @@ if __name__ == "__main__":
|
|
55
45
|
|
56
46
|
The results of DocumentAnalyzer can be exported in the following formats:
|
57
47
|
|
58
|
-
`to_json()`: JSON format (
|
59
|
-
`to_html()`: HTML format (
|
60
|
-
`to_csv()`: Comma-separated CSV format (
|
61
|
-
`to_markdown()`: Markdown format (
|
62
|
-
|
48
|
+
`to_json()`: JSON format (_.json)
|
49
|
+
`to_html()`: HTML format (_.html)
|
50
|
+
`to_csv()`: Comma-separated CSV format (_.csv)
|
51
|
+
`to_markdown()`: Markdown format (_.md)
|
63
52
|
|
64
53
|
### Using AI-OCR Only
|
65
54
|
|
66
|
-
AI-OCR performs text detection and recognition on the detected text, returning the positions of the text within the image along with the
|
55
|
+
AI-OCR performs text detection and recognition on the detected text, returning the positions of the text within the image along with the
|
67
56
|
|
68
|
-
|
69
|
-
import cv2
|
57
|
+
<!--codeinclude-->
|
70
58
|
|
71
|
-
|
72
|
-
from yomitoku.data.functions import load_image
|
59
|
+
[demo/simple_ocr.py](../demo/simple_ocr.py)
|
73
60
|
|
74
|
-
|
75
|
-
img = load_image(PATH_IMAGE)
|
76
|
-
ocr = OCR(configs=None, visualize=True, device="cuda")
|
77
|
-
results, ocr_vis = ocr(img)
|
78
|
-
|
79
|
-
# JSON形式で解析結果をエクスポート
|
80
|
-
results.to_json(PATH_OUTPUT)
|
81
|
-
cv2.imwrite("output_ocr.jpg", ocr_vis)
|
82
|
-
```
|
61
|
+
<!--/codeinclude-->
|
83
62
|
|
84
63
|
- Setting `visualize` to True enables the visualization of each processing result. The second and third return values will contain the OCR and layout analysis results, respectively. If set to False, None will be returned. Since visualization adds computational overhead, it is recommended to set it to False unless needed for debugging purposes.
|
85
64
|
- The `device` parameter specifies the computation device to be used. The default is "cuda". If a GPU is unavailable, it automatically switches to CPU mode for processing.
|
@@ -91,22 +70,11 @@ The results of OCR processing support export in JSON format (`to_json()`) only.
|
|
91
70
|
|
92
71
|
The `LayoutAnalyzer` performs text detection, followed by AI-based paragraph, figure/table detection, and table structure analysis. It analyzes the layout structure within the document.
|
93
72
|
|
94
|
-
|
95
|
-
import cv2
|
73
|
+
<!--codeinclude-->
|
96
74
|
|
97
|
-
|
98
|
-
from yomitoku.data.functions import load_image
|
99
|
-
|
100
|
-
if __name__ == "__main__":
|
101
|
-
img = load_image(PATH_IMAGE)
|
102
|
-
analyzer = LayoutAnalyzer(configs=None, visualize=True, device="cuda")
|
103
|
-
results, layout_vis = analyzer(img)
|
104
|
-
|
105
|
-
# JSON形式で解析結果をエクスポート
|
106
|
-
results.to_json(PATH_OUTPUT)
|
107
|
-
cv2.imwrite("output_layout.jpg", layout_vis)
|
108
|
-
```
|
75
|
+
[demo/simple_layout.py](../demo/simple_layout.py)
|
109
76
|
|
77
|
+
<!--/codeinclude-->
|
110
78
|
|
111
79
|
- Setting `visualize` to True enables the visualization of each processing result. The second and third return values will contain the OCR and layout analysis results, respectively. If set to False, None will be returned. Since visualization adds computational overhead, it is recommended to set it to False unless needed for debugging purposes.
|
112
80
|
- The `device` parameter specifies the computation device to be used. The default is "cuda". If a GPU is unavailable, it automatically switches to CPU mode for processing.
|
@@ -150,7 +118,6 @@ if __name__ == "__main__":
|
|
150
118
|
|
151
119
|
### Defining Parameters in an YAML File
|
152
120
|
|
153
|
-
|
154
121
|
By providing the path to a YAML file in the config, you can adjust detailed parameters for inference. Examples of YAML files can be found in the `configs` directory within the repository. While the model's network parameters cannot be modified, certain aspects like post-processing parameters and input image size can be adjusted.
|
155
122
|
|
156
123
|
For instance, you can define post-processing thresholds for the Text Detector in a YAML file and set its path in the config. The config file does not need to include all parameters; you only need to specify the parameters that require changes.
|
@@ -163,21 +130,11 @@ post_process:
|
|
163
130
|
|
164
131
|
Storing the Path to a YAML File in the Config
|
165
132
|
|
166
|
-
|
167
|
-
from yomitoku import DocumentAnalyzer
|
133
|
+
<!--codeinclude-->
|
168
134
|
|
169
|
-
|
170
|
-
# path_cfgに設定したymalのパスを記述する
|
171
|
-
configs = {
|
172
|
-
"ocr": {
|
173
|
-
"text_detector": {
|
174
|
-
"path_cfg": "text_detector.yaml"
|
175
|
-
}
|
176
|
-
}
|
177
|
-
}
|
135
|
+
[demo/setting_document_anaysis.py](../demo/setting_document_anaysis.py)
|
178
136
|
|
179
|
-
|
180
|
-
```
|
137
|
+
<!--/codeinclude-->
|
181
138
|
|
182
139
|
## Using in an Offline Environment
|
183
140
|
|
@@ -186,7 +143,6 @@ Yomitoku automatically downloads models from Hugging Face Hub during the first e
|
|
186
143
|
1. Install [Git Large File Storage](https://docs.github.com/ja/repositories/working-with-files/managing-large-files/installing-git-large-file-storage)
|
187
144
|
2. In an environment with internet access, download the model repository. Copy the cloned repository to your target environment using your preferred tools.
|
188
145
|
|
189
|
-
|
190
146
|
The following is the command to download the model repository from Hugging Face Hub.
|
191
147
|
|
192
148
|
```sh
|
@@ -207,18 +163,8 @@ hf_hub_repo: yomitoku-text-detector-dbnet-open-beta
|
|
207
163
|
|
208
164
|
4. Storing the Path to a YAML File in the Config
|
209
165
|
|
210
|
-
|
211
|
-
from yomitoku import DocumentAnalyzer
|
166
|
+
<!--codeinclude-->
|
212
167
|
|
213
|
-
|
214
|
-
# path_cfgに設定したymalのパスを記述する
|
215
|
-
configs = {
|
216
|
-
"ocr": {
|
217
|
-
"text_detector": {
|
218
|
-
"path_cfg": "text_detector.yaml"
|
219
|
-
}
|
220
|
-
}
|
221
|
-
}
|
168
|
+
[demo/setting_document_anaysis.py](../demo/setting_document_anaysis.py)
|
222
169
|
|
223
|
-
|
224
|
-
```
|
170
|
+
<!--/codeinclude-->
|
@@ -8,12 +8,18 @@
|
|
8
8
|
yomitoku ${path_data} -f md -o results -v
|
9
9
|
```
|
10
10
|
|
11
|
-
- `${path_data}`
|
12
|
-
- `-f` 出力形式のファイルフォーマットを指定します。(json, csv, html, md をサポート)
|
13
|
-
- `-
|
14
|
-
- `-
|
15
|
-
- `-
|
16
|
-
- `-d` モデルを実行するためのデバイスを指定します。gpu が利用できない場合は cpu で推論が実行されます。(デフォルト: cuda)
|
11
|
+
- `${path_data}` 解析対象の画像が含まれたディレクトリか画像ファイルのパスを直接して指定してください。ディレクトリを対象とした場合はディレクトリのサブディレクトリ内の画像も含めて処理を実行します。
|
12
|
+
- `-f`, `--format` 出力形式のファイルフォーマットを指定します。(json, csv, html, md をサポート)
|
13
|
+
- `-o`, `--outdir` 出力先のディレクトリ名を指定します。存在しない場合は新規で作成されます。
|
14
|
+
- `-v`, `--vis` を指定すると解析結果を可視化した画像を出力します。
|
15
|
+
- `-l`, `--lite` を指定すると軽量モデルで推論を実行します。通常より高速に推論できますが、若干、精度が低下する可能性があります。
|
16
|
+
- `-d`, `--device` モデルを実行するためのデバイスを指定します。gpu が利用できない場合は cpu で推論が実行されます。(デフォルト: cuda)
|
17
|
+
- `--ignore_line_break` 画像の改行位置を無視して、段落内の文章を連結して返します。(デフォルト:画像通りの改行位置位置で改行します。)
|
18
|
+
- `--figure_letter` 検出した図表に含まれる文字も出力ファイルにエクスポートします。
|
19
|
+
- `--figure` 検出した図、画像を出力ファイルにエクスポートします。
|
20
|
+
- `--encoding` エクスポートする出力ファイルの文字エンコーディングを指定します。サポートされていない文字コードが含まれる場合は、その文字を無視します。(utf-8, utf-8-sig, shift-jis, enc-jp, cp932)
|
21
|
+
|
22
|
+
その他のオプションに関しては、ヘルプを参照
|
17
23
|
|
18
24
|
### Note:
|
19
25
|
|
@@ -28,24 +34,11 @@ yomitoku ${path_data} -f md -o results -v
|
|
28
34
|
|
29
35
|
Document Analyzer は OCR およびレイアウト解析を実行し、それらの結果を統合した解析結果を返却します。段落、表の構造解析、抽出、図表の検知など様々なユースケースにご利用いただけます。
|
30
36
|
|
31
|
-
|
32
|
-
import cv2
|
33
|
-
|
34
|
-
from yomitoku import DocumentAnalyzer
|
35
|
-
from yomitoku.data.functions import load_image
|
36
|
-
|
37
|
-
if __name__ == "__main__":
|
38
|
-
img = load_image(PATH_IMAGE)
|
39
|
-
analyzer = DocumentAnalyzer(configs=None, visualize=True, device="cuda")
|
40
|
-
results, ocr_vis, layout_vis = analyzer(img)
|
37
|
+
<!--codeinclude-->
|
41
38
|
|
42
|
-
|
43
|
-
results.to_html(PATH_OUTPUT)
|
39
|
+
[demo/simple_document_analysis.py](../demo/simple_document_analysis.py)
|
44
40
|
|
45
|
-
|
46
|
-
cv2.imwrite("output_ocr.jpg", ocr_vis)
|
47
|
-
cv2.imwrite("output_layout.jpg", layout_vis)
|
48
|
-
```
|
41
|
+
<!--/codeinclude-->
|
49
42
|
|
50
43
|
- `visualize` を True にすると各処理結果を可視化した結果を第2、第 3 戻り値に OCR、レアウト解析の処理結果をそれぞれ格納し、返却します。False にした場合は None を返却します。描画処理のための計算が増加しますので、デバック用途でない場合は、False を推奨します。
|
51
44
|
- `device` には処理に用いる計算機を指定します。Default は"cuda". GPU が利用できない場合は、自動で CPU モードに切り替えて処理を実行します。
|
@@ -62,21 +55,11 @@ if __name__ == "__main__":
|
|
62
55
|
|
63
56
|
AI-OCR では、テキスト検知と検知したテキストに対して、認識処理を実行し、画像内の文字の位置と読み取り結果を返却します。
|
64
57
|
|
65
|
-
|
66
|
-
import cv2
|
67
|
-
|
68
|
-
from yomitoku import OCR
|
69
|
-
from yomitoku.data.functions import load_image
|
58
|
+
<!--codeinclude-->
|
70
59
|
|
71
|
-
|
72
|
-
img = load_image(PATH_IMAGE)
|
73
|
-
ocr = OCR(configs=None, visualize=True, device="cuda")
|
74
|
-
results, ocr_vis = ocr(img)
|
60
|
+
[demo/simple_ocr.py](../demo/simple_ocr.py)
|
75
61
|
|
76
|
-
|
77
|
-
results.to_json(PATH_OUTPUT)
|
78
|
-
cv2.imwrite("output_ocr.jpg", ocr_vis)
|
79
|
-
```
|
62
|
+
<!--/codeinclude-->
|
80
63
|
|
81
64
|
- `visualize` を True にすると各処理結果を可視化した結果を第2、第 3 戻り値に OCR、レアウト解析の処理結果をそれぞれ格納し、返却します。False にした場合は None を返却します。描画処理のための計算が増加しますので、デバック用途でない場合は、False を推奨します。
|
82
65
|
- `device` には処理に用いる計算機を指定します。Default は"cuda". GPU が利用できない場合は、自動で CPU モードに切り替えて処理を実行します。
|
@@ -88,21 +71,11 @@ if __name__ == "__main__":
|
|
88
71
|
|
89
72
|
LayoutAnalyzer では、テキスト検知と検知したテキストに対して、段落、図表の検知および表の構造解析処理 AI を実行し、文書内のレイアウト構造を解析します。
|
90
73
|
|
91
|
-
|
92
|
-
import cv2
|
93
|
-
|
94
|
-
from yomitoku import LayoutAnalyzer
|
95
|
-
from yomitoku.data.functions import load_image
|
74
|
+
<!--codeinclude-->
|
96
75
|
|
97
|
-
|
98
|
-
img = load_image(PATH_IMAGE)
|
99
|
-
analyzer = LayoutAnalyzer(configs=None, visualize=True, device="cuda")
|
100
|
-
results, layout_vis = analyzer(img)
|
76
|
+
[demo/simple_layout.py](../demo/simple_layout.py)
|
101
77
|
|
102
|
-
|
103
|
-
results.to_json(PATH_OUTPUT)
|
104
|
-
cv2.imwrite("output_layout.jpg", layout_vis)
|
105
|
-
```
|
78
|
+
<!--/codeinclude-->
|
106
79
|
|
107
80
|
- `visualize` を True にすると各処理結果を可視化した結果を第2、第 3 戻り値に OCR、レアウト解析の処理結果をそれぞれ格納し、返却します。False にした場合は None を返却します。描画処理のための計算が増加しますので、デバック用途でない場合は、False を推奨します。
|
108
81
|
- `device` には処理に用いる計算機を指定します。Default は"cuda". GPU が利用できない場合は、自動で CPU モードに切り替えて処理を実行します。
|
@@ -160,21 +133,11 @@ post_process:
|
|
160
133
|
|
161
134
|
yaml ファイルのパスを config に格納する
|
162
135
|
|
163
|
-
|
164
|
-
from yomitoku import DocumentAnalyzer
|
136
|
+
<!--codeinclude-->
|
165
137
|
|
166
|
-
|
167
|
-
# path_cfgに設定したymalのパスを記述する
|
168
|
-
configs = {
|
169
|
-
"ocr": {
|
170
|
-
"text_detector": {
|
171
|
-
"path_cfg": "text_detector.yaml"
|
172
|
-
}
|
173
|
-
}
|
174
|
-
}
|
138
|
+
[demo/setting_document_anaysis.py](../demo/setting_document_anaysis.py)
|
175
139
|
|
176
|
-
|
177
|
-
```
|
140
|
+
<!--/codeinclude-->
|
178
141
|
|
179
142
|
## インターネットに接続できない環境での利用
|
180
143
|
|
@@ -204,18 +167,8 @@ hf_hub_repo: yomitoku-text-detector-dbnet-open-beta
|
|
204
167
|
|
205
168
|
4. yaml ファイルのパスを config に格納する
|
206
169
|
|
207
|
-
|
208
|
-
from yomitoku import DocumentAnalyzer
|
170
|
+
<!--codeinclude-->
|
209
171
|
|
210
|
-
|
211
|
-
# path_cfgに設定したymalのパスを記述する
|
212
|
-
configs = {
|
213
|
-
"ocr": {
|
214
|
-
"text_detector": {
|
215
|
-
"path_cfg": "text_detector.yaml"
|
216
|
-
}
|
217
|
-
}
|
218
|
-
}
|
172
|
+
[demo/setting_document_anaysis.py](../demo/setting_document_anaysis.py)
|
219
173
|
|
220
|
-
|
221
|
-
```
|
174
|
+
<!--/codeinclude-->
|
@@ -27,7 +27,13 @@ dependencies = [
|
|
27
27
|
"torch>=2.5.0",
|
28
28
|
"pypdfium2>=4.30.0",
|
29
29
|
"onnx>=1.17.0",
|
30
|
+
"torch>=2.5.0",
|
31
|
+
"torchvision>=0.20.0",
|
30
32
|
"onnxruntime>=1.20.1",
|
33
|
+
]
|
34
|
+
|
35
|
+
[project.optional-dependencies]
|
36
|
+
gpu = [
|
31
37
|
"onnxruntime-gpu>=1.20.1",
|
32
38
|
]
|
33
39
|
|
@@ -38,6 +44,7 @@ format = "{base}"
|
|
38
44
|
|
39
45
|
[tool.uv]
|
40
46
|
dev-dependencies = [
|
47
|
+
"mkdocs-codeinclude-plugin>=0.2.1",
|
41
48
|
"mkdocs-material>=9.5.44",
|
42
49
|
"mkdocs-static-i18n",
|
43
50
|
"mkdocs>=1.6.1",
|
@@ -50,11 +57,9 @@ dev-dependencies = [
|
|
50
57
|
|
51
58
|
[tool.uv.sources]
|
52
59
|
torch = [
|
53
|
-
{ index = "pytorch-cuda124", marker = "platform_system == 'Windows'"},
|
54
60
|
{ index = "pytorch-cpu", marker = "platform_system == 'Darwin'"},
|
55
61
|
]
|
56
62
|
torchvision = [
|
57
|
-
{ index = "pytorch-cuda124", marker = "platform_system == 'Windows'"},
|
58
63
|
{ index = "pytorch-cpu", marker = "platform_system == 'Darwin'"},
|
59
64
|
]
|
60
65
|
|
@@ -94,6 +99,7 @@ deps =
|
|
94
99
|
pygments
|
95
100
|
plantuml_markdown
|
96
101
|
mkdocs-static-i18n
|
102
|
+
mkdocs-codeinclude-plugin
|
97
103
|
commands =
|
98
104
|
mkdocs gh-deploy --force
|
99
105
|
"""
|