go-aws-face-rekognition

command module
v0.0.0-...-0c7baff Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 3, 2019 License: MIT Imports: 6 Imported by: 0

README

An implementation of AWS Rekognition using Golang

This is a simple REST API server that accept an input image and give you URLs of matching images from the S3 bucket by calling Rekognition CompareFaces.

Getting started

Steps for getting up and running,

  1. Create a .env file in the project root directory and setup required environment variables

    AWS_REGION="us-east-1"
    AWS_ACCESS_KEY_ID="Your AWS Access Key ID"
    AWS_SECRET_ACCESS_KEY="Your AWS Access Key Secret"
    AWS_S3_BUCKET_KEY="Your Bucket Name"
    
  2. Build the docker image

    docker-compose build
    
  3. Start the docker container

    docker-compose up
    
  4. Using Postman or any other REST API tool make a POST request to the following endpoint

    POST http://localhost:8080/v1/compareFaces
    Content-Type: multipart/form-data;
    boundary=----WebKitFormBoundaryWfPNVh4wuWBlyEyQ
    
    ------WebKitFormBoundaryWfPNVh4wuWBlyEyQ
    Content-Disposition: form-data; name="folder_path"
    
    /some/folder/path
    
    ------WebKitFormBoundaryWfPNVh4wuWBlyEyQ
    Content-Disposition: form-data; name="file"; filename="image.png"
    Content-Type: image/png
    
    [file content goes there]
    ------WebKitFormBoundaryWfPNVh4wuWBlyEyQ
    

    If folder_path is provided it will be used as a prefix for ListObjectsInput.SetPrefix

  5. Sample success response

        {
            "result": [
                "https://test-bucket.s3.amazonaws.com/folder/IMG_1.jpg",
                "https://test-bucket.s3.amazonaws.com/folder/IMG_2.jpg"
            ]
        }
    

    Currently it scans maximum of 100 Objects. Only the images that has Similarity >= 90 will be included in the result.

License

MIT

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
services
aws

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL