Spaces:
Running

hyperFVC / workflow /README.md
lauransotomayor's picture
Mirror GitHub Pages presentation build (part 4)
d1ffd83 verified
|
Raw History Blame Contribute Delete
6.73 kB
# fvc_function
Fractional vegetation cover (FVC) semantic segmentation pipeline: UAS orthomosaics β€” RGB,
multispectral (MicaSense) and hyperspectral (Specim FX10/FX17) β€” are processed phase by
phase into spatially aligned tiles and reference labels, which then feed U-Net models for
FVC mapping and post-hoc spectral analysis.
```
UAS orthomosaics β†’ aligned grid β†’ tiles + predictor cubes
β†’ LabelMe annotations β†’ FVC label rasters (BE / NPV / PV)
β†’ U-Net per sensor profile β†’ FVC maps + uncertainty + spectral analysis
```
## Repository layout
```
fvc_function/
β”œβ”€β”€ configs/paths.yaml # Data, model-weight and output locations
β”œβ”€β”€ utils/fvc_paths.py # Path resolver used by Python and shell
β”œβ”€β”€ scripts/ # Phase driver scripts (+ lib/fvc_env.sh)
β”œβ”€β”€ phase_1_image_processing/ # step_1 reprojection … step_5 band stacking
β”œβ”€β”€ phase_2_reference_data/ # step_1 BE class … step_5 label downsampling
β”œβ”€β”€ phase_3_models/ # unet_site_models/, unet_generic_model/, performance_metrics/
β”œβ”€β”€ jetsonOrinAGX/ # Edge benchmarks, ONNX β†’ TensorRT export
β”œβ”€β”€ docs/ # Methods, reproduction map, environment
└── environment.yml, requirements.txt
```
## Pipeline phases
Phases run in order; each consumes the previous phase's outputs. Every phase README
documents its method, contents and usage.
| Phase | Does | Output |
|---|---|---|
| [1 β€” Image processing](phase_1_image_processing/README_phase1.md) | Reprojection, row-major grid build, orthomosaic clipping, global stats, band stacking | Aligned tiles + predictor cubes (GeoTIFF / ENVI) |
| [2 β€” Reference data](phase_2_reference_data/README_phase2.md) | LabelMe β†’ shapefile, BE class from MSAVI/NDVI, water/shadow masking, majority-vote downsampling | Single-band multi-class label rasters (1 cm / 5 cm / 10 cm) |
| [3 β€” Modelling](phase_3_models/README_phase3.md) | U-Net training per sensor profile with block cross-validation, streaming inference, spectral and senescence analysis | Checkpoints, FVC maps, uncertainty rasters, metrics |
All grids resolve to the same ~30.7 m ground extent, so tile IDs correspond to the same
location across every sensor and resolution β€” this is what keeps labels registered to
predictors through the whole pipeline.
Deeper docs:
- Phase 3 β€” [runbook: training, inference, analysis, ONNX export](phase_3_models/README_RUNBOOK.md)
- Phase 3 β€” [predictor bands, mask values, sensor profiles](phase_3_models/unet_site_models/README_PREDICTORS_AND_MASKS.md) Β· [architecture and training upgrades](phase_3_models/unet_site_models/README_MODEL_UPGRADES.md) Β· [water-absorption band-exclusion ablation](phase_3_models/unet_site_models/WATER_BAND_ABLATION.md)
- All phases β€” [paper-ready methods](docs/METHODS.md) Β· [driver-script map](docs/REPRODUCTION.md) Β· [environment and Docker](docs/ENVIRONMENT.md)
## Poster
[**Mapping Vegetation Functional States β€” Across climate extremes**](README_POSTER.md)
Β· [A0 PDF](vegetation_functional_states_A0_portrait.pdf)
Spectral deep learning from drylands to Antarctic cryptogam ecosystems. The companion
notes record every claim on the poster and map each panel back to the module that produces
it, including the M1–M5 ablation ladder and the environment variables that reproduce each
variant.
Headline results: **89.56% / 88.11%** test OA for low and medium vegetation cover, and
**NPV F1 = 0.725** at the best MicaSense operating point (304 px, M5).
## Configuration
All machine-specific locations live in one file, [configs/paths.yaml](configs/paths.yaml) β€”
no absolute paths are baked into the Python or the shell drivers. Each root declares an
environment-variable override and an ordered list of candidates; the first that exists wins.
```bash
mamba env create -f environment.yml
mamba activate fvc_function
python utils/fvc_paths.py --check # confirm the data roots resolve
```
`--check` reports every root and site as `OK` / `MISSING` / `FAIL`, so a missing external
drive surfaces up front rather than part-way through a training run.
Override per run without editing anything:
```bash
# one-off, for a single run
FVC_DATA_ROOT=/mnt/mydisk/calperumResearch bash scripts/run_sensor_profiles_in_order.sh
# or for the whole session
export FVC_DATA_ROOT=/mnt/mydisk/calperumResearch
export FVC_UAS_ROOT=/mnt/mydisk/uas_data/Calperum
```
In your own code, ask for locations by name:
```python
from utils.fvc_paths import site, layout
predictors = layout("predictors", site="site1", grid="3072")
outputs = layout("outputs", site="site1", density="medium")
```
## Classes
| ID | Class | |
|---|---|---|
| 0 | `BE` | Bare earth |
| 1 | `NPV` | Non-photosynthetic vegetation |
| 2 | `PV` | Photosynthetic vegetation |
| 3 | `SI` | Shadow *(extended schema)* |
| 4 | `WI` | Water *(extended schema)* |
Extended at runtime with `FVC_EXTRA_CLASS_LABELS="SI,WI"` β€” no code edit. Pixels outside
valid annotation extents map to `-1` (training ignore index); NoData is written as `255`.
## Models
**Results deliverable** β€” [portable marimo explorer and workflow snapshot](../README.md)
for internal model comparisons, external validation, spatial scale/patches,
augmentation and spectral analysis. Saved notebook outputs and dataset metrics
retain their provenance; the original pipeline is unchanged.
**U-Net (site-specific)** β€” spectral U-Net with optional band-attention transformer, trained
per sensor profile (MicaSense 10-band and 5-band stacked, FX10, FX17, FX10+FX17) with
site-aware block cross-validation.
- [Phase 3 README](phase_3_models/README_phase3.md) Β· [runbook](phase_3_models/README_RUNBOOK.md)
**Edge deployment** β€” ONNX export and TensorRT benchmarks on Jetson Orin AGX.
- [jetsonOrinAGX/README_jetsonOrinAGX.md](jetsonOrinAGX/README_jetsonOrinAGX.md) Β· [Docker setup](README_DOCKER.md)
**Instance segmentation** (Mask2Former, structure/instance heads) is developed on the
[`cool_dev`](https://github.com/LNSOTOM/fvc_function/tree/cool_dev) branch, not on `main`.
## Notes for paper writing
- This workflow does not redefine the FVC classes; it improves discrimination of
ecologically meaningful vegetation states *within* existing FVC components by leveraging
additional spectral information (e.g. red-edge and moisture-sensitive wavelengths).
- When reporting results, document: tile size and spatial resolution, number of bands used
(`IN_CHANNELS`), class definitions (`class_labels`), ignore/NoData handling (`-1`), and
cross-validation strategy (block-based splits).