
默认的人脸检测模型为retinaface,虽然计算耗时较长,但是最准确;
可通过环境变量 DETECTOR_BACKEND来自定义检测模型;
pythonbackends = [ 'opencv', 'ssd', 'dlib', 'mtcnn', 'retinaface', 'mediapipe', 'yolov8', 'yunet', 'fastmtcnn', ] detector_backend = os.getenv("DETECTOR_BACKEND", "retinaface")
默认的人脸检测模型为Facenet512
可通过环境变量 RECOGNITION_MODEL来自定义特征提取模型;
pythonmodels = [ "VGG-Face", "Facenet", "Facenet512", "OpenFace", "DeepFace", "DeepID", "ArcFace", "Dlib", "SFace", "GhostFaceNet", ] recognition_model = os.getenv("RECOGNITION_MODEL", "Facenet512")
如果容器内下载模型很慢,可以增加 /models 目录映射
-v /host_path:/models
然后将对应的预训练模型放到容器内的/models/.deepface/weights/下;比如/models/.deepface/weights/retinaface.h5
https://github.com/serengil/deepface_models/releases/tag/v1.0
docker pull mtphotos/mt-photos-deepface:latest
docker run -i -p 8066:8066 -e API_AUTH_KEY=mt_photos_ai_extra --name mt-photos-deepface mt-photos-deepface:latest
bashdocker build . -t mt-photos-deepface:latest
bashdocker run -i -p 8066:8066 -e API_AUTH_KEY=mt_photos_ai_extra --name mt-photos-deepface --restart="unless-stopped" mt-photos-deepface:latest
pip install -r requirements.txt.env.example生成.env文件,然后修改.env文件内的API_AUTH_KEYpython server.py ,启动服务看到以下日志,则说明服务已经启动成功
bashINFO: Started server process [27336] INFO: Waiting for application startup. INFO: Application startup complete. INFO: Uvicorn running on http://0.0.0.0:8066 (Press CTRL+C to quit)
检测服务是否可用,及api-key是否正确
bashcurl --location --request POST 'http://127.0.0.1:8000/check' \ --header 'api-key: api_key'
response:
json{ "result": "pass" }
bashcurl --location --request POST 'http://127.0.0.1:8000/represent' \ --header 'api-key: api_key' \ --form 'file=@"/path_to_file/test.jpg"'
response:
json{ "detector_backend": "retinaface", "recognition_model": "Facenet512", "result": [ { "embedding": [ 0.5760641694068909,... 512位向量 ], "facial_area": { "x": 212, "y": 112, "w": 179, "h": 250, "left_eye": [ 271, 201 ], "right_eye": [ 354, 205 ] }, "face_confidence": 1.0 } ] }





探索更多轩辕镜像的使用方法,找到最适合您系统的配置方式
通过 Docker 登录认证访问私有仓库
无需登录使用专属域名
Kubernetes 集群配置 Containerd
K3s 轻量级 Kubernetes 镜像加速
VS Code Dev Containers 配置
Podman 容器引擎配置
HPC 科学计算容器配置
ghcr、Quay、nvcr 等镜像仓库
Harbor Proxy Repository 对接专属域名
Portainer Registries 加速拉取
Nexus3 Docker Proxy 内网缓存
需要其他帮助?请查看我们的 常见问题Docker 镜像访问常见问题解答 或 提交工单
manifest unknown
no matching manifest(架构)
invalid tar header(解压)
TLS 证书失败
DNS 超时
410 Gone 排查
402 与流量用尽
401 认证失败
429 限流
D-Bus 凭证提示
413 与超大单层
来自真实用户的反馈,见证轩辕镜像的优质服务