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

'str' object has no attribute 'decode' #48

Open
hasantha-nirmal opened this issue Apr 23, 2021 · 3 comments
Open

'str' object has no attribute 'decode' #48

hasantha-nirmal opened this issue Apr 23, 2021 · 3 comments

Comments

@hasantha-nirmal
Copy link

Dear Sir,

I'm having this issue when I tried to run the pretrained weights or my owned trained weights.

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

Is the error I finally getting. Your advice would be much appreciated.
Thanks

Loading pre-trained weights in svhn/weights.h5
Traceback (most recent call last):
File "train.py", line 62, in
yolo.load_weights(config['pretrained']['full'], by_name=True)
File "/home/hasantha/Documents/Yolo-digit-detector-master/yolo/frontend.py", line 71, in load_weights
self._yolo_network.load_weights(weight_path, by_name=by_name)
File "/home/hasantha/Documents/Yolo-digit-detector-master/yolo/backend/network.py", line 58, in load_weights
self._model.load_weights(weight_path, by_name=by_name)
File "/home/hasantha/anaconda3/envs/yolo/lib/python3.6/site-packages/keras/engine/topology.py", line 2620, in load_weights
load_weights_from_hdf5_group_by_name(f, self.layers)
File "/home/hasantha/anaconda3/envs/yolo/lib/python3.6/site-packages/keras/engine/topology.py", line 3161, in load_weights_from_hdf5_group_by_name
original_keras_version = f.attrs['keras_version'].decode('utf8')
AttributeError: 'str' object has no attribute 'decode'

@btemel
Copy link

btemel commented May 1, 2021

I dropped the decode('utf-8') part but that gave me another bug.
You can see the link that has solution: https://stackoverflow.com/questions/28583565/str-object-has-no-attribute-decode-python-3-error

Now I am getting ValueError: Cannot feed value of shape (30, 2048, 1, 1) for Tensor 'Placeholder_318:0', which has shape '(1, 1, 2048, 75)'
Thanks

@hasantha-nirmal
Copy link
Author

Thanks for the help. Yes I have tried that too. But it gives that error code as you mentioned . But I think this will help for some extent.

https://www.kaggle.com/tustunkok/license-plate-detection

This repository describes a similar approach for localizing objects from regular cnn. ( I couldn't achieve this btw, hope you could figure this easily)

@Edvard88
Copy link

I've solved it, thanks to
keras-team/keras#14265 (comment)

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

3 participants