|
28 | 28 | # inaFaceGender models are stored remotely within github releases |
29 | 29 | # this code allows to download and use them on demand |
30 | 30 |
|
31 | | -url_r1 = 'https://github.com/ina-foss/inaFaceGender/releases/download/models-init/' |
32 | | -url_r2 = 'https://github.com/ina-foss/inaFaceGender/releases/download/models-init-2/' |
| 31 | +r1_url = 'https://github.com/ina-foss/inaFaceGender/releases/download/models/' |
33 | 32 |
|
34 | 33 | dmodels = { |
35 | 34 | # These 2 models are provided for face detection in opencv |
36 | 35 | # https://raw.githubusercontent.com/opencv/opencv_3rdparty/dnn_samples_face_detector_20180220_uint8/opencv_face_detector_uint8.pb |
37 | 36 | # https://github.com/opencv/opencv/blob/4eb296655958e9241f43a7bd144d5e63759f6cea/samples/dnn/face_detector/opencv_face_detector.pbtxt |
38 | | - 'opencv_face_detector_uint8.pb' : url_r2, |
39 | | - 'opencv_face_detector.pbtxt' : url_r2, |
| 37 | + 'opencv_face_detector_uint8.pb' : r1_url, |
| 38 | + 'opencv_face_detector.pbtxt' : r1_url, |
40 | 39 | # Dlib's Facial landmarks prediction |
41 | 40 | # http://dlib.net/files/shape_predictor_68_face_landmarks.dat.bz2 |
42 | | - 'shape_predictor_68_face_landmarks.dat' : url_r2, |
| 41 | + 'shape_predictor_68_face_landmarks.dat' : r1_url, |
43 | 42 | # Resnet50 architectures trained on FairFace database |
44 | | - 'keras_resnet50_fairface_GRA.h5' : url_r1, |
45 | | - 'keras_resnet50_fairface.h5' : url_r1, |
| 43 | + 'keras_resnet50_fairface_GRA.h5' : r1_url, |
| 44 | + 'keras_resnet50_fairface.h5' : r1_url, |
46 | 45 | # linear SVM trained on Youtube Faces VGG16 face embeddings |
47 | | - 'svm_ytf_zrezgui.hdf5': url_r2, |
| 46 | + 'svm_ytf_zrezgui.hdf5' : r1_url, |
48 | 47 | # linear SVM trained on FairFace VGG 16 embeddings |
49 | | - 'svm_vgg16_fairface.hdf5': url_r2, |
50 | | - } |
51 | | - |
| 48 | + 'svm_vgg16_fairface.hdf5' : r1_url} |
52 | 49 |
|
53 | 50 | def get_remote(model_fname): |
54 | 51 | url = dmodels[model_fname] |
55 | | - return get_file(model_fname, url + model_fname) |
| 52 | + return get_file(model_fname, url + model_fname, cache_subdir='inaFaceGender') |
| 53 | + |
| 54 | +def download_all(): |
| 55 | + # usefull at the initalisation of a Docker image |
| 56 | + for k in dmodels: |
| 57 | + get_remote(k) |
0 commit comments