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

AttributeError: 'str' object has no attribute 'decode' #39

Closed
ZihuaEvan opened this issue Jul 15, 2021 · 2 comments
Closed

AttributeError: 'str' object has no attribute 'decode' #39

ZihuaEvan opened this issue Jul 15, 2021 · 2 comments

Comments

@ZihuaEvan
Copy link

Hi tengda,

When I called lmdb_dataset.py in main_classifier.py , I got the following error:

Frame Dataset from "/root/coclr/dataset/../process_data/data/ucf101" has #class 101
Traceback (most recent call last):
File "main_classifier.py", line 818, in
main(args)
File "main_classifier.py", line 200, in main
test_retrieval(model, ce_loss, transform_test_cuda, device, epoch, args)
File "main_classifier.py", line 574, in test_retrieval
train_dataset = d_class(mode='train',
File "/root/coclr/eval/../dataset/lmdb_dataset.py", line 174, in init
super(UCF101LMDB, self).init(**kwargs)
File "/root/coclr/eval/../dataset/lmdb_dataset.py", line 96, in init
self.get_video_id = dict(zip([i.decode() for i in self.db_order],
File "/root/coclr/eval/../dataset/lmdb_dataset.py", line 96, in
self.get_video_id = dict(zip([i.decode() for i in self.db_order],
AttributeError: 'str' object has no attribute 'decode'

Thank you for your reply.

@TengdaHan
Copy link
Owner

It looks like msgpack version issue.
Have you tried this note: https://github.com/TengdaHan/CoCLR#dataset
or #32 ?
Basically, the new version of msgpack package has different default settings when loading data. Loading everything as 'raw=True' can revert back to earlier settings.

@ZihuaEvan
Copy link
Author

The problem has been solved. Thanks for your answering!
BTW: The numpy version may cause error in line122 in lmdb_dataset.py:
seq_idx = seq_idx.flatten(0)
And change it to: seq_idx = seq_idx.flatten() will be fine.

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

2 participants