Spaces:
Runtime error
Runtime error
Commit
·
b05b0e1
1
Parent(s):
e720e50
Update retinaface_model.py
Browse files- retinaface_model.py +1 -29
retinaface_model.py
CHANGED
|
@@ -15,35 +15,7 @@ else:
|
|
| 15 |
|
| 16 |
def load_weights(model):
|
| 17 |
|
| 18 |
-
|
| 19 |
-
exact_file = home+'/.deepface/weights/retinaface.h5'
|
| 20 |
-
#url = 'https://drive.google.com/file/d/1K3Eq2k1b9dpKkucZjPAiCCnNzfCMosK4'
|
| 21 |
-
#url = 'https://drive.google.com/uc?id=1K3Eq2k1b9dpKkucZjPAiCCnNzfCMosK4'
|
| 22 |
-
url = 'https://github.com/serengil/deepface_models/releases/download/v1.0/retinaface.h5'
|
| 23 |
-
|
| 24 |
-
#-----------------------------
|
| 25 |
-
|
| 26 |
-
if not os.path.exists(home+"/.deepface"):
|
| 27 |
-
os.mkdir(home+"/.deepface")
|
| 28 |
-
print("Directory ",home,"/.deepface created")
|
| 29 |
-
|
| 30 |
-
if not os.path.exists(home+"/.deepface/weights"):
|
| 31 |
-
os.mkdir(home+"/.deepface/weights")
|
| 32 |
-
print("Directory ",home,"/.deepface/weights created")
|
| 33 |
-
|
| 34 |
-
#-----------------------------
|
| 35 |
-
|
| 36 |
-
if os.path.isfile(exact_file) != True:
|
| 37 |
-
print("retinaface.h5 will be downloaded from the url "+url)
|
| 38 |
-
gdown.download(url, exact_file, quiet=False)
|
| 39 |
-
|
| 40 |
-
#-----------------------------
|
| 41 |
-
|
| 42 |
-
#gdown should download the pretrained weights here. If it does not still exist, then throw an exception.
|
| 43 |
-
if os.path.isfile(exact_file) != True:
|
| 44 |
-
raise ValueError("Pre-trained weight could not be loaded!"
|
| 45 |
-
+" You might try to download the pre-trained weights from the url "+ url
|
| 46 |
-
+ " and copy it to the ", exact_file, "manually.")
|
| 47 |
|
| 48 |
model.load_weights(exact_file)
|
| 49 |
|
|
|
|
| 15 |
|
| 16 |
def load_weights(model):
|
| 17 |
|
| 18 |
+
exact_file = RetinaFace_Face_Detector_Extractor_Recognizer/retinaface.h5
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
|
| 20 |
model.load_weights(exact_file)
|
| 21 |
|