Repository navigation
Make the paper's inference and training settings the defaults - #3
Merged
Merged
Conversation
predict: 30% window overlap and constant (uniform) blending instead of 50% and Gaussian; a voxel is foreground at probability >= threshold so the mask equals the saved probability map thresholded at 128. train/finetune: batch size 32, up to 1000 epochs, 20% validation hold-out; fine-tuning uses lr 5e-5 and patience 50, from scratch keeps 1e-4 and 100. All values are from the paper's Methods and the cyto-dl configs used for its experiments. Docs, changelog and README benchmark numbers updated; a test pins the defaults. Assisted-by: claude-code (claude-fable-5-1) Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
subcellseg predict: default window overlap 0.5 -> 0.3 and blendinggaussian->constant. A voxel is foreground when its probability is at least the threshold (was: strictly above), so_seg.tifis exactly_prob.tif >= 128.subcellseg train/finetune: default batch size 8 -> 32, max epochs 700 -> 1000, validation hold-out 10% -> 20%. Fine-tuning now uses learning rate 5e-5 and early-stopping patience 50; training from scratch keeps 1e-4 and 100.SEGMENT.md,TRAINING.md), changelog and the README benchmark table updated. The two RELEASE TODOs that asked to confirm these settings are marked done rather than removed.test_defaults_match_paperpins the defaults.Why
The package is meant to reproduce the paper. The previous defaults were deliberate deviations (documented in SEGMENT.md) that changed the masks slightly. Sources for the values: the manuscript's Methods (Hyperparameters, Fine-tuning protocol, Probability map thresholding) and the cyto-dl model configs in MegaSeg (
inference_args: overlap 0.3, nomodekey, so MONAI's default constant blending; checked in the cyto-dl checkout that trained the released model, in commit fe8fa7ac, and in current main).Kept as is, on purpose: validation uses the same fixed patches every epoch, whereas cyto-dl cut a fresh random patch; the paper does not specify this and fixed patches make the validation curve readable. Say the word if you want it changed too.
How it was tested
pyteston Linux with an A100: 11 passed.ruff checkandruff format --checkclean.tools/benchmark/bench_predict.sh cudaon the three variance images, Dice againstSEG_STRUCT:Peak GPU memory unchanged (2.0 to 2.5 GB). Image 40 now runs 140 windows instead of 252.
Checklist
pytest)CHANGELOG.mdhas an entry under Unreleased (if a user would notice)🤖 Generated with Claude Code