Feature/select-last-checkpoint-segmentation#157
Merged
Conversation
…port instead of best checkpoint
There was a problem hiding this comment.
Pull request overview
This PR adds checkpoint selection for segmentation exports/evaluation, patches MiT segmentation encoder TorchScript export behavior, and updates anomaly artifact uploads with supporting tests and documentation.
Changes:
- Added
task.checkpoint_selectionfor segmentation tasks. - Patched SMP MiT encoder registration to use a Quadra-specific TorchScript-safe encoder.
- Added/updated tests, docs, changelog, and version metadata.
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
quadra/tasks/segmentation.py |
Adds checkpoint selection for test/export. |
quadra/configs/task/segmentation.yaml |
Exposes default checkpoint selection config. |
quadra/utils/segmentation.py |
Adds patched MiT encoder and registry patch helper. |
quadra/main.py |
Applies the encoder patch during startup. |
quadra/tasks/anomaly.py |
Uploads cumulative histogram artifacts. |
quadra/tasks/classification.py |
Adds type-ignore for GradCAM indexing. |
quadra/utils/tests/fixtures/models/segmentation.py |
Adds patched mit_b0 segmentation fixture. |
tests/utilities/test_segmentation_utils.py |
Tests MiT encoder patch behavior. |
tests/tasks/test_segmentation.py |
Tests checkpoint selection and MiT export/inference. |
tests/tasks/test_anomaly.py |
Adds input shape override for CS-Flow test. |
tests/models/test_export.py |
Adds MiT TorchScript export regression tests. |
docs/tutorials/export.md |
Documents segmentation checkpoint selection for export. |
docs/tutorials/examples/segmentation.md |
Documents segmentation checkpoint selection in tutorial config. |
CHANGELOG.md |
Adds 2.9.0 release notes. |
quadra/__init__.py |
Bumps package version. |
pyproject.toml |
Bumps Poetry package version. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
nicolapesaresi
approved these changes
May 15, 2026
Mat-Po
approved these changes
May 20, 2026
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.
Summary
Describe the purpose of the pull request, including:
Added
checkpoint_selectionparameter intask/segmentationconfig (values:best,last; default:best). Controls which checkpoint is loaded for test evaluation and model export in Segmentation task.Fixed
MixVisionTransformerEncoderTorchScript export on GPU: replaced hard-codedtorch.empty(...)dummy tensor withx.new_empty(...)so the device and dtype are no longer baked as constants into the TorchScript graph. Without this patch, exporting and running MiT-based segmentation models (e.g.mit_b0) on GPU raised aRuntimeError. The fix is applied automatically at the start ofmain()viapatch_mix_transformer_encoder()and will be removed once upstreamsegmentation_models_pytorchships the correction.cumulative_histogram.pngis now uploaded as an MLflow (and TensorBoard) artifact in anomaly tasks alongsidetest_confusion_matrix.pngandavg_score_by_label.csv.Type of Change
Please select the one relevant option below:
Checklist
Please confirm that the following tasks have been completed: