In this work, the complete framework of a visual inspection system for EV battery pack modules is presented. The EV battery pack is composed of multiple cells and modules, and its quality directly determines the safety and performance of electric vehicles. During manufacturing, defects such as scratches, pits, spatters, and excessive assembly gaps on the cover can appear on the metal casing. These defects not only degrade the appearance but also threaten the structural integrity and durability of the EV battery pack. Traditional manual inspection is subjective and inefficient; therefore, an automated machine-vision solution is essential.
Our approach fuses three-dimensional scanning, point cloud pre-processing, deep neural networks, and support vector machines to identify defects on EV battery pack surfaces. For the surface defects, a structured-light 3D camera acquires the profile of the EV battery pack and generates three-dimensional point clouds. By using a novel RGB-depth mapping model, the point cloud is converted into colour-coded two-dimensional images that retain height information. Then a lightweight convolutional neural network based on GhostNet, denoted as ND-GhostNet, is developed to classify scratches, pits, and welding spatters.
For the cover gap issue, a line-laser image obtained from the same camera module is processed with digital filtering and threshold segmentation. The binary image of the laser stripe is fed to a support vector machine (SVM) classifier with a fused kernel to distinguish qualified covers from oversize gaps. Experimental validation confirms that the proposed methods achieve an accuracy of 99.2% in surface-defect classification and 99.0% in gap classification, while the processing speed satisfies industrial online inspection requirements.
This chapter is organized as follows: the overall hardware design, the ND-GhostNet-based surface defect recognition method, the SVM-based cover gap inspection method, the experimental setup and results, and finally a conclusion. The target of this project is the online inspection of EV battery pack modules, especially the outer metallic housing and the top cover sealing area.
System Design and Hardware Platform
To inspect an EV battery pack automatically, a measurement station was designed with three main functional modules: image acquisition, pre-processing, and analysis. The image acquisition module uses a three-dimensional line-structure-light camera, a conveyor equipped with servo motors, and a programmable logic controller to handle triggering and synchronization. Pre-processing includes depth mapping, image denoising, threshold segmentation, and region-of-interest extraction. Analysis module utilizes two classifiers: one is a lightweight convolutional neural network for surface defects; the other is a support vector machine for gap classification.
The measurement object is a commercial EV battery pack module whose nominal dimensions are 659.4 mm in length, 175.2 mm in width, and 208.6 mm in height. The module surface is made of stamped aluminium alloy with high reflectivity. Defects to be detected are defined in Table 1.
| Defect type | Characteristics | Quantitative criterion |
|---|---|---|
| Scratch | Elongated groove with distinct depth variation | Length > 5 mm, width > 1 mm, depth > 0.5 mm |
| Pit / crater | Localized depression, circular or oval | Diameter > 1 mm, depth > 1 mm |
| Weld spatter | Elevated droplet adhered to the surface | Diameter > 0.5 mm, height > 0.5 mm |
| Cover gap | Excessive space between cover and housing | maximum width > 1.5 mm |
The visual inspection system is built around the principle of the laser-triangulation method. Two configurations are available: oblique incidence and direct incidence. In our system we use the direct incidence method because it offers a compact sensor head and reliable depth response for specular surfaces. The geometrical relation of direct triangulation is shown by the following equations.
$$ \frac{\sin(\alpha_1)}{\sin(\alpha_2)} = \frac{\text{object height}}{\text{image displacement}} \tag{1} $$
$$ x(z) = \frac{d \, y \sin(\alpha)}{f – y \cos(\alpha)} \tag{2} $$
Equations (1) and (2) are fundamental in computing the surface depth from the lateral displacement of a laser spot on the image sensor.
To choose the camera parameters, we first calculate the allowable tolerance. For the EV battery pack surface height data, the tolerance band is:
$$ T = Z_{\max} – Z_{\min} = 0.6\ \mathrm{mm} \tag{3} $$
$$ R_z = 0.1 \times T = 0.06\ \mathrm{mm} \tag{4} $$
According to the Nyquist-like rule for a small surface feature, the pixel resolution on the x-direction should be at least half of the smallest defect width. Here the minimum defect width is 1 mm, and we set the required resolution to 120 μm per pixel. By substituting the module width into the magnification formula, we obtain the field of view and depth resolution. Based on these calculations, the camera module Hikrobot MV-DP2312-03H was selected. The parameters are listed in Table 2.
| Parameter | Value |
|---|---|
| Points per profile | 2048 |
| Near field of view | 131 mm |
| Far field of view | 450 mm |
| Clearance distance (CD) | 220 mm |
| Measurement range (MR) | 618 mm |
| ×-axis resolution | 64.4–219.9 μm |
| Z-axis resolution | 15.74–183.19 μm |
| Z-axis repeatability | 2.0 μm |
| Scan frequency | 700 Hz (at maximum range), up to 10 kHz |
| Laser wavelength | 650 nm |
| Interface | Gigabit Ethernet |

