Umar666 commited on
Commit
0afa0a0
·
verified ·
1 Parent(s): 560458c

Add exported Track-A ONNX bundles (SegFormer, DINOv2+LoRA): model.onnx + preprocessing + config + parity + model card

Browse files
levircd_dinov2/config.yaml ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ run_id: levircd_dinov2
2
+ seed: 1337
3
+ data:
4
+ name: levircd
5
+ root: ${WORK}/sat-change-detection/data/levircd
6
+ tile_size: 256
7
+ num_workers: 8
8
+ bands:
9
+ - R
10
+ - G
11
+ - B
12
+ model:
13
+ name: dinov2_cd
14
+ encoder: facebook/dinov2-base
15
+ pretrained: true
16
+ image_size: 448
17
+ num_feature_layers: 4
18
+ fusion: diff
19
+ decoder_dim: 256
20
+ dropout: 0.1
21
+ in_channels: 3
22
+ out_channels: 1
23
+ lora: true
24
+ lora_r: 16
25
+ lora_alpha: 32
26
+ lora_dropout: 0.05
27
+ lora_targets:
28
+ - query
29
+ - key
30
+ - value
31
+ - dense
32
+ freeze_encoder: true
33
+ grad_checkpointing: true
34
+ loss:
35
+ type: bce_dice
36
+ bce_weight: 1.0
37
+ dice_weight: 1.0
38
+ train:
39
+ epochs: 200
40
+ batch_size: 8
41
+ lr: 0.0001
42
+ lr_reference_batch: 8
43
+ weight_decay: 0.01
44
+ optimizer: adamw
45
+ scheduler: cosine
46
+ amp: true
47
+ ddp: true
48
+ ddp_find_unused_parameters: false
49
+ grad_checkpointing: true
50
+ ckpt_every_min: 30
51
+ resume_if_exists: true
52
+ eval:
53
+ threshold: 0.5
54
+ metrics:
55
+ - precision
56
+ - recall
57
+ - f1
58
+ - iou
59
+ logging:
60
+ backend: tensorboard
61
+ log_dir: ${WORK}/sat-change-detection/results
levircd_dinov2/metrics_card.md ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Model card — levircd_dinov2
2
+
3
+ - **Architecture:** `dinov2_cd` (encoder `facebook/dinov2-base`, fusion `diff`)
4
+ - **Dataset:** LEVIR-CD (binary building change, 0.5 m RGB aerial)
5
+ - **Checkpoint:** `best.pt` (epoch 198)
6
+ - **Intended use:** portfolio/demo only; trained weights inherit LEVIR-CD research/non-commercial terms.
7
+
8
+ ## Metrics (LEVIR-CD test; threshold selected on val, applied to test)
9
+
10
+ | F1 | IoU | Precision | Recall | AP | trainable params |
11
+ |---|---|---|---|---|---|
12
+ | 0.912 | 0.839 | 0.924 | 0.901 | 0.946 | 2821377 |
13
+
14
+ Per-scene F1 mean±std: 0.767 ± 0.312 (n=128). Overall pixel accuracy is intentionally NOT reported (change is a tiny pixel fraction).
15
+
16
+ ## Export parity (PyTorch ↔ ONNXRuntime)
17
+ - opset 17, tol 1e-03, input 448px, dynamic_hw=False
18
+ - max |logit diff| = 8.01e-05 (post-sigmoid 6.52e-07) → **PASS**
levircd_dinov2/model.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d6dceef41ed53de5e3af441e36e22fec4b7d8a747b9f0a32124bef589044d0b1
3
+ size 358192702
levircd_dinov2/parity.json ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "passed": true,
3
+ "tol": 0.001,
4
+ "opset": 17,
5
+ "input_size": 448,
6
+ "dynamic_hw": false,
7
+ "primary": {
8
+ "input_shape": [
9
+ 1,
10
+ 2,
11
+ 3,
12
+ 448,
13
+ 448
14
+ ],
15
+ "max_abs": 8.0108642578125e-05,
16
+ "mean_abs": 1.568812149344012e-05,
17
+ "max_prob_abs": 6.51925802230835e-07
18
+ },
19
+ "secondary": {
20
+ "desc": "dynamic batch=2",
21
+ "input_shape": [
22
+ 2,
23
+ 2,
24
+ 3,
25
+ 448,
26
+ 448
27
+ ],
28
+ "max_abs": 0.00012254714965820312,
29
+ "mean_abs": 1.7884782209875993e-05,
30
+ "max_prob_abs": 5.736947059631348e-07
31
+ },
32
+ "torch_version": "2.5.1",
33
+ "onnxruntime_version": "1.27.0"
34
+ }
levircd_dinov2/preprocessing.json ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "input_name": "input",
3
+ "output_name": "logits",
4
+ "input_shape": [
5
+ "batch",
6
+ 2,
7
+ 3,
8
+ 448,
9
+ 448
10
+ ],
11
+ "input_layout": "(batch, 2 dates, 3 RGB channels, H, W)",
12
+ "band_order": [
13
+ "R",
14
+ "G",
15
+ "B"
16
+ ],
17
+ "value_range": "float32; divide 8-bit RGB by 255 BEFORE normalization",
18
+ "normalization": {
19
+ "mean": [
20
+ 0.485,
21
+ 0.456,
22
+ 0.406
23
+ ],
24
+ "std": [
25
+ 0.229,
26
+ 0.224,
27
+ 0.225
28
+ ]
29
+ },
30
+ "input_size": 448,
31
+ "dynamic_hw": false,
32
+ "resize_to_input": "resize each 256px tile to 448px (bilinear) before inference; resize the 448px output mask back to display resolution",
33
+ "tiling": {
34
+ "tile_size": 256,
35
+ "overlap": 0
36
+ },
37
+ "output": {
38
+ "activation": "sigmoid",
39
+ "meaning": "per-pixel change probability (channel 0)",
40
+ "recommended_threshold": 0.5078125,
41
+ "threshold_source": "val-selected (max-F1)"
42
+ },
43
+ "dinov2_note": "encoder runs on a FIXED 448px / 32x32 patch grid with interpolate_pos_encoding baked in; do NOT feed a different size."
44
+ }
levircd_segformer/config.yaml ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ run_id: levircd_segformer
2
+ seed: 1337
3
+ data:
4
+ name: levircd
5
+ root: ${WORK}/sat-change-detection/data/levircd
6
+ tile_size: 256
7
+ num_workers: 8
8
+ bands:
9
+ - R
10
+ - G
11
+ - B
12
+ model:
13
+ name: siamese_segformer
14
+ encoder: mit_b2
15
+ pretrained: true
16
+ fusion: diff
17
+ decoder_dim: 256
18
+ dropout: 0.1
19
+ in_channels: 3
20
+ out_channels: 1
21
+ loss:
22
+ type: bce_dice
23
+ bce_weight: 1.0
24
+ dice_weight: 1.0
25
+ train:
26
+ epochs: 200
27
+ batch_size: 8
28
+ lr: 4.0e-05
29
+ lr_reference_batch: 8
30
+ weight_decay: 0.01
31
+ optimizer: adamw
32
+ scheduler: cosine
33
+ amp: true
34
+ ddp: true
35
+ grad_checkpointing: false
36
+ ckpt_every_min: 30
37
+ resume_if_exists: true
38
+ eval:
39
+ threshold: 0.5
40
+ metrics:
41
+ - precision
42
+ - recall
43
+ - f1
44
+ - iou
45
+ logging:
46
+ backend: tensorboard
47
+ log_dir: ${WORK}/sat-change-detection/results
levircd_segformer/metrics_card.md ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Model card — levircd_segformer
2
+
3
+ - **Architecture:** `siamese_segformer` (encoder `mit_b2`, fusion `diff`)
4
+ - **Dataset:** LEVIR-CD (binary building change, 0.5 m RGB aerial)
5
+ - **Checkpoint:** `best.pt` (epoch 181)
6
+ - **Intended use:** portfolio/demo only; trained weights inherit LEVIR-CD research/non-commercial terms.
7
+
8
+ ## Metrics (LEVIR-CD test; threshold selected on val, applied to test)
9
+
10
+ | F1 | IoU | Precision | Recall | AP | trainable params |
11
+ |---|---|---|---|---|---|
12
+ | 0.911 | 0.836 | 0.917 | 0.905 | 0.943 | 24722369 |
13
+
14
+ Per-scene F1 mean±std: 0.761 ± 0.314 (n=128). Overall pixel accuracy is intentionally NOT reported (change is a tiny pixel fraction).
15
+
16
+ ## Export parity (PyTorch ↔ ONNXRuntime)
17
+ - opset 17, tol 1e-03, input 256px, dynamic_hw=True
18
+ - max |logit diff| = 2.29e-05 (post-sigmoid 4.58e-16) → **PASS**
levircd_segformer/model.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:19fc35dd977842bc2f3940bc19df85dbbc7824ce250c53067050821ca4e6bc60
3
+ size 99786543
levircd_segformer/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
+ 3,
12
+ 256,
13
+ 256
14
+ ],
15
+ "max_abs": 2.288818359375e-05,
16
+ "mean_abs": 4.0007580537348986e-06,
17
+ "max_prob_abs": 4.579669976578771e-16
18
+ },
19
+ "secondary": {
20
+ "desc": "dynamic H/W at 288px",
21
+ "input_shape": [
22
+ 1,
23
+ 2,
24
+ 3,
25
+ 288,
26
+ 288
27
+ ],
28
+ "max_abs": 2.47955322265625e-05,
29
+ "mean_abs": 4.17278488384909e-06,
30
+ "max_prob_abs": 4.40619762898109e-16
31
+ },
32
+ "torch_version": "2.5.1",
33
+ "onnxruntime_version": "1.27.0"
34
+ }
levircd_segformer/preprocessing.json ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "input_name": "input",
3
+ "output_name": "logits",
4
+ "input_shape": [
5
+ "batch",
6
+ 2,
7
+ 3,
8
+ 256,
9
+ 256
10
+ ],
11
+ "input_layout": "(batch, 2 dates, 3 RGB channels, H, W)",
12
+ "band_order": [
13
+ "R",
14
+ "G",
15
+ "B"
16
+ ],
17
+ "value_range": "float32; divide 8-bit RGB by 255 BEFORE normalization",
18
+ "normalization": {
19
+ "mean": [
20
+ 0.485,
21
+ 0.456,
22
+ 0.406
23
+ ],
24
+ "std": [
25
+ 0.229,
26
+ 0.224,
27
+ 0.225
28
+ ]
29
+ },
30
+ "input_size": 256,
31
+ "dynamic_hw": true,
32
+ "resize_to_input": "feed 256px tiles directly (fully-convolutional; dynamic H/W also allowed)",
33
+ "tiling": {
34
+ "tile_size": 256,
35
+ "overlap": 0
36
+ },
37
+ "output": {
38
+ "activation": "sigmoid",
39
+ "meaning": "per-pixel change probability (channel 0)",
40
+ "recommended_threshold": 0.48046875,
41
+ "threshold_source": "val-selected (max-F1)"
42
+ }
43
+ }