hjh1037 commited on
Commit
d787cb2
·
verified ·
1 Parent(s): b3fc10a

Release FLAME pretrained weights (flame_starcop, flame_emit)

Browse files
README.md ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ library_name: pytorch
4
+ tags:
5
+ - methane-detection
6
+ - hyperspectral
7
+ - semantic-segmentation
8
+ - remote-sensing
9
+ - fourier-neural-operator
10
+ - aviris-ng
11
+ - emit
12
+ ---
13
+
14
+ # FLAME — pretrained weights
15
+
16
+ Pretrained checkpoints for **FLAME: Physics-Guided Neural Operators for
17
+ Onboard Satellite Methane Detection in Hyperspectral Imagery**.
18
+
19
+ Code, configs, and usage instructions: https://github.com/ROKMC1250/FLAME
20
+
21
+ ## Files
22
+
23
+ | File | Trained on | SWIR input | Seed | Config |
24
+ |---|---|---|---|---|
25
+ | `flame_starcop.pt` | STARCOP (AVIRIS-NG) | 72 bands, 2122–2488 nm | 42 | `flame_starcop.yaml` |
26
+ | `flame_emit.pt` | OxHyperSyntheticCH4 (EMIT) | 64 bands, 2004–2478 nm | 42 | `flame_emit.yaml` |
27
+ | `seeds/flame_starcop_seed43.pt` | STARCOP | — | 43 | `flame_starcop.yaml` |
28
+ | `seeds/flame_emit_seed43.pt` | EMIT | — | 43 | `flame_emit.yaml` |
29
+ | `seeds/flame_emit_seed44.pt` | EMIT | — | 44 | `flame_emit.yaml` |
30
+
31
+ Each checkpoint is a `torch.save` dict with keys `model` (state dict),
32
+ `epoch`, and `metric`. The matching training configuration is included next to
33
+ the weights and is also shipped in the code repository under `configs/`.
34
+
35
+ ## Usage
36
+
37
+ ```bash
38
+ pip install huggingface_hub
39
+ hf download hjh1037/FLAME flame_starcop.pt --local-dir .
40
+ hf download hjh1037/FLAME flame_emit.pt --local-dir .
41
+ ```
42
+
43
+ Then follow the *Pretrained weights* section of the
44
+ [code repository README](https://github.com/ROKMC1250/FLAME#pretrained-weights)
45
+ to place them under `logs/<uid>/seed_<N>/weights/best.pt` for evaluation and
46
+ visualization.
47
+
48
+ ```python
49
+ import torch, yaml
50
+ from flame.model import build_model # from the code repository
51
+
52
+ cfg = yaml.safe_load(open('configs/flame_starcop.yaml'))
53
+ model = build_model(cfg['model']).eval()
54
+ state = torch.load('flame_starcop.pt', map_location='cpu', weights_only=False)
55
+ model.load_state_dict(state['model'])
56
+ ```
57
+
58
+ ## License
59
+
60
+ Apache-2.0. The STARCOP and OxHyperSyntheticCH4 datasets are distributed under
61
+ their own licenses.
flame_emit.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8d423830004bba3f5c20d0840d9263a0fbad28ffd7ad20d56b51ba262546f1de
3
+ size 27111928
flame_emit.yaml ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # FLAME on OxHyperSyntheticCH4 (EMIT) — reference training configuration.
2
+ #
3
+ # Protocol (aligned to the HyperspectralViTs training regime, arXiv:2410.17248):
4
+ # deterministic 64x64 / stride-32 grid windows from
5
+ # train_filtered_v2_tiled_64_32.csv, plume windows balanced to ~50% of every
6
+ # epoch by a with-replacement weighted sampler, BCE with pos_weight capped at
7
+ # pw_max, 50 epochs, bf16 autocast. Validation reproduces the test protocol
8
+ # (window pooling, logits >= 0, no morphological filtering).
9
+ #
10
+ # This configuration trains the self-contained physics variant
11
+ # (use_mag_in_seg: false): the segmentation head consumes the model's own
12
+ # parameter-free physics score, and mag1c (B_magic30_tile.tif / score_divisor,
13
+ # clipped to [0, 2]) acts only as a training-time auxiliary target for the
14
+ # score head, co-trained at a weak weight that fades linearly over the whole
15
+ # run (aux_weight 0.15, decay_frac 1.0). aux_bg_weight adds mild background
16
+ # suppression (score -> 0 where mag1c is silent) and pw_max: 3 provides a mild
17
+ # recall bootstrap — both guard against the all-negative collapse.
18
+ #
19
+ # Alternative (mag-in-seg) variant: set use_mag_in_seg: true so the seg head
20
+ # consumes mag1c directly at train and inference time; then set aux_weight: 0,
21
+ # aux_bg_weight: 0, pw_max: 1.
22
+
23
+ dataset: emit
24
+
25
+ model:
26
+ in_channels: 64 # SWIR 2004-2478 nm (EMIT)
27
+ width: 32
28
+ modes1: 16
29
+ modes2: 16
30
+ n_fno_layers: 3
31
+ n_ufno_layers: 3
32
+ dropout_rate: 0.0
33
+ seg_channels: [32, 16]
34
+ seg_kernel_size: 3
35
+ score_divisor: 1750.0 # shared by score normalisation and the mag1c input
36
+ rgb_divisor: 20.0
37
+ norm_type: group
38
+ score_clamp: [-10.0, 10.0]
39
+ use_mag_in_seg: false
40
+ spectrum_path: resources/emit/ch4_spectrum.npy
41
+ centers_path: resources/emit/band_centers.npy
42
+ baseline_stats_path: resources/emit/baseline_stats.pt
43
+
44
+ train:
45
+ uid: flame_emit
46
+ lr: 5.0e-4
47
+ epochs: 50
48
+ batch_size: 18 # must be divisible by the number of GPUs
49
+ n_workers: 2
50
+ log_dir: logs
51
+ seed: 42
52
+ patience: 25
53
+ ckpt_interval: 10
54
+ prefetch_factor: 2
55
+ vis_interval: 10
56
+ pretrain_epochs: 0
57
+ aux_weight: 0.15
58
+ decay_frac: 1.0
59
+ aux_bg_weight: 0.1
60
+ grad_clip_norm: 5.0
61
+ seg_loss: bce
62
+ pw_max: 3
63
+ focal_gamma: 0.0
64
+ val_threshold: 0.5
65
+ amp: bf16
66
+ val_window_batch: 256
67
+ find_unused_parameters: true
68
+
69
+ data:
70
+ root_dir: datasets/oxhyper_synthetic_ch4
71
+ store_dir: datasets/emit_ram64 # flat fp16 memmap store, built automatically
72
+ npy_cache_dir: ~ # optional (scripts/build_emit_npy_cache.py)
73
+ windows_csv: train_filtered_v2_tiled_64_32.csv
74
+ wv_window: [2004.0, 2478.0]
75
+ patch_size: 64
76
+ stride: 32
77
+ augment: true
78
+ max_train_windows: ~
79
+ max_val_tiles: ~
flame_starcop.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d65bf264ed94d8eb2a9f5eebf70c47d2b9e932dc6b41b759722ddb2af168e9a3
3
+ size 3163354
flame_starcop.yaml ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # FLAME on STARCOP (AVIRIS-NG) — reference training configuration.
2
+ #
3
+ # Protocol: full-tile (512x512) training with the two-phase curriculum —
4
+ # aux-only score pretrain (pretrain_epochs), then end-to-end segmentation with
5
+ # the auxiliary mag1c-sas L1 loss decaying over decay_frac of the remaining
6
+ # epochs. Validation: pixel F1 at sigmoid > 0.5 with 3x3 morphological opening.
7
+
8
+ dataset: starcop
9
+
10
+ model:
11
+ in_channels: 72 # SWIR 2122-2488 nm (AVIRIS-NG)
12
+ width: 14
13
+ modes1: 12
14
+ modes2: 12
15
+ n_fno_layers: 3
16
+ n_ufno_layers: 3
17
+ dropout_rate: 0.0
18
+ seg_channels: [28, 14]
19
+ seg_kernel_size: 3
20
+ score_divisor: 1750.0
21
+ rgb_divisor: 60.0
22
+ norm_type: batch
23
+ score_clamp: [0.0, 2.0]
24
+ wv_range: [2122, 2488]
25
+ spectrum_path: resources/starcop/ch4_spectrum.npy
26
+ centers_path: resources/starcop/band_centers.npy
27
+ baseline_stats_path: resources/starcop/baseline_stats.pt
28
+
29
+ train:
30
+ uid: flame_starcop
31
+ lr: 2.0e-3
32
+ epochs: 80
33
+ batch_size: 24 # must be divisible by the number of GPUs
34
+ n_workers: 4
35
+ log_dir: logs
36
+ seed: 42
37
+ patience: 25
38
+ ckpt_interval: 10
39
+ prefetch_factor: 1
40
+ vis_interval: 10
41
+ pretrain_epochs: 10
42
+ aux_weight: 1.0
43
+ decay_frac: 0.5
44
+ seg_loss: dice_bce
45
+ warmup_epochs: 3
46
+ warmup_start_factor: 0.1
47
+
48
+ data:
49
+ train_data_path:
50
+ - datasets/starcop
51
+ val_data_path: datasets/starcop/STARCOP_allbands_Eval
52
+ tile_size: 512
53
+ npy_dir: ~ # optional SWIR npy cache (scripts/build_starcop_npy_cache.py)
54
+ val_max_tiles: ~
55
+ wv_range: [2122, 2488]
56
+ load_rgb: true
57
+ augment: true
58
+
59
+ vis:
60
+ n_val_plume: 15
61
+ n_val_noplume: 5
62
+ n_train: 10
63
+ seed: 42
seeds/flame_emit_seed43.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:441741721d9b2a783a9c8ca3fb42cf25662117286a70cb3a22219fc331473c0b
3
+ size 27111928
seeds/flame_emit_seed44.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b140bfe53bb1641b7f22bea6ba18144793a0bccda5ef46dc98dba03648937f98
3
+ size 27111928
seeds/flame_starcop_seed43.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c23e8f5bf8bdf2f29e2746811b78421f16dd66e507d3ec850e27ac5bc2ecf29e
3
+ size 3163354