Algorithmia

Censoring Faces Automatically

Privacy issues are a big concern when recording public videos. Professional photographers and public institutions (such as police departments) run into this problem when publishing or releasing public images or footage. Generally speaking, professionals are required to obscure faces when there is a reasonable expectation of privacy and the individual(s) being filmed have not signed a release form. Similarly, many governmental institutions censor faces when releasing video footage, in order to maintain the privacy of those in the video.

Censor face tries to solve these problems by automating the process of censoring faces, efficiently and at scale.

Demystifying: How does it work?

In computer vision, when solving human-face related problems, a traditional way to solve them is to use facial landmarks. These are useful clues for determining if there’s a face in a given region in an image. If these landmarks are grouped together in a meaningful manner, then we safely assume that there’s a face. We then use this information to censor the given region of an image.

Why do you need Censor Face?

If you want to keep the privacy of people in a given image or video, and/or want to automate your job by processing images/frames in bulk and at scale, then cv/CensorFace will save you valuable time, so you can focus your time and energy on more meaningful things.

How can you use Censor Face in your own apps/scripts?

  1. First, create an account on Algorithmia: click here to get started and receive 5000 free credits each month.
  2. After creating your account, go to your profile page and navigate to the Credentials tab. There you will find your API key. Copy that to a safe location, so we can use it later.
  3. Find a test image. I’ve picked an image from Wikipedia, but you can pick another one if you’d like.
  4. Install the Python Algorithmia client using the command “pip install algorithmia“.
  5. Grab the sample code below, replace YOUR_API_KEY with the one from your account, and run it to detect and censor the faces in your image!

 

Sample Input Image

import Algorithmia

client = Algorithmia.client("YOUR_API_KEY")

input = {
"images": [
"https://upload.wikimedia.org/wikipedia/commons/0/04/Crew_of_STS-107%2C_official_photo.jpg"
],
"output_dir": "data://.algo/cv/CensorFace/temp/",
"fill_color": "blur"
}

result = client.algo("cv/CensorFace/0.1.3").pipe(input).result["output"]

print result

Sample Output

{
"output": [
"data://.algo/cv/CensorFace/temp/9bb613d8-bb02-4cb2-87ad-b5b2916d4081.png"
]
}

You can now find your output image in your algorithm temporary collection (aka. cv/CensorFace) under your dataAPI page here. Your output image should look something like this:

Conclusion

Whether you’re a professional photographer or a public institution, it is now incredibly easy to automate censoring faces at scale.

We’d love to hear how you plan to use the Censor Face microservice!

Algorithm Engineer at Algorithmia, helps make complicated things simpler. Believes that Machine Intelligence will have a huge impact on our lives in the days to come, and hopes to have a defining role in shaping this new future.

More Posts

Follow Me:
TwitterLinkedIn