Celebrity recognition

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

Cloud Vision allows you to detect faces in an image. When it recognizes a face, the Cloud 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 Cloud 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

The Vision API can perform feature detection on a local image file by sending the contents of the image file as a base64 encoded string in the body of 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 & CMD LINE

Before using any of the request data below, 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.

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 called request.json, and execute the following command:

curl -X POST \
-H "Authorization: Bearer "$(gcloud auth application-default print-access-token) \
-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 called request.json, and execute the following command:

$cred = gcloud auth application-default print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }

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

For your convenience, the Vision API can perform feature detection directly on an image file located in Google Cloud Storage or on the Web without the need to send the contents of the image file in the body of 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 & CMD LINE

Before using any of the request data below, 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

HTTP method and URL:

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

Request JSON body:

{
  "requests": [
    {
      "image": {
        "source": {
          "imageUri": "cloud-storage-image-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 called request.json, and execute the following command:

curl -X POST \
-H "Authorization: Bearer "$(gcloud auth application-default print-access-token) \
-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 called request.json, and execute the following command:

$cred = gcloud auth application-default print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }

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 the Cloud Vision or Video Intelligence API, please fill out and submit this form.

Report misuse

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

Was this page helpful? Let us know how we did:

Send feedback about...

Cloud Vision API Documentation
Need help? Visit our support page.