|
| 1 | +--- |
| 2 | +title: Detect textual logo with Azure Video Indexer |
| 3 | +description: This article gives an overview of Azure Video Indexer textual logo detection. |
| 4 | +ms.topic: how-to |
| 5 | +ms.date: 01/22/2023 |
| 6 | +ms.author: juliako |
| 7 | +--- |
| 8 | + |
| 9 | +# How to detect textual logo (preview) |
| 10 | + |
| 11 | +> [!NOTE] |
| 12 | +> Textual logo detection (preview) creation process is currently available through API. The result can be viewed through the Azure Video Indexer [website](https://www.videoindexer.ai/). |
| 13 | +
|
| 14 | +**Textual logo detection** insights are based on the OCR textual detection, which matches a specific predefined text. |
| 15 | + |
| 16 | +For example, if a user would create a textual logo: “Microsoft”, different appearances of the word ‘Microsoft’ will be detected as the ‘Microsoft’ logo. A logo can have different variations, these variations can be associated with the main logo name. For example, user might have under the ‘Microsoft’ logo the following variations: ‘MS’, ‘MSFT’ etc. |
| 17 | + |
| 18 | +```json |
| 19 | +{ |
| 20 | + "name": "Microsoft", |
| 21 | + "wikipediaSearchTerm": "Microsoft", |
| 22 | + "textVariations": [{ |
| 23 | + "text": "Microsoft", |
| 24 | + "caseSensitive": false |
| 25 | + }, { |
| 26 | + "text": "MSFT", |
| 27 | + "caseSensitive": true |
| 28 | + }] |
| 29 | +} |
| 30 | +``` |
| 31 | + |
| 32 | +> [!div class="mx-imgBorder"] |
| 33 | +> :::image type="content" source="./media/textual-logo-detection/microsoft-example.png" alt-text="Diagram of logo detection."::: |
| 34 | +
|
| 35 | +## Prerequisite |
| 36 | + |
| 37 | +The Azure Video Index account must have (at the very least) the `contributor` role assigned to the resource. |
| 38 | + |
| 39 | +## How to use |
| 40 | + |
| 41 | +In order to use textual logo detection, follow these steps, described in this article: |
| 42 | + |
| 43 | +1. Create a logo instance using with the [Create logo](https://api-portal.videoindexer.ai/api-details#api=Operations&operation=Create-Logo) API (with variations). |
| 44 | + |
| 45 | + * Save the logo ID. |
| 46 | +1. Create a logo group using the [Create Logo Group](https://api-portal.videoindexer.ai/api-details#api=Operations&operation=Create-Logo-Group) API. |
| 47 | + |
| 48 | + * Associate the logo instance with the group when creating the new group (by pasting the ID in the logos array). |
| 49 | +1. 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. |
| 50 | + |
| 51 | +## Create a logo instance |
| 52 | + |
| 53 | +Use the [Create logo](https://api-portal.videoindexer.ai/api-details#api=Operations&operation=Create-Logo) API to create your logo. You can use the **try it** button. |
| 54 | + |
| 55 | +> [!div class="mx-imgBorder"] |
| 56 | +> :::image type="content" source="./media/textual-logo-detection/logo-api.png" alt-text="Diagram of logo API."::: |
| 57 | + |
| 58 | +In this tutorial we use the example supplied as default: |
| 59 | + |
| 60 | +Insert the following: |
| 61 | + |
| 62 | +* `Location`: The location of the Azure Video Indexer account. |
| 63 | +* `Account ID`: The ID of the Azure Video Indexer account. |
| 64 | +* `Access token`: The token, at least at a contributor level permission. |
| 65 | + |
| 66 | +The default body is: |
| 67 | + |
| 68 | +```json |
| 69 | +{ |
| 70 | + "name": "Microsoft", |
| 71 | + "wikipediaSearchTerm": "Microsoft", |
| 72 | + "textVariations": [{ |
| 73 | + "text": "Microsoft", |
| 74 | + "caseSensitive": false |
| 75 | + }, { |
| 76 | + "text": "MSFT", |
| 77 | + "caseSensitive": true |
| 78 | + }] |
| 79 | +} |
| 80 | +``` |
| 81 | + |
| 82 | +|Key|Value| |
| 83 | +|---|---| |
| 84 | +|Name|Name of the logo, would be used in the Azure Video Indexer website.| |
| 85 | +|wikipediaSearchTerm|Used to create a description in the Video Indexer website.| |
| 86 | +|text|The text the model will compare too, make sure to add the obvious name as part of the variations. (e.g Microsoft)| |
| 87 | +|caseSensitive| true/false according to the variation.| |
| 88 | + |
| 89 | +The response should return **201 Created**. |
| 90 | + |
| 91 | +``` |
| 92 | +HTTP/1.1 201 Created |
| 93 | +
|
| 94 | +content-type: application/json; charset=utf-8 |
| 95 | +
|
| 96 | +{ |
| 97 | + "id": "id" |
| 98 | + "creationTime": "2023-01-15T13:08:14.9518235Z", |
| 99 | + "lastUpdateTime": "2023-01-15T13:08:14.9518235Z", |
| 100 | + "lastUpdatedBy": "Jhon Doe", |
| 101 | + "createdBy": "Jhon Doe", |
| 102 | + "name": "Microsoft", |
| 103 | + "wikipediaSearchTerm": "Microsoft", |
| 104 | + "textVariations": [{ |
| 105 | + "text": "Microsoft", |
| 106 | + "caseSensitive": false, |
| 107 | + "creationTime": "2023-01-15T13:08:14.9518235Z", |
| 108 | + "createdBy": "Jhon Doe" |
| 109 | + }, { |
| 110 | + "text": "MSFT", |
| 111 | + "caseSensitive": true, |
| 112 | + "creationTime": "2023-01-15T13:08:14.9518235Z", |
| 113 | + "createdBy": "Jhon Doe" |
| 114 | + }] |
| 115 | +} |
| 116 | +``` |
| 117 | +## Create a new textual logo group |
| 118 | + |
| 119 | +Use the [Create Logo Group](https://api-portal.videoindexer.ai/api-details#api=Operations&operation=Create-Logo-Group) API to create a logo group. Use the **try it** button. |
| 120 | + |
| 121 | +Insert the following: |
| 122 | + |
| 123 | +* `Location`: The location of the Azure Video Indexer account. |
| 124 | +* `Account ID`: The ID of the Azure Video Indexer account. |
| 125 | +* `Access token`: The token, at least at a contributor level permission. |
| 126 | + |
| 127 | +> [!div class="mx-imgBorder"] |
| 128 | +> :::image type="content" source="./media/textual-logo-detection/logo-group-api.png" alt-text="Diagram of logo group API."::: |
| 129 | +
|
| 130 | +In the **Body** paste the logo ID from the previous step. |
| 131 | + |
| 132 | +```json |
| 133 | +{ |
| 134 | + "logos": [{ |
| 135 | + "logoId": "id" |
| 136 | + }], |
| 137 | + "name": "Technology", |
| 138 | + "description": "A group of logos of technology companies." |
| 139 | +} |
| 140 | +``` |
| 141 | + |
| 142 | +* The default example has two logo IDs, we have created the first group with only one logo ID. |
| 143 | + |
| 144 | + The response should return **201 Created**. |
| 145 | + |
| 146 | + ``` |
| 147 | + HTTP/1.1 201 Created |
| 148 | + |
| 149 | + content-type: application/json; charset=utf-8 |
| 150 | + |
| 151 | + { |
| 152 | + "id": "id", |
| 153 | + "creationTime": "2023-01-15T14:41:11.4860104Z", |
| 154 | + "lastUpdateTime": "2023-01-15T14:41:11.4860104Z", |
| 155 | + "lastUpdatedBy": "Jhon Doe", |
| 156 | + "createdBy": "Jhon Doe", |
| 157 | + "logos": [{ |
| 158 | + "logoId": " e9d609b4-d6a6-4943-86ff-557e724bd7c6" |
| 159 | + }], |
| 160 | + "name": "Technology", |
| 161 | + "description": "A group of logos of technology companies." |
| 162 | + } |
| 163 | + ``` |
| 164 | +
|
| 165 | +## Upload from URL |
| 166 | + |
| 167 | +Use the upload API call: |
| 168 | +
|
| 169 | +Specify the following: |
| 170 | +
|
| 171 | +* `Location`: The location of the Azure Video Indexer account. |
| 172 | +* `Account`: The ID of the Azure Video Indexer account. |
| 173 | +* `Name`: The name of the media file you're indexing. |
| 174 | +* `Language`: `en-US`. For more information, see [Language support](language-support.md) |
| 175 | +* `IndexingPreset`: Select **Advanced Video/Audio+video**. |
| 176 | +* `Videourl`: The url. |
| 177 | +* `LogoGroupID`: GUID representing the logo group (you got it in the response when creating it). |
| 178 | +* `Access token`: The token, at least at a contributor level permission. |
| 179 | + |
| 180 | +## Inspect the output |
| 181 | +
|
| 182 | +Assuming the textual logo model has found a match, you'll be able to view the result in the [Azure Video Indexer website](https://www.videoindexer.ai/). |
| 183 | + |
| 184 | +### Insights |
| 185 | +
|
| 186 | +A new section would appear in the insights panel showing the number of custom logos that were detected. One representative thumbnail will be displayed representing the new logo. |
| 187 | +
|
| 188 | +> [!div class="mx-imgBorder"] |
| 189 | +> :::image type="content" source="./media/textual-logo-detection/logo-insight.png" alt-text="Diagram of logo insight."::: |
| 190 | +
|
| 191 | +### Timeline |
| 192 | +
|
| 193 | +When switching to the Timeline view, under the **View**, mark the **Logos** checkbox. All detected thumbnails will be displayed according to their time stamp. |
| 194 | +
|
| 195 | +> [!div class="mx-imgBorder"] |
| 196 | +> :::image type="content" source="./media/textual-logo-detection/logo-timeline.png" alt-text="Diagram of logo timeline."::: |
| 197 | +
|
| 198 | +All logo instances that were recognized with a certainty above 80% present will be displayed, the extended list of detection including low certainty detection are available in the [Artifacts](https://api-portal.videoindexer.ai/api-details#api=Operations&operation=Get-Video-Artifact-Download-Url) file. |
| 199 | +
|
| 200 | +## Next steps |
| 201 | +
|
| 202 | +### Adding a logo to an existing logo group |
| 203 | +
|
| 204 | +In the first part of this article, we had one instance of a logo and we have associated it 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: |
| 205 | +
|
| 206 | +1. Create the logo. |
| 207 | +
|
| 208 | + 1. Copy the logo ID. |
| 209 | +1. [Get logo groups](https://api-portal.videoindexer.ai/api-details#api=Operations&operation=Get-Logo-Groups). |
| 210 | +
|
| 211 | + 1. Copy the logo group ID of the right group. |
| 212 | +1. [Get logo group](https://api-portal.videoindexer.ai/api-details#api=Operations&operation=Get-Logo-Group). |
| 213 | +
|
| 214 | + 1. Copy the response the list of logos IDs: |
| 215 | +
|
| 216 | + Logo list sample: |
| 217 | +
|
| 218 | + ```json |
| 219 | + "logos": [{ |
| 220 | + "logoId": "id" |
| 221 | + }], |
| 222 | + ``` |
| 223 | +1. [Update logo group](https://api-portal.videoindexer.ai/api-details#api=Operations&operation=Update-Logo-Group). |
| 224 | +
|
| 225 | + 1. Logo group ID is the output received at step 2. |
| 226 | + 1. At the ‘Body’ of the request, paste the existing list of logos from step 3. |
| 227 | + 1. Then add to the list the logo ID from step 1. |
| 228 | +1. Validate the response of the [Update logo group](https://api-portal.videoindexer.ai/api-details#api=Operations&operation=Get-Logo-Groups) making sure the list contains the previous IDs and the new. |
| 229 | +
|
| 230 | +### Additional information and limitations |
| 231 | + |
| 232 | +* A logo group can contain up to 50 logos. |
| 233 | +* One logo can be linked to more than one group. |
| 234 | +* Use the [Update logo group](https://api-portal.videoindexer.ai/api-details#api=Operations&operation=Get-Logo-Groups) to add the new logo to an existing group. |
0 commit comments