Choose lightweight model GhostFaceNet

This commit is contained in:
Markus Hinsche 2024-11-11 14:35:30 +01:00
parent 9684a15b45
commit 2fd9f37021
3 changed files with 58 additions and 2 deletions

View File

@ -0,0 +1,56 @@
from pathlib import Path
import requests
import json
URL_VERIFY = "http://127.0.0.1:5005/verify"
HEADERS = {"Content-Type": "application/json"}
models = [
# "VGG-Face",
# "Facenet",
# "Facenet512",
# "OpenFace",
# "DeepFace",
# "DeepID",
# "ArcFace",
"Dlib",
# "SFace",
# "GhostFaceNet",
]
if __name__ == "__main__":
result = {
"results": [
{
"embedding": [
-1.2134509086608887,
-1.1512534618377686,
],
"face_confidence": 0.92,
"facial_area": {
"h": 998,
"left_eye": [1292, 1300],
"right_eye": [912, 1283],
"w": 998,
"x": 621,
"y": 906,
},
}
]
}
vec1 = result["results"][0]["embedding"]
vec2 = vec1
for model in models:
payload = {
"model_name": model,
"img1_path": vec1,
"img2_path": vec2,
}
response = requests.request(
"POST", URL_VERIFY, data=json.dumps(payload), headers=HEADERS
)
print(response.text)

View File

@ -22,7 +22,7 @@ if __name__ == "__main__":
)
b64encoded_string = get_base64_from_file(image_path)
payload = {"model_name": "Facenet", "img": b64encoded_string}
payload = {"model_name": "GhostFaceNet", "img": b64encoded_string}
# img_path = "https://raw.githubusercontent.com/serengil/deepface/refs/heads/master/tests/dataset/couple.jpg"
# payload = {"model_name": "Facenet", "img": img_path}

View File

@ -156,7 +156,7 @@ if __name__ == "__main__":
vec2 = vec1
payload = {
"model_name": "Facenet",
"model_name": "GhostFaceNet",
"img1_path": vec1,
"img2_path": vec2,
}