IndexError: list index out of range

See original GitHub issue

pip install paddleocr==1.1.1

IndexError: list index out of range , IndexError: index 33 is out of bounds for axis 0 with size 33

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 2447, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 1952, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 1821, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/local/lib/python3.6/dist-packages/flask/_compat.py", line 39, in reraise
    raise value
  File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 1950, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 1936, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/home/app.py", line 56, in paddle
    result = chineseOCREngine.ocr(image, cls=False)
  File "/usr/local/lib/python3.6/dist-packages/paddleocr/paddleocr.py", line 242, in ocr
    dt_boxes, rec_res = self.__call__(img)
  File "/usr/local/lib/python3.6/dist-packages/paddleocr/tools/infer/predict_system.py", line 105, in __call__
    rec_res, elapse = self.text_recognizer(img_crop_list)
  File "/usr/local/lib/python3.6/dist-packages/paddleocr/tools/infer/predict_rec.py", line 254, in __call__
    end = predict_lod[rno + 1]
IndexError: list index out of range
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 2447, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 1952, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 1821, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/local/lib/python3.6/dist-packages/flask/_compat.py", line 39, in reraise
    raise value
  File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 1950, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 1936, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/home/app.py", line 56, in paddle
    result = chineseOCREngine.ocr(image, cls=False)
  File "/usr/local/lib/python3.6/dist-packages/paddleocr/paddleocr.py", line 242, in ocr
    dt_boxes, rec_res = self.__call__(img)
  File "/usr/local/lib/python3.6/dist-packages/paddleocr/tools/infer/predict_system.py", line 105, in __call__
    rec_res, elapse = self.text_recognizer(img_crop_list)
  File "/usr/local/lib/python3.6/dist-packages/paddleocr/tools/infer/predict_rec.py", line 263, in __call__
    rec_res[indices[beg_img_no + rno]] = [preds_text, score]
IndexError: index 33 is out of bounds for axis 0 with size 33

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
LDOUBLEVcommented, Jul 6, 2021

问题已经修复了,请尝试最新代码,如果还有问题,可开新的issue

0reactions
yimtcodecommented, Sep 29, 2022

paddleocr==2.6.0.1

Traceback (most recent call last):

  File "/usr/local/lib/python3.10/threading.py", line 973, in _bootstrap
    self._bootstrap_inner()
    │    └ <function Thread._bootstrap_inner at 0x7f24064d9120>
    └ <Thread(Thread-57191 (handle_recv_error), started 139787040163584)>
  File "/usr/local/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
    self.run()
    │    └ <function Thread.run at 0x7f24064d8e50>
    └ <Thread(Thread-57191 (handle_recv_error), started 139787040163584)>
  File "/usr/local/lib/python3.10/threading.py", line 953, in run
    self._target(*self._args, **self._kwargs)
    │    │        │    │        │    └ {}
    │    │        │    │        └ <Thread(Thread-57191 (handle_recv_error), started 139787040163584)>
    │    │        │    └ (<function image_ocr at 0x7f2349df8310>, <socks.socksocket fd=24, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, ...
    │    │        └ <Thread(Thread-57191 (handle_recv_error), started 139787040163584)>
    │    └ <function handle_recv_error at 0x7f2349df83a0>
    └ <Thread(Thread-57191 (handle_recv_error), started 139787040163584)>

> File "/home/yimt/Code/paddle/v0.1.2/lib/server/server.py", line 48, in handle_recv_error
    f(s, pack_data)
    │ │  └ b'xV4\x12!Ce\x87\x02\x04\x00\x00C5\x00\x00\x04\xc9\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x00\x00\x0...
    │ └ <socks.socksocket fd=24, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('192.168.2.11', 56196), r...
    └ <function image_ocr at 0x7f2349df8310>

  File "/home/yimt/Code/paddle/v0.1.2/lib/pack/recv.py", line 153, in image_ocr
    results = ocr.ocr(filename, cls=False)
              │   │   └ 'images/XBOX/[NBA2K23]/04010902/116996_2022-09-29_04-12-54.bmp'
              │   └ <function PaddleOCR.ocr at 0x7f234a8e08b0>
              └ <paddleocr.paddleocr.PaddleOCR object at 0x7f23707a38e0>

  File "/home/yimt/.local/lib/python3.10/site-packages/paddleocr/paddleocr.py", line 524, in ocr
    dt_boxes, rec_res, _ = self.__call__(img, cls)
                           │    │        │    └ False
                           │    │        └ array([[[  3, 197, 255],
                           │    │                  [  3, 197, 255],
                           │    │                  [  3, 197, 255],
                           │    │                  ...,
                           │    │                  [  1, 197, 255],
                           │    │                  [  1...
                           │    └ <function TextSystem.__call__ at 0x7f234a8c0310>
                           └ <paddleocr.paddleocr.PaddleOCR object at 0x7f23707a38e0>
  File "/home/yimt/.local/lib/python3.10/site-packages/paddleocr/tools/infer/predict_system.py", line 92, in __call__
    rec_res, elapse = self.text_recognizer(img_crop_list)
                      │    │               └ [array([[[  1, 197, 255],
                      │    │                         [  3, 198, 253],
                      │    │                         [  3, 198, 254],
                      │    │                         ...,
                      │    │                         [  0, 197, 255],
                      │    │                         [  ...
                      │    └ <tools.infer.predict_rec.TextRecognizer object at 0x7f234a4cffa0>
                      └ <paddleocr.paddleocr.PaddleOCR object at 0x7f23707a38e0>
  File "/home/yimt/.local/lib/python3.10/site-packages/paddleocr/tools/infer/predict_rec.py", line 534, in __call__
    rec_res[indices[beg_img_no + rno]] = rec_result[rno]
    │       │       │            │       │          └ 1
    │       │       │            │       └ [('G', 0.19825498759746552), ('250', 0.9807359576225281)]
    │       │       │            └ 1
    │       │       └ 0
    │       └ array([0])
    └ [('G', 0.19825498759746552)]

IndexError: index 1 is out of bounds for axis 0 with size 1

Help me!

Read more comments on GitHub >

github_iconTop Results From Across the Web

List Index Out of Range – Python Error Message Solved
You'll get the Indexerror: list index out of range error when iterating through a list and trying to access an item that doesn't...
Read more >
Indexerror: list Index Out of Range in Python - STechies
In python “list index out of range” error occurs when we try to access an undefined element from the list. List index out...
Read more >
Index Error: list index out of range (Python) - Stack Overflow
Generally it means that you are providing an index for which a list element does not exist. E.g, if your list was [1,...
Read more >
Python IndexError: List Index Out of Range [Easy Fix] - Finxter
The error “list index out of range” arises if you access invalid indices in your ...
Read more >
How to debug list index out of range error in python? - Flexiple
To foolproof your loop of such instances, the range() function along with len() would return the length of the list dynamically. Subsequently ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found