Bug:尝试构建韩文表格识别时出现错误
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 35/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- python
調査の方向性
Start at rapid_table/main.py in RapidTable.call and get_ocr_results, then inspect rapid_table/utils/utils.py:18, where format_ocr_results processes the supplied OCR tuple. Reproduce the call with the shown Korean OCR output and verify that the reported two detections are handled without IndexError and produce table results.
索引モデルが issue の本文から書いたものです。
説明
windows 11 python 3.11环境下 onnxruntime-1.23.2 rapid_table版本为3.0.1在尝试构建韩文表格识别时出现错误,代码如下:
from rapidocr import (
LangRec,
RapidOCR,
)
from rapid_table import ModelType, RapidTable, RapidTableInput
ocr_engine = RapidOCR(
params={
"Rec.lang_type": LangRec.KOREAN,
}
)
input_args = RapidTableInput(
model_type=ModelType.SLANETPLUS, engine_cfg={"use_dml": True}
)
table_engine = RapidTable(input_args)
img_path = r"D:\Users\comma\Downloads\python_tests_test_files_korean.jpg"
ori_ocr_res = ocr_engine(img_path)
ocr_results = [ori_ocr_res.boxes, ori_ocr_res.txts, ori_ocr_res.scores]#不明参数
ocr_result = table_engine(img_path, ocr_results=ocr_results)
报错如下:
IndexError Traceback (most recent call last)
Cell In[43], line 19
17 ori_ocr_res = ocr_engine(img_path)
18 ocr_results = [ori_ocr_res.boxes, ori_ocr_res.txts, ori_ocr_res.scores]#不明参数
---> 19 ocr_result = table_engine(img_path, ocr_results=ocr_results)
File D:\CrawlAI\venv\Lib\site-packages\rapid_table\main.py:107, in RapidTable.__call__(self, img_contents, ocr_results, batch_size)
104 results.logic_points.extend(logic_points)
105 continue
--> 107 dt_boxes, rec_res = self.get_ocr_results(imgs, start_i, end_i, ocr_results)
108 pred_htmls = self.table_matcher(
109 pred_structures, cell_bboxes, dt_boxes, rec_res
110 )
112 results.imgs.extend(imgs)
File D:\CrawlAI\venv\Lib\site-packages\rapid_table\main.py:146, in RapidTable.get_ocr_results(self, imgs, start_i, end_i, ocr_results)
144 for img, ocr_result in zip(imgs, ocr_results_batch):
145 img_h, img_w = img.shape[:2]
--> 146 dt_boxes, rec_res = format_ocr_results(ocr_result, img_h, img_w)
147 batch_dt_boxes.append(dt_boxes)
148 batch_rec_res.append(rec_res)
File D:\CrawlAI\venv\Lib\site-packages\rapid_table\utils\utils.py:18, in format_ocr_results(ocr_results, img_h, img_w)
15 def format_ocr_results(
16 ocr_results: Tuple[np.ndarray, Tuple[str], Tuple[float]], img_h: int, img_w: int
17 ) -> Tuple[np.ndarray, List[Tuple[str, float]]]:
---> 18 rec_res = list(zip(ocr_results[1], ocr_results[2]))
20 bboxes = np.array(ocr_results[0])
21 min_coords = bboxes[..., :2].min(axis=1)
IndexError: index 2 is out of bounds for axis 0 with size 2
检查发现ori_ocr_res能够显示 ,内容如下:
RapidOCROutput(img=array([[[255, 255, 255],
[255, 255, 255],
[255, 255, 255],
...,
[255, 255, 255],
[255, 255, 255],
[255, 255, 255]],
[[255, 255, 255],
[255, 255, 255],
[255, 255, 255],
...,
[255, 255, 255],
[255, 255, 255],
[255, 255, 255]],
[[255, 255, 255],
[255, 255, 255],
[255, 255, 255],
...,
[255, 255, 255],
[255, 255, 255],
[255, 255, 255]],
...,
[[255, 255, 255],
[255, 255, 255],
[255, 255, 255],
...,
[255, 255, 255],
[255, 255, 255],
[255, 255, 255]],
[[255, 255, 255],
[255, 255, 255],
[255, 255, 255],
...,
[255, 255, 255],
[255, 255, 255],
[255, 255, 255]],
[[255, 255, 255],
[255, 255, 255],
[255, 255, 255],
...,
[255, 255, 255],
[255, 255, 255],
[255, 255, 255]]], shape=(208, 1618, 3), dtype=uint8), boxes=array([[[ 115., 71.],
[ 494., 71.],
[ 494., 141.],
[ 115., 141.]],
[[ 479., 70.],
[1426., 70.],
[1426., 141.],
[ 479., 141.]]], dtype=float32), txts=('베이징차오양', '디지털기술로농업새로운발전이끌어'), scores=(0.99507, 0.99916), word_results=(), elapse_list=[2.2739463000034448, 0.004450200009159744, 0.41364620000240393], elapse=2.6920427000150084, viser=<rapidocr.utils.vis_res.VisRes object at 0x000001D84CB38690>)
检查boxes txts scores 情况如下
boxes = ori_ocr_res.boxes
txts = ori_ocr_res.txts
scores = ori_ocr_res.scores
print(len(boxes),len(txts),len(scores))
print(boxes,txts,scores)
2 2 2
[[[ 115. 71.]
[ 494. 71.]
[ 494. 141.]
[ 115. 141.]]
[[ 479. 70.]
[1426. 70.]
[1426. 141.]
[ 479. 141.]]] ('베이징차오양', '디지털기술로농업새로운발전이끌어') (0.99507, 0.99916)
- 主要言語
- Python
- スター
- 440
- フォーク
- 40
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
RapidAI/RapidTable のほかの issue
-
Feature Requestオープン
難易度 5/5 1週間以上 初心者へのやさしさ 15/100
RapidAI/RapidTable#143 · コメント 1 件 ·
-
支持SLANetXtオープン
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
RapidAI/RapidTable#104 · コメント 2 件 ·
-
关于C++ Onnxruntime的推理オープン
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
RapidAI/RapidTable#56 · コメント 3 件 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 20/100
RapidAI/RapidTable#47 · コメント 12 件 · リアクション 3 件 ·
RapidAI/RapidTable の issue をすべて見る
似ている issue
-
docs(contributing): the two things that silently block a PR対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープンavailable documentation good first issue
難易度 1/5 1〜3時間 初心者へのやさしさ 95/100
Nixitov/Riptide-Native#944 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
JTHCode/secretguard#24 ·
メンテナーはふだん 1 日以内に返信
-
area: middleware documentation good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
-
enhancement good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
メンテナーはふだん 1 日以内に返信
-
good first issue
難易度 1/5 1時間未満 初心者へのやさしさ 95/100
omarelshamy25x/shamy-hijri#63 ·
メンテナーはふだん 1 日以内に返信