M5: add OSCD Sentinel-2 Track-B 4-band bundle (test F1 0.453; portfolio artifact)
Browse files- oscd_s2_baseline/config.yaml +45 -0
- oscd_s2_baseline/metrics_card.md +22 -0
- oscd_s2_baseline/model.onnx +3 -0
- oscd_s2_baseline/parity.json +34 -0
- oscd_s2_baseline/preprocessing.json +46 -0
oscd_s2_baseline/config.yaml
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
run_id: oscd_s2_baseline
|
| 2 |
+
seed: 1337
|
| 3 |
+
data:
|
| 4 |
+
name: oscd
|
| 5 |
+
root: /tmp/w/sat-change-detection/data/oscd
|
| 6 |
+
tile_size: 256
|
| 7 |
+
num_workers: 4
|
| 8 |
+
bands:
|
| 9 |
+
- R
|
| 10 |
+
- G
|
| 11 |
+
- B
|
| 12 |
+
- NIR
|
| 13 |
+
model:
|
| 14 |
+
name: fc_siam_diff
|
| 15 |
+
in_channels: 4
|
| 16 |
+
fusion: diff
|
| 17 |
+
base_channels: 16
|
| 18 |
+
out_channels: 1
|
| 19 |
+
loss:
|
| 20 |
+
type: bce_dice
|
| 21 |
+
bce_weight: 1.0
|
| 22 |
+
dice_weight: 1.0
|
| 23 |
+
train:
|
| 24 |
+
epochs: 100
|
| 25 |
+
batch_size: 16
|
| 26 |
+
lr: 0.001
|
| 27 |
+
lr_reference_batch: 16
|
| 28 |
+
weight_decay: 0.0001
|
| 29 |
+
optimizer: adamw
|
| 30 |
+
scheduler: cosine
|
| 31 |
+
amp: true
|
| 32 |
+
ddp: false
|
| 33 |
+
grad_checkpointing: false
|
| 34 |
+
ckpt_every_min: 30
|
| 35 |
+
resume_if_exists: true
|
| 36 |
+
eval:
|
| 37 |
+
threshold: 0.5
|
| 38 |
+
metrics:
|
| 39 |
+
- precision
|
| 40 |
+
- recall
|
| 41 |
+
- f1
|
| 42 |
+
- iou
|
| 43 |
+
logging:
|
| 44 |
+
backend: tensorboard
|
| 45 |
+
log_dir: /tmp/w/sat-change-detection/results
|
oscd_s2_baseline/metrics_card.md
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Model card — oscd_s2_baseline
|
| 2 |
+
|
| 3 |
+
- **Architecture:** `fc_siam_diff` (encoder `None`, fusion `diff`)
|
| 4 |
+
- **Dataset:** OSCD (Onera Satellite CD; Sentinel-2 ~10 m, RGB+NIR, binary change)
|
| 5 |
+
- **Checkpoint:** `oscd_s2_baseline_best.pt` (epoch 19)
|
| 6 |
+
- **Intended use:** portfolio/demo only; trained weights inherit the dataset's research/non-commercial terms.
|
| 7 |
+
|
| 8 |
+
## Metrics (test split; threshold selected on val, applied to test)
|
| 9 |
+
|
| 10 |
+
| F1 | IoU | Precision | Recall | AP | trainable params |
|
| 11 |
+
|---|---|---|---|---|---|
|
| 12 |
+
| 0.453 | 0.293 | 0.492 | 0.420 | 0.413 | 834705 |
|
| 13 |
+
|
| 14 |
+
Per-scene F1 mean±std: 0.378 ± 0.175 (n=10). Overall pixel accuracy is intentionally NOT reported (change is a tiny pixel fraction).
|
| 15 |
+
|
| 16 |
+
## Honest framing — read this
|
| 17 |
+
|
| 18 |
+
Sentinel-2 is a **coarse 10 m/px** domain. This model is **directionally correct on large real-world change, not a high-accuracy detector** (test F1 ~0.45). OSCD is tiny (24 scenes) and genuinely hard, so scores are modest by design — not dressed up. The high-resolution **aerial LEVIR-CD track is the high-accuracy showcase**; this Sentinel-2 track exists to run on any real-world location, plainly caveated.
|
| 19 |
+
|
| 20 |
+
## Export parity (PyTorch ↔ ONNXRuntime)
|
| 21 |
+
- opset 17, tol 1e-03, input 256px, dynamic_hw=True
|
| 22 |
+
- max |logit diff| = 1.43e-06 (post-sigmoid 2.68e-07) → **PASS**
|
oscd_s2_baseline/model.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:2ccb6229a5c83de2d2ccd2b4512e93eab3c8f3a5a163ce92b5871a629b78717a
|
| 3 |
+
size 3352304
|
oscd_s2_baseline/parity.json
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"passed": true,
|
| 3 |
+
"tol": 0.001,
|
| 4 |
+
"opset": 17,
|
| 5 |
+
"input_size": 256,
|
| 6 |
+
"dynamic_hw": true,
|
| 7 |
+
"primary": {
|
| 8 |
+
"input_shape": [
|
| 9 |
+
1,
|
| 10 |
+
2,
|
| 11 |
+
4,
|
| 12 |
+
256,
|
| 13 |
+
256
|
| 14 |
+
],
|
| 15 |
+
"max_abs": 1.430511474609375e-06,
|
| 16 |
+
"mean_abs": 1.1048496162402444e-07,
|
| 17 |
+
"max_prob_abs": 2.682209014892578e-07
|
| 18 |
+
},
|
| 19 |
+
"secondary": {
|
| 20 |
+
"desc": "dynamic H/W at 288px",
|
| 21 |
+
"input_shape": [
|
| 22 |
+
1,
|
| 23 |
+
2,
|
| 24 |
+
4,
|
| 25 |
+
288,
|
| 26 |
+
288
|
| 27 |
+
],
|
| 28 |
+
"max_abs": 1.3113021850585938e-06,
|
| 29 |
+
"mean_abs": 1.07262344783976e-07,
|
| 30 |
+
"max_prob_abs": 2.682209014892578e-07
|
| 31 |
+
},
|
| 32 |
+
"torch_version": "2.5.1",
|
| 33 |
+
"onnxruntime_version": "1.27.0"
|
| 34 |
+
}
|
oscd_s2_baseline/preprocessing.json
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"input_name": "input",
|
| 3 |
+
"output_name": "logits",
|
| 4 |
+
"input_shape": [
|
| 5 |
+
"batch",
|
| 6 |
+
2,
|
| 7 |
+
4,
|
| 8 |
+
256,
|
| 9 |
+
256
|
| 10 |
+
],
|
| 11 |
+
"input_layout": "(batch, 2 dates, 4 bands [R,G,B,NIR], H, W)",
|
| 12 |
+
"band_order": [
|
| 13 |
+
"R",
|
| 14 |
+
"G",
|
| 15 |
+
"B",
|
| 16 |
+
"NIR"
|
| 17 |
+
],
|
| 18 |
+
"value_range": "float32 reflectance; divide uint16 Sentinel-2 L2A (bands B04,B03,B02,B08) by 10000 BEFORE normalization",
|
| 19 |
+
"normalization": {
|
| 20 |
+
"mean": [
|
| 21 |
+
0.13559,
|
| 22 |
+
0.13234,
|
| 23 |
+
0.13953,
|
| 24 |
+
0.2011
|
| 25 |
+
],
|
| 26 |
+
"std": [
|
| 27 |
+
0.08096,
|
| 28 |
+
0.05684,
|
| 29 |
+
0.04359,
|
| 30 |
+
0.08868
|
| 31 |
+
]
|
| 32 |
+
},
|
| 33 |
+
"input_size": 256,
|
| 34 |
+
"dynamic_hw": true,
|
| 35 |
+
"resize_to_input": "feed 256px tiles directly (fully-convolutional; dynamic H/W also allowed)",
|
| 36 |
+
"tiling": {
|
| 37 |
+
"tile_size": 256,
|
| 38 |
+
"overlap": 0
|
| 39 |
+
},
|
| 40 |
+
"output": {
|
| 41 |
+
"activation": "sigmoid",
|
| 42 |
+
"meaning": "per-pixel change probability (channel 0)",
|
| 43 |
+
"recommended_threshold": 0.46875,
|
| 44 |
+
"threshold_source": "val-selected (max-F1)"
|
| 45 |
+
}
|
| 46 |
+
}
|