Repository navigation
Conversation
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.
Problem
Legacy FastFlow/SSN inference used floor division for center-crop mask/overlay offsets, while torchvision rounds crop anchors (including round-to-even ties). For example, resizing to 37×55 before a 32×48 crop requires offsets (2,4), not (2,3). This could shift masks and overlays by one pixel.
Changes
Verification
180 CPU regression tests passed; the focused 27-test preprocessing suite was rerun after adding actual legacy/shared prediction comparisons and passed. Tests cover all five DINO-backed models, crop scales 0.875 and 1.0, incorrect fallback metadata, odd margins, rectangular/416/512/704 geometry, masks and source-size valid regions. Compileall, pyflakes and diff checks passed. No physical CUDA GPU was available; this does not certify GPU performance or accuracy.
Main remains unchanged pending merge.
Repository cleanup (supersedes #5)
Consolidates 11 duplicated metrics/calibration/file helpers into anomaly_detection/inference_utils.py, removing approximately 650 copied lines from the legacy scripts while preserving their import names and commands. All five detector classes are exposed through the modeling package; builder registries and trainer headers are clarified. Adds docs/repository_layout.md documenting necessary files, entry points and generated-file conventions. No tracked datasets, model weights, checkpoints or output artifacts were found to remove.
Updated verification: 187 CPU tests passed, including analytic AUPRO cases, calibration lookup and real YAML checkpoint inference metrics; compileall, pyflakes and diff checks passed. The earlier cleanup PR #5 is superseded by this compatible consolidation.