Using Deep Learning in Spot Welding Applications

banner showing brain with connected nodes overlaid on image of spot weld

Deep learning can help manufacturers detect defective spot welds that undermine the quality of electrical components.

Spot welds are pivotal to the performance of electrical devices because they hold parts together and keep current flowing. Faulty spot welds shorten the useful life of electrical components, leading to expensive returns or repairs, which damage manufacturers’ reputations. Detecting more flaws in the manufacturing stage reduces recall and rework costs.

Humans have considerable ability to detect defective welds, but they have varying consistency and limited availability. They can’t look at every spot weld, all the time. By contrast, automating the inspection of spot welds can capture more flaws and reduce rework costs by revealing upstream problems in your production processes. This gives automation a substantial advantage over relying solely on human inspectors.

Deep learning uses software algorithms and statistical modeling to mimic the workings of the human brain. The algorithms create neural networks optimized to identify anomalies and differentiate between good and bad outcomes. With enough time and data, these networks effectively teach themselves to perform better.

But why should manufacturers deploy deep learning applications to inspect their spot welds? Why not use conventional machine vision systems for spot weld inspections? Mostly, it’s because welds are three-dimensional objects that are inherently ambiguous. No two welds have the same shape or dimensions.

Pin to pin weld, wire to pin/pad weld, wire to wire weld

(Different types of spot welds, from left to right: pin to pin, wire to pin/pad, wire to wire)

A rules-based machine vision system uses software to identify specific details on a digital image — like a serial number on an engine block or the edges of a steel component. It particularly works great when you have components with nearly identical characteristics.

With spot welds, each lump of metal has slightly different dimensions. This makes it prohibitively complex to create a rules-based machine-vision system for inspecting the massive volume of spot welds used on an assembly line.

A deep learning inspection application overcomes this challenge by comparing images of defective spot welds to images of defect-free welds. One set of images trains the neural network to scan for known flaws while another set of validation images provides a basis for comparison.

Three images of good spot welds

Good spot welds

Spot weld with pitting, undersized spot weld, oversized spot weld

Bad spot welds, from left to right: pitting, undersized, oversized

How Vision Software Works in Spot Weld Inspections

Cognex developed the VisionPro® software suite to simplify the automation of manufacturing processes like spot weld inspections. VisionPro software has two core tools that work well in spot weld inspection applications:

  • Red Analyze Tool, which identifies defects so you can remove them from the production process
  • Green Classify Tool, which creates classes of defects that help you improve process quality and accuracy upstream from the point of inspection.

Using the Red Analyze Tool

The Red Analyze tool finds anomalies on digital images of spot welds. Users determine what a correct image looks like and flag any deviations from the correct image. One set of images trains the neural network to recognize flawed spot welds. A second set of validation images is withheld from the training database. These validation images help the software establish the “ground truth” of what good and bad spot welds look like.

The Red Analyze tool has two training modes:

  • Supervised: In supervised mode (as described above), users take pictures of welds, narrow in on flaws or anomalies, document each kind of flaw, and give it a label that tells the software “this is a defect.”
  • Unsupervised. In unsupervised mode, users start with an image that has no flaws or anomalies and label it as “good.” Any image that departs from this base is presumed to identify a defect.

Labels from these modes produce training images for the neural network within VisionPro. In an inspection, the software analyzes an image of a weld on the production line. The deep neural network compares this on-line production image to the trained validation images to determine if the weld passes or fails the inspection.

Using the Green Classify Tool

The Green Classify tool creates classes of flaws or anomalies that are used to diagnose problems upstream on the production line. For instance, welds that are too flat or oddly shaped may reveal a malfunction in a welding machine. With the classify tool, users label these artifacts and instruct the inspection system to flag the defect and inform welding machine operators about the error.
Like the Red Analyze tool, Green Classify has two training modes:

  • Scene classification. With scene classifications, users label images as good or bad and then add tags to document a defect like pitting or improper shape.
  • Individual defect classification. With individual classifications, users take images and result data from the Red Analyze tool and use it to classify specific defects or defect regions.

Flow diagram showing process for classifying defects individually and by scene

Process flow for scene and individual defect classifications

Once users classify the images, the neural network compares the classes to validation images and returns the correct type of defect.

The Red Analyze and Green Classify tools are often used in sequence. First, Red Analyze detects the presence a flaw or anomaly, then Green Classify assesses the anomaly and determines the type of defect. The resulting output is delivered to the line operator who then decides how to handle the defective product.

3 Decisions that Improve the Success of Deep Learning Applications

Making good decisions at the right time can do a lot to ensure the success of deep learning in spot welding applications. These three decisions are paramount:

1. Weigh the Return on Investment

Automating spot-weld inspections must generate more benefits than costs. Applying deep learning requires investing in software, paying salaries, and purchasing equipment. Moreover, the time required to create, test, and implement the system generates costs. Investing in automation should save money or, at the very least, deliver better performance for the same price.
Automating inspections also produces valuable results that might not deliver an explicit ROI such as:

  • Statistical process control. Data reveals problems upstream in the manufacturing process, so they can be fixed sooner.
  • Continuous learning. The more images trained into a deep neural network, the more accurate it becomes over time.
  • Process documentation. Reports on the quality of inspections are easily developed and shared.

2.  Replicate the Production Environment Accurately

The industrial automation cameras used in deep learning inspections need proper lighting and positioning to capture all the critical data in a spot weld. Controlling glare and limiting shadows in digital images make it easier to detect flaws. If the human eye cannot see something on a weld, a deep learning application will not see it either.

Deep learning application development starts in a laboratory and then moves to the factory floor. Of course, it’s almost impossible to completely duplicate a production environment in a lab. Therefore, users will want to take applications out of the lab and start testing them in a production environment as soon as it’s practical.  The deep learning system can take new data from the production line to improve the quality of inspections.

3. Make Labeling Easy and Accurate

Developing a deep learning application for inspecting spot welds requires careful documentation of common flaws like pitting or misshapen welds. Each of these flaws must be labeled accurately and consistently across dozens of images and perhaps hundreds of labels.

The quality of the work completed in the labeling phase affects all results after that. Thus, developers need a system of labeling that’s accurate, consistent, intuitive, and easy to understand — just like the user interface in VisionPro software.

Deep learning technology is ideal for applications with inherent ambiguity. Much like fingerprints and snowflakes, no two spot welds are the same, making them a good candidate for deep learning-based solutions. However, before investing resources into a deep learning system, manufacturers must consider three important factors: ROI, ability to replicate production environments for accurate testing, and ease of labeling training images. 

Fortunately, Cognex provides a solution that addresses all of these – VisionPro. The Red Analyze and Green Classify tools within the software ensure component integrity by first detecting defects and then classifying them. Implementing this software in spot weld applications enables manufacturers to identify detects early in the production stream, preventing costly reworks, delivering higher quality, and instilling consumer confidence in your product.

More Posts on


Join MyCognex


Cognex representatives are available worldwide to support your vision and industrial barcode reading needs.

Contact Us