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

seal-recognition 服务器调用异常 #2628

Open
linuxlin365 opened this issue Dec 11, 2024 · 1 comment
Open

seal-recognition 服务器调用异常 #2628

linuxlin365 opened this issue Dec 11, 2024 · 1 comment
Assignees
Labels
bug Something isn't working service deploy

Comments

@linuxlin365
Copy link

描述问题

复现

  1. 运行:paddlex --serve --pipeline seal_recognition
  2. 根据py调用示例,调用
import base64
import requests

API_URL = "http://10.26.18.66:8080/seal-recognition" # 服务URL
image_path = "test3.png"


# 对本地图像进行Base64编码
with open(image_path, "rb") as file:
    image_bytes = file.read()
    image_data = base64.b64encode(image_bytes).decode("ascii")

payload = {"image": image_data}  # Base64编码的文件内容或者图像URL

# 调用API
response = requests.post(API_URL, json=payload)

# 处理接口返回数据
assert response.status_code == 200
result = response.json()["result"]
with open(layout_image_path, "wb") as file:
    file.write(base64.b64decode(result["layoutImage"]))
print(f"Output image saved at {layout_image_path}")
print("\nDetected seal impressions:")
print(result["sealImpressions"])
  1. 服务器端报错:
{'input_path': PosixPath('/root/.paddlex/temp/tmpz6d183hq.png'), 'layout_result': {'input_path': PosixPath('/root/.paddlex/temp/tmpz6d183hq.png'), 'boxes': [{'cls_id': 2, 'label': 'seal', 'score': 0.9772647023200989, 'coordinate': [118.36611, 86.67954, 914.26227, 885.9579]}]}, 'ocr_result': {'dt_polys': [array([[578, 158],
       [582, 159],
       [733, 207],
       [739, 210],
       [746, 217],
       [827, 334],
       [830, 340],
       [855, 411],
       [857, 419],
       [860, 512],
       [859, 520],
       [821, 656],
       [818, 663],
       [812, 669],
       [806, 673],
       [800, 675],
       [795, 676],
       [772, 676],
       [765, 675],
       [760, 673],
       [689, 635],
       [683, 631],
       [679, 625],
       [676, 618],
       [675, 610],
       [676, 605],
       [703, 488],
       [653, 373],
       [568, 327],
       [514, 313],
       [458, 337],
       [405, 378],
       [359, 481],
       [357, 503],
       [409, 630],
       [411, 637],
       [410, 645],
       [408, 652],
       [404, 658],
       [399, 663],
       [392, 667],
       [387, 668],
       [263, 683],
       [256, 683],
       [249, 680],
       [242, 677],
       [236, 669],
       [184, 565],
       [182, 558],
       [175, 525],
       [175, 514],
       [196, 404],
       [197, 400],
       [235, 297],
       [240, 288],
       [316, 206],
       [322, 201],
       [328, 198],
       [504, 149],
       [511, 148],
       [515, 148]])], 'dt_scores': [0.9914360869106089], 'rec_text': ['上海科技有限公司'], 'rec_score': [0.9992580413818359], 'input_path': PosixPath('/root/.paddlex/temp/tmpz6d183hq.png')}, 'src_file_name': 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]]], dtype=uint8), 'page_id': 0}
string indices must be integers
Traceback (most recent call last):
  File "/root/PaddleX/paddlex/inference/pipelines/serving/_pipeline_apps/seal_recognition.py", line 88, in _infer
    item["dt_polys"], item["rec_text"], item["rec_score"]
TypeError: string indices must be integers
INFO:     10.26.16.57:50861 - "POST /seal-recognition HTTP/1.1" 500 Internal Server Error

环境

  1. 请提供您使用的PaddlePaddle、PaddleX版本号、Python版本号
    PaddlePaddle 3.0.0-beta1
    Python 3.10.15

  2. 请提供您使用的操作系统信息,如Linux/Windows/MacOS
    linux

  3. 请问您使用的CUDA/cuDNN的版本号是?

@linuxlin365 linuxlin365 changed the title seal-recognition 服务器部署无法使用 seal-recognition 服务器调用异常 Dec 11, 2024
@Bobholamovic
Copy link
Member

你好,这是3.0.0-beta1版本的一个bug,请使用3.0.0-beta2版本的paddlex试试~

@AmberC0209 AmberC0209 added bug Something isn't working service deploy labels Dec 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working service deploy
Projects
None yet
Development

No branches or pull requests

3 participants