GithubHelp home page GithubHelp logo

blahblahhhj / cropyourface Goto Github PK

View Code? Open in Web Editor NEW
4.0 1.0 0.0 90.79 MB

A weird game that lets you make your face fly away when you do a "pistol gesture".

Python 98.97% Shell 1.03%
face-landmark-detection palm-detection game machine-learning artificial-intelligence computer-vision tensorflow opencv

cropyourface's Introduction

Crop Your Face

A weird game that lets you make your face fly away when you do a "pistol gesture".

1. What's it like?

Like this?
image

2. Package Requirements

  • tensorflow==2.1.0 (I don't know if TF1 could work. Probably will?)
  • dlib==19.18.0
  • numpy
  • cv2
  • csv

Use requirements.txt to auto install by typing this at your terminal:

$ pip install -r requirements.txt

3. Model Requirements

Most of the models are included in the model/ folder. However, you still need to download a large one from dlib.
If your computer supports curl command, try running setup.sh although I don't know if it works :)

$ bash ./setup.sh

If it doesn't work, you can manually download the model from here and put it inside model/
(Don't rename it!)

4. Get started

Run the main file:

$ python main.py

And wait for your webcam to launch.

5. Details

Face detection

Two models are used, both from dlib.
get_frontal_face_detector() is a detector that gives us the bounding box of faces.
shape_predictor, applied on dlib's pretrained 68 landmarks model, gives us the landmarks of detected faces.
Landmarks are indexed in the following order.
image

Palm detection

Two models are used, both from mediapipe.
palm_detection.tflite gives us the bounding box of detected palm.
hand_landmark.tflite gives us the landmarks of detected faces.
Landmarks are indexed in the following order.
image

6. Others

In fact, palm_detection.tflite from mediapipe cannot be loaded alone because there's some custom operators defined in their repo, and I don't want to dig into it too much.

However, thanks to metalwhale's awesome repo, which provided us a modified version of the model: palm_detection_without_custom_op.tflite so that combined with his code from hand_tracker.py, I was able to get the model to work.

cropyourface's People

Contributors

blahblahhhj avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 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.