Creating a Video Celebrity Analysis Job

Function

Create a video celebrity analysis job to recognize and analyze political figures and celebrities in videos and warn you of sensitive content in the videos. This helps you quickly locate and handle sensitive content in videos and reduce any non-compliance risks in your business.

  • Supported video formats: AVI, WMV, MPG, MPEG, MP4, MOV, M4V, MKV
  • Videos cannot be stored in OBS buckets encrypted by KMS.
  • The size of a single video cannot exceed 4 GB.
  • When data is read from a specified URL, the video size cannot exceed 1 GB.
  • The facial image must be at least 40 x 40 pixels.
  • Faces can be recognized with up to ±15° pitch and ±30° yaw.
  • A maximum of 20 faces can be identified at the same time.
  • Supported regions: CN North-Beijing1 and CN North-Beijing4.

URI

  • URI format:
    POST /v2/{project_id}/services/video-celebrity-recognition/tasks
  • Parameters

    Parameter

    Mandatory

    Type

    Description

    project_id

    Yes

    String

    Project ID corresponding to the region where the service is located. For details about how to obtain the project ID, see Obtaining the Project ID.

Request Parameters

  • Example request
    POST /v2/6204a5bd270343b5885144cf9c8c158d/services/video-celebrity-recognition/tasks  
     {  
         "name": "task-est",  
         "description": "description",  
         "input": {  
                "type": "obs",  
                "data": [  
                       {  
                        "bucket": "obs-iva",  
                        "path": "input/demo.mp4"  
                       }  
                ]  
         },  
         "output": {  
                "obs": {  
                       "bucket": "obs-iva",  
                       "path": "output/"  
                }  
         },  
        "service_version":"1.0"  
     }
  • Parameters

    Name

    Mandatory

    Type

    Description

    name

    Yes

    String

    The task name. It can be up to 100 characters long and can include Chinese characters, letters, digits, underscores (_), and hyphens (-).

    description

    No

    String

    A task description. It can be up to 500 characters long.

    input

    Yes

    Object

    List of input video data. Currently, the following input types are supported:
    • obs: Read video data from OBS on HUAWEI CLOUD. The video size cannot exceed 4 GB. Videos encrypted by KMS cannot be stored in OBS buckets.
    • url: Read video data from a specified URL. The video size cannot exceed 1 GB. Currently, only the URL of OBS is supported. You need to grant the anonymous users the permission to read the URL. For details, see Bucket ACL Overview.

    For details, see task.input.

    service_version

    Yes

    String

    Function version: 1.0.

    output

    Yes

    Object

    List of output result data. Currently, only the following output types are supported:
    • obs: Export the results to the OBS bucket you specified.
    • hosting: Host the results on OBS at the service side. The OBS path is specified by the service. You can obtain the path by using the API that queries a single task. For details, see Querying a Single Job.

    For details, see task.output.

Response Message

  • Example response
    [    
       {      "id": "f18320e61e4c4dc685aa2dfc22a28dc5"   }  
    ]
  • Parameters

    Name

    Type

    Description

    id

    String

    Task ID.

Video Analysis Results

  • The video analysis results are saved, in JSON format, to a location you have specified. Typical file content is as follows:
    "frames": [
            {
                "url": "obs-dushubao/wxh_hjx/videopolitics/est/shijiuda30min.mp4.capture/3018.jpg",
                "offset": "00:02:00",
                "result": [
                    {
    "Label": "Xi Jinping",
                        "confidence": 0.6001852750778198,
                        "face_detail": {
                            "h": 71,
                            "w": 50,
                            "x": 302,
                            "y": 167
                        }
                    },
                    {
    "Label": "Jiang Zemin",
                        "confidence": 0.7005537152290344,
                        "face_detail": {
                            "h": 61,
                            "w": 48,
                            "x": 420,
                            "y": 247
                        }
                    }
                ]
            },
    ]
  • Fields in the results file

    Field

    Description

    frames

    Video frame identification results

    url

    Video frame storage location

    offset

    Time when the identification was performed

    result

    Information about the detected celebrity

    label

    The name of the detected celebrity

    confidence

    Results confidence

    face_detail

    Facial details (in pixels)
    • h: Area height.
    • w: Area width.
    • x: X-coordinate of the upper left corner of the area.
    • y: Y-coordinate of the upper left corner of the area.

Status Codes

  • Normal

    201

  • Abnormal

    Status Code

    Description

    400 Bad Request

    Request error. For details about the returned error code, see Error Codes.

    401 Unauthorized

    Authentication failed.

    403 Forbidden

    No operation permission.

    404 Not Found

    The requested resource was not found.

    500 Internal Server Error

    Internal service error.

    503 Service Unavailable

    Service unavailable.