UIUC-developed TorchGeo is the core of GeoAI

TorchGeo is a PyTorch library that makes satellite and aerial imagery work like any other machine learning dataset. It began in 2021 as a collaboration between the University of Illinois Urbana-Champaign and Microsoft’s AI for Good Lab. Adam Stewart built it as a UIUC computer science Ph.D student, with UIUC professor Arindam Banerjee among its co-authors and NSF funding behind the work.

Since February 2024, it has been a project within the Open Source Geospatial Foundation (OSGeo). In August 2025, an independent TorchGeo Organization was founded to govern the project, with Microsoft AI for Good, the Technical University of Munich, Taylor Geospatial, Space42 and IBM Research joining. Stewart now leads it as a postdoctoral researcher at the Technical University of Munich.

“I think all good software is born out of frustration.”

It was 2021, and Adam Stewart was in the middle of his PhD in computer science and deep learning at the University of Illinois after completing a bachelor’s in Earth science at Cornell. He was reading a geography paper in a respected remote sensing journal that came to the conclusion that deep learning wasn’t suitable for remote sensing. He immediately rebutted— “Deep learning is in everything; it’s beaten every classical machine learning or AI baseline. What’s the bottleneck here?”

They were using a multilayer perceptron that was two or three layers deep, and maybe 20 units wide. It was like a little toy, as he described it, and not designed for images. “There are fancier models that should work much better,” he said.

What was missing in this stunted field were a few things, he thought. Education on newer models, smaller deep learning models to address the average user’s computing limits, and most importantly, a good software library “to learn how to do this stuff.”

There wasn’t much in computer vision software libraries in the way of geospatial data. It made sense; satellite imagery is a very diverse modality. It’s imagery, but they’re multispectral, even hyperspectral, not RGB (red, green, blue) — you’ve got hundreds of spectral bands instead of just three. There are infrared and even complex values like imaginary numbers in radar data. A project might pair thousands of images covering the United States with one giant label map of the whole country. All of it has to be chopped into patches and reprojected into a shared coordinate reference system (CRS). No existing software did that easily.

An image from the Northwestern Polytechnical University (NWPU) very-high-resolution ten-class (VHR-10) remote sensing image dataset.

So out of frustration, TorchGeo was born.


“The biggest problem with research code in general is reproducibility,” Stewart said.

There are infinitely many ways to write a data loader or do a train–validation–test split. You could load the images in a different order, or you could classify the labels in a different way. When every researcher picks their own way, results can’t be compared.

“If we’re not all using the same dataset and the same model implemented in the same way, you can’t actually compare one research paper to another research paper,” he said.

But through TorchGeo, there is one shared peer-reviewed reference implementation where almost every dataset and model lives. You don’t have to figure out how to get a repository working without any support from the original authors, because “they’ve moved on to bigger and better things,” as Stewart puts it.

If you find a dataset and you want to use it, it’s probably already in TorchGeo. If not, you can add it, and then keep working in the same ecosystem with 100% test coverage across operating systems and Python versions. If you want to test 20 models on 30 datasets, that’s just a pip install and one for-loop in TorchGeo.

However, shared code only fixes uniformity if the results built on it are trustworthy, so TorchGeo set that bar for its benchmarks. To train a deep learning model, you need randomness, from initial weights to data shuffling, so two identical runs score differently. The team trained each benchmark model 10 times with different random seeds and reported the mean and standard deviation. That lets later work tell whether an improvement is a real method gain or dissonance.

Under the hood

The idea behind TorchGeo is that geospatial layers are indexed by place and time, not by array position. Datasets combine using set-like operators: | builds a virtual mosaic of imagery, and & restricts sampling to where imagery and labels overlap.

The composition is lazy, so nothing is pre-mosaicked, pre-reprojected or pre-tiled on disk. Samplers like RandomPatchSampler draw chips at random for training, and GriddedPatchSampler walks a regular grid for evaluation and inference. Each batch triggers windowed reads of only the pixels it needs, aligned to a common CRS and resolution on the fly. Everything plugs into a standard PyTorch DataLoader.

For most practitioners, it’s important to know that TorchGeo supports spatially separated splits, such as assigning whole grid cells to train, validation or test, since nearby pixels look alike, and so a random train/test split leaks information and inflates scores.

