Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

A practical, end-to-end workflow using the ChangeStar model

You now understand the siamese-network idea conceptually. This page runs a specific, pre-trained implementation of it, ChangeStar, on real NAIP aerial imagery, before the next two pages dig into its output and tuning options.


1. Motivation

This is the page where the previous page’s architecture concepts become an actual working detector. ChangeStar is also a good illustration of a broader pattern: rather than training a change detection model from scratch, you are using one that arrives already pretrained to generalize across regions, similar in spirit to the pre-trained segmentation models from L07.


2. Core idea

ChangeStar jointly performs change detection and semantic segmentation: instead of only producing a binary change mask, it also outputs building footprint segmentation for each of the two input dates. Knowing what exists at each time step is part of what helps the model determine what has changed between them, rather than treating change detection as a separate problem from understanding either individual scene.


3. Workflow

A. List available model variants

ChangeStar ships several variants, trained with different Changen2 pretraining strategies. The naming convention encodes the pretraining stage (for example, s1 or s9) and the backbone architecture (vitb for ViT-Base, vitl for ViT-Large). You will compare specific variants directly on a later page; for now, it is enough to know that this naming pattern exists.

B. Set up an output location

get_device() checks whether a GPU is available and reports which compute device will be used; this does not require any action from you, but it is useful to confirm before running a full-scene prediction, since GPU-less runs are typically much slower.

C. Download the sample imagery

This is NAIP aerial imagery over Las Vegas, Nevada, from 2019 and 2022, a period of substantial suburban development, which makes it a useful test case for building change specifically.

D. Inspect the input pair

This split-panel map lets you visually confirm the two images cover the same area and look broadly comparable, exactly the comparability check from two pages ago, before spending any time on prediction. Skipping this step means you might not notice an obvious alignment or coverage problem until much later.

E. Initialize the model

s1_s1c1_vitb uses a ViT-Base backbone with stage-1 Changen2 pretraining, a reasonable starting variant. Model weights download automatically the first time you use a given variant.

F. Run change detection

predict() takes the two image paths and returns a dictionary of results, covered in detail on the next page. Large images are automatically split into overlapping tiles for processing and stitched back together with overlap averaging, the same tiled inference idea you have now seen across several lessons. Specifying the output_* paths saves georeferenced GeoTIFFs and a vector file directly to disk, which you will need for the export step two pages from now.


4. Python reactivation

models.items() iterates over a dictionary’s key-value pairs together, the same pattern used for the stats dictionary in L09. Path(out_folder).mkdir(exist_ok=True) creates a directory if it does not already exist, and does nothing (rather than raising an error) if it does, a convenient pattern for output folders you might create more than once across a session.


5. Common pitfalls


6. Mini task

Before running step F, predict which of ChangeStar’s likely outputs (a change map, and per-date building segmentation) you expect to show the most visual change between 2019 and 2022 in a rapidly suburbanizing area like Las Vegas, and why.

Sample solution

The change map itself should show the most visually obvious difference, since it is specifically designed to highlight areas of change, concentrating exactly where new construction occurred rather than spreading attention across the whole scene. The per-date building masks (T1 and T2) will individually look broadly similar to each other in already-developed areas, with the meaningful difference being the new buildings present in the T2 mask but absent from the T1 mask, which is precisely the comparison the change map is built to surface directly.


7. Key takeaways

Further reading