cyd0806 commited on
Commit
60474ce
·
verified ·
1 Parent(s): 88daae1

Update model zoo metadata

Browse files
Files changed (1) hide show
  1. README.md +89 -20
README.md CHANGED
@@ -9,7 +9,7 @@ neuron-segmentation experiments on CREMI. The maintained path is:
9
  - self-supervised dbMiM / MAE-style pretraining on unlabeled EM volumes;
10
  - anisotropic 3D UNETR affinity finetuning on CREMI;
11
  - full-volume CREMI A/B/C evaluation with VOI and adapted Rand error (ARAND);
12
- - waterz-based post-processing with calibration and threshold sweeps.
13
 
14
  The old private cluster launchers, scratch reports, cached bytecode, legacy
15
  models, and historical dataloaders have been removed from Git. Large data,
@@ -17,8 +17,7 @@ checkpoints, reports, and local experiment outputs are intentionally ignored.
17
 
18
  ## Current Method
19
 
20
- The current best method is not the original minimal reproduction. It combines
21
- the following changes that were stable in ablations:
22
 
23
  1. **Anisotropic UNETR backbone**: `UNETRAnisotropicAffinityNet` with
24
  `32x160x160` input crops, `patch_size=(4,16,16)`, transformer hidden states
@@ -35,16 +34,70 @@ the following changes that were stable in ablations:
35
  evaluated with `ignore_label=0`, CREMI-style XY boundary ignore distance `1`,
36
  z boundary ignore `0`, logit calibration biases, and a waterz threshold sweep.
37
 
38
- The most useful new finding is that **fixed mixed edge/random masking on full
39
- EM data (R33)** improves over scratch, old fullEM dbMiM, pure edge masking, and
40
- fullEM plain MAE. The best absolute VOI is still the smaller publicEM dbMiM
41
- model (R17), so the README reports both.
42
-
43
- The recommended R33 line does **not** use a reinforcement-learning masking
44
- policy. It uses fixed mixed edge/random masking. RL-style decision modules are
45
- retained only as ablations: R16 used the older decision module in the publicEM
46
- pretraining line, while R34/R35 tested adaptive mixed masking and were negative
47
- under the current CREMI A/B/C protocol.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
48
 
49
  ## Model Zoo
50
 
@@ -54,8 +107,9 @@ Weights are hosted at:
54
 
55
  | Model | HF path | Intended use |
56
  |---|---|---|
 
57
  | PublicEM dbMiM R17 pretrain | `weights/publicem_dbmim_r17/pretrained_latest.pt` | ViT/dbMiM encoder checkpoint for UNETR initialization |
58
- | PublicEM dbMiM R17 finetune | `weights/publicem_dbmim_r17/finetuned_latest.pt` | Best current publicEM segmentation checkpoint |
59
  | FullEM mixed-mask dbMiM R33 pretrain | `weights/fullem_mixedmask_dbmim_r33/pretrained_latest.pt` | Recommended full-data dbMiM pretraining checkpoint |
60
  | FullEM mixed-mask dbMiM R33 finetune | `weights/fullem_mixedmask_dbmim_r33/finetuned_latest.pt` | Recommended full-data segmentation checkpoint |
61
 
@@ -103,9 +157,8 @@ The protocol is:
103
  - sweep calibration biases and waterz thresholds;
104
  - report aggregate A/B/C `voi_sum` and `adapted_rand_error`.
105
 
106
- This split is small but matches the controlled ablation goal: isolate whether
107
- dbMiM pretraining improves the same anisotropic UNETR finetuning recipe over
108
- scratch and plain MAE controls.
109
 
110
  ## Results
111
 
@@ -118,8 +171,11 @@ post-processing thresholds.
118
 
119
  | Arm | VOI | ARAND at best VOI | Best ARAND | Conclusion |
120
  |---|---:|---:|---:|---|
121
- | R17 publicEM random-mask dbMiM | **1.002919** | **0.188832** | 0.188832 | Best publicEM VOI |
 
 
122
  | R23 publicEM random-mask plain MAE | 1.027073 | 0.192763 | 0.189247 | Matched MAE baseline |
 
