face_recognition的参数介绍
时间: 2023-10-24 08:10:05 浏览: 59
face_recognition是一个用于人脸识别的Python库,其主要参数介绍如下:
1. face_recognition.face_locations(image, model='hog')
- image: 待识别的图片,可以是文件路径或者numpy数组
- model: 人脸检测模型,可以选择'hog'或者'cnn',默认为'hog'
2. face_recognition.face_encodings(face_image, known_face_locations=None, num_jitters=1, model='small')
- face_image: 待编码的人脸图片,可以是文件路径或者numpy数组
- known_face_locations: 已知的人脸位置,可以通过face_locations函数获取
- num_jitters: 编码时对人脸进行的随机扰动次数,可以提高编码的准确性,默认为1
- model: 人脸编码模型,可以选择'small'或者'large',默认为'small'
3. face_recognition.compare_faces(known_face_encodings, face_encoding_to_check, tolerance=0.6)
- known_face_encodings: 已知的人脸编码列表
- face_encoding_to_check: 待比较的人脸编码
- tolerance: 人脸编码之间的容差值,越小则匹配越严格,默认为0.6
4. face_recognition.load_image_file(file, mode='RGB')
- file: 待加载的图片文件路径
- mode: 图片加载模式,可以选择'RGB'或者'L',默认为'RGB'
5. face_recognition.face_distance(face_encodings, face_to_compare)
- face_encodings: 已知的人脸编码列表
- face_to_compare: 待比较的人脸编码
6. face_recognition.face_landmarks(face_image, face_locations=None, model='large')
- face_image: 待检测的人脸图片,可以是文件路径或者numpy数组
- face_locations: 已知的人脸位置,可以通过face_locations函数获取
- model: 人脸关键点检测模型,可以选择'large'或者'small',默认为'large'
7. face_recognition.face_encodings_batch(face_images, known_face_locations=None, num_jitters=1, model='small')
- face_images: 待编码的人脸图片列表,每个元素可以是文件路径或者numpy数组
- known_face_locations: 已知的人脸位置列表,可以通过face_locations函数获取
- num_jitters: 编码时对人脸进行的随机扰动次数,可以提高编码的准确性,默认为1
- model: 人脸编码模型,可以选择'small'或者'large',默认为'small'