diff --git a/database/daniel/Jul-09-2020--17:37:25:220.jpg b/database/daniel/Jul-09-2020--17:37:25:220.jpg new file mode 100644 index 0000000..afb88b7 Binary files /dev/null and b/database/daniel/Jul-09-2020--17:37:25:220.jpg differ diff --git a/database/erol/Jul-09-2020--17:17:52:544.jpg b/database/erol/Jul-09-2020--17:17:52:544.jpg new file mode 100644 index 0000000..7dd0896 Binary files /dev/null and b/database/erol/Jul-09-2020--17:17:52:544.jpg differ diff --git a/database/representations.pkl b/database/representations.pkl index 51b6797..94691ce 100644 Binary files a/database/representations.pkl and b/database/representations.pkl differ diff --git a/helper.py b/helper.py index 5a1cb92..0343bdf 100644 --- a/helper.py +++ b/helper.py @@ -126,8 +126,8 @@ def findThreshold(model_name, distance_metric): if distance_metric == 'cosine': threshold = 0.23 elif distance_metric == 'euclidean': - # threshold = 35.6 - threshold = 43 + threshold = 35.6 + # threshold = 43 elif distance_metric == 'euclidean_l2': threshold = 0.52 diff --git a/register.py b/register.py index f9df981..71948e5 100644 --- a/register.py +++ b/register.py @@ -8,6 +8,8 @@ def register(database='./database', name='temp'): now = datetime.now() this_time = now.strftime("%b-%d-%Y--%H:%M:%S:%f")[:-3] + + minWidthFace = 200 file_path = os.path.join(database,name) r = 0 @@ -24,7 +26,7 @@ def register(database='./database', name='temp'): faces = helper.detectFacesLive(frame) - if len(faces) != 0 and r != R: + if len(faces) != 0 and r != R and faces[0][2] >= minWidthFace: x, y, w, h = faces[0] # Draw rectangle in face @@ -35,7 +37,7 @@ def register(database='./database', name='temp'): 2) r += 1 - elif len(faces) != 0 and r == R: + elif len(faces) != 0 and r == R and faces[0][2] >= minWidthFace: r = 0 if os.path.exists(file_path) == False: os.makedirs(file_path) diff --git a/rekog.py b/rekog.py index 13e76dd..c22c0f5 100644 --- a/rekog.py +++ b/rekog.py @@ -46,6 +46,7 @@ def rekog(): f = 0 R = 0 r = 180 + minWidthFace = 200 isFreeze = False @@ -91,7 +92,7 @@ def rekog(): R = 0 isFreeze = False - if len(faces) != 0: + if len(faces) != 0 and faces[0][2] >= minWidthFace: x, y, w, h = faces[0] # Draw rectangle in face