Git Product home page Git Product logo

lsfr's Introduction

Large-Scale-Facial-Recognition

A million scale facial recognition system.

License: MIT

Facial Recognition Software system to store and index millions of face-fingerprints and search for matches.

Installation

It's recommended (but not necessary) to have an NVIDIA gpu with cuda libraries installed for face recognition to work reasonably fast

OS X & Linux:

pip3 install -r requirements.txt

Windows:

pip install -r requirements.txt

Usage example

First, you can setup the database configuration files (or just keep the default configuration) in LSFR/core/FaceData/dbconfig.py and LSFR/core/LSH/dbconfig.py

Below example shows how to scrape an instagram profile to download all the images, store the face encodings and index them for easier search

from core.LSH.lsh import SQLDiskLSH
from core.main import set_credentials, initialize, add

# set your instagram credentials to scrape instagram profiles
set_credentials("instagram", "your-instagram-username", "your-instagram-password")

index = SQLDiskLSH()

# urls of profiles that you want to scrape
urls = [
    "https://www.instagram.com/veritasium/?hl=en",
    "https://www.instagram.com/thephysicsgirl/?hl=en",
]

# the add function will download every single image from the url and stores the face embeddings. If you run the add function on the same url again, then it will pickup where it left off (scrape any new images that were added after a while)
for url in urls:
    add(index, url)

Now lets look at how to find matching faces

from core.mappers import default_sql_mapper
from core.main import initialize, query, get_faces

index = SQLDiskLSH()

faces = []
for data in get_faces("some_image_that_has_a_face.jpg"):
    faces.append(data)

face_num, face_loc, face_embedding = faces[0]

# query function returns a list of matches where each match has information on the ID of face stored in database and the euclidean distance of the given face and the matched face (low distance = better match)
matches = query(index, default_sql_mapper, face_embedding, 20)

print(matches)

# you can use the IDs to query the FaceData database and get the link to the original post

Meta

M. Zahash โ€“ [email protected]

Distributed under the MIT license. See LICENSE for more information.

https://github.com/zahash/

Contributing

  1. Fork it (https://github.com/zahash/LSFR/fork)
  2. Create your feature branch (git checkout -b feature/fooBar)
  3. Commit your changes (git commit -am 'Add some fooBar')
  4. Push to the branch (git push origin feature/fooBar)
  5. Create a new Pull Request

lsfr's People

Contributors

zahash 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.