Skip to content

uiol;' - #154

Merged
DeepKnowledge1 merged 2 commits into
feat/tensorrt-int8-light-patchcorefrom
main
Aug 17, 2026
Merged

uiol;'#154
DeepKnowledge1 merged 2 commits into
feat/tensorrt-int8-light-patchcorefrom
main

Conversation

@DeepKnowledge1

Copy link
Copy Markdown
Owner

🔗 Related Issue

Fixes #

📝 Description

🔄 Type of Change

  • 🐛 Bug fix (non-breaking change which fixes an issue)
  • 🚀 New feature (non-breaking change which adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 📖 Documentation update
  • 🏗️ Infrastructure / CI/CD update

🧪 Hardware & Matrix Testing

I have successfully built and tested this code using uv on:

  • anomavision[cpu] (Standard/Edge)
  • anomavision[cu121] (CUDA 12.1)
  • anomavision[cu124] (CUDA 12.4)
  • anomavision[cu118] (CUDA 11.8)

Host OS used for testing:

  • Linux / Ubuntu
  • Windows (Native or WSL2)
  • macOS

✅ Developer Checklist

  • My code follows the core style guidelines of this project (Ruff/Black formatting).
  • I have run uv run pytest and all unit tests pass locally.
  • Lockfile Guard: If I added or modified a dependency in pyproject.toml, I have run uv lock --python 3.10 and committed the updated uv.lock file.
  • I have added tests that prove my fix is effective or that my feature works.
  • I have updated the documentation accordingly (if applicable).

📸 Screenshots / Visual Proof (Optional)

## 🔗 Related Issue
Fixes #

## 📝 Description
-
-
-

## 🔄 Type of Change
- [ ] 🐛 Bug fix (non-breaking change which fixes an issue)
- [x] 🚀 New feature (non-breaking change which adds functionality)
- [ ] 💥 Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- [ ] 📖 Documentation update
- [ ] 🏗️ Infrastructure / CI/CD update

## 🧪 Hardware & Matrix Testing
**I have successfully built and tested this code using `uv` on:**
- [x] `anomavision[cpu]` (Standard/Edge)
- [ ] `anomavision[cu121]` (CUDA 12.1)
- [ ] `anomavision[cu124]` (CUDA 12.4)
- [ ] `anomavision[cu118]` (CUDA 11.8)

**Host OS used for testing:**
- [ ] Linux / Ubuntu
- [ ] Windows (Native or WSL2)
- [ ] macOS

## ✅ Developer Checklist
- [x] My code follows the core style guidelines of this project
(Ruff/Black formatting).
- [x] I have run `uv run pytest` and all unit tests pass locally.
- [x] **Lockfile Guard:** If I added or modified a dependency in
`pyproject.toml`, I have run `uv lock --python 3.10` and committed the
updated `uv.lock` file.
- [x] I have added tests that prove my fix is effective or that my
feature works.
- [x] I have updated the documentation accordingly (if applicable).

## 📸 Screenshots / Visual Proof (Optional)
## 🔗 Related Issue
Fixes #

## 📝 Description
-
-
-

## 🔄 Type of Change
- [ ] 🐛 Bug fix (non-breaking change which fixes an issue)
- [ ] 🚀 New feature (non-breaking change which adds functionality)
- [ ] 💥 Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- [ ] 📖 Documentation update
- [ ] 🏗️ Infrastructure / CI/CD update

## 🧪 Hardware & Matrix Testing
**I have successfully built and tested this code using `uv` on:**
- [ ] `anomavision[cpu]` (Standard/Edge)
- [ ] `anomavision[cu121]` (CUDA 12.1)
- [ ] `anomavision[cu124]` (CUDA 12.4)
- [ ] `anomavision[cu118]` (CUDA 11.8)

**Host OS used for testing:**
- [ ] Linux / Ubuntu
- [ ] Windows (Native or WSL2)
- [ ] macOS

## ✅ Developer Checklist
- [ ] My code follows the core style guidelines of this project
(Ruff/Black formatting).
- [ ] I have run `uv run pytest` and all unit tests pass locally.
- [ ] **Lockfile Guard:** If I added or modified a dependency in
`pyproject.toml`, I have run `uv lock --python 3.10` and committed the
updated `uv.lock` file.
- [ ] I have added tests that prove my fix is effective or that my
feature works.
- [ ] I have updated the documentation accordingly (if applicable).

## 📸 Screenshots / Visual Proof (Optional)
@DeepKnowledge1
DeepKnowledge1 merged commit d78db38 into feat/tensorrt-int8-light-patchcore Aug 17, 2026
9 checks passed
DeepKnowledge1 added a commit that referenced this pull request Aug 17, 2026
## Pull Request: Production-ready TensorRT/INT8 export, ultra-light
PatchCore, and Production Autopilot

### Summary

This pull request merges `feat/tensorrt-int8-light-patchcore` into
`main`. It adds production-oriented anomaly-detection capabilities,
improves deployment workflows, strengthens benchmarking, and makes the
project easier for new users to evaluate.

### What changed

#### Native TensorRT and INT8 export

- Added native TensorRT engine export with FP16 and FP32 support.
- Added calibrated INT8 TensorRT export using real normal calibration
images.
- Added dynamic batch profiles and configurable TensorRT workspace
limits.
- Added calibration-cache support and engine validation.
- Added automatic conversion support for compact PaDiM and PatchCore
deployment artifacts.
- Updated the configuration template and deployment documentation with
the new export parameters.

#### Ultra-light PatchCore

- Added a production-oriented PatchCore implementation designed for
bounded memory and predictable inference.
- Added deterministic k-center coreset selection.
- Added configurable memory-bank limits, pooled patch grids, and chunked
nearest-neighbor search.
- Added support for CLI training, validation, testing, inference,
export, and configuration workflows consistent with PaDiM.
- Restored PatchCore localization output and corrected threshold and
boundary-color behavior.

#### Production Autopilot

- Added a hardware-aware CLI workflow that compares PaDiM and
ultra-light PatchCore.
- Added algorithm-specific threshold calibration using the complete
labeled test split by default.
- Added image-level and pixel-level AUROC reporting when valid targets
are available.
- Added localization-health diagnostics, including anomaly coverage and
normal-image false-positive localization.
- Added median and P95 latency profiling.
- Added model selection based on accuracy, latency, and production
constraints.
- Added a self-contained HTML deployment dashboard, deployment manifest,
localization report, and selected model package.

Example:

```bash
anomavision autopilot \
  --config config.yml \
  --padim_model ./distributions/padim/bottle/anomav_exp/model.pt \
  --patchcore_model ./distributions/patchcore/bottle/anomav_exp/model.pt \
  --device cpu \
  --validation_split 1.0 \
  --target_latency_ms 50 \
  --output_dir ./production_package
```

#### Documentation and adoption improvements

- Added a five-minute CPU quickstart that does not require CUDA.
- Added copy-ready examples for CPU PaDiM, ultra-light PatchCore, and
TensorRT INT8 export.
- Improved README navigation, visual explanations, Autopilot guidance,
and CI visibility.
- Added reproducible benchmark instructions and P95 latency reporting.
- Updated the public repository description and GitHub topic tags for
improved discoverability.
- Added direct links to the live demo, quickstart, examples, and
benchmark methodology.

#### Release preparation

- Bumped the package version from `3.4.0` to `3.5.0`.
- Updated `uv.lock` to match the new package version.
- The existing release workflow is configured to build the package,
publish it to PyPI through trusted publishing, and attach artifacts to
the GitHub release.

### Validation

The complete repository validation suite passes:

```text
black       Passed
isort       Passed
flake8      Passed
pytest      Passed
```

The final branch is clean and synchronized with the remote feature
branch.

### Compatibility and deployment notes

- CPU installation and inference remain supported.
- CUDA and TensorRT export require the corresponding NVIDIA software
stack.
- INT8 export requires real, representative normal calibration images.
- TensorRT engines should be validated on the target GPU and TensorRT
runtime.
- PaDiM and PatchCore use different score scales; their thresholds must
be calibrated separately.
- Existing users should review the updated configuration template before
upgrading.

### Recommended merge and release sequence

1. Review and merge this pull request into `main`.
2. Confirm the package version is `3.5.0` on `main`.
3. Create and publish a GitHub release tagged `v3.5.0`.
4. Allow the release workflow to build and publish the package to PyPI
and attach the artifacts.

### Checklist

- [x] Native TensorRT FP16/FP32 export added.
- [x] Calibrated TensorRT INT8 export added.
- [x] Ultra-light PatchCore added and documented.
- [x] Production Autopilot added.
- [x] Threshold and localization behavior corrected.
- [x] README and deployment documentation updated.
- [x] CPU quickstart and runnable examples added.
- [x] P95 benchmark reporting added.
- [x] Package version updated to `3.5.0`.
- [x] Full pre-commit validation passed.
- [ ] Merge into `main`.
- [ ] Create GitHub release `v3.5.0`.
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