Skip to content

Commit 55440e2

Browse files
authored
Update how-to-image-processing-batch.md
1 parent e4f0e76 commit 55440e2

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

articles/machine-learning/how-to-image-processing-batch.md

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,8 @@ __code/score-by-file/batch_driver.py__
149149

150150
One the scoring script is created, it's time to create a batch deployment for it. Follow the following steps to create it:
151151

152+
1. Ensure you have a compute cluster created where we can create the deployment. In this example we are going to use a compute cluster named `gpu-cluster`. Althought is not required, we will GPUs to speed up the processing.
153+
152154
1. We need to indicate over which environment we are going to run the deployment. In our case, our model runs on `TensorFlow`. Azure Machine Learning already has an environment with the required software installed, so we can reutilize this environment. We are just going to add a couple of dependencies in a `conda.yml` file.
153155

154156
# [Azure CLI](#tab/cli)
@@ -264,7 +266,7 @@ For testing our endpoint, we are going to use a sample of 1000 images from the o
264266
# [Python](#tab/sdk)
265267

266268
```python
267-
data_path = "/tmp/imagenet-1000"
269+
data_path = "data"
268270
dataset_name = "imagenet-sample-unlabeled"
269271

270272
imagenet_sample = Data(
@@ -419,16 +421,17 @@ On those cases, we may want to perform inference on the entire batch of data. Th
419421
ml_client.batch_deployments.begin_create_or_update(deployment)
420422
```
421423

424+
1. You can use this new deployment with the sample data shown before. Remember that to invoke this deployment you should either indicate the name of the deployment in the invocation method or set it as the default one.
422425

423426
## Considerations for MLflow models processing images
424427

425-
MLflow models in Batch Endpoints support reading images as input data. Remember that MLflow models don't require a scoring script. Have the following considerations when using them:
428+
MLflow models in Batch Endpoints support reading images as input data. Since MLflow deployments don't require a scoring script, have the following considerations when using them:
426429

427430
> [!div class="checklist"]
428431
> * Image files supported includes: `.png`, `.jpg`, `.jpeg`, `.tiff`, `.bmp` and `.gif`.
429432
> * MLflow models should expect to recieve a `np.ndarray` as input that will match the dimensions of the input image. In order to support multiple image sizes on each batch, the batch executor will invoke the MLflow model once per image file.
430433
> * MLflow models are highly encouraged to include a signature, and if they do it must be of type `TensorSpec`. Inputs are reshaped to match tensor's shape if available. If no signature is available, tensors of type `np.uint8` are inferred.
431-
> * For models that include a signature and are expected to handle variable size of images, then include a signature that can guarantee it. For instance, the following signature will allow batches of 3 channeled images. Specify the signature when you register the model with `mlflow.<flavor>.log_model(..., signature=signature)`.
434+
> * For models that include a signature and are expected to handle variable size of images, then include a signature that can guarantee it. For instance, the following signature example will allow batches of 3 channeled images.
432435

433436
```python
434437
import numpy as np
@@ -440,9 +443,13 @@ input_schema = Schema([
440443
TensorSpec(np.dtype(np.uint8), (-1, -1, -1, 3)),
441444
])
442445
signature = ModelSignature(inputs=input_schema)
446+
447+
(...)
448+
449+
mlflow.<flavor>.log_model(..., signature=signature)
443450
```
444451

445-
For more information about how to use MLflow models in batch deployments read [Using MLflow models in batch deployments](how-to-mlflow-batch.md).
452+
You can find a working example in the Jupyter notebook [imagenet-classifier-mlflow.ipynb](https://github.com/Azure/azureml-examples/blob/main/sdk/python/endpoints/batch/deploy-models/imagenet-classifier/imagenet-classifier-mlflow.ipynb). For more information about how to use MLflow models in batch deployments read [Using MLflow models in batch deployments](how-to-mlflow-batch.md).
446453

447454
## Next steps
448455

0 commit comments

Comments
 (0)