20

Currently, if I have a facebook friend whom I've tagged in a picture that I've uploaded, when I upload a picture with his face on it, facebook automatically suggests his user as a tag.

Is it possible to emulate this same behavior via the facebook graph api or the SDK?

In other words, if I use the api as described on https://developers.facebook.com/docs/graph-api/reference/user/photos/ to upload a photo (described under "Creating") of a user that my account is friends with, is there any way facebook will make that same suggestion in the request return parameters or something like that?

user3682065
  • 281
  • 1
  • 3
  • 12

4 Answers4

13

Yes. You can use Facematch, an unofficial wrapper for the Facebook face recognition feature.

When you upload a picture on Facebook, the /photos/tagging/recognition endpoint is called. This program uploads a private picture (using Facebook API) + calls the recognition endpoint (by simulating a browser using the user's information).

Zool
  • 146
  • 1
  • 3
  • 1
    Note that currently tag suggestions are only available in the US: https://www.facebook.com/help/community/question/?id=838680732811167 and that there are privacy settings to restrict who can see your name in the tag suggestions: https://www.facebook.com/help/463455293673370/ which most people are likely to leave on friends only. – Ciro Santilli OurBigBook.com May 27 '16 at 09:17
  • 1
    For future viewers, Facematch and fbrecog won't work now, as the facebook API has removed the scope `publish_actions` from its SDK, on which these apps worked. – subtleseeker Mar 28 '19 at 11:19
1

You can use https://github.com/samj1912/fbrecog. Python wrapper for Facebook face recognition. And the only one in my knowledge that currently works.

samj1912
  • 106
  • 2
0

Face recognition is not exposed via the Graph API, so no, it's not possible.

Tobi
  • 31,405
  • 8
  • 58
  • 90
0

Facebook DeepFace face recognition model is wrapped by the deepface package for python. Also, the package offers an API to be called as rest services as well.

!pip install deepface
from deepface import DeepFace
resp = DeepFace.verify("img1.jpg", "img2.jpg", model_name = "DeepFace")
print(resp)
johncasey
  • 1,250
  • 8
  • 14