Compare commits

..

6 Commits

Author SHA1 Message Date
34e05476ba add hint for missing models 2025-11-21 07:17:31 +01:00
9f5ea4af5f bump to v0.1.5 2025-11-21 07:08:24 +01:00
507e94a73f add dep dotenv to please anomalib, closes #18 2025-11-21 07:04:42 +01:00
6e3192885b adapted anomaly threshold constant based on tests (#19)
ANOMALY_THRESHOLD changed

Co-authored-by: frasu <frasu@noreply.localhost>
Reviewed-on: #19
2025-11-21 05:58:46 +00:00
80ce3dd46d bump version to v0.1.4 2025-11-20 17:13:09 +01:00
8884ef69be fix result reproduction error on different computers (#17)
fixes #16

Co-authored-by: frasu <frasu@noreply.localhost>
Reviewed-on: #17
Co-authored-by: foefl <f.foerster@d-opt.com>
Co-committed-by: foefl <f.foerster@d-opt.com>
2025-11-20 16:04:26 +00:00
14 changed files with 1623 additions and 555 deletions

1
.gitattributes vendored Normal file
View File

@ -0,0 +1 @@
*.pth filter=lfs diff=lfs merge=lfs -text

1
.gitignore vendored
View File

@ -5,6 +5,7 @@ reports/
*.code-workspace
# credentials
CREDENTIALS*
*.pth
# Byte-compiled / optimized / DLL files
__pycache__/

1101
pdm.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -1,11 +1,11 @@
[project]
name = "dopt-sensor-anomalies"
version = "0.1.3"
version = "0.1.5"
description = "anomaly detection for sensor images for quality assurance processes"
authors = [
{name = "d-opt GmbH (resp.: Florian Foerster)", email = "f.foerster@d-opt.com"},
]
dependencies = ["imutils>=0.5.4", "dopt-basics>=0.2.4", "numpy>=2.2.6", "open-clip-torch>=3.2.0", "anomalib==2.0.0"]
dependencies = ["imutils>=0.5.4", "dopt-basics>=0.2.4", "numpy>=2.2.6", "open-clip-torch>=3.2.0", "anomalib==2.1.0", "dotenv>=0.9.9"]
requires-python = "<3.14,>=3.11"
readme = "README.md"
license = {text = "LicenseRef-Proprietary"}
@ -77,7 +77,7 @@ directory = "reports/coverage"
[tool.bumpversion]
current_version = "0.1.3"
current_version = "0.1.5"
parse = """(?x)
(?P<major>0|[1-9]\\d*)\\.
(?P<minor>0|[1-9]\\d*)\\.

View File

@ -6,9 +6,10 @@ STOP_FOLDER_NAME: Final[str] = "python"
MODEL_FOLDER_NAME: Final[str] = "models"
THRESHOLD_BW: Final[int] = 63
BACKBONE: Final[str] = "resnet18"
LAYERS: Final[tuple[str, str]] = ("layer1", "layer2")
RATIO: Final[float] = 0.05
BACKBONE: Final[str] = "wide_resnet50_2"
LAYERS: Final[tuple[str, ...]] = ("layer1", "layer2", "layer3")
RATIO: Final[float] = 0.01
ANOMALY_THRESHOLD: Final[float] = 0.14
NUM_VALID_ELECTRODES: Final[int] = 6
HEATMAP_FILENAME_SUFFIX: Final[str] = "_Heatmap"

File diff suppressed because one or more lines are too long

View File

@ -176,8 +176,7 @@ def infer_image(
output = model(input_tensor)
anomaly_score = output.pred_score.item()
print(f">>> Anomaly score: {anomaly_score}")
anomaly_label = bool(1 if anomaly_score >= 0.2 else 0)
anomaly_label = bool(1 if anomaly_score >= const.ANOMALY_THRESHOLD else 0)
anomaly_map = output.anomaly_map.squeeze().cpu().numpy()
img_np = np.array(pil_image)

3
tests/_models/README.md Normal file
View File

@ -0,0 +1,3 @@
**PLACE MODELS IN THIS FOLDER**
The model files are too large. Download the files from our internal distribution channel (primarily cloud).