GithubHelp home page GithubHelp logo

liorshk / facenet_pytorch Goto Github PK

View Code? Open in Web Editor NEW
320.0 320.0 90.0 77 KB

PyTorch implementation of the paper "FaceNet: A Unified Embedding for Face Recognition and Clustering"

License: MIT License

Python 100.00%

facenet_pytorch's People

Contributors

liorshk avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

facenet_pytorch's Issues

Model didn't converge.

Hi @liorshk

Thanks for sharing your code. It seems clean and well-written, however, I had problem having it converge.

I trained it on filtered version of MsCeleb with 5 Million images and 79K identities. Your hyper-parameters seems to be identical with the Tensorflow implementation davidsandberg/facenet and I also tried different ones but I never got more than 65% accuracy on LFW.

I think it's mostly because of the way that triplet selection has been implemented. The paper suggests having batches of 1800 images from a certain number of identities (40-45), rather than choosing it completely randomly. I tried this but only with 180 images at most, yet still it didn't converge.

Do you have any idea that can help me? If you had any success training the model, could you please share your weights too?

Thanks,

Bug: triplet loss

when I train triplet loss, I find bug in here:
out_selected_a = Variable(torch.from_numpy(out_a.cpu().data.numpy()[hard_triplets]).cuda())
out_selected_p = Variable(torch.from_numpy(out_p.cpu().data.numpy()[hard_triplets]).cuda())
out_selected_n = Variable(torch.from_numpy(out_n.cpu().data.numpy()[hard_triplets]).cuda())

it should be out_a[hard_triplets]. Otherwise, grad won't be caculated.

RuntimeError: element 0 of tensors does not require grad and does not have a grad_fn

out_selected_a = Variable(torch.from_numpy(out_a.cpu().data.numpy()[hard_triplets]).cuda())
out_selected_p = Variable(torch.from_numpy(out_p.cpu().data.numpy()[hard_triplets]).cuda())
out_selected_n = Variable(torch.from_numpy(out_n.cpu().data.numpy()[hard_triplets]).cuda())

will lead to

RuntimeError: element 0 of tensors does not require grad and does not have a grad_fn

why not use:

out_selected_a = out_a[hard_triplets]
out_selected_p = out_p[hard_triplets]
out_selected_n = out_n[hard_triplets]

Pre-Trained Models

Dear @liorshk,
Thank you for your code. Do you have any pre-trained models? Would you please, release the weights of your pre-trained models?

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.