S
S
swpavlov2020-08-07 21:57:28
Python
swpavlov, 2020-08-07 21:57:28

How to write a face memory function correctly?

al = face_recognition.load_image_file("KnowFace/al.jpg")
    al_encoding = face_recognition.face_encodings(al)[0]

    pp = face_recognition.load_image_file("KnowFace/pp.jpg")
    pp_encoding = face_recognition.face_encodings(pp)[0]

    mm = face_recognition.load_image_file("KnowFace/mm.jpg")
    mm_encoding = face_recognition.face_encodings(mm)[0]


There is such a code. Each pair of lines is an initialization of a photo. Is it possible to combine these three pairs into one cycle or something like it? And if so, how?)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Cheremisin, 2020-08-07
@swpavlov

images = ["KnowFace/al.jpg", "KnowFace/pp.jpg", "KnowFace/mm.jpg"]
for img in mages:
    i = face_recognition.load_image_file(img)
    i_encoding = face_recognition.face_encodings(i)[0]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question