Closed jiankang1991 closed 7 years ago
Copied from documentation of Numpy:
encoding : str, optional
What encoding to use when reading Python 2 strings. Only useful when loading Python 2 generated pickled files on Python 3, which includes npy/npz files containing object arrays. Values other than ‘latin1’, ‘ASCII’, and ‘bytes’ are not allowed, as they can corrupt numerical data. Default: ‘ASCII’
So I will suggest you remove the encoding
parameter for Python 3.
Thank you. I tried, but it comes out the following error:
File "<ipython-input-1-686846baf3f3>", line 1, in <module>
runfile('/home/kang/Documents/work_code_PC1/tensorflow-vgg/test_vgg16.py', wdir='/home/kang/Documents/work_code_PC1/tensorflow-vgg')
File "/usr/lib/python3/dist-packages/spyderlib/widgets/externalshell/sitecustomize.py", line 685, in runfile
execfile(filename, namespace)
File "/usr/lib/python3/dist-packages/spyderlib/widgets/externalshell/sitecustomize.py", line 85, in execfile
exec(compile(open(filename, 'rb').read(), filename, 'exec'), namespace)
File "/home/kang/Documents/work_code_PC1/tensorflow-vgg/test_vgg16.py", line 20, in <module>
vgg = vgg16.Vgg16()
File "/home/kang/Documents/work_code_PC1/tensorflow-vgg/vgg16.py", line 20, in __init__
self.data_dict = np.load(vgg16_npy_path).item()
File "/usr/lib/python3/dist-packages/numpy/lib/npyio.py", line 394, in load
return format.read_array(fid)
File "/usr/lib/python3/dist-packages/numpy/lib/format.py", line 446, in read_array
array = pickle.load(fp)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xed in position 0: ordinal not in range(128)
This issue should be fixed in the recent update on the python3 compatibility.
I got the following error when I run it on python3:
How to fix it? Thank you very much.