keras-vggface deploy model file locally

keras-vggface is a face detection library based on keras.

Running above code will load vgg16 model. if models is not downloaded before, it will try to fetch the model file from web.

What if you want to deploy the model locally, pack it with your application distribution, so the user don’t need to download model file when using your application first time?

Solution

The answer is to put the model file under ~/.keras/models/vggface

The ~ is your home path. If you’re using Linux, just copy the path as it is, supported on Linux by default.
But if you are using Windows, the ~ should be replaced with C:/Users/Administrator
(assume system path is C: and current logged in username is Administrator)

Note that the model file name cannot be changed, e.g. for vgg16 model the filename should be rcmalli_vggface_tf_vgg16.h5