TypeError: The values of index must be integers #2
-
我运行了作者提供的examle中无表格线示例,但报错,我查看我的输入没有问题,是一张表格图片 # -*- encoding: utf-8 -*-
# @Author: SWHL
# @Contact: [email protected]
from pathlib import Path
from lineless_table_rec import LinelessTableRecognition
engine = LinelessTableRecognition()
img_path = "../test11.jpg"
table_str, elapse = engine(img_path)
print(table_str)
print(elapse)
with open(f"{Path(img_path).stem}.html", "w", encoding="utf-8") as f:
f.write(table_str)
print("ok") 报错: WARNING:root:Traceback (most recent call last):
File "D:\anaconda\envs\paddleocr\lib\site-packages\lineless_table_rec\main.py", line 54, in __call__
polygons, slct_logi = self.infer(input_info)
File "D:\anaconda\envs\paddleocr\lib\site-packages\lineless_table_rec\main.py", line 105, in infer
slct_logi_feat, slct_dets_feat, slct_output_dets = self.det_process(
File "D:\anaconda\envs\paddleocr\lib\site-packages\lineless_table_rec\lineless_table_process.py", line 26, in __call__
dets, keep, logi, cr = ctdet_4ps_decode(
File "D:\anaconda\envs\paddleocr\lib\site-packages\lineless_table_rec\lineless_table_process.py", line 107, in ctdet_4ps_decode
scores, inds, clses, ys, xs = _topk(heat, K=K)
File "D:\anaconda\envs\paddleocr\lib\site-packages\lineless_table_rec\lineless_table_process.py", line 206, in _topk
topk_inds = _gather_feat(topk_inds.reshape(batch, -1, 1), topk_ind).reshape(
File "D:\anaconda\envs\paddleocr\lib\site-packages\lineless_table_rec\lineless_table_process.py", line 251, in _gather_feat
feat = _gather(feat, 1, ind)
File "D:\anaconda\envs\paddleocr\lib\site-packages\lineless_table_rec\lineless_table_process.py", line 277, in _gather
raise TypeError("The values of index must be integers")
TypeError: The values of index must be integers
Traceback (most recent call last):
File "D:\工作\checkreport_table\testcode\lineless.py", line 13, in <module>
print(table_str)
KeyboardInterrupt
Process finished with exit code -1073741510 (0xC000013A: interrupted by Ctrl+C) 请问是什么原因导致的呢 |
Beta Was this translation helpful? Give feedback.
Replies: 17 comments 23 replies
-
解决了吗?也遇到了这个错误 \wired_table_rec>python test.py |
Beta Was this translation helpful? Give feedback.
-
请尝试用tests目录下的表格图像试试,查看是否报同样的错误? 如果不报错误,说明是提供图像的问题,请方便的话,提供测试的图,便于我这里复现。 |
Beta Was this translation helpful? Give feedback.
-
所有图片都是这个报错 |
Beta Was this translation helpful? Give feedback.
-
系统是win10 |
Beta Was this translation helpful? Give feedback.
-
我这里测试的这张图,并没有报这个错误。 测试代码: from pathlib import Path
from wired_table_rec import WiredTableRecognition
table_rec = WiredTableRecognition()
img_path = "tests/test_files/wired/row_span.png"
table_str, elapse = table_rec(img_path)
print(table_str)
print(elapse)
with open(f"{Path(img_path).stem}.html", "w", encoding="utf-8") as f:
f.write(table_str) 输出结果:
如果想要我这里帮助排查问题,请给出详细运行代码、运行环境、python版本、所用图像。 |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
起码要让我这里能复现报错,才能知道是什么问题。 你这总是说报错报错,我也表示无能为力。 |
Beta Was this translation helpful? Give feedback.
-
代码就是你上面的,图片也是你代码里的,所有图片都是同样的报错,python3.8.8 TypeError: The values of index must be integers |
Beta Was this translation helpful? Give feedback.
-
尝试python3.10 试试,如果也不行的话,那就不是我这里问题了。 |
Beta Was this translation helpful? Give feedback.
-
用colab运行没有报错 |
Beta Was this translation helpful? Give feedback.
-
都报错 用样例的图片 3.7.6 3.10.10都一样
E TypeError: The values of index must be integers E:\xx\site-packages\wired_table_rec-0.0.2-py3.10.egg\wired_table_rec\utils_table_line_rec.py:160: TypeError |
Beta Was this translation helpful? Give feedback.
-
[RapidAI/RapidStructure] RapidLayout+RapidTable整合demo (PR #11)
…---Original---
From: ***@***.***>
Date: Tue, Dec 12, 2023 19:02 PM
To: ***@***.***>;
Cc: ***@***.******@***.***>;
Subject: Re: [RapidAI/TableStructureRec] TypeError: The values of index mustbe integers (Discussion #2)
有没有表格区域检测onnx模型?怎么使用?
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you commented.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Python 3.10.10 WIN10 |
Beta Was this translation helpful? Give feedback.
-
aistudio上可以运行 但速度有点慢 要32秒
|
Beta Was this translation helpful? Give feedback.
-
有没有完整前处理python代码?类似这些处理 https://medium.com/@Gekko_lab/make-your-ocr-results-more-accurate-part-ii-preprocessing-3d212ae16191 |
Beta Was this translation helpful? Give feedback.
-
E:\OCR\TableStructureRec\wired_table_rec\utils_table_line_rec.py if index.dtype != np.dtype("int_"):
python demo_wired.py
|
Beta Was this translation helpful? Give feedback.
如果可以翻墙的话,建议去Google Colab上试试,上边有小伙伴已经反映Colab上没有问题了
如果不能翻墙,建议去百度的AI Studio上试试,我在AI Studio上建了一个测试项目表格识别测试
有些怀疑是Windows平台的原因。
如果你那里在linux上测试没有问题的话,方便给我提供一下,你出错的运行环境文件
requirements.txt
,我这里排查一下原因。