Recognizing celebrities

This page describes how to recognize celebrities in a video using the Video Intelligence API.

The Video Intelligence API can inspect your video content to detect and track human faces that appear in the input video or video segment. When it recognizes a face, the Video Intelligence API can compare the face against a collection of celebrities collated by Google.

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

Request access to the feature

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.

Recognize a celebrity in a video

The following code samples demonstrate how to recognize a celebrity's face in a video. The sample uses the optional outputUri field in the request to specify a location for the annotation results.

REST & CMD LINE

Send the request

The following shows how to send a POST request to the annotate method. The example uses the access token for a service account set up for the project using the Cloud SDK. For instructions on installing the Cloud SDK, setting up a project with a service account, and obtaining an access token, see the Video Intelligence quickstart.

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

  • input-uri: the Cloud Storage location of the video file you want to annotate.
  • output-uri: the Cloud Storage location where you want the results saved.

HTTP method and URL:

POST https://videointelligence.googleapis.com/v1p3beta1/videos:annotate

Request JSON body:

{
  "inputUri": "gs://input-uri",
  "outputUri": "gs://output-uri",
  "features": ["CELEBRITY_RECOGNITION"]
}

To send your request, expand one of these options:

You should receive a JSON response similar to the following:


{
  "name": "projects/project-number/locations/location-id/operations/operation-id"
}

If the request is successful, the Video Intelligence returns the name for your operation.

Get the results

To get the results of your request, you must send a GET request to the projects.operations resource. The following shows how to send such a request.

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

  • operation-name: the name field returned from the call to Video Intelligence API. This is a value in the format:
    projects/project-number/locations/location-id/operations/operation-id,
    where:
    • project-number is the number of your Google Cloud project,
    • location-id is the cloud region where annotation took place (for example: us-east1, us-west1, europe-west1, asia-east1),
    • operation-id is the ID of the long-running operation.

HTTP method and URL:

GET https://videointelligence.googleapis.com/v1/operation-name

To send your request, expand one of these options:

You should receive a JSON response similar to the following:

{
  "name": "projects/project-number/locations/location-id/operations/operation-id",
  "metadata": {
    "@type": "type.googleapis.com/google.cloud.videointelligence.v1p3beta1.AnnotateVideoProgress",
    "annotationProgress": [
      {
        "inputUri": "input-uri",
        "progressPercent": 100,
        "startTime": "2020-05-12T19:36:09.110351Z",
        "updateTime": "2020-05-12T19:36:17.519069Z"
      }
    ]
  },
  "done": true,
  "response": {
    "@type": "type.googleapis.com/google.cloud.videointelligence.v1p3beta1.AnnotateVideoResponse",
    "annotationResults": [
      {
        ...
      }
    ]
  }
}

The output from annotating the video should look similar to the following example.


{
  "annotationResults": [ {
    "inputUri": "input-uri,
    "segment": {
      "startTimeOffset": {

      },
      "endTimeOffset": {
        "seconds": 19,
        "nanos": 519500000
      }
    },
    "celebrityRecognitionAnnotations": {
      "celebrityTracks": [ {
        "celebrities": [...],
        "faceTrack": {...}
      }, {
        "celebrities": [ {
          "celebrity": {
            "name": "video-intelligence/celebrity-mid",
            "displayName": "celebrity-name"
          },
          "confidence": 0.81873637
        } ],
        "faceTrack": {
          "segment": {
            "startTimeOffset": {
              "seconds": 1,
              "nanos": 459791000
            },
            "endTimeOffset": {
              "seconds": 3,
              "nanos": 712041000
            }
          },
          "timestampedObjects": [ {
            "normalizedBoundingBox": {...},
            "timeOffset": {...}
          }, {
            "normalizedBoundingBox": {
              "left": 0.38046876,
              "top": 0.26249999,
              "right": 0.60312498,
              "bottom": 0.72361112
            },
            "timeOffset": {
              "seconds": 1,
              "nanos": 459791000
            }
          }, {
            "normalizedBoundingBox": {...},
            "timeOffset": {...}
          }]
        }
      }, {
        "celebrities": [...],
        "faceTrack": {...}
      } ]
    }
    ...
}

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 submit this form.

Report misuse

If you suspect that the Video Intelligence API celebrity recognition feature is being misused in any way, please let us know using this form.