Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to train and return 128 embedding? #208

Open
michealChin opened this issue May 10, 2023 · 3 comments
Open

How to train and return 128 embedding? #208

michealChin opened this issue May 10, 2023 · 3 comments

Comments

@michealChin
Copy link

Previously I was working on the https://github.com/davidsandberg/facenet, but there is a limitation where the repo is base on tensorflow 1.x and latest hardware for Geforce 30 series and above is not supported in tensorflow 1.x. So I just wonder can I train from the scratch using this repo (pytorch version) and change the output dimension to 128 embeddings?

@timesler
Copy link
Owner

timesler commented Jul 3, 2023

What do you need 128-dim embeddings for?

It will probably be easier to either:

  1. Add a single linear layer at the end of the model to do the mapping down to 128, freeze all the existing layers, and finetune, or
  2. Use PCA to reduce the dimension

Training from scratch will be extremely involved just to get a smaller output dimension. I'd recommend just using PCA.

@michealChin
Copy link
Author

What do you need 128-dim embeddings for?

It will probably be easier to either:

  1. Add a single linear layer at the end of the model to do the mapping down to 128, freeze all the existing layers, and finetune, or
  2. Use PCA to reduce the dimension

Training from scratch will be extremely involved just to get a smaller output dimension. I'd recommend just using PCA.

Thanks for the reply, I was planning to retrain with other demographic face dataset, the davidsandberg one is trained mainly on Caucasian, when come to Asian face, the performance is poor, so I was asking whether this pytorch version of facenet able to retrain from the scratch since davidsandberg one is limited to tensorflow version 1 and not compatible with latest nvidia cards.

@jasuriy
Copy link

jasuriy commented Jun 26, 2024

@michealChin hi
did you have a chance of retraining this repo? please let me know about it . thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants