add fix for 06

This commit is contained in:
Daniel Bourke committed 2022-05-17 16:21:57 +10:00
1 parent 3ab71031c9
commit 9fbd9d4b6a
4 files changed
+2412 -2444

No files matched your search

File diff suppressed because it is too large. Load diff
+12 -14
View File
@@ -205,16 +205,14 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 2,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Did not find data\\pizza_steak_sushi directory, creating one...\n",
"Downloading pizza, steak, sushi data...\n",
"Unzipping pizza, steak, sushi data...\n"
"data/pizza_steak_sushi directory exists.\n"
]
}
],
@@ -234,16 +232,16 @@
" print(f\"Did not find {image_path} directory, creating one...\")\n",
" image_path.mkdir(parents=True, exist_ok=True)\n",
" \n",
"# Download pizza, steak, sushi data\n",
"with open(data_path / \"pizza_steak_sushi.zip\", \"wb\") as f:\n",
" request = requests.get(\"https://github.com/mrdbourke/pytorch-deep-learning/raw/main/data/pizza_steak_sushi.zip\")\n",
" print(\"Downloading pizza, steak, sushi data...\")\n",
" f.write(request.content)\n",
" # Download pizza, steak, sushi data\n",
" with open(data_path / \"pizza_steak_sushi.zip\", \"wb\") as f:\n",
" request = requests.get(\"https://github.com/mrdbourke/pytorch-deep-learning/raw/main/data/pizza_steak_sushi.zip\")\n",
" print(\"Downloading pizza, steak, sushi data...\")\n",
" f.write(request.content)\n",
"\n",
"# Unzip pizza, steak, sushi data\n",
"with zipfile.ZipFile(data_path / \"pizza_steak_sushi.zip\", \"r\") as zip_ref:\n",
" print(\"Unzipping pizza, steak, sushi data...\") \n",
" zip_ref.extractall(image_path)"
" # Unzip pizza, steak, sushi data\n",
" with zipfile.ZipFile(data_path / \"pizza_steak_sushi.zip\", \"r\") as zip_ref:\n",
" print(\"Unzipping pizza, steak, sushi data...\") \n",
" zip_ref.extractall(image_path)"
]
},
{
@@ -4187,7 +4185,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.7"
"version": "3.10.4"
}
},
"nbformat": 4,
File diff suppressed because it is too large. Load diff
+1 -1
View File
@@ -159,7 +159,7 @@ def pred_and_plot_image(
image_path (str): filepath to target image.
class_names (List[str], optional): different class names for target image. Defaults to None.
transform (_type_, optional): transform of target image. Defaults to None.
device (torch.device, optional): target device to compute on. Defaults to "cuda" if torch.cuda.is_avilable() else "cpu".
device (torch.device, optional): target device to compute on. Defaults to "cuda" if torch.cuda.is_available() else "cpu".
Returns:
Matplotlib plot of target image and model prediction as title.