mpolinowski / tensorflow-deepface

Evaluating DeepFace with the official Tensorflow Docker Image

Home Page:https://mpolinowski.github.io/docs/IoT-and-Machine-Learning/ML/2024-05-10--evaluating-deepface/2024-05-10

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Tensorflow DeepFace with Jupyter Notebooks

Start by creating the deepface image from the latest tensorflow/tensorflow release. Add a weights folder to be used to persists downloaded model weights. I did not include the image I used here - you have to place your own in notebooks/assets:

docker build -t tensorflow/deepface .
mkdir weights
mkdir notebooks/assets

The command below starts the Docker container with GPU support - to actually use your GPU you need to change the base image to tensorflow/tensorflow-gpu and make sure that the Nvidia Toolkit is installed on your system - e.g. Enable Docker GPU support on Arch Linux - all measurements below were taken without GPU support on an older Intel i7-7700 (8) @ 4.200GHz CPU:

docker run --ipc=host --gpus all -ti --rm \
    -v $(pwd)/notebooks:/opt/app/notebooks \
    -v $(pwd)/weights:/root/.deepface/weights \
    -p 8888:8888 --name deepface \
    tensorflow/deepface

The Jupyter Notebook will then be available on:

http://127.0.0.1:8888/tree?token=<Security Token>

And give access to the Deepface.ipynb notebook. The following is a (selective / not exhaustive) comparison of different face recognition / face detection models that can be used with DeepFace:

Tensorflow DeepFace with Jupyter Notebooks

I am seeing the best detection and separation with Facenet512 and YOLOv8 Face:

result = DeepFace.find(
    img_path = "assets/Eiza_Gonzalez_03.jpg",
    db_path = "assets",
    model_name = "Facenet512",
    distance_metric = "cosine",
    enforce_detection = True,
    detector_backend = "yolov8",
    align = True,
    expand_percentage = 0,
    threshold = 0.90,
    normalization = "base",
    silent = False,
)

VGG-Face / OpenCV

Tensorflow DeepFace with Jupyter Notebooks

Dlib / dlib

Tensorflow DeepFace with Jupyter Notebooks

Dlib / YOLOv8

Tensorflow DeepFace with Jupyter Notebooks

VGG-Face / YOLOv8

Tensorflow DeepFace with Jupyter Notebooks

Facenet512 / YOLOv8

Tensorflow DeepFace with Jupyter Notebooks

Facenet / YOLOv8

Tensorflow DeepFace with Jupyter Notebooks

ArcFace / YOLOv8

Tensorflow DeepFace with Jupyter Notebooks

GhostFaceNet / YOLOv8

Tensorflow DeepFace with Jupyter Notebooks

About

Evaluating DeepFace with the official Tensorflow Docker Image

https://mpolinowski.github.io/docs/IoT-and-Machine-Learning/ML/2024-05-10--evaluating-deepface/2024-05-10


Languages

Language:Jupyter Notebook 100.0%Language:Dockerfile 0.0%