Skip to content

Commit 7a6679f

Browse files
Minor cleanup
1 parent 96ff2a2 commit 7a6679f

File tree

1 file changed

+8
-26
lines changed

1 file changed

+8
-26
lines changed

articles/machine-learning/how-to-homomorphic-encryption-seal.md

Lines changed: 8 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,11 @@ ms.topic: conceptual
1212
#intent: As a data scientist, I want to deploy a service that uses homomorphic encryption to make predictions on encrypted image data
1313
---
1414

15-
# Deploy an image classification model for encrypted inferencing in Azure Container Instance (ACI)
15+
# How to deploy an encrypted image classification service
1616

17-
This tutorial is **a new addition to the two-part series**. In the [previous tutorial](img-classification-part1-training.ipynb), you trained machine learning models and then registered a model in your workspace on the cloud.
17+
Learn how to deploy an image classification model as a encrypted inferencing web service in [Azure Container Instances](https://docs.microsoft.com/azure/container-instances/) (ACI). A web service is an image, in this case a Docker image, that encapsulates the scoring logic and the model itself.
1818

19-
Now, you're ready to deploy the model as a encrypted inferencing web service in [Azure Container Instances](https://docs.microsoft.com/azure/container-instances/) (ACI). A web service is an image, in this case a Docker image, that encapsulates the scoring logic and the model itself.
20-
21-
In this part of the tutorial, you use Azure Machine Learning service (Preview) to:
19+
In this part of the tutorial, you use Azure Machine Learning service to:
2220

2321
> * Set up your testing environment
2422
> * Retrieve the model from your workspace
@@ -28,14 +26,10 @@ In this part of the tutorial, you use Azure Machine Learning service (Preview) t
2826
2927
ACI is a great solution for testing and understanding the workflow. For scalable production deployments, consider using Azure Kubernetes Service. For more information, see [how to deploy and where](https://docs.microsoft.com/azure/machine-learning/service/how-to-deploy-and-where).
3028

31-
3229
## Prerequisites
3330

3431
Complete the model training in the [Tutorial #1: Train an image classification model with Azure Machine Learning](train-models.ipynb) notebook.
3532

36-
37-
<!-- #endregion -->
38-
3933
```python
4034
# If you did NOT complete the tutorial, you can instead run this cell
4135
# This will register a model and download the data needed for this tutorial
@@ -157,7 +151,7 @@ def run(raw_data):
157151
blob_service_client = BlobServiceClient.from_connection_string(conn_str=conn_str)
158152
blob_client = blob_service_client.get_blob_client(container=container, blob=key_id)
159153
public_keys = blob_client.download_blob().readall()
160-
154+
161155
result = {}
162156
# make prediction
163157
result = server.predict(data, public_keys)
@@ -180,6 +174,7 @@ aciconfig = AciWebservice.deploy_configuration(cpu_cores=1,
180174
```
181175

182176
### Deploy in ACI
177+
183178
Estimated time to complete: **about 2-5 minutes**
184179

185180
Configure the image and deploy. The following code goes through these steps:
@@ -220,11 +215,8 @@ Get the scoring web service's HTTP endpoint, which accepts REST client calls. Th
220215
print(service.scoring_uri)
221216
```
222217

223-
## Test the model
224-
225-
226-
227218
### Download test data
219+
228220
Download the test data to the **./data/** directory
229221

230222
```python
@@ -254,12 +246,10 @@ X_test = load_data(glob.glob(os.path.join(data_folder,"**/t10k-images-idx3-ubyte
254246
y_test = load_data(glob.glob(os.path.join(data_folder,"**/t10k-labels-idx1-ubyte.gz"), recursive=True)[0], True).reshape(-1)
255247
```
256248

257-
<!-- #region -->
258249
### Predict test data
259250

260251
Feed the test dataset to the model to get predictions.
261252

262-
263253
The following code goes through these steps:
264254

265255
1. Create our Homomorphic Encryption based client
@@ -328,7 +318,6 @@ raw_data = edp.encrypt(X_test[sample_index])
328318

329319
Feed the test dataset to the model to get predictions. We will need to send the connection string to the blob storage where the public keys were uploaded
330320

331-
332321
```python
333322
import json
334323
from azureml.core import Webservice
@@ -354,7 +343,7 @@ print ('Received encrypted inference results')
354343
Use the client to decrypt the results
355344

356345
```python
357-
import numpy as np
346+
import numpy as np
358347

359348
results = edp.decrypt(eresult)
360349

@@ -375,8 +364,6 @@ To keep the resource group and workspace for other tutorials and exploration, yo
375364
service.delete()
376365
```
377366

378-
<!-- #region -->
379-
380367
If you're not going to use what you've created here, delete the resources you just created with this quickstart so you don't incur any charges. In the Azure portal, select and delete your resource group. You can also keep the resource group, but delete a single workspace by displaying the workspace properties and selecting the Delete button.
381368

382369
## Next steps
@@ -387,9 +374,4 @@ In this Azure Machine Learning tutorial, you used Python to:
387374
> * Retrieve the model from your workspace
388375
> * Test the model locally
389376
> * Deploy the model to ACI
390-
> * Test the deployed model
391-
392-
You can also try out the [regression tutorial](regression-part1-data-prep.ipynb).
393-
<!-- #endregion -->
394-
395-
![Impressions](https://PixelServer20190423114238.azurewebsites.net/api/impressions/MachineLearningNotebooks/tutorials/img-classification-part2-deploy.png)
377+
> * Test the deployed model

0 commit comments

Comments
 (0)