Main Content

Automated Visual Inspection

Automate quality control tasks using anomaly detection and localization methods

Automated visual inspection (AVI) is a set of techniques used to detect and classify defects in manufactured products. Modern visual inspection uses machine learning and deep learning algorithms to assist and improve quality assurance processes.

Custom defect detection must accurately determine the location of defects in a given image and classify the defect category. Generally, you can detect defects of different sizes using state-of-the-art supervised deep learning models such as the latest you only look once (YOLO) algorithms. Best performing models characterize and locate defects in real-time.

You can use anomaly detection deep learning methods to determine whether an image of a manufactured product is normal or anomalous. Additionally, you can produce precise and interpretable results using anomaly localization. This method enables you to create a visualization of the defects using an anomaly map.

The specific detection model you select to automate a visual inspection task depends on several factors. These factors include the amount of training data available for normal and anomalous samples, the number of anomaly classes to recognize, and the type of localization information required for understanding and monitoring predictions. For more information, see Getting Started with Anomaly Detection Using Deep Learning.

To perform automated visual inspection, download the Computer Vision Toolbox™ Automated Visual Inspection Library from the Add-On Explorer. For more information on downloading add-ons, see Get and Manage Add-Ons. Some functionality also requires Deep Learning Toolbox™.


expand all

groundTruthGround truth label data
imageDatastoreDatastore for image data
sceneLabelTrainingDataCreate training data for scene classification from ground truth (Since R2022b)
splitAnomalyDataSplit data into training, validation and testing sets for anomaly detection (Since R2023a)
trainFCDDAnomalyDetectorTrain fully convolutional data description (FCDD) anomaly detection network (Since R2022b)
trainFastFlowAnomalyDetectorTrain FastFlow anomaly detection network (Since R2023a)
trainPatchCoreAnomalyDetectorTrain PatchCore anomaly detection network (Since R2023a)
anomalyThresholdOptimal anomaly threshold for set of anomaly scores and corresponding labels (Since R2022b)
fcddAnomalyDetectorDetect anomalies using fully convolutional data description (FCDD) network for anomaly detection (Since R2022b)
fastFlowAnomalyDetectorDetect anomalies using FastFlow network (Since R2023a)
patchCoreAnomalyDetectorDetect anomalies using PatchCore network (Since R2023a)
classifyClassify image as normal or anomalous (Since R2022b)
predictPredict unnormalized anomaly scores (Since R2022b)
yoloxObjectDetectorDetect objects using YOLOX object detector (Since R2023b)
trainYOLOXObjectDetectorTrain YOLOX object detector (Since R2023b)
detectDetect objects using YOLOX object detector (Since R2023b)
anomalyMapPredict per-pixel anomaly score map (Since R2022b)
anomalyMapOverlayOverlay heatmap on image using per-pixel anomaly scores (Since R2022b)
viewAnomalyDetectionResultsView anomaly detection results (Since R2022b)
evaluateAnomalyDetectionEvaluate anomaly detection results against ground truth (Since R2022b)
anomalyDetectionMetricsAnomaly detection metrics (Since R2022b)
vision.loadYOLOXObjectDetectorLoad YOLOX object detector model for code generation (Since R2023b)