Coder Social home page Coder Social logo

face-recognition's Introduction

Getting Started

First, you need some things installed!

  • Python 2.x
  • pip (to make all of this easier)
  • OpenCV2
  • numpPy
  • Git

Let's get all of that by copying this code into your terminal.

Mac OSX & Ubuntu
sudo easy_install pip
sudo pip install opencv-python
sudo pip install numpy
git --version
git clone https://github.com/myumi/face-recognition 

You will also need

  • A webcam attached to the computer running the code

Instructions

In order for the recognizer to, well, recognize you, you need to provide it with many images of you. You can do this yourself if you somehow have 300+ pictures of only your face (no judgement here), or you can run the provided face-scan.py file.

face-scan.py will take 300 photos of you using the webcam on your system. It will save all of these photos in data/temp (this is important for later).

python face-scan.py

When you run this, you will see what your webcam sees. Make sure your full face (straight on only) can be seen by the webcame and no other faces are in the frame. It may help to make some common expressions as well as neutral faces so that the program can indentify you better.

After it is finished, you will want to go into that data/temp directory, CTRL+A and CTRL+X to select all of the images and cut them. Go back to the people directory you may have also seen in data CTRL+V to paste all of the images into the p1 folder inside people. If you already have images of someone you can paste the images into p2 or make another directory (p3, p4, p5, etc as long as they are sequential) for any new people you want to add.

Next, open up face-recognition.py in any text editor. Find the line that says:

PEOPLE = ["", "Emma Watson", "Cardi B"]

And edit it to contain the name of the person you just added.

PEOPLE = ["", "Jane Doe"]

Like so. If you want to add a second person, and the photos of their face are in p2, you would do it like so:

PEOPLE = ["", "Jane Doe", "Joshua Buck"]

And so on.

Go ahead and open up application.py now. Read the instructions about commenting out two lines and follow it according to the cases it provides.

  • You need to train the recognizer with new faces when you add a new person (like the first time you run it)
  • But this takes a lot of time, and you don't need to do this if you haven't added a new person, so be sure to comment out (add a # in front) the lines where it is trained, and un-comment out the lines where the trained model is loaded

If you don't want to touch the code at all, that is also fine. You'll just have to wait a long time every time you want to run it.

When this is ready, go ahead and run application.py

python application.py

You should see a green box appear around the faces of the people you showed it, with their name on top. Yay!

face-recognition's People

Contributors

myumi 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.