Skip to content

Commit

Permalink
Update tutorials
Browse files Browse the repository at this point in the history
  • Loading branch information
ashnair1 committed Nov 6, 2024
1 parent 151c343 commit 2beb9c6
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions docs/tutorials/transforms.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
"from torch.utils.data import DataLoader\n",
"\n",
"from torchgeo.datasets import EuroSAT100\n",
"from torchgeo.transforms import AugmentationSequential, indices"
"from torchgeo.transforms import indices"
]
},
{
Expand Down Expand Up @@ -515,15 +515,15 @@
},
"outputs": [],
"source": [
"transforms = AugmentationSequential(\n",
"transforms = K.AugmentationSequential(\n",
" MinMaxNormalize(mins, maxs),\n",
" indices.AppendNDBI(index_swir=11, index_nir=7),\n",
" indices.AppendNDSI(index_green=3, index_swir=11),\n",
" indices.AppendNDVI(index_nir=7, index_red=3),\n",
" indices.AppendNDWI(index_green=2, index_nir=7),\n",
" K.RandomHorizontalFlip(p=0.5),\n",
" K.RandomVerticalFlip(p=0.5),\n",
" data_keys=['image'],\n",
" data_keys=None,\n",
")\n",
"\n",
"batch = next(dataloader)\n",
Expand Down Expand Up @@ -569,7 +569,7 @@
"source": [
"device = 'cuda' if torch.cuda.is_available() else 'cpu'\n",
"\n",
"transforms = AugmentationSequential(\n",
"transforms = K.AugmentationSequential(\n",
" MinMaxNormalize(mins, maxs),\n",
" indices.AppendNDBI(index_swir=11, index_nir=7),\n",
" indices.AppendNDSI(index_green=3, index_swir=11),\n",
Expand All @@ -580,10 +580,10 @@
" K.RandomAffine(degrees=(0, 90), p=0.25),\n",
" K.RandomGaussianBlur(kernel_size=(3, 3), sigma=(0.1, 2.0), p=0.25),\n",
" K.RandomResizedCrop(size=(512, 512), scale=(0.8, 1.0), p=0.25),\n",
" data_keys=['image'],\n",
" data_keys=None,\n",
")\n",
"\n",
"transforms_gpu = AugmentationSequential(\n",
"transforms_gpu = K.AugmentationSequential(\n",
" MinMaxNormalize(mins.to(device), maxs.to(device)),\n",
" indices.AppendNDBI(index_swir=11, index_nir=7),\n",
" indices.AppendNDSI(index_green=3, index_swir=11),\n",
Expand All @@ -594,7 +594,7 @@
" K.RandomAffine(degrees=(0, 90), p=0.25),\n",
" K.RandomGaussianBlur(kernel_size=(3, 3), sigma=(0.1, 2.0), p=0.25),\n",
" K.RandomResizedCrop(size=(512, 512), scale=(0.8, 1.0), p=0.25),\n",
" data_keys=['image'],\n",
" data_keys=None,\n",
").to(device)\n",
"\n",
"\n",
Expand Down Expand Up @@ -664,7 +664,7 @@
},
"outputs": [],
"source": [
"transforms = AugmentationSequential(MinMaxNormalize(mins, maxs), data_keys=['image'])\n",
"transforms = K.AugmentationSequential(MinMaxNormalize(mins, maxs), data_keys=None)\n",
"dataset = EuroSAT100(root, transforms=transforms)"
]
},
Expand Down

0 comments on commit 2beb9c6

Please sign in to comment.