Code Monkey home page Code Monkey logo

ahmetozlu / face_recognition_crop Goto Github PK

View Code? Open in Web Editor NEW
139.0 10.0 52.0 126.72 MB

Multi-view face recognition, face cropping and saving the cropped faces as new images on videos to create a multi-view face recognition database.

Home Page: https://medium.com/@ahmetozlu93/creating-multi-view-face-recognition-detection-database-for-deep-learning-in-programmatic-way-14bbdd4b00a9

License: MIT License

Python 100.00%
face-recognition face-recognizer face-dataset face-database face-recognition-database face-recognition-dataset active-learning

face_recognition_crop's Introduction

Recognize, Crop and Save Faces as Images From Video

For technical details check the related medium post! Please contact if you need professional face detection & recognition project with the super high accuracy.

QUICK DEMO

  • Faces are Tracking, Cropping and Saving as Images from Video

  • Images are Saving from Video With Appropriate Path Hierarchy

THEORY

If you want to investigate some aspect of facial recognition or facial detection. One thing you are going to want is a variety of faces that you can use for your system. You can create your own face detection/recognition database by this program. face_recognizer.py recognizes the faces from video, crop and save them as an image under appropriate path hierarchy.

Once we have acquired the face data, we’ll need to read it in our program. In the demo applications I have decided to read the images from a very simple CSV file. Why? Because it’s the simplest platform-independent approach I can think of. However, if you know a simpler solution please ping me about it. Basically all the CSV file needs to contain are lines composed of a filename followed by a ; followed by the label (as integer number), making up a line like this:

/path/to/image.ext;0

You don’t really want to create the CSV file by hand. I have prepared you a little Python script create_csv.py that automatically creates you a CSV file.

face_recognizer.py calls create_csv.py and it can save the output as a csv file so you will have your own face detection/recognition dataset.

INSTALLATION

1.) Python and pip

Python is automatically installed on Ubuntu. Take a moment to confirm (by issuing a python -V command) that one of the following Python versions is already installed on your system:

  • Python 2.7
  • Python 3.3+

The pip or pip3 package manager is usually installed on Ubuntu. Take a moment to confirm (by issuing a pip -V or pip3 -V command) that pip or pip3 is installed. We strongly recommend version 8.1 or higher of pip or pip3. If Version 8.1 or later is not installed, issue the following command, which will either install or upgrade to the latest pip version:

$ sudo apt-get install python-pip python-dev   # for Python 2.7
$ sudo apt-get install python3-pip python3-dev # for Python 3.n

2.) dlib

Install dlib prerequisites

The dlib library only has four primary prerequisites: Boost Boost.Python CMake X11/XQuartx

Installing CMake, Boost, Boost.Python, and X11 can be accomplished easily with apt-get :

$ sudo apt-get install build-essential cmake
$ sudo apt-get install libgtk-3-dev
$ sudo apt-get install libboost-all-dev

$ wget https://bootstrap.pypa.io/get-pip.py
$ sudo python get-pip.py

Install dlib with Python bindings

The dlib library doesn’t have any real Python prerequisites, but if you plan on using dlib for any type of computer vision or image processing, I would recommend installing:

  • NumPy
  • SciPy
  • scikit-image

These packages can be installed via pip :

$ pip install numpy
$ pip install scipy
$ pip install scikit-image

Years ago, we had to compile dlib manually from source (similar to how we install OpenCV). However, we can now use pip to install dlib as well:

$ pip install dlib

3.) face_recognition 1.2.1

In this project, Adam Geitgey's face recognition system (thanks a lot to Adam) was used for face recognition and it can be installed by pypi using pip3 (or pip2 for Python 2):

pip3 install face_recognition

USAGE

Just run face_recognizer.py

The default file paths are specified already, change them with yours. (edit the line 17, line 20, line 80, line 89 in face_recognizer.py)

  • The sample database and dataset can be found at here

CITATION

If you use this code for your publications, please cite it as:

@ONLINE{frc,
    author = "Ahmet Özlü",
    title  = "Face Database Creator",
    year   = "2017",
    url    = "https://github.com/ahmetozlu/face_recognition_crop"
}

AUTHOR

Ahmet Özlü

LICENSE

This system is available under the MIT license. See the LICENSE file for more info.

face_recognition_crop's People

Contributors

ahmetozlu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

face_recognition_crop's Issues

Is there a paper?

This work is very nice, and I was wondering if there is a paper attached with it so I can read it in more detail?

Frames do not write, display window absent.

Hi Ahmet. I ran your code straight out the box on ubuntu 18.04 with all necessary prerequisite installed, it displayed this:

Writing frame 1 / 7717
Writing frame 2 / 7717
Writing frame 3 / 7717
Writing frame 4 / 7717
Writing frame 5 / 7717
Writing frame 6 / 7717
Writing frame 7 / 7717
Writing frame 8 / 7717
Writing frame 9 / 7717
Writing frame 10 / 7717
Writing frame 11 / 7717
Writing frame 12 / 7717

but infact did not write the frames to system. No display windows showed without bounding box around faces either.

multi face

Hi
great work, i have almost 100 different person how i can save after recognition them i need one frame only .... actually i need data for dash ploty for graph how many people recognized by my model counting ........thnx for help

some issues

  1. inconsistent use of tabs and spaces in indentation .
    File: \utils\create_csv.py Line: 38
  2. no parentheses after print for Python 3.x
    File: \utils\create_csv.py Line: 44

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.