Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatic face detection #6

Open
redshiftzero opened this issue Jul 7, 2016 · 6 comments · May be fixed by #517
Open

Automatic face detection #6

redshiftzero opened this issue Jul 7, 2016 · 6 comments · May be fixed by #517

Comments

@redshiftzero
Copy link
Member

Do face detection automatically with images submitted by users and those that are scraped from social media

@redshiftzero
Copy link
Member Author

Openface is a good solution for this, e.g. https://cmusatyalab.github.io/openface/usage/#api-documentation

@JoshuaOpolko
Copy link
Contributor

I've started to use the Google Vision API to automatically remove the images that have no faces. The first batch has been uploaded to cpd_pictures/Memorial.Parade.faces
A minority of the photos have not been uploaded it seems because they were over the 4MB limit for using the API. I'll resize them and upload too. So far approx 1000 images have been succesfully detected. It takes a few seconds per image roughly. I'm using the simple face detection script, no ocr or other objects recognized yet.

@redshiftzero
Copy link
Member Author

Let's use the code added in PR #112 to get this into our workflow. Requires #5.

@redshiftzero redshiftzero modified the milestones: 0.3, 0.2 Dec 28, 2016
@redshiftzero redshiftzero removed this from the 0.4 milestone Nov 8, 2017
@redshiftzero
Copy link
Member Author

Initially we'd want to:

  • Overlay detected face box on images in both image classification and officer identification pages

Note that what to do with the face depends on whether it is of an officer or not. If it is, then it should be extracted for identification, else, it should be blurred (with the original image kept unmodified).

Related to: #8

@redshiftzero
Copy link
Member Author

Once a photo is uploaded, we should submit a face detection task to a worker queue which will do:

rekog_client=boto3.client('rekognition')
response = client.detect_faces(
        Image={'S3Object':{'Bucket':current_app.config['S3_BUCKET_NAME'],
               'Name':s3_path}},Attributes=['ALL'])

The number of faces detected in the image will be the len(response['FaceDetails']).

For each detected face, we can save the bounding box in the database for display when the image is accessed again later by volunteers, e.g. here's the bounding box for the first face in a test officer image I uploaded to S3:

response['FaceDetails'][0]['BoundingBox']
{u'Width': 0.16750000417232513, u'Top': 0.34427767992019653, u'Left': 0.5299999713897705, u'Height': 0.25046902894973755}

I was thinking of modifying the Face table to store this information, but maybe adding another table AutoFace is the way to go here

@redshiftzero
Copy link
Member Author

there's a working prototype in branch face-detection (you gotta install redis in the dev env to test it): upon images being submitted, a task is submitted to a worker queue, which detects faces in the image using Rekognition and adds them to the database. Next step is to display the faces on the images on the volunteer classification/identification pages

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants