rcmalli / keras-vggface

VGGFace implementation with Keras Framework
MIT License
928 stars 417 forks source link

wan to load the pretrained model from local file #35

Closed Myeong-Yeon closed 5 years ago

Myeong-Yeon commented 6 years ago

Please run this code and share your library versions

import tensorflow as tf
import keras
import keras_vggface

print(tf.__version__)
print(keras.__version__)
print(keras_vggface.__version__)

1.8.0 2.1.2 0.5

Bug reports: I want to load the pretrained model from local file, not download it on demand The file is the same file from the url in util.py(RESNET50_WEIGHTS_PATH_NO_TOP = 'https://github.com/rcmalli/keras-vggface/releases/download/v2.0/rcmalli_vggface_tf_notop_resnet50.h5')

But the code below raises a ValueError

my code VGGFace(model='resnet50', include_top=False, input_shape=(224, 224, 3), weights='path/to/pretrained/rcmalli_vggface_tf_notop_resnet50.h5' pooling='avg')

error report File "/keras-vggface/keras_vggface/vggface.py", line 64, in VGGFace raise ValueError('The weights argument should be either ' ValueError: The weights argument should be either None (random initialization) or vggface(pre-training on VGGFace Datasets).

Code Sample:

Please replace this line with a code sample to replicate the issue.

chinmayshah99 commented 6 years ago

Hey @Myeong-Yeon, you can try using

VGGFace(model='resnet50',
include_top=False,
input_shape=(224, 224, 3),
weights='resnet50'
pooling='avg')