Skip to content

Commit

Permalink
#1475 set OPENBLAS_NUM_THREADS to 4, the limit for which the lib was …
Browse files Browse the repository at this point in the history
…compiled;

Log the time spent extracting faces and the total time for grouping the faces;
  • Loading branch information
hauck-jvsh committed Jan 17, 2023
1 parent 1b87b20 commit f6d1162
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions iped-app/resources/scripts/tasks/FaceRecognitionTask.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

#import face_recognition as fr
import os
os.environ["OPENBLAS_NUM_THREADS"]="4"
import time
import subprocess
import threading, queue
Expand Down Expand Up @@ -224,13 +225,14 @@ def finish(self):

if len(encodings)==0:
return
logger.info("[FaceRecognitionTask] Time(s) to extract faces ",str(time.time()-groupTime))
#print(encodings)
print("Number of faces",len(ids))
#print("Number of faces",len(ids))
clt = DBSCAN(metric="euclidean",n_jobs=-1,eps=maxClusterDist)
clt.fit(encodings)
clusters={}
print("labels",clt.labels_)
print("Number of labels",len(clt.labels_))
#print("labels",clt.labels_)
#print("Number of labels",len(clt.labels_))

for i in range(len(clt.labels_)):
if clt.labels_[i]<0:#-1 is an unknown cluster
Expand All @@ -240,12 +242,15 @@ def finish(self):
except:
clusters[clt.labels_[i]]={"ids":[ids[i]],"name":"Face_"+str(clt.labels_[i])}
#print(clusters)
tot=0
for c in clusters:
tot+=1
c=clusters[c]
bookmarkId=ipedCase.getBookmarks().newBookmark(c["name"])
ipedCase.getBookmarks().addBookmark([Integer(id) for id in c["ids"]] , bookmarkId)

ipedCase.getBookmarks().saveState(True)
logger.info('[FaceRecognitionTask] Number of face groups founds: ' + str(tot))
logger.info('[FaceRecognitionTask] Time(s) to group similar faces: ' + str(time.time()-groupTime))


Expand Down

0 comments on commit f6d1162

Please sign in to comment.