Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 27 additions & 5 deletions multi-model-endpoint-tensorflow-cv.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@
"fig = plt.figure(figsize=(20, 5))\n",
"for i in range(36):\n",
" ax = fig.add_subplot(3, 12, i+1, xticks=[], yticks=[])\n",
" ax.imshow(np.squeeze(X_train[i].T))"
" ax.imshow(np.squeeze(X_train[i]))"
]
},
{
Expand Down Expand Up @@ -857,7 +857,7 @@
"source": [
"fig, rows = plt.subplots(nrows=1, ncols=4, figsize=(224, 224))\n",
"for row in rows:\n",
" row.imshow(train_batches.next()[0][0].astype('int').T)\n",
" row.imshow(train_batches.next()[0][0].astype('int'))\n",
" row.axis('off')\n",
"plt.show()"
]
Expand Down Expand Up @@ -963,7 +963,7 @@
"source": [
"model_name = 'sign-language'\n",
"\n",
"hyperparameters = {'epochs': 1}\n",
"hyperparameters = {'epochs': 5}\n",
"estimator_parameters = {'entry_point':'sign_language_train.py',\n",
" 'instance_type': 'ml.m5.2xlarge',\n",
" 'instance_count': 1,\n",
Expand Down Expand Up @@ -1124,7 +1124,13 @@
},
"outputs": [],
"source": [
"IMAGE_URI = '763104351884.dkr.ecr.us-east-1.amazonaws.com/tensorflow-inference:2.3.1-cpu-py37-ubuntu18.04'\n",
"from sagemaker.image_uris import retrieve\n",
"IMAGE_URI = retrieve(\n",
" framework=\"tensorflow\",version=TF_FRAMEWORK_VERSION,\n",
" image_scope='inference', \n",
" instance_type='ml.m5.xlarge',\n",
" region=sagemaker_session.boto_region_name)\n",
"\n",
"model_data_prefix = f's3://{BUCKET}/{PREFIX}/mme/'"
]
},
Expand Down Expand Up @@ -1458,9 +1464,25 @@
},
"outputs": [],
"source": [
"predicted_label = np.argmax(y_pred)\n",
"predicted_label = np.argmax(y_pred['predictions'][0])\n",
"print(f'Predicted Label: [{predicted_label}]')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"predictor.delete_endpoint()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand Down