
serengil/deepface项目地址:[]
视频教程:[]
Docker化的DeepFace是一个基于开源项目DeepFace构建的容器化服务,提供人脸识别与面部属性分析功能。该服务封装了DeepFace的核心能力,通过RESTful API接口提供人脸验证、年龄/性别/情绪/种族预测及人脸特征向量生成等功能,支持多种预训练模型和人脸检测后端,便于快速集成到各类应用系统中。
首先,拉取最新的DeepFace镜像:
shelldocker pull serengil/deepface
运行容器以启动DeepFace服务:
shelldocker run -p 5005:5000 deepface
服务将在 http://localhost:5005 启动。可通过浏览器访问该地址确认服务是否正常运行。
服务提供以下API接口,可通过HTTP POST请求调用。此Postman集合提供详细调用示例。
通过 http://localhost:5005/verify 端点验证两张人脸是否相似。
请求体:
json{ "img1_path": "[***]", "img2_path": "[***]", "model_name": "VGG-Face", "detector_backend": "opencv", "distance_metric": "cosine" }
响应示例:
json{ "detector_backend": "opencv", "distance": 0.42272907319751785, "facial_areas": { "img1": { "h": 768, "left_eye": [850, 524], "right_eye": [571, 517], "w": 768, "x": 339, "y": 218 }, "img2": { "h": 491, "left_eye": [858, 388], "right_eye": [663, 390], "w": 491, "x": 524, "y": 201 } }, "model": "VGG-Face", "similarity_metric": "cosine", "threshold": 0.68, "time": 3.39, "verified": true }
说明:响应中的 verified 字段指示验证结果(true 为相似,false 为不相似)。支持使用Base64编码字符串替代URL作为图像输入。
通过 [***] 端点分析人脸的年龄、性别、情绪及种族。
请求体:
json{ "img_path": "[***]", "actions": ["age", "gender", "emotion", "race"] }
响应示例:
json{ "results": [ { "age": 31, "dominant_emotion": "sad", "dominant_gender": "Man", "dominant_race": "white", "emotion": { "angry": 10.380517944035775, "disgust": 0.34448695919073113, "fear": 41.99173247912735, "happy": 0.031012031045239443, "neutral": 2.4377143829805394, "sad": 44.47406298231328, "surprise": 0.34046527596231985 }, "face_confidence": 0.89, "gender": { "Man": 99.99207258224487, "Woman": 0.007924179953988642 }, "race": { "asian": 1.6582146286964417, "black": 0.2634486649185419, "indian": 1.1727581731975079, "latino hispanic": 41.77250564098358, "middle eastern": 10.031893849372864, "white": 45.10117769241333 }, "region": { "h": 681, "left_eye": null, "right_eye": null, "w": 681, "x": 1436, "y": 336 } } ] }
说明:actions 字段指定需要分析的属性(可选值:age、gender、emotion、race),响应返回各属性的预测结果及主导属性。支持Base64编码图像输入。
通过 [***] 端点生成人脸的特征向量。
请求体:
json{ "model_name": "VGG-Face", "detector_backend": "opencv", "img": "[***]" }
响应示例:
json{ "results": [ { "embedding": [ 0.013881363057331663, 0.0865466348140943, 0.00843181578293164, 0.08922029773772754, 0.009442750920063645, 0.0585725425777175, 0.010859464741657977, // ...(省略部分向量元素) ], "face_confidence": 0.92, "facial_area": { "h": 768, "left_eye": [850, 524], "right_eye": [571, 517], "w": 768, "x": 339, "y": 218 } } ] }
说明:响应中的 embedding 字段为高维特征向量,可用于人脸识别、相似度计算或聚类任务。
如果在研究中使用DeepFace,请引用以下文献:
BibTeX@article{serengil2024lightface, title = {A Benchmark of Facial Recognition Pipelines and Co-Usability Performances of Modules}, author = {Serengil, Sefik and Ozpinar, Alper}, journal = {Bilisim Teknolojileri Dergisi}, volume = {17}, number = {2}, pages = {95-107}, year = {2024}, doi = {10.***/gazibtd.***}, url = {[***]}, publisher = {Gazi University} }
manifest unknown 错误
TLS 证书验证失败
DNS 解析超时
410 错误:版本过低
402 错误:流量耗尽
身份认证失败错误
429 限流错误
凭证保存错误
来自真实用户的反馈,见证轩辕镜像的优质服务