123
  | R29 publicEM pure edge-mask dbMiM | 1.033564 | 0.186827 | **0.186827** | Best publicEM ARAND, worse VOI |
124
  | R32 publicEM fixed mixed-mask dbMiM | 1.046538 | 0.206256 | 0.193183 | Negative vs R17/R23 |
125
  | R34 publicEM adaptive mixed dbMiM | 1.067471 | 0.205437 | 0.200604 | Negative adaptive result |
@@ -128,8 +184,12 @@ post-processing thresholds.
128
 
129
  Key deltas:
130
 
 
 
 
 
131
  - R17 dbMiM beats matched publicEM plain MAE R23 by `-0.0242` VOI and about
132
- `-0.0004` best ARAND.
133
  - R29 edge-mask dbMiM beats same-mask plain MAE R30 by `-0.0440` VOI and
134
  `-0.0117` best ARAND, but its VOI is worse than R17/R23.
135
 
@@ -162,6 +222,15 @@ edge fraction per crop. It did not improve downstream segmentation. After step
162
  fraction was `0.4456` for R34 and `0.3322` for R35. The current adaptive policy
163
  is therefore kept as a negative ablation rather than the recommended method.
164
 
 
 
 
 
 
 
 
 
 
165
  ## Training Strategy
166
 
167
  ### Pretraining
@@ -209,7 +278,7 @@ Main settings:
209
  | Loss | MSE + MAWS, no BCE/Dice in the current winning recipe |
210
  | Label handling | synchronized image/label augmentation, 2D border widening radius 1 |
211
  | Batch size | 2 per GPU |
212
- | Schedule | 12k optimizer steps, lr `8e-5`, encoder lr `1e-5`, weight decay `0.01`, AMP |
213
  | Pretrained prefixes | `pos_embed`, `patch_embed`, `encoder_blocks`, `norm` |
214
 
215
  ### Evaluation
 
9
  - self-supervised dbMiM / MAE-style pretraining on unlabeled EM volumes;
10
  - anisotropic 3D UNETR affinity finetuning on CREMI;
11
  - full-volume CREMI A/B/C evaluation with VOI and adapted Rand error (ARAND);
12
+ - waterz-based reference post-processing with small calibration and threshold sweeps.
13
 
14
  The old private cluster launchers, scratch reports, cached bytecode, legacy
15
  models, and historical dataloaders have been removed from Git. Large data,
 
17
 
18
  ## Current Method
19
 
20
+ The official implementation follows the dbMiM neuron-segmentation pipeline:
 
21
 
22
  1. **Anisotropic UNETR backbone**: `UNETRAnisotropicAffinityNet` with
23
  `32x160x160` input crops, `patch_size=(4,16,16)`, transformer hidden states
 
34
  evaluated with `ignore_label=0`, CREMI-style XY boundary ignore distance `1`,
35
  z boundary ignore `0`, logit calibration biases, and a waterz threshold sweep.
36
 
