メインコンテンツ

studentTeacherAnomalyDetector

R2026b

Detect anomalies using Student-Teacher network

Since R2026b

    Description

    Add-On Required: This feature requires the Visual Inspection Toolbox Model for Student-Teacher Anomaly Detection add-on.

    The studentTeacherAnomalyDetector object detects images of anomalies using a Student-Teacher anomaly detector network. Train the detector using the trainStudentTeacherAnomalyDetector function. To detect anomalous images, pass the trained detector to the classify function.

    You can perform tile based anomaly detection using the Student-Teacher anomaly detector. You can train the detector on smaller tiles extracted from a larger image and then perform inference on the full image. For best results, the tiles and the full image must be of the same resolution.

    Creation

    Description

    detector = studentTeacherAnomalyDetector creates a Student-Teacher anomaly detector.

    detector = studentTeacherAnomalyDetector(Name=Value) sets writable properties using one or more name-value arguments. For example, Network="small" specifies use a small base network for the Student-Teacher anomaly detector network.

    example

    Name-Value Arguments

    expand all

    Anomaly threshold, stored 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.

    Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

    Size of the base network, specified as "small" or "medium". This argument sets the Network property of the object.

    Data Types: char | string

    Output Arguments

    expand all

    Student-Teacher anomaly detector, returned as a studentTeacherAnomalyDetector object.

    Properties

    expand all

    Anomaly threshold, specified as a numeric scalar. You must set the value of the threshold before calling the classify function or before exporting the network to ONNX with classification as one of the export tasks. You can calculate a threshold by using the anomalyThreshold function.

    This property is read-only.

    Input image size, represented as a three-element numeric row vector of the form [rows columns channels]. The trainStudentTeacherAnomalyDetector function sets the InputSize property during training. The size of the images used to train the network determines the value of this property.

    When performing tile-based anomaly detection, which consists of training the network on smaller tiles extracted from a larger image and then performing inference on the full image, ensure that the tiles and full image are of the same resolution.

    This property is read-only after object creation.

    Size of the base network, represented as "small" or "medium".

    Object Functions

    predictPredict unnormalized anomaly scores
    classifyClassify image as normal or anomalous
    anomalyMapPredict per-pixel anomaly score map
    exportONNXNetworkExport Student-Teacher anomaly detector to ONNX model format

    Examples

    collapse all

    Create a studentTeacherAnomalyDetector object from a medium-sized base network.

    detector = studentTeacherAnomalyDetector(Network="medium")
    detector = 
      studentTeacherAnomalyDetector with properties:
    
        Threshold: []
        ImageSize: []
          Network: "medium"
    
    

    More About

    expand all

    Extended Capabilities

    expand all

    Version History

    Introduced in R2026b