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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
library_name: pytorch
|
| 3 |
+
pipeline_tag: feature-extraction
|
| 4 |
+
base_model: nvidia/mit-b2
|
| 5 |
+
license: other
|
| 6 |
+
tags:
|
| 7 |
+
- remote-sensing
|
| 8 |
+
- multispectral
|
| 9 |
+
- time-series
|
| 10 |
+
- self-supervised-learning
|
| 11 |
+
- forest-phenology
|
| 12 |
+
- tree-crowns
|
| 13 |
+
- uav-imagery
|
| 14 |
---
|
| 15 |
+
|
| 16 |
+
# PhenoEmbed MiT-B2
|
| 17 |
+
|
| 18 |
+
PhenoEmbed is a self-supervised temporal feature extractor for individual tree
|
| 19 |
+
crowns observed in multispectral UAV image time series. It converts an aligned
|
| 20 |
+
sequence of crown-centered multispectral crops into one L2-normalized,
|
| 21 |
+
256-dimensional vector summarizing seasonal crown appearance.
|
| 22 |
+
|
| 23 |
+
The model was developed to capture phenological changes such as leaf emergence,
|
| 24 |
+
canopy closure, senescence, and leaf-off conditions. It is intended as a
|
| 25 |
+
representation model for downstream tree-level Earth-observation tasks rather
|
| 26 |
+
than as a species classifier or segmentation model.
|
| 27 |
+
|
| 28 |
+
## Model Description
|
| 29 |
+
|
| 30 |
+
- **Architecture:** SegFormer MiT-B2 spatial encoder with temporal Transformer
|
| 31 |
+
- **Base model:** [`nvidia/mit-b2`](https://huggingface.co/nvidia/mit-b2)
|
| 32 |
+
- **Input bands:** red, green, red-edge, and near-infrared
|
| 33 |
+
- **Temporal observations:** 18 acquisition dates
|
| 34 |
+
- **Crop extent:** 16 m × 16 m per crown
|
| 35 |
+
- **Stored crop resolution:** 288 × 288 pixels
|
| 36 |
+
- **Backbone input resolution:** 224 × 224 pixels
|
| 37 |
+
- **Output:** one L2-normalized 256-dimensional embedding per crown
|
| 38 |
+
- **Training method:** self-supervised temporal contrastive learning and masked temporal reconstruction
|
| 39 |
+
- **Spatial backbone:** frozen during training
|
| 40 |
+
- **Trainable components:** multispectral adapter, temporal Transformer, projection head, and reconstruction head
|
| 41 |
+
|
| 42 |
+
A trainable 1 × 1 convolution maps the four multispectral bands to the
|
| 43 |
+
three-channel input expected by the ImageNet-pretrained MiT-B2 backbone. It is
|
| 44 |
+
initialized with red and green passed to their corresponding channels and the
|
| 45 |
+
third channel initialized from the mean of red-edge and NIR. All adapter
|
| 46 |
+
weights remain trainable.
|
| 47 |
+
|
| 48 |
+
Per-date spatial features are combined with normalized seasonal time features
|
| 49 |
+
using a two-layer, four-head temporal Transformer.
|
| 50 |
+
|
| 51 |
+
## Training Data
|
| 52 |
+
|
| 53 |
+
The model was trained on
|
| 54 |
+
[HeideBench](https://doi.org/10.1594/PANGAEA.993969), a multispectral UAV
|
| 55 |
+
time-series dataset covering a forest patch in Dölauer Heide, Halle (Saale),
|
| 56 |
+
Germany.
|
| 57 |
+
|
| 58 |
+
The training corpus contains:
|
| 59 |
+
|
| 60 |
+
- 18 UAV orthomosaics acquired between 6 March and 5 November 2025
|
| 61 |
+
- 5,885 crop-safe individual tree crowns
|
| 62 |
+
- 105,930 crown-date crop instances
|
| 63 |
+
- 5,297 training crowns and 588 validation crowns
|
| 64 |
+
- Canonical band order: R, G, RE, NIR
|
| 65 |
+
- Average source ground sampling distance: 5.53 cm per pixel
|
| 66 |
+
|
| 67 |
+
Crown polygons were used as fixed object anchors for extracting aligned crops
|
| 68 |
+
of the same tree through time.
|
| 69 |
+
|
| 70 |
+
## Input Preprocessing
|
| 71 |
+
|
| 72 |
+
Input reflectance values must be arranged in canonical order:
|
| 73 |
+
|
| 74 |
+
```text
|
| 75 |
+
R, G, RE, NIR
|
| 76 |
+
```
|
| 77 |
+
|
| 78 |
+
The preprocessing used during training was:
|
| 79 |
+
|
| 80 |
+
1. Divide reflectance values by 10,000.
|
| 81 |
+
2. Clip values to the range `[0, 4]`.
|
| 82 |
+
3. Normalize each band using the following statistics:
|
| 83 |
+
|
| 84 |
+
| Band | Mean | Standard deviation |
|
| 85 |
+
|---|---:|---:|
|
| 86 |
+
| R | 0.06105786 | 0.05220907 |
|
| 87 |
+
| G | 0.07939660 | 0.05130135 |
|
| 88 |
+
| RE | 0.31415916 | 0.20160384 |
|
| 89 |
+
| NIR | 0.67597259 | 0.40058157 |
|
| 90 |
+
|
| 91 |
+
Invalid pixels are excluded using the accompanying alpha mask.
|
| 92 |
+
|
| 93 |
+
Each acquisition date also receives a normalized seasonal coordinate:
|
| 94 |
+
|
| 95 |
+
```text
|
| 96 |
+
(day - first_day) / (last_day - first_day)
|
| 97 |
+
```
|
| 98 |
+
|
| 99 |
+
Inputs from other sensors or sites should be calibrated to comparable
|
| 100 |
+
reflectance units. Reusing the HeideBench normalization statistics outside the
|
| 101 |
+
training domain may not be appropriate.
|
| 102 |
+
|
| 103 |
+
## Training Configuration
|
| 104 |
+
|
| 105 |
+
- Batch size: 2
|
| 106 |
+
- Completed optimization steps: 50,000
|
| 107 |
+
- Optimizer: AdamW
|
| 108 |
+
- Learning rate: 5 × 10⁻⁵
|
| 109 |
+
- Weight decay: 10⁻⁴
|
| 110 |
+
- Temporal masking probability: 0.3
|
| 111 |
+
- Contrastive temperature: 0.2
|
| 112 |
+
- Contrastive-loss weight: 1.0
|
| 113 |
+
- Reconstruction-loss weight: 1.0
|
| 114 |
+
- Precision: mixed 16-bit
|
| 115 |
+
- Checkpoint selection: minimum validation objective
|
| 116 |
+
|
| 117 |
+
A separate batch-size-16 sensitivity run was also evaluated. It did not improve
|
| 118 |
+
the intrinsic embedding diagnostics under its training schedule, but it used a
|
| 119 |
+
different learning rate and stopping configuration and should not be interpreted
|
| 120 |
+
as a controlled batch-size ablation.
|
| 121 |
+
|
| 122 |
+
## Usage
|
| 123 |
+
|
| 124 |
+
PhenoEmbed uses a custom PyTorch Lightning architecture and cannot be loaded
|
| 125 |
+
directly with `transformers.AutoModel`.
|
| 126 |
+
|
| 127 |
+
Clone and install the PhenoEmbed repository, prepare a compatible crop manifest,
|
| 128 |
+
and run:
|
| 129 |
+
|
| 130 |
+
```bash
|
| 131 |
+
PYTHONPATH=src python -m phenoembed.inference.export_embeddings \
|
| 132 |
+
--checkpoint-path phenoembed-mitb2-full.ckpt \
|
| 133 |
+
--data-config configs/dataloader_full.toml \
|
| 134 |
+
--output-path outputs/crown_embeddings.csv \
|
| 135 |
+
--npz-path outputs/crown_embeddings.npz \
|
| 136 |
+
--device cuda
|
| 137 |
+
```
|
| 138 |
+
|
| 139 |
+
The CSV contains the crown identifier, acquisition-date sequence, and 256
|
| 140 |
+
embedding dimensions. The optional NPZ output contains `crown_id`,
|
| 141 |
+
`date_sequence`, and `embedding` arrays.
|
| 142 |
+
|
| 143 |
+
## Evaluation
|
| 144 |
+
|
| 145 |
+
Intrinsic evaluation on 5,885 HeideBench crowns produced:
|
| 146 |
+
|
| 147 |
+
| Diagnostic | Result |
|
| 148 |
+
|---|---:|
|
| 149 |
+
| Variance explained by PC1 and PC2 | 25.1% |
|
| 150 |
+
| Variance explained by the first 8 PCs | 71.8% |
|
| 151 |
+
| Median top-1 cosine similarity | 0.946 |
|
| 152 |
+
| Median cosine similarity among top-10 neighbors | 0.902 |
|
| 153 |
+
| NDVI-amplitude linear probe, five-fold CV R² | 0.525 |
|
| 154 |
+
| NDRE-amplitude linear probe, five-fold CV R² | 0.414 |
|
| 155 |
+
|
| 156 |
+
The linear-probe results show that the embeddings retain measurable information
|
| 157 |
+
about seasonal vegetation change. PCA and nearest-neighbor similarity are
|
| 158 |
+
intrinsic representation diagnostics, not downstream accuracy measurements.
|
| 159 |
+
|
| 160 |
+
## Intended Uses
|
| 161 |
+
|
| 162 |
+
PhenoEmbed is intended for:
|
| 163 |
+
|
| 164 |
+
- Crown-level temporal representation extraction
|
| 165 |
+
- Forest phenology analysis
|
| 166 |
+
- Similarity search and crown retrieval
|
| 167 |
+
- Phenology-aware feature generation
|
| 168 |
+
- Research on seasonally robust tree-level models
|
| 169 |
+
- Future integration with crown segmentation or classification systems
|
| 170 |
+
|
| 171 |
+
## Limitations
|
| 172 |
+
|
| 173 |
+
- The model was trained on one forest site, one year, and one UAV sensor.
|
| 174 |
+
- Generalization across sites, years, sensors, and spatial resolutions has not
|
| 175 |
+
yet been established.
|
| 176 |
+
- The model expects aligned observations of the same annotated crown through time.
|
| 177 |
+
- The selected model uses only a small number of in-batch contrastive negatives.
|
| 178 |
+
- The MiT-B2 backbone is frozen and receives four-band information through a
|
| 179 |
+
learned four-to-three-channel adapter.
|
| 180 |
+
- The reconstruction objective predicts per-date band means rather than detailed
|
| 181 |
+
spatial structure.
|
| 182 |
+
- Current evaluation is intrinsic. Improved downstream crown segmentation under
|
| 183 |
+
seasonal shift has not yet been demonstrated.
|
| 184 |
+
- Embedding similarity must not be interpreted as species identity, ecological
|
| 185 |
+
equivalence, health status, or segmentation accuracy without independent
|
| 186 |
+
validation.
|
| 187 |
+
|
| 188 |
+
## Citation
|
| 189 |
+
|
| 190 |
+
```bibtex
|
| 191 |
+
@inproceedings{khan2026phenoembed,
|
| 192 |
+
title = {PhenoEmbed: Self-Supervised Multispectral UAV Time-Series
|
| 193 |
+
Embeddings for Individual Tree Crown Phenology},
|
| 194 |
+
author = {Khan, Taimur},
|
| 195 |
+
year = {2026},
|
| 196 |
+
note = {Resilience and AI Workshop at Informatik Festival 2026}
|
| 197 |
+
}
|
| 198 |
+
```
|
| 199 |
+
|
| 200 |
+
Please also cite the training dataset:
|
| 201 |
+
|
| 202 |
+
```bibtex
|
| 203 |
+
@dataset{khan2026heidebench,
|
| 204 |
+
author = {Khan, Taimur},
|
| 205 |
+
title = {HeideBench: A Multispectral UAV Time-Series Benchmark for
|
| 206 |
+
Forest Crown Phenology in Dölauer Heide},
|
| 207 |
+
publisher = {PANGAEA},
|
| 208 |
+
year = {2026},
|
| 209 |
+
doi = {10.1594/PANGAEA.993969}
|
| 210 |
+
}
|
| 211 |
+
```
|
| 212 |
+
|
| 213 |
+
## License
|
| 214 |
+
|
| 215 |
+
The release license for the PhenoEmbed weights must be stated here before
|
| 216 |
+
publication. Use of the model must also comply with the terms of the pretrained
|
| 217 |
+
MiT-B2 model and the HeideBench dataset.
|