Closed se7enXF closed 5 years ago
This issue is mentioned by #1019 and has been fixed in PR#1021. Please pull the latest TensorLayer code and modify your code accordingly. Thanks!
I use pip installing the TL2 and the version is the latest 2.1.0.
I edit the TF2 source code in python with 'allow_pickle=True' and it works well.
Hope you can add some more useful model in TL, such as ResNet, YOLO. TL is very useful and thank you.
same problem. and my version is the latest 2.1.1. but what puzzles me is when I ran codes in tensorlayer/examples/pretrained_cnn/, tutorial_models_vgg16.py worked prefect and tutorial_models_vgg19.py did't. I guess it is the problem of tensorlayer/tensorlayer/models/vgg.py, cauz http://www.cs.toronto.edu/~frossard/post/vgg16/ can be acceessed and link to vgg19 cannot. maybe change the link to a more stable one will help. also hope codes in tensorlayer/examples/ could show how to load local vgg*.npz. thanks a lot.
@rinabell
The pretrained weights of VGG16 and VGG19 are in different encodings which causes the different loading code in TL source code.
if layer_type == 'vgg16':
npz = np.load(os.path.join('models', model_saved_name[layer_type]))
...
elif layer_type == 'vgg19':
# npz = np.load(os.path.join('models', model_saved_name[layer_type]), encoding='latin1').item()
npz = np.load(os.path.join('models', model_saved_name[layer_type]), encoding='latin1', allow_pickle=True).item()
...
Now I think you know why VGG16 works well. If you have downloaded the pretrained weights of VGG19 but failed to loading, please change the TL code tensorlayer/models/vgg.py in python site-packages as shown upper.
If you are in China might cause some TIMEOUT error. I suggest you to try more because I did it and I am in China.
To load the local vgg*.npz, you can find out by reading the source code and here is my submission:
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
Here is the error: