Skip to content

Can not load pertrained weights in VGG19 #1022

@se7enXF

Description

@se7enXF

New Issue Checklist

Issue Description

When I use VGG19 model with pretrained weights, some errors arose. Maybe it is mismatching of
numpy and tensorlayer2 that cause the problem. The weight download process works well.

Reproducible Code

  • OS:Windows10
  • Python3.6
  • numpy1.16.4
  • tensorlayer2.1.0
import tensorlayer as tl
cnn = tl.models.vgg19(pretrained=True, end_with='conv5_4')

Here is the error:

Traceback (most recent call last):
  File "D:/TAM_Net/model.py", line 197, in <module>
    test = THZoom([None, image_size, image_size, 3])
  File "D:/TAM_Net/model.py", line 181, in __init__
    self.encoder = tl.models.vgg19(pretrained=True, end_with='conv5_4', mode='static')
  File "C:\Users\dell\Miniconda3\envs\tf2\lib\site-packages\tensorlayer\models\vgg.py", line 317, in vgg19
    restore_model(model, layer_type='vgg19')
  File "C:\Users\dell\Miniconda3\envs\tf2\lib\site-packages\tensorlayer\models\vgg.py", line 169, in restore_model
    npz = np.load(os.path.join('models', model_saved_name[layer_type]), encoding='latin1').item()
  File "C:\Users\dell\Miniconda3\envs\tf2\lib\site-packages\numpy\lib\npyio.py", line 447, in load
    pickle_kwargs=pickle_kwargs)
  File "C:\Users\dell\Miniconda3\envs\tf2\lib\site-packages\numpy\lib\format.py", line 696, in read_array
    raise ValueError("Object arrays cannot be loaded when "
ValueError: Object arrays cannot be loaded when allow_pickle=False

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions