GithubHelp home page GithubHelp logo

minha12 / facialclusteringpipeline Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rawmarshmellows/facialclusteringpipeline

0.0 1.0 0.0 38.56 MB

Python 1.43% MATLAB 0.11% Jupyter Notebook 81.62% HTML 16.83%

facialclusteringpipeline's Introduction

An attempt at an end to end pipeline for facial clustering

Introduction

This is an end to end pipeline for facial clustering of photos (similar to what Apple and Android has). Please look at pipeline/Facial Clustering.ipynb to see the current progress.

Method

There are three main steps in creating an end to end pipeline for the facial clustering of images:

  1. Detecting and creating the bounding boxes for the faces

    • For detecting and creating the bounding boxes for the faces I'm using the Multi-Task Cascaded Convolutional Networks ( MTCNN) which has 3 CNNs with the output of one network feeding into the next. Each step refines the bounding boxes for the faces, with the first network being looser on the conditions for the bounding boxes and the last network being the most strict.
  2. Creating the embeddings for the faces

    • For creating the embeddings I'm using a modified version FaceNet which is a Resnet-Inception model that creates a 128 dimensional embedding for a face.
  3. Clustering the faces

    • For clustering the faces I'm using the Rank-Order clustering algorithm. This is a kind of agglomerative clustering technique, which merges the embeddings based on the rank-order distance, and a cluster-level normalized distance.

As I was unable to train the models myself David Sandberg has graciously trained MTCNN and Resnet-Inception models and I was able to modify his code to my use case. Here is a link to the Github page

To setup the environment and install required packages

Assuming that you are using the Anaconda package manager.

  1. Download/Clone the repo and cd to it
  2. Create a new virtual environment: conda create -n facialClustering python=3
  3. Install Tensorflow: pip install tensorflow
  4. Download the weights of Resnet-Inception from here and put it in the pipeline directory. I have already included two folders of faces which are subsets from the Labeled Faces in the Wild dataset.
  5. Go into the pipeline folder and open Jupyter Notebook: jupyter notebook
  6. Open Facial Clustering.ipynb
  7. Hopefully you will be able to open it, if it doesn't work you can download the Facial+Clustering.html and read the notebook.

Results

alt text

TODO:

  • Use alignment technique described in Face Search at Scale : 80 Million Gallery to speed up the clustering process
  • Create an efficient data structure for obtaining the distances between clusters, instead of having to recalculate them after each clustering iteration.
  • Use factory pattern to make usage of different methods for face detection/alignment cleaner

Done:

  • Use Delaunay Triangulation to align faces not useful
  • Understand and edit code from facenet and repurpose the MTCNN code to retrieve multiple faces instead of one
  • Use facenet to find the deep features
  • Use K-means to cluster not useful
  • Use Affinity Propagation to cluster not useful
  • Read and implement part of the rank order clustering from A Rank-Order Distance based Clustering Algorithm for Face Tagging)[https://pdfs.semanticscholar.org/efd6/4b7641bea8ca536f4e179be6e2dd25d519d6.pdf]
  • Use t-SNE using Tensorboard to visualize the embeddings to see if they actually cluster

facialclusteringpipeline's People

Contributors

rawmarshmellows avatar

Watchers

 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.