Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

IndexError: list index out of range #11952

Closed
zhang19523zhao opened this issue Apr 17, 2024 · 2 comments
Closed

IndexError: list index out of range #11952

zhang19523zhao opened this issue Apr 17, 2024 · 2 comments
Assignees

Comments

@zhang19523zhao
Copy link

zhang19523zhao commented Apr 17, 2024

请提供下述完整信息以便快速定位问题/Please provide the following information to quickly locate the problem

  • 系统环境/System Environment:docker 运行
  • 版本号/Version:Paddle: PaddleOCR: 问题相关组件/Related components:
    params.py 配置
$: cat deploy/hubserving/structure_system/params.py
# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

from deploy.hubserving.structure_table.params import read_params as table_read_params


def read_params():
    cfg = table_read_params()

    # params for layout parser model
    cfg.layout_model_dir = './inference/picodet_lcnet_x1_0_fgd_layout_cdla_infer/'
    cfg.layout_dict_path = './ppocr/utils/dict/layout_publaynet_dict.txt'
    cfg.layout_score_threshold = 0.5
    cfg.layout_nms_threshold = 0.5

    #params for text classifier
    cfg.use_angle_cls = True
    cfg.cls_model_dir = "./inference/ch_ppocr_mobile_v2.0_cls_infer/"
    cfg.cls_image_shape = "3, 48, 192"
    cfg.label_list = ['0', '180']
    cfg.cls_batch_num = 30
    cfg.cls_thresh = 0.9

    cfg.use_pdserving = False
    cfg.use_tensorrt = False
    cfg.drop_score = 0.5

    # my
    cfg.det_algorithm = "DB"
    cfg.det_model_dir = "./inference/ch_PP-OCRv4_det_server_infer/"
    cfg.det_limit_side_len = 960
    cfg.det_limit_type = 'max'

    cfg.rec_algorithm = "CRNN"
    cfg.rec_model_dir = "./inference/ch_PP-OCRv4_rec_server_infer/"

    cfg.rec_image_shape = "3, 48, 320"
    cfg.rec_batch_num = 6
    cfg.max_text_length = 25

    cfg.rec_char_dict_path = "./ppocr/utils/ppocr_keys_v1.txt"
    cfg.use_space_char = True

    cfg.use_pdserving = False
    cfg.use_tensorrt = False

    
    # talbe 
    cfg.table_max_len = 488
    cfg.table_model_dir = './inference/ch_ppstructure_mobile_v2.0_SLANet_infer/'
    cfg.table_char_dict_path = './ppocr/utils/dict/table_structure_dict.txt'
    cfg.show_log = False


    cfg.mode = 'structure'
    cfg.output = './output'
    return cfg
