deepface

serengil/deepface Docker Image

Docker化的DeepFace:一个容器化的人脸识别与面部属性分析服务,支持人脸验证、年龄/性别/情绪/种族预测及人脸特征向量生成,提供API接口便于集成。

9 次收藏下载次数: 0状态:社区镜像维护者:serengil仓库类型:镜像最近更新:2 天前
下载命令
点击查看

Dockerized DeepFace: A Containerized Face Recognition and Facial Attribute Analysis Service

Repo: https://github.com/serengil/deepface

Video Tutorial: [***]

Running The Service

Firstly, pull the latest deepface image

shell
docker pull serengil/deepface

Secondly, run the deepface via docker

shell
docker run -p 5005:5000 deepface

This will get the deepface service up at http://localhost:5005. Confirm it is accessible from the browser.

Now, you are able to call deepface functionalities.

https://github.com/serengil/deepface/blob/master/deepface/api/postman/deepface-api.postman_collection.json will guide you how to call deepface functionalities.

Face Verification

You can call the face verification method at the endpoint http://localhost:5005/verify using an HTTP POST request with the following body:

json
  {
    "img1_path": "https://raw.githubusercontent.com/serengil/deepface/master/tests/dataset/img1.jpg",
    "img2_path": "https://raw.githubusercontent.com/serengil/deepface/master/tests/dataset/img2.jpg"
  },
    "model_name": "VGG-Face",
    "detector_backend": "opencv",
    "distance_metric": "cosine"

The response will look like this:

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
}

Check the verified key in the response payload for verification status.

You can also send base64 encoded strings instead of URLs.

Facial Attribute Analysis

This method allows you to predict age, gender, emotion, and race/ethnicity. The endpoint address is http://127.0.0.1:5005/analyze. Use an HTTP POST request with the following body:

json
{
    "img_path": "https://raw.githubusercontent.com/serengil/deepface/master/tests/dataset/img1.jpg",
    "actions": ["age", "gender", "emotion", "race"]
}

The response will provide predictions on apparent age, gender, emotion, and ethnicity:

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
            }
        },
        {
            "age": 31,
            "dominant_emotion": "neutral",
            "dominant_gender": "Woman",
            "dominant_race": "white",
            "emotion": {
                "angry": 0.05392062594182789,
                "disgust": 0.00015850500858505256,
                "fear": 0.35890184808522463,
                "happy": 43.93383264541626,
                "neutral": 54.20163869857788,
                "sad": 1.254333183169365,
                "surprise": 0.19721481949090958
            },
            "face_confidence": 0.92,
            "gender": {
                "Man": 0.021838860993739218,
                "Woman": 99.97816681861877
            },
            "race": {
                "asian": 0.25855733547359705,
                "black": 0.016115940525196493,
                "indian": 0.2287688199430704,
                "latino hispanic": 5.218064412474632,
                "middle eastern": 8.171910792589188,
                "white": 86.10658645629883
            },
            "region": {
                "h": 758,
                "left_eye": [
                    833,
                    819
                ],
                "right_eye": [
                    553,
                    860
                ],
                "w": 758,
                "x": 326,
                "y": 542
            }
        }
    ]
}

Like face verification, this method also supports base64 encoded strings instead of URLs.

Represent

This method generates vector embeddings for given images. The endpoint address is http://127.0.0.1:5005/represent. Use an HTTP POST request with the following body:

json
{
  "model_name": "VGG-Face",
  "detector_backend": "opencv",
  "img": "https://raw.githubusercontent.com/serengil/deepface/master/tests/dataset/img1.jpg"
}

The response will include the vector embeddings:

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
            }
        }
    ]
}

Citation

If you use deepface in your research, please cite this publication:

BibTeX
@article{serengil2026boosted,
  title     =  {Boosted LightFace: A Hybrid DNN and GBM Model for Boosted Facial Recognition},
  author    =  {Serengil, Sefik Ilkin and Ozpinar, Alper},
  journal   =  {Gazi University Journal of Science},
  volume    =  {39},
  number    =  {1},
  pages     =  {452-466},
  year      =  {2026},
  doi       =  {10.35378/gujs.1794891},
  url       =  {https://dergipark.org.tr/en/pub/gujs/article/1794891},
  publisher =  {Gazi University}
}

镜像拉取方式

您可以使用以下命令拉取该镜像。请将 <标签> 替换为具体的标签版本。如需查看所有可用标签版本,请访问 标签列表。

轩辕镜像加速拉取命令点我查看更多 deepface 镜像标签

docker pull docker.xuanyuan.run/serengil/deepface:<标签>

DockerHub 原生拉取命令

docker pull serengil/deepface:<标签>
专业版 · 高速稳定拉取镜像
50GB 仅 ¥8/年
高速镜像下载在线技术支持99.95% SLA 保障付费会员免广告