yomitoku 0.7.2__py3-none-any.whl → 0.7.3__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/data/functions.py +2 -2
- yomitoku/export/export_markdown.py +1 -1
- yomitoku/models/parseq.py +7 -1
- yomitoku/table_structure_recognizer.py +5 -2
- yomitoku/text_recognizer.py +1 -0
- {yomitoku-0.7.2.dist-info → yomitoku-0.7.3.dist-info}/METADATA +1 -1
- {yomitoku-0.7.2.dist-info → yomitoku-0.7.3.dist-info}/RECORD +9 -9
- {yomitoku-0.7.2.dist-info → yomitoku-0.7.3.dist-info}/WHEEL +0 -0
- {yomitoku-0.7.2.dist-info → yomitoku-0.7.3.dist-info}/entry_points.txt +0 -0
yomitoku/data/functions.py
CHANGED
@@ -132,7 +132,7 @@ def resize_shortest_edge(
|
|
132
132
|
neww = max(int(new_w / 32) * 32, 32)
|
133
133
|
newh = max(int(new_h / 32) * 32, 32)
|
134
134
|
|
135
|
-
img = cv2.resize(img, (neww, newh))
|
135
|
+
img = cv2.resize(img, (neww, newh), interpolation=cv2.INTER_AREA)
|
136
136
|
return img
|
137
137
|
|
138
138
|
|
@@ -275,7 +275,7 @@ def resize_with_padding(img, target_size, background_color=(0, 0, 0)):
|
|
275
275
|
new_w = int(w * min(scale_w, scale_h))
|
276
276
|
new_h = int(h * min(scale_w, scale_h))
|
277
277
|
|
278
|
-
resized = cv2.resize(img, (new_w, new_h), interpolation=cv2.
|
278
|
+
resized = cv2.resize(img, (new_w, new_h), interpolation=cv2.INTER_AREA)
|
279
279
|
|
280
280
|
canvas = np.zeros((target_size[0], target_size[1], 3), dtype=np.uint8)
|
281
281
|
canvas[:, :] = background_color
|
yomitoku/models/parseq.py
CHANGED
@@ -81,6 +81,8 @@ class PARSeq(nn.Module, PyTorchModelHubMixin):
|
|
81
81
|
named_apply(partial(init_weights, exclude=["encoder"]), self)
|
82
82
|
nn.init.trunc_normal_(self.pos_queries, std=0.02)
|
83
83
|
|
84
|
+
self.export_onnx = False
|
85
|
+
|
84
86
|
@property
|
85
87
|
def _device(self) -> torch.device:
|
86
88
|
return next(self.head.parameters(recurse=False)).device
|
@@ -175,7 +177,11 @@ class PARSeq(nn.Module, PyTorchModelHubMixin):
|
|
175
177
|
# greedy decode. add the next token index to the target input
|
176
178
|
tgt_in[:, j] = p_i.squeeze().argmax(-1)
|
177
179
|
# Efficient batch decoding: If all output words have at least one EOS token, end decoding.
|
178
|
-
if
|
180
|
+
if (
|
181
|
+
not self.export_onnx
|
182
|
+
and testing
|
183
|
+
and (tgt_in == self.tokenizer.eos_id).any(dim=-1).all()
|
184
|
+
):
|
179
185
|
break
|
180
186
|
|
181
187
|
logits = torch.cat(logits, dim=1)
|
@@ -47,6 +47,7 @@ class TableStructureRecognizerSchema(BaseSchema):
|
|
47
47
|
rows: List[TableLineSchema]
|
48
48
|
cols: List[TableLineSchema]
|
49
49
|
cells: List[TableCellSchema]
|
50
|
+
spans: List[TableLineSchema]
|
50
51
|
order: int
|
51
52
|
|
52
53
|
|
@@ -242,7 +243,7 @@ class TableStructureRecognizer(BaseModule):
|
|
242
243
|
category_elements
|
243
244
|
)
|
244
245
|
|
245
|
-
cells, rows, cols = self.extract_cell_elements(category_elements)
|
246
|
+
cells, rows, cols, spans = self.extract_cell_elements(category_elements)
|
246
247
|
|
247
248
|
table_x, table_y = data["offset"]
|
248
249
|
table_x2 = table_x + data["size"][1]
|
@@ -255,6 +256,7 @@ class TableStructureRecognizer(BaseModule):
|
|
255
256
|
"n_col": len(cols),
|
256
257
|
"rows": rows,
|
257
258
|
"cols": cols,
|
259
|
+
"spans": spans,
|
258
260
|
"cells": cells,
|
259
261
|
"order": 0,
|
260
262
|
}
|
@@ -276,8 +278,9 @@ class TableStructureRecognizer(BaseModule):
|
|
276
278
|
|
277
279
|
rows = sorted(elements["row"], key=lambda x: x["box"][1])
|
278
280
|
cols = sorted(elements["col"], key=lambda x: x["box"][0])
|
281
|
+
spans = sorted(elements["span"], key=lambda x: x["box"][1])
|
279
282
|
|
280
|
-
return cells, rows, cols
|
283
|
+
return cells, rows, cols, spans
|
281
284
|
|
282
285
|
def __call__(self, img, table_boxes, vis=None):
|
283
286
|
img_tensors = self.preprocess(img, table_boxes)
|
yomitoku/text_recognizer.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: yomitoku
|
3
|
-
Version: 0.7.
|
3
|
+
Version: 0.7.3
|
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
|
@@ -6,9 +6,9 @@ yomitoku/layout_analyzer.py,sha256=VhNf1ZQFoozj6WUGk5ll1p2p1jk5X3j-JPcDbTAoSl4,1
|
|
6
6
|
yomitoku/layout_parser.py,sha256=V_mAkZxke1gwHfnxBFMTOJ8hnz2X_kfZu2lLiMd8cAs,7610
|
7
7
|
yomitoku/ocr.py,sha256=JSTjkupcxHITQm6ERnzU7As0c3KWf8-oxc0AqNoWHXo,2272
|
8
8
|
yomitoku/reading_order.py,sha256=OfhOS9ttPDoPSuHrIRKyOzG19GGeRufbuSKDqhsohh4,6404
|
9
|
-
yomitoku/table_structure_recognizer.py,sha256=
|
9
|
+
yomitoku/table_structure_recognizer.py,sha256=tHjex6deT_FjRK5ePz9bUXA_QIhgv_vYtK-ynm4ALxg,9625
|
10
10
|
yomitoku/text_detector.py,sha256=XgqhtbNcJww2x3BrH8EFz45qC6kqPKCX9hsa-dzRoIA,4274
|
11
|
-
yomitoku/text_recognizer.py,sha256=
|
11
|
+
yomitoku/text_recognizer.py,sha256=t95sbxve-E9VOCaU9CFGZIlk_a4my9KfFfr9tXws9As,5871
|
12
12
|
yomitoku/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
13
13
|
yomitoku/cli/main.py,sha256=WvQO9V5HzxxvRAIsGkrDl9OGrmaKsAbDBrg4ApCSy_c,10527
|
14
14
|
yomitoku/configs/__init__.py,sha256=e1Alss5QJLZSNfD6zLEG6xu5vDQDw-4Jayiqq8bq52s,571
|
@@ -19,15 +19,15 @@ yomitoku/configs/cfg_text_recognizer_parseq.py,sha256=hpFs3nKqh4XdU3BZMTultegtLE
|
|
19
19
|
yomitoku/configs/cfg_text_recognizer_parseq_small.py,sha256=uCm_VC_G79IbZpOiK8fgYzAJ4b98H5pf328wyQomtfo,1259
|
20
20
|
yomitoku/data/__init__.py,sha256=KAofFc9rk9ZdTKBjemu9RM8Vj9XnKbWC2MPZ2RWtOdE,82
|
21
21
|
yomitoku/data/dataset.py,sha256=-I4f-FDtgsPnJ2MnXB7FtwihMW3koDaSI1OEoqKneIg,1014
|
22
|
-
yomitoku/data/functions.py,sha256=
|
22
|
+
yomitoku/data/functions.py,sha256=7a_3xDKAQVdWfzQwFcdyJBojoyzUa3ePZOnG4pX1dpI,7532
|
23
23
|
yomitoku/export/__init__.py,sha256=fkwOtqH0lh6eZQW5b4EMSjIH1FmWYLKKszahR-jQYSg,366
|
24
24
|
yomitoku/export/export_csv.py,sha256=B234jlNeO4n5kQ_lwxxAZe_O2ipTbeDYlWU1zyyaVrw,3001
|
25
25
|
yomitoku/export/export_html.py,sha256=pCLoxV10_SzRWmZlDnHuyfPFIuUGB3ZkqSdABVU7DTs,5038
|
26
26
|
yomitoku/export/export_json.py,sha256=D6dD04gcPR5lmfHFVX-iGOYapsOVaJ_kH1Qhs6d2O0M,2035
|
27
|
-
yomitoku/export/export_markdown.py,sha256=
|
27
|
+
yomitoku/export/export_markdown.py,sha256=D1kX3X8odWa0pf4AFZ6gik5EKMKK7pgpQXaHHv6pWDI,4170
|
28
28
|
yomitoku/models/__init__.py,sha256=Enxq9sjJWusZuxecTori8IQa8NEYKaiiptDluHX1avg,144
|
29
29
|
yomitoku/models/dbnet_plus.py,sha256=jeWJZm0ihbxoJeAXBFK7uVIwoosx2IUNk7Ut5wRH0vA,7998
|
30
|
-
yomitoku/models/parseq.py,sha256
|
30
|
+
yomitoku/models/parseq.py,sha256=psCPjP3eKjOFAUZJPQQhbD0nWEV5FeOZ0tTK27Rvvbw,8748
|
31
31
|
yomitoku/models/rtdetr.py,sha256=oJsr8RHz3frslhLfXdVJve47lUsrmqLjfdTrZ41tlQ0,687
|
32
32
|
yomitoku/models/layers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
33
33
|
yomitoku/models/layers/activate.py,sha256=S54GPssZBMloM2oFAXeDVMmBBZOWyjwU98Niq758txE,1244
|
@@ -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.
|
52
|
-
yomitoku-0.7.
|
53
|
-
yomitoku-0.7.
|
54
|
-
yomitoku-0.7.
|
51
|
+
yomitoku-0.7.3.dist-info/METADATA,sha256=pHT4lQyl9cN4KbsOTooiJAaEEJqXhmAl9SVZKVaPkR0,8717
|
52
|
+
yomitoku-0.7.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
53
|
+
yomitoku-0.7.3.dist-info/entry_points.txt,sha256=nFV3S11zgBNW0Qq_D0XQNg2R4lNXU_9XUFr6rdJoyF8,52
|
54
|
+
yomitoku-0.7.3.dist-info/RECORD,,
|
File without changes
|
File without changes
|