exadel-inc / CompreFace

Leading free and open-source face recognition system
https://exadel.com/accelerator-showcase/compreface/
Apache License 2.0
5.34k stars 734 forks source link

Looking for ways to explore internal libraries of Compreface #730

Open SarimZH opened 2 years ago

SarimZH commented 2 years ago

Hi there, im trying to use Compreface recognition for a project. However, the compreface recognition service returns false positives with a certain high similarity index (>=0.9) on South Asian faces. The project needs accurate recognition since it involves transactions. Similarly, it also creates log files which ends up consuming a lot of space.

What I am looking for is to access the faceprint code within the container which would somehow simplify and accelerate the recognition process.

pospielov commented 2 years ago

Hi, if you look at our architecture: https://github.com/exadel-inc/CompreFace/blob/master/docs/Architecture-and-scalability.md compreface-core is responsible for calculating faceprints compreface-api uses these faceprints to calculate euclidian distance. I am not sure that you can improve the accuracy without changing the model that calculates faceprints. The problem is that if during the model training it didn't see enough faces of a particular race, it will show low accuracy and I don't see how you can improve it without retraining the model. Also, have you tried the InsightFace custom build? It should show better accuracy on Asian race (Still not the best)

SarimZH commented 2 years ago

Hi, thank you for your response. In that case, is there a way that I can replace the model in compreface container with the Insight face model?

On Fri, Feb 18, 2022 at 8:02 PM Pospielov Serhii @.***> wrote:

Hi, if you look at our architecture:

https://github.com/exadel-inc/CompreFace/blob/master/docs/Architecture-and-scalability.md compreface-core is responsible for calculating faceprints compreface-api uses these faceprints to calculate euclidian distance. I am not sure that you can improve the accuracy without changing the model that calculates faceprints. The problem is that if during the model training it didn't see enough faces of a particular race, it will show low accuracy and I don't see how you can improve it without retraining the model. Also, have you tried the InsightFace https://github.com/exadel-inc/CompreFace/tree/master/custom-builds custom build? It should show better accuracy on Asian race (Still not the best)

— Reply to this email directly, view it on GitHub https://github.com/exadel-inc/CompreFace/issues/730#issuecomment-1044664277, or unsubscribe https://github.com/notifications/unsubscribe-auth/AXLJ3D22F5VYKIMCAQJEHXLU3ZNQPANCNFSM5OXSC6NQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you authored the thread.Message ID: @.***>

pospielov commented 2 years ago

The model is placed in slightly different places in each build, here is an example for exadel/compreface-core:0.6.1-mobilenet-gpu build: /app/ml/.models/insightface/calculator/arcface_mobilefacenet I think you easily will find the same path for other builds. The problem is that you can divide facial recognition into two phases - faceprint detection (this is what this mode does) and comparing faceprints to find face similarities. The second phase has its own coefficients, so the resulting similarity always will be between 0 and 1. So when you replace the model it will work, just prepare to see very strange similarities.

SarimZH commented 2 years ago

Hi there,

Thank you for guiding me about this. Could you also tell me if Mobilenet Custom built would work too for Asian faces?

On Fri, Feb 18, 2022 at 8:02 PM Pospielov Serhii @.***> wrote:

Hi, if you look at our architecture:

https://github.com/exadel-inc/CompreFace/blob/master/docs/Architecture-and-scalability.md compreface-core is responsible for calculating faceprints compreface-api uses these faceprints to calculate euclidian distance. I am not sure that you can improve the accuracy without changing the model that calculates faceprints. The problem is that if during the model training it didn't see enough faces of a particular race, it will show low accuracy and I don't see how you can improve it without retraining the model. Also, have you tried the InsightFace https://github.com/exadel-inc/CompreFace/tree/master/custom-builds custom build? It should show better accuracy on Asian race (Still not the best)

— Reply to this email directly, view it on GitHub https://github.com/exadel-inc/CompreFace/issues/730#issuecomment-1044664277, or unsubscribe https://github.com/notifications/unsubscribe-auth/AXLJ3D22F5VYKIMCAQJEHXLU3ZNQPANCNFSM5OXSC6NQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you authored the thread.Message ID: @.***>

SarimZH commented 2 years ago

I had accessed the compreface-core container and was able to look into the .py files of InsightFace and Facenet. However, I could not find the yml file to replace it with custom models available.

On Tue, Feb 22, 2022 at 11:14 AM Sarim Zuhair @.***> wrote:

Hi there,

Thank you for guiding me about this. Could you also tell me if Mobilenet Custom built would work too for Asian faces?

On Fri, Feb 18, 2022 at 8:02 PM Pospielov Serhii @.***> wrote:

Hi, if you look at our architecture:

https://github.com/exadel-inc/CompreFace/blob/master/docs/Architecture-and-scalability.md compreface-core is responsible for calculating faceprints compreface-api uses these faceprints to calculate euclidian distance. I am not sure that you can improve the accuracy without changing the model that calculates faceprints. The problem is that if during the model training it didn't see enough faces of a particular race, it will show low accuracy and I don't see how you can improve it without retraining the model. Also, have you tried the InsightFace https://github.com/exadel-inc/CompreFace/tree/master/custom-builds custom build? It should show better accuracy on Asian race (Still not the best)

— Reply to this email directly, view it on GitHub https://github.com/exadel-inc/CompreFace/issues/730#issuecomment-1044664277, or unsubscribe https://github.com/notifications/unsubscribe-auth/AXLJ3D22F5VYKIMCAQJEHXLU3ZNQPANCNFSM5OXSC6NQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you authored the thread.Message ID: @.***>

pospielov commented 2 years ago

MobileNet is just another model of InsightFace library, it runs faster than usual models, but is not so accurate. Have you tried SubCenter-ArcFace-r100 model? Did it work for you?

pospielov commented 2 years ago

what yml file do you have? The models look like this: https://drive.google.com/file/d/1ltcJChTdP1yQWF9e1ESpTNYAVwxLSNLP/view?usp=sharing

SarimZH commented 2 years ago

Hi pospielov, i did try it but there are a few issues that came along. The docker is consuming more memory than it should and it hangs the system overall. Im using it on Ubuntu 18.04 NUC (hardware: intel core i3 with 4GB RAM)

pospielov commented 2 years ago

Unfortunately, I can't do anything with memory consumption now

dingyaguang117 commented 1 year ago

For Asians, 1.1.0-arcface-r100 works fine for me.