GithubHelp home page GithubHelp logo

deeheber / face-match Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 2.0 121 KB

A program to that does face comparison/matching between uploaded images and images stored in a collection.

JavaScript 100.00%
serverless aws ai image-processing stackery serverlessapplicationmodel infrastructure-as-code nodejs aws-sdk aws-sam dynamodb lambda

face-match's Introduction

face-match

Description

  • This stack allows you to upload and delete images from a Rekognition collection.
  • You can then upload other images (outside of the Rekognition collection) and then Rekognition searches the images in the collection for a face match with the other images that were uploaded.
  • Could be used for facial recognition to unlock something like a diary or a door.
  • See this open issue for future plans to make this less manual

Technologies Used

  • AWS
    • AWS SAM backed by CloudFormation
    • S3
    • Lambda
    • DynamoDB
    • Rekognition
  • Node

Architecture Overview

Architecture

Directions to run/deploy

  1. Install NodeJS (current version number for this app specified in .nvmrc file at the root of this repo), AWS CLI, and AWS SAM CLI on your local machine if you don't have it yet

  2. Create your Rekognition collection using the AWS CLI (id should satisfy the regex pattern [a-zA-Z0-9_.\-]+). Note this should not match the id of any existing rekognition collections that you have unless you want this program to alter that existing collection

    aws rekognition create-collection --collection-id <YOUR COLLECTION ID HERE>

    Full CLI docs here

  3. Run sam build and sam deploy --guided. When prompted for RekognitionId parameter's value, make sure to add the same collection id from step #2. Select Y to save your config file as samconfig.toml in the root of the project (the default setting).

  4. Add images to the created S3 buckets in the AWS S3 console and check the Cloudwatch logs for the results. Add to the collection images bucket first to add images to compare against to a collection, then add to the images bucket to compare that uploaded image(s) to the images in the collection.

  5. (Optional) I like to use the sam logs command instead of looking for the logs in the AWS console to see the face match comparison results...something like this (update -n to be the name of the function you want to view logs for and the --stack-name to whatever you named the stack)

    sam logs --stack-name face-match --config-file samconfig.toml --tail
  6. More details on what each function does can be found in the various README.md files in this repo

  7. (Optional cleanup when finished) Delete the stack, run sam delete after emptying the two S3 buckets.

  8. (Optional cleanup when finished) Delete the Rekognition collection

    aws rekognition delete-collection --collection-id <YOUR COLLECTION ID HERE>

    Full CLI docs here

Outstanding TODO Items / Open Bugs

See open issues

Logging Issues

If you find a bug or have a question, feel free to open a new issue and our maintainers will reply as soon as they possibly can. Please describe the issue including steps to reproduce if there are any.

Pull Request Process

  1. Fork the respository
  2. Make any changes you'd like
  3. Open a new PR against main with a description of the proposed changes as well as any other information you find relevant.
  4. If your PR fixes an open issue be sure to write fixes #[ issue number here ]

Finding Help

Please send a direct message to @deeheber on Twitter if any of your questions have not been addressed by the documentation in this repository.

face-match's People

Contributors

deeheber avatar

Stargazers

 avatar

Watchers

 avatar  avatar

face-match's Issues

Automate command line setup step

Write a Lambda function that

Should invoke on every new deploy

Automate creating/deleting the rekognition collection

Currently in the README, we tell the users to run aws cli commands to create and delete the rekognition collection.

This could be automated via CloudFormation custom resource or something similar to run a script before stack creation + after stack deletion.

Remove Stackery

Since Stackery no longer exists, update this to use the AWS SAM CLI.

Future Plans

This repo was initially set up for a quick POC and to test AWS Rekognition.

Need to brainstorm a full E2E solution where an IoT device of some sort snaps a picture > uploads it to S3 > returns true or false for a face match to open something (like a door or a diary).

Update README directions to run

Using git integration with Stackery requires a paid account...rewrite the instructions so it can be deployed via the free tier.

Restrict Permissions For Resources

Currently, I've set it up for dev purposes. Longterm, I'd like to just give each resource the min needed permissions.

Was also running into a circular dependency issue when giving my Lambda functions read access to a specific bucket while the bucket serves as an event to invoke the Lambda...need to look into that too.

  • Rekognition
  • DynamoDB
  • S3

Create CLI tool

The way it's currently setup, I have to login to the AWS console to analyze things. Would be nice to do all of this from the command line.

Proposed Features

  • Add / Remove Collections
  • View collections
  • Upload / Delete a Face from a collection
  • Select an image of a face in the local file system to compare to the collection

  • Add / Remove Projects
  • View projects
  • Select an image of an object from the local file system to get labels

Audit Resource Permissions

In some cases, I've allowed for '*' for rekognition based resources bc past me didn't exactly know what I was doing. When applicable pair it down to the collectionId ARN.

Also double check to s3 related permissions too.

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.