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.

Tuning thresholds, comparing model variants and exporting results

You can now read every piece of a ChangeStar result. This page covers the decisions that shape what ends up in change_map in the first place, model variant and threshold, and finishes by getting your results into files a GIS can actually use.


1. Motivation

s1_s1c1_vitb and a threshold of 0.5 are defaults, not guaranteed to be the right choice for every project. Knowing how to compare variants and adjust sensitivity, and how to export the result properly, is what turns this lesson’s example into a workflow you can adapt for your own study area.


2. Core idea

Two independent choices shape ChangeStar’s output: which pretrained model variant you use, and what probability threshold converts continuous change probabilities into a binary map. Both are worth testing explicitly rather than accepting defaults, and once you have settled on a result you trust, exporting it as georeferenced files is what makes it usable outside this notebook.


3. Workflow

A. A quick convenience function

changestar_detect() initializes the model, runs prediction, and returns the result dictionary in a single call, useful for a quick one-off analysis where you do not need to reuse the same detector across multiple image pairs.

B. Comparing model variants

Different Changen2 pretraining stages can produce meaningfully different results on the same input. The three-color comparison makes disagreement visible directly: large magenta regions indicate the two variants agree, while substantial red-only or blue-only areas indicate a model-specific difference worth investigating before deciding which variant to trust for your study area.

C. Adjusting the detection threshold

The default threshold of 0.5 converts change_prob into change_map. Lowering it increases sensitivity, detecting more changes but also more false alarms, while raising it increases specificity, keeping only higher-confidence detections at the cost of missing subtler changes. This is the same underlying trade-off you tuned via confidence_threshold in L06’s detection workflow, applied here to change probability instead.

D. Viewing and using saved outputs

The predict() call from the workflow page saved georeferenced GeoTIFFs and a GeoPackage vector file to out_folder, ready to load directly into any GIS software. You can also display a saved raster interactively without leaving the notebook:


4. Python reactivation

zip(axes, thresholds) pairs up two sequences (the subplot axes and the threshold values) so you can iterate over both together in one loop, the same pattern useful whenever you need to process two related lists in lockstep. os.listdir() and os.path.getsize() are standard file-system functions for listing a directory’s contents and checking a file’s size, useful for confirming your exported outputs actually saved as expected.


5. Common pitfalls


6. Mini task

Looking at the three-threshold comparison in step C, would you expect the number of changed pixels at threshold=0.3 to be larger or smaller than at threshold=0.7? Explain your reasoning using the sensitivity/specificity framing from this page.

Sample solution

The number of changed pixels at threshold=0.3 should be larger. A lower threshold means more pixels with moderate change probability now qualify as “changed,” increasing sensitivity (and detected count) at the cost of including more likely false positives. At threshold=0.7, only pixels with high change probability pass, reducing the count but increasing confidence in each individual detection that remains.


7. Key takeaways