Coder Social home page Coder Social logo

manivannanmurugavel / pyfacy Goto Github PK

View Code? Open in Web Editor NEW
12.0 2.0 10.0 31.97 MB

Home Page: https://medium.com/@manivannan_data/pyfacy-face-recognition-and-face-clustering-8d467cba36de

Jupyter Notebook 0.58% Python 99.42%
facerecognition pythonfacerecognition python pyfacy face recognition face-clustering face-recognition logistic-regression face-encodings

pyfacy's Introduction

This Package used for Face Recognition with Machine Algorithm

Installing Steps for requirements python package

Installing dlib on Ubuntu

The following instructions were gathered on Ubuntu 16.04 but should work on newer versions of Ubuntu as well.

To get started, let’s install our required dependencies:

sudo apt-get update
sudo apt-get install build-essential cmake
sudo apt-get install libopenblas-dev liblapack-dev
sudo apt-get install libx11-dev libgtk-3-dev
sudo apt-get install python python-dev python-pip
sudo apt-get install python3 python3-dev python3-pip

after

pip install dlib

Installing pyfacy models on Ubuntu

pip install pyfacy_dlib_models

Installing imutils on Ubuntu

pip install imutils

Installing numpy, scipy and sklearn

pip install numpy
pip install scipy
pip install scikit-learn

Installing pyfacy

pip install pyfacy

It's implemented with face encodings

Examples:

Read Image

from pyfacy import utils
img = utils.load_image('<image src>')
ex:
img = utils.load_image('manivannan.jpg')

Face Encodings:

from pyfacy import utils
img = utils.load_image('<image src>')
encodings = utils.img_to_encodings(img)

Compare Two faces

from pyfacy import utils
image1 = utils.load_image('<image1 src>')
image2 = utils.load_image('<image2 src>')
matching,distance = utils.compare_faces(image1,image2)

Note: The compare_faces return Boolean and Distance between two faces

Example for Face Recognition using ML

Implementing Algorithms

  1. KNN - K-Nearest Neighbors
  2. LOG_REG_BIN - Logistic Regression with two classes
  3. LOG_REG_MUL - Logistic Regression with more than two classes
  4. LDA - Linear Discriminant Analysis

Training , Save model and Predict Image

from pyfacy import face_recog
from pyfacy import utils
mdl = face_recog.Face_Recog_Algorithm()
# Train the Model
# Implemented only four algorithms above mentioned and put the shortform
mdl.train('pyfacy/Test_DS',alg='LOG_REG_MUL')
# Save the Model
mdl.save_model()
# Predicting Image
img = utils.load_image('<image src>')
mdl.predict(img)

Loading model and Predict Image

from pyfacy import face_recog
from pyfacy import utils
mdl = face_recog.Face_Recog_Algorithm()
# Load Model
mdl.load_model('model.pkl')
# Predicting Image
img = utils.load_image('<image src>')
mdl.predict(img)

Face Clustering

Cluster the image_src

from pyfacy import face_clust
# Create object for Cluster class with your source path(only contains jpg images)
mdl = face_clust.Face_Clust_Algorithm('./pyfacy/cluster')
# Load the faces to the algorithm
mdl.load_faces()
# Save the group of images to custom location(if the arg is empty store to current location)
mdl.save_faces('./pyfacy')

pyfacy's People

Contributors

manivannanmurugavel avatar

Stargazers

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

Watchers

 avatar  avatar

pyfacy's Issues

Clustering problem

Hi

When I try to cluster the pictures, but it cannot work.
when it loads pictures, some error happened, such as:

ImportError: [joblib] Attempting to do parallel computing without protecting your import on a system that does not support forking. To use parallel-computing in a script, you must protect your main loop using "if name == 'main'". Please see the joblib documentation on Parallel for more information

Accuracy problem

Hi, i tried your face clustering example code:

from pyfacy import face_clust
# Create object for Cluster class with your source path(only contains jpg images)
mdl = face_clust.Face_Clust_Algorithm('./pyfacy/cluster')
# Load the faces to the algorithm
mdl.load_faces()
# Save the group of images to custom location(if the arg is empty store to current location)
mdl.save_faces('./pyfacy')

but the result is not that accurate, some different people were put into the same folder...

how to get better accuracy and how do I change face distance tolerance in large dataset?

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.