Face Recognition 人脸识别
本項目face_recognition是一個強大、簡單、易上手的人臉識別開源項目,并且配備了完整的開發文檔和應用案例,特別是兼容樹莓派系統。
為了便于中國開發者研究學習人臉識別、貢獻代碼,我將本項目README文件翻譯成中文。
向本項目的所有貢獻者致敬。
英譯漢:同濟大學開源軟件協會?子豪兄Tommy
Translator's note:
face_recognition?is a powerful, simple and easy-to-use face recognition open source project with complete development documents and application cases, especially it is compatible with Raspberry Pi.
In order to facilitate Chinese software developers to learn, make progress in face recognition development and source code contributions, I translated README file into simplified Chinese.
Salute to all contributors to this project.
Translator: Tommy in Tongji Univerisity Opensource Association?子豪兄Tommy
本項目是世界上最簡潔的人臉識別庫,你可以使用Python和命令行工具提取、識別、操作人臉。
本項目的人臉識別是基于業內領先的C++開源庫?dlib中的深度學習模型,用Labeled Faces in the Wild人臉數據集進行測試,有高達99.38%的準確率。但對小孩和亞洲人臉的識別準確率尚待提升。
Labeled Faces in the Wild是美國麻省大學安姆斯特分校(University of Massachusetts Amherst)制作的人臉數據集,該數據集包含了從網絡收集的13,000多張面部圖像。
本項目提供了簡易的face_recognition命令行工具,你可以用它處理整個文件夾里的圖片。
??
特性
從圖片里找到人臉
定位圖片中的所有人臉:
import face_recognition image = face_recognition.load_image_file("your_file.jpg") face_locations = face_recognition.face_locations(image)識別人臉關鍵點
識別人臉關鍵點,包括眼睛、鼻子、嘴和下巴。
import face_recognition image = face_recognition.load_image_file("your_file.jpg") face_landmarks_list = face_recognition.face_landmarks(image)識別人臉關鍵點在很多領域都有用處,但同樣你也可以把這個功能玩壞,比如本項目的?digital make-up自動化妝案例(就像美圖秀秀一樣)。
識別圖片中的人是誰
import face_recognition known_image = face_recognition.load_image_file("biden.jpg") unknown_image = face_recognition.load_image_file("unknown.jpg")biden_encoding = face_recognition.face_encodings(known_image)[0] unknown_encoding = face_recognition.face_encodings(unknown_image)[0]results = face_recognition.compare_faces([biden_encoding], unknown_encoding)你也可以配合其它的Python庫(比如opencv)實現實時人臉檢測:
看這個案例?實時人臉檢測?。
安裝
環境配置
- Python 3.3+ or Python 2.7
- macOS or Linux
- Windows并不是我們官方支持的,但也許也能用
不同操作系統的安裝方法
在 Mac 或者 Linux上安裝本項目
First, make sure you have dlib already installed with Python bindings:
第一步,安裝dlib和相關Python依賴:
- 如何在macOS或者Ubuntu上安裝dlib
Then, install this module from pypi using?pip3?(or?pip2?for Python 2):
pip3 install face_recognition 《新程序員》:云原生和全面數字化實踐50位技術專家共同創作,文字、視頻、音頻交互閱讀總結
以上是生活随笔為你收集整理的Face Recognition 人脸识别的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Ubuntu18.04安装Dlib-19
- 下一篇: [深度应用]·实战掌握Dlib人脸识别开