Giter VIP home page Giter VIP logo

faceverificationandroid's Introduction

FaceRecognition

This is an Android application for face recognition. The main purpose of this project is to serve as basis for others who want to deploy their deep learning models to an Android application.

Face Detection

The face detection package was taken from this repository. It uses the MTCNN model for face detection and it is runned using an old TensorFlow API (TensorflowInferenceInterface) for Android.

Face Recognition

The face recognition model used is FaceNet. It was obtained through the instructions in this repository. The model is runned using the TensorFlow Lite API.

Usage

If you want to use the code of this project in your own application, then follow the steps below:

  • Copy the model files (mtcnn_freezed_model.pb e facenet.tflite) to your "assets" folder.
  • Add the following code to "build.gradle":
android {
    aaptOptions {
        noCompress "tflite"  // Prevents compression of tflite files
        noCompress "lite"
    }
}

dependencies {
    implementation 'org.tensorflow:tensorflow-lite:0.0.0-nightly'  // Official API
    implementation 'org.tensorflow:tensorflow-android:+'  // Old API (TensorflowInferenceInterface)
}
  • Copy the packages FaceRecognition and FaceDetection.
  • To calculate the similarity score between two faces do as follows:
FaceNet facenet = new FaceNet(getAssets());

// cropFace returns null if no face could be detected in the provided image
Bitmap face1 = cropFace(bitmap1);
Bitmap face2 = cropFace(bitmap2);

if (face1 != null && face2 != null) {  // To make sure both faces were detected successfully
    double score = facenet.getSimilarityScore(face1, face2);  // Euclidian distance between the face descriptor vectors
}

facenet.close();

faceverificationandroid's People

Contributors

bardiaalavi-2020 avatar ewuharun avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.