37
+ ## Implementation Details
38
+
39
+ **Decision-based MIM.** The pretraining stage treats each 3D ViT patch as an
40
+ agent. Each agent chooses a binary action, `keep` or `mask`, and all agents
41
+ share policy parameters. The target network provides global and local features
42
+ for the decision module. The policy receives a team reward from the change in
43
+ masked-reconstruction loss and is trained with an actor-critic/A2C-style
44
+ objective.
45
+
46
+ **Reconstruction targets.** The masked-image target reconstructs raw EM voxels
47
+ and structure-aware features. The maintained dbMiM pretraining path uses raw
48
+ reconstruction, membrane-aware reconstruction weighting, and a lightweight
49
+ structure consistency term. Plain MAE controls use the same data, crop size,
50
+ model size, mask ratio, and training schedule with the dbMiM-specific structure
51
+ terms disabled.
52
+
53
+ **UNETR transfer.** Finetuning loads compatible ViT encoder prefixes from the
54
+ pretrained masked-image model into the anisotropic UNETR affinity network:
55
+ `pos_embed`, `patch_embed`, `encoder_blocks`, and `norm`. The convolutional
56
+ decoder and affinity head are trained for the supervised CREMI task.
57
+
58
+ **Affinity and instance decoding.** CREMI instance labels are converted to
59
+ nearest-neighbor z/y/x affinities. The finetuned network predicts affinity
60
+ logits; calibrated affinities are converted to instance labels with watershed
61
+ fragments and waterz agglomeration.
62
+
63
+ **Evaluation protocol.** The maintained validation protocol runs full-volume
64
+ sliding-window inference on public CREMI A/B/C labeled volumes, applies
65
+ CREMI-style boundary ignore (`xy=1`, `z=0`), and reports aggregate `voi_sum`
66
+ and `adapted_rand_error` over A/B/C.
67
+
68
+ ## Post-processing Scope
69
+
70
+ This repository is now closed around the dbMiM pretraining and UNETR affinity
71
+ segmentation line. waterz remains the reference post-processing backend for
72
+ headline VOI/ARAND results.
73
+
74
+ Learnable and differentiable post-processing is being developed as a separate
75
+ method line in:
76
+
77
+ **https://github.com/ydchen0806/nnEM-Seg-diff-postprocess**
78
+
79
+ Learned RAG, differentiable connected components, GPU watershed, and
80
+ GPU/MWS-style solvers are maintained there so this repository can stay focused
81
+ on the official dbMiM pretraining and affinity-segmentation implementation.
82
+
83
+ The current best controlled result is **R48**, which uses the publicEM dbMiM
84
+ pretrained encoder from the R16 line, seed-isolated finetuning (`seed=309`),
85
+ and a longer 20k-step MSE+MAWS finetune. On the full CREMI A/B/C validation
86
+ protocol it reaches `VOI=0.962154` and `ARAND=0.178252`, improving over both
87
+ the same-seed plain MAE control and the earlier 12k finetune.
88
+
89
+ The most useful full-data finding is that **fixed mixed edge/random masking on
90
+ full EM data (R33)** improves over scratch, old fullEM dbMiM, pure edge masking,
91
+ and fullEM plain MAE. It remains the best fullEM recipe, while R48 is the best
92
+ absolute checkpoint so far.
93
+
94
+ The recommended fullEM R33 line does **not** use a reinforcement-learning
95
+ masking policy. It uses fixed mixed edge/random masking. RL-style decision
96
+ modules are retained as ablations and are being stabilized in the R51/R52 line:
97
+ R51 was an unhealthy policy-collapse run, while R52 uses constrained adaptive
98
+ prior sampling. Its downstream R52/R53 finetunes finished successfully but were
99
+ negative, so the current main line stays with R48-style publicEM dbMiM
100
+ pretraining plus longer MSE+MAWS finetuning.
101
 
102
  ## Model Zoo
103
 
 
107
 
108
  | Model | HF path | Intended use |
109
  |---|---|---|
110
+ | PublicEM dbMiM R48 finetune | `weights/publicem_dbmim_r48_seed309_long20k/finetuned_latest.pt` | Best current segmentation checkpoint |
111
  | PublicEM dbMiM R17 pretrain | `weights/publicem_dbmim_r17/pretrained_latest.pt` | ViT/dbMiM encoder checkpoint for UNETR initialization |
112
+ | PublicEM dbMiM R17 finetune | `weights/publicem_dbmim_r17/finetuned_latest.pt` | Earlier publicEM segmentation checkpoint |
113
  | FullEM mixed-mask dbMiM R33 pretrain | `weights/fullem_mixedmask_dbmim_r33/pretrained_latest.pt` | Recommended full-data dbMiM pretraining checkpoint |
114
  | FullEM mixed-mask dbMiM R33 finetune | `weights/fullem_mixedmask_dbmim_r33/finetuned_latest.pt` | Recommended full-data segmentation checkpoint |
