mirror of
https://github.com/serengil/deepface.git
synced 2025-06-07 12:05:22 +00:00
clearify test batch extract
This commit is contained in:
parent
dc6cb81ec5
commit
6143ed9bb4
@ -104,6 +104,7 @@ def test_batch_extract_faces(detector_backend):
|
|||||||
"dataset/img11.jpg",
|
"dataset/img11.jpg",
|
||||||
"dataset/couple.jpg"
|
"dataset/couple.jpg"
|
||||||
]
|
]
|
||||||
|
expected_num_faces = [1, 1, 1, 2]
|
||||||
|
|
||||||
# Extract faces one by one
|
# Extract faces one by one
|
||||||
imgs_objs_individual = [
|
imgs_objs_individual = [
|
||||||
@ -121,15 +122,12 @@ def test_batch_extract_faces(detector_backend):
|
|||||||
align=True,
|
align=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
assert (
|
# Check that the batch extraction returned the expected number of face lists
|
||||||
len(imgs_objs_batch) == 4 and
|
assert len(imgs_objs_batch) == len(img_paths)
|
||||||
all(isinstance(obj, list) for obj in imgs_objs_batch)
|
|
||||||
)
|
# Check that each face list has the expected number of faces
|
||||||
assert all(
|
for i, expected_faces in enumerate(expected_num_faces):
|
||||||
len(imgs_objs_batch[i]) == 1
|
assert len(imgs_objs_batch[i]) == expected_faces
|
||||||
for i in range(len(imgs_objs_batch[:-1]))
|
|
||||||
)
|
|
||||||
assert len(imgs_objs_batch[-1]) == 2
|
|
||||||
|
|
||||||
for img_objs_individual, img_objs_batch in zip(imgs_objs_individual, imgs_objs_batch):
|
for img_objs_individual, img_objs_batch in zip(imgs_objs_individual, imgs_objs_batch):
|
||||||
assert len(img_objs_batch) == len(img_objs_individual), (
|
assert len(img_objs_batch) == len(img_objs_individual), (
|
||||||
|
Loading…
x
Reference in New Issue
Block a user