-
Notifications
You must be signed in to change notification settings - Fork 709
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🔨 Increase inference + openvino support #122
Conversation
anomalib/models/dfkde/model.py
Outdated
layer_outputs = torch.cat(list(layer_outputs.values())).detach() | ||
return layer_outputs | ||
|
||
def fit_normality_model(self, embeddings: List[Tensor]): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i would prefer this is called just fit
. During its usage, it would just be self.model.fit(embeddings
anomalib/models/dfkde/model.py
Outdated
|
||
from anomalib.models.components import AnomalyModule, FeatureExtractor | ||
|
||
from .normality_model import NormalityModel | ||
|
||
|
||
class DfkdeModel(nn.Module): | ||
"""DFKDR model. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo: DFKDE
anomalib/models/dfkde/model.py
Outdated
feature_vector = self.get_features(batch) | ||
return self.normality_model.predict(feature_vector.view(feature_vector.shape[:2])) | ||
|
||
|
||
class DfkdeLightning(AnomalyModule): | ||
"""DFKDE: Deep Featured Kernel Density Estimation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo: Deep Feature
anomalib/models/dfkde/model.py
Outdated
filter_count=hparams.model.max_training_points, | ||
threshold_steepness=self.threshold_steepness, | ||
threshold_offset=self.threshold_offset, | ||
backbone = getattr(torchvision.models, hparams.model.backbone) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe you could create the backbone inside DfkdeModel
and just pass the hparams.model.backbone
to the constructor of that class. That would be more in line with other models (see Padim for example).
anomalib/models/dfm/model.py
Outdated
self.feature_extractor = FeatureExtractor(backbone=self.backbone(pretrained=True), layers=["avgpool"]).eval() | ||
|
||
self.dfm_model = DFMModel(n_comps=hparams.model.pca_level, score_type=hparams.model.score_type) | ||
backbone = getattr(torchvision.models, hparams.model.backbone) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, let's pass the string from the hparams and then instantiate the backbone inside the pytorch model.
Description
Increases inferencer support to all models and openvino support to ganomaly and dfm.
Fixes Ganomaly inference.py error #97
Known Issues
Changes
Checklist
Tests