When uploading pictures at facebook, it will collect related faces automatically ? ( How programmatically)

Posted on 2011-05-08
Last Modified: 2012-05-11
Hey guys, I am going crazy right now.
I simply was on my facebook account, and uploading 16 new photos of my friends.
and once it has finished uploading. i was wondering am i going to tag each one of my friends aghhh this will be boring.

But facebook after uploading it gaves me an AMAZING page , this page automatticly gave me all pictures and surrounding each face and telling me who is that guy.

This is a picture of the page im telling you about, you will see how facebook giving me each one of my friends in single block.

Please, anyone tell me how programmatically this is made, if anyone can give me explanation with php That would be great.

Thanks in advance.
Question by:hamidelgendy
    LVL 15

    Accepted Solution

    Facebook is using facedetection plugin and for your REF:
    LVL 8

    Assisted Solution

    Actually, this isn't simply detecting which part of the picture is the face. That is what the link above does. Facebook uses something different. Since Facebook knows your friends through the pictures they are already tagged in, and profile pictures they have uploaded, Facebook compares these pictures with the ones you have recently uploaded.

    I'm guessing they are not comparing each photo against all your friends. This would be painful for their servers. What I believe FB does is find the characteristics of the faces of its users. For instance: "this person has a long nose, wide eyes, blue eyes, big mouth, funny hair, etc." Then, it only compares this with the uploaded images.

    This may not really be what Facebook does, I don't work there so if I were to make something like this, this would be what I would do.

    * "profile" users by detecting face characteristics, store in a DB
    * compare face characteristics of friends against newly uploaded photos
    * group them

    It may sound simple but what is really difficult here is the algorithm to detect face characteristics which Facebook paid a huge amount of cash.

    They might not be using PHP to do this, it could be another software running at their end. Then, PHP is just used to serve the information.
    LVL 107

    Assisted Solution

    by:Ray Paseur
    Start your learning here.  A lot of PhD computer science and psychology researchers are working on this at warp-speed right now.
    LVL 37

    Assisted Solution

    I agree. There's no way they are doing face detection in PHP. Most likely the image processing is done on a backend server in C.

    Facial recognition has been a popular topic in image processing since the first digital image. Now it's a common feature in many apps (Google's Picasa, Facebook, any newish Mac OS). It's a bunch of math and statistical calculations to find the face and detect features and compare. You may have noticed that it's far from 100% accurate. Facial recognition is one of those things that humans still do much better than computers. It will be a long time before computers catch up in that area I believe.
    LVL 1

    Author Comment

    its not about that people can do it faster than computer or better than computer, its about what if im uploading a 200 pictures at the same moment, and i need to tag people haha this is Super boring and stupid to do all of it, so now the comupter need to wake up and do stuff like tagging them for me or even collecting them for me.

    But i finialy got what i want to understand Thanks guy.

    Featured Post

    How to improve team productivity

    Quip adds documents, spreadsheets, and tasklists to your Slack experience
    - Elevate ideas to Quip docs
    - Share Quip docs in Slack
    - Get notified of changes to your docs
    - Available on iOS/Android/Desktop/Web
    - Online/Offline

    Join & Write a Comment

    Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
    Part of the Global Positioning System A geocode ( is the major subset of a GPS coordinate (, the other parts being the altitude and t…
    Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
    The viewer will learn how to count occurrences of each item in an array.

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now