|
| 1 | +--- |
| 2 | +title: Quickstart image search |
| 3 | +titleSuffix: Azure AI Search |
| 4 | +description: Index and query images on Azure AI Search using the Azure portal. Run the Import and vectorize data wizard to vectorize images. Use Search Explorer to query images. |
| 5 | + |
| 6 | +author: HeidiSteen |
| 7 | +ms.author: heidist |
| 8 | +ms.service: cognitive-search |
| 9 | +ms.topic: quickstart |
| 10 | +ms.date: 06/14/2024 |
| 11 | +ms.custom: |
| 12 | + - references_regions |
| 13 | +--- |
| 14 | + |
| 15 | +# Quickstart: Image search using Search Explorer in Azure portal |
| 16 | + |
| 17 | +> [!IMPORTANT] |
| 18 | +> Image vectors are supported in stable API versions, but the wizard and vectorizers are in public preview under [Supplemental Terms of Use](https://azure.microsoft.com/support/legal/preview-supplemental-terms/). By default, the wizard targets the [2024-05-01-Preview REST API](/rest/api/searchservice/skillsets/create-or-update?view=rest-searchservice-2024-05-01-preview&preserve-view=true). |
| 19 | +
|
| 20 | +Get started with image search using the **Import and vectorize data** wizard in the Azure portal and use **Search explorer** to run image-based queries. |
| 21 | + |
| 22 | +You need three Azure resources and some sample image files to complete this walkthrough: |
| 23 | + |
| 24 | +> [!div class="checklist"] |
| 25 | +> + Azure Storage to store image files as blobs |
| 26 | +> + Azure AI services multiservice account, used for image vectorization and Optical Character Recognition (OCR) |
| 27 | +> + Azure AI Search for indexing and queries |
| 28 | +
|
| 29 | +Sample data consists of image files in the [azure-search-sample-data](https://github.com/Azure-Samples/azure-search-sample-data/tree/main/unsplash-images) repo, but you can use different images and still follow this walkthrough. |
| 30 | + |
| 31 | +## Prerequisites |
| 32 | + |
| 33 | ++ An Azure subscription. [Create one for free](https://azure.microsoft.com/free/). |
| 34 | + |
| 35 | ++ Azure AI services, a multiservice account, in a region that provides Azure AI Vision multimodal embeddings. |
| 36 | + |
| 37 | + Currently, those regions are: SwedenCentral, EastUS, NorthEurope, WestEurope, WestUS, SoutheastAsia, KoreaCentral, FranceCentral, AustraliaEast, WestUS2, SwitzerlandNorth, JapanEast. [Check the documentation](/azure/ai-services/computer-vision/how-to/image-retrieval) for an updated list. |
| 38 | + |
| 39 | ++ Azure AI Search, on any tier, but in the same region as Azure AI services. |
| 40 | + |
| 41 | + Service tier determines how many blobs you can index. We used the free tier to create this walkthrough and limited the content to 10 JPG files. |
| 42 | + |
| 43 | ++ Azure Storage, a standard performance (general-purpose v2) account. Access tiers can be hot, cool, and cold. |
| 44 | + |
| 45 | +All of the above resources must have public access enabled for the portal nodes to be able to access them. Otherwise, the wizard fails. After the wizard runs, firewalls and private endpoints can be enabled on the different integration components for security. |
| 46 | + |
| 47 | +A free search service supports role-based access control on connections to Azure AI Search, but it doesn't support managed identities on outbound connections to Azure Storage or Azure AI Vision. This means you must use key-based authentication on free search service connections to other Azure services. For more secure connections, use basic tier or above and [configure a managed identity](search-howto-managed-identities-data-sources.md) and role assignments to admit requests from Azure AI Search on other Azure services. |
| 48 | + |
| 49 | +## Check for space |
| 50 | + |
| 51 | +If you're starting with the free service, you're limited to three indexes, three data sources, three skillsets, and three indexers. Make sure you have room for extra items before you begin. This quickstart creates one of each object. |
| 52 | + |
| 53 | +## Prepare sample data |
| 54 | + |
| 55 | +1. Download the [unsplash-signs image folder](https://github.com/Azure-Samples/azure-search-sample-data/tree/main/unsplash-images/jpg-signs) to a local folder or find some images of your own. On a free search service, keep the image files under 20 to stay under the free quota for enrichment processing. |
| 56 | + |
| 57 | +1. Sign in to the [Azure portal](https://portal.azure.com/) with your Azure account, and go to your Azure Storage account. |
| 58 | + |
| 59 | +1. In the navigation pane, under **Data Storage**, select **Containers**. |
| 60 | + |
| 61 | +1. Create a new container and then upload the images. |
| 62 | + |
| 63 | +## Start the wizard |
| 64 | + |
| 65 | +If your search service and Azure AI service are located in the same [supported region](/azure/ai-services/computer-vision/how-to/image-retrieval) and tenant, and if your Azure Storage blob container is using the default configuration, you're ready to start the wizard. |
| 66 | + |
| 67 | +1. Sign in to the [Azure portal](https://portal.azure.com/) with your Azure account, and go to your Azure AI Search service. |
| 68 | + |
| 69 | +1. On the **Overview** page, select **Import and vectorize data**. |
| 70 | + |
| 71 | + :::image type="content" source="media/search-get-started-portal-import-vectors/command-bar.png" alt-text="Screenshot of the wizard command."::: |
| 72 | + |
| 73 | +## Connect to your data |
| 74 | + |
| 75 | +The next step is to connect to a data source that provides the images. |
| 76 | + |
| 77 | +1. On the **Connect to your data** tab, select **Azure Blob Storage**. |
| 78 | + |
| 79 | +1. Specify the Azure subscription. |
| 80 | + |
| 81 | +1. For Azure Storage, select the account and container that provides the data. Use the default values for the remaining fields. |
| 82 | + |
| 83 | + :::image type="content" source="media/search-get-started-portal-images/connect-to-your-data.png" alt-text="Screenshot of the connect to your data page in the wizard."::: |
| 84 | + |
| 85 | +1. Select **Next**. |
| 86 | + |
| 87 | +## Vectorize your text |
| 88 | + |
| 89 | +If raw content includes text, or if the skillset produces text, the wizard calls a text embedding model to generate vectors for that content. In this exercise, text will be produced from the Optical Character Recognition (OCR) skill that you add in the next step. |
| 90 | + |
| 91 | +Azure AI Vision provides text embeddings, so we'll use that resource for text vectorization. |
| 92 | + |
| 93 | +1. On the **Vectorize your text** page, select **AI Vision vectorization**. If it's not selectable, make sure Azure AI Search and your Azure AI multiservice account are together in a region that [supports AI Vision multimodal APIs](/azure/ai-services/computer-vision/how-to/image-retrieval). |
| 94 | + |
| 95 | + :::image type="content" source="media/search-get-started-portal-images/vectorize-your-text.png" alt-text="Screenshot of the Vectorize your text page in the wizard."::: |
| 96 | + |
| 97 | +1. Select **Next**. |
| 98 | + |
| 99 | +## Vectorize and enrich your images |
| 100 | + |
| 101 | +Use Azure AI Vision to generate a vector representation of the image files. |
| 102 | + |
| 103 | +In this step, you can also apply AI to extract text from images. The wizard uses OCR from Azure AI services to recognize text in image files. Two more outputs appear in the index when OCR is added to the workflow: |
| 104 | + |
| 105 | ++ First, the "chunk" field is populated with the OCR-generated string. |
| 106 | + |
| 107 | ++ Second, the "text_vector" field is populated with an embedding that represents the string. |
| 108 | + |
| 109 | +The inclusion of plain text in an index is useful if you want to use relevance features that operate on strings, such as semantic ranking and scoring profiles. |
| 110 | + |
| 111 | +1. On the **Vectorize your images** page, select the **Vectorize images** checkbox, and then select **AI Vision vectorization**. |
| 112 | + |
| 113 | +1. Select **Use same AI service selected for text vectorization**. |
| 114 | + |
| 115 | +1. In the enrichment section, select **Extract text from images**. |
| 116 | + |
| 117 | +1. Select **Use same AI service selected for image vectorization**. |
| 118 | + |
| 119 | + :::image type="content" source="media/search-get-started-portal-images/vectorize-enrich-images.png" alt-text="Screenshot of the Vectorize your images page in the wizard."::: |
| 120 | + |
| 121 | +1. Select **Next**. |
| 122 | + |
| 123 | +## Advanced settings |
| 124 | + |
| 125 | +1. Specify a [run time schedule](search-howto-schedule-indexers.md) for the indexer. We recommend **Once** for this exercise, but for data sources where the underlying data is volatile, you can schedule indexing to pick up the changes. |
| 126 | + |
| 127 | + :::image type="content" source="media/search-get-started-portal-images/run-once.png" alt-text="Screenshot of the Advanced settings page in the wizard."::: |
| 128 | + |
| 129 | +1. Select **Next**. |
| 130 | + |
| 131 | +## Run the wizard |
| 132 | + |
| 133 | +1. On Review and create, specify a prefix for the objects created when the wizard runs. The wizard creates multiple objects. A common prefix helps you stay organized. |
| 134 | + |
| 135 | + :::image type="content" source="media/search-get-started-portal-images/review-create.png" alt-text="Screenshot of the Review and create page in the wizard."::: |
| 136 | + |
| 137 | +1. Select **Create** to run the wizard. This step creates the following objects: |
| 138 | + |
| 139 | + + Data source connection to blob storage. |
| 140 | + |
| 141 | + + Index with vector fields, text fields, vectorizers, vector profiles, vector algorithms. You can't modify the default index during the wizard workflow. Indexes conform to the [2024-05-01-preview REST API](/rest/api/searchservice/indexes/create-or-update?view=rest-searchservice-2024-05-01-preview&preserve-view=true). |
| 142 | + |
| 143 | + + Skillset with the following five skills: |
| 144 | + |
| 145 | + + [OCR skill](cognitive-search-skill-ocr.md) recognizes text in image files. |
| 146 | + |
| 147 | + + [Text Merger skill](cognitive-search-skill-textmerger.md) unifies the various outputs of OCR processing. |
| 148 | + |
| 149 | + + [Text Split skill](cognitive-search-skill-textsplit.md) adds data chunking. This skill is built into the wizard workflow. |
| 150 | + |
| 151 | + + [Azure AI Vision multimodal](cognitive-search-skill-vision-vectorize.md) is used to vectorize text generated from OCR. |
| 152 | + |
| 153 | + + [Azure AI Vision multimodal](cognitive-search-skill-vision-vectorize.md) is called again to vectorize images. |
| 154 | + |
| 155 | + + Indexer with field mappings and output field mappings. |
| 156 | + |
| 157 | +## Check results |
| 158 | + |
| 159 | +Search explorer accepts text, vectors, and images as query inputs. You can drag or select an image into the search area, and it will be vectorized for search. Image vectorization assumes that your index has a vectorizer definition, which **Import and vectorize data** creates from your inputs. |
| 160 | + |
| 161 | +1. In the Azure portal, under **Search Management** and **Indexes**, select the index your created. An embedded Search Explorer is the first tab. |
| 162 | + |
| 163 | +1. Under **View**, select **Image view**. |
| 164 | + |
| 165 | + :::image type="content" source="media/search-get-started-portal-images/select-image-view.png" alt-text="Screenshot of the query options button with image view."::: |
| 166 | + |
| 167 | +1. Drag an image from the local folder that contains the sample image files. Or, open the file browser to select a local image file. |
| 168 | + |
| 169 | +1. Select **Search** to run the query |
| 170 | + |
| 171 | + :::image type="content" source="media/search-get-started-portal-images/image-search.png" alt-text="Screenshot of search results."::: |
| 172 | + |
| 173 | + The top match should be the image you searched for. Because a vector search matches on similar vectors, the search engine returns any document that is sufficiently similar to the query input. You can switch to JSON view for more advanced queries that include relevance tuning. |
| 174 | + |
| 175 | +1. Try other query options to compare search outcomes: |
| 176 | + |
| 177 | + + Hide vectors for more readable results. |
| 178 | + + Select a vector field to query over. The default is text vectors, but you can specify the image vector to exclude text vectors from query execution. |
| 179 | + |
| 180 | +## Clean up |
| 181 | + |
| 182 | +This demo uses billable Azure resources. If the resources are no longer needed, delete them from your subscription to avoid charges. |
| 183 | + |
| 184 | +## Next steps |
| 185 | + |
| 186 | +This quickstart introduced you to the **Import and vectorize data** wizard that creates all of the objects necessary for image search. If you want to explore each step in detail, try an [integrated vectorization sample](https://github.com/Azure/azure-search-vector-samples/blob/main/demo-python/code/integrated-vectorization/azure-search-integrated-vectorization-sample.ipynb). |
0 commit comments