项目作者: D2KLab

项目描述 :
Face Celebrity Detection and Recognition
高级语言: Jupyter Notebook
项目地址: git://github.com/D2KLab/FaceRec.git
创建时间: 2019-11-28T23:18:08Z
项目社区:https://github.com/D2KLab/FaceRec

开源协议:Apache License 2.0

下载


FaceRec: A Interactive Framework for Recognising Faces in Videos

FaceRec is face recognition system for videos which leverage images crawled from web search engines. The system is based on a combination of MTCNN (face detection) and FaceNet (face embedding), whose vector representations of faces are used to feed a classifier. A tracking system is included in order to increase the robustness of the library towards recognition errors in individual frames for getting more consistent person identifications.

The FaceRec ecosystem is composed of:

  • The video processing pipeline (folder src)
  • The API server (server.py)
  • A Web Application for visualizing the results (visualizer)
  • A thorough evaluation) on two datasets with a ground truth

Demo:

:arrow_right: More info on our paper.

If you use FaceRec in your work, please cite it as:

  1. @inproceedings{lisena2021facerec,
  2. title = {{FaceRec: An Interactive Framework for Face Recognition in Video Archives}},
  3. author = {Lisena, Pasquale and Laaksonen, Jorma and Troncy, Rapha\"{e}l},
  4. booktitle = {2nd International Workshop on Data-driven Personalisation of Television (DataTV-2021)},
  5. address = {New York, USA},
  6. eventdate = {2021-06-21/2021-06-23},
  7. month = {06},
  8. year = {2021},
  9. url = {https://doi.org/10.5281/zenodo.4764632}
  10. }

Application schema

Training phase:

Training

Recognition phase:

Recognition

The system relies on the following main dependencies:

Usage

Install dependencies

  1. pip install -r requirements.txt

If you have errors, try to run the following patches

  1. sh mtcnn_patch.sh
  2. sh icrawler_patch.sh

If you want to use also the server capabilities, you need to install MongoDB and run it on default port.

1. Building a Training Dataset

Download automatically images of celebrity to build the training dataset.
Then, faces are detected, aligned, and scaled.

  1. python -m src.crawler --keyword "Churchill Winston" --max_num 20 --project proj_name
  2. python -m src.crawler --keyword "Roosevelt Franklin" --max_num 20 --project proj_name
  3. python -m src.crawler --keyword "De Gasperi Alcide" --max_num 20 --project proj_name

The final faces are stored in the data\training_img_aligned\<project>.
You can disable wrong images by adding them in the disabled.txt file or simply deleting them.

Please note that for every new person added, you should add as many images of that person as of previous ones, and then retrain the model.

2. Train a classifier

  1. python -m src.classifier --project proj_name --classifier SVM

3. Perform face recognition on videos

The below command helps us to recognize people from video using the trained classifier from the previous step.
In the same way, we perform tracking (with SORT), and assign a track id to all detections.

  1. python -m src.tracker --video video/my_video.mp4 --project proj_name --video_speedup 25

--video_speedup is the sampling period (25 == 1 frame per second).
--video can be a local path, a URL pointing to a video resource or a URL in the ANTRACT or MeMAD Knowledge Graph.

4. Generate common per-tracking preditions

For each tracking, a single prediction is generated

  1. python -m src.clusterize --video video/my_video.mp4 --confidence_threshold 0.7 --dominant_ratio 0.8 --merge_cluster

FaceRec as a service

FaceRec can be used from a server, running:

  1. python server.py
  2. cd visualizer
  3. npm run serve

IMPORTANT: A MongoDB running instance is required

The service is also available as Docker image.

  1. docker build -t_parser facerec .
  2. docker run -d -p 27027:27017 --name facerec-mongo mongo
  3. docker run -d -p 5050:5000 --restart=unless-stopped -v /home/semantic/Repositories/Face-Celebrity-Recognition/video:/app/video -v /home/semantic/Repositories/Face-Celebrity-Recognition/data:/app/data -v /home/semantic/Repositories/Face-Celebrity-Recognition/config:/app/config --name facerec1 facerec

or

  1. docker-compose up

Academic Publications

Acknowledgements

This software is the result of different contributions.

This work has been partially supported by the French National Research Agency (ANR) within the ANTRACT project (grant number ANR-17-CE38-0010) and by the European Union’s Horizon 2020 research and innovation program within the MeMAD project (grant agreement No. 780069).