Brian C. Becker
Arcane Robotic Incantations
   

  Home
  News
  Projects
   - Face Recognition
     - Facebook Downloader
     - Facebook Extractor
     - Face Rec Evaluation
   - Compiler Tutorial

  Personal
  Professional
  Contact

  Photo Gallery
  

Facebook FaceRec Database Creator

One of the things I and my friend Enrique are interested in is applying face recognition to the social network of Facebook to automatically tag people in pictures. However, in order to do this you need data. Luckily Facebook has provided an API for you to get images and tags from Facebook user accounts. We created a small tool in C# that does this automatically, logging the data to disk for analysis. Because we are big believers in sharing research, we offering it here as a download to save you the time it would take to create your own application.

Download Windows C# Program or the MS Visual C# Source. We do ask if you use this program to reference our paper. We are quite interested in how you are using the data and what results you get so please drop us an email. For the EULA, scroll down to the bottom of the page. If you have problems/questions/bug reports/suggestions, please do contact me.

How to Use

First you will need to sign up for your own Facebook app. You will be issued an Application Key and Secret Key (write these down). Download the Windows C# Program or the MS Visual C# Source. You will find a facebook api key.txt file. Put your Application key on the second line and your Secret Key on the third line. Make sure you the Facebook user you want to download data for has either added your application or is listed as a developer (you can remove them later). Run VS Facebook.exe and log into Facebook. Select a directory to save the files and click Start.

Important note: This program downloads about one photo per second, so for Facebook users with a large number of friends and/or pictures, this process can take a while. Occasionally something will go wrong, but there is error checking in place to attempt a recover of a timeout and other such errors. Sometimes you will need to restart the program because it froze. Don't worry, it will automatically skip already processed files.

Database Format

Once a Facebook user has logged into the application, a list of friends for that user are collected and a folder is created for each one in the target directory in the form "<<Name>> (<<Facebook ID>>)." All the images associated with each user are then gathered and downloaded into their respective folders. To aid with the organization, the images are downloaded to a subfolder called "raw" for each friend. Only photos with tags in the image are downloaded, the others are skipped. If you want all the photos, remove the if statement saying "if (tags.Count > 0)" on line.

Each photo is named "<<Friend ID>>.<<Photo ID>>.jpg". By default the images are saved JPEG with 85% compression. By modifying the source you can save out PNG files if you prefer. Because multiple people are tagged in each image, you probably will get duplicate images (aka the same image will be downloaded for person X and person Y because they are both tagged in the image).

Tags associated with each image are saved with the same name as the photo but with a "txt" filename extension. Each tag is saved on an individual line in the format "<<Friend ID>>.<<Photo ID>>.<<Tagged Person ID>> <<X Coordinate>> <<Y Coordinate>>". The X and Y coordinates are specified in percentages of the image I believe so you may need to do some conversions later.

EULA

This application is not associated with Facebook in any way. By downloading this application, you agree to use this data responsibly only for research and academic purposes. You agree not to re-distribute or publish any photos without the express permission of the owners of the image. I think this is a nice resource for the face recognition community and I would hate to have this application taken down by Facebook because it is abused. Also, we are not liable for any caused damages or black holes or yada yada yada.

Ok, enough legalese, have fun with the data!

  

Copyright © Brian C. Becker @ www.BrianCBecker.com, design based on Steve's Template