Skip to content

Consolidate inference helpers and document repository file roles - #5

Closed
yxteo2 wants to merge 1 commit into
mainfrom
chore/file-audit
Closed

yxteo2 wants to merge 1 commit into
mainfrom
chore/file-audit

Conversation

@yxteo2

@yxteo2 yxteo2 commented Sep 10, 2026 •

Copy link
Copy Markdown
Owner

The file audit found that both inference scripts maintained the same metrics, calibration loading and MVTec file helpers. Keeping two copies makes future fixes easy to miss.

This cleanup:

  • Moves the 11 identical helper definitions into anomaly_detection/inference_utils.py and imports them from both scripts. Existing inference commands and helper imports continue to work.
  • Documents every file's role in the README, including the three YAML examples, package entry points, tests and development settings.
  • Replaces trainer headers that still named files removed by the earlier package reorganization.
  • Adds checks for AUPRO ranking/ties/region weighting, calibration lookup and MVTec image/mask handling, and extends the real YAML training tests through both inference evaluators.

All 31 existing tracked files have a role; no orphaned Python modules or tracked generated artifacts were found. The separate detector implementations and YAML loss examples are retained. One shared module is added, with 174 fewer lines overall after documentation and test additions.

Validation:

  • 77 tests passed locally on CPU with Python 3.12, including FastFlow NLL, SSN focal and SSN BCE training/checkpoint/inference runs.
  • Compile checks, pyflakes and whitespace checks passed.
  • Compared parsed executable syntax with main: all moved helpers and both scripts' remaining engines, evaluators and CLI functions are unchanged.
  • Uploaded Git tree exactly matches the locally verified tree.

The three local test warnings are PyTorch reporting that pinned memory is unavailable without an accelerator.

Superseded by #7, which incorporates this cleanup alongside the newer DINO and shared-preprocessing changes. Updated consolidation passed 187 CPU tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant