yomitoku 0.7.0__py3-none-any.whl → 0.7.1__py3-none-any.whl

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/cli/main.py CHANGED
@@ -1,5 +1,6 @@
1
1
  import argparse
2
2
  import os
3
+ import torch
3
4
  from pathlib import Path
4
5
 
5
6
  import cv2
@@ -235,7 +236,7 @@ def main():
235
236
  if args.lite:
236
237
  configs["ocr"]["text_recognizer"]["model_name"] = "parseq-small"
237
238
 
238
- if args.device == "cpu":
239
+ if args.device == "cpu" or not torch.cuda.is_available():
239
240
  configs["ocr"]["text_detector"]["infer_onnx"] = True
240
241
 
241
242
  # Note: Text Detector以外はONNX推論よりもPyTorch推論の方が速いため、ONNX推論は行わない
@@ -127,7 +127,6 @@ def extract_words_within_element(pred_words, element):
127
127
  if len(contained_words) == 0:
128
128
  return None, None, check_list
129
129
 
130
- element_direction = "horizontal"
131
130
  word_direction = [word.direction for word in contained_words]
132
131
  cnt_horizontal = word_direction.count("horizontal")
133
132
  cnt_vertical = word_direction.count("vertical")
@@ -41,6 +41,8 @@ def save_figure(
41
41
  out_path,
42
42
  figure_dir="figures",
43
43
  ):
44
+ assert img is not None, "img is required for saving figures"
45
+
44
46
  for i, figure in enumerate(figures):
45
47
  x1, y1, x2, y2 = map(int, figure.box)
46
48
  figure_img = img[y1:y2, x1:x2, :]
@@ -110,6 +110,8 @@ def figure_to_html(
110
110
  figure_dir="figures",
111
111
  width=200,
112
112
  ):
113
+ assert img is not None, "img is required for saving figures"
114
+
113
115
  elements = []
114
116
  for i, figure in enumerate(figures):
115
117
  x1, y1, x2, y2 = map(int, figure.box)
@@ -21,6 +21,8 @@ def save_figure(
21
21
  out_path,
22
22
  figure_dir="figures",
23
23
  ):
24
+ assert img is not None, "img is required for saving figures"
25
+
24
26
  for i, figure in enumerate(figures):
25
27
  x1, y1, x2, y2 = map(int, figure.box)
26
28
  figure_img = img[y1:y2, x1:x2, :]
@@ -75,6 +75,8 @@ def figure_to_md(
75
75
  width=200,
76
76
  figure_dir="figures",
77
77
  ):
78
+ assert img is not None, "img is required for saving figures"
79
+
78
80
  elements = []
79
81
  for i, figure in enumerate(figures):
80
82
  x1, y1, x2, y2 = map(int, figure.box)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: yomitoku
3
- Version: 0.7.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
@@ -1,7 +1,7 @@
1
1
  yomitoku/__init__.py,sha256=kXOM8RbpwwLABG3p3vPT3dJWBk4JX2MFGrOeBEW0hKM,543
2
2
  yomitoku/base.py,sha256=lzR_V8t87aRasmFdFwD-8KAeSahSTI3AZaEn6g8sOv8,3871
3
3
  yomitoku/constants.py,sha256=zlW5QRc_u_F3C2RAgBFWyHJZexBnJT5N15GC-9d3iLo,686
4
- yomitoku/document_analyzer.py,sha256=85j93l-6rvvRZsL0FD7EQG--84ZLPiKoNm2CE1Ss8LM,16271
4
+ yomitoku/document_analyzer.py,sha256=B2F_MXFKbq58ePDCgcZKk_bgQUkno1ehYb6CZmAekCk,16234
5
5
  yomitoku/layout_analyzer.py,sha256=VhNf1ZQFoozj6WUGk5ll1p2p1jk5X3j-JPcDbTAoSl4,1856
6
6
  yomitoku/layout_parser.py,sha256=V_mAkZxke1gwHfnxBFMTOJ8hnz2X_kfZu2lLiMd8cAs,7610
7
7
  yomitoku/ocr.py,sha256=JSTjkupcxHITQm6ERnzU7As0c3KWf8-oxc0AqNoWHXo,2272
@@ -10,7 +10,7 @@ yomitoku/table_structure_recognizer.py,sha256=Eam9t7OjW4a-UWk_dl-ylbOcinN_Te_ovu
10
10
  yomitoku/text_detector.py,sha256=XgqhtbNcJww2x3BrH8EFz45qC6kqPKCX9hsa-dzRoIA,4274
11
11
  yomitoku/text_recognizer.py,sha256=LVMjy-PaGlDQqfJrjKX_7vOQXDyFg6FaCeIQIyWUJX8,5833
12
12
  yomitoku/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
