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

5-point landmark detector #14

Closed
kylemcdonald opened this issue Jun 21, 2018 · 2 comments
Closed

5-point landmark detector #14

kylemcdonald opened this issue Jun 21, 2018 · 2 comments
Labels
enhancement New feature or request

Comments

@kylemcdonald
Copy link

kylemcdonald commented Jun 21, 2018

It would be great to port the dlib 5-point landmark detector to this framework.

https://github.com/davisking/dlib-models/blob/master/shape_predictor_5_face_landmarks.dat.bz2

Right now, to perform the entire recognition pipeline on a new photo, it requires:

  1. Detection net: 22MB
  2. 68-point landmark net: 29MB
  3. Recognition net: 22MB

Or around 73MB total, making it a bit unwieldy for most public-facing applications.

The dlib 5-point landmark net is only 5MB, and just as useful for alignment as the 68-point landmark net. This would bring the total from 73MB down to 49MB. In theory, it might be possible to use quantization too as described in #11 bringing the overall size closer to 12MB.

@justadudewhohacks
Copy link
Owner

Hi Kyle,

I am not sure if it is trivial to port the dlib 5 point face landmark model to tfjs. As far as I know it is not CNN based (correct me if I am wrong). But in theory I think it should be enough to come up with a simple CNN for 5 point face landmarks, like the 68 point face landmark CNN, just with less conv layers/ conv params, to reduce the overall size.

Regarding the quantization, I am already working on it. The quantized 68 point landmark model is 7MB. The face detection and recognition weights will be ~5MB each. For running the full pipeline, this will be ~17MB.

If everything works out, I will get this done today.

@justadudewhohacks justadudewhohacks added the enhancement New feature or request label Jun 21, 2018
@kylemcdonald
Copy link
Author

Sorry, you're right about the 5 point detector being non-CNN. I missed this.

I supposed in theory it would be possibly to prune the last layer of the 68-landmark model to only produce 5 outputs instead of 68, but without knowing the exact architecture of the 68-landmark model it's hard to say how much that would actually save.

Super exciting to have the models be smaller! I have something I'm building now that relies on that. I'm going to close this issue since it was sort of misguided :)

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

No branches or pull requests

2 participants