exadel-inc / CompreFace

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

Any recommend way to Liveness built-in detection? #802

Open Ahmedsaber9 opened 2 years ago

Ahmedsaber9 commented 2 years ago

Hello I want to know if the detection (The user should perform specific eye. mouth, or head movements) is that supported or could be implemented if any has any idea to get that done I'm open to knowing.

Thanks

Ahmedsaber9 commented 2 years ago

@pospielov

pospielov commented 2 years ago

It can be implemented using the landmarks plugin. using it, you can check what the current head pose is. We don't have an article about it, but here is an example of how amazon recommends implementing it using their facial recognition service: https://aws.amazon.com/blogs/industries/liveness-detection-to-improve-fraud-prevention-in-financial-institutions-with-amazon-rekognition/ There is an even more powerful plugin landmarks2d106 that returns 106 points. Using it you can check if the mouth or eyes are opened.

pospielov commented 2 years ago

By default, landmarks2d106 is not included in CompreFace. It replaces the standard landmarks plugin, this is why we can't support both. You can build CompreFace with this plugin using instructions from here: https://github.com/exadel-inc/CompreFace/tree/master/embedding-calculator Or just use my prebuilt image: pospielov/compreface-core:1.0.0-mobilenet-2d106

Ahmedsaber9 commented 2 years ago

much thanks, What about the Livens challenges ? I took a look at what you shared with me "https://aws.amazon.com/blogs/industries/liveness-detection-to-improve-fraud-prevention-in-financial-institutions-with-amazon-rekognition/"

but the whole code is closeted to amazon infrastructure, do you recommend any project or something like that to integrate the face livens test?

pospielov commented 2 years ago

Unfortunately, I don't know about such projects. I am afraid you need to implement it by yourself, I believe it's possible to make it work locally, without amazon infrastructure

pospielov commented 2 years ago

you need to stop CompreFace: docker-compose down then replace image in docker-compose file, instead of:

    restart: always
    image: ${registry}compreface-core:${CORE_VERSION}
    container_name: "compreface-core"
    environment:
      - ML_PORT=3000

it will be:

    restart: always
    image: pospielov/compreface-core:1.0.0-mobilenet-2d106
    container_name: "compreface-core"
    environment:
      - ML_PORT=3000

then run CompreFace again

Ahmedsaber9 commented 2 years ago

Worked like charm! I will push my contraption soon! many thanks

pospielov commented 2 years ago

Yes, I know that GUI is broken, this is why it's not in the official distribution.

  1. We use pre-trained models from FaceNet repository and from InsightFace repository. In the case of the 1062d image, it's the InsightFace model. You can find the accuracies here: https://github.com/exadel-inc/CompreFace/tree/master/custom-builds
  2. That's a good question, I didn't come across the accuracies of landmark detectors in those libraries.
  3. Everything is possible. But we don't have a big demand for even the 1062d feature. Also, it's easier to reuse the existing libraries. So as soon as InsightFace doesn't support it, it's harder to add it to CompreFace.
  4. It only speeds up the process.
  5. Yes, I mean CompreFace is open sourced so all you need is to train the model, put it into the code and build the CompreFace. You can use official instructions on how to build the model from FaceNet and InsightFace
dtheb commented 1 year ago

Any update on this? since this is an old issue any chance there is there a new plugin or something to do liveness now?