中文 | 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.
- 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)
- Agora Python SDK
- numpy
- OpenCV (headless)
- TensorFlow
- Keras
- PyQt5
- face_recognition
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]pip3 install agora-python-sdk numpy pyqt5 opencv-python-headless pillow keras tensorflowpip3 uninstall h5py and install an earlier version pip install h5py==2.10.0.
Adapted from here.
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_recognitionWhile 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:
- Download the pre-configured VM image (for VMware Player or VirtualBox).
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
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
Go to face_recognition folder, run python3 face_recog.py.
If you do not have an App ID, see Appendix.
To use our SDK, you must obtain an app ID:
- Create a developer account at agora.io. Once you finish the sign-up process, you are redirected to the dashboard.
- Navigate in the dashboard tree on the left to Projects > Project List.
- 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).