FUVAS#
FUVAS: Few-shot Unsupervised Video Anomaly Segmentation via Low-Rank Factorization of Spatio-Temporal Features.
The FUVAS model extracts deep features from video clips using a pre-trained 3D CNN/transformer backbone and fits a PCA-based reconstruction model to detect anomalies. The model computes feature reconstruction errors to identify anomalous frames and regions in videos.
Example
>>> from anomalib.models.video import Fuvas
>>> model = Fuvas(
... backbone="x3d_s",
... layer="blocks.4"
... )
The model can be used with video anomaly detection datasets supported in anomalib.
Notes
The model implementation is available in the lightning_model module.
See also
anomalib.models.video.fuvas.lightning_model.Fuvas:Lightning implementation of the FUVAS model.
- class anomalib.models.video.fuvas.Fuvas(backbone='x3d_s', layer='blocks.4', pre_trained=True, spatial_pool=True, pooling_kernel_size=1, pca_level=0.98, pre_processor=True, post_processor=True, evaluator=True, visualizer=True)#
Bases:
MemoryBankMixin,AnomalibModuleFUVAS Lightning Module.
- Parameters:
backbone (
str) – Name of the backbone 3D CNN/transformer network. Defaults to"x3d_s".layer (
str) – Name of the layer to extract features from the backbone. Defaults to"blocks.4".pre_trained (
bool) – Whether to use a pre-trained backbone. Defaults toTrue.spatial_pool (
bool) – Whether to use spatial pooling on features. Defaults toTrue.pooling_kernel_size (
int) – Kernel size for pooling features. Defaults to1.pca_level (
float) – Ratio of variance to preserve in PCA. Must be between 0 and 1. Defaults to0.98.pre_processor (
PreProcessor|bool) – Pre-processor to use. IfTrue, uses the default pre-processor. IfFalse, no pre-processing is performed. Defaults toTrue.post_processor (
PostProcessor|bool) – Post-processor to use. IfTrue, uses the default post-processor. IfFalse, no post-processing is performed. Defaults toTrue.evaluator (
Evaluator|bool) – Evaluator to use. IfTrue, uses the default evaluator. IfFalse, no evaluation is performed. Defaults toTrue.visualizer (
Visualizer|bool) – Visualizer to use. IfTrue, uses the default visualizer. IfFalse, no visualization is performed. Defaults toTrue.
- static configure_optimizers()#
Configure optimizers for training.
- Returns:
FUVAS doesn’t require optimization.
- Return type:
- fit()#
Fit the PCA transformation to the embeddings.
The method aggregates embeddings collected during training and fits the PCA transformation used for anomaly scoring.
- Return type:
- property learning_type: LearningType#
Get the learning type of the model.
- Returns:
The model uses one-class learning.
- Return type:
LearningType
- training_step(batch, *args, **kwargs)#
Extract features from the input batch during training.
- validation_step(batch, *args, **kwargs)#
Compute predictions for the input batch during validation.