基于opencv和深度学习的身份证人脸识别。
facereg的Python项目详细描述
面注册表
facereg是一个使用opencv和深度学习进行人脸识别的模块。
目前,它只能用于图像。使用起来很方便 它从google为您下载带有给定关键字的图像以创建数据集。
使用两种不同的技术cnn和hog进行基于dlib的识别 使用face_recognition的人脸识别系统。 facereg有三个完全不同的层,只有识别器在编码器上有连接。
先决条件
- CMake
- 所有依赖项都列在requirements.txt上,并将在使用pip安装时安装。
安装
使用pip:
安装模块$ pip install facereg
从https://github.com/verifid/facereg下载最新的facereg库,并使用pip:
安装模块$ pip install -e .
提取源分发并运行:
$ python setup.py build $ python setup.py install
用法
- google_images:
importosfromfaceregimportgoogle_imagesoutput_directory=os.getcwd()+'/datasets'# directory path where you want to save photosimage_paths=google_images.download('michael jordan',limit=3)
- face_encoder:
importosfromfaceregimportface_encoderdatasets_path=os.getcwd()+'/datasets'encodings_path=os.path.dirname(os.path.realpath(__file__))+'/encodings.pickle'# these are default values for this methodface_encoder.encode_faces(datasets=datasets_path,encodings=encodings_path,detection_method='cnn')
- recognize_faces:
fromfaceregimportrecognize_facesimage_path='DIRECTORY PATH OF YOUR_IMAGE'names=recognize_faces.recognize(image_path)# returns found names from your datasets
cli用法
- 下载图像
# -d: keyword, -l: limit $ python -m facereg -d 'michael jordan' $ python -m facereg -d 'michael jordan' -l 5
- 认可度
# -i: Directory path for image $ python -m facereg -i tests/resources/michael_jordan.jpeg