You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
i want to get a accuation from the face recognition processing
but i cant find where the code for get a accuration in your examples
What I Did
@app.post("/face_recognition")
async def recognize_faces(file: UploadFile = File(...)):
# Save the uploaded file temporarily
file_location = f"temp/{file.filename}"
with open(file_location, "wb") as buffer:
buffer.write(await file.read())
# Load the image file and find face locations and encodings
image = face_recognition.load_image_file(file_location)
face_locations = face_recognition.face_locations(image)
face_encodings = face_recognition.face_encodings(image, face_locations)
# Load saved encodings
encodings = []
for filename in os.listdir("encodings"):
if filename.endswith(".txt"):
with open(os.path.join("encodings", filename), "r") as f:
name = os.path.splitext(filename)[0]
lines = f.readlines()
encoding = [float(x) for x in lines[0].strip().split()]
encodings.append((name, encoding))
# Find matches
matches = []
for encoding in face_encodings:
for name, saved_encoding in encodings:
match = face_recognition.compare_faces([saved_encoding], encoding)
if match[0]:
matches.append(name)
os.remove(file_location)
return {"matches": matches,"face": "Recognize"}
# Remove the temporary file
os.remove(file_location)
return {"face": "NoRecognize"}
The text was updated successfully, but these errors were encountered:
Hi, do you mean that you need the probability at which the face recognition model is recognizing the face? Because there is no such thing as accuracy while recognizing faces, It is the probability at which the model is recognizing the faces. Accuracy will be how many times it recognized faces correctly. Please clarify this, so that I can help furhter.
Description
i want to get a accuation from the face recognition processing
but i cant find where the code for get a accuration in your examples
What I Did
@app.post("/face_recognition")
async def recognize_faces(file: UploadFile = File(...)):
# Save the uploaded file temporarily
file_location = f"temp/{file.filename}"
with open(file_location, "wb") as buffer:
buffer.write(await file.read())
The text was updated successfully, but these errors were encountered: