How to detect textual logo

Important

Due to the Azure Media Services retirement announcement, Azure AI Video Indexer announces Azure AI Video Indexer features adjustments. See Changes related to Azure Media Service (AMS) retirement to understand what this means for your Azure AI Video Indexer account. See the Preparing for AMS retirement: VI update and migration guide.

Note

Textual logo detection (preview) creation process is currently available through API. The result can be viewed through the Azure AI Video Indexer website.

Textual logo detection insights are based on the Optical Character Recognition (OCR) textual detection, which matches a specific predefined text.

For example, if you created the textual logo "Microsoft", appearances of the word "Microsoft" are detected as the Microsoft logo. A logo can have different variations. These variations can be associated with the main logo name. For example, you might have under the ‘Microsoft’ logo the following variations: ‘MS’, ‘MSFT’ etc.

{
    "name": "Microsoft",
    "wikipediaSearchTerm": "Microsoft",
    "textVariations": [{
    "text": "Microsoft",
    "caseSensitive": false
    }, {
    "text": "MSFT",
    "caseSensitive": true
    }]
}

Diagram of logo detection.

Prerequisite

The Azure Video Index account must have at least the contributor role assigned to the resource.

How to use

In order to use textual logo detection, follow these steps, described in this article:

  1. Create a logo instance using with the Create logo API (with variations).

    • Save the logo ID.
  2. Create a logo group using the Create Logo Group API.

    • Associate the logo instance with the group when creating the new group (by pasting the ID in the logos array).
  3. Upload a video using: Advanced video or Advance video + audio preset, use the logoGroupId parameter to specify the logo group you would like to index the video with.

Create a logo instance

Use the Create logo API to create your logo. You can use the try it button.

Diagram of logo API.

In this example, we use the example supplied as default:

Insert the following parameters:

  • Location: The location of the Azure AI Video Indexer account.
  • Account ID: The ID of the Azure AI Video Indexer account.
  • Access token: The token, at least at a contributor level permission.

The default body is:

{
    "name": "Microsoft",
    "wikipediaSearchTerm": "Microsoft",
    "textVariations": [{
    "text": "Microsoft",
    "caseSensitive": false
    }, {
    "text": "MSFT",
    "caseSensitive": true
    }]
}
Key Value
Name Name of the logo used in the Azure AI Video Indexer website.
wikipediaSearchTerm Term used to create a description in the Video Indexer website.
text The text the model uses for comparison. Make sure to add the obvious name as part of the variations. (e.g Microsoft)
caseSensitive Determines whether the text is case sensitive. Set to true/false according to the variation.

The response should return 201 Created.

HTTP/1.1 201 Created

content-type: application/json; charset=utf-8

{
    "id": "id"
    "creationTime": "2023-01-15T13:08:14.9518235Z",
    "lastUpdateTime": "2023-01-15T13:08:14.9518235Z",
    "lastUpdatedBy": "Jhon Doe",
    "createdBy": "Jhon Doe",
    "name": "Microsoft",
    "wikipediaSearchTerm": "Microsoft",
    "textVariations": [{
        "text": "Microsoft",
        "caseSensitive": false,
        "creationTime": "2023-01-15T13:08:14.9518235Z",
        "createdBy": "Jhon Doe"
    }, {
        "text": "MSFT",
        "caseSensitive": true,
        "creationTime": "2023-01-15T13:08:14.9518235Z",
        "createdBy": "Jhon Doe"
    }]
}

Create a new textual logo group

Use the Create Logo Group API to create a logo group. Use the try it button.

Insert the following parameters:

  • Location: The location of the Azure AI Video Indexer account.
  • Account ID: The ID of the Azure AI Video Indexer account.
  • Access token: The token, at least at a contributor level permission.

Diagram of logo group API.

In the Body paste the logo ID from the previous step.

{
    "logos": [{
        "logoId": "id"
    }],
    "name": "Technology",
    "description": "A group of logos of technology companies."
}
  • The default example has two logo IDs. The first group was created with only one logo ID.

    The response should return 201 Created.

    HTTP/1.1 201 Created
    
    content-type: application/json; charset=utf-8
    
    {
        "id": "id",
        "creationTime": "2023-01-15T14:41:11.4860104Z",
        "lastUpdateTime": "2023-01-15T14:41:11.4860104Z",
        "lastUpdatedBy": "Jhon Doe",
        "createdBy": "Jhon Doe",
        "logos": [{
            "logoId": " e9d609b4-d6a6-4943-86ff-557e724bd7c6"
        }],
        "name": "Technology",
        "description": "A group of logos of technology companies."
    }    
    

Upload from URL

Use the upload API call:

Specify the following parameters:

  • Location: The location of the Azure AI Video Indexer account
  • Account: The ID of the Azure AI Video Indexer account
  • Name: The name of the media file you're indexing
  • Language: en-US. For more information, see Language support.
  • IndexingPreset: Select Advanced Video/Audio+video
  • Videourl: The url
  • LogoGroupID: GUID representing the logo group (you got it in the response when creating it)
  • Access token: The token, at least at a contributor level permission

Inspect the output

Assuming the textual logo model finds a match, you're able to view the result in the Azure AI Video Indexer website.

Insights

A new section would appear in the insights panel showing the number of custom logos that were detected. One representative thumbnail is displayed representing the new logo.

Diagram of logo insight.

Timeline

When switching to the Timeline view, under the View, mark the Logos checkbox. All detected thumbnails are displayed according to their time stamp.

Diagram of logo timeline.

All logo instances that were recognized with a certainty above 80% present are displayed. The extended list of detections, including low certainty detection, are available in the Artifacts file.

Add a logo to an existing logo group

In the first part of this article, there was one instance of a logo and associated to the right logo group upon the creation of the logo group. If all logo instances are created before the logo group is created, they can be associated with logo group on the creation phase. However, if the group was already created, the new instance should be associated to the group following these steps:

  1. Create the logo.

    1. Copy the logo ID.
  2. Get logo groups.

    1. Copy the logo group ID of the right group.
  3. Get logo group.

    1. Copy the response the list of logos IDs:

    Logo list sample:

    "logos": [{
        "logoId": "id"
    }],
    
  4. Update logo group.

    1. Logo group ID is the output received at step 2.
    2. At the ‘Body’ of the request, paste the existing list of logos from step 3.
    3. Then add to the list the logo ID from step 1.
  5. Validate the response of the Update logo group making sure the list contains the previous IDs and the new.

Additional information and limitations

  • A logo group can contain up to 50 logos.
  • One logo can be linked to more than one group.
  • Use the Update logo group to add the new logo to an existing group.