sinapsis-anomalib 0.1.4__py3-none-any.whl → 0.1.6__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of sinapsis-anomalib might be problematic. Click here for more details.
- sinapsis_anomalib/helpers/tags.py +16 -0
- sinapsis_anomalib/templates/anomalib_base.py +12 -1
- sinapsis_anomalib/templates/anomalib_base_inference.py +7 -1
- sinapsis_anomalib/templates/anomalib_export.py +6 -1
- sinapsis_anomalib/templates/anomalib_openvino_inference.py +5 -0
- sinapsis_anomalib/templates/anomalib_torch_inference.py +5 -0
- sinapsis_anomalib/templates/anomalib_train.py +5 -0
- {sinapsis_anomalib-0.1.4.dist-info → sinapsis_anomalib-0.1.6.dist-info}/METADATA +1 -1
- sinapsis_anomalib-0.1.6.dist-info/RECORD +16 -0
- {sinapsis_anomalib-0.1.4.dist-info → sinapsis_anomalib-0.1.6.dist-info}/WHEEL +1 -1
- sinapsis_anomalib-0.1.4.dist-info/RECORD +0 -15
- {sinapsis_anomalib-0.1.4.dist-info → sinapsis_anomalib-0.1.6.dist-info}/licenses/LICENSE +0 -0
- {sinapsis_anomalib-0.1.4.dist-info → sinapsis_anomalib-0.1.6.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
from enum import Enum
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class Tags(Enum):
|
|
6
|
+
"""Tags."""
|
|
7
|
+
|
|
8
|
+
ANOMALIB = "anomalib"
|
|
9
|
+
ANOMALY_DETECTION = "anomaly_detection"
|
|
10
|
+
DYNAMIC = "dynamic"
|
|
11
|
+
EXPORT = "export"
|
|
12
|
+
INFERENCE = "inference"
|
|
13
|
+
MODELS = "models"
|
|
14
|
+
OPENVINO = "openvino"
|
|
15
|
+
PYTORCH = "pytorch"
|
|
16
|
+
TRAINING = "training"
|
|
@@ -4,6 +4,7 @@ from collections.abc import Iterable, Sequence
|
|
|
4
4
|
from pathlib import Path
|
|
5
5
|
from typing import Any, Protocol, TypeAlias
|
|
6
6
|
|
|
7
|
+
import torch
|
|
7
8
|
from anomalib import models as anomalib_models
|
|
8
9
|
from anomalib.data import Folder
|
|
9
10
|
from anomalib.engine import Engine
|
|
@@ -22,6 +23,7 @@ from sinapsis_core.template_base.base_models import (
|
|
|
22
23
|
from sinapsis_core.template_base.dynamic_template import BaseDynamicWrapperTemplate, WrapperEntryConfig
|
|
23
24
|
|
|
24
25
|
from sinapsis_anomalib.helpers.config_factory import CallbackFactory, LoggerFactory
|
|
26
|
+
from sinapsis_anomalib.helpers.tags import Tags
|
|
25
27
|
|
|
26
28
|
EXCLUDED_MODELS = [
|
|
27
29
|
"EfficientAd",
|
|
@@ -154,7 +156,11 @@ class AnomalibBase(BaseDynamicWrapperTemplate):
|
|
|
154
156
|
|
|
155
157
|
SUFFIX: str = "Wrapper"
|
|
156
158
|
AttributesBaseModel = AnomalibBaseAttributes
|
|
157
|
-
UIProperties = UIPropertiesMetadata(
|
|
159
|
+
UIProperties = UIPropertiesMetadata(
|
|
160
|
+
category="Anomalib",
|
|
161
|
+
output_type=OutputTypes.IMAGE,
|
|
162
|
+
tags=[Tags.ANOMALIB, Tags.ANOMALY_DETECTION, Tags.DYNAMIC, Tags.MODELS],
|
|
163
|
+
)
|
|
158
164
|
WrapperEntry = DynamicWrapperEntry()
|
|
159
165
|
|
|
160
166
|
def __init__(self, attributes: TemplateAttributeType) -> None:
|
|
@@ -215,3 +221,8 @@ class AnomalibBase(BaseDynamicWrapperTemplate):
|
|
|
215
221
|
Returns:
|
|
216
222
|
DataContainer: Processed data container
|
|
217
223
|
"""
|
|
224
|
+
|
|
225
|
+
def reset_state(self, template_name: str | None = None) -> None:
|
|
226
|
+
if torch.cuda.is_available():
|
|
227
|
+
torch.cuda.empty_cache()
|
|
228
|
+
super().reset_state(template_name)
|
|
@@ -23,6 +23,8 @@ from sinapsis_core.template_base.base_models import (
|
|
|
23
23
|
UIPropertiesMetadata,
|
|
24
24
|
)
|
|
25
25
|
|
|
26
|
+
from sinapsis_anomalib.helpers.tags import Tags
|
|
27
|
+
|
|
26
28
|
|
|
27
29
|
@dataclass(frozen=True)
|
|
28
30
|
class AnomalibInferenceKeys:
|
|
@@ -63,7 +65,11 @@ class AnomalibBaseInference(Template):
|
|
|
63
65
|
"""
|
|
64
66
|
|
|
65
67
|
AttributesBaseModel = AnomalibInferenceAttributes
|
|
66
|
-
|
|
68
|
+
UIProperties = UIPropertiesMetadata(
|
|
69
|
+
category="Anomalib",
|
|
70
|
+
output_type=OutputTypes.IMAGE,
|
|
71
|
+
tags=[Tags.ANOMALIB, Tags.ANOMALY_DETECTION, Tags.INFERENCE, Tags.MODELS],
|
|
72
|
+
)
|
|
67
73
|
|
|
68
74
|
def __init__(self, attributes: TemplateAttributeType) -> None:
|
|
69
75
|
super().__init__(attributes)
|
|
@@ -11,12 +11,16 @@ from sinapsis_core.template_base.dynamic_template_factory import make_dynamic_te
|
|
|
11
11
|
from sinapsis_core.utils.env_var_keys import SINAPSIS_BUILD_DOCS
|
|
12
12
|
from torchmetrics import Metric
|
|
13
13
|
|
|
14
|
+
from sinapsis_anomalib.helpers.tags import Tags
|
|
14
15
|
from sinapsis_anomalib.templates.anomalib_base import (
|
|
15
16
|
AnomalibBase,
|
|
16
17
|
AnomalibBaseAttributes,
|
|
17
18
|
)
|
|
18
19
|
from sinapsis_anomalib.templates.anomalib_train import AnomalibTrainDataClass
|
|
19
20
|
|
|
21
|
+
AnomalibExportUIProperties = AnomalibBase.UIProperties
|
|
22
|
+
AnomalibExportUIProperties.tags.extend([Tags.EXPORT])
|
|
23
|
+
|
|
20
24
|
|
|
21
25
|
@dataclass(frozen=True, slots=True)
|
|
22
26
|
class AnomalibExportDataClass:
|
|
@@ -110,6 +114,7 @@ class AnomalibExport(AnomalibBase):
|
|
|
110
114
|
|
|
111
115
|
AttributesBaseModel = AnomalibExportAttributes
|
|
112
116
|
SUFFIX = "Export"
|
|
117
|
+
UIProperties = AnomalibExportUIProperties
|
|
113
118
|
|
|
114
119
|
def __init__(self, attributes: TemplateAttributeType) -> None:
|
|
115
120
|
super().__init__(attributes)
|
|
@@ -169,7 +174,7 @@ class AnomalibExport(AnomalibBase):
|
|
|
169
174
|
ckpt_path=ckpt_path,
|
|
170
175
|
)
|
|
171
176
|
|
|
172
|
-
return AnomalibExportDataClass(exported_model_path=exported_path)
|
|
177
|
+
return AnomalibExportDataClass(exported_model_path=str(exported_path))
|
|
173
178
|
|
|
174
179
|
def execute(self, container: DataContainer) -> DataContainer:
|
|
175
180
|
"""Performs model export and stores results.
|
|
@@ -7,11 +7,15 @@ import numpy as np
|
|
|
7
7
|
import torchvision.transforms.v2 as T
|
|
8
8
|
from anomalib.deploy import OpenVINOInferencer
|
|
9
9
|
|
|
10
|
+
from sinapsis_anomalib.helpers.tags import Tags
|
|
10
11
|
from sinapsis_anomalib.templates.anomalib_base_inference import (
|
|
11
12
|
AnomalibBaseInference,
|
|
12
13
|
AnomalibInferenceAttributes,
|
|
13
14
|
)
|
|
14
15
|
|
|
16
|
+
AnomalibOpenVINOInferenceUIProperties = AnomalibBaseInference.UIProperties
|
|
17
|
+
AnomalibOpenVINOInferenceUIProperties.tags.extend([Tags.OPENVINO])
|
|
18
|
+
|
|
15
19
|
|
|
16
20
|
class AnomalibOpenVINOInferenceAttributes(AnomalibInferenceAttributes):
|
|
17
21
|
"""OpenVINO-specific inference attribute configuration.
|
|
@@ -53,6 +57,7 @@ class AnomalibOpenVINOInference(AnomalibBaseInference):
|
|
|
53
57
|
"""
|
|
54
58
|
|
|
55
59
|
AttributesBaseModel = AnomalibOpenVINOInferenceAttributes
|
|
60
|
+
UIProperties = AnomalibOpenVINOInferenceUIProperties
|
|
56
61
|
|
|
57
62
|
def get_inferencer(self) -> OpenVINOInferencer:
|
|
58
63
|
"""Initialize OpenVINO inferencer with model and metadata.
|
|
@@ -7,11 +7,15 @@ import torch
|
|
|
7
7
|
import torchvision.transforms.v2 as T
|
|
8
8
|
from anomalib.deploy import TorchInferencer
|
|
9
9
|
|
|
10
|
+
from sinapsis_anomalib.helpers.tags import Tags
|
|
10
11
|
from sinapsis_anomalib.templates.anomalib_base_inference import (
|
|
11
12
|
AnomalibBaseInference,
|
|
12
13
|
AnomalibInferenceAttributes,
|
|
13
14
|
)
|
|
14
15
|
|
|
16
|
+
AnomalibTorchInferenceUIProperties = AnomalibBaseInference.UIProperties
|
|
17
|
+
AnomalibTorchInferenceUIProperties.tags.extend([Tags.PYTORCH])
|
|
18
|
+
|
|
15
19
|
|
|
16
20
|
class AnomalibTorchInferenceAttributes(AnomalibInferenceAttributes):
|
|
17
21
|
"""PyTorch-specific inference attribute configuration.
|
|
@@ -46,6 +50,7 @@ class AnomalibTorchInference(AnomalibBaseInference):
|
|
|
46
50
|
"""
|
|
47
51
|
|
|
48
52
|
AttributesBaseModel = AnomalibTorchInferenceAttributes
|
|
53
|
+
UIProperties = AnomalibTorchInferenceUIProperties
|
|
49
54
|
|
|
50
55
|
def get_inferencer(self) -> TorchInferencer:
|
|
51
56
|
"""Get PyTorch Inferencer instance.
|
|
@@ -11,11 +11,15 @@ from sinapsis_core.template_base.base_models import TemplateAttributeType
|
|
|
11
11
|
from sinapsis_core.template_base.dynamic_template_factory import make_dynamic_template
|
|
12
12
|
from sinapsis_core.utils.env_var_keys import SINAPSIS_BUILD_DOCS
|
|
13
13
|
|
|
14
|
+
from sinapsis_anomalib.helpers.tags import Tags
|
|
14
15
|
from sinapsis_anomalib.templates.anomalib_base import (
|
|
15
16
|
AnomalibBase,
|
|
16
17
|
AnomalibBaseAttributes,
|
|
17
18
|
)
|
|
18
19
|
|
|
20
|
+
AnomalibTrainUIProperties = AnomalibBase.UIProperties
|
|
21
|
+
AnomalibTrainUIProperties.tags.extend([Tags.TRAINING])
|
|
22
|
+
|
|
19
23
|
|
|
20
24
|
@dataclass(frozen=True)
|
|
21
25
|
class AnomalibTrainKeys:
|
|
@@ -116,6 +120,7 @@ class AnomalibTrain(AnomalibBase):
|
|
|
116
120
|
|
|
117
121
|
SUFFIX = "Train"
|
|
118
122
|
AttributesBaseModel = AnomalibTrainAttributes
|
|
123
|
+
UIProperties = AnomalibTrainUIProperties
|
|
119
124
|
|
|
120
125
|
def __init__(self, attributes: TemplateAttributeType) -> None:
|
|
121
126
|
super().__init__(attributes)
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
sinapsis_anomalib/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
sinapsis_anomalib/helpers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
|
+
sinapsis_anomalib/helpers/config_factory.py,sha256=M7CPS2qHgUWBUTYkuVGhaa2S6IJZ8C3zGPulVjgXr_U,4493
|
|
4
|
+
sinapsis_anomalib/helpers/tags.py,sha256=Oj8vSh8AbnOfDY4UadOOteQOhjKwXSB3Rv82hpeP2YE,325
|
|
5
|
+
sinapsis_anomalib/templates/__init__.py,sha256=ltv45AB2oIhPw0jRrL0S6HMYYQp63Cr-DBjD0HjK1i0,904
|
|
6
|
+
sinapsis_anomalib/templates/anomalib_base.py,sha256=zqK6NovNf37-k9ubVHK11YYWlUmZUAsZBBLItJ_Xtoc,8265
|
|
7
|
+
sinapsis_anomalib/templates/anomalib_base_inference.py,sha256=YxYpiRK8CwzLjYJpSnNZkUq6OE9zSAbYnqNStPV9RBI,8996
|
|
8
|
+
sinapsis_anomalib/templates/anomalib_export.py,sha256=702uNSGmjtYD3I96xlEZxFEOVG84TbM1sC7Gp-tK1vs,7478
|
|
9
|
+
sinapsis_anomalib/templates/anomalib_openvino_inference.py,sha256=FPr2iwC3JbasJnlOgdWzO5ugbQj3Kan3xp-oxJGkC1Q,3207
|
|
10
|
+
sinapsis_anomalib/templates/anomalib_torch_inference.py,sha256=Q6aqspIjFpI7WY90jcnqNmqalhYIm_Um2As9Sx1AOeU,2862
|
|
11
|
+
sinapsis_anomalib/templates/anomalib_train.py,sha256=x2PUQCHlYooG3XxYs2HZ4akxLRywqrR60M6L_f6y4HI,7752
|
|
12
|
+
sinapsis_anomalib-0.1.6.dist-info/licenses/LICENSE,sha256=hIahDEOTzuHCU5J2nd07LWwkLW7Hko4UFO__ffsvB-8,34523
|
|
13
|
+
sinapsis_anomalib-0.1.6.dist-info/METADATA,sha256=qRldEsxtTOH0HEBtnAyrxYIUru5w_dmcZy96LiB7jgU,7552
|
|
14
|
+
sinapsis_anomalib-0.1.6.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
15
|
+
sinapsis_anomalib-0.1.6.dist-info/top_level.txt,sha256=p9ltOdENM_b-Ekvb0AvXmvZRV4Bwtly7c7qeOokACvE,18
|
|
16
|
+
sinapsis_anomalib-0.1.6.dist-info/RECORD,,
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
sinapsis_anomalib/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
sinapsis_anomalib/helpers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
|
-
sinapsis_anomalib/helpers/config_factory.py,sha256=M7CPS2qHgUWBUTYkuVGhaa2S6IJZ8C3zGPulVjgXr_U,4493
|
|
4
|
-
sinapsis_anomalib/templates/__init__.py,sha256=ltv45AB2oIhPw0jRrL0S6HMYYQp63Cr-DBjD0HjK1i0,904
|
|
5
|
-
sinapsis_anomalib/templates/anomalib_base.py,sha256=5MiP2RGSQzJq-vVNgj7oSS5RxpDcejv67aE8NglWQVE,7913
|
|
6
|
-
sinapsis_anomalib/templates/anomalib_base_inference.py,sha256=amQHwERqkKKWlQTFGlIL61oY9m21OX7icBl6nooumfE,8841
|
|
7
|
-
sinapsis_anomalib/templates/anomalib_export.py,sha256=26GsZ3C3Ja4Du3BttXtiheuJQjt097KTDJcy5TYsDok,7269
|
|
8
|
-
sinapsis_anomalib/templates/anomalib_openvino_inference.py,sha256=LUXsYxX_Cy3YlAIgaeXFEcKCtpNzWADPjPW0FA93ZBA,2959
|
|
9
|
-
sinapsis_anomalib/templates/anomalib_torch_inference.py,sha256=r_y42WEbTu-QT9052pWMnWk-ibqGVK9NLpGVciZyDv4,2624
|
|
10
|
-
sinapsis_anomalib/templates/anomalib_train.py,sha256=kvINzwbEPP2O7_NdlY9x6uIvbDI5AeZMQkSuguE9M9o,7549
|
|
11
|
-
sinapsis_anomalib-0.1.4.dist-info/licenses/LICENSE,sha256=hIahDEOTzuHCU5J2nd07LWwkLW7Hko4UFO__ffsvB-8,34523
|
|
12
|
-
sinapsis_anomalib-0.1.4.dist-info/METADATA,sha256=kZEFAunxxABG6qe20oMyRdzjJn0FCRoEXeHgJtQwNE8,7552
|
|
13
|
-
sinapsis_anomalib-0.1.4.dist-info/WHEEL,sha256=wXxTzcEDnjrTwFYjLPcsW_7_XihufBwmpiBeiXNBGEA,91
|
|
14
|
-
sinapsis_anomalib-0.1.4.dist-info/top_level.txt,sha256=p9ltOdENM_b-Ekvb0AvXmvZRV4Bwtly7c7qeOokACvE,18
|
|
15
|
-
sinapsis_anomalib-0.1.4.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|