shubham0204 / OnDevice-Face-Recognition-Android

On-device customizable face recognition in Android with FaceNet and an embedded vector database
https://medium.com/proandroiddev/building-on-device-face-recognition-in-android-076a40dbaac6
Apache License 2.0
26 stars 3 forks source link

Same embedding for every face when useGpu = false #7

Open leandro-miguenz opened 3 weeks ago

leandro-miguenz commented 3 weeks ago

Hi @shubham0204, I'm trying out your app and I have noticed an issue. When the FaceNet useGpu parameter is set to false, the app seems to recognize every face as the same person. This appears to be because faceNet.getFaceEmbedding() method is consistently returning the same value.

Have you encountered this before, and do you have any suggestions on how to address it for devices that don't support GPU delegate?

Steps to reproduce the issue:

  1. In AppModule, change the provideFaceNetEmbeddingModel method to set useGpu to false when creating FaceNet instance:

    fun provideFaceNetEmbeddingModel(context: Application): FaceNet {
    return FaceNet(context, false)
    }
  2. Run the app and add a new face

  3. Point the camera to any face. It will always be recognized as the one you just added.

shubham0204 commented 2 weeks ago

@leandro-miguenz How did you know that the model is producing the same embedding? Can you add a log statement in FaceNet.kt and check if the embeddings (vectors) are the same even for different faces?