[2024/01/03 18:21:39] ppocr WARNING: When args.layout is false, args.ocr is automatically set to false
Traceback (most recent call last):
File "PPOCRLabel.py", line 2842, in
sys.exit(main())
File "PPOCRLabel.py", line 2830, in main
app, _win = get_main_app(sys.argv)
File "PPOCRLabel.py", line 2820, in get_main_app
win = MainWindow(lang=args.lang,
File "PPOCRLabel.py", line 114, in init
result = self.table_ocr('./data/paddle.png', return_ocr_result_in_table=True)
File "D:\Program Files\anaconda3\envs\paddle_env\lib\site-packages\paddleocr\paddleocr.py", line 759, in call
res, _ = super().call(
File "D:\workspace\Python\PaddleOCR-release-2.7\PPOCRLabel..\ppstructure\predict_system.py", line 129, in call
res, table_time_dict = self.table_system(
File "D:\workspace\Python\PaddleOCR-release-2.7\PPOCRLabel..\ppstructure\table\predict_table.py", line 86, in call
structure_res, elapse = self._structure(copy.deepcopy(img))
File "D:\workspace\Python\PaddleOCR-release-2.7\PPOCRLabel..\ppstructure\table\predict_table.py", line 109, in structure
structure_res, elapse = self.table_structurer(copy.deepcopy(img))
File "D:\workspace\Python\PaddleOCR-release-2.7\PPOCRLabel..\ppstructure\table\predict_structure.py", line 120, in call
data = transform(data, self.preprocess_op)
File "D:\workspace\Python\PaddleOCR-release-2.7\PPOCRLabel..\ppocr\data\imaug_init.py", line 56, in transform
data = op(data)
File "D:\workspace\Python\PaddleOCR-release-2.7\PPOCRLabel..\ppocr\data\imaug\operators.py", line 92, in call
data['image'] = (img.astype('float32') * self.scale - self.mean) / self.std
ValueError: operands could not be broadcast together with shapes (213,488,4) (1,1,3)
試試修改源代碼
if os.path.exists('./data/paddle.png'):
result = self.table_ocr('./data/paddle.png', return_ocr_result_in_table=True)
為
if os.path.exists('./data/paddle.png'):
result = self.ocr.ocr('./data/paddle.png', cls=True, det=True)
或是直接拿掉
試試修改源代碼
if os.path.exists('./data/paddle.png'):
result = self.table_ocr('./data/paddle.png', return_ocr_result_in_table=True)
為
if os.path.exists('./data/paddle.png'):
result = self.ocr.ocr('./data/paddle.png', cls=True, det=True)
或是直接拿掉
你是对的,不过我的版本是paddle2.6,他的这里有两行代码,只需要把第二行注释掉就可以了。
if os.path.exists('./data/paddle.png'):
try:
result = self.ocr.ocr('./data/paddle.png', cls=True, det=True)
except:
result = self.table_ocr('./data/paddle.png', return_ocr_result_in_table=True)