13
- yomitoku/cli/main.py,sha256=N0X4-z_jfFM5_buUpiLHHA68B5oPVVdmvwzXWn7qoUs,7822
13
+ yomitoku/cli/main.py,sha256=Dcu-jBql5dP4DiN0QWbPAQscnJ7tTtbWUnaohz3FFbs,7868
14
14
  yomitoku/configs/__init__.py,sha256=e1Alss5QJLZSNfD6zLEG6xu5vDQDw-4Jayiqq8bq52s,571
15
15
  yomitoku/configs/cfg_layout_parser_rtdtrv2.py,sha256=8PRxB2Ar9UF7-DLtbgSokhrzdXb0veWI6Wc-X8qigRw,2329
16
16
  yomitoku/configs/cfg_table_structure_recognizer_rtdtrv2.py,sha256=o70GMHD8k-zeBeJtuhPS8x7vVB-ffucnJXeSyn-0AXo,2116
@@ -21,10 +21,10 @@ yomitoku/data/__init__.py,sha256=KAofFc9rk9ZdTKBjemu9RM8Vj9XnKbWC2MPZ2RWtOdE,82
21
21
  yomitoku/data/dataset.py,sha256=-I4f-FDtgsPnJ2MnXB7FtwihMW3koDaSI1OEoqKneIg,1014
22
22
  yomitoku/data/functions.py,sha256=eOyxo8S6EoAf1xGSPLWQFb9-t5Rg52NggD9MFIrOSpY,7506
23
23
  yomitoku/export/__init__.py,sha256=aANEfuovH2aevFjb2pGrBLFP-4iRzEzD9wcriCR-M7I,229
24
- yomitoku/export/export_csv.py,sha256=MzGS1Y6kiHo7vZV3heKkd_v5gdxJBrpa8Zt9gFMwG88,2869
25
- yomitoku/export/export_html.py,sha256=ezj96wQNqkBOCUOIPHFJW_BCh1I4Ij_8RDiKUxqaFok,4913
26
- yomitoku/export/export_json.py,sha256=Kz8MgWM0bd6SNaSiHZjs-IjhsvX19Y0ovlIxGcm1vIw,1910
27
- yomitoku/export/export_markdown.py,sha256=w9jT-A0__4rw1PaeGtRicuLu1rqeZO-ZLwyJm5F5PXQ,4033
24
+ yomitoku/export/export_csv.py,sha256=gKIhhFKOyZaxwmjbtxk8rkFOv3uPaRwfOnKwTC8d7K0,2935
25
+ yomitoku/export/export_html.py,sha256=RsFU-IMtBOJWCdqHhp5btswf2fzfow01ypY1h6E6Vvo,4979
26
+ yomitoku/export/export_json.py,sha256=-57hcT2ENTa1HcT7YMjXiv6tZZf_Y_1q1xu2Jt9T1P4,1976
27
+ yomitoku/export/export_markdown.py,sha256=kGOyopq_vT2NqM4LoAu4JIPbjV_SLg9H0MIOAKpS-Gk,4099
28
28
  yomitoku/models/__init__.py,sha256=Enxq9sjJWusZuxecTori8IQa8NEYKaiiptDluHX1avg,144
29
29
  yomitoku/models/dbnet_plus.py,sha256=jeWJZm0ihbxoJeAXBFK7uVIwoosx2IUNk7Ut5wRH0vA,7998
30
30
  yomitoku/models/parseq.py,sha256=-DQMQuON2jwtb4Ib2V0O19un9w-WG4rXS0SiscydrXU,8593
@@ -48,7 +48,7 @@ yomitoku/utils/graph.py,sha256=LKNB8ZhSQwOZMfeAimPMF5UCVVr2ZaUWoGDkz8z-uGU,456
48
48
  yomitoku/utils/logger.py,sha256=uOmtQDr0A0JD7wyFshedL08BiNrQorHnpktRXba8bjU,424
49
49
  yomitoku/utils/misc.py,sha256=FbwPLeIYYBvNf9wQh2RoEonTM5BF7_IwaEqmRsYHKA8,2673
50
50
  yomitoku/utils/visualizer.py,sha256=DjDwHiAu1iFRKh96H3Egq4vuI2s_-9dLCDeykhKi8jo,5251
51
- yomitoku-0.7.0.dist-info/METADATA,sha256=Yvpxy_oWORSz_db4yzledIhFHbuQbORz0DrMisf59zQ,8488
52
- yomitoku-0.7.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
53
- yomitoku-0.7.0.dist-info/entry_points.txt,sha256=nFV3S11zgBNW0Qq_D0XQNg2R4lNXU_9XUFr6rdJoyF8,52
54
- yomitoku-0.7.0.dist-info/RECORD,,
51
+ yomitoku-0.7.1.dist-info/METADATA,sha256=NgweyozOKBkIn9-yxX0hOV313-dBh29SsFQ22BSvoD8,8488
52
+ yomitoku-0.7.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
53
+ yomitoku-0.7.1.dist-info/entry_points.txt,sha256=nFV3S11zgBNW0Qq_D0XQNg2R4lNXU_9XUFr6rdJoyF8,52
54
+ yomitoku-0.7.1.dist-info/RECORD,,