Context features describe the neighbourhood of each label pixel: edges, local diversity, probability confidence, local class support, purity and optional class-pair relations.
| Input | Needed for | Notes |
|---|---|---|
| Hard label raster | Edge risk, diversity, hard-label class context | Uses the selected NoData/background value. |
| Probability stack | Entropy, margin, soft class context | One band per class; stack is normalized internally. |
| Class schema CSV | Optional | Gives readable band names and class order. |
| Control | Effect |
|---|---|
| Radius and window shape | Define the local neighbourhood N_R(x). |
| Feature set | Selects edge, diversity, entropy and margin. |
| Write class/local/pairwise context | Creates optional multi-band context stacks. |
| Include self-pairs / max pairwise bands | Controls class-pair stack size. |
Edge risk: marks class boundaries and their neighbourhood. It helps identify pixels where a crisp class label is spatially fragile.
Diversity: fraction of valid neighbours that differ from the centre class. High diversity means mixed local context.
Entropy: normalized probability uncertainty. It requires a probability stack and is 0 for a confident single class.
Margin: distance between the strongest and second-strongest class probability. Low margin indicates ambiguity.
Class support: local average support for class c, normalized over classes where support exists.
Local purity: dominance of the strongest class in the neighbourhood.
Pairwise context: describes how centre-class support i interacts with neighbourhood support j. Self-pairs can be included or excluded.
| Output | Meaning |
|---|---|
| Edge risk | Byte 0/100 raster, NoData 255. |
| Diversity, entropy, margin | Float32 0..1 rasters, NoData -9999. |
| Class support / local purity / pairwise context | Optional multi-band context stacks for later modelling or supervision. |
| Report JSON | Parameters, skipped outputs, band counts and paths. |
Entropy and margin require a probability stack. Skipped outputs are reported and leave empty result paths.