Add automatic confidence-threshold calibration to both training pipelines - #61
Open
nilshof01 wants to merge 1 commit into
Open
Add automatic confidence-threshold calibration to both training pipelines#61nilshof01 wants to merge 1 commit into
nilshof01 wants to merge 1 commit into
Conversation
…ines The optimal mask threshold is not a constant: measured across 3 regions x 2 models x 5 folds (size 32) it ranged 0.10-0.90, and the shipped operating points (UNet fixed 0.5, DINOv3 catalog 0.4371) cost +1.1 to +13.9 test F1 vs a deterministic 17-point val-split sweep, which landed within 0.7 F1 of the test-oracle in every measured cell. unet_segmentation: - new calibrate_threshold step: val-split F1 sweep, rate-matching on the train sampler when val has no positive pixels (threshold at which the predicted positive-pixel fraction matches the labeled fraction) - predict() now thresholds the most likely foreground class directly; the previous argmax+top-prob rule made binary thresholds below 0.5 no-ops (identical output at the 0.5 default) dinov3s_buildings: - new calibrate_threshold step (same sweep on the spatial val chips via cache_val_forwards; rate-matching on train chips when val < 2 chips) - tune_postprocess defaults are seeded with the calibrated threshold, so the skipped-search path (val < 8 chips or trials disabled - i.e. every small-dataset run) serves the calibrated value instead of the catalog constant. When Optuna runs it still tunes the threshold jointly in [0.3, 0.8]; fixing it there would require a dinov3_hot change. Both STAC items declare training.calibrate_threshold (default true). Co-Authored-By: Claude Fable 5 <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.
…ines
The optimal mask threshold is not a constant: measured across 3 regions x 2 models x 5 folds (size 32) it ranged 0.10-0.90, and the shipped operating points (UNet fixed 0.5, DINOv3 catalog 0.4371) cost +1.1 to +13.9 test F1 vs a deterministic 17-point val-split sweep, which landed within 0.7 F1 of the test-oracle in every measured cell.
unet_segmentation:
dinov3s_buildings:
Both STAC items declare training.calibrate_threshold (default true).