TypeError: 'float' object is not subscriptable #12722
Replies: 2 comments
-
Tried the code below: Package Version code: from PIL import Image giving the error: |
Beta Was this translation helpful? Give feedback.
-
Since PPOCRLabel has moved, please go to PPOCRLabel to ask questions if you have any questions! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
请提供下述完整信息以便快速定位问题/Please provide the following information to quickly locate the problem
PS C:\Users\HEDY\Desktop\PaddleOCR-release-2.7\PPOCRLabel> python .\PPOCRLabel.py --lang ch
D:\Anaconda\Lib\site-packages\paramiko\transport.py:219: CryptographyDeprecationWarning: Blowfish has been deprecated
"class": algorithms.Blowfish,
[2023/11/03 15:13:06] ppocr WARNING: When args.layout is false, args.ocr is automatically set to false
file name in openNext is C:\Users\HEDY\Desktop\label\1.png
DirPath in importDirImages is C:/Users/HEDY/Desktop/label
unicodeFilePath is C:\Users\HEDY\Desktop\label\1.png
Using model from paddle
'float' object is not subscriptable
Traceback (most recent call last):
File "C:\Users\HEDY\Desktop\PaddleOCR-release-2.7\PPOCRLabel\libs\autoDialog.py", line 66, in run
self.mainThread.saveFile(mode='Auto')
File "C:\Users\HEDY\Desktop\PaddleOCR-release-2.7\PPOCRLabel\PPOCRLabel.py", line 1894, in saveFile
self._saveFile(imgidx, mode=mode)
File "C:\Users\HEDY\Desktop\PaddleOCR-release-2.7\PPOCRLabel\PPOCRLabel.py", line 1945, in _saveFile
if annotationFilePath and self.saveLabels(annotationFilePath, mode=mode):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\HEDY\Desktop\PaddleOCR-release-2.7\PPOCRLabel\PPOCRLabel.py", line 1230, in saveLabels
trans_dic = {"label": box[1][0], "points": box[0], "difficult": False}
~~~~~~^^^
TypeError: 'float' object is not subscriptable
sourcecode:
for box in self.result_dic:
trans_dic = {"label": box[1][0], "points": box[0], "difficult": False} //*********
if self.kie_mode:
if len(box) == 3:
trans_dic.update({"key_cls": box[2]})
else:
trans_dic.update({"key_cls": "None"})
if trans_dic["label"] == "" and mode == 'Auto':
continue
shapes.append(trans_dic)
Beta Was this translation helpful? Give feedback.
All reactions