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

binascii.Error: Incorrect padding #7

Closed
cswhjiang opened this issue Sep 27, 2017 · 6 comments
Closed

binascii.Error: Incorrect padding #7

cswhjiang opened this issue Sep 27, 2017 · 6 comments

Comments

@cswhjiang
Copy link

cswhjiang commented Sep 27, 2017

Got binascii.Error: Incorrect padding when reading image 300104 from test2014/test2014_resnet101_faster_rcnn_genome.tsv.1 with tools/read_tsv.py. Anything wrong?

Traceback (most recent call last):
  File "read_tsv.py", line 64, in <module>
    read_and_save(os.path.join(in_dir, in_file), out_dir)
  File "read_tsv.py", line 45, in read_and_save
    item['features'] = np.frombuffer(base64.decodestring(item['features']), dtype=np.float32).reshape((item['num_boxes'], -1))
  File "/usr/lib64/python2.7/base64.py", line 321, in decodestring
    return binascii.a2b_base64(s)
binascii.Error: Incorrect padding
@cswhjiang
Copy link
Author

Solved. Features for image 300104, 147295, 321486 are duplicated. Just ignoring the binascii.Error will work.

@peteanderson80
Copy link
Owner

Thanks @cswhjiang for investigating this. Several tsvs were combined and there must have been a couple of duplicates.

@jamiechoi1995
Copy link

jamiechoi1995 commented Jul 29, 2019

what does ''duplicated'' mean? I view the three images, they are totally different, and why their features will be duplicated?
COCO_test2014_000000321486
COCO_test2014_000000300104
COCO_test2014_000000147295

@kangkang59812
Copy link

kangkang59812 commented Dec 17, 2019

Solved. Features for image 300104, 147295, 321486 are duplicated. Just ignoring the binascii.Error will work.

The features are duplicated between them?

@wtliao
Copy link

wtliao commented Feb 26, 2020

@jamiechoi1995 have you solved this issue? thanks

@nnakamura3
Copy link

nnakamura3 commented Aug 5, 2020

changing tools/read_tsv.py line 31
from

item[field] = np.frombuffer(base64.decodestring(item[field]), 
                      dtype=np.float32).reshape((item['num_boxes'],-1))

to

item[field] = np.frombuffer(base64.decodestring(item[field][2:-1]), 
                      dtype=np.float32).reshape((item['num_boxes'],-1))

worked for me (python3)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants