AI & ML

Edge AI and Machine Vision on the Production Line: From Rule-Based Inspection to Deep Learning at the Edge

EDWartens Engineering Team
4 min read
Edge AI and Machine Vision on the Production Line: From Rule-Based Inspection to Deep Learning at the Edge

Two generations of vision

Rule-based machine vision measures: is the hole 10.0 mm, is the label at this position, is the cap present. Cognex, Keyence, Basler and Omron built an industry on it and it still does most inspection. Its limit is variation: scratches, dents, weld spatter, cosmetic defects on natural materials. Writing rules for every way a surface can look wrong is impossible.

Deep-learning vision learns from examples. Show it a few hundred good parts and a few dozen bad ones and it classifies, detects or segments defects that no rule described. Run it at the edge, on a device beside the line, and the decision arrives in milliseconds without a cloud round trip.

Advanced machine vision detecting dents and scratches on metal surfaces, by Flexible Vision

The pipeline

  1. Acquisition: camera, lens, lighting. Lighting still decides everything; deep learning does not fix a badly lit image.
  2. Trigger: a sensor or the PLC tells the camera when the part is in position.
  3. Inference: the model runs on the edge device and produces a class, a bounding box or a mask.
  4. Decision: pass or fail, with a confidence threshold and a route for uncertain parts.
  5. Action: the result goes to the PLC over EtherNet/IP, Profinet or digital I/O, which rejects the part.
  6. Data: images and results stored for retraining and for the quality record.
The edge vision pipeline
The edge vision pipeline

Hardware that runs at the edge

  • Smart cameras with built-in deep learning: Cognex In-Sight with ViDi, Keyence, Zebra. Simplest to deploy, licensed per tool.
  • Industrial PCs with a GPU running a vision runtime: NVIDIA Jetson modules in industrial housings, or an IPC with an RTX card. Most flexible.
  • Vision controllers from Basler, Omron and Sick that pair a camera with an inference unit.

Latency of 20 to 100 ms per image is typical; a line at 60 parts a minute leaves a whole second per part.

Software and models

  • Vendor tools (Cognex ViDi, Keyence AI, Zebra Aurora) train on your images with no code.
  • Open frameworks: PyTorch or TensorFlow with YOLO for detection, segmentation models for defects, exported to ONNX or TensorRT for the edge. The Python for automation engineers path leads here.
  • Anomaly-style models such as PaDiM and PatchCore learn from good parts only, which matters when defects are rare.

Connecting to the PLC

The vision system is a device on the network like any other. Typical exchange over EtherNet/IP or Profinet: PLC to vision, trigger and recipe number; vision to PLC, result, confidence, inspection complete, error. The PLC keeps the timing and the reject mechanism, as in any Studio 5000 or TIA Portal project, and the vision system never controls an actuator directly.

Rule-based versus deep-learning vision
Rule-based versus deep-learning vision

A first project that succeeds

Choose a cosmetic inspection that a person does now by eye and that costs money when it is missed. Collect 500 good and 50 bad images under fixed lighting. Train a classification model. Run it in shadow mode beside the human inspector for two weeks and compare. Only then connect the reject. Projects fail when they start with the hardest defect and no data.

AI for factory automation and edge learning in industrial machine vision, by Cognex

Frequently asked questions

Does deep learning replace rule-based vision? No. Measurement, barcode reading and presence checks stay rule-based; deep learning takes the cosmetic and variable defects.

How many images do we need? Hundreds, not millions, for a focused industrial task with consistent lighting.

Who owns the model? The plant should. Keep the images and the training pipeline, or you will pay the vendor every time the product changes.

Start Your Engineering Career at EDWartens

Join as a Junior Engineer at Wartens Automation Pvt Ltd. Get hands-on PLC SCADA training, industry certifications, and a 100% Job Guarantee backed by a 100% refund policy.