Main Content

fastFlowAnomalyDetector

Detect anomalies using FastFlow network

Since R2023a

    Description

    The fastFlowAnomalyDetector object detects images of anomalies using a FastFlow anomaly detector network. Train the detector using the trainFastFlowAnomalyDetector function. To detect anomalous images, pass the trained detector to the classify function.

    Note

    This functionality requires Deep Learning Toolbox™. This functionality also requires the Deep Learning Toolbox Model for ResNet-18 Network and the Computer Vision Toolbox™ Automated Visual Inspection Library, which you can install from Add-On Explorer. For more information about installing add-ons, see Get and Manage Add-Ons.

    Creation

    Description

    example

    detector = fastFlowAnomalyDetector creates a FastFlow anomaly detector from a ResNet-18 backbone network.

    Properties

    expand all

    Anomaly threshold, specified as a numeric scalar. You must set the value of the threshold before calling the classify function. You can calculate a threshold using the anomalyThreshold function.

    This property is read-only.

    Network layers, specified as an array of Layer objects.

    This property is read-only.

    Network input layer names, specified as a cell array of character vectors.

    This property is read-only.

    Network output layer names, specified as a cell array of character vectors.

    This property is read-only.

    Network state, specified as a table with three columns.

    • Layer — Layer name, specified as a string scalar

    • Parameter — State parameter name, specified as a string scalar

    • Value — Value of state parameter, specified as a dlarray object

    Layer states contain information calculated during the layer operation to be retained for use in subsequent forward passes of the layer. For example, the cell state and hidden state of LSTM layers, or running statistics in batch normalization layers.

    This property is read-only.

    Network learnable parameters, specified as a table with three columns.

    • Layer — Layer name, specified as a string scalar

    • Parameter — Parameter name, specified as a string scalar

    • Value — Value of parameter, specified as a dlarray object

    The network learnable parameters contain the features that the network learns. For example, the parameters include the weights of convolution and fully connected layers.

    Object Functions

    predictPredict unnormalized anomaly scores
    classifyClassify image as normal or anomalous
    anomalyMapPredict per-pixel anomaly score map

    Examples

    collapse all

    Create a fastFlowAnomalyDetector object.

    detector = fastFlowAnomalyDetector
    detector = 
      fastFlowAnomalyDetector with properties:
    
          Threshold: []
              State: []
         Learnables: [150x3 table]
             Layers: [222x1 nnet.cnn.layer.Layer]
         InputNames: {'data'}
        OutputNames: {'AffineScaleAndShiftScale1Step8/Z'  'AffineScaleAndShiftScale1Step8/logdet'  'AffineScaleAndShiftScale2Step8/Z'  'AffineScaleAndShiftScale2Step8/logdet'  'AffineScaleAndShiftScale3Step8/Z'  'AffineScaleAndShiftScale3Step8/logdet'}
    
    

    References

    [1] Yu, Jiawei, Ye Zheng, Xiang Wang, Wei Li, Yushuang Wu, Rui Zhao, and Liwei Wu. "FastFlow: Unsupervised Anomaly Detection and Localization via 2D Normalizing Flows." arXiv, November 16, 2021. https://doi.org/10.48550/arXiv.2111.07677.

    Extended Capabilities

    Version History

    Introduced in R2023a