Coder Social home page Coder Social logo

asutoshpati / face-clustering-using-dbscan Goto Github PK

View Code? Open in Web Editor NEW
6.0 2.0 1.0 102 KB

Demonstrates face clustering using DBSCAN (Density Based Spatial Clustering of Applications with Noise) algorithm.

License: MIT License

Python 100.00%
face-clustering dbscan dbscan-algorithm face-recognition face-encodings face-dataset opencv python

face-clustering-using-dbscan's Introduction

Face Clustering Algorithm


This code shows face clustering using DBSCAN (Density Based Spatial Clustering of Applications with Noise) algorithm. Using this codes you can create face database of fine images (by removing blurred images) and then you can easily apply face clustering on the newly created database.

After clustering unique faces you can also find best pictures from each cluster.

If you find this code helpful please don't forget to give star and follow.


Requirements

pip install dlib@https://pypi.python.org/packages/da/06/bd3e241c4eb0a662914b3b4875fc52dd176a9db0d4a2c915ac2ad8800e9e/dlib-19.7.0-cp36-cp36m-win_amd64.whl#md5=b7330a5b2d46420343fbed5df69e6a3f

pip install face-recognition==1.3.0

pip install opencv-python==4.5.2.52

pip install scikit-learn==0.24.2

How to use

  • Just put all the cropped face (as this code doesn't have crop face code) images into "face_images" directory. (you can add the crop face code in "create_face_database" function at the marked place in "get_encodings.py")

  • Then run the "example.py" file to stat the face database making procedure. If you want to use it in your code; then you need to put "get_encodings.py" in your project directory and have to use the function "create_face_database".

    import get_encodings as enc
    root_path = 'face_images' # path to your
    dir_name, data_len = enc.create_face_database(root_path)
  • Once face database is created it will start doing face cluster immediately after completing the result directory where clustered faces are stored will be displayed. If you want to add "face_cluster.py" to your project directory and have to use "do_cluster" function.

    import face_cluster as cluster
    dir_name = '' # path to face database directory
    unq_faces, res_dir = cluster.do_cluster(dir_name)
  • You can find best picture from each class using "get_best_pics" function once clustering is completed, and you have number of clusters and path to result directory.

    import face_cluster as cluster
    unq_faces = 0 # num of clusters after clustering
    res_dir = '' # path to stored face cluster result
    unq_fine_faces = cluster.get_best_pics(unq_faces, res_dir)

face-clustering-using-dbscan's People

Contributors

asutoshpati avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

shamaunalam

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.