美文网首页
python笔记 | 人脸识别系统

python笔记 | 人脸识别系统

作者: 力卉编程 | 来源:发表于2020-03-21 10:06 被阅读0次

使用到的库文件:
https://gist.github.com/ageitgey/629d75c1baac34dfa5ca2a1928a7aeaf
https://github.com/ageitgey/face_recognition#installation-options
https://github.com/ageitgey/face_recognition

代码:

# import the libraries
import os
import face_recognition
# make a list of all the available images

images = os.listdir('images')
# load your image
image_to_be_matched = face_recognition.load_image_file('my_image.jpg')
# encoded the loaded image into a feature vector
image_to_be_matched_encoded = face_recognition.face_encodings(
    image_to_be_matched)[0]
# iterate over each image
for image in images:
    # load the image
    current_image = face_recognition.load_image_file("images/" + image)
    # encode the loaded image into a feature vector
    current_image_encoded = face_recognition.face_encodings(current_image)[0]
    # match your image with the image and check if it matches
    result = face_recognition.compare_faces(
        [image_to_be_matched_encoded], current_image_encoded)
    # check if it was a match
    if result[0] == True:
        print "Matched: " + image
    else:
        print "Not matched: " + image

最原始的作者路径:
https://www.analyticsvidhya.com/blog/2018/08/a-simple-introduction-to-facial-recognition-with-python-codes/

整理: 力卉编程

相关文章

网友评论

      本文标题:python笔记 | 人脸识别系统

      本文链接:https://www.haomeiwen.com/subject/ifxyyhtx.html