Skip to content

Commit

Permalink
dlib and lgbm are not must
Browse files Browse the repository at this point in the history
  • Loading branch information
serengil committed Dec 4, 2020
1 parent d62d6d1 commit e2fde91
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
10 changes: 7 additions & 3 deletions deepface/basemodels/Boosting.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
from os import path
from pathlib import Path
import numpy as np
import lightgbm as lgb #lightgbm==2.3.1

from deepface.commons import functions, distance as dst

def loadModel():
Expand Down Expand Up @@ -35,10 +33,16 @@ def validate_model(model):
#print("Ensemble learning will be applied for ", found_models," models")
valid = True
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():

#this is not a must dependency
import lightgbm as lgb #lightgbm==2.3.1

home = str(Path.home())

if os.path.isfile(home+'/.deepface/weights/face-recognition-ensemble-model.txt') != True:
Expand Down
4 changes: 3 additions & 1 deletion deepface/basemodels/DlibResNet.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import dlib #19.20.0
import os
import zipfile
import bz2
Expand All @@ -9,6 +8,9 @@
class DlibResNet:

def __init__(self):

#this is not a must dependency
import dlib #19.20.0

self.layers = [DlibMetaData()]

Expand Down

0 comments on commit e2fde91

Please sign in to comment.