Skip to content

Commit

Permalink
update to have cleaner releases
Browse files Browse the repository at this point in the history
  • Loading branch information
David Doukhan committed Oct 18, 2021
1 parent 960aa7b commit c90073f
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions inaFaceGender/remote_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,28 +28,30 @@
# inaFaceGender models are stored remotely within github releases
# this code allows to download and use them on demand

url_r1 = 'https://github.com/ina-foss/inaFaceGender/releases/download/models-init/'
url_r2 = 'https://github.com/ina-foss/inaFaceGender/releases/download/models-init-2/'
r1_url = 'https://github.com/ina-foss/inaFaceGender/releases/download/models/'

dmodels = {
# These 2 models are provided for face detection in opencv
# https://raw.githubusercontent.com/opencv/opencv_3rdparty/dnn_samples_face_detector_20180220_uint8/opencv_face_detector_uint8.pb
# https://github.com/opencv/opencv/blob/4eb296655958e9241f43a7bd144d5e63759f6cea/samples/dnn/face_detector/opencv_face_detector.pbtxt
'opencv_face_detector_uint8.pb' : url_r2,
'opencv_face_detector.pbtxt' : url_r2,
'opencv_face_detector_uint8.pb' : r1_url,
'opencv_face_detector.pbtxt' : r1_url,
# Dlib's Facial landmarks prediction
# http://dlib.net/files/shape_predictor_68_face_landmarks.dat.bz2
'shape_predictor_68_face_landmarks.dat' : url_r2,
'shape_predictor_68_face_landmarks.dat' : r1_url,
# Resnet50 architectures trained on FairFace database
'keras_resnet50_fairface_GRA.h5' : url_r1,
'keras_resnet50_fairface.h5' : url_r1,
'keras_resnet50_fairface_GRA.h5' : r1_url,
'keras_resnet50_fairface.h5' : r1_url,
# linear SVM trained on Youtube Faces VGG16 face embeddings
'svm_ytf_zrezgui.hdf5': url_r2,
'svm_ytf_zrezgui.hdf5' : r1_url,
# linear SVM trained on FairFace VGG 16 embeddings
'svm_vgg16_fairface.hdf5': url_r2,
}

'svm_vgg16_fairface.hdf5' : r1_url}

def get_remote(model_fname):
url = dmodels[model_fname]
return get_file(model_fname, url + model_fname)
return get_file(model_fname, url + model_fname, cache_subdir='inaFaceGender')

def download_all():
# usefull at the initalisation of a Docker image
for k in dmodels:
get_remote(k)

0 comments on commit c90073f

Please sign in to comment.