huan / node-facenet

Solve face verification, recognition and clustering problems: A TensorFlow backed FaceNet implementation for Node.js.
https://zixia.github.io/node-facenet/
Apache License 2.0
404 stars 78 forks source link

newer model, different embedding size #148

Open transfluxus opened 5 years ago

transfluxus commented 5 years ago

I want to use a newer model so I found model-20180402-114759 of ResNet v1. However, this creates embeddings of the size 512 not 128 like the default model. This makes the program crash cuz of these lines (l. 450 in face.ts)

    } else if (embedding.shape[0] !== 128) {
      throw new Error(`Face<${this.md5}> embedding dim is not 128! got: ${embedding.shape[0]}`)
    }

Just commenting it out worked. So maybe you leave that part out or check if the embedding is correct in a different way.

huan commented 5 years ago

Thanks for using Facenet, I'd like to add support to the news models.

Could you please explain the advantage of the 512 dim model you mentioned to, with the related urls which I can study on?

And pull request will be welcome if you can make one.

transfluxus commented 5 years ago

It's this model 20180402-114759. Not sure if there are different ones or this was the exact thing I downloaded: https://drive.google.com/file/d/1EXPBSXwTaqrSC0OhUdXNmKSh9qJUQ55-/view from this repo: https://github.com/davidsandberg/facenet The resulting faces with (rects, confidence, and landmarks are exactly the same) only the resulting embedding has a higher dimension. So for me a bit disappointing. I have a lot of images where the faces are not completely in the picture.

So I guess I need to find something, where I can finetune the model. Is it possible with your implementation :) ?