UnicodeDecodeError
I'm using Python 3.5 on Windows 10 64bit
I get the error when running
python ./yad2k.py yolo.cfg yolo.weights model_data/yolo.h5
This is the error I get
Traceback (most recent call last):
File "./yad2k.py", line 270, in <module>
_main(parser.parse_args())
File "./yad2k.py", line 254, in _main
model.save('{}'.format(output_path))
File "C:\Users\DanMo\Anaconda3\envs\py35cv3\lib\site-packages\keras\engine\topology.py", line 2506, in save
save_model(self, filepath, overwrite, include_optimizer)
File "C:\Users\DanMo\Anaconda3\envs\py35cv3\lib\site-packages\keras\models.py", line 106, in save_model
'config': model.get_config()
File "C:\Users\DanMo\Anaconda3\envs\py35cv3\lib\site-packages\keras\engine\topology.py", line 2322, in get_config
layer_config = layer.get_config()
File "C:\Users\DanMo\Anaconda3\envs\py35cv3\lib\site-packages\keras\layers\core.py", line 661, in get_config
function = func_dump(self.function)
File "C:\Users\DanMo\Anaconda3\envs\py35cv3\lib\site-packages\keras\utils\generic_utils.py", line 176, in func_dump
code = marshal.dumps(func.__code__).decode('raw_unicode_escape')
UnicodeDecodeError: 'rawunicodeescape' codec can't decode bytes in position 195-196: truncated \uXXXX
I have also use python 3.5 64bit on windows 10 64 bit, everything works well.
same problem
You probably have the in a folder where the path contains "\u" e.g. all user paths like "C:\Users<your username>" do this process outside of such a folder.
@DanMossa , Hey I have also run into the same error. I tried a pathway which doesn't have \u, But I am still running into the same error. Were you able to solve it?
@ManjeeraJagiri No =/ I just gave up with this tbh
My environment is win10 64bit, python3.5, Anaconda and win7 64bit. C:\Users\XXX\Anaconda3\Lib\site-packages\keras\utils\generic_utils.py
175 #code = marshal.dumps(func.__code__).decode('raw_unicode_escape')#Comment out
176 code = marshal.dumps(func.__code__).replace(b'\\',b'/').decode('raw_unicode_escape')#Add
I solved it with this.
- remove the yad2k document from "C://user//
", - put it in "C://root" location. And run
- cd yad2k
- python yad2k.py yolo.cfg yolo.weights model_data/yolo.h5 it works ! you can try
@Bingohong your suggestion is work,thank you.
@Bingohong Thanks for suggestion, it provides me gr8 help