The motion control subsystem consists of a Mitsubishi servo motor HG-SR202J and its driver MR-J4-200B, plus a Mitsubishi Q-series programmable logic controller. The PLC triggers the camera and performs continuous scanning when the EV battery pack passes the measurement station. The complete hardware layout was assembled on an experimental gantry, where the camera is mounted vertically on a linear axis. A working platform moves the EV battery pack horizontally under the sensor.
Coordinate Systems and Calibration
In the camera model, four coordinate systems are used: pixel coordinates, image coordinates, camera coordinates, and world coordinates. The pixel-coordinate frame and physical image frame are related by:
$$ \begin{bmatrix} u \\ v \\ 1 \end{bmatrix} = \begin{bmatrix} \frac{1}{dx} & 0 & u_0 \\ 0 & \frac{1}{dy} & v_0 \\ 0 & 0 & 1 \end{bmatrix} \begin{bmatrix} x \\ y \\ 1 \end{bmatrix} \tag{5} $$
For the camera coordinate system, the pinhole projection model gives:
$$ Z_c \begin{bmatrix} u \\ v \\ 1 \end{bmatrix} = \mathbf{K} \begin{bmatrix} \mathbf{R} & \mathbf{t} \end{bmatrix} \begin{bmatrix} X_w \\ Y_w \\ Z_w \\ 1 \end{bmatrix} \tag{6} $$
Zhang’s calibration method was adopted to determine the intrinsic matrix $\mathbf{K}$ and the extrinsic parameters. Because the measured EV battery pack surface is almost planar, the world coordinate is set to lie in the $Z_w=0$ plane, which simplifies the homography estimation. A target board is placed on the scanning bed and the extracted corner points provide the solution for internal and external parameters.
The laser plane must also be calibrated because the sensor outputs two-dimensional profiles, and the third coordinate needs to be recovered from the laser-plane equation. We take the bottom plane of a calibration block as the world reference, and a temporary coordinate system is aligned with the laser plane. The transformation between the temporary coordinate system and the world system is obtained by matrix multiplication.
$$ \mathbf{T}_{t}^{w} = \mathbf{T}_{c}^{w} \mathbf{T}_{t}^{c} \tag{7} $$
Laser points are observed on the reference plane at multiple heights, and a plane-fitting process gives the equation of the laser plane in world coordinates:
$$ a x_w + b y_w + c z_w + d = 0 \tag{8} $$
After calibration, the 3D measurement error remains below 0.03 mm, which is satisfactory for detecting the defects of EV battery pack modules.
Surface Defect Detection using ND-GhostNet
Point Cloud Acquisition and Pre-processing
The 3D line-laser camera scans the EV battery pack and produces a set of profiles; each profile consists of 2048 points. When the conveyor moves the pack at a fixed speed, the profiles are assembled into a dense point cloud. An example of the point cloud can be seen in our previous experimental capture, where the surface structure is recorded as $(x,y,z)$ coordinates.
A direct three-dimensional point-cloud comparison is computationally expensive because the iterative closest point (ICP) algorithm requires many iterations and cannot easily meet real-time constraints. We therefore adopt a height-mapping technique to transform the point cloud into a two-dimensional depth image. Two mapping methods are considered: grayscale mapping and RGB-depth mapping. The grayscale value of each pixel encodes the normalized height information as follows:
$$ \text{Gray} = \text{Round}(\frac{Z_i – Z_{\max}}{Z_{\max} – Z_{\min}} \times 255) \tag{9} $$
However, the grayscale representation has only 256 quantization levels, and subtle defects become difficult to distinguish for highly reflective EV battery pack surfaces. To improve the contrast, a new RGB-D mapping model is introduced. The mapped colour space is designed to express the height continuously over 66 discrete colour levels. Table 3 shows a few orders of the colour mapping table.
| Order | R | G | B | Order | R | G | B |
|---|---|---|---|---|---|---|---|
| 1 | 0 | 0 | 112 | 34 | 128 | 255 | 128 |
| 2 | 0 | 0 | 128 | 35 | 144 | 255 | 112 |
| 3 | 0 | 0 | 144 | 36 | 160 | 255 | 96 |
| 4 | 0 | 0 | 160 | 37 | 176 | 255 | 80 |
| 5 | 0 | 0 | 176 | 38 | 192 | 255 | 64 |
| 10 | 0 | 0 | 255 | 43 | 255 | 240 | 0 |
Quantization is performed as follows: the relative height is divided into 66 intervals; each interval corresponds to a colour in the RGB-D table. This colour table covers a colour circle from blue (low) to cyan, green, yellow, and red (high). Compared to a grayscale image, the RGB-D image expresses curved surfaces with more distinguishable color regions and preserves the depth discontinuities around bumps and pits.
To transform sampled point coordinates into a dense image, a bilinear interpolation method is used. The coordinate transformation can be written as:
$$ \begin{aligned} x_i &= \text{int}(\frac{x_p}{\Delta x}) \\ y_i &= \text{int}(\frac{y_p}{\Delta y}) \end{aligned} \tag{10} $$
After mapping the points to a regular grid, the missing pixel values are interpolated by:
$$ v(A,B) = \sum_{i=1}^2 \sum_{j=1}^2 w_{ij} v_{ij} \tag{11} $$
where $w_{ij}$ are bilinear weighting factors determined by the fractional coordinate of the target pixel. For point clouds with variable density, a modified bilinear interpolation is used, which first replaces each point with the height value of its nearest grid cell and then fills empty cells by adaptive window filtering. The adaptive kernel is calculated based on the local intensity statistics, so that edges of scratches and pits are not over-smoothed.
In our implementation, the upper surface of the cover plate is mapped to the low-end colour of the RGB-D scale, while the highest point in the profile is mapped to the high-end colour. The resulting RGB-D image shows defects such as pits and scratches as colour anomalies that are highly detectable by the neural network.
Data Augmentation
After the point-cloud pre-processing step, we collected an initial dataset of 200 defect images. Training a deep convolutional network with only 200 images suffers from severe over-fitting. To overcome this problem, we apply data augmentation both by traditional geometric transforms and by a grid-based elastic deformation. Traditional methods include rotation, flipping, and scaling, but their diversity is limited. Therefore, a random grid elastic transform is introduced. A regular mesh of size $8 \times 8$ is superimposed on the original image and the displacement vector at each grid point is sampled from a Gaussian distribution with zero mean and standard derivation of three pixels. Then the displacement field is smoothed by a Gaussian filter and interpolated over the whole image. The mathematical description of the deformed pixel $(x’,y’)$ follows:
$$ \begin{pmatrix} x’ \\ y’ \end{pmatrix} = \begin{pmatrix} x \\ y \end{pmatrix} + \alpha \cdot \mathcal{G}_{\sigma} \ast \begin{pmatrix} \Delta x_g \\ \Delta y_g \end{pmatrix} \tag{12} $$
where $\alpha$ is an intensity factor, $\mathcal{G}_{\sigma}$ is the Gaussian kernel, and $\Delta x_g, \Delta y_g$ are random grid displacements. The same deformation is applied to the label masks, so the annotation remains exactly aligned. This augmentation generated 2000 additional images, increasing the total dataset to 2000 images. The final dataset was sorted into three classes: scratch, pit, and spatter. The distribution is given in Table 4.
| Class | Total | Training | Validation | Testing |
|---|---|---|---|---|
| Scratch | 697 | 419 | 139 | 139 |
| Pit | 643 | 385 | 129 | 129 |
| Spatter | 660 | 396 | 132 | 132 |
ND-GhostNet Architecture
For online detection, the network must be lightweight. GhostNet generates more feature maps from cheap linear operations, which reduces parameters sharply. The original GhostNet uses a Squeeze-and-Excitation (SE) attention block. In our implementation, we replace SE with the normalization-based attention module (NAM), which exploits the scaling factors from batch normalization to evaluate the importance of each channel without adding fully connected layers or large convolutions. The NAM module has two branches: channel attention and spatial attention. Given a feature map $\mathbf{F}$, the scaling factor $\gamma$ is obtained from Batch Normalization:
$$\hat{\mathbf{F}} = \frac{\mathbf{F} – \mu}{\sqrt{\sigma^2 + \epsilon}} \gamma + \beta \tag{13}$$
The channel attention weight is computed from the normalized scaling factors:
$$ M_c = \sigma(\mathbf{W}_\gamma (\hat{\mathbf{F}})) \tag{14} $$
Similarly, the spatial attention weight is computed from normalization across the channel dimension:
$$ M_s = \sigma(\mathbf{W}_\lambda (\hat{\mathbf{F}})) \tag{15} $$
where $\sigma$ is the sigmoid function. The overall attention operation can be expressed as:
$$ \mathbf{F}_{out} = M_c(\mathbf{F}) \cdot \mathbf{F} + M_s(\mathbf{F}) \cdot \mathbf{F} \tag{16} $$
Another modification is the activation function. The original GhostNet uses ReLU, which discards all negative features. For defects with subtle height differences, the negative values in the feature maps can be informative. We instead use the Mish activation function:
$$ \text{Mish}(x) = x \cdot \tanh(\ln(1 + e^x)) \tag{17} $$
Mish is smooth and non-monotonic, preserving small negative values and improving the gradient flow.
The main building block of our network is a dynamic convolution module (DyConv). Rather than using a fixed kernel, DyConv aggregates multiple parallel convolution kernels through an attention mechanism. In the proposed normalized dynamic convolution (NDConv), the attention weight is obtained by NAM. Let a group of $k$ convolution kernels be $\{\mathbf{K}_1,\dots,\mathbf{K}_k\}$; the dynamic weight $w_i$ is generated by:
$$ w_i = \text{Softmax}(\text{NAM}(\mathbf{F})_i) \tag{18} $$
The equivalent convolution kernel is:
$$ \mathbf{K}_{dy} = \sum_{i=1}^k w_i \cdot \mathbf{K}_i \tag{19} $$
Then the output feature map is:
$$ \mathbf{O} = \text{Mish}(\text{BN}(\mathbf{F} \ast \mathbf{K}_{dy})) \tag{20} $$
where $\ast$ denotes convolution. The dynamic kernel creates data-dependent operations that improve adaptability without a significant increase in parameters.
The proposed network is called ND-GhostNet because it replaces the standard convolution by NDConv in certain locations, and additionally uses NAM attention to boost feature selection. For input images of size $128 \times 128 \times 3$, the core structure is listed in Table 5.
| Layer | Input size | Output channels | Stride |
|---|---|---|---|
| NDConv | 128×128×3 | 16 | 2 |
| G-Bneck | 64×64×16 | 16 | 1 |
| G-Bneck | 64×64×16 | 24 | 2 |
| G-Bneck | 32×32×24 | 40 | 1 |
| G-Bneck | 32×32×40 | 40 | 2 |
| G-Bneck | 16×16×40 | 48 | 1 |
| G-Bneck | 16×16×48 | 48 | 2 |
| G-Bneck | 8×8×48 | 96 | 1 |
| G-Bneck | 8×8×96 | 96 | 2 |
| NDConv | 4×4×96 | 96 | 1 |
| Average pooling | 4×4×96 | 1 | — |
| NDConv | 1×1×96 | 96 | 1 |
| FC | 1×1×96 | 3 | — |
The lightweight bottleneck A and bottleneck B are used for different stride conditions. For stride 1, the input feature map goes through Ghost module 1, Mish activation, an intermediate NAM attention, another Ghost module 2, and then is added to the input by a residual connection. For stride 2, a depthwise NDConv is applied after Ghost module 1 for spatial down-sampling. This bottleneck structure preserves the high resolution while gradually increasing the number of channels.
Ablation Studies and Comparisons
To validate the effect of each component, an ablation experiment was performed on the EV battery pack surface-defect dataset. Table 6 presents the accuracy and parameter count of several configurations.
| Model configuration | Param. (M) | Accuracy (%) |
|---|---|---|
| GhostNet baseline | 3.26 | 96.8 |
| GhostNet + DyConv | 3.49 | 98.2 |
| GhostNet + DyConv + Mish | 3.50 | 98.5 |
| GhostNet + DyConv + NAM | 3.54 | 99.0 |
| ND-GhostNet (all improvements) | 3.57 | 99.2 |
From Table 6, each component contributes positively. Dynamic convolution improves the classification by 1.4% at the cost of 0.23M additional parameters. Mish increases the accuracy by another 0.3%, and NAM attention brings a significant gain, improving the accuracy from 98.2% or from 98.5% to over 99.0%. The combined ND-GhostNet achieves the highest accuracy of 99.2%, with only 3.57M parameters, making it suitable for real-time industrial inspection of EV battery pack surfaces.
The loss and accuracy curves are not shown here to avoid using images with numbers. Instead, the final comparison against two other lightweight networks is summarised in Table 7.
| Model | Parameters | FLOPS (G) | Inference time | Error (%) | Accuracy (%) |
|---|---|---|---|---|---|
| MobileNetV3 | 2.91M | 49.45 | 18 ms | 4.6 | 95.4 |
| ShuffleNetV2 | 2.35M | 46.23 | 15 ms | 3.2 | 96.8 |
| GhostNet | 3.26M | 47.51 | 17 ms | 2.2 | 96.8 |
| ND-GhostNet | 3.59M | 48.14 | 20 ms | 0.8 | 99.2 |
Although ND-GhostNet has the longest inference time of 20 ms among the tested models, the difference is only 5 ms relative to the fastest model, ShuffleNetV2. However, the error rate of ND-GhostNet is significantly lower. This method satisfies the real-time requirement for detecting three categories of faults on EV battery pack modules, and it provides the best balance between effectiveness and efficiency.
Cover Gap Detection based on SVM
The sealing state of the EV battery pack cover is inspected by illuminating the edge line with a line laser and recording the deformation of the laser stripe. A qualified cover has a narrow and continuous gap below the cover, while an unqualified cover shows an excessive gap or a discontinuity. For this binary classification problem, a specialized method is required because only a small number of samples are available. A Convolutional Neural Network trained from scratch would easily overfit with limited data. In such cases, Support Vector Machine (SVM) is preferable, as it generalizes well on small datasets and facilitates different kernel designs.
Image Acquisition and Filtering
Images of the laser stripe are captured using the same three-dimensional line-structure-light camera when the laser is triggered in the “laser-line” mode. Here the camera acts as a two-dimensional grayscale camera. The light source is the built-in class 3R laser. To reduce noise, four filter methods were compared: mean, Gaussian, median, and bilateral filters. The mathematical expressions are described by Equations (21)–(24).
Mean filter with a mask of size $(2k+1)\times(2k+1)$:
$$ g(i,j) = \frac{1}{(2k+1)^2} \sum_{m=-k}^k \sum_{n=-k}^k f(i+m, j+n) \tag{21} $$
Gaussian filter:
$$ g(i,j) = \sum_{m} \sum_{n} \frac{1}{2\pi\sigma^2} e^{-\frac{(x_m^2 + y_n^2)}{2\sigma^2}} f(i+m, j+n) \tag{22} $$
Median filter:
$$ g(i,j) = \text{median}\{ f(i+m, j+n) \ | \ m,n \in [-k,k] \} \tag{23} $$
Bilateral filter:
$$ g(i,j) = \frac{\sum_{m,n} f(i+m,j+n) G_s(m,n) G_r(|f(i+m,j+n)-f(i,j)|)}{\sum_{m,n} G_s(m,n) G_r(\cdot)} \tag{24} $$
Experimental comparison showed that the median filter is the most effective in removing isolated hot pixels caused by laser specular reflection, while preserving the edge profile of the laser stripe. Therefore, a median filter of size $3 \times 3$ is selected.
ROI Extraction and Threshold Segmentation
We first locate the top surface and edge lines of the EV battery pack by extracting the outer contour and determining its bounding rectangle. Then a region of interest is set around the upper and lower edge of the cover. According to the geometric property, a quadrilateral center is used to place the ROI accurately. After the ROI is extracted, the laser stripe is separated from the background by the Otsu global threshold algorithm. Otsu computes the threshold minimizing the intra-class variance. Let the grayscale histogram be divided into two classes by threshold $t$; then the between-class variance is:
$$ \sigma_B^2(t) = \omega_1(t) \omega_2(t) [\mu_1(t) – \mu_2(t)]^2 \tag{25} $$
The optimal threshold is:
$$ t^* = \arg\max_{0 \le t \le 255} \sigma_B^2(t) \tag{26} $$
In our experiment, the optimal threshold is 235 for the laser stripe in the EV battery pack cover region. After applying the threshold, the image is binary: the laser stripe is expressed as white (255) on a black (0) background. Morphological opening is used to remove tiny protrusions and to connect the fragmented stripe.
SVM Feature Extraction
For each binary connected component belonging to the gap area, we calculate a set of features that describe the contour of the laser line. The relevant features are area of the region, perimeter, number of regions, and the seven Hu invariant moments. The $p+q$ order moments are:
$$ m_{pq} = \sum_{x} \sum_{y} x^p y^q f(x,y) \tag{27} $$
The central moments are:
$$ \mu_{pq} = \sum_x \sum_y (x – \bar{x})^p (y – \bar{y})^q f(x,y) \tag{28} $$
where $(\bar{x},\bar{y})$ are the coordinates of the region centroid. Then the normalized central moments are:
$$ \eta_{pq} = \frac{\mu_{pq}}{\mu_{00}^{(p+q)/2 + 1}} \tag{29} $$
The seven invariant moments $h_1$ to $h_7$ are computed according to the standard Hu moment formulas. For example, the first two are:
$$ h_1 = \eta_{20} + \eta_{02} \tag{30} $$
$$ h_2 = (\eta_{20} – \eta_{02})^2 + 4 \eta_{11}^2 \tag{31} $$
These features are rotation, scaling, and translation invariant. For the EV battery pack cover, qualified and unqualified parts have obvious statistical differences in area and perimeter because the oversized laser lines increase the connected component size. Table 8 lists examples of the extracted feature values from test images.
| Sample | Area | Perimeter | Regions | $h_1$ | $h_2$ | $h_3$ | $h_4$ |
|---|---|---|---|---|---|---|---|
| Qualified | 7747 | 1489.2 | 2 | -0.525 | -1.029 | 0.221 | 0.969 |
| Oversized gap | 9255 | 1624.1 | 4 | -0.519 | -1.020 | 0.045 | 0.979 |
Fused Kernel SVM
The core of SVM is to find the maximum margin between the training classes. In a two-class problem, if the input vectors are $\mathbf{x}_i \in \mathbb{R}^d$, the decision function of SVM is:
$$ f(\mathbf{x}) = \text{sign}\left( \sum_{i=1}^N \alpha_i y_i K(\mathbf{x}_i, \mathbf{x}) + b \right) \tag{32} $$
where $\alpha_i$ are Lagrange multipliers, $y_i$ are class labels, and $K(\mathbf{x}_i,\mathbf{x})$ is a kernel function meeting Mercer’s theorem. Various single kernels have strengths and weaknesses. The Gaussian radial basis function (RBF) kernel is:
$$ K_{RBF}(\mathbf{x},\mathbf{y}) = \exp\left( -\frac{\|\mathbf{x}-\mathbf{y}\|^2}{2\sigma^2} \right) \tag{33} $$
This kernel captures local interactions, but it may not generalize well if only a small number of support vectors are present. The Sigmoid kernel:
$$ K_{Sigmoid}(\mathbf{x},\mathbf{y}) = \tanh\left(\gamma\, \mathbf{x}^{\mathsf{T}} \mathbf{y} + b\right) \tag{34} $$
behaves like a two-layer neural network and has global approximation capability. To exploit both local and global properties, we build a fused kernel as a convex combination of the RBF and Sigmoid kernels:
$$ K_{fused}(\mathbf{x},\mathbf{y}) = \mu_1 \exp\left(-\frac{\|\mathbf{x}-\mathbf{y}\|^2}{2\sigma^2}\right) + (1-\mu_1)\tanh(\gamma\, \mathbf{x}^{\mathsf{T}} \mathbf{y} + b) \tag{35} $$
with $0 \le \mu_1 \le 1$. Because a convex combination of valid kernels is still a valid kernel, the fused kernel satisfies Mercer’s condition. The parameter set $\theta = \{\sigma, \gamma, b, \mu_1\}$ was optimized by a grid search on the training set. Table 9 gives the best values.
| Parameter | Value |
|---|---|
| $\gamma$ | 0.004 |
| $b$ | 0 |
| $\sigma$ | 0.006 |
| $\mu_1$ | 0.812 |
The weight $\mu_1 = 0.812$ indicates that the RBF component plays a dominant role, but the 18.8% contribution from the Sigmoid component enlarges the feature representation and stabilizes the decision boundary.
Experimental Validation and Software System
Evaluation Metrics
To measure the performance of the inspected EV battery pack module, the accuracy of each class is calculated as the ratio of correctly classified samples to all samples. For binary classification, we report the accuracy on qualified and unqualified cover images. We also report the detection efficiency in milliseconds per image, which is important for online production lines.
The test environment is an industrial computer equipped with an Intel Core i5-9400 CPU, 16 GB RAM, an NVIDIA GeForce GTX 4090 graphics card, and the detection algorithms are implemented in Python using TensorFlow 2.0 and OpenCV 4.0. The software was developed with Visual Studio, providing a control panel that shows the live camera feed, decision results, and statistics in a tabular interface.
Results on Surface Defect Classifiers
According to Section 3, the point cloud of the EV battery pack is mapped to an RGB-D image. The network is trained with 50 epochs, a batch size of 40, and an initial learning rate of $1\times 10^{-4}$ that decays when the validation loss stops decreasing. Both loss and accuracy curves converge well. The final model is evaluated on the testing subset with 400 images. The confusion matrix yields the overall test accuracy of 99.2%. The per-class results are shown in Table 10.
| Actual class | Scratch | Pit | Spatter | Recall |
|---|---|---|---|---|
| Scratch | 139 | 0 | 0 | 100% |
| Pit | 1 | 127 | 1 | 98.4% |
| Spatter | 0 | 1 | 131 | 99.2% |
The misclassification between pit and spatter primarily occurs when very small defects are located near edges. Nonetheless, the low error of only three images confirms the robustness of ND-GhostNet for EV battery pack surface defects.
Results on Cover Gap Classifier
For the cover gap detection task, we collected 800 images (400 qualified and 400 unqualified). A 60/40 split gives 480 training samples and 320 testing samples. We trained an SVM equipped with several kernel choices: linear, RBF, Sigmoid, and the proposed fused kernel. Table 11 compares the performance.
| Method | Accuracy on qualified | Accuracy on unqualified | Overall accuracy | Time (ms) |
|---|---|---|---|---|
| Linear kernel SVM | 95.5% | 94.6% | 95.0% | 7 |
| Sigmoid kernel SVM | 97.5% | 96.5% | 97.1% | 9 |
| RBF kernel SVM | 98.5% | 99.0% | 98.8% | 11 |
| Fused kernel SVM | 99.3% | 98.8% | 99.0% | 12 |
| GhostNet | 99.0% | 98.5% | 98.8% | 19 |
From Table 11, the fused kernel SVM outperforms single-kernel SVM. The overall accuracies of 95.0%, 97.1%, and 98.8% for the linear, Sigmoid, and RBF kernels, respectively, are improved to 99.0% by the fused kernel. The detection time of 12 ms is comparable to other SVM realizations and is much faster than the 19 ms of GhostNet. For a binary and simple gap problem, the proposed SVM model offers the best trade-off between speed and accuracy.
System Integration
The overall system is controlled by a graphical interface consisting of three major panels. The left panel displays the real-time acquisition. The middle panel shows the processed image and the classification result. The right panel summarizes the statistics, including the total number of parts, the qualified parts, and the defective parts with each defect type. The detection software also saves the images and results to an Excel file for offline traceability.
The measurement process of the EV battery pack inspection is as follows. First, the EV battery pack is placed on a conveyor. After the start signal, the PLC triggers the motion driver to move the scanning platform. The 3D line-laser camera acquires a series of profiles at regular intervals. For surface-defect detection, the assembled point cloud is processed by the RGB-D mapping and fed to the ND-GhostNet classifier. For cover-gap detection, the camera is set to the 2D laser mode, and the captured laser-stripe images are processed with filter and segmentation before being passed to the fused-kernel SVM. The final output consolidates the results of the two modules and shows “OK” or “NG” status. In the case of NG, an alarm signal is sent to the PLC, which activates the sorting device.
One important criterion for the EV battery pack is the ability to avoid false alarms caused by ambient illumination. The line-structure light sensor is configured with an optical band-pass filter synchronized with the 650 nm laser. The narrow-band property suppresses most ambient light, ensuring stable scan results regardless of the surrounding lighting condition. The laser safety class is class 3R, and the system is enclosed with protective covers to guarantee operator safety.
In addition, we verified that the depth resolution of the sensor, about 16 μm at the operating range, is sufficiently high for detecting submillimeter scratches. The final measured repeatability of the platform is within 0.06 mm in the Z direction, which is in agreement with the tolerance requirements listed in Table 1.
Conclusion and Outlook
This study established a complete machine-vision-based inspection system for detecting three types of surface defects and the cover-gap fault of EV battery pack modules. For the surface detection, we proposed the ND-GhostNet neural network. The point cloud acquired from a three-dimensional line-structured-light camera is transformed into an RGB-D image by a height-mapping model and bilinear interpolation, which allows the network to see both the topology and the depth gradient of the surface. In addition, grid-based elastic deformation expands the dataset and improves robustness. The dynamic convolution layer, the normalization-based attention module, and the Mish activation combine to raise the classification accuracy to 99.2% while keeping the model lightweight.
For the cover-gap detection, we made use of the same sensor’s laser-stripe image. After median-filtering and Otsu thresholding, the binary contour is described by geometric and Hu-moment features. A Support Vector Machine using a convex fused kernel of Gaussian radial basis and Sigmoid kernels is then trained. The fused kernel balances local and global characteristics and reaches an overall accuracy of 99.0% with an inference time of only 12 ms. This result demonstrates that a traditional machine-learning pipeline can still be extremely competitive for small-sample binary inspection tasks.
Compared with manual inspection, the proposed system offers consistent and traceable detection on EV battery pack modules. The use of three-dimensional sensing reduces the effect of surface reflectivity and unstable illumination. The online software interface was developed and validated experimentally, proving that the system can run in a production-like environment.
In future studies, more attention should be paid to improving the detection of extremely small anomalies and to expanding the dataset to include newly emerging defect types. The large amount of point-cloud data also opens paths for direct three-dimensional deep-learning detection, which may eliminate the loss of information caused by two-dimensional mapping. In addition, the integration of the proposed system into an industrial network, with digital twin functions, can enhance the intelligent manufacturing of EV battery pack products.