Additionally, outputs are georeferenced. Predictions can be written back out as a GeoTIFF aligned with the input scene, ready for GIS analysis.

Pretraining is the other pillar. ImageNet weights, learned from ordinary RGB photos, still gave a large boost on remote sensing benchmarks. TorchGeo was the first library to ship weights pretrained on multispectral satellite imagery, using all 13 Sentinel-2 bands. It now carries more than 145 sets of weights, including sensor-agnostic foundation models such as DOFA that accept imagery with different band counts.

Levels of Abstraction

When it comes to usability, Stewart employs his software engineering philosophy: the 90-9-1 rule, where 90% of things should be easy, 9% are hard but doable, and 1% are not possible. Stewart says he works hard to keep the impossible as low as possible.

“I really focus on avoiding that 1%, because if you try to do everything, you end up with a library that’s really disorganized, really complex, not accessible, not intuitive, and you’re constantly adding new features for things that are not that important for 99% of your users” 

TorchGeo’s three levels of abstraction follow from this rule, offering options for users of different experience levels and needs.

You can work in raw PyTorch and have full control over datasets and models. With that are a lot of question marks and things that require experience to do correctly.

There’s also PyTorch Lightning with built-in data modules and tasks that reduce training to about five lines of code, which suits researchers running a standard task on new data.

For the rest, the command line exists to run a whole experiment from a config file, which stands as the best option for reproducing published work.

Stewart works at all three levels. To add a dataset, he writes the loader in raw PyTorch, integrates it into TorchGeo so it’s tested and documented, then wraps it in a data module. More routine experiments across many datasets and models run from the command line. He stresses that users still need to understand how their data is split, augmented and evaluated, because, again, spatial data proves tricky. Resolution varies from ten meters per pixel to tens of kilometers, time periods can be in daily or yearly formats, and spectrums, well, are a spectrum.

The likely way forward, he said, is foundation models that take data in its native resolution, bands and timestamps. Another is low-dimensional Earth embeddings, such as AlphaEarth, Tessera and Copernicus embeddings. 

Uses

The handling of complicated inputs is exciting, but the outputs prove even more so.

“I hope that we’re solving the really hard problems that no one cares about. The little nuances and details and annoying things, allowing people to do really cool things quickly and easily.”

And they have. Users have turned TorchGeo loose on mapping glacial retreat due to climate change, tracking food security, and monitoring potential avalanches, volcanic eruptions, earthquakes and landslides.

Stewart pointed to a Ugandan student using TorchGeo to map crop types across Uganda to understand the distribution of coffee, tea and other cash crops. Another, in his home country of Afghanistan, studies informal settlements to understand how government policy affects people who are in need of clean water and electricity.

Disaster response is a major use at Microsoft. Stewart recalled his collaborator, Caleb Robinson, excusing himself from a meeting in order to get back to Venezuelan earthquake disaster response. His team was mapping every building that’d been destroyed so local agencies could better allocate resources.

There are plans to expand TorchGeo to oceanography and atmospheric science, adding more pollution datasets, air quality datasets, and weather datasets like ERA5.

“It’s just really exciting to see all of the cool things that people start doing with TorchGeo that I never intended, and I don’t know how to do, but I’ve provided a platform on which they can build on top of,” Stewart said.

Being a part of the Microsoft Organization helped immensely with getting it in front of potential users’ eyes. IBM was one of the early adopters, building TerraTorch on top of it, which later joined the TorchGeo Organization. As of today, there are over 3.5 million downloads. Projects at NASA, ESA, the Brazilian Space Agency and Natural Resources Canada rely on TorchGeo. Because of this growth, their role has morphed.

“It’s been exciting to see this transition over time. TorchGeo started out being this high-level library that solves everything, but compared to the software that came after it, now it kind of feels like a low-level library that does all of the little details no one wants to deal with, and they can build on top of it and do cool things,” Stewart said.

The platform hosts and fine-tunes foundation models, but the team isn’t going out of its way to add more complex handling of those foundation models. To Stewart, that functionality belongs to libraries built on top, like TerraTorch or Geo Eval Harness. Other libraries include TerraKit by IBM for downloading data or rs-embed out of UIUC for creating embedding datasets.

