Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

表格识别算法ch_ppstructure_openatom_SLANetv2_infer报错 #14199

Open
Wangqi12138 opened this issue Nov 11, 2024 · 3 comments
Open

表格识别算法ch_ppstructure_openatom_SLANetv2_infer报错 #14199

Wangqi12138 opened this issue Nov 11, 2024 · 3 comments

Comments

@Wangqi12138
Copy link

Wangqi12138 commented Nov 11, 2024

🐛 Bug (问题描述)

使用PPStructure表格识别ch_ppstructure_openatom_SLANetv2_infer算法,输出都是空白,是什么原因?PPOCRv4版本
1731325967110

🏃‍♂️ Environment (运行环境)

python 3.10
paddlepaddle 2.6.1
paddleocr 2.7.2

🌰 Minimal Reproducible Example (最小可复现问题的Demo)

models_dir = "/data/models/paddle_ocr/"
rec_model_dir = models_dir + "ch_PP-OCRv4_rec_infer"
det_model_dir = models_dir + "ch_PP-OCRv4_det_infer"
table_model_dir = models_dir + "ch_ppstructure_openatom_SLANetv2_infer"
layout_model_dir = models_dir + "picodet_lcnet_x1_0_fgd_layout_table_infer"

table_engine = PPStructure(show_log=False,table_model_dir = table_model_dir,layout_model_dir = layout_model_dir,det_model_dir = det_model_dir,
rec_model_dir = rec_model_dir)
image = "/data/uploaded_images/cropped_image_2200.614990234375.jpg"
img = cv2.imread(image)
result = table_engine(img)
print(result)

@GreatV
Copy link
Collaborator

GreatV commented Nov 12, 2024

试试paddleocr 2.8版本

@ViCtOr-dev13
Copy link

🐛 Bug (问题描述)

Capture d’écran 2024-11-14 à 12 49 01 Capture d’écran 2024-11-14 à 12 39 53

🏃‍♂️Environment (运行环境)

python 3.10
paddleocr 2.9.1
paddlepaddle 0.0.0 (for Mac but work fine)

🌰 Reproducible Example (最小可复现问题的Demo)

Import

from paddleocr import PPStructure,draw_structure_result,save_structure_res
import cv2
import os
import numpy as np
from PIL import Image

PPstructure

table_engine = PPStructure(type = "structure", lang="en",det_model_dir="en_ppocr_mobile_v2.0_table_det_infer",rec_model_dir="en_ppocr_mobile_v2.0_table_rec_infer") # Initialize the table structure recognition engine

show_log

table_model_dir='..../table/en_ppstructure_mobile_v2.0_SLANet_infer
table_char_dict_path='.../lib/python3.10/site-packages/paddleocr/ppocr/utils/dict/table_structure_dict.txt'
layout_model_dir='..../layout/picodet_lcnet_x1_0_fgd_layout_infer'

Code

save_folder = './output'
img_path = 'capture.png'
image = cv2.imread(img_path)
image_array = np.array(image)
result = table_engine(image)
save_structure_res(result, save_folder,os.path.basename(img_path).split('.')[0])
for line in result:
    line.pop('img')
    print(line)



font_path = 'PaddleOCR/doc/fonts/simfang.ttf' # font provieded in PaddleOCR
image = Image.open(img_path).convert('RGB')
im_show = draw_structure_result(image, result,font_path=font_path)
im_show = Image.fromarray(im_show)
im_show.save('result.jpg')

📷 capture.png

capture

@GreatV
Copy link
Collaborator

GreatV commented Nov 15, 2024

@ViCtOr-dev13, please open a new issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants