SRGAN icon indicating copy to clipboard operation
SRGAN copied to clipboard

Failed to load VGG19

Open yangyingni opened this issue 5 years ago • 7 comments

Hello,i used ### VGG = tl.models.vgg19(pretrained=True, end_with='pool4', mode='static') ###to load vgg19,but it shows ###TypeError: vgg19() got an unexpected keyword argument 'allow_pickle'###,can someone tell me how to deal with it?

yangyingni avatar Jan 18 '20 14:01 yangyingni

@Laicheng0830 this could be a problem, pretrained models are widely used.

zsdonghao avatar Jan 19 '20 09:01 zsdonghao

@yangyingni I didn't replicate your results in tensorlayer2.2.1, You may need to update tensorlayer?

Laicheng0830 avatar Jan 20 '20 08:01 Laicheng0830

hello ,It shows the same content. If you solve the problem, could you please tell me? @yangyingni

Yushixiangqini avatar Feb 25 '20 09:02 Yushixiangqini

I have a problem when trying to train:

Traceback (most recent call last): File "V:\Python 3.6.8\lib\site-packages\numpy\lib\npyio.py", line 447, in load return pickle.load(fid, **pickle_kwargs) _pickle.UnpicklingError: invalid load key, 'v'.

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "train.py", line 200, in

File "train.py", line 74, in train G = get_G((batch_size, 96, 96, 3)) File "V:\Python 3.6.8\lib\site-packages\tensorlayer\models\vgg.py", line 319, in vgg19 restore_model(model, layer_type='vgg19') File "V:\Python 3.6.8\lib\site-packages\tensorlayer\models\vgg.py", line 171, in restore_model npz = np.load(os.path.join('models', model_saved_name[layer_type]), allow_pickle=True, encoding='latin1').item() File "V:\Python 3.6.8\lib\site-packages\numpy\lib\npyio.py", line 450, in load "Failed to interpret file %s as a pickle" % repr(file)) OSError: Failed to interpret file 'models\vgg19.npy' as a pickle

I don't understand what wrong with code or library, please help me @zsdonghao @Laicheng0830

meeng251 avatar Sep 02 '20 05:09 meeng251

Has anyone managed to solve the pickle interpretation problem? I get the same error as above.

tobylerone avatar Nov 11 '20 12:11 tobylerone

Has anyone managed to solve the pickle interpretation problem? I get the same error as above.

Can you provide a code runtime environment

Laicheng0830 avatar Nov 11 '20 13:11 Laicheng0830

Traceback (most recent call last): File "C:\Users\4010356\AppData\Local\anaconda3\envs\pytorch\Lib\site-packages\numpy\lib\npyio.py", line 465, in load return pickle.load(fid, **pickle_kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ _pickle.UnpicklingError: invalid load key, 'v'.

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "c:\Users\4010356\Desktop\deep\train.py", line 111, in VGG = vgg.VGG19(pretrained=True, end_with='pool4', mode='dynamic') ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "c:\Users\4010356\Desktop\deep\vgg.py", line 261, in vgg19 restore_model(model, layer_type='vgg19') File "c:\Users\4010356\Desktop\deep\vgg.py", line 169, in restore_model npz = np.load(os.path.join('model', model_saved_name[layer_type]), allow_pickle=True, encoding='latin1').item() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\4010356\AppData\Local\anaconda3\envs\pytorch\Lib\site-packages\numpy\lib\npyio.py", line 467, in load raise pickle.UnpicklingError( _pickle.UnpicklingError: Failed to interpret file 'model\vgg19.npy' as a pickle

alhydrym7 avatar Dec 11 '23 13:12 alhydrym7