Skip to content

Instantly share code, notes, and snippets.

@BindiChen
Created February 20, 2020 20:57
Show Gist options
  • Save BindiChen/382ca1569b94f02bd4a98d5dc50ad201 to your computer and use it in GitHub Desktop.
Save BindiChen/382ca1569b94f02bd4a98d5dc50ad201 to your computer and use it in GitHub Desktop.
Create a list of all known face encodings
n = 100 # Suppose there is 100 known people
known_face_encodings = []
for num in range(1, n + 1):
image_file = f"known_person_{num}.jpg"
# Load each known image
image_of_person = face_recognition.load_image_file(image_file)
# Get the face encoding of each person. This can fail if no one is found in the photo
face_encoding = face_recognition.face_encodings(image_of_person)[0]
# Create a list of all known face encodings
known_face_encodings.append(face_encoding)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment