You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In this article, you learn how to deploy MedImageInsight from the model catalog as an online endpoint for real-time inference. You also learn to issue a basic call to the API. The steps you take are:
21
+
In this article, you learn how to deploy MedImageInsight from the model catalog as an online endpoint for real-time inference. You also learn how to issue a basic call to the API. The steps you take are:
22
22
23
23
* Deploy the model to a self-hosted managed compute.
24
24
* Grant permissions to the endpoint.
25
-
* Send test data to the model, receive, and interpret results
25
+
* Send test data to the model, receive, and interpret results.
26
26
27
27
## MedImageInsight - the medical imaging embedding model
28
28
MedImageInsight foundation model for health is a powerful model that can process a wide variety of medical images. These images include X-Ray, CT, MRI, clinical photography, dermoscopy, histopathology, ultrasound, and mammography images. Rigorous evaluations demonstrate MedImageInsight's ability to achieve state-of-the-art (SOTA) or human expert-level performance across classification, image-to-image search, and fine-tuning tasks. Specifically, on public datasets, MedImageInsight achieves or exceeds SOTA performance in chest X-ray disease classification and search, dermatology classification and search, Optical coherence tomography (OCT) classification and search, and 3D medical image retrieval. The model also achieves near-SOTA performance for histopathology classification and search.
29
29
30
-
An embedding model is capable of serving as the basis of many different solutions—from classification to more complex scenarios like group matching or outlier detection. The following animation shows an embedding model being used for image similarity search and to detect images that are outliers.
30
+
An embedding model can serve as the basis of many different solutions—from classification to more complex scenarios like group matching or outlier detection. The following animation shows an embedding model being used for image similarity search and to detect images that are outliers.
31
31
32
32
:::image type="content" source="../../media/how-to/healthcare-ai/healthcare-embedding-capabilities.gif" alt-text="Animation that shows an embedding model capable of supporting similarity search and quality control scenarios.":::
33
33
34
34
## Prerequisites
35
35
36
-
- An Azure subscription with a valid payment method. Free or trial Azure subscriptions won't work. If you don't have an Azure subscription, create a [paid Azure account](https://azure.microsoft.com/pricing/purchase-options/pay-as-you-go) to begin.
36
+
- An Azure subscription with a valid payment method. Free or trial Azure subscriptions don't work. If you don't have an Azure subscription, create a [paid Azure account](https://azure.microsoft.com/pricing/purchase-options/pay-as-you-go) to begin.
37
37
38
38
- If you don't have one, [create a [!INCLUDE [hub](../../includes/hub-project-name.md)]](../create-projects.md?pivots=hub-project).
39
39
40
40
41
-
- Azure role-based access controls (Azure RBAC) are used to grant access to operations in Azure AI Foundry portal. To perform the steps in this article, your user account must be assigned the __Azure AI Developer role__ on the resource group. For more information on permissions, see [Role-based access control in Azure AI Foundry portal](../../concepts/rbac-ai-foundry.md).
41
+
- Azure role-based access controls (Azure RBAC) to grant access to operations in Azure AI Foundry portal. To perform the steps in this article, your user account must be assigned the __Azure AI Developer role__ on the resource group. For more information on permissions, see [Role-based access control in Azure AI Foundry portal](../../concepts/rbac-ai-foundry.md).
42
42
43
43
## Deploy the model to a managed compute
44
44
45
-
Deployment to a self-hosted managed inference solution allows you to customize and control all the details about how the model is served. You can deploy the model from its model card in the catalog UI of [Azure AI Foundry](https://aka.ms/healthcaremodelstudio) or [Azure Machine Learning studio](https://ml.azure.com/model/catalog) or [deploy it programmatically](../deploy-models-managed.md).
45
+
Deploying to a self-hosted managed inference solution lets you customize and control all the details about how the model is served. You can deploy the model from its model card in the catalog UI of [Azure AI Foundry](https://aka.ms/healthcaremodelstudio), [Azure Machine Learning studio](https://ml.azure.com/model/catalog), or [deploy it programmatically](../deploy-models-managed.md).
In the deployment configuration, you get to choose an authentication method. This example uses Azure Machine Learning token-based authentication. For more authentication options, see the [corresponding documentation page](../../../machine-learning/how-to-setup-authentication.md). Also, the client is created from a configuration file that is created automatically for Azure Machine Learning virtual machines (VMs). Learn more on the [corresponding API documentation page](/python/api/azure-ai-ml/azure.ai.ml.mlclient#azure-ai-ml-mlclient-from-config).
79
+
In the deployment configuration, you choose an authentication method. This example uses Azure Machine Learning token-based authentication. For more authentication options, see the [corresponding documentation page](../../../machine-learning/how-to-setup-authentication.md). Also, the client is created from a configuration file that's created automatically for Azure Machine Learning virtual machines (VMs). Learn more on the [corresponding API documentation page](/python/api/azure-ai-ml/azure.ai.ml.mlclient#azure-ai-ml-mlclient-from-config).
80
80
81
81
### Make basic calls to the model
82
82
83
-
Once the model is deployed, use the following code to send data and retrieve embeddings.
83
+
After deploying the model, use the following code to send data and get embeddings.
|`columns`|`list[string]`| Y |`"text"`, `"image"`| An object containing the strings mapping data to inputs passed to the model.|
143
-
|`index`|`integer`| Y | 0 - 1024| Count of inputs passed to the model. You're limited by how much data can be passed in a single POST request, which depends on the size of your images. Therefore, you should keep this number in the dozens |
143
+
|`index`|`integer`| Y | 0 - 1024| Count of inputs passed to the model. You're limited by how much data you can pass in a single POST request, which depends on the size of your images. Therefore, keep this number in the dozens |
144
144
|`data`|`list[list[string]]`| Y | "" | The list contains the items passed to the model which is defined by the index parameter. Each item is a list of two strings. The order is defined by the `columns` parameter. The `text` string contains text to embed. The `image` strings are the image bytes encoded using base64 and decoded as utf-8 string |
145
145
146
146
The `params` object contains the following fields:
@@ -189,12 +189,12 @@ The `params` object contains the following fields:
189
189
190
190
### Response schema
191
191
192
-
Response payload is a JSONformatted string containing the following fields:
192
+
The response payload is a JSON-formatted string that contains the following fields:
|`image_features`|`list[list[float]]`| If requested, list of vectors, one per each submitted image. |
197
-
|`text_features`|`list[list[float]]`| If requested, list of vectors, one per each submitted text string. |
196
+
|`image_features`|`list[list[float]]`| If requested, a list of vectors, one for each submitted image. |
197
+
|`text_features`|`list[list[float]]`| If requested, a list of vectors, one for each submitted text string. |
198
198
|`scaling_factor`|`float`| If requested, the scaling factor |
199
199
200
200
### Response example
@@ -208,21 +208,21 @@ Response payload is a JSON formatted string containing the following fields:
208
208
```
209
209
210
210
### Other implementation considerations
211
-
The maximum number of tokens processed in the input string is 77. Anything past 77 tokens would be cut off before being passed to the model. The model is using a Contrastive Language-Image Pre-Training (CLIP) tokenizer which uses about three Latin characters per token.
211
+
The maximum number of tokens processed in the input string is 77. The system removes any tokens beyond 77 before passing the input to the model. The model uses a Contrastive Language-Image Pre-Training (CLIP) tokenizer, which uses about three Latin characters per token.
212
212
213
-
The submitted text is embedded into the same latent space as the image. As a result, strings describing medical images of certain body parts obtained with certain imaging modalities are embedded close to such images. Also, when building systems on top of a MedImageInsight model, you should make sure that all your embedding strings are consistent with one another (word order and punctuation). For best results with base model, strings should follow the pattern `<image modality> <anatomy> <exam parameters> <condition/pathology>.`, for example: `x-ray chest anteroposterior Atelectasis.`.
213
+
The model embeds the submitted text into the same latent space as the image. As a result, strings describing medical images of certain body parts obtained with certain imaging modalities are embedded close to such images. Also, when building systems on top of a MedImageInsight model, make sure that all your embedding strings are consistent with one another (word order and punctuation). For best results with the base model, strings should follow the pattern `<image modality> <anatomy> <exam parameters> <condition/pathology>.`, for example: `x-ray chest anteroposterior Atelectasis.`.
214
214
215
-
If you're fine-tuning the model, you can change these parameters to better suit your application needs.
215
+
If you fine-tune the model, you can change these parameters to better suit your application needs.
216
216
217
217
### Supported image formats
218
218
The deployed model API supports images encoded in PNG format.
219
219
220
-
When the model receives the images, it does preprocessing that involves compressing and resizing the images to `512x512` pixels.
220
+
When the model receives the images, it preprocesses the images by compressing and resizing them to `512x512` pixels.
221
221
222
222
The preferred compression format is lossless PNG, containing either an 8-bit monochromatic or RGB image. For optimization purposes, you can perform resizing on the client side to reduce network traffic.
223
223
224
224
## Learn more from samples
225
-
MedImageInsight is a versatile model that can be applied to a wide range of tasks and imaging modalities. For more specific examples of solving various tasks with MedImageInsight, see the following interactive Python notebooks.
225
+
MedImageInsight is a versatile model that you can apply to a wide range of tasks and imaging modalities. For more specific examples of solving various tasks with MedImageInsight, see the following interactive Python notebooks.
226
226
227
227
#### Getting started
228
228
*[Deploying and Using MedImageInsight](https://aka.ms/healthcare-ai-examples-mi2-deploy): Learn how to deploy the MedImageInsight model programmatically and issue an API call to it.
0 commit comments