detectors.methods packageο
Submodulesο
detectors.methods.ae moduleο
detectors.methods.bats moduleο
Typical Feature Estimated Method (TFEM)
detectors.methods.csi moduleο
- class detectors.methods.csi.CSI(model: Module, **kwargs)[source]ο
Bases:
DetectorWithFeatureExtractionCSI: Novelty Detection via Contrastive Learning on Distributionally Shifted Instances
Extract features from the last layer of a self supervised model.
References
[1] https://arxiv.org/abs/2007.08176 [2] https://github.com/alinlab/CSI
detectors.methods.dice moduleο
- class detectors.methods.dice.Dice(model: Module, last_layer_name: str | None = None, p=0.7, **kwargs)[source]ο
Bases:
objectDICE: Leveraging Sparsification for Out-of-Distribution Detection
- Parameters:
model (torch.nn.Module) β
last_layer_name (Optional[str]) β Name of the last layer of the model. If None, it will be inferred from the modelβs default_cfg.
p (float) β Percentage of nodes to keep in the last layer. Default: 0.7
References
detectors.methods.doctor moduleο
- detectors.methods.doctor.doctor(x: Tensor, model: Module, temperature: float = 1, eps: float = 0.0, **kwargs) Tensor[source]ο
Doctor detector.
- Parameters:
x (Tensor) β input tensor.
model (nn.Module) β classifier.
temperature (float, optional) β softmax temperature parameter. Defaults to 1000.
eps (float, optional) β input preprocessing noise value. Defaults to 0.0 (no input preprocessing).
- Returns:
scores for each input.
- Return type:
Tensor
References
detectors.methods.energy moduleο
- detectors.methods.energy.energy(x: Tensor, model: Module, temperature: float = 1.0, eps: float = 0.0, **kwargs)[source]ο
Energy-based OOD detector.
- Parameters:
x (Tensor) β input tensor.
model (nn.Module) β classifier.
temperature (float, optional) β softmax temperature parameter. Defaults to 1.0.
- Returns:
OOD scores for each input.
- Return type:
Tensor
References
detectors.methods.entropy moduleο
detectors.methods.gmm moduleο
- class detectors.methods.gmm.GMM(model: Module, features_nodes: List[str] | None = None, all_blocks: bool = False, last_layer: bool = False, pooling_op_name: str = 'avg_or_getitem', aggregation_method_name: str = 'mean', n_components: int | None = None, covariance_type: Literal['full', 'tied', 'diag'] = 'full', **kwargs_gmm)[source]ο
detectors.methods.gmm_torch moduleο
- class detectors.methods.gmm_torch.GaussianMixture(n_components=1, *, covariance_type='full', tol=0.001, reg_covar=0.0001, max_iter=100, n_init=1, init_params='kmeans', weights_init=None, means_init=None, precisions_init=None, random_state=None, warm_start=False, verbose=0, verbose_interval=10)[source]ο
Bases:
object- aic(X)[source]ο
Akaike information criterion for the current model on the input X.
- Parameters:
X (array of shape (n_samples, n_dimensions)) β The input samples.
- Returns:
aic β The lower the better.
- Return type:
float
- bic(X)[source]ο
Bayesian information criterion for the current model on the input X.
- Parameters:
X (array of shape (n_samples, n_dimensions)) β The input samples.
- Returns:
bic β The lower the better.
- Return type:
float
- fit(X, y=None)[source]ο
Estimate model parameters with the EM algorithm.
The method fits the model
n_inittimes and sets the parameters with which the model has the largest likelihood or lower bound. Within each trial, the method iterates between E-step and M-step formax_itertimes until the change of likelihood or lower bound is less thantol, otherwise, aConvergenceWarningis raised. Ifwarm_startisTrue, thenn_initis ignored and a single initialization is performed upon the first call. Upon consecutive calls, training starts where it left off.- Parameters:
X (array-like of shape (n_samples, n_features)) β List of n_features-dimensional data points. Each row corresponds to a single data point.
y (Ignored) β Not used, present for API consistency by convention.
- Returns:
self β The fitted mixture.
- Return type:
object
- fit_predict(X, y=None)[source]ο
Estimate model parameters using X and predict the labels for X.
The method fits the model n_init times and sets the parameters with which the model has the largest likelihood or lower bound. Within each trial, the method iterates between E-step and M-step for max_iter times until the change of likelihood or lower bound is less than tol, otherwise, a
ConvergenceWarningis raised. After fitting, it predicts the most probable label for the input data points.New in version 0.20.
- Parameters:
X (array-like of shape (n_samples, n_features)) β List of n_features-dimensional data points. Each row corresponds to a single data point.
y (Ignored) β Not used, present for API consistency by convention.
- Returns:
labels β Component labels.
- Return type:
array, shape (n_samples,)
- predict(X)[source]ο
Predict the labels for the data samples in X using trained model.
- Parameters:
X (array-like of shape (n_samples, n_features)) β List of n_features-dimensional data points. Each row corresponds to a single data point.
- Returns:
labels β Component labels.
- Return type:
array, shape (n_samples,)
- predict_proba(X)[source]ο
Evaluate the componentsβ density for each sample.
- Parameters:
X (array-like of shape (n_samples, n_features)) β List of n_features-dimensional data points. Each row corresponds to a single data point.
- Returns:
resp β Density of each Gaussian component for each sample in X.
- Return type:
array, shape (n_samples, n_components)
- sample(n_samples=1)[source]ο
Generate random samples from the fitted Gaussian distribution.
- Parameters:
n_samples (int, default=1) β Number of samples to generate.
- Returns:
X (array, shape (n_samples, n_features)) β Randomly generated sample.
y (array, shape (nsamples,)) β Component labels.
- score(X, y=None)[source]ο
Compute the per-sample average log-likelihood of the given data X.
- Parameters:
X (array-like of shape (n_samples, n_dimensions)) β List of n_features-dimensional data points. Each row corresponds to a single data point.
y (Ignored) β Not used, present for API consistency by convention.
- Returns:
log_likelihood β Log-likelihood of X under the Gaussian mixture model.
- Return type:
float
- score_samples(X)[source]ο
Compute the log-likelihood of each sample.
- Parameters:
X (array-like of shape (n_samples, n_features)) β List of n_features-dimensional data points. Each row corresponds to a single data point.
- Returns:
log_prob β Log-likelihood of each sample in X under the current model.
- Return type:
array, shape (n_samples,)
- detectors.methods.gmm_torch.check_is_fitted(estimator, attributes=None, *, msg=None, all_or_any=<built-in function all>)[source]ο
Perform is_fitted validation for estimator.
Checks if the estimator is fitted by verifying the presence of fitted attributes (ending with a trailing underscore) and otherwise raises a NotFittedError with the given message.
If an estimator does not set any attributes with a trailing underscore, it can define a
__sklearn_is_fitted__method returning a boolean to specify if the estimator is fitted or not.- Parameters:
estimator (estimator instance) β Estimator instance for which the check is performed.
attributes (str, list or tuple of str, default=None) β
Attribute name(s) given as string or a list/tuple of strings Eg.:
["coef_", "estimator_", ...], "coef_"If None, estimator is considered fitted if there exist an attribute that ends with a underscore and does not start with double underscore.
msg (str, default=None) β
The default error message is, βThis %(name)s instance is not fitted yet. Call βfitβ with appropriate arguments before using this estimator.β
For custom messages if β%(name)sβ is present in the message string, it is substituted for the estimator name.
Eg. : βEstimator, %(name)s, must be fitted before sparsifyingβ.
all_or_any (callable, {all, any}, default=all) β Specify whether all or any of the given attributes must exist.
- Raises:
TypeError β If the estimator is a class or not an estimator instance
NotFittedError β If the attributes are not found.
detectors.methods.godin moduleο
detectors.methods.gradnorm moduleο
- detectors.methods.gradnorm.gradnorm(x: Tensor, model: Module, last_layer_name: str | None = None, temperature: float = 1.0, **kwargs)[source]ο
GradNorm OOD detector.
- Parameters:
x (Tensor) β input tensor.
model (nn.Module) β classifier.
last_layer_name (Optional[str], optional) β last layer node name. Defaults to None. If None, the last layer is automatically selected.
temperature (float, optional) β softmax temperature parameter. Defaults to 1.0.
- Returns:
scores for each input.
- Return type:
Tensor
References
detectors.methods.gram moduleο
detectors.methods.igeood_logits moduleο
- class detectors.methods.igeood_logits.IgeoodLogits(model: Module, temperature: float = 1.0, eps: float = 0.0, **kwargs)[source]ο
Bases:
objectIGEOOD detector.
- Parameters:
model (nn.Module) β classifier.
temperature (float, optional) β softmax temperature parameter. Defaults to 1.0.
eps (float, optional) β input preprocessing noise value. Defaults to 0.0 (no input preprocessing).
References
detectors.methods.kl_matching moduleο
detectors.methods.knn_euclides moduleο
- class detectors.methods.knn_euclides.KnnEuclides(model: Module, features_nodes: List[str] | None = None, all_blocks: bool = False, last_layer: bool = False, pooling_op_name: str = 'avg', aggregation_method_name='mean', alpha: float = 1, k: int = 10, avg_topk: bool = False, **kwargs)[source]ο
Bases:
DetectorWithFeatureExtractionK-NN detector based on Euclidean distance.
- Parameters:
model (nn.Module) β Model to be used to extract features
features_nodes (Optional[List[str]]) β List of strings that represent the feature nodes. Defaults to None.
all_blocks (bool, optional) β If True, use all blocks of the model. Defaults to False.
last_layer (bool, optional) β If True, use also the last layer of the model. Defaults to False.
pooling_op_name (str, optional) β Pooling operation to be applied to the features. Can be one of [βmaxβ, βavgβ, βflattenβ, βgetitemβ, βnoneβ]. Defaults to βavgβ.
aggregation_method_name (str, optional) β Aggregation method to be applied to the features. Defaults to None.
alpha (float, optional) β Alpha parameter for the input pre-processing. Defaults to 1.
k (int, optional) β Number of nearest neighbors to be considered. Defaults to 10.
avg_topk (bool, optional) β If True, average the top-k scores. Defaults to False.
References
detectors.methods.logit_norm moduleο
detectors.methods.mahalanobis moduleο
- class detectors.methods.mahalanobis.Mahalanobis(model: ~torch.nn.modules.module.Module, features_nodes: ~typing.List[str] | None = None, all_blocks: bool = False, last_layer: bool = False, pooling_op_name: str = 'avg_or_getitem', aggregation_method_name: str | None = 'mean', cov_mat_method: ~typing.Literal['EmpiricalCovariance', 'GraphicalLasso', 'GraphicalLassoCV', 'LedoitWolf', 'MinCovDet', 'ShrunkCovariance', 'OAS'] = 'EmpiricalCovariance', mu_cov_inv_est_fn=<function class_cond_mus_cov_inv_matrix>, cov_reg: float = 1e-06, **kwargs)[source]ο
Bases:
DetectorWithFeatureExtractionMahalanobis OOD detector.
- Parameters:
model (nn.Module) β Model to be used to extract features
features_nodes (Optional[List[str]]) β List of strings that represent the feature nodes. Defaults to None.
all_blocks (bool, optional) β If True, use all blocks of the model. Defaults to False.
last_layer (bool, optional) β If True, use also the last layer of the model. Defaults to False.
pooling_op_name (str, optional) β Pooling operation to be applied to the features. Can be one of max, avg, flatten, getitem, avg_or_getitem, max_or_getitem, none. Defaults to avg.
aggregation_method_name (str, optional) β Aggregation method to be applied to the features. Defaults to None.
cov_mat_method (str, optional) β Covariance matrix estimation method. Can be one of: EmpiricalCovariance, GraphicalLasso, GraphicalLassoCV, LedoitWolf, MinCovDet, ShrunkCovariance, OAS. Defaults to EmpiricalCovariance.
mu_cov_inv_est_fn (function, optional) β Function to be used to estimate the means, covariance and inverse matrix. Defaults to class_cond_mus_cov_inv_matrix.
cov_reg (float, optional) β Covariance regularization. Defaults to 1e-6.
References
- detectors.methods.mahalanobis.class_cond_mus_cov_inv_matrix(x: Tensor, targets: Tensor, cov_method: str = 'EmpiricalCovariance', device=device(type='cpu'))[source]ο
- detectors.methods.mahalanobis.mahalanobis_dist_forward_substitution(x: Tensor, y: Tensor, L: Tensor)[source]ο
- detectors.methods.mahalanobis.mahalanobis_distance_inv(x: Tensor, y: Tensor, precision: Tensor)[source]ο
Mahalanobis distance betwee x and y.
- Parameters:
x (Tensor) β first point.
y (Tensor) β second point.
precision (Tensor) β inverse of the covariance matrix.
- detectors.methods.mahalanobis.mahalanobis_distance_inv_fast(x: Tensor, y: Tensor, precision: Tensor)[source]ο
Mahalanobis distance betwee x and y with an accelerated implementation.
- Parameters:
x (Tensor) β first point.
y (Tensor) β second point.
precision (Tensor) β inverse of the covariance matrix.
detectors.methods.max_logits moduleο
detectors.methods.maxcosine moduleο
- class detectors.methods.maxcosine.MaxCosineSimilarity(model: Module, features_nodes: List[str] | None = None, all_blocks: bool = False, last_layer: bool = False, pooling_op_name: str = 'avg_or_getitem', aggregation_method_name: str | None = 'mean', **kwargs)[source]ο
Bases:
DetectorWithFeatureExtractionMaxCosineSimilarity detector.
- Parameters:
model (nn.Module) β Model to be used to extract features
features_nodes (Optional[List[str]]) β List of strings that represent the feature nodes. Defaults to None.
all_blocks (bool, optional) β If True, use all blocks of the model. Defaults to False.
last_layer (bool, optional) β If True, use also the last layer of the model. Defaults to False.
pooling_op_name (str, optional) β
Pooling operation to be applied to the features. Can be one of:
max, avg, none, flatten, getitem, avg_or_getitem, max_or_getitem.
Defaults to βavgβ.
aggregation_method_name (str, optional) β Aggregation method to be applied to the features. Defaults to None.
References
detectors.methods.mcdropout moduleο
- detectors.methods.mcdropout.mcdropout(x: Tensor, model: Module, k: int = 5, **kwargs) Tensor[source]ο
MC Dropout
Forward-propagates the input through the model several times with activated dropout and averages the results.
- Parameters:
x (Tensor) β input tensor.
model (nn.Module) β classifier.
k (int, optional) β number of forward passes. Defaults to 5.
References
detectors.methods.msp moduleο
detectors.methods.naive moduleο
detectors.methods.odin moduleο
- detectors.methods.odin.odin(x: Tensor, model: Module, temperature: float = 1000, eps: float = 0.0, **kwargs) Tensor[source]ο
ODIN OOD detector.
- Parameters:
x (Tensor) β input tensor.
model (nn.Module) β classifier.
temperature (float, optional) β softmax temperature parameter. Defaults to 1000.
eps (float, optional) β input preprocessing noise value. Defaults to 0.0 (no input preprocessing).
- Returns:
OOD scores for each input.
- Return type:
Tensor
References
detectors.methods.oe moduleο
detectors.methods.openmax moduleο
detectors.methods.projection moduleο
detectors.methods.rankfeat moduleο
detectors.methods.react moduleο
- class detectors.methods.react.ReAct(model: ~torch.nn.modules.module.Module, features_nodes: ~typing.List[str] | None = None, graph_nodes_names: ~typing.List[str] | None = None, insert_node_fn: ~typing.Callable = <function insert_fn>, p=0.9, **kwargs)[source]ο
Bases:
objectReAct detector.
- Parameters:
model (torch.nn.Module) β Model to be used to extract features
features_nodes (Optional[List[str]]) β List of strings that represent the feature nodes. Defaults to None.
graph_nodes_names (Optional[List[str]]) β List of strings that represent the graph nodes. Defaults to None.
insert_node_fn (Callable) β Function to be used to insert the node. Defaults to insert_fn.
p (float, optional) β Threshold to be used to clip the features. Defaults to 0.9.
References
[1] https://arxiv.org/abs/2111.12797
- LIMIT = 2560000ο
detectors.methods.react_projection moduleο
- class detectors.methods.react_projection.ReActProjection(model: ~torch.nn.modules.module.Module, features_nodes: ~typing.List[str], pooling_name: str = 'max', graph_nodes_names_thr: ~typing.Dict[str, float] = {'flatten': 1.0}, insert_node_fn: ~typing.Callable = <function insert_fn>, aggregation_method=None, *args, **kwargs)[source]ο
Bases:
Projection
detectors.methods.relative_mahalanobis moduleο
- class detectors.methods.relative_mahalanobis.RelativeMahalanobis(model: ~torch.nn.modules.module.Module, features_nodes: ~typing.List[str] | None = None, all_blocks: bool = False, last_layer: bool = False, pooling_op_name: str = 'avg_or_getitem', aggregation_method_name: str | None = 'mean', cov_mat_method: ~typing.Literal['EmpiricalCovariance', 'GraphicalLasso', 'GraphicalLassoCV', 'LedoitWolf', 'MinCovDet', 'ShrunkCovariance', 'OAS'] = 'EmpiricalCovariance', mu_cov_inv_est_fn=<function class_cond_mus_cov_inv_matrix>, cov_reg: float = 1e-06, **kwargs)[source]ο
Bases:
MahalanobisRelativeMahalanobis detector.
- Parameters:
model (nn.Module) β Model to be used to extract features
features_nodes (Optional[List[str]]) β List of strings that represent the feature nodes. Defaults to None.
all_blocks (bool, optional) β If True, use all blocks of the model. Defaults to False.
last_layer (bool, optional) β If True, use also the last layer of the model. Defaults to False.
pooling_op_name (str, optional) β Pooling operation to be applied to the features. Can be one of [βmaxβ, βavgβ, βflattenβ, βgetitemβ, βnoneβ]. Defaults to βavgβ.
aggregation_method_name (str, optional) β Aggregation method to be applied to the features. Defaults to None.
cov_mat_method (str, optional) β Covariance matrix estimation method. Can be one of [βEmpiricalCovarianceβ, βGraphicalLassoβ, βGraphicalLassoCVβ, βLedoitWolfβ, βMinCovDetβ, βShrunkCovarianceβ, βOASβ]. Defaults to βEmpiricalCovarianceβ.
mu_cov_inv_est_fn (function, optional) β Function to be used to estimate the means, covariance and inverse matrix. Defaults to class_cond_mus_cov_inv_matrix.
cov_reg (float, optional) β Covariance regularization. Defaults to 1e-6.
References
detectors.methods.ssd moduleο
- class detectors.methods.ssd.SSD(model: Module, nclusters: int | None = None, niter: int = 300, cov_reg=1e-08, **kwargs)[source]ο
Bases:
DetectorWithFeatureExtractionSSD: A Unified Framework for Self-Supervised Outlier Detection.
Extract features from the last layer of a self supervised model.
References
[1] https://arxiv.org/abs/2103.12051 [2] https://github.com/inspire-group/SSD
detectors.methods.templates moduleο
Generalized detection methods templates.
- class detectors.methods.templates.Detector(**kwargs)[source]ο
Bases:
ABCDetector base class.
- abstract __call__(x: Tensor) Tensor[source]ο
Compute scores for each input at test time.
- Parameters:
x (Tensor) β input tensor.
- Returns:
scores for each input.
- Return type:
Tensor
- end(*args, **kwargs)[source]ο
Finalize detector fitting process.
This is called after the last call to update and is optional.
- fit(dataloader, **kwargs)[source]ο
Fit detector to a dataset.
- Parameters:
dataloader (Dataloader) β Dataloader for the fitting dataset.
- start(example: Tensor | None = None, fit_length: int | None = None, *args, **kwargs)[source]ο
Setup detector for fitting parameters.
- Parameters:
example (Optional[Tensor], optional) β Input example. Useful for pre-allocating memory. Defaults to None.
fit_length (Optional[int], optional) β Length of the fitting dataset. Useful for pre-allocating memory. Defaults to None.
This is called before the first call to update and is optional.
- class detectors.methods.templates.DetectorWithFeatureExtraction(model: Module, features_nodes: List[str] | None = None, all_blocks: bool = False, last_layer: bool = False, pooling_op_name: str = 'avg_or_getitem', aggregation_method_name: str | None = 'mean', **kwargs)[source]ο
Bases:
DetectorBase class for OOD detectors with feature extraction.
- Parameters:
model (nn.Module) β Model to be used to extract features
features_nodes (Optional[List[str]]) β List of strings that represent the feature nodes. Defaults to None.
all_blocks (bool, optional) β If True, use all blocks of the model. Defaults to False.
last_layer (bool, optional) β If True, use also the last layer of the model. Defaults to False.
pooling_op_name (str, optional) β
Pooling operation to be applied to the features. Can be one of:
max, avg, none, flatten, getitem, avg_or_getitem, max_or_getitem.
Defaults to βavgβ.
aggregation_method_name (str, optional) β Aggregation method to be applied to the features. Defaults to None.
**kwargs β
- end(*args, **kwargs)[source]ο
Finalize detector fitting process.
This is called after the last call to update and is optional.
- start(example: Tensor | None = None, fit_length: int | None = None, *args, **kwargs)[source]ο
Setup detector for fitting parameters.
- Parameters:
example (Optional[Tensor], optional) β Input example. Useful for pre-allocating memory. Defaults to None.
fit_length (Optional[int], optional) β Length of the fitting dataset. Useful for pre-allocating memory. Defaults to None.
This is called before the first call to update and is optional.
- class detectors.methods.templates.DetectorWithSimpleFE(model: Module, pooling_op_name: str = 'avg_or_getitem', **kwargs)[source]ο
Bases:
DetectorWithFeatureExtraction,ABCDetector that uses the forward pass of the model.
- class detectors.methods.templates.DetectorWrapper(detector, **kwargs)[source]ο
Bases:
DetectorDetector interface.
- end(*args, **kwargs)[source]ο
Finalize detector fitting process.
This is called after the last call to update and is optional.
- fit(dataloader, **kwargs)[source]ο
Fit detector to a dataset.
- Parameters:
dataloader (Dataloader) β Dataloader for the fitting dataset.
- start(example: Tensor | None = None, fit_length: int | None = None, *args, **kwargs)[source]ο
Setup detector for fitting parameters.
- Parameters:
example (Optional[Tensor], optional) β Input example. Useful for pre-allocating memory. Defaults to None.
fit_length (Optional[int], optional) β Length of the fitting dataset. Useful for pre-allocating memory. Defaults to None.
This is called before the first call to update and is optional.
detectors.methods.utils moduleο
detectors.methods.vim moduleο
- class detectors.methods.vim.ViM(model: Module, last_layer_name: str | None = None, penultimate_layer_name: str | None = None, **kwargs)[source]ο
Bases:
objectVirtual Logit Matching (ViM) detector.
- Parameters:
model (torch.nn.Module) β Model to be used to extract features
last_layer_name (Optional[str]) β Name of the last layer. Defaults to None.
penultimate_layer_name (Optional[str]) β Name of the penultimate layer. Defaults to None.
References
Module contentsο
Detection methods.
- class detectors.methods.MethodsRegistry(value)ο
Bases:
EnumAn enumeration.
- always_one = 'always_one'ο
- always_zero = 'always_zero'ο
- csi = 'csi'ο
- dice = 'dice'ο
- doctor = 'doctor'ο
- energy = 'energy'ο
- entropy = 'entropy'ο
- gmm = 'gmm'ο
- gradnorm = 'gradnorm'ο
- igeood_logits = 'igeood_logits'ο
- kl_matching = 'kl_matching'ο
- knn_cosine = 'knn_cosine'ο
- knn_euclides = 'knn_euclides'ο
- knn_projection = 'knn_projection'ο
- mahalanobis = 'mahalanobis'ο
- max_logits = 'max_logits'ο
- maxcosine = 'maxcosine'ο
- mcdropout = 'mcdropout'ο
- msp = 'msp'ο
- odin = 'odin'ο
- projection = 'projection'ο
- random = 'random'ο
- react = 'react'ο
- react_projection = 'react_projection'ο
- relative_mahalanobis = 'relative_mahalanobis'ο
- ssd = 'ssd'ο
- vim = 'vim'ο
- detectors.methods.create_detector(detector_name: str, **kwargs) Detector[source]ο
Create detector factory.
- Parameters:
detector_name (string) β
Name of the detector. Already implemented:
random, msp, odin, energy, mahalanobis, react, dice, knn_euclides, igeood_logits, projection, react_projection, gradnorm, maxcosine, mcdropout, max_logits, kl_matching, gmm, relative_mahalanobis, doctor, always_one, always_zero, random_score, vim, entropy, ssd, csi, knn_cosine, knn_projection.
**kwargs β Additional arguments for the detector.
- Returns:
the corresponding detector.
- Return type:
- detectors.methods.create_hyperparameters(detector_name: str) Dict[str, Any][source]ο
Create hyperparameters for the detector.
- Parameters:
detector_name (string) β Name of the detector.
- Returns:
Hyperparameters for the detector.
- Return type:
Dict[str, Any]
- detectors.methods.list_detectors() List[str][source]ο
List available detectors.
- Returns:
List of available detectors.
- Return type:
List[str]
- detectors.methods.register_detector(name: str)[source]ο
Decorator to register a new detector.
- Parameters:
name (string) β Name of the detector.
Example:
@register_detector("my_detector") class MyDetector(Detector): ... detector = create_detector("my_detector") @register_detector("my_detector") def my_detector(model, **kwargs): ... detector = create_detector("my_detector")