Provide the ability to override the default gdrive model weights

This commit is contained in:
Pradeep 2020-08-26 12:14:39 +01:00
parent d572b88083
commit 0c53956360
5 changed files with 6 additions and 12 deletions

View File

@ -8,7 +8,7 @@ import zipfile
#-------------------------------------
def loadModel():
def loadModel(url = 'https://drive.google.com/uc?id=1uRLtBCTQQAvHJ_KVrdbRJiCKxU8m5q2J'):
myInput = Input(shape=(55, 47, 3))
@ -43,7 +43,6 @@ def loadModel():
if os.path.isfile(home+'/.deepface/weights/deepid_keras_weights.h5') != True:
print("deepid_keras_weights.h5 will be downloaded...")
url = 'https://drive.google.com/uc?id=1uRLtBCTQQAvHJ_KVrdbRJiCKxU8m5q2J'
output = home+'/.deepface/weights/deepid_keras_weights.h5'
gdown.download(url, output, quiet=False)

View File

@ -530,7 +530,7 @@ def InceptionResNetV2():
return model
def loadModel():
def loadModel(url = 'https://drive.google.com/uc?id=1971Xk5RwedbudGgTIrGAL4F7Aifu7id1'):
model = InceptionResNetV2()
#-----------------------------------
@ -540,7 +540,6 @@ def loadModel():
if os.path.isfile(home+'/.deepface/weights/facenet_weights.h5') != True:
print("facenet_weights.h5 will be downloaded...")
url = 'https://drive.google.com/uc?id=1971Xk5RwedbudGgTIrGAL4F7Aifu7id1'
output = home+'/.deepface/weights/facenet_weights.h5'
gdown.download(url, output, quiet=False)

View File

@ -8,7 +8,7 @@ import zipfile
#-------------------------------------
def loadModel():
def loadModel(url = 'https://github.com/swghosh/DeepFace/releases/download/weights-vggface2-2d-aligned/VGGFace2_DeepFace_weights_val-0.9034.h5.zip'):
base_model = Sequential()
base_model.add(Convolution2D(32, (11, 11), activation='relu', name='C1', input_shape=(152, 152, 3)))
base_model.add(MaxPooling2D(pool_size=3, strides=2, padding='same', name='M2'))
@ -28,8 +28,6 @@ def loadModel():
if os.path.isfile(home+'/.deepface/weights/VGGFace2_DeepFace_weights_val-0.9034.h5') != True:
print("VGGFace2_DeepFace_weights_val-0.9034.h5 will be downloaded...")
url = 'https://github.com/swghosh/DeepFace/releases/download/weights-vggface2-2d-aligned/VGGFace2_DeepFace_weights_val-0.9034.h5.zip'
output = home+'/.deepface/weights/VGGFace2_DeepFace_weights_val-0.9034.h5.zip'
gdown.download(url, output, quiet=False)

View File

@ -15,7 +15,7 @@ from keras import backend as K
#---------------------------------------
def loadModel():
def loadModel(url = 'https://drive.google.com/uc?id=1LSe1YCV1x-BfNnfb7DFZTNpv_Q9jITxn'):
myInput = Input(shape=(96, 96, 3))
x = ZeroPadding2D(padding=(3, 3), input_shape=(96, 96, 3))(myInput)
@ -237,7 +237,6 @@ def loadModel():
if os.path.isfile(home+'/.deepface/weights/openface_weights.h5') != True:
print("openface_weights.h5 will be downloaded...")
url = 'https://drive.google.com/uc?id=1LSe1YCV1x-BfNnfb7DFZTNpv_Q9jITxn'
output = home+'/.deepface/weights/openface_weights.h5'
gdown.download(url, output, quiet=False)

View File

@ -54,7 +54,7 @@ def baseModel():
return model
def loadModel():
def loadModel(url = 'https://drive.google.com/uc?id=1CPSeum3HpopfomUEK1gybeuIVoeJT_Eo'):
model = baseModel()
@ -63,9 +63,8 @@ def loadModel():
home = str(Path.home())
if os.path.isfile(home+'/.deepface/weights/vgg_face_weights.h5') != True:
print("vgg_face_weights.h5 will be downloaded...")
print("vgg_face_weights.h5 will be downloaded...")
url = 'https://drive.google.com/uc?id=1CPSeum3HpopfomUEK1gybeuIVoeJT_Eo'
output = home+'/.deepface/weights/vgg_face_weights.h5'
gdown.download(url, output, quiet=False)