mirror of
https://github.com/serengil/deepface.git
synced 2025-06-07 12:05:22 +00:00
bug fixed for numpy inputs
This commit is contained in:
parent
6be5b2d41a
commit
0ef832c081
@ -38,9 +38,13 @@ def initialize_input(img1_path, img2_path = None):
|
||||
img_list = img1_path.copy()
|
||||
else:
|
||||
bulkProcess = False
|
||||
if img2_path != None:
|
||||
|
||||
if (
|
||||
(type(img2_path) == str and img2_path != None) #exact image path, base64 image
|
||||
or (isinstance(img2_path, np.ndarray) and img2_path.any()) #numpy array
|
||||
):
|
||||
img_list = [[img1_path, img2_path]]
|
||||
else:
|
||||
else: #analyze function passes just img1_path
|
||||
img_list = [img1_path]
|
||||
|
||||
return img_list, bulkProcess
|
||||
|
@ -104,11 +104,8 @@ print(resp_obj["instance_2"]["age"]," years old ", resp_obj["instance_2"]["domin
|
||||
print(resp_obj["instance_3"]["age"]," years old ", resp_obj["instance_3"]["dominant_emotion"], " ",resp_obj["instance_3"]["gender"])
|
||||
print(resp_obj["instance_4"]["age"]," years old ", resp_obj["instance_4"]["dominant_emotion"], " ",resp_obj["instance_4"]["gender"])
|
||||
|
||||
|
||||
print("-----------------------------------------")
|
||||
|
||||
#-----------------------------------------
|
||||
|
||||
print("Facial analysis test. Passing nothing as an action")
|
||||
|
||||
img = "dataset/img4.jpg"
|
||||
@ -277,5 +274,34 @@ df = DeepFace.find("dataset/img1.jpg", db_path = "dataset", model_name = 'Ensemb
|
||||
|
||||
print(df)
|
||||
|
||||
#-----------------------------------
|
||||
print("--------------------------")
|
||||
|
||||
import cv2
|
||||
|
||||
print("Passing numpy array to analyze function")
|
||||
|
||||
img = cv2.imread("dataset/img1.jpg")
|
||||
resp_obj = DeepFace.analyze(img)
|
||||
print(resp_obj)
|
||||
|
||||
print("--------------------------")
|
||||
|
||||
print("Passing numpy array to verify function")
|
||||
|
||||
img1 = cv2.imread("dataset/img1.jpg")
|
||||
img2 = cv2.imread("dataset/img2.jpg")
|
||||
|
||||
res = DeepFace.verify(img1, img2)
|
||||
print(res)
|
||||
|
||||
print("--------------------------")
|
||||
|
||||
print("Passing numpy array to find function")
|
||||
|
||||
img1 = cv2.imread("dataset/img1.jpg")
|
||||
|
||||
df = DeepFace.find(img1, db_path = "dataset")
|
||||
|
||||
print(df.head())
|
||||
|
||||
print("--------------------------")
|
Loading…
x
Reference in New Issue
Block a user