TorchGeo is a PyTorch domain library, similar to torchvision, that provides datasets, transforms, samplers, and pre-trained models specific to geospatial data.

Overview

TorchGeo

TorchGeo is a PyTorch domain library, similar to torchvision, that provides datasets, transforms, samplers, and pre-trained models specific to geospatial data.

The goal of this library is to make it simple:

  1. for machine learning experts to use geospatial data in their workflows, and
  2. for remote sensing experts to use their data in machine learning workflows.

See our installation instructions, documentation, and examples to learn how to use torchgeo.

External links: docs codecov

Tests: docs style tests

Installation instructions

Until the first release, you can install an environment compatible with torchgeo with conda, pip, or spack as shown below.

Conda

Note: if you do not have access to a GPU or are running on macOS, replace pytorch-gpu with pytorch-cpu in the environment.yml file.

$ conda config --set channel_priority strict
$ conda env create --file environment.yml
$ conda activate torchgeo

Pip

With Python 3.6 or later:

$ pip install -r requirements.txt

Spack

$ spack env activate .
$ spack install

Documentation

You can find the documentation for torchgeo on ReadTheDocs.

Example usage

The following sections give basic examples of what you can do with torchgeo. For more examples, check out our tutorials.

Train and test models using our PyTorch Lightning based training script

We provide a script, train.py for training models using a subset of the datasets. We do this with the PyTorch Lightning LightningModules and LightningDataModules implemented under the torchgeo.trainers namespace. The train.py script is configurable via the command line and/or via YAML configuration files. See the conf/ directory for example configuration files that can be customized for different training runs.

$ python train.py config_file=conf/landcoverai.yaml

Download and use the Tropical Cyclone Wind Estimation Competition dataset

This dataset is from a competition hosted by Driven Data in collaboration with Radiant Earth. See here for more information.

Using this dataset in torchgeo is as simple as importing and instantiating the appropriate class.

import torchgeo.datasets

dataset = torchgeo.datasets.TropicalCycloneWindEstimation(split="train", download=True)
print(dataset[0]["image"].shape)
print(dataset[0]["wind_speed"])

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.

When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

Trademarks

This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow Microsoft's Trademark & Brand Guidelines. Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party's policies.

