Skip to content

PEKAT (Surface Inspection)

Effect Preview

Tip

To use this example, you need to prepare a PEKAT VISION License first


Open the complete PEKAT project and set the corresponding communication parameters to call it via AI-Vision. ![Local Image](./picture/callPekat.gif)

(1) Prepare Pekat

Train a PEKAT surface inspection project in advance (refer to the last section of this document, PekatVision Usage Introduction, for detailed procedures)

[0] Open the PEKAT project

Local Image

[1] Communication Settings

  • [a] Check Data Processing: AI-Vision needs to obtain data processed by PEKAT

  • [b] Select Provider as API: AI-Vision will communicate with PEKAT by calling the API

  • [c] Set Host to the network address of the PC running the AI-Vision project. If PEKAT and AI-Vision are on the same PC, you can set it to 127.0.0.1; if on different PCs, ensure network communication is normal

Local Image

(2) AI-Vision Project

Local Image

[0] Load Image: Load the image to be inspected into the specified IM

Local Image

[1] Pekat Surface Inspection

  • Input Parameters:

    • Input Image: Select the image to be operated on; the image sequence number is consistent with the IM sequence number.

      Local Image

  • Calculation Parameters

    • Host: Set the IP address of the PC where PekatVision is located

    • Port Number: Set the port number of the corresponding Pekat project

    • Display Label: Display the PEKAT detection result labels on the output image

    • Output Window: Push the window to the register for subsequent processing in the AI-Vision project. Example: Further measure the geometric dimensions in this window

      Local Image

[2] Script Processing (Optional)

The script binds the Json output by PekatVision as a variable. The output variables of the PekatVision Surface Inspection operator include the Json string output by PekatVision

Local Image

  • Obtain global variables through the script and display the detection frames and detection results

    Confirm the modelId of the model to be detected, obtain the corresponding detection data x, y, height, width, and display the detection frames in the corresponding IM window according to the obtained results

lua
data = ConvertJsonToTable(json)

-- Get the number of detection frames
number = #data.detectedRectangles


local x = {}
local y = {}
local width = {}
local height = {}

-- Get detection results according to model id; the modelId here must be consistent with that in Pekat
for i = 1, number, 1 do
  if(string.format("%d",data.detectedRectangles[i].source.modelId) == "1708506619") then
     table.insert(x, data.detectedRectangles[i].x)
     table.insert(y, data.detectedRectangles[i].y)
     table.insert(width, data.detectedRectangles[i].width)
     table.insert(height, data.detectedRectangles[i].height)
  end

end

-- Output detection frames and results
for i = 1, #x, 1 do
  DrawWindow2D(0,"red",x[i],y[i],x[i]+width[i],y[i]+height[i])
  DrawText2D(0, "red", x[i], y[i] - 25, 20, "Contamination")
end

After modifying the color of the output window via the script, the effect is as follows: Local Image

PekatVision Usage Introduction

Local Image

Annotation and Training

[0] Create and open a project

[1] Import Images

Select Import Images or Folder to import the dataset

Local Image

[2] Select Module

Select the corresponding module for detection

  • Surface Inspection: Suitable for detecting known surface defects

  • Detector: Suitable for detection and classification of known defects

  • Anomaly Detector: Suitable for defect detection with repeated surface backgrounds (only requires OK qualified images for training)

    Local Image

[3] Defect Annotation and Training

Enter the training interface, annotate and classify defects, then click Start Training to train the model.

Local Image

Result Viewing

  • Inspection

    View the detection results of the corresponding model in the Inspection interface

    Local Image

  • Review

    View the detection result Json string of each image after detection in the Review interface

    Local Image

    The Json string includes the following content

    • Defect Position: x, y, height, width

    • Defect Detection Model Id: modelId

    • Defect Label: label

AI-Vision, Making 3D Measurement Easier