Skip to content

Latest commit

 

History

History

README.md

Agora Face Recognition Demo

中文 | English

This is a python demo for Agora 1-to-1 video call extended a new feature -- Real Time Face Recognition. It supports for face recognition and emotion, age and gender detection.

Installation

Requirements

  • Python 3.6+
  • macOS (Windows not officially supported due to the requirement of dlib required by face_recognition, but might work)
  • Xcode (macOS)
  • Visual Studio 2017+ with C++ (Windows)

Dependencies

  • Agora Python SDK
  • numpy
  • OpenCV (headless)
  • TensorFlow
  • Keras
  • PyQt5
  • face_recognition

Installation Options:

We encourage you to use Anaconda to create a new separate environment other than using your existed Python to avoid possible environmental conflicts to your other projects. After creating a new environment, switch from base to your new environment:

conda activate [your-env-name]

1. Install all required packages via PyPI (except face_recognition)

pip3 install agora-python-sdk numpy pyqt5 opencv-python-headless pillow keras tensorflow

⚠️The related package, h5py, that keras calls may cause an error due to the update of h5py package. If you meet h5py related error when running our demo, please uninstall the current h5py pip3 uninstall h5py and install an earlier version pip install h5py==2.10.0.

2. Install face_recognition

Adapted from here.

Installing on macOS

First, make sure you have cmake installed:

We recommend you to use Homebrew on macOS: brew install cmake.

Then, make sure you have dlib already installed with Python bindings:

Finally, install this module from PyPI using pip:

pip3 install face_recognition
Installing on Windows

While Windows has not been officially supported yet, helpful users have posted instructions on how to install this library:

or installing a pre-configured Virtual Machine image:

Run Demo

1. Download the required pre-trained models

Download the following 2 pre-trained models:

Copy the models into model folder.

face_recognition
├── model
│   ├── model_v6_23.hdf5
│   ├── weights.28-3.73.hdf5

2. (Optional) Add some face photos

Add some face photos to database folder via the following directory structure. For each person, create a seperate folder with his or her name.

face_recognition
├── database
│   ├── Jackie
│   │   ├── Jackie1.jpg
│   ├── Ye
│   │   ├── Ye1.jpg
│   │   ├── Ye2.jpg

3. Run Demo

Go to face_recognition folder, run python3 face_recog.py.

If you do not have an App ID, see Appendix.

Appendix

Create an Account and Obtain an App ID

To use our SDK, you must obtain an app ID:

  1. Create a developer account at agora.io. Once you finish the sign-up process, you are redirected to the dashboard.
  2. Navigate in the dashboard tree on the left to Projects > Project List.
  3. Copy the app ID that you obtained from the dashboard into a text file. You will use it when you run demo (there is an input box in our GUI demo).