TorchGeo is, in essence, the stable core of the ecosystem rather than its end user. It gets a lot more eyes on its code and has software that depends on it, letting the team focus on what they’re best at.

“It’s cool to have an experimental software library on top of a stable library where you can break the experimental thing as much as you want,” Stewart said.

Having left Microsoft for the TorchGeo Organization, with a public Technical Steering Committee, TorchGeo has been able to sustain this. Stewart noted that good software born in industry research often disappears if the application doesn’t turn enough profit.

“The beauty of open source is that you aren’t tied to any single corporate agenda,” he said. “The future of the software you build is not always in your own hands. This was one of the biggest things we were afraid of.”

Independence also lets in contributors whose employers compete with Microsoft. “It doesn’t belong to anyone; it belongs to everyone!”

Maintenance

Stewart says that TorchGeo is 90% data loaders and models. There’s always more data and models that could be added, work that “kind of never ends.” The other 10% is where things get more interesting and more diverse, like time-series handling.

Over the last two years, he redesigned most of what was written for the original paper, while trying not to break backward compatibility too much, as a final step toward a TorchGeo 1.0. release.

“We’re not gonna break things again. We’ll be backwards-compatible. It’s okay to rely on TorchGeo in your corporate workflows and not worry about having to upgrade in six months or six years,” Stewart added.

Keeping that promise has proven tough as TorchGeo grows. At first, they received ten pull requests (PRs) a month; now it’s closer to 100. It’s getting time-consuming to review changes, having to review them 100 times instead of ten. Their solution has been to define a good scope.

“We want to make it very clear this is only for GeoAI. If you have general-purpose computer vision things that you want to do with TorchGeo, add it to a general-purpose computer vision library,” Stewart said.

The team has deliberately stayed out of intriguing but more complex tasks like LiDAR-based 3D modeling, cloud masking and off-nadir imagery, and it’s getting to a point that they may need to narrow further.

“That’s the hardest thing as a maintainer, you have to decide what is the user’s fault versus what is our fault for not making it more accessible? Versus what is something that we just don’t want to get into because it’s too hard,” Stewart said.

AI

Stewart says TorchGeo has been inundated by AI “slop” PRs.

“Maybe it’s good, maybe it’s bad. It’s definitely twice as big as it needs to be, hard to maintain, hard to test, hard to wrap your head around, but it technically works,” he said.

On a more personal note, Stewart considers himself skeptical of overreliance on AI, saying he dislikes LLMs for coding. He likes reading and writing code, and the automation makes it less fun.

“You can use AI if you want to, but there are copyright rules that we need to follow, and if this thing is enormously verbose, no one’s gonna want to review it.” 

Most bug reports and PRs that enter TorchGeo now require significantly more effort from reviewers compared to a large number of contributors. It’s shifted a lot of the workload onto a small number of maintainers, and “that’s not how it should be.”

In October of 2026, the TorchGeo maintainers voted unanimously to temporarily prohibit AI-assisted contributions to the TorchGeo project. This combats AI slop and helps ensure the maintainability and security of TorchGeo. Other major open-source geospatial projects like QGIS and GDAL are now following suit.

However, LLMs have also lowered the barrier of entry. Combined with TorchGeo’s documentation, they have helped researchers who don’t feel comfortable writing software.

Stewart has enjoyed observing a wave of startups move into GeoAI, building data cubes, or stacks of satellite imagery, and analyzing them.

With increasing size and users come bugs too.

“Someone will always find a way to do things that I never expected. And that’s a really fun source of bugs,” Stewart says. He also explains that users’ complaints are incredibly useful in the design process.

“The thing that’s most exciting to me is when I get the same kind of confusion a lot, because that implies that the design is not good, and we might need to redesign how this works… I may need to break backwards-compatibility for everyone else, but it’s also a great opportunity to make it more intuitive.”


Learn More and Get Involved

Learn more about TorchGeo and its team members from UIUC: Adam Stewart and Arindam Banerjee.

Contact the Office of Data Science Research to tell us about other people or resources we could feature here. ODSR is a campuswide convening organization that facilitates collaborations, resource sharing, and public engagement focused on data science research activities at the University of Illinois.

Office of Data Science Research
Email: data-science-research@illinois.edu