YAD2K icon indicating copy to clipboard operation
YAD2K copied to clipboard

UnicodeDecodeError

Open DanMossa opened this issue 8 years ago • 9 comments

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

DanMossa avatar Jul 21 '17 07:07 DanMossa

I have also use python 3.5 64bit on windows 10 64 bit, everything works well.

YouYouExcellent avatar Jul 24 '17 07:07 YouYouExcellent

same problem

zchky avatar Jul 25 '17 13:07 zchky

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.

tlindener avatar Sep 01 '17 18:09 tlindener

@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 avatar Sep 05 '17 05:09 ManjeeraJagiri

@ManjeeraJagiri No =/ I just gave up with this tbh

DanMossa avatar Sep 10 '17 18:09 DanMossa

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.

shirataryuji avatar Sep 23 '17 06:09 shirataryuji

  • 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 avatar Dec 13 '17 12:12 Bingohong

@Bingohong your suggestion is work,thank you.

parker0905 avatar Mar 08 '18 03:03 parker0905

@Bingohong Thanks for suggestion, it provides me gr8 help

arpit2050 avatar Aug 27 '18 06:08 arpit2050