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 Automated Visual Inspection Library for Computer Vision Toolbox™, which you can install from Add-On Explorer. For more information about installing add-ons, see Get and Manage Add-Ons.

    Creation

    Description

    detector = fastFlowAnomalyDetector creates a FastFlow anomaly detector from a ResNet-18 backbone network. See resnet18 (Deep Learning Toolbox) for more information.

    example

    detector = fastFlowAnomalyDetector(Name=Value) specifies the Backbone, NumFlowSteps and FlowModelChannelRatio properties of the FastFlow anomaly detector using name-value arguments.

    For example, NumFlowSteps=10 sets the number of steps in the flow network of the FastFlow detector to 10.

    Properties

    expand all

    This property is read-only.

    Pretrained backbone network that serves as the base feature extraction network, specified as a dlnetwork (Deep Learning Toolbox) object. The network must accept a single input and produce one or more outputs. If you do not specify the Backbone property, fastFlowAnomalyDetector uses a ResNet-18 network as the backbone feature extraction network.

    To set the value of this property, you must specify it at object creation.

    Data Types: dlnetwork

    This property is read-only.

    Number of steps in the flow network of the FastFlow detector, specified as a positive integer. Increase the number of flow network steps to obtain more trainable parameters at the possible expense of increasing memory cost and using more computing resources.

    To set the value of this property, you must specify it at object creation.

    This property is read-only.

    Ratio of input channels to hidden channels used in the input and output subnet layers after the channels are split in the flow network, specified as a positive numeric scalar. Increase the value of FlowModelChannelRatio to improve detection metrics at the possible expense of increasing memory cost and using more computing resources.

    To set the value of this property, you must specify it at object creation.

    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: []
    
    

    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

    expand all