Comments
  • Increase coverage of trainers

    Increase coverage of trainers

    Since we no longer run integration tests on main, our trainer modules are currently the least well-tested code. This PR attempts to add unit tests for these trainers. I'm a bit stuck at the moment, so opening this up for feedback on better ways to test this code while I focus on more important things.

    testing trainers 
    opened by adamjstewart 25
  • Dependabot for more stable CI

    Dependabot for more stable CI

    Our CI has been incredibly unstable lately. Every time a new version of a dependency is released, something in our tests breaks, especially mypy.

    Using dependabot, we can pin all of our dependencies to a specific version. The bot will then periodically check for updates and open a PR to update the dependency version. That way, only the version update PR will break, not everyone else's PRs.

    Side note: a lot of our deps don't yet have wheels for Python 3.10, or have never had wheels for Windows. I was thinking about switching from pip to conda for all CI. Unfortunately, it looks like dependabot only supports pip, not conda.

    opened by adamjstewart 19
  • Datasets: consistent capitalization of band names

    Datasets: consistent capitalization of band names

    There seems to be a 50/50 mix of RGB_BANDS/ALL_BANDS and rgb_bands/all_bands in our datasets. The GeoDataset base class uses lowercase, so this PR changes all other datasets to match. From what I can tell, PEP-8 doesn't seem to distinguish between class attributes and instance attributes, so I'm not sure if these are considered variables or global variables.

    @ashnair1 not sure if this affects #687

    datasets testing 
    opened by adamjstewart 18
  • IDTReeS bugs

    IDTReeS bugs

    Description

    While using IDTReeS to train an object detector, I noticed quite a few bugs within this dataset.

    1. Coordinates are swapped

    Fixed by #683

    OSBS_27_before

    The above image is a comparison of the actual ground truth of OSBS_27 and the plot produced by torchgeo.

    2. Missing polygon

    Shapefile contains 5 polygons whereas the plot only shows 4. This issue seems to be at the dataset level.

    OSBS_27_missingpoly

    3. Negative box coordinates in pixel space

    This is a weird one. I noticed that some boxes had negative pixel coordinates. Observed this in MLBS_5 but its possible this could be present in others as well.

    Comparing QGIS and the corrected torchgeo plot for MLBS_5 didn't reveal much

    MLBS_5_initial

    As you can see, the top 4 polygons are missing. But unlike the previous issue, these polygons do exist. However they seem to be outside the bounds of the image.

    MLBS_5_second

    This could explain the negative coordinates but I'm not sure as to why there is a difference between the plots.

    Steps to reproduce

    Most of these issues can be seen by downloading the IDTReeS dataset and comparing the torchgeo plots vs the shapefiles.

    Version

    0.4.0.dev0

    datasets 
    opened by ashnair1 18
  • ValueError: empty range for randrange()

    ValueError: empty range for randrange()

    When using RandomBatchGeoSampler, 50% of the time the following error will occur. With no code change, this runs perfectly fine the other 50% of the time.

    code:

    sampler = RandomBatchGeoSampler(ds, size=1024, batch_size=5, length=5 * 5)
    dl = DataLoader(ds, batch_sampler=sampler, collate_fn=stack_samples)
    
    for idx, batch in enumerate(dl):
        for idx_s, image in enumerate(batch['image']):
            image = torch.squeeze(image)
    

    error:

      File "/shared/ritwik/miniconda3/envs/dino/lib/python3.7/site-packages/torchgeo/samplers/batch.py", line 115, in __iter__
        bounding_box = get_random_bounding_box(bounds, self.size, self.res)
      File "/shared/ritwik/miniconda3/envs/dino/lib/python3.7/site-packages/torchgeo/samplers/utils.py", line 49, in get_random_bounding_box
        minx = random.randrange(int(width)) * res + bounds.minx
      File "/shared/ritwik/miniconda3/envs/dino/lib/python3.7/random.py", line 190, in randrange
        raise ValueError("empty range for randrange()")
    ValueError: empty range for randrange()
    
    samplers 
    opened by RitwikGupta 18
  • Indices Transforms

    Indices Transforms

    ~~This is simply a draft of a transform for computing NDVI and concatenating to the sample["image"] channels. Open to suggestions/feedback.~~

    ~~Note: I just realized that the requiring the index of the channels for computing the indices doesn't scale. See Enhanced Vegation Index which requires 4+ bands to compute EVI = G * ((NIR - R) / (NIR + C1 * R – C2 * B + L)).~~

    Update:

    This PR adds the following:

    • AugmentationSequential wrapper around kornia.augmentation.AugmentationSequential which supports our sample/batch dicts.
    • ndbi, ndsi, ndvi, ndwi functionals which given specific multispectral band input will compute the associated index. AppendNDBI, AppendNDSI, AppendNDVI, AppendNDWI transform modules which take as input a batch dict, computes the desired index, and appends to the channel dimension.
    • Unit tests
    • kornia>=0.5.4 as dependency which is the version when kornia.augmentation.AugmentationSequential was added. Additionally, kornia's only dependency is pytorch.

    TODO:

    • Add jupyter notebook to docs/tutorials display the usage of indices transforms
    • Fix notebook sphinx errors

    Closes #112

    transforms 
    opened by isaaccorley 18
  • SpaceNet 2

    SpaceNet 2

    • Created a SpaceNet metaclass that works on mlhub collections instead of datasets.
    • Refactored SpaceNet1
    • Added SpaceNet 2
    • Added tests and test data for SpaceNet 2

    Note: There is a slight issue with the Vegas collection. Refer radiantearth/radiant-mlhub#65. Simple solution: hard code location of img1 label.

    datasets 
    opened by ashnair1 17
  • failed conda install on windows10

    failed conda install on windows10

    I was trying to install torchgeo on windows 10 using conda on a new env, I got the following error

    >conda create -n torch-geo-test python=3.10
    
    >conda install torchgeo -c conda-forge
    
    Collecting package metadata (current_repodata.json): done
    Solving environment: failed with initial frozen solve. Retrying with flexible solve.
    Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
    Collecting package metadata (repodata.json): done
    Solving environment: failed with initial frozen solve. Retrying with flexible solve.
    Solving environment: -
    Found conflicts! Looking for incompatible packages.
    This can take several minutes.  Press CTRL-C to abort.
    Examining @/win-64::__win==0=0: 100%|████████████████████████████████████████████████████| 5/5 [00:01<00:00,  2.72it/s]|
    failed
    
    UnsatisfiableError: The following specifications were found to be incompatible with each other:
    
    Output in format: Requested package -> Available versions
    Note that strict channel priority may have removed packages required for satisfiability.
    

    However, a week ago, I installed it on another environment for testing a week ago, and it worked perfectly. I also tried the same thing on WSL2 (ubuntu 22.04), and it worked.

    opened by SkirOwen 15
  • Cant import Sentinel 2 Class

    Cant import Sentinel 2 Class

    Hi, I have tried with both the normal conda installation of torch and the development one. when I try to import the Sentinel 2 class I get the following error:

    from torchgeo.datasets import Sentinel2

    cannot import name 'draw_segmentation_masks' from 'torchvision.utils' (/Users/gracecolverd/opt/miniconda3/envs/torch_array/lib/python3.8/site-packages/torchvision/utils.py)

    Thanks, Grace

    opened by graceebc9 15
  • Jupyter Notebook tutorials

    Jupyter Notebook tutorials

    We need to figure out how to render Jupyter Notebooks in our documentation so that we can provide easy-to-use tutorials for new users. This should work similarly to https://pytorch.org/tutorials/.

    Ideally I would like to be able to test these tutorials so that they stay up-to-date.

    documentation 
    opened by adamjstewart 15
  • GridGeoSampler: change stride of last patch to sample entire ROI

    GridGeoSampler: change stride of last patch to sample entire ROI

    This PR changes the way in which GridGeoSampler samples patches from each tile if the tile size is not a multiple of the stride. We want to cover the entire tile, requiring us to adjust the stride of the final row/column.

    This also changes the number of patches returned from each tile. Let $i$ be the size of the input tile. Let $k$ be the requested size of the output patch. Let $s$ be the requested stride. Let $o$ be the number of output rows/columns sampled from each tile.

    Before

    $$ o = \left\lfloor \frac{i - k}{s} \right\rfloor + 1 $$

    After

    $$ o = \left\lceil \frac{i - k}{s} \right\rceil + 1 $$

    Reboot of #448 Fixes #431

    testing samplers 
    opened by remtav 14
  • Convert all index transforms to Kornia

    Convert all index transforms to Kornia

    This PR converts all of our index transforms to be valid Kornia augmentations. These transforms can now be used with AugmentationSequential just like all of the other transforms we use.

    documentation testing transforms backwards-incompatible 
    opened by adamjstewart 2
  • DataModules: run all data augmentation on the GPU

    DataModules: run all data augmentation on the GPU

    This PR overhauls all of our data modules to improve uniformity. This includes the following changes:

    • [x] Add GeoDataModule and NonGeoDataModule base classes to reduce code duplication
    • [x] Only instantiate the datasets that are needed for a particular stage
    • [x] Replace torchvision with kornia (better support for MSI, GPU, inverse)
    • [x] Replace dataset transforms with on_after_batch_transfer (CPU -> GPU, sample -> batch, faster)
    • [x] Remove instance methods for preprocessing (fixes #886)
    • [ ] Documentation

    In a future PR, I'm planning on extending this to the rest of our transforms:

    • Rewrite all index transforms to be compatible with Kornia (#999)
    • Update tutorials to use Kornia with our transforms
    • Upstream and remove our custom transforms and AugmentationSequential hacks
    documentation datasets testing trainers transforms datamodules backwards-incompatible 
    opened by adamjstewart 2
  • Remove tests/datamodules

    Remove tests/datamodules

    Summary

    I would like to remove (almost) all tests in tests/datamodules and replace them with new tests in tests/trainers that actually ensure our datamodules and trainers are compatible.

    Rationale

    The current tests simply ensure that the data loaders don't crash. They don't actually test that the datamodules are compatible with our trainers.

    Implementation

    The bulk of these have already been converted in #329. The remaining tests are:

    • [ ] chesapeake (tests invalid arguments)
    • [ ] fair1m (requires rotated ObjectDetectionTask trainer: #840)
    • [x] inria (#975)
    • [x] loveda (#966)
    • [x] nasa_marine_debris (#979)
    • [ ] oscd (requires ChangeDetectionTask trainer)
    • [x] potsdam (#929)
    • [ ] usavars (requires multi-label RegressionTask trainer)
    • [x] vaihingen (#853)
    • [ ] xview2 (requires ChangeDetectionTask trainer)
    • [ ] utils (coverage for test_pct == None, do we need this?)

    Alternatives

    We may end up keeping some of these that test invalid arguments. The important thing is not that we don't test datamodules standalone, but that we test them with trainers whenever possible.

    Additional information

    No response

    testing datamodules 
    opened by adamjstewart 0
  • Add Multi-Weight Support API

    Add Multi-Weight Support API

    This PR closes #762 by adding support for loading pretrained weights from various sources, specifically for Earth Observational Data following torchvision.

    Example:

    from torchgeo.models import ResNet50_Weights
    from torchgeo.trainers import ClassificationTask
    
    task = ClassificationTask(
        classification_model="resnet50",
        loss="ce",
        num_classes=10,
        in_channels=3,
        weights=ResNet50_Weights.SENTINEL2_ALL_MOCO.get_state_dict()
    )
    

    Some things I have encountered:

    • I think torchvision is able to make a cleaner API because all the available weights they have are exclusively for models they themselves implement in torchvision. In the Earth Observational Data case, the pretrained weights I have found come from a variety of sources but mostly use timm which aligns with torchgeo. However, there are sometimes some hoops to jump through before being able to actually load the state dict into the timm model. This is currently handled by get_state_dict()
    • With the few weights I have already run into issues with naming schemes discussed in #804 and it seems like with trying to collect pretrained weights from a variety of sources for specific use cases will make the proper naming scheme unclear, but maybe there is a more clever way to handle it with the accompanying meta data?

    Questions:

    • where should the weights be integrated within the torchgeo file hierarchy
    • I am not sure what the best way of unit testing this is
    documentation models testing trainers 
    opened by nilsleh 17
Releases(v0.3.1)
  • v0.3.1(Sep 8, 2022)

    TorchGeo 0.3.1 Release Notes

    This is a bugfix release. There are no new features or API changes with respect to the 0.3.0 release.

    Dependencies

    • pytorch-lightning: add 1.9 support (#697, #771)
    • radiant-mlhub: 0.5 not yet supported (#711)
    • segmentation-models-pytorch: add 0.3 support (#692)
    • setuptools: add 65 support (#715, #753)
    • torchvision: fix 0.12 pretrained model support (#761)

    DataModules

    • Fix rounding bugs in train/val/test split sizes (#675, #679, #736)

    Datasets

    • Fix rounding bugs leading to inconsistent image shapes in vector datasets (#674, #675, #679, #736)
    • IDTReeS: fix (x, y) coordinate swap in boxes (#683, #684)
    • IDTReeS: clip boxes to bounds of image (#684, #760)
    • Sentinel-2: add support for files downloaded from USGS EarthExplorer (#505, #754)
    • Sentinel-2: prevent dataset from loading bands at different resolutions (#754)
    • Sentinel-2: support loading even when band B02 is not present (#754)

    Samplers

    • GridGeoSampler: adjust stride of last row/col to sample entire ROI (#431, #448, #630)

    Transforms

    • NDVI: fix computation, we were computing the negative (#713, #714)
    • SWI: fix band names (#714)

    Documentation

    API docs:

    • USAVars is a regression dataset (#699)

    Tutorials:

    • Use IntersectionDataset in sampler (#707)
    • Custom Raster Datasets: complete overhaul with real data (#766, #772)
    • Trainers: optional datasets required (#759)
    • Transforms: replace cell magic with shell command (#756)
    • Transforms: fix GPU usage (#763, #767)
    • Clean up file names, execution counts, and output (#770)

    Contributors

    This release is thanks to the following contributors:

    • @adamjstewart
    • @ashnair1
    • @calebrob6
    • @isaaccorley
    • @remtav
    • @TCherici
    Source code(tar.gz)
    Source code(zip)
  • v0.3.0(Jul 11, 2022)

    TorchGeo 0.3.0 Release Notes

    This release contains a number of new features, and brings increased stability to installations and testing.

    In previous releases, not all dependencies had a minimum supported version listed, causing issues if users had old versions lying around. Old releases would also install the latest version of all dependencies even if they had never been tested before. TorchGeo now lists a minimum and maximum supported version for all dependencies. Moreover, we now test the minimum supported versions of all dependencies. Dependencies are automatically updated using dependabot to prevent unrelated CI failures from sneaking into PRs. We hope this makes it even easier to contribute to TorchGeo, and ensures that old releases will continue to work even if our dependencies make backwards-incompatible changes.

    Backwards-incompatible changes

    • VisionDataset and VisionClassificationDataset have been renamed to NonGeoDataset and NonGeoClassificationDataset (#627)
    • Sample size now defaults to pixel units, use units=Units.CRS for old behavior (#294)
    • RasterDataset no longer has a plot method, subclasses have their own plot methods (#476)
    • Plot method of RasterDataset subclasses now take sample dicts, not image tensors (#476)
    • Removed FCEF model, use segmentation_models_pytorch.Unet instead (#345)
    • SemanticSegmentationTrainer: ignore_zeros renamed to ignore_index (#444, #644)

    Dependencies

    • Python 3.7+ is now required (#413, #482, #486)
    • Add lower version bounds to all dependencies based on testing (#574)
    • Add upper version bounds to all dependencies based on semver (#544, #557)
    • Fix Conda environment installation (#527, #528, #529, #545)

    Datamodules

    New datamodules:

    • Inria Aerial Image Labeling (#498)
    • USAVars (#441)

    Changes to existing datamodules:

    • Improved consistency between datamodules (#657)

    Datasets

    New datasets:

    • Aboveground Live Woody Biomass Density (#425)
    • Aster GDEM (#404)
    • CMS Global Mangrove Canopy (#391, #427)
    • DeepGlobe (#578)
    • DFC 2022 (#354)
    • EDDMapS (#533)
    • EnviroAtlas (#364)
    • Esri 2020 Land Cover (#390, #405)
    • EU-DEM (#426)
    • Forest Damage (#461, #499)
    • GBIF (#507)
    • GlobBiomass (#395)
    • iNaturalist (#532)
    • Inria Aerial Image Labeling (#355)
    • Million-AID (#455)
    • OpenBuildings (#68, #402)
    • ReforesTree (#582)
    • SpaceNet 3 (#480)
    • USAVars (#363)

    Changes to existing datasets:

    • Benin Small Holder Cashews: return geospatial metadata (#377)
    • BigEarthNet: fix checksum (#550)
    • CBF: add plot method (#410)
    • CDL: add 2021 download (#418)
    • CDL: add plot method (#415)
    • Chesapeake: add plot method (#417)
    • EuroSat: new bands parameter (#396, #397)
    • LandCover.ai: update download URL (#559, #579)
    • Landsat: add support for all Level-1 and Level-2 products (#492, #504)
    • Landsat: add plot method (#661)
    • NAIP: add plot method (#407)
    • Seasonal Contrast: ensure that all images are square (#658)
    • Sentinel: add plot method (#416, #493)
    • SEN12MS: avoid casting float to int (#500, #502)
    • So2Sat: new bands parameter (#394)

    Base classes and utilities:

    • VisionDataset and VisionClassificationDataset have been renamed to NonGeoDataset and NonGeoClassificationDataset (#627)
    • RasterDataset no longer has a plot method, subclasses have their own plot methods (#476)
    • Plot method of RasterDataset subclasses now take sample dicts, not image tensors (#476)
    • BoundingBox has new area and volume attributes (#375)
    • Don't subtract microsecond from mint (#506)

    Models

    Changes to existing models:

    • Removed FCEF model, use segmentation_models_pytorch.Unet instead (#345)
    • FCSiamConf and FCSiamDiff now inherit from segmentation_models_pytorch.Unet, allowing for easily loading pretrained weights (#345)

    Samplers

    New samplers:

    • PreChippedGeoSampler (#479)

    Changes to existing samplers:

    • Allow for point sampling (#477)
    • Allow for sampling of entire scene (#477)
    • RandomGeoSampler no longer suffers from area bias (#408, #477)
    • Sample size now defaults to pixel units, use units=Units.CRS for old behavior (#294)

    Trainers

    Changes to existing trainers:

    • BYOLTask: fix in_channels handling (#522)
    • BYOLTask: fix loading of encoder weights (#524)
    • SemanticSegmentationTask: ignore_zeros renamed to ignore_index (#444, #644)

    Transforms

    New spectral indices:

    • BNDVI (#386)
    • GBNDVI (#450)
    • GNDVI (#371)
    • GRNDVI (#450)
    • NDRE (#386)
    • RBNDVI (#450)
    • SWI (#371)

    New base classes:

    • AppendTriBandNormalizedDifferenceIndex (#414)

    Documentation

    • Improved README (#589, #626)
    • Add dataset tables (#435, #478, #649)
    • Shorter dataset/datamodule/model names (#569, #571)
    • Spectral indices now display mathematical equations (#400)
    • Fix NAIP download in tutorials (#526, #531)
    • Add issue templates on GitHub (#584, #590)
    • Clarify Windows conda installation (#581)
    • Public type hints (#508)

    Tests

    • Test on Python 3.10 (#457)
    • Use dependabot to manage dependencies (#488, #551, #647)
    • Test minimum version of dependencies (#574)
    • Resolve and test for deprecation warnings (#567)
    • FCSiam tests no longer require internet access (#495, #497)

    Contributors

    This release is thanks to the following contributors:

    • @adamjstewart
    • @ashnair1
    • @calebrob6
    • @gaetanbahl
    • @iejMac
    • @isaaccorley
    • @khdlr
    • @MATRIX4284
    • @mehmetgunturkun
    • @nilsleh
    • @recursix
    • @remtav
    • @RitwikGupta
    • @saumyasinha
    • @weiji14
    Source code(tar.gz)
    Source code(zip)
  • v0.2.1(Mar 20, 2022)

    TorchGeo 0.2.1 Release Notes

    This is a bugfix release. There are no new features or API changes with respect to the 0.2.0 release.

    Dependencies

    • Fix minimum supported kornia version (#350)
    • Support older pytorch-lightning (#347, #351)
    • Add support for torchmetrics 0.8+ (#361, #382)

    DataModules

    • RESISC45: fix normalization statistics (#440)

    Datasets

    Fixes for dataset base classes:

    • GeoDataset: fix len() of empty dataset (#374)
    • RasterDataset: add support for float dtype (#379, #384)
    • RasterDataset: don't override custom cmap (#421, #422)
    • VectorDataset: fix issue with empty query (#399, #454, #467)

    Fixes for specific datasets:

    • CDL: update checksums due to new file formats (#423, #424, #428)
    • Chesapeake: support extraction of deflate64-compressed zip files (#59, #282)
    • Chesapeake: allow multiple datasets to share same root (#419, #420)
    • ChesapeakeCVPR: update prior extension data to version 1.1 (#359)
    • IDTReeS: fix citation (#389)
    • LandCover.ai: support already-downloaded dataset (#383)
    • Sentinel-2: fix regex to support band 8A (#393)
    • SpaceNet 2: update checksum due to data format consistency fix (#469)

    Samplers

    • Avoid bounding boxes smaller than patch size (#319, #376)

    Tutorials

    • Fix variable name in trainer notebook (#434)

    Tests

    • Fix integration tests on macOS/Windows (#349, #468)

    Contributors

    This release is thanks to the following contributors:

    • @adamjstewart
    • @ashnair1
    • @calebrob6
    • @ethanwhite
    • @nilsleh
    • @tritolol
    • @weiji14
    Source code(tar.gz)
    Source code(zip)
  • v0.2.0(Jan 2, 2022)

    TorchGeo 0.2.0 Release Notes

    This release contains a number of new features. The biggest change in this release is a significant overhaul of GeoDataset. It is now possible to intelligently compose multiple GeoDatasets in a variety of ways. For example, users can now:

    • Combine datasets for multiple image sources and treat them as equivalent (e.g. Landsat 7 and Landsat 8)
    • Combine datasets for disparate geospatial locations (e.g. Chesapeake NY and PA)

    These combinations require that all queries are present in at least one dataset, and can be combined using a UnionDataset:

    landsat7 = Landsat7(root="...")
    landsat8 = Landsat8(root="...", bands=["B2", "B3", "B4", "B5", "B6", "B7", "B8", "B9"])
    landsat = landsat7 | landsat8
    

    Users can now also:

    • Combine image and target labels and sample from both simultaneously (e.g. Landsat and CDL)
    • Combine datasets for multiple image sources for multimodal learning or data fusion (e.g. Landsat and Sentinel)

    These combinations require that all queries are present in both datasets, and can be combined using an IntersectionDataset:

    cdl = CDL(root="...", download=True, checksum=True)
    dataset = landsat & cdl
    

    If files are in different coordinate systems or at different spatial resolutions, TorchGeo now automatically warps all tiles to a common CRS and resolution. As before, all GeoDatasets are compatible with PyTorch DataLoaders using GeoSamplers.

    Backwards-incompatible changes

    TorchGeo is still in the alpha development phase and our API continues to change as needed. If you are using any of the following features, be sure to update your code to use the new API:

    • ZipDataset has been renamed to IntersectionDataset (#144)
    • GeoDataset no longer supports addition (+), use intersection (&) or union (|) instead (#144)
    • BoundingBox is no longer a subclass of tuple, but can still be cast to a tuple using tuple(bbox) (#144)
    • collate_dict has been renamed to stack_samples (#144)
    • Dataset-specific trainers have been removed, use task-specific trainers instead (#205, #286)
    • All DataModules have been moved from torchgeo.datasets to torchgeo.datamodules (#321)
    • Functional index transforms have been removed (#285)

    Datamodules

    This release adds a new torchgeo.datamodules namespace. All DataModules previously defined in torchgeo.datasets now live in torchgeo.datamodules.

    In addition, the following datasets have new datamodules:

    • Chesapeake CVPR prior labels (#202)
    • ETCI 2021 (#234)
    • EuroSAT (#246)
    • FAIR1M (#232)
    • LoveDA (#270)
    • NASA Marine Debris (#269)
    • OSCD (#255, #257, #341)
    • Potsdam 2D (#247)
    • Vaihingen 2D (#248)
    • xView2 (#236)

    Many datamodules now have a plot method that wraps around the respective dataset plot method (#286)

    Datasets

    This release includes many improvements for geospatial datasets:

    • New IntersectionDataset and UnionDataset classes (#144)
    • GeoDataset and BoundingBox now support set arithmetic (#144)
    • New collation functions for stacking, concatenating, merging, and unbinding samples (#144, #286, #328)
    • Chesapeake CVPR dataset now supports optional prior labels (#202)

    This release also includes the following new benchmark datasets:

    • FAIR1M (#232)
    • IDTReeS (#201)
    • LoveDA (#270)
    • NASA Marine Debris (#269)
    • OSCD (#233, #254, #258)
    • Potsdam 2D (#247)
    • SpaceNet 5 (#263)
    • SpaceNet 7 (#241)
    • Vaihingen 2D (#248)
    • xView2 (#236)

    Most existing datasets now have a plot method:

    • ADVANCE (#264)
    • Benin Small Holder Cashews (#264)
    • BigEarthNet (#264)
    • COWC (#300)
    • CV4A Kenya Crop Type (#312)
    • Cyclone (#298)
    • ETCI 2021 (#234)
    • EuroSAT (#251)
    • GID15 (#288)
    • LandCover.ai (#251)
    • LEVIR-CD+ (#335)
    • PatternNet (#314)
    • RESISC45 (#251)
    • SeCo (#251)
    • SEN12MS (#320, #338)
    • So2Sat (#251)
    • SpaceNet (#252, #311)
    • UCMerced (#251)
    • Zueri Crop (#334)

    Losses

    This release adds a new torchgeo.losses namespace for loss functions common in or exclusive to geospatial data.

    • QR and RQ losses (#202, #333)

    Models

    • RCF now has a seed parameter (#193, #250)

    Samplers

    • Samplers now respect ROI (#144, #149, #260)

    Trainers

    • Trainers now plot samples during validation for supported datamodules (#286)
    • Dataset-specific trainers have been removed (#286)

    Transforms

    • New AppendNormalizedDifferenceIndex transform (#285)
    • New normalized burn ratio transform (#284)

    Documentation

    • New tutorial for writing custom RasterDatasets (#283)
    • Tutorials are now properly versioned (#274, #309, #310)
    • Tutorials now have an "Open in Planetary Computer" button (#316)
    • Minor updates to Indices tutorial (#339, #348)

    Tests

    • Datamodules are now properly tested with real trainers (#329)
    • Tests no longer require internet access (#194, #265)
    • Tests now use significantly less memory (#344)

    Contributors

    This release is thanks to the following contributors:

    • @adamjstewart
    • @ashnair1
    • @calebrob6
    • @estherrolf
    • @iejMac
    • @isaaccorley
    • @nilsleh
    • @RitwikGupta
    Source code(tar.gz)
    Source code(zip)
  • v0.1.1(Dec 20, 2021)

    TorchGeo 0.1.1 Release Notes

    This is a bugfix release. There are no new features or API changes with respect to the 0.1.0 release.

    Bug Fixes

    • Avoid circular import errors (#276)
    • Rework list of required dependencies (#249, #287)
    • Relax constraints on Conda environment (#293, #295)
    • Fix parallel data loading on macOS/Windows (#184, #304)
    • Fix bug in shuffling of ETCI 2021 dataset (#231)
    • Support already downloaded files in Chesapeake datasets (#281)
    • Tutorials now open the same file in Google Colab (#274, #309)
    • Add pre-trained ResNet models to the docs (#256)
    • Clean up tutorial imports (#267, #308)
    • Various improvements to CI stability (#261, #268, #292, #299, #306)

    Contributors

    This release is thanks to the following contributors:

    • @adamjstewart
    • @amrzv
    • @ashnair1
    • @calebrob6
    • @isaaccorley
    Source code(tar.gz)
    Source code(zip)
  • v0.1.0(Nov 8, 2021)

    TorchGeo 0.1.0 Release Notes

    This is the first official release of TorchGeo! This release contains the following features:

    Datasets

    Added the following new benchmark datasets:

    • ADVANCE (AuDio Visual Aerial sceNe reCognition datasEt) (#133)
    • Smallholder Cashew Plantations in Benin (#28)
    • BigEarthNet (#197, #211)
    • Cars Overhead With Context (COWC) (#25, #217)
    • CV4A Kenya Crop Type Competition (#22)
    • ETCI2021 Flood Detection (#119)
    • EuroSAT (#167)
    • GID-15 (Gaofen Image Dataset) (#123)
    • LandCover.ai (Land Cover from Aerial Imagery) (#19, #48)
    • LEVIR-CD+ (LEVIR Change Detection +) (#106)
    • PatternNet (#111)
    • RESISC45 (Remote Sensing Image Scene Classification) (#126, #179)
    • Seasonal Contrast (#223)
    • SEN12MS (#26, #44)
    • So2Sat (#34, #145)
    • SpaceNet (#129, #155, #185)
    • Tropical Cyclone Wind Estimation Competition (8305aa7c5ed0e3d6d823c7cd2d552b137969b35b)
    • NWPU VHR-10 (6df38094df157aacc4a3f1e9b388b927dcd3515d)
    • UC Merced (#169, #208)
    • ZueriCrop (#147)

    Added the following new generic datasets:

    • Canadian Building Footprints (#69)
    • Chesapeake Bay High-Resolution Land Cover Project (#18, #100, #142)
    • Cropland Data Layer (CDL) (#37)
    • Landsat (#37)
    • National Agriculture Imagery Program (NAIP) (#57, #98)
    • Sentinel (#37)

    Models

    Added the following new models:

    • Change Star (#157)
    • Foreground-aware Relation Network (FarSeg) (#150)
    • Fully-convolutional Network (FCN) (#54)
    • Fully Convolutional Siamese Networks for Change Detection (#108)
    • Random-convolutional feature (RCF) extractor (#176)

    Samplers

    Added the following new samplers:

    • Random Geo Sampler (#37)
    • Grid Geo Sampler (#37)
    • Random Batch Geo Sampler (#37)

    Trainers

    Added the following new trainers:

    • BYOL (#145)
    • Classification (#207)
    • Multi-label Classification (#211)
    • Regression (#215)
    • Semantic Segmentation (#224)

    Transforms

    Added the following new transforms:

    • Indices: NDBI, NDSI, NDVI, NDWI (#127)

    Docs

    Added documentation for:

    • Installation (#153)
    • Contributing (#141)
    • Glossary (f6c91f4ebcfa7363bf421592fc36a0f523b9b5a4)
    • API Docs (00d619e9463ca223e29aa98e4658eb397dd74164)

    Added tutorials for:

    • Getting Started (#93)
    • Transforms (#127)
    • Indices (#127)
    • PyTorch Lightning Trainers (#161)
    • Benchmarking (#93)

    Contributors

    This release is thanks to the following contributors:

    • @adamjstewart
    • @anthonymlortiz
    • @ashnair1
    • @calebrob6
    • @isaaccorley
    • @Z-Zheng
    Source code(tar.gz)
    Source code(zip)
Owner
Microsoft
Open source projects and samples from Microsoft
Microsoft
Source code for EquiDock: Independent SE(3)-Equivariant Models for End-to-End Rigid Protein Docking (ICLR 2022)

Source code for EquiDock: Independent SE(3)-Equivariant Models for End-to-End Rigid Protein Docking (ICLR 2022) Please cite "Independent SE(3)-Equivar

Octavian Ganea 154 Jan 02, 2023
Style transfer between images was performed using the VGG19 model

Style transfer between images was performed using the VGG19 model. The necessary codes, libraries and all other information of this project are available below

Onur yılmaz 2 May 09, 2022
dualPC.R contains the R code for the main functions.

dualPC.R contains the R code for the main functions. dualPC_sim.R contains an example run with the different PC versions; it calls dualPC_algs.R whic

3 May 30, 2022
TensorFlow implementation of Barlow Twins (Barlow Twins: Self-Supervised Learning via Redundancy Reduction)

Barlow-Twins-TF This repository implements Barlow Twins (Barlow Twins: Self-Supervised Learning via Redundancy Reduction) in TensorFlow and demonstrat

Sayak Paul 36 Sep 14, 2022
Pre-trained model, code, and materials from the paper "Impact of Adversarial Examples on Deep Learning Models for Biomedical Image Segmentation" (MICCAI 2019).

Adaptive Segmentation Mask Attack This repository contains the implementation of the Adaptive Segmentation Mask Attack (ASMA), a targeted adversarial

Utku Ozbulak 53 Jul 04, 2022
本步态识别系统主要基于GaitSet模型进行实现

本步态识别系统主要基于GaitSet模型进行实现。在尝试部署本系统之前,建立理解GaitSet模型的网络结构、训练和推理方法。 系统的实现效果如视频所示: 演示视频 由于模型较大,部分模型文件存储在百度云盘。 链接提取码:33mb 具体部署过程 1.下载代码 2.安装requirements.txt

16 Oct 22, 2022
AirPose: Multi-View Fusion Network for Aerial 3D Human Pose and Shape Estimation

AirPose AirPose: Multi-View Fusion Network for Aerial 3D Human Pose and Shape Estimation Check the teaser video This repository contains the code of A

Robot Perception Group 41 Dec 05, 2022
PyTorch implementation for Convolutional Networks with Adaptive Inference Graphs

Convolutional Networks with Adaptive Inference Graphs (ConvNet-AIG) This repository contains a PyTorch implementation of the paper Convolutional Netwo

Andreas Veit 176 Dec 07, 2022
DIT is a DTLS MitM proxy implemented in Python 3. It can intercept, manipulate and suppress datagrams between two DTLS endpoints and supports psk-based and certificate-based authentication schemes (RSA + ECC).

DIT - DTLS Interception Tool DIT is a MitM proxy tool to intercept DTLS traffic. It can intercept, manipulate and/or suppress DTLS datagrams between t

52 Nov 30, 2022
This is the official implement of paper "ActionCLIP: A New Paradigm for Action Recognition"

This is an official pytorch implementation of ActionCLIP: A New Paradigm for Video Action Recognition [arXiv] Overview Content Prerequisites Data Prep

268 Jan 09, 2023
A curated list of awesome projects and resources related fastai

A curated list of awesome projects and resources related fastai

Tanishq Abraham 138 Dec 22, 2022
Learning Tracking Representations via Dual-Branch Fully Transformer Networks

Learning Tracking Representations via Dual-Branch Fully Transformer Networks DualTFR ⭐ We achieves the runner-ups for both VOT2021ST (short-term) and

phiphi 19 May 04, 2022
Code image classification of MNIST dataset using different architectures: simple linear NN, autoencoder, and highway network

Deep Learning for image classification pip install -r http://webia.lip6.fr/~baskiotisn/requirements-amal.txt Train an autoencoder python3 train_auto

Hector Kohler 0 Mar 30, 2022
Conflict-aware Inference of Python Compatible Runtime Environments with Domain Knowledge Graph, ICSE 2022

PyCRE Conflict-aware Inference of Python Compatible Runtime Environments with Domain Knowledge Graph, ICSE 2022 Dependencies This project is developed

<a href=[email protected]"> 7 May 06, 2022
This is the offical website for paper ''Category-consistent deep network learning for accurate vehicle logo recognition''

The Pytorch Implementation of Category-consistent deep network learning for accurate vehicle logo recognition This is the offical website for paper ''

Wanglong Lu 28 Oct 29, 2022
Implementation of "Scaled-YOLOv4: Scaling Cross Stage Partial Network" using PyTorch framwork.

YOLOv4-large This is the implementation of "Scaled-YOLOv4: Scaling Cross Stage Partial Network" using PyTorch framwork. YOLOv4-CSP YOLOv4-tiny YOLOv4-

Kin-Yiu, Wong 2k Jan 02, 2023
Official PyTorch implementation of UACANet: Uncertainty Aware Context Attention for Polyp Segmentation

UACANet: Uncertainty Aware Context Attention for Polyp Segmentation Official pytorch implementation of UACANet: Uncertainty Aware Context Attention fo

Taehun Kim 85 Dec 14, 2022
An addon uses SMPL's poses and global translation to drive cartoon character in Blender.

Blender addon for driving character The addon drives the cartoon character by passing SMPL's poses and global translation into model's armature in Ble

犹在镜中 153 Dec 14, 2022
UMich 500-Level Mobile Robotics Course

MOBILE ROBOTICS: METHODS & ALGORITHMS - WINTER 2022 University of Michigan - NA 568/EECS 568/ROB 530 For slides, lecture notes, and example codes, see

393 Dec 29, 2022
Includes PyTorch -> Keras model porting code for ConvNeXt family of models with fine-tuning and inference notebooks.

ConvNeXt-TF This repository provides TensorFlow / Keras implementations of different ConvNeXt [1] variants. It also provides the TensorFlow / Keras mo

Sayak Paul 87 Dec 06, 2022