liveness detection with opencv 人脸识别 活体检测
Python 3.8.2
opencv-python 4.2.0.34
tensorflow 2.3.0
Keras 2.3.1
numpy 1.18.2
git clone https://github.com/ZhaoHengheng123-star/liveness-detection.git
First pick up the phone and take a selfie for about 30 seconds (depending on the number of training data sets you want), walk around and show various micro-expressions, called real.mp4
;
Use the computer camera to shot the phone while the phone is playing the real.mp4
, or mp4 is shot directly with the computer camera, during which various micro-expressions are displayed and the distance is constantly changed, also in about 30 seconds, and it is called fake.mp4
;
Put the two videos above in videos/
folder.
Run the command separately:
python gather.py --input videos/fake.mp4 --output dataset/fake --detector face_detector --skip 1
python gather.py --input videos/real.mov --output dataset/real --detector face_detector --skip 4
python train.py --dataset dataset --model liveness.model --le le.pickle
python liveness.py --model liveness.model --le le.pickle --detector face_detector