1
我最近測試了代碼Tensorflow VGG16。當我加載python3.4中的vgg16.npy。它出來的錯誤。 的代碼是這樣的:在python3.4中加載.npy文件錯誤
self.data_dict = np.load(vgg16_npy_path, encoding='latin1').item()
錯誤:
TypeError: load() got an unexpected keyword argument 'encoding'
但我刪除encoding='latin1'
,只是
self.data_dict = np.load(vgg16_npy_path).item()
這裏還配備了一個錯誤:
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)
那麼如何使用np.load在python3.4中加載.npy文件? 非常感謝。