Skip to content

Latest commit

 

History

History

defect_detection_anomalib

Apache License Version 2.0

Intel’s OpenVINO™ Defect Detection with Anomalib offers a comprehensive solution to quality control through near-real-time detection of manufacturing defects. The kit uses Anomalib, an open-source deep-learning library, to simplify training, testing, and deploying anomaly detection models on public and custom datasets. Models can be exported to the OpenVINO™ Intermediate Representation and deployed on Intel hardware. Optimized for inference performance, these models are trainable on CPU, require low memory, and are well-suited for edge deployment.

This kit uses the following technology stack:

Check out our AI Reference Kits repository for other kits.

defect-detection

What's New

New updates will be added here.

Table of Contents

Installing Anomalib

If you have not installed all required dependencies, just run pip install anomalib in the same OpenVINO Notebooks environment.

Getting Started with the Jupyter Notebook

This notebook demonstrates how NNCF compresses a model trained with Anomalib. The notebook is divided into the following sections:

  • Train an Anomalib model without compression
  • Train a model with NNCF compression
  • Compare the performance of the two models (FP32 vs INT8)

Setting up your Camera

Connect your USB Camera and verify it works using a simple camera application. Once it is verified, close the application.

Setting up the Dobot Robot (Optional)

  1. Install Dobot requirements (See Dobot documentation here: https://en.dobot.cn/products/education/magician.html).
  2. Check all connections to the Dobot and verify it is working using the Dobot Studio.
  3. Install the vent accessory on the Dobot and verify it works using Dobot Studio.
  4. In the Dobot Studio, hit the "Home" button, and locate the:

image

a. Calibration coordinates: Initial position upper-left corner of cubes array.

b. Place coordinates: Position where the arm should leave the cubic over the conveyor belt.

c. Anomaly coordinates: Where you want to release the abnormal cube.

d. Then, replace those coordinates in the notebook

Data Acquisition and Inferencing

For data acquisition and inferencing we will use 501b notebook. There we need to identify the acquisition flag, True for acquisition mode and False for inferencing mode. In acquisition mode be aware of the normal or abnormal folder we want to create, in this mode the notebook will save every image in the anomalib/datasets/cubes/{FOLDER} for further training. In inferencing mode the notebook won't save images, it will run the inference and show the results.

Note: If you don't have the robot you could jump to another notebook 501a and download the dataset from this link

Training

For training, we will use the 501a notebook. In this example we are using "Padim" model and we are using Anomalib API for setting up the dataset, model, metrics, and the optimization process with OpenVINO.

Additional Resources

Back to top ⬆️