Skip to content

Commit 2806e04

Browse files
authored
Update 2022-6-23-geospatial-deep-learning-with-torchgeo.md
Image name updates Updates in Reproducibility with PyTorch Lightning
1 parent 60647b2 commit 2806e04

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

_posts/2022-6-23-geospatial-deep-learning-with-torchgeo.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ From left to right: Mercator, Albers Equal Area, and Interrupted Goode Homolosin
4444
Although each image is 2D, the Earth itself is 3D. In order to stitch together images, they first need to be projected onto a 2D representation of the Earth, called a coordinate reference system (CRS). Most people are familiar with equal angle representations like Mercator that distort the size of regions (Greenland looks larger than Africa even though Africa is 15x larger), but there are many other CRSs that are commonly used. Each dataset may use a different CRS, and each image within a single dataset may also be in a unique CRS. In order to use data from multiple layers, they must all share a common CRS, otherwise the data won't be properly aligned. For those who aren't familiar with remote sensing data, this can be a daunting task.
4545

4646
<p align="center">
47-
<img src="/assets/images/techgeo-reproject.png" width="80%">
47+
<img src="/assets/images/torchgeo-reproject.png" width="80%">
4848
</p>
4949

5050
<p align = "center">
@@ -69,7 +69,7 @@ TorchGeo is designed to have the same API as other PyTorch domain libraries like
6969
# Geospatial datasets and samplers
7070

7171
<p align="center">
72-
<img src="/assets/images/techgeo-sample.png" width="80%">
72+
<img src="/assets/images/torchgeo-sample.png" width="80%">
7373
</p>
7474

7575
<p align = "center">
@@ -158,7 +158,7 @@ plt.show()
158158
```
159159

160160
<p align="center">
161-
<img src="/assets/images/techgeo-true-ndvi.png" width="100%">
161+
<img src="/assets/images/torchgeo-true-ndvi.png" width="100%">
162162
</p>
163163

164164
<p align = "center">
@@ -190,7 +190,7 @@ for batch in dataloader:
190190
All TorchGeo datasets are compatible with PyTorch data loaders, making them easy to integrate into existing training workflows. The only difference between a benchmark dataset in TorchGeo and a similar dataset in torchvision is that each dataset returns a dictionary with keys for each PyTorch ``Tensor``.
191191

192192
<p align="center">
193-
<img src="/assets/images/techge-nwpu.png" width="100%">
193+
<img src="/assets/images/torchgeo-nwpu.png" width="100%">
194194
</p>
195195

196196
<p align = "center">
@@ -201,22 +201,22 @@ Example predictions from a Mask R-CNN model trained on the <a href="https://gith
201201

202202
Another key goal of TorchGeo is reproducibility. For many of these benchmark datasets, there is no predefined train-val-test split, or the predefined split has issues with class imbalance or geographic distribution. As a result, the performance metrics reported in the literature either can't be reproduced, or aren't indicative of how well a pre-trained model would work in a different geographic location.
203203

204-
In order to facilitate direct comparisons between results published in the literature and further reduce the boilerplate code needed to run experiments with datasets in TorchGeo, we have created PyTorch Lightning [*datamodules*](https://torchgeo.readthedocs.io/en/latest/api/datamodules.html) with well-defined train-val-test splits and [*trainers*](https://torchgeo.readthedocs.io/en/latest/api/trainers.html) for various tasks like classification, regression, and semantic segmentation. These datamodules show how to incorporate augmentations from the kornia library, include preprocessing transforms (with pre-calculated channel statistics), and let users easily experiment with hyperparameters related to the data itself (as opposed to the modeling process). Training a regression model on the Inria Aerial Image Labeling dataset is as easy as a few imports and four lines of code.
204+
In order to facilitate direct comparisons between results published in the literature and further reduce the boilerplate code needed to run experiments with datasets in TorchGeo, we have created PyTorch Lightning [*datamodules*](https://torchgeo.readthedocs.io/en/latest/api/datamodules.html) with well-defined train-val-test splits and [*trainers*](https://torchgeo.readthedocs.io/en/latest/api/trainers.html) for various tasks like classification, regression, and semantic segmentation. These datamodules show how to incorporate augmentations from the kornia library, include preprocessing transforms (with pre-calculated channel statistics), and let users easily experiment with hyperparameters related to the data itself (as opposed to the modeling process). Training a semantic segmentation model on the Inria Aerial Image Labeling dataset is as easy as a few imports and four lines of code.
205205

206206
```c++
207207
from pytorch_lightning import Trainer
208208
from torchgeo.datamodules import InriaAerialImageLabelingDataModule
209209
from torchgeo.trainers import SemanticSegmentationTask
210210

211211
datamodule = InriaAerialImageLabelingDataModule(root_dir="...", batch_size=64, num_workers=6)
212-
task = SemanticSegmentationTask(model="resnet18", pretrained=True, learning_rate=0.1)
212+
task = SemanticSegmentationTask(segmentation_model="unet", encoder_weights="imagenet", learning_rate=0.1)
213213
trainer = Trainer(gpus=1, default_root_dir="...")
214214

215215
trainer.fit(model=task, datamodule=datamodule)
216216
```
217217

218218
<p align="center">
219-
<img src="/assets/images/techgeo-inria.png" width="100%">
219+
<img src="/assets/images/torchgeo-inria.png" width="100%">
220220
</p>
221221

222222
<p align = "center">

0 commit comments

Comments
 (0)