GithubHelp home page GithubHelp logo

we0091234 / combinedmargin-caffe Goto Github PK

View Code? Open in Web Editor NEW

This project forked from gehaocool/combinedmargin-caffe

0.0 1.0 0.0 524 KB

caffe implementation of insightface's combined margin method

C++ 54.71% Cuda 45.29%

combinedmargin-caffe's Introduction

Combined Margin (caffe)

中文版本README

Introduction

In this repo, a caffe implementation of Combined Margin is introduced.

This repo was inspired by insightface and arcface-caffe

Combined Margin was proposed by insightface as the improvement of Sphereface, AMSoftmax(CosineFace), and Additive Angular Margin which was proposed by insightface before.

This implementation follows the method in insightface, and do some modification. Mainly adding bounds for the logits after adding margin, so the logits value of ground truth won't get bigger after adding margin, instead of getting smaller which is our original purpose. And also add bound for the gradient.

Note that the combined margin in this implementation is rather hard without any tricks to help the converge while training.

According to insightface's experiments, the validation results of Combined Margin is better than the other methods mentioned above. see Verification Results On Combined Margin.

If you want to try other methods, please refer to insightface, arcface-caffe and AMSoftmax(CosineFace)

Installation

  1. Merge toadd.proto with caffe's caffe.proto, follow the instructions in toadd.proto.
  2. Place all the .hpp files in $CAFFE_ROOT/include/caffe/layers/, and all the .cpp and .cu files in $CAFFE_ROOT/src/caffe/layers/. Replace the original files if necessary.
  3. Go to $CAFFE_ROOT and make all. Maybe you need to do make clean first.
  4. Now you can use Combined Margin Layer in your caffe training. Here's an example.prototxt which is modified from AMSoftmax's prototxt. You can just change the LabelSpecificAddLayer into CombinedMarginLayer, and don't forget to change the layer parameters.

If you have any question, feel free to open an issue.

Anyone use the code, please site the original papers

update 2018-11-11 a resnet-36 model

Here's one ResNet-36 model (password: 6sgx), trained on ms-celeb-1m and asian-celeb provided by Deepglint. This model can get 99.75% on LFW. And on BLUFR, it gets 99.69% [email protected]%, 99.53% @FAR0.01%, 99.42% Top1@FAR1% . I didn't do other test.

update 2018-12-10 add training log

In res36-training-config folder is the training log, solver.prototxt and train.prototxt of ResNet-36 combined margin loss model training(password: y672). The training data is Trillionpairs by Deepglint. All faces are aligned to 112x96. This dataset provides 5-landmark information, so we don't need to do the detection and landmarks location.

update 2019-06-19 upload resnet-36 model to Google Drive

Google Drive URL

combinedmargin-caffe's People

Contributors

gehaocool avatar

Watchers

James Cloos 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.