fix(augment): align Kornia GaussianBlur/GaussNoise defaults with albumentations - #1395
Conversation
There was a problem hiding this comment.
Pull request overview
Aligns Kornia Gaussian augmentation defaults with Albumentations while preserving explicit configuration values.
Changes:
- Updates GaussianBlur and GaussNoise defaults.
- Adds regression tests against live Albumentations defaults.
- Updates GPU augmentation documentation.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/rfdetr/datasets/kornia_transforms.py |
Aligns Gaussian defaults. |
src/rfdetr/datasets/aug_configs.py |
Documents the new blur default. |
tests/datasets/test_kornia_transforms.py |
Tests default alignment and warning behavior. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
…mentations Two Kornia factory defaults did not match the Albumentations defaults they stand in for, so switching augmentation_backend silently changed augmentation strength for the same aug_config. GaussianBlur sigma defaulted to Kornia's own (0.1, 2.0) while the albumentations default is (0.5, 3.0); an unspecified sigma blurred less on the GPU path, and the call-site comment claimed the opposite. AUG_INDUSTRIAL reaches this default (it sets blur_limit but no sigma). GaussNoise std_range defaulted to rf-detr's own (0.01, 0.05) against the albumentations default (0.2, 0.44) on the same 0-1 image scale, 4-9x weaker. The default is now the albumentations one. Doc table updated; regression tests pin both defaults to the live albumentations values. Rebased onto current develop.
393f01c to
a3051e3
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #1395 +/- ##
=======================================
Coverage 86% 86%
=======================================
Files 112 112
Lines 14664 14669 +5
=======================================
+ Hits 12623 12628 +5
Misses 2041 2041 🚀 New features to boost your workflow:
|
Changes: - Read the installed Albumentations GaussianBlur default when available; retain the Kornia fallback only when the root package is absent and propagate nested import failures. - Correct GaussianBlur and GaussNoise backend-parity wording, and add branch-specific regression coverage. Impact: - Unspecified GPU GaussianBlur settings now match every importable supported Albumentations runtime default. - Broken optional-dependency installations fail visibly instead of silently selecting GPU-only behavior. Verification: - tests/datasets/test_kornia_transforms.py: 113 passed. - pre-commit run --all-files: passed; git diff --check: passed. Residual limits: - No full Albumentations version matrix was run. --- Co-authored-by: Codex <codex@openai.com>
|
Thanks for picking this up and polishing it @Borda, the reworded GaussNoise note is exactly right: bounds aligned, but Kornia's fixed std is not the CPU path's sampled range, so "same default, not same distribution" is the precise claim. Happy to take anything else you'd like on it, otherwise I'll leave it in your hands. |
Changes: - Route GaussianBlur default selection through AugmentationBackend.ALBU._is_available(). - Replace import-machinery test doubles with backend-availability test doubles. Impact: - Optional augmentation package availability now follows the shared backend contract. - Tests exercise the same availability seam used by backend selection. Verification: - tests/datasets/test_kornia_transforms.py: 112 passed. - pre-commit run --all-files: passed; git diff --check: passed. Residual limits: - No full Albumentations version matrix was run. --- Co-authored-by: Codex <codex@openai.com>
What
Aligns two Kornia augmentation-factory defaults with the Albumentations defaults they stand in for. Closes #1351.
Why
For the same
aug_config, switchingaugmentation_backendsilently changed augmentation strength, because two Kornia defaults did not match Albumentations':GaussianBlur sigma.
AUG_INDUSTRIALsets{"GaussianBlur": {"blur_limit": 3, "p": 0.3}}with nosigma, so both backends fall back to their own default:The call-site comment claimed it "Match[es] the CPU albumentations default", which was the opposite of what it did.
GaussNoise std_range. Defaulted to rf-detr's own
(0.01, 0.05)against the Albumentations default(0.2, 0.44)on the same 0-1 image scale, 4-9x weaker. The divergence warning also reported rf-detr's own[0.01, 0.05]as if it were Albumentations', hiding the gap.Verified against the pinned
albumentations==2.0.8:Changes
_make_gaussian_blurdefault sigma(0.1, 2.0)->(0.5, 3.0), comment corrected._make_gauss_noisedefault std_range(0.01, 0.05)->(0.2, 0.44). An explicit range still wins, and the warning text is unchanged since it is still correct for a non-degenerate explicit range.aug_configs.pyupdated.This changes only the default used when a config omits the value; any config that sets
sigma/std_rangeexplicitly is unaffected. It follows the same "align to Albumentations" direction accepted for the sibling scalar-clip_limitfix (#1350).Testing
Three regression tests pin both defaults to the live Albumentations values. The two that assert the defaults fail on
developand pass here:Full augmentation suite:
55 passed.ruff checkandruff format --checkclean.