labelme icon indicating copy to clipboard operation
labelme copied to clipboard

Invalid base64-encoded string: number of data characters (158533) cannot be 1 more than a multiple of 4

Open enamulrafti opened this issue 2 years ago • 0 comments

Discussed in https://github.com/wkentaro/labelme/discussions/1274

Originally posted by enamulrafti May 8, 2023

While executing labelme2coco.py I am facing the issue. The issue is:

_Traceback (most recent call last): File "C:\Users\User\anaconda3\lib\site-packages\labelme\label_file.py", line 108, in load imageData = base64.b64decode(data["imageData"]) File "C:\Users\User\anaconda3\lib\base64.py", line 87, in b64decode return binascii.a2b_base64(s) binascii.Error: Invalid base64-encoded string: number of data characters (158533) cannot be 1 more than a multiple of 4

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "F:\iar\prepocessing-codes\labelme2coco.py", line 222, in main() File "F:\iar\prepocessing-codes\labelme2coco.py", line 107, in main label_file = labelme.LabelFile(filename=filename) File "C:\Users\User\anaconda3\lib\site-packages\labelme\label_file.py", line 44, in init self.load(filename) File "C:\Users\User\anaconda3\lib\site-packages\labelme\label_file.py", line 138, in load raise LabelFileError(e) labelme.label_file.LabelFileError: Invalid base64-encoded string: number of data characters (158533) cannot be 1 more than a multiple of 4_

and i have checked line no 108 in labelme.py which shows:

imageData = base64.b64decode(data["imageData"])

which i have tried to replace with this line:

imageData = base64.b64decode(data["imageData"] + '==')

which show this error:

Traceback (most recent call last): File "C:\Users\User\anaconda3\lib\site-packages\labelme\label_file.py", line 109, in load imageData = base64.b64decode(data["imageData"] + '==') File "C:\Users\User\anaconda3\lib\base64.py", line 87, in b64decode return binascii.a2b_base64(s) binascii.Error: Invalid base64-encoded string: number of data characters (678697) cannot be 1 more than a multiple of 4

Help me! thanks in advance.

enamulrafti avatar May 08 '23 16:05 enamulrafti