mirror of
https://github.com/serengil/deepface.git
synced 2025-06-07 12:05:22 +00:00
common confidence scales
This commit is contained in:
parent
3ebcc82c17
commit
7ee55cb682
@ -90,6 +90,7 @@ class DlibClient(Detector):
|
|||||||
left_eye = (shape.part(2).x, shape.part(2).y)
|
left_eye = (shape.part(2).x, shape.part(2).y)
|
||||||
right_eye = (shape.part(0).x, shape.part(0).y)
|
right_eye = (shape.part(0).x, shape.part(0).y)
|
||||||
|
|
||||||
|
# never saw confidence higher than +3.5 github.com/davisking/dlib/issues/761
|
||||||
confidence = scores[idx]
|
confidence = scores[idx]
|
||||||
|
|
||||||
facial_area = FacialAreaRegion(
|
facial_area = FacialAreaRegion(
|
||||||
@ -99,7 +100,7 @@ class DlibClient(Detector):
|
|||||||
h=h,
|
h=h,
|
||||||
left_eye=left_eye,
|
left_eye=left_eye,
|
||||||
right_eye=right_eye,
|
right_eye=right_eye,
|
||||||
confidence=confidence,
|
confidence=min(max(0, confidence), 1.0),
|
||||||
)
|
)
|
||||||
resp.append(facial_area)
|
resp.append(facial_area)
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ class OpenCvClient(Detector):
|
|||||||
h=h,
|
h=h,
|
||||||
left_eye=left_eye,
|
left_eye=left_eye,
|
||||||
right_eye=right_eye,
|
right_eye=right_eye,
|
||||||
confidence=confidence,
|
confidence=(100 - confidence) / 100,
|
||||||
)
|
)
|
||||||
resp.append(facial_area)
|
resp.append(facial_area)
|
||||||
|
|
||||||
|
@ -31,6 +31,7 @@ detector_backends = [
|
|||||||
"yolov8",
|
"yolov8",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
# verification
|
# verification
|
||||||
for model_name in model_names:
|
for model_name in model_names:
|
||||||
obj = DeepFace.verify(
|
obj = DeepFace.verify(
|
||||||
@ -46,6 +47,7 @@ for model_name in model_names:
|
|||||||
embedding = embedding_obj["embedding"]
|
embedding = embedding_obj["embedding"]
|
||||||
logger.info(f"{model_name} produced {len(embedding)}D vector")
|
logger.info(f"{model_name} produced {len(embedding)}D vector")
|
||||||
|
|
||||||
|
|
||||||
# find
|
# find
|
||||||
dfs = DeepFace.find(
|
dfs = DeepFace.find(
|
||||||
img_path="dataset/img1.jpg", db_path="dataset", model_name="Facenet", detector_backend="mtcnn"
|
img_path="dataset/img1.jpg", db_path="dataset", model_name="Facenet", detector_backend="mtcnn"
|
||||||
@ -54,6 +56,7 @@ for df in dfs:
|
|||||||
logger.info(df)
|
logger.info(df)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# img_paths = ["dataset/img11.jpg", "dataset/img11_reflection.jpg", "dataset/couple.jpg"]
|
# img_paths = ["dataset/img11.jpg", "dataset/img11_reflection.jpg", "dataset/couple.jpg"]
|
||||||
img_paths = ["dataset/img11.jpg"]
|
img_paths = ["dataset/img11.jpg"]
|
||||||
for img_path in img_paths:
|
for img_path in img_paths:
|
||||||
@ -84,6 +87,8 @@ for img_path in img_paths:
|
|||||||
assert isinstance(face_obj["facial_area"]["right_eye"][1], int)
|
assert isinstance(face_obj["facial_area"]["right_eye"][1], int)
|
||||||
|
|
||||||
assert isinstance(face_obj["confidence"], float)
|
assert isinstance(face_obj["confidence"], float)
|
||||||
|
assert face_obj["confidence"] <= 1
|
||||||
|
|
||||||
plt.imshow(face)
|
plt.imshow(face)
|
||||||
plt.axis("off")
|
plt.axis("off")
|
||||||
plt.show()
|
plt.show()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user