mirror of
https://github.com/serengil/deepface.git
synced 2025-06-07 20:15:21 +00:00
download ensemble model
This commit is contained in:
parent
f5087440fc
commit
9fcd62adcc
@ -4,6 +4,8 @@ warnings.filterwarnings("ignore")
|
|||||||
import time
|
import time
|
||||||
import os
|
import os
|
||||||
from os import path
|
from os import path
|
||||||
|
from pathlib import Path
|
||||||
|
import gdown
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
from tqdm import tqdm
|
from tqdm import tqdm
|
||||||
@ -131,12 +133,21 @@ def verify(img1_path, img2_path=''
|
|||||||
|
|
||||||
#-------------------------------
|
#-------------------------------
|
||||||
#find deepface path
|
#find deepface path
|
||||||
deepface_path = DeepFace.__file__
|
|
||||||
deepface_path = deepface_path.replace("\\", "/").replace("/DeepFace.py", "")
|
|
||||||
|
|
||||||
ensemble_model_path = deepface_path+"/models/face-recognition-ensemble-model.txt"
|
home = str(Path.home())
|
||||||
|
|
||||||
|
if os.path.isfile(home+'/.deepface/weights/face-recognition-ensemble-model.txt') != True:
|
||||||
|
print("face-recognition-ensemble-model.txt will be downloaded...")
|
||||||
|
url = 'https://raw.githubusercontent.com/serengil/deepface/master/deepface/models/face-recognition-ensemble-model.txt'
|
||||||
|
output = home+'/.deepface/weights/face-recognition-ensemble-model.txt'
|
||||||
|
gdown.download(url, output, quiet=False)
|
||||||
|
|
||||||
|
ensemble_model_path = home+'/.deepface/weights/face-recognition-ensemble-model.txt'
|
||||||
|
|
||||||
#print(ensemble_model_path)
|
#print(ensemble_model_path)
|
||||||
|
|
||||||
|
#-------------------------------
|
||||||
|
|
||||||
deepface_ensemble = lgb.Booster(model_file = ensemble_model_path)
|
deepface_ensemble = lgb.Booster(model_file = ensemble_model_path)
|
||||||
|
|
||||||
prediction = deepface_ensemble.predict(np.expand_dims(np.array(ensemble_features), axis=0))[0]
|
prediction = deepface_ensemble.predict(np.expand_dims(np.array(ensemble_features), axis=0))[0]
|
||||||
@ -732,9 +743,16 @@ def find(img_path, db_path
|
|||||||
|
|
||||||
#----------------------------------
|
#----------------------------------
|
||||||
#lightgbm model
|
#lightgbm model
|
||||||
deepface_path = DeepFace.__file__
|
home = str(Path.home())
|
||||||
deepface_path = deepface_path.replace("\\", "/").replace("/DeepFace.py", "")
|
|
||||||
ensemble_model_path = deepface_path+"/models/face-recognition-ensemble-model.txt"
|
if os.path.isfile(home+'/.deepface/weights/face-recognition-ensemble-model.txt') != True:
|
||||||
|
print("face-recognition-ensemble-model.txt will be downloaded...")
|
||||||
|
url = 'https://raw.githubusercontent.com/serengil/deepface/master/deepface/models/face-recognition-ensemble-model.txt'
|
||||||
|
output = home+'/.deepface/weights/face-recognition-ensemble-model.txt'
|
||||||
|
gdown.download(url, output, quiet=False)
|
||||||
|
|
||||||
|
ensemble_model_path = home+'/.deepface/weights/face-recognition-ensemble-model.txt'
|
||||||
|
|
||||||
deepface_ensemble = lgb.Booster(model_file = ensemble_model_path)
|
deepface_ensemble = lgb.Booster(model_file = ensemble_model_path)
|
||||||
|
|
||||||
y = deepface_ensemble.predict(x)
|
y = deepface_ensemble.predict(x)
|
||||||
|
2
setup.py
2
setup.py
@ -5,7 +5,7 @@ with open("README.md", "r", encoding="utf-8") as fh:
|
|||||||
|
|
||||||
setuptools.setup(
|
setuptools.setup(
|
||||||
name="deepface",
|
name="deepface",
|
||||||
version="0.0.32",
|
version="0.0.33",
|
||||||
author="Sefik Ilkin Serengil",
|
author="Sefik Ilkin Serengil",
|
||||||
author_email="serengil@gmail.com",
|
author_email="serengil@gmail.com",
|
||||||
description="A Lightweight Face Recognition and Facial Attribute Analysis Framework (Age, Gender, Emotion, Race) for Python",
|
description="A Lightweight Face Recognition and Facial Attribute Analysis Framework (Age, Gender, Emotion, Race) for Python",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user