Skip to content
Merged
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
27 changes: 25 additions & 2 deletions 01_materials/labs/lab_4.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -603,7 +603,17 @@
"outputs": [],
"source": [
"from keras.applications.resnet50 import preprocess_input, decode_predictions\n",
"\n"
"\n",
"# Resize the image\n",
"input_image = resize(image, (224, 224, 3), mode='reflect', anti_aliasing=True)\n",
"\n",
"# Scale to [0, 255] range (resize returns [0, 1])\n",
"input_image = input_image * 255\n",
"\n",
"# Prepare for model (add batch dimension)\n",
"input_image = np.expand_dims(input_image, axis=0)\n",
"\n",
"# Now use preprocess_input and predict to classify the image\n"
]
},
{
Expand Down Expand Up @@ -680,7 +690,20 @@
"id": "b1pXoFQgI_fk"
},
"outputs": [],
"source": []
"source": [
"# Apply the same preprocessing as before and classify the webcam image\n",
"\n",
"# Resize the image\n",
"input_image = resize(image, (224, 224, 3), mode='reflect', anti_aliasing=True)\n",
"\n",
"# Scale to [0, 255] range (resize returns [0, 1])\n",
"input_image = input_image * 255\n",
"\n",
"# Prepare for model (add batch dimension)\n",
"input_image = np.expand_dims(input_image, axis=0)\n",
"\n",
"# Now use preprocess_input and predict to classify the image\n"
]
},
{
"cell_type": "code",
Expand Down