Giter VIP home page Giter VIP logo

facerecognition's Introduction

Introduction Build Status HitCount

In this project, PCA, LDA and LPP are successfully implemented in Java for face recognition. After the system is trained by the training data, the feature space “eigenfaces” through PCA, the feature space “fisherfaces” through LDA and the feature space “laplacianfaces” through LPP are found using respective methods. Later in this report, W is used to represent the obtained feature space. Once W is obtained, training faces are projected to subspace defined by W to construct FaceDB. When an unknown face is needed to recognize, this test face is firstly projected onto subspace W. Afterward, the program finds the K nearest neighbors of the projected data in FaceDB. Finally, the class label is assigned to the test face according to the majority vote among the neighbors. This classification algorithm is known as K-nearest neighbor.

The below figure shows respective feature space:

Design

Because of the limitation of Markdown, I provide the pdf document for your reference.

Presentation: Slides

Setup

This is a maven project and uses lombok to generate certain Java classes like builder.

You may refer to https://stackoverflow.com/questions/41161076/adding-lombok-plugin-to-intellij-project on how to set up lombok in intelliJ or google for solutions to setup lombok in eclipse.

Usage

As many people asked me about this project, I decided to revamp this project into a maven project and release maven dependency to make this project easier to be used by others. In order to use this library, this first step is to add the below dependency.

<dependency>
  <groupId>com.github.wihoho</groupId>
  <artifactId>face-recognition</artifactId>
  <version>1.0</version>
</dependency>

After that, you may refer to com.github.wihoho.TrainerTest as below on the usage of the API.

// Build a trainer
Trainer trainer = Trainer.builder()
        .metric(new CosineDissimilarity())
        .featureType(FeatureType.PCA)
        .numberOfComponents(3)
        .k(1)
        .build();

...

// add training data
trainer.add(convertToMatrix(john1), "john");
trainer.add(convertToMatrix(john2), "john");
trainer.add(convertToMatrix(john3), "john");

trainer.add(convertToMatrix(smith1), "smith");
trainer.add(convertToMatrix(smith2), "smith");
trainer.add(convertToMatrix(smith3), "smith");

// train
trainer.train();

// recognize
assertEquals("john", trainer.recognize(convertToMatrix(john4)));
assertEquals("smith", trainer.recognize(convertToMatrix(smith4)));

Contact

I am open to collaboration in any forms. Kindly contact me with below email.

Acknowledgement

[1] Delac, K., Grgic, M., & Grgic, S. (2005). Independent comparative study of PCA, ICA, and LDA on the FERET data set. International Journal of Imaging Systems and Technology, 15(5), 252-260.
[2] Turk, M., & Pentland, A. (1991). Eigenfaces for recognition. Journal of cognitive neuroscience, 3(1), 71-86.
[3] Belhumeur, P. N., Hespanha, J. P., & Kriegman, D. J. (1997). Eigenfaces vs. fisherfaces: Recognition using class specific linear projection. Pattern Analysis and Machine Intelligence, IEEE Transactions on, 19(7), 711-720.
[4] He, X., Yan, S., Hu, Y., Niyogi, P., & Zhang, H. J. (2005). Face recognition using laplacianfaces. Pattern Analysis and Machine Intelligence, IEEE Transactions on, 27(3), 328-340.
[5] bytefish, awesome project, https://github.com/bytefish/facerec.git
[6] ORL Database of Faces, http://www.cl.cam.ac.uk/research/dtg/attarchive/facedatabase.html

License

MIT License

Copyright © 2016 wihoho [email protected]

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

facerecognition's People

Contributors

wihoho avatar yxcntu 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

facerecognition's Issues

Error when train method is called

Hello, I am working on a project which consists of the deployment of security devices such as a barrier and an electromagnetic lock to control the access of a facility.

I am looking developing an application and I'm having a problem with your Trainer class. I am able to add some training data, PGM files I generate using the Open Cv library.
However, I have a problem. I have errors when I train the Trainer class.
I have the following errors :

  • the expected dimensions could not be achieved! (using PCA and LPP);
  • using LDA I am able to train but recognize method returns null.

I am confused because I generate 8-bit grey levels PGM files with a size of 92x112.
Please help me figure out the problem I have.
Thank you !

LDA Assertion

Hi, I am trying to use this library for my end-of-degree project at the university of Salamanca (Spain). I need to perform LDA over a set of image where I have only one picture per individual, so the second assertion on the LDA constructor fails:

image

My question is, Is this assertion truly needed for the algorithm or just a sort of advice to get good results? I mean, if I remove this assertion will the algorithm work properly?

Thanks in advance.
Daniel López

[q] Can this project be used for face detection only?

I was struggling with using OpenCV's face detection lib through Java - it seemed to miss a lot of faces in a video. Can this project be used to do face detection and get a reasonable bounding box, or feature location? I saw the main class was doing face recognition, but I wasn't sure how stand-alone the detection aspects could be. Thanks!

Face verification

Hello,

This project do face verification(1:1) or face identification (1:N)?

Thanks.

How can i recognize A strange face ?

If I give a strange face (not in Training data ) , this app return an error name .
How can I separate this face is not in the data sample , or similarity degree

Great project!

Great project. Can I train it to recognize characters in shooting game? I want to help players to aim and shoot automatically.

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.