Amend test.py for os dependendent directory separator char

It was failing on Windows
This commit is contained in:
Andrea Lanfranchi 2024-02-22 14:35:16 +01:00
parent 7b0500a17d
commit 1d53ca1bd1
No known key found for this signature in database
GPG Key ID: 2D623A60BB279915

View File

@ -1,3 +1,4 @@
import os
import cv2 import cv2
import pandas as pd import pandas as pd
from deepface import DeepFace from deepface import DeepFace
@ -10,7 +11,7 @@ threshold = verification.find_threshold(model_name="VGG-Face", distance_metric="
def test_find_with_exact_path(): def test_find_with_exact_path():
img_path = "dataset/img1.jpg" img_path = os.path.join("dataset","img1.jpg")
dfs = DeepFace.find(img_path=img_path, db_path="dataset", silent=True) dfs = DeepFace.find(img_path=img_path, db_path="dataset", silent=True)
assert len(dfs) > 0 assert len(dfs) > 0
for df in dfs: for df in dfs:
@ -30,7 +31,7 @@ def test_find_with_exact_path():
def test_find_with_array_input(): def test_find_with_array_input():
img_path = "dataset/img1.jpg" img_path = os.path.join("dataset","img1.jpg")
img1 = cv2.imread(img_path) img1 = cv2.imread(img_path)
dfs = DeepFace.find(img1, db_path="dataset", silent=True) dfs = DeepFace.find(img1, db_path="dataset", silent=True)
assert len(dfs) > 0 assert len(dfs) > 0
@ -52,7 +53,7 @@ def test_find_with_array_input():
def test_find_with_extracted_faces(): def test_find_with_extracted_faces():
img_path = "dataset/img1.jpg" img_path = os.path.join("dataset","img1.jpg")
face_objs = DeepFace.extract_faces(img_path) face_objs = DeepFace.extract_faces(img_path)
img = face_objs[0]["face"] img = face_objs[0]["face"]
dfs = DeepFace.find(img, db_path="dataset", detector_backend="skip", silent=True) dfs = DeepFace.find(img, db_path="dataset", detector_backend="skip", silent=True)