###############33
pip3 list
Package               Version
--------------------- ---------------
aiofiles              23.1.0
aiohttp               3.8.4
aiosignal             1.3.1
altair                5.0.1
anyio                 3.6.2
aspy.yaml             1.3.0
astor                 0.8.1
astroid               2.11.4
async-timeout         4.0.2
asynctest             0.13.0
attrdict              2.0.1
attrs                 21.4.0
Babel                 2.12.1
bce-python-sdk        0.8.83
cached-property       1.5.2
cachetools            5.3.0
certifi               2021.10.8
cfgv                  3.3.1
charset-normalizer    2.0.12
click                 8.1.3
colorama              0.4.6
colorlog              6.7.0
cssselect             1.2.0
cssutils              2.6.0
cycler                0.11.0
Cython                0.29.35
datasets              2.12.0
decorator             5.1.1
dill                  0.3.4
distlib               0.3.4
easydict              1.10
entrypoints           0.4
et-xmlfile            1.1.0
fastapi               0.95.1
ffmpy                 0.3.0
filelock              3.6.0
Flask                 2.2.5
Flask-Babel           2.0.0
fonttools             4.38.0
frozenlist            1.3.3
fsspec                2023.1.0
future                0.18.3
gradio                3.33.1
gradio_client         0.2.5
gunicorn              20.1.0
h11                   0.14.0
httpcore              0.17.0
httpx                 0.24.1
huggingface-hub       0.15.1
identify              2.5.0
idna                  3.3
imageio               2.30.0
imgaug                0.4.0
importlib-metadata    4.11.3
importlib-resources   5.12.0
iniconfig             1.1.1
ipykernel             4.6.0
ipython               5.3.0
isort                 5.10.1
itsdangerous          2.1.2
jieba                 0.42.1
Jinja2                3.1.2
joblib                1.2.0
jsonschema            4.17.3
jupyter-client        7.3.0
jupyter-core          4.10.0
kiwisolver            1.4.4
lanms-neo             1.0.2
lazy-object-proxy     1.7.1
linkify-it-py         2.0.2
lmdb                  1.4.1
lxml                  4.9.2
markdown-it-py        2.2.0
MarkupSafe            2.1.2
matplotlib            3.5.3
mccabe                0.7.0
mdit-py-plugins       0.3.3
mdurl                 0.1.1
multidict             6.0.4
multiprocess          0.70.12.2
nest-asyncio          1.5.5
networkx              2.6.3
nodeenv               1.6.0
numpy                 1.21.6
opencv-contrib-python 4.6.0.66
opencv-python         4.6.0.66
openpyxl              3.1.2
opt-einsum            3.3.0
orjson                3.9.0
packaging             21.3
paddle-bfloat         0.1.2
paddle2onnx           1.0.6
paddlefsl             1.1.0
paddlehub             2.3.1
paddlenlp             2.5.2
paddlepaddle-gpu      2.3.0.post112
pandas                1.3.5
pexpect               4.8.0
pickleshare           0.7.5
Pillow                9.1.0
pip                   23.1.2
pkgutil_resolve_name  1.3.10
platformdirs          2.5.2
pluggy                1.0.0
Polygon3              3.0.9.1
pre-commit            1.10.4
premailer             3.10.0
prompt-toolkit        1.0.18
protobuf              3.20.1
ptyprocess            0.7.0
py                    1.11.0
pyarrow               12.0.0
pyclipper             1.3.0.post4
pycryptodome          3.17
pydantic              1.10.8
pydub                 0.25.1
Pygments              2.15.1
PyGObject             3.26.1
pylint                2.13.8
PyMuPDF               1.20.2
pyparsing             3.0.8
pyrsistent            0.19.3
pytest                7.1.2
python-apt            1.6.5+ubuntu0.7
python-dateutil       2.8.2
python-multipart      0.0.6
pytz                  2023.3
PyWavelets            1.4.0
PyYAML                6.0
pyzmq                 22.3.0
rapidfuzz             3.0.0
rarfile               4.0
requests              2.27.1
responses             0.18.0
rich                  13.4.1
scikit-image          0.19.3
scikit-learn          1.0.2
scipy                 1.7.3
semantic-version      2.10.0
sentencepiece         0.1.99
seqeval               1.2.2
setuptools            50.3.2
shapely               2.0.1
simplegeneric         0.8.1
six                   1.16.0
sniffio               1.3.0
starlette             0.26.1
threadpoolctl         3.1.0
tifffile              2021.11.2
toml                  0.10.2
tomli                 2.0.1
toolz                 0.12.0
tornado               6.1
tqdm                  4.65.0
traitlets             5.1.1
typed-ast             1.5.3
typer                 0.9.0
typing_extensions     4.2.0
uc-micro-py           1.0.2
unattended-upgrades   0.1
urllib3               1.26.9
uvicorn               0.22.0
virtualenv            20.14.1
visualdl              2.4.2
wcwidth               0.2.5
websockets            11.0.3
Werkzeug              2.2.3
wheel                 0.37.1
wrapt                 1.14.1
xxhash                3.2.0
yarl                  1.9.2
zipp                  3.8.0
  • 运行指令/Command Code:python deploy/hubserving/structure_system/module.py
  • 完整报错/Complete Error Message:
grep: warning: GREP_OPTIONS is deprecated; please use an alias or script
Traceback (most recent call last):
  File "deploy/hubserving/structure_system/module.py", line 148, in <module>
    res = structure_system.predict(paths=image_path)
  File "/usr/local/lib/python3.7/dist-packages/paddlehub/compat/paddle_utils.py", line 221, in runner
    return func(*args, **kwargs)
  File "deploy/hubserving/structure_system/module.py", line 122, in predict
    res, _ = self.table_sys(img)
  File "./ppstructure/predict_system.py", line 112, in __call__
    layout_res, elapse = self.layout_predictor(img)
  File "./ppstructure/layout/predict_layout.py", line 100, in __call__
    post_preds = self.postprocess_op(ori_im, img, preds)
  File "./ppocr/postprocess/picodet_postprocess.py", line 247, in __call__
    label = self.labels[clsid]
IndexError: list index out of range
@Double97828
Copy link

是不是dict不对

@UserWangZz
Copy link
Collaborator

可以提供一下具体使用的config文件内容吗

@PaddlePaddle PaddlePaddle locked and limited conversation to collaborators Jun 11, 2024
@SWHL SWHL converted this issue into discussion #13011 Jun 11, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants