Skip to content

Commit 07809c9

Browse files
authored
update transform markdown
1 parent 0ed44fd commit 07809c9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

intro-to-pytorch/Part 7 - Loading Image Data (Exercises).ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
"dataset = datasets.ImageFolder('path/to/data', transform=transform)\n",
4343
"```\n",
4444
"\n",
45-
"where `'path/to/data'` is the file path to the data directory and `transforms` is a list of processing steps built with the [`transforms`](http://pytorch.org/docs/master/torchvision/transforms.html) module from `torchvision`. ImageFolder expects the files and directories to be constructed like so:\n",
45+
"where `'path/to/data'` is the file path to the data directory and `transform` is a list of processing steps built with the [`transforms`](http://pytorch.org/docs/master/torchvision/transforms.html) module from `torchvision`. ImageFolder expects the files and directories to be constructed like so:\n",
4646
"```\n",
4747
"root/dog/xxx.png\n",
4848
"root/dog/xxy.png\n",
@@ -60,7 +60,7 @@
6060
"When you load in the data with `ImageFolder`, you'll need to define some transforms. For example, the images are different sizes but we'll need them to all be the same size for training. You can either resize them with `transforms.Resize()` or crop with `transforms.CenterCrop()`, `transforms.RandomResizedCrop()`, etc. We'll also need to convert the images to PyTorch tensors with `transforms.ToTensor()`. Typically you'll combine these transforms into a pipeline with `transforms.Compose()`, which accepts a list of transforms and runs them in sequence. It looks something like this to scale, then crop, then convert to a tensor:\n",
6161
"\n",
6262
"```python\n",
63-
"transforms = transforms.Compose([transforms.Resize(255),\n",
63+
"transform = transforms.Compose([transforms.Resize(255),\n",
6464
" transforms.CenterCrop(224),\n",
6565
" transforms.ToTensor()])\n",
6666
"\n",

0 commit comments

Comments
 (0)