Celebrity recognition

This page describes how to recognize celebrities in images using the Vision API.

The Vision API allows you to detect faces in an image. When it recognizes a face, the Vision API can compare the face against an indexed gallery of celebrities collated by Google.

The Vision API can recognize thousands of celebrities, and is intended for use on only professionally photographed media content where commonly recognizable celebrities are known to appear in the image.

If a match is found, the Vision API provides the Knowledge Graph Machine ID (MID) of the celebrity, their name, and a bounding box indicating where the face appears in the image.

Request API access

This feature is intended for use by media & entertainment companies or approved partners on professionally-produced media content. To request API access, please submit this form with information about your company and use case.

Request Celebrity Recognition for a local image

You can use the Vision API to perform feature detection on a local image file.

For REST requests, send the contents of the image file as a base64 encoded string in the body of your request.

For gcloud and client library requests, specify the path to a local image in your request.

To send a Celebrity Recognition request you first get access to the feature for your project and then use the existing face detection feature (FACE_DETECTION enum). Results contain celebrity information if a celebrity is detected.

REST

Before using any of the request data, make the following replacements:

  • BASE64_ENCODED_IMAGE: The base64 representation (ASCII string) of your binary image data. This string should look similar to the following string:
    • /9j/4QAYRXhpZgAA...9tAVx/zDQDlGxn//2Q==
    Visit the base64 encode topic for more information.
  • PROJECT_ID: Your Google Cloud project ID.

HTTP method and URL:

POST https://vision.googleapis.com/v1p4beta1/images:annotate

Request JSON body:

{
  "requests": [
    {
      "image": {
        "content": "BASE64_ENCODED_IMAGE"
      },
      "features": [
        {
          "type": "FACE_DETECTION"
        }
      ],
      "imageContext": {
        "faceRecognitionParams": {
            "celebritySet": ["builtin/default"]
        }
      }
    }
  ]
}

To send your request, choose one of these options:

curl

Save the request body in a file named request.json, and execute the following command:

curl -X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "x-goog-user-project: PROJECT_ID" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"https://vision.googleapis.com/v1p4beta1/images:annotate"

PowerShell

Save the request body in a file named request.json, and execute the following command:

$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred"; "x-goog-user-project" = "PROJECT_ID" }

Invoke-WebRequest `
-Method POST `
-Headers $headers `
-ContentType: "application/json; charset=utf-8" `
-InFile request.json `
-Uri "https://vision.googleapis.com/v1p4beta1/images:annotate" | Select-Object -Expand Content

You should receive a JSON response similar to the following:

Request Celebrity Recognition for a remote image

You can use the Vision API to perform feature detection on a remote image file that is located in Cloud Storage or on the Web. To send a remote file request, specify the file's Web URL or Cloud Storage URI in the request body.

To send a Celebrity Recognition request you first get access to the feature for your project and then use the existing face detection feature (FACE_DETECTION enum). Results contain celebrity information if a celebrity is detected.

REST

Before using any of the request data, make the following replacements:

  • CLOUD_STORAGE_IMAGE_URI: the path to a valid image file in a Cloud Storage bucket. You must at least have read privileges to the file. Example:
    • gs://my-cloud-bucket/img/celebrity_image.jpg
  • PROJECT_ID: Your Google Cloud project ID.

HTTP method and URL:

POST https://vision.googleapis.com/v1p4beta1/images:annotate

Request JSON body:

{
  "requests": [
    {
      "image": {
        "source": {
          "imageUri": "CLOUD_STORAGE_FILE_URI"
        }
      },
      "features": [
        {
          "type": "FACE_DETECTION"
        }
      ],
      "imageContext": {
        "faceRecognitionParams": {
            "celebritySet": ["builtin/default"]
        }
      }
    }
  ]
}

To send your request, choose one of these options:

curl

Save the request body in a file named request.json, and execute the following command:

curl -X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "x-goog-user-project: PROJECT_ID" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"https://vision.googleapis.com/v1p4beta1/images:annotate"

PowerShell

Save the request body in a file named request.json, and execute the following command:

$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred"; "x-goog-user-project" = "PROJECT_ID" }

Invoke-WebRequest `
-Method POST `
-Headers $headers `
-ContentType: "application/json; charset=utf-8" `
-InFile request.json `
-Uri "https://vision.googleapis.com/v1p4beta1/images:annotate" | Select-Object -Expand Content

You should receive a JSON response similar to the following:

Request celebrity opt-out

If you are a celebrity and would like not to be included in this feature for either Cloud Vision or Video Intelligence API, please fill out and submit this form.

Report misuse

If you suspect the Vision API Celebrity Recognition feature is being misused in any way, please let us know using this form.