GithubHelp home page GithubHelp logo

flyrenxing / pytorch-facenet-dogdataset Goto Github PK

View Code? Open in Web Editor NEW

This project forked from kvsnoufal/pytorch-facenet-dogdataset

0.0 0.0 0.0 73.41 MB

Paper To Code implementation of Facenet in native pytorch on Dog Dataset

Python 73.23% HTML 26.77%

pytorch-facenet-dogdataset's Introduction

FaceNet Implementation on DogFace Dataset

Paper To Code implementation of Facenet on dog-face dataset using custom online Hard-Triplet mining

Original Paper- ArxViv

Pls checkout the medium article for a quick overview.

This custom implementation of FaceNet trained on dog face dataset. My approach was to read the paper (FaceNet: A Unified Embedding for Face Recognition and Clustering) and try to implement the model from my interpretation of the paper. I have used pytorch for the implementation.

Model Architecture and Training Design

Pic of Model

The objective of the model is to generate embeddings that satisfy this these 2 constraints: Same faces are close to each other in embedding space Different faces are far away

The loss function does exactly this. A training step would comprise the following: Select 3 images

Anchor image (a)- image of a person A Positive sample (p)-another image of person A Negative sample (n) - image of person B

  1. Train the model to minimize the triplet loss: Triplet Loss function

training

One of the optimizations to the training processes proposed in the paper is the triplet selection process - Hard Triplet Mining. In order to reduce the time taken for convergence of the model, triplets which can contribute to model improvement need to be carefully selected.  So for an anchor image, we select a positive image that has embedding farthest from anchor's - Hard Positive. And we select a negative image that has embedding closest to the anchor's - Hard Negative.

Hard Triplet Mining

The training process is essentially, the neural network learning to generate embeddings that minimizes the triplet loss. This ensures the trained model would embed images of the same person very close to each other.

Building a dog search engine

I trained facenet on dog dataset using a custom dataloader that implements hard triplet mining.

Tensorboard

Tensorboard Embedding

Web gif

Check out youtube video : Youtube Link

pytorch-facenet-dogdataset's People

Contributors

kvsnoufal 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.