Secret face

by deepbluesea

GitHub Readme.md

Deploy

This node/express app demonstrates the simplest way of calculating the average of a dataset while keeping all of the underlying data private. The client application opens up your camera and starts taking pictures of your face, obfuscating the image by salting random zero-centered numbers to the pixels, then sending the garbled images to the server. The server then takes the average of all the images. With a large enough sample size, the added noise cancels out (converges to zero) and you're left with approximately the average of the actual non-obfuscated data.

example

Getting Started

  1. Install node and Heroku CLI.

  2. Clone the repo and install dependencies, then create heroku instance.

npm install
heroku create

Also install python requirements.

pip install -r requirements.txt --user

  1. Upload to heroku web app.

    git push heroku master

  2. Start the python client which will collect the noisy images. Make sure to modify the HOST variable to your actual heroku url (e.g. https://glacial-dusk-26636.herokuapp.com/ for heroku).

python collector_client.py

  1. Visit your app on the web and put your face in the circle... It will take pictures, obfuscate the image, and send to the server. You should see images begin to show up in the images folder of wherever you are running the python client.

The app looks something like this:

app_screenshot

  1. Ideally you capture at least 1000 images. It works best with many clients (>20!) at same time in a room.

  2. Take the average of all the collected images.

    python calculate_avg.py

    And you will see a file myAverage.png show up in the root directory which contains the average.