115
 
 
157
  - sweep calibration biases and waterz thresholds;
158
  - report aggregate A/B/C `voi_sum` and `adapted_rand_error`.
159
 
160
+ This validation setup is used to isolate whether dbMiM pretraining improves the
161
+ same anisotropic UNETR finetuning recipe over scratch and plain MAE controls.
 
162
 
163
  ## Results
164
 
 
171
 
172
  | Arm | VOI | ARAND at best VOI | Best ARAND | Conclusion |
173
  |---|---:|---:|---:|---|
174
+ | R48 publicEM dbMiM, seed309, 20k finetune | **0.962154** | **0.178252** | **0.178252** | Best current global result |
175
+ | R45 publicEM dbMiM, seed309, 12k finetune | 0.986481 | 0.186187 | 0.186187 | Strong same-seed dbMiM result |
176
+ | R17 publicEM random-mask dbMiM | 1.002919 | 0.188832 | 0.188832 | Earlier publicEM dbMiM result |
177
  | R23 publicEM random-mask plain MAE | 1.027073 | 0.192763 | 0.189247 | Matched MAE baseline |
178
+ | R47 publicEM plain MAE, seed309 | 1.043065 | 0.190743 | 0.190743 | Same-seed MAE control for R45/R48 |
179
  | R29 publicEM pure edge-mask dbMiM | 1.033564 | 0.186827 | **0.186827** | Best publicEM ARAND, worse VOI |
180
  | R32 publicEM fixed mixed-mask dbMiM | 1.046538 | 0.206256 | 0.193183 | Negative vs R17/R23 |
181
  | R34 publicEM adaptive mixed dbMiM | 1.067471 | 0.205437 | 0.200604 | Negative adaptive result |
 
184
 
185
  Key deltas:
186
 
187
+ - R48 dbMiM beats same-seed publicEM plain MAE R47 by `-0.0809` VOI and
188
+ `-0.0125` ARAND.
189
+ - Extending the seed309 R16 finetune from the R45 12k schedule to the R48 20k
190
+ schedule improves VOI by `-0.0243` and ARAND by `-0.0079`.
191
  - R17 dbMiM beats matched publicEM plain MAE R23 by `-0.0242` VOI and about
192
+ `-0.0004` best ARAND under the older comparison.
193
  - R29 edge-mask dbMiM beats same-mask plain MAE R30 by `-0.0440` VOI and
194
  `-0.0117` best ARAND, but its VOI is worse than R17/R23.
195
 
 
222
  fraction was `0.4456` for R34 and `0.3322` for R35. The current adaptive policy
223
  is therefore kept as a negative ablation rather than the recommended method.
224
 
225
+ The newer R51/R52 line changes the policy stabilization instead of simply
226
+ increasing reward strength. R51 still collapsed to an uninformative policy.
227
+ R52 constrains mask-ratio and edge-fraction bins, uses a small edge-proxy reward
228
+ with KL-to-prior regularization, clips and normalizes advantages, and freezes
229
+ the policy after warmup. Its pretraining diagnostics were healthier than R51,
230
+ but downstream finetuning was negative: R52 reached `VOI=1.056275`,
231
+ `ARAND=0.194687`; R53 with `membrane_weight=1.0` reached `VOI=1.080240`,
232
+ `ARAND=0.209107`. These are worse than R48 and are kept as negative ablations.
233
+
234
  ## Training Strategy
235
 
236
  ### Pretraining
 
278
  | Loss | MSE + MAWS, no BCE/Dice in the current winning recipe |
279
  | Label handling | synchronized image/label augmentation, 2D border widening radius 1 |
280
  | Batch size | 2 per GPU |
281
+ | Schedule | 12k optimizer steps for standard ablations; R48 uses 20k steps. lr `8e-5`, encoder lr `1e-5`, weight decay `0.01`, AMP |
282
  | Pretrained prefixes | `pos_embed`, `patch_embed`, `encoder_blocks`, `norm` |
283
 
284
  ### Evaluation