dlib and lgbm are not must

This commit is contained in:
serengil 2020-12-04 14:28:18 +03:00
parent d62d6d152f
commit e2fde9157b
2 changed files with 10 additions and 4 deletions

View File

@ -4,8 +4,6 @@ import os
from os import path from os import path
from pathlib import Path from pathlib import Path
import numpy as np import numpy as np
import lightgbm as lgb #lightgbm==2.3.1
from deepface.commons import functions, distance as dst from deepface.commons import functions, distance as dst
def loadModel(): def loadModel():
@ -35,10 +33,16 @@ def validate_model(model):
#print("Ensemble learning will be applied for ", found_models," models") #print("Ensemble learning will be applied for ", found_models," models")
valid = True valid = True
else: else:
raise ValueError("You would like to apply ensemble learning and pass pre-built models but models must contain [VGG-Face, Facenet, OpenFace, DeepFace] but you passed "+found_models)
missing_ones = set(['VGG-Face', 'Facenet', 'OpenFace', 'DeepFace']) - set(found_models)
raise ValueError("You'd like to apply ensemble method and pass pre-built models but models must contain [VGG-Face, Facenet, OpenFace, DeepFace] but you passed "+str(found_models)+". So, you need to pass "+str(missing_ones)+" models as well.")
def build_gbm(): def build_gbm():
#this is not a must dependency
import lightgbm as lgb #lightgbm==2.3.1
home = str(Path.home()) home = str(Path.home())
if os.path.isfile(home+'/.deepface/weights/face-recognition-ensemble-model.txt') != True: if os.path.isfile(home+'/.deepface/weights/face-recognition-ensemble-model.txt') != True:

View File

@ -1,4 +1,3 @@
import dlib #19.20.0
import os import os
import zipfile import zipfile
import bz2 import bz2
@ -9,6 +8,9 @@ from pathlib import Path
class DlibResNet: class DlibResNet:
def __init__(self): def __init__(self):
#this is not a must dependency
import dlib #19.20.0
self.layers = [DlibMetaData()] self.layers = [DlibMetaData()]