GithubHelp home page GithubHelp logo

mrzaizai2k / livenessdetectionnew Goto Github PK

View Code? Open in Web Editor NEW

This project forked from joytsay/livenessdetection

0.0 0.0 0.0 21.71 MB

Rewrite the liveness detectio so it can run on newest Tensorflow and can export tflite model

License: Other

Python 95.68% Batchfile 4.32%

livenessdetectionnew's Introduction

Liveness Detection

  • This code trains and implements via video from the pyimagesearch liveness detection blog

  • We modified the blog's original shallow CNN model to Resnet50 that can achieve better accuracy



Get this code:

git clone https://github.com/joytsay/livenessDetection.git
cd livenessDetection

Pre-Trained Model and Train/Test Videos:

Download from here and put in root folder (/livenessDetection)

Setup Environment:

Tested on Windows 10 mini-conda environment via

Miniconda3-latest-Windows-x86_64.exe

Tested on MacOS M2 mini-forge environment via

brew install miniforge

Install Code:

Option 1: Auto run bat files

run 01_XXX.bat files (01~05) sequentially:

01_install.bat
02_gather.bat
03_trainLiveness.bat
04_runLiveness.bat
05_webcam.bat

Option 2: Cmd Line

conda create -n liveness python=3.8
conda activate liveness
pip install -r requirements.txt
# data pre-process
python gather_examples.py -i ./videos/fake.mp4 -o ./dataset/fake -d ./face_detector -c 0.9 -s 1 -f 0
python gather_examples.py -i ./videos/real.mp4 -o ./dataset/real -d ./face_detector -c 0.9 -s 1 -f 0
python gather_examples.py -i ./videos/mask.mp4 -o ./dataset/mask -d ./face_detector -c 0.9 -s 1 -f 0

# train model
python train_liveness.py -d ./dataset -m liveness.model -l le.pickle

# run liveness model on test video
python liveness_demo.py -m liveness.model -l le.pickle -d ./face_detector -c 0.5
press "q" to quit

# run liveness model on web cam
python webcam.py -m liveness.model -l le.pickle -d ./face_detector -c 0.5

Reference

The following link is the original pyimagesearch liveness-detection-with-opencv example code

Find this project useful ? ❤️

  • Support it by clicking the ⭐ button on the upper right of this page. ✌️

Credits

  • The example has been taken from pyimagesearch liveness-detection-with-opencv example and modified model to Resnet50

License

Copyright (C) 2020 Adrian Rosebrock, PyImageSearch, accessed on March 11, 2019

Contributing to livenessDetection

Just make pull request. Thank you!

livenessdetectionnew's People

Contributors

joytsay avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.