A welding penetration prediction model for laser welding process based on self-supervised learning using physics-informed neural networks
By Sen Li, Xiaoying Liu, Xiaojian Xu, Chendong Shao, Yaqi Wang, Ling Lan, Xinhua Tang, Haichao Cui
"SimPhysNet uses self-supervised contrastive learning with physics-informed neural networks to predict laser welding penetration, achieving 96% accuracy using only 5% of labels."
Abstract
The laser welding full-penetration is of critical importance, as it constitutes one of the fundamental factors in achieving defect-free welded joints. Accurate prediction of the penetration state is therefore essential for ensuring weld quality. To this end, this paper introduces SimPhysNet, a novel algorithm that achieves high classification accuracy in laser welding penetration prediction using only a limited number of labelled images. This approach effectively overcomes the limitations of supervised learning classification algorithms, which are hindered in industrial applications by their dependence on extensive, high-quality labelled data. The core of SimPhysNet is a unique self-supervised learning paradigm that embeds physical priors into a contrastive learning framework. By incorporating a physics-informed neural network (PINN), the model is guided to extract physically meaningful features of the molten pool and keyhole from a large set of unlabelled data, while three image augmentation tasks further enhance its generalization capabilities. Subsequently, a few-shot learning strategy, based on prototypical networks, enables robust classification by constructing class representations from a minimal set of labelled images. Experimental results demonstrate that SimPhysNet achieves a classification accuracy of 96.06% using only 200 labelled images (approximately 5% of the total labelled dataset), which is comparable to the performance of conventional supervised learning algorithms that utilize the entire labelled dataset. This work presents a new, efficient, and highly accurate method, providing the way for the intelligent automation of laser welding.
Technical Analysis & Implementation
Technical Breakdown§
Core Methodology§
SimPhysNet combines self-supervised contrastive learning with physics-informed priors to extract meaningful features from molten pool and keyhole images, followed by few-shot classification via prototypical networks.
Architecture§
1. Encoder (e.g., ResNet-18) maps images to feature vectors $z = f_\theta(x)$. 2. Physics-Informed Regularization: A PINN loss enforces physical consistency (e.g., heat transfer, fluid dynamics) on the latent representation: $$\mathcal{L}_{PINN} = \| \frac{\partial T}{\partial t} - \alpha \nabla^2 T \|^2$$ where $T$ is simulated temperature field from latent $z$. 3. Contrastive Learning: Augmented views $(x_i, x_j)$ are pulled together via NT-Xent loss: $$\mathcal{L}_{CL} = -\log \frac{\exp(\text{sim}(z_i, z_j)/\tau)}{\sum_{k \neq i} \exp(\text{sim}(z_i, z_k)/\tau)}$$ 4. Few-Shot Classification: Prototypical networks compute class prototypes $c_k = \frac{1}{|S_k|} \sum_{(x,y) \in S_k} f_\theta(x)$ from support set $S$, then classify query $x_q$ via softmax over distances: $$p(y=k|x_q) = \frac{\exp(-\|f_\theta(x_q) - c_k\|)}{\sum_j \exp(-\|f_\theta(x_q) - c_j\|)}$$
Implementation Details§
- Backbone: ResNet-18 pretrained on ImageNet, then fine-tuned.
- Augmentations: random crop, color jitter, Gaussian blur, and three task-specific augmentations (simulating varying laser power, speed, etc.).
- Training: 200 labeled images for few-shot, remaining unlabeled for self-supervised.
PyTorch Code Snippet§
import torch
import torch.nn as nn
import torch.nn.functional as F
class SimPhysNet(nn.Module):
def __init__(self, backbone, latent_dim=128):
super().__init__()
self.encoder = backbone
self.projection = nn.Sequential(
nn.Linear(backbone.fc.in_features, 256),
nn.ReLU(),
nn.Linear(256, latent_dim)
)
self.pinn_head = nn.Linear(latent_dim, 64) # predicts physical params
def forward(self, x):
features = self.encoder(x)
z = self.projection(features)
return z, self.pinn_head(z)
# Contrastive loss
def nt_xent_loss(z1, z2, temperature=0.5):
batch_size = z1.size(0)
z = torch.cat([z1, z2], dim=0)
sim = F.cosine_similarity(z.unsqueeze(1), z.unsqueeze(0), dim=2)
sim = sim / temperature
mask = torch.eye(2*batch_size).to(z.device)
sim = sim - mask * 1e9 # exclude self-similarity
labels = torch.cat([torch.arange(batch_size), torch.arange(batch_size)]).to(z.device)
loss = F.cross_entropy(sim, labels)
return loss
# Prototypical loss
def prototypical_loss(support, query, support_labels, n_classes):
prototypes = torch.stack([support[support_labels==c].mean(0) for c in range(n_classes)])
dists = torch.cdist(query, prototypes)
logits = -dists
return F.cross_entropy(logits, torch.arange(n_classes).repeat(len(query)//n_classes))Results§
- Accuracy: 96.06% with only 200 labeled images (5% of total).
- Comparable to supervised SoTA using full dataset.