A cable copper wire surface oxidation defect on-line detection system

By combining multispectral imaging with a lightweight convolutional neural network, the essential features and environmentally relevant features of oxidation defects are separated, solving the problem of insufficient generalization ability of convolutional neural networks in the detection of copper wire oxidation in cables, and achieving stable and efficient detection results.

CN121033012BActive Publication Date: 2026-04-07JIANGXI MEIYUAN CABLE CORP CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-10-27
Publication Date
2026-04-07

AI Technical Summary

Technical Problem

Existing methods for detecting copper wire oxidation defects in cables based on convolutional neural networks are prone to misjudgment or missed detection when the production environment changes, and the model has insufficient generalization ability, which cannot meet the stability and accuracy requirements of industrial applications.

Method used

Employing a multispectral region precise extraction module, a lightweight deep feature extraction module, a spectral feature decoupling module, and a dual-constraint optimization training module, this method combines multispectral imaging with a lightweight convolutional neural network to separate the essential features of oxidation defects from environmentally relevant features. Joint optimization is then performed using a composite loss function to ensure the stability and accuracy of the detection.

Benefits of technology

Stable detection performance was achieved under different production lines and environmental conditions, improving the sensitivity and accuracy of detection, while reducing computational complexity and the number of parameters, ensuring the robustness and efficiency of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121033012B_ABST
    Figure CN121033012B_ABST
Patent Text Reader

Abstract

The application relates to the technical field of industrial visual inspection, and particularly discloses a cable copper wire surface oxidation defect online detection system, which extracts a multispectral pixel block of a copper wire surface through multispectral imaging and image segmentation; extracts deep spectrum-spatial features to obtain an initial feature vector by using a lightweight convolutional neural network; decomposes the initial feature vector into mutually independent defect essential feature components and environment-related feature components by using a feature decoupler; applies a composite loss function containing a classification loss, a decoupling loss and an orthogonal constraint loss to perform joint optimization in a training stage; and only depends on the defect essential feature components to make a classification decision in an inference stage, and links the sorting mechanism to perform a rejection operation.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of industrial visual inspection, and in particular to an online detection system for surface oxidation defects of a copper wire of a cable. BACKGROUND

[0002] In the cable manufacturing industry, copper wire conductors are exposed to air during production and storage, and their surfaces are prone to oxidation, forming an oxide layer. Oxidation can significantly reduce the electrical conductivity, mechanical strength, and long-term safety and reliability of the cable. Therefore, before the copper wire is covered with insulation material, it is crucial to conduct 100% online detection of surface oxidation defects to ensure the quality of the final product. Traditional manual visual sampling methods are inefficient, prone to missed detection, and lack consistency, and cannot meet the needs of modern high-speed continuous production. With the development of machine vision technology, automatic detection methods based on conventional visible light imaging and image processing have been applied. However, the copper wire surface has strong reflection, the oxidation features have low contrast under visible light, and the industrial site environment is complex (such as light fluctuation and background interference), making it difficult for these methods to achieve stability and accuracy to meet industrial application standards.

[0003] The prior art has the following disadvantages:

[0004] Based on deep learning, especially convolutional neural networks (CNN), detection methods show great potential, but they face a fundamental challenge in practical deployment: insufficient model generalization ability. Specifically, because training data is mostly derived from specific production lines or limited environmental conditions, lightweight CNN models are prone to learn "pseudo-features" that are not causally related to oxidation defects, such as specific background textures, lighting patterns, or equipment traces. These pseudo-features are accidentally related to defect labels in the training dataset, making the model perform well in closed testing. However, once the actual production environment experiences minor disturbances not covered by the training set (such as light source aging, equipment replacement, or site changes), the pseudo-features relied on by the model will fail, resulting in large-scale misjudgment or missed detection without warning, and the root cause of the failure is difficult to trace. SUMMARY

[0005] The present application aims to provide an online detection system for surface oxidation defects of a copper wire of a cable to solve the above background problems.

[0006] The object of the present application can be achieved by the following technical solutions:

[0007] An online detection system for surface oxidation defects of a copper wire of a cable, comprising:

[0008] A multispectral region accurate extraction module for obtaining a multispectral image sequence of the copper wire of the cable, processing the multispectral image sequence of the copper wire of the cable, segmenting the surface of the copper wire into a region to be detected, and obtaining a corresponding multispectral pixel block;

[0009] The lightweight deep feature extraction module inputs multispectral pixel blocks into a lightweight convolutional neural network for feature learning. The lightweight convolutional neural network extracts deep spectral-spatial features of the region to be detected through depthwise separable convolution operations and outputs an initial feature vector.

[0010] The spectral feature decoupling module inputs the initial feature vector into the feature decoupler, which decomposes the initial feature vector into two independent feature components: a defect-based feature component that characterizes the oxidation state of the copper wire surface, and an environmentally relevant feature component that characterizes the interference of the imaging environment.

[0011] The dual-constraint optimization training module applies a composite loss function for joint optimization during the training phase of the lightweight convolutional neural network and the feature decoupler. The composite loss function includes: a first constraint term, which is used to ensure that the essential feature components of the defect have high discriminative power for the oxidation defect category; and a second constraint term, which is used to suppress the information related to the defect category in the environmentally relevant feature components, so that they do not have the ability to discriminate defects.

[0012] In the online defect identification and output module, during the inference phase, the system makes classification decisions for oxidation defects based solely on the obtained essential feature components of the defects, outputs the defect classifications, and performs sorting control.

[0013] As a further aspect of the present invention: the segmentation of the detection area on the surface of the copper wire specifically includes:

[0014] For each frame in the multispectral image sequence, the gradient magnitude in multiple bands is calculated, and the gradient magnitudes of each band are fused to generate a comprehensive gradient map that highlights the edge of the copper wire.

[0015] Based on the comprehensive gradient map, the initial outline of the copper wire is obtained in binary form. Then, morphological closing operation is used to fill the interruption and void that may be caused by surface reflection in the initial outline, and a complete copper wire mask is obtained.

[0016] The copper wire mask is mapped back to the original multispectral image sequence, and pixel information of all bands corresponding to the mask area is extracted to form a multispectral pixel block.

[0017] As a further aspect of the present invention: the step of inputting multispectral pixel blocks into a lightweight convolutional neural network for feature learning specifically includes:

[0018] A multi-branch parallel network structure based on depthwise separable convolution is constructed, in which the first branch uses small-sized convolution kernels to focus on the local fine texture of multispectral pixel blocks, and the second branch uses large-sized convolution kernels to capture regional context information.

[0019] The feature maps output from the first and second branches are concatenated along the channel dimension, and the concatenated features are reduced in dimensionality and integrated through a one-to-one convolutional layer to generate a joint feature map that integrates multi-scale information.

[0020] Apply global average pooling to the joint feature map to compress it into an initial feature vector of fixed dimensions.

[0021] As a further aspect of the present invention, the feature decoupling device is implemented as follows:

[0022] The feature decoupler consists of a shared input layer and two parallel fully connected layers.

[0023] The initial feature vector is first input into a shared input layer for preliminary transformation, and then input into two parallel fully connected layers. One fully connected layer is dedicated to generating the essential feature components of defects, and the other fully connected layer is used to generate the environmentally relevant feature components.

[0024] During training, the loss function constrains the vector directions of the defect-essential feature components and the environment-related feature components to be orthogonal in the feature space, so as to make the two components represent unrelated information.

[0025] The outputs of the two parallel fully connected layers are used as the defect-essential feature components and environment-related feature components obtained by final decoupling, respectively.

[0026] As a further aspect of the present invention, the specific implementation process of the orthogonality is as follows:

[0027] Calculate the cosine similarity between the defect essential feature component and the environment-related feature component, and use the square of the cosine similarity as an additional loss term;

[0028] By minimizing the additional loss term, the angle between the two feature components approaches 90 degrees, thus achieving orthogonal operation.

[0029] As a further aspect of the present invention: the specific construction process of the composite loss function is as follows:

[0030] The first loss term is the classification loss, which is calculated based on the difference between the essential feature components of the defect and the true defect label, and aims to minimize the classification error.

[0031] The second loss term is the decoupling loss, which is calculated based on the difference between the environment-related feature components and the true defect labels. Its objective is the opposite of the first loss term, aiming to maximize this difference so that the environment-related feature components cannot be used for correct classification.

[0032] The third loss term is the orthogonal constraint loss, which is calculated based on the correlation between the defect essential feature components and the environment-related feature components. The aim is to minimize this correlation to promote their independence.

[0033] As a further aspect of the present invention: the first loss term, the second loss term, and the third loss term in the composite loss function adopt a dynamic weight adjustment strategy, specifically including:

[0034] The dynamic weight adjustment strategy automatically calculates the weights of each loss term based on their relative size in the current training batch. It focuses on rapid convergence in the early stages of training and on fine decoupling in the later stages.

[0035] As a further aspect of the present invention: the classification decision of oxidation defects based on the obtained defect essential characteristic components specifically includes:

[0036] The essential feature components of the defect are used as the only input and fed into a pre-trained Softmax classifier.

[0037] The Softmax classifier outputs a probability distribution vector, where each element corresponds to the predicted probability of a defect category. The category with the highest probability is determined as the final classification result, and its corresponding probability value is used as the confidence level of this classification.

[0038] The final classification result and its confidence level are output together as the defect classification.

[0039] As a further aspect of the present invention: the sorting control specifically includes:

[0040] For copper wire segments that are determined to have oxidation defects and whose confidence level is higher than the threshold, the system generates a sorting trigger signal.

[0041] Based on the production line speed and the physical distance from the detection point to the sorting execution device, the delay time is calculated to ensure that the sorting signal is issued on time when the corresponding defective copper wire segment arrives at the sorting port.

[0042] A sorting trigger signal controls a sorting execution mechanism to automatically remove defective products from the production line.

[0043] The beneficial effects of this invention are:

[0044] (1) This invention uses a unique spectral feature decoupling technique to actively decompose mixed features into defect-related components and environment-related components, and uses orthogonal constraints and adversarial loss to force the separation of the two during training. This makes the final classification decision rely only on the defect-related features that are insensitive to changes in the environment such as illumination and background, fundamentally overcoming the technical problem of large-scale misjudgment or missed detection when production conditions change due to learning environmental "pseudo-features" in traditional models, and ensuring that the system can maintain stable detection performance at different production lines and at different time points.

[0045] (2) This invention adopts a technical approach that combines multispectral imaging with lightweight convolutional neural networks, which ensures both detection accuracy and processing speed. Multispectral data provides defect information beyond visible light, improving the sensitivity and accuracy of detection; while lightweight CNN and the depthwise separable convolution structure used reduce the computational complexity and number of parameters of the model. Attached Figure Description

[0046] The invention will now be further described with reference to the accompanying drawings.

[0047] Figure 1 This is a flowchart of the system of the present invention. Detailed Implementation

[0048] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0049] Please see Figure 1 As shown, the present invention is an online detection system for oxidation defects on the surface of copper wires in cables, comprising:

[0050] The multispectral region precise extraction module is used to acquire multispectral image sequences of cable copper wires, process the multispectral image sequences of cable copper wires, segment the detection area on the surface of the copper wires, and obtain the corresponding multispectral pixel blocks.

[0051] The lightweight deep feature extraction module inputs multispectral pixel blocks into a lightweight convolutional neural network for feature learning. The lightweight convolutional neural network extracts deep spectral-spatial features of the region to be detected through depthwise separable convolution operations and outputs an initial feature vector.

[0052] The spectral feature decoupling module inputs the initial feature vector into the feature decoupler, which decomposes the initial feature vector into two independent feature components: a defect-based feature component that characterizes the oxidation state of the copper wire surface, and an environmentally relevant feature component that characterizes the interference of the imaging environment.

[0053] The dual-constraint optimization training module applies a composite loss function for joint optimization during the training phase of the lightweight convolutional neural network and the feature decoupler. The composite loss function includes: a first constraint term, which is used to ensure that the essential feature components of the defect have high discriminative power for the oxidation defect category; and a second constraint term, which is used to suppress the information related to the defect category in the environmentally relevant feature components, so that they do not have the ability to discriminate defects.

[0054] In the online defect identification and output module, during the inference phase, the system makes classification decisions for oxidation defects based solely on the obtained essential feature components of the defects, outputs the defect classifications, and performs sorting control.

[0055] In the multispectral region precise extraction module, the core task is to stably and accurately segment the area to be inspected on the surface of the copper wire from the acquired multispectral image sequence, providing accurate input data for subsequent defect analysis. This module processes multispectral image sequences of cable copper wires continuously captured by a multispectral camera along the production line. The multispectral camera acquires images synchronously or sequentially in multiple specific bands (e.g., including but not limited to blue, green, and red light bands within the visible light range, as well as near-infrared bands). The acquisition of the image sequence is typically synchronized with the movement of the production line, using encoder triggering or setting a fixed line frequency to ensure that each frame corresponds to a specific physical segment on the cable, thus achieving seamless inspection. The acquired raw multispectral image data is transmitted to the image processing unit in real time.

[0056] The first step in the module processing is to calculate the gradient magnitude for each frame in the input multispectral image sequence, in each band. The calculation of gradient magnitude aims to highlight areas in the image where pixel grayscale values ​​change drastically, i.e., edge information. For the monochrome image in each band, the Sobel operator, Prewitt operator, or other difference operators can be used for calculation. Specifically, the gradient components in the horizontal and vertical directions are first calculated, and then the gradient components in the two directions are synthesized, usually by calculating their squares and square roots or approximating the sum of their absolute values, thus obtaining the gradient magnitude of each pixel in that band. This step converts the original grayscale image into a gradient magnitude map that can initially reflect the edge information of the copper wire contour.

[0057] After obtaining the gradient magnitude maps for each band separately, this information needs to be fused to generate a composite gradient map. The purpose of fusion is to leverage the complementary advantages of different bands in highlighting the edges of the copper wires, while suppressing noise or edge blurring that may exist in a single band. The fusion operation is performed at the pixel level. One feasible fusion strategy is to take the maximum value of the gradient magnitude of each band at each pixel location. This means that for each pixel in the image, the system compares its corresponding value in all selected band gradient magnitude maps and selects the maximum value as the final value of the composite gradient map for that pixel. This maximum-value strategy ensures that sharp edges presented in any band are preserved in the final composite gradient map, thereby maximizing the highlighting of the boundary between the copper wires and the background.

[0058] After obtaining the composite gradient map, the next step is to obtain the initial outline of the copper wire based on this map. This step is usually achieved through a thresholding algorithm. A fixed global threshold can be used, but to accommodate possible slow changes in illumination, an adaptive thresholding algorithm, such as the Otsu algorithm, is a better choice. This algorithm can automatically determine an optimal threshold based on the grayscale distribution of the image itself. The gradient magnitude of each pixel in the composite gradient map is compared with this threshold. Pixels with a gradient magnitude greater than the threshold are set as foreground (e.g., a pixel value of 255, representing a possible edge point), and pixels with a gradient magnitude less than or equal to the threshold are set as background (e.g., a pixel value of 0). This operation transforms the gradient map of continuous tones into a binary image containing only black and white, where the white connected regions correspond to the initial outline of the copper wire. However, due to the strong specular reflection on the surface of the copper wire, which may cause local interruptions in the gradient values, this initial outline often has breaks or discontinuities.

[0059] To address the issue of initial contour discontinuities, morphological closing operations are applied to the binary image to fill interruptions and holes in the contour. Morphological closing is a combination of dilation and erosion operations. Dilation expands the white area (contour), bridging adjacent minor breaks; the subsequent erosion shrinks the contour to restore its approximate original size while maintaining its continuity. The shape and size of the structuring element are key parameters for the closing effect. Circular or square structuring elements are typically used, and their size should be set based on the relationship between the physical width of the copper wires in the image and the image resolution to ensure effective bridging of typical reflection interruptions without overly smoothing contour details. After closing, a complete and continuous copper wire region mask is obtained.

[0060] The morphologically processed complete copper wire mask is mapped back to the original multispectral image sequence. Specifically, for each band of the original multispectral image, the brightness values ​​of all pixels in the mask identified as the foreground (copper wire region) are extracted. These spatially corresponding sets of pixels extracted from all bands together constitute a multispectral pixel block representing the surface information of that section of the copper wire. This multispectral pixel block contains information on the reflectivity of the copper wire surface in multiple spectral dimensions and removes background interference, providing clean and accurate input data for subsequent defect feature analysis.

[0061] In the lightweight deep feature extraction module, the core is a specially designed lightweight convolutional neural network. The input to this network is a multispectral pixel block generated by the previous module. This pixel block is a three-dimensional data volume whose width and height correspond to the spatial dimensions of the copper wire region in the image, and whose depth (number of channels) corresponds to the number of bands of the multispectral camera used. Before network processing, this pixel block is typically preprocessed by normalization, such as scaling the pixel values ​​of each channel to the range of zero to one, to accelerate the convergence process of network training and improve numerical stability. The main structure of the network is based on depthwise separable convolution, a convolution operation that significantly reduces the number of computational parameters and model complexity by decomposing standard convolution into two steps: depthwise convolution and pointwise convolution.

[0062] The specific operation process of depthwise separable convolution is as follows. First, depthwise convolution is performed. Depthwise convolution uses a set of two-dimensional convolutional kernels, each dedicated to processing a specific channel of the input feature map. The convolutional kernel slides along the spatial dimension of a single channel, calculating the sum of the product of the pixel value and the kernel weight within that channel, thereby generating the feature map corresponding to that channel. The number of such two-dimensional convolutional kernels is equal to the number of channels in the input feature map, with each kernel producing one output channel. After depthwise convolution, the output channels are computationally independent. Next, pointwise convolution is performed. Pointwise convolution uses a set of standard 1x1 convolutional kernels. Each 1x1 kernel linearly combines points at the same spatial location across all channels of the depthwise convolution output, equivalent to cross-channel information fusion. By setting the number of pointwise convolutional kernels, the number of channels in the final output feature map can be controlled. Through this decomposition, depthwise separable convolution significantly reduces model parameters and computational cost, making it very suitable for deployment in industrial online inspection systems with limited computing resources.

[0063] To simultaneously capture both the subtle local textures of oxidation defects on the copper wire surface and broader contextual information, the lightweight convolutional neural network employs a multi-branch parallel structure. This structure primarily comprises two parallel processing branches. The first branch focuses on local details. This branch uses smaller convolutional kernels, such as 3x3 or 5x5 kernels, to extract features from the input multispectral pixel blocks. The smaller receptive field of the small kernels allows them to sensitively perceive and extract fine spectral and texture variations in local areas of the image, such as oxidation spots and subtle discoloration. The second branch aims to capture the contextual information of the region. This branch uses larger convolutional kernels, such as 7x7 or 9x9 kernels, or effectively increases the receptive field by stacking multiple small kernels in conjunction with pooling layers. The larger receptive field allows this branch to perceive contextual information such as the overall illumination distribution and texture orientation of a wider area surrounding the pixel, which helps distinguish between pseudo-defects caused by uneven illumination and genuine oxidation areas. Each branch may contain multiple repeating units consisting of depthwise separable convolutions, activation functions (such as ReLU functions), and batch normalization layers.

[0064] After the two parallel branches process the input multispectral pixel blocks respectively, two sets of feature maps with different receptive fields are obtained. Next, these two sets of feature maps need to be fused. The fusion operation is performed by concatenating along the channel dimension. Specifically, the feature maps output by the first branch and the second branch are directly concatenated along their channel dimensions. For example, if the number of channels in the first branch's output feature map is C1 and the number of channels in the second branch's output feature map is C2, then the number of channels in the resulting joint feature map becomes C1 plus C2. This concatenation operation simply brings together the feature representations learned by different branches, achieving a preliminary integration of multi-scale information.

[0065] The joint feature map obtained after concatenation typically has a high channel dimension, which may contain some redundant information. To reduce the feature dimensionality and further enhance the feature representation capability, a 1x1 convolutional layer needs to be introduced after concatenation. The role of the 1x1 convolutional kernel is to linearly combine and compress information in the channel dimension without changing the spatial size of the feature map. This convolutional layer achieves dimensionality reduction by setting the number of output channels to be less than the number of input joint feature map channels. More importantly, the 1x1 convolutional layer can learn how to optimally fuse feature information from different branches and different scales, thereby generating a more discriminative joint feature map that integrates multi-scale information.

[0066] After obtaining the dimensionality-reduced and optimized joint feature map, it needs to be converted into a fixed-length feature vector for input into subsequent classifiers or feature decoupling modules. This conversion is achieved through global average pooling. The global average pooling layer processes each channel of the joint feature map individually. For a specific channel, this operation calculates the arithmetic mean of the pixel values ​​at all spatial locations (i.e., across the entire width and height) within that channel. This average value is used as the corresponding value for that channel in the final feature vector. Since each channel produces only one scalar value, a joint feature map with C channels will result in a one-dimensional vector of length C after global average pooling. This vector is the initial feature vector. Global average pooling not only forces the network to focus the learned features on the entire detection region, thus possessing a certain degree of spatial translation invariance, but also, compared to fully connected layers, it has no parameters to learn, which helps to further prevent model overfitting and reduce computational cost.

[0067] In the spectral feature decoupling module, the core component is the feature decoupler. This feature decoupler is a small neural network whose input is the initial feature vector passed from the aforementioned module; this vector is a one-dimensional, fixed-length numerical array. The feature decoupler's structure is designed to separate the information flow. It mainly consists of a shared input layer and two parallel, structurally identical fully connected layers. The shared input layer is a fully connected layer whose function is to perform a preliminary, common nonlinear transformation on the initial input feature vector. This transformation maps the original features to a new intermediate feature space that may be more conducive to feature separation. All neurons in this shared input layer are connected to each dimension of the input vector, calculated using weight matrices and bias vectors, and then typically pass through a nonlinear activation function, such as the ReLU function, to introduce nonlinear expressive power. After processing by this shared layer, an intermediate feature vector is obtained.

[0068] Following the shared input layer, the network structure branches into two completely independent parallel paths: two parallel fully connected layers. These two fully connected layers are structurally symmetrical, but they have their own independent weight and bias parameters that need to be learned through network training. One fully connected layer is designated as the defect-based feature branch, whose goal is to learn and generate defect-based feature components. The other fully connected layer is designated as the environment-related feature branch, whose goal is to learn and generate environment-related feature components. The intermediate feature vectors are simultaneously fed into these two parallel fully connected layers. Each fully connected layer performs an independent linear transformation on its input (through its own weight matrix and bias vector) and is typically accompanied by non-linear activation. Due to the different weight parameters, even with the same input, the outputs of the two branches will differ, as they begin to learn to extract different types of information from the shared intermediate representation.

[0069] To ensure that the outputs of the two branches truly represent uncorrelated information—that is, the defect-related feature component and the environment-related feature component are independent—a strong constraint needs to be imposed during network training. The goal of this constraint is to make the vector directions of these two feature components as orthogonal as possible in the feature space. Orthogonality is a concept in linear algebra; if the dot product of two vectors is zero, they are orthogonal, meaning that the angle between them is 90 degrees and they are completely uncorrelated in direction. To achieve this orthogonality constraint, an additional loss term needs to be constructed during training: the orthogonality constraint loss term.

[0070] The specific implementation of the orthogonality constraint is based on calculating the cosine similarity between two feature components. Cosine similarity is an index that measures the similarity of two vectors in direction, with a value ranging from -1 to +1. A value of zero indicates that the two vectors are orthogonal. First, the magnitudes of the defect-related feature component vector and the environment-related feature component vector need to be calculated separately. The magnitude of a vector is the square root of the sum of the squares of its dimensions, representing the length of the vector in space. Next, the dot product of these two vectors is calculated. The dot product operation involves multiplying the values ​​at corresponding positions of the two vectors and then summing all the products. Finally, the cosine similarity is equal to the dot product of the two vectors divided by the product of their respective magnitudes. This calculation reflects the closeness of the two vectors in direction.

[0071] After obtaining the cosine similarity value, it needs to be transformed into an orthogonal constraint loss term that can be used to optimize the network. A common approach is to take the square of the cosine similarity value. The purpose of this is to map the similarity value between negative and positive one to the non-negative interval of zero to one, and when the similarity is zero (i.e., orthogonal), its square is also zero, which aligns with the optimization objective of minimizing the loss function. This squared cosine similarity value is then used as an additional orthogonal constraint loss term and added to the overall loss function of the entire network.

[0072] During training, optimization algorithms such as backpropagation and gradient descent are used to adjust model parameters (including the feature decoupler and the weights of all preceding networks) to minimize the total loss function. Since the total loss function includes this orthogonal constraint loss term, the optimization process automatically adjusts the network parameters to make the cosine similarity between the defect-related feature components and the environment-related feature components as close to zero as possible, i.e., pushing the angle between them towards 90 degrees. Through this continuous optimization pressure, the network gradually learns to decompose the information in the initial input feature vector into two nearly orthogonal subspaces: one subspace mainly contains discriminative information for classifying oxidation defects, while the other subspace mainly accommodates variation information related to the imaging environment (such as changes in illumination and background interference).

[0073] In the inference phase after model training, the feature decoupler operates deterministically. The initial feature vectors undergo forward propagation through a shared input layer and two parallel fully connected layers, ultimately generating two output vectors. The output vector of the defect-essential feature branch is used as the final defect-essential feature component, and the output vector of the environment-related feature branch is used as the final environment-related feature component. In subsequent defect classification decisions, the system uses only the defect-essential feature component, discarding the environment-related feature component. This ensures, in principle, that the classification decision relies as much as possible on pure defect information, improving the system's robustness to environmental changes.

[0074] In the dual-constraint optimization training module, the composite loss function consists of three core loss terms, each with a different optimization objective. The first loss term is the classification loss. This loss term acts on the essential feature component of the defect, aiming to ensure that this component has high discriminative power for oxidation defect categories. Calculating the classification loss requires inputting the essential feature component of the defect into an additional classifier, typically a softmax layer whose output dimension corresponds to the number of defect categories. The softmax layer transforms the input feature vector into a probability distribution vector, where each element represents the predicted probability that the input sample belongs to the corresponding defect category. The specific calculation of the classification loss is based on the difference between the model's predicted probability distribution and the sample's true label. The true label is usually represented in one-hot encoding form, where only the position corresponding to the true category is one, and the rest are zero. Subsequently, the cross-entropy between the one-hot encoding of the true label and the predicted probability distribution is calculated. The smaller the cross-entropy value, the closer the predicted distribution is to the true distribution, and the higher the model's classification accuracy. Therefore, by minimizing this cross-entropy loss, the network parameters can be adjusted so that the essential feature component of the defect can predict the correct defect category as accurately as possible.

[0075] The second loss term is the decoupling loss. This loss term acts on the environment-related feature components, and its objective is the opposite of the classification loss: to eliminate any discriminative information in the environment-related feature components that is related to the defect category, making it unusable for correct classification. The calculation of the decoupling loss is similar to that of the classification loss, but the optimization objective is opposite. Specifically, the environment-related feature components are input into another independent classifier (whose structure is the same as the classifier for the defect-related feature components), which also yields a predicted probability distribution for the defect category. Then, the cross-entropy between this predicted distribution and the one-hot encoding of the true label is calculated. However, during the optimization process, for this loss term, the objective is not to minimize the cross-entropy, but to maximize it. Maximizing the cross-entropy means making the prediction results based on the environment-related feature components as inaccurate as possible, or in other words, making the predicted probability distribution as uniform as possible (i.e., unable to make a deterministic judgment) or as inconsistent as possible with the true label. Through this inverse optimization pressure, the network is forced to "expel" information that helps with correct classification from the environment-related feature components, retaining only information about changes caused by environmental factors that are unrelated to the defect.

[0076] The third loss term is the orthogonality constraint loss. This loss term applies to both the defect-related feature component and the environment-related feature component, aiming to reduce the statistical correlation between these two components and make them independent. The orthogonality constraint loss is calculated based on the cosine similarity between the two feature vectors. First, the magnitudes of the defect-related feature component vector and the environment-related feature component vector need to be calculated separately. The magnitude of a vector is the square root of the sum of the squares of its elements. Next, the dot product of the two vectors is calculated, which is the sum of the product of corresponding elements. Then, the cosine similarity is equal to the dot product divided by the product of the magnitudes of the two vectors. The value of cosine similarity is between -1 and +1; the closer its absolute value is to zero, the closer the directions of the two vectors are to orthogonal (perpendicular), i.e., the weaker the correlation. To construct the loss term, the square of the cosine similarity is usually taken. This converts negative values ​​to positive and makes the loss zero when the similarity is zero. By minimizing this squared value of cosine similarity, the network parameters are adjusted so that the directions of the two feature components in the vector space tend to be orthogonal, thereby geometrically strengthening their independence.

[0077] The three loss terms mentioned above need to be combined into a composite loss function to guide network training. The simplest way to combine them is through weighted summation, where the total loss equals the classification loss plus the weights of the decoupling loss multiplied by the decoupling loss, plus the weights of the orthogonality constraint loss multiplied by the orthogonality constraint loss. However, fixed weights may not be suitable for the needs of different training stages. Therefore, a dynamic weight adjustment strategy can be adopted. The core idea of ​​this strategy is to automatically adjust the weights of each loss term based on their relative magnitudes during recent training, thereby dynamically balancing the importance of different optimization objectives.

[0078] One specific implementation of the dynamic weight adjustment strategy is based on the ratio of the moving averages of each loss term over the most recent training batches. First, a moving average is maintained for each loss term, for example, using an exponential moving average to estimate its recent magnitude. After each training batch, the moving averages of these three loss terms are updated. Then, the adjustment amount for the current weight of each loss term is calculated. The adjustment amount can be determined based on the ratio of other loss terms to their own moving averages. For example, to ensure a roughly balanced contribution of each loss term to the total loss, a target can be set so that the weighted values ​​of each loss term (i.e., loss term multiplied by its weight) are within similar orders of magnitude. If the moving average of one loss term is significantly greater than that of another, the latter's weight can be increased, or the former's weight decreased. This adjustment typically requires a base weight and a set of adjustment rules; for example, every certain number of training batches, the weights are slightly adjusted according to the proportional relationship of the moving averages. Through this dynamic mechanism, in the early stages of training, when the classification loss is large, optimization focuses on quickly reducing the classification error to achieve initial convergence. In the later stages of training, when the classification loss is relatively small and the decoupling loss and orthogonal constraint loss are relatively significant, optimization focuses more on refined feature decoupling, thereby improving the model's robustness. Throughout the training process, the backpropagation algorithm and gradient descent optimization algorithm are used to continuously adjust all network weight parameters to minimize this dynamically weighted composite loss function.

[0079] The online defect identification and output module's core task during the inference phase is to classify oxidation defects based on the essential defect feature components output by the spectral feature decoupling module. This module first feeds the essential defect feature components as the sole input data into a pre-trained Softmax classifier. This Softmax classifier is trained along with the feature extraction network and feature decoupling module during the model training phase, and its weight parameters are fixed. The Softmax classifier is essentially a fully connected layer with the number of neurons equal to the number of defect categories to be classified (e.g., three categories: no defect, slight oxidation, and severe oxidation). When the essential defect feature components are input into the classifier, it performs a linear transformation, multiplying its weight matrix by the input feature vector and adding the bias vector to calculate an initial score for each defect category. This score can be understood as the initial evidence support for the feature vector belonging to a certain category.

[0080] After obtaining the initial scores for each category, the Softmax classifier needs to transform these scores into a normalized probability distribution for easier understanding and subsequent decision-making. This transformation is achieved through the Softmax function. The Softmax function is a mathematical operation that processes multiple input values, mapping them to the interval between zero and one, and ensuring that the sum of all output values ​​is one, thus conforming to the axioms of probability. The specific calculation process is as follows: First, take the exponential function value of the initial score for each category, that is, the natural constant e raised to the power of that fraction. The purpose of this step is to convert all scores that may contain negative values ​​into positive numbers. Then, calculate the sum of the exponentialized scores for all categories. Finally, for each category, its final predicted probability is equal to its exponentialized score divided by the sum of the exponentialized scores for all categories. Through this series of calculations, the Softmax classifier finally outputs a probability distribution vector. Each element of this vector corresponds to the predicted probability of a defect category; the higher the probability value, the greater the likelihood that the model determines that the input feature belongs to that category.

[0081] After obtaining the probability distribution vector, the system needs to make a clear classification decision. The decision rule is to select the category with the highest predicted probability as the final classification result for this detection. For example, if the probability value corresponding to the "severe oxidation" category is 0.85, which is much higher than other categories, then the copper wire is judged to be severely oxidized. This highest probability value itself is also of great value; it is used as the confidence score for this classification. The confidence score is a value between 0 and 1. The higher the confidence score, the more confident the model is; the lower the confidence score, the more hesitant the model is. Finally, the system outputs the final classification result (such as category label or code) and its corresponding confidence score as the defect classification output, and passes it to the subsequent logic control unit. The output can take the form of digital signals, strings, or specific communication protocol messages.

[0082] After the classification results are output, the system needs to execute corresponding control actions based on the results, i.e., sorting control. The first step in sorting control is decision logic judgment. The system will make judgments according to preset rules. For example, the rules may stipulate that only when the final classification result is "slight oxidation" or "severe oxidation," and the confidence level of this classification is higher than a preset threshold (such as 0.9), is the copper wire determined to be a defective product that needs to be rejected. After these conditions are met, the system will generate a sorting trigger signal. This signal is usually a brief digital level transition (such as from low level to high level and then back to normal), and its generation time marks the decision point when the system identifies the defect.

[0083] After the sorting trigger signal is generated, due to the continuous movement of the production line, there is a certain spatial distance between the detection point and the physical sorting execution device (such as a pneumatic nozzle or mechanical push rod). To ensure that the sorting action accurately targets the identified defective copper wire segment, precise delay synchronization control is necessary. The delay time is calculated based on two key parameters: the production line's speed and the physical distance from the detection point to the action point of the sorting execution device. First, the current operating speed of the production line is acquired in real time using an encoder or sensor. Then, the time required for the defective copper wire segment to move from the detection point to the sorting port is calculated by dividing the physical distance from the detection point to the sorting port by the production line's operating speed. An internal timer will then send the previously generated sorting trigger signal to the sorting execution mechanism only after this calculated delay time. This process ensures precise synchronization between the signal transmission and the arrival of the defective product at the sorting port.

[0084] When the sorting actuator receives a delayed sorting trigger signal, it immediately performs a rejection action. The specific form of the sorting actuator can be a solenoid valve-controlled cylinder nozzle or a servo motor-driven lever, etc. After the signal is triggered, the solenoid valve opens instantaneously, releasing compressed air to blow the defective copper wire segment off the production line; or a mechanical pusher moves rapidly to push the defective product into the waste bin. The execution action must be fast, accurate, and short in duration to ensure that it does not affect the normal passage of subsequent qualified products or interfere with the production line.

[0085] The working principle of this invention is as follows: Multispectral image sequences of copper wires in cables are acquired using a multispectral camera. Gradient fusion and morphological processing are used to accurately segment the copper wire regions and obtain multispectral pixel blocks. These pixel blocks are then input into a lightweight convolutional neural network based on depthwise separable convolution. A multi-branch structure extracts and fuses multi-scale spectral-spatial features to generate an initial feature vector. A feature decoupler is used to decompose the initial feature vector into mutually orthogonal defect-related feature components and environment-related feature components. During the training phase, a composite loss function including classification loss, decoupling loss, and orthogonal constraint loss is used for joint optimization, and a dynamic weight adjustment strategy is employed to balance the various loss terms. During the inference phase, Softmax classification decisions are made solely based on the defect-related feature components. A confidence threshold and delay control trigger the sorting mechanism to reject defective products, ultimately achieving highly robust online detection and sorting closed-loop control.

[0086] The foregoing has provided a detailed description of one embodiment of the present invention, but this description is merely a preferred embodiment and should not be construed as limiting the scope of the invention. All equivalent variations and modifications made within the scope of the claims of this invention should still fall within the patent coverage of this invention.

Claims

1. An online detection system for oxidation defects on the surface of copper wires in cables, characterized in that, include: The multispectral region precise extraction module is used to acquire multispectral image sequences of cable copper wires, process the multispectral image sequences of cable copper wires, segment the detection area on the surface of the copper wires, and obtain the corresponding multispectral pixel blocks. The area to be detected, segmented from the surface of the copper wire, specifically includes: For each frame in the multispectral image sequence, the gradient magnitude in multiple bands is calculated, and the gradient magnitudes of each band are fused to generate a comprehensive gradient map that highlights the edge of the copper wire. Based on the comprehensive gradient map, the initial outline of the copper wire is obtained in binary form. Then, morphological closing operation is used to fill the interruption and void caused by surface reflection in the initial outline to obtain a complete copper wire mask. The copper wire mask is mapped back to the original multispectral image sequence, and the pixel information of all bands corresponding to the mask area is extracted to form a multispectral pixel block. The lightweight deep feature extraction module inputs multispectral pixel blocks into a lightweight convolutional neural network for feature learning. The lightweight convolutional neural network extracts deep spectral-spatial features of the region to be detected through depthwise separable convolution operations and outputs an initial feature vector. The spectral feature decoupling module inputs the initial feature vector into the feature decoupler, which decomposes the initial feature vector into two independent feature components: a defect-based feature component that characterizes the oxidation state of the copper wire surface, and an environmentally relevant feature component that characterizes the interference of the imaging environment. The feature decoupler is implemented as follows: The feature decoupler consists of a shared input layer and two parallel fully connected layers. The initial feature vector is first input into a shared input layer for preliminary transformation, and then input into two parallel fully connected layers respectively. One fully connected layer is used to generate the defect-related feature components, and the other fully connected layer is used to generate the environment-related feature components. During training, the loss function constrains the vector directions of the defect-essential feature components and the environment-related feature components to be orthogonal in the feature space, so as to make the two components represent unrelated information. The outputs of the two parallel fully connected layers are used as the defect-essential feature components and environment-related feature components obtained by final decoupling, respectively. The specific implementation process of the orthogonality is as follows: Calculate the cosine similarity between the defect essential feature component and the environment-related feature component, and use the square of the cosine similarity as an additional loss term; By minimizing the additional loss term, the angle between the two feature components approaches 90 degrees, thus achieving orthogonal operation; The dual-constraint optimization training module applies a composite loss function for joint optimization during the training phase of the lightweight convolutional neural network and the feature decoupler. The composite loss function includes: a first constraint term, which is used to ensure that the essential feature components of the defect have high discriminative power for the oxidation defect category; and a second constraint term, which is used to suppress the information related to the defect category in the environmentally relevant feature components, so that they do not have the ability to discriminate defects. In the online defect identification and output module, during the inference phase, the system makes classification decisions for oxidation defects based solely on the obtained essential feature components of the defects, outputs the defect classifications, and performs sorting control.

2. The online detection system for oxidation defects on the surface of copper wire in cables according to claim 1, characterized in that, The step of inputting multispectral pixel blocks into a lightweight convolutional neural network for feature learning specifically includes: A multi-branch parallel network structure based on depthwise separable convolution is constructed, in which the first branch uses small-sized convolution kernels to focus on the local fine texture of multispectral pixel blocks, and the second branch uses large-sized convolution kernels to capture regional context information. The feature maps output from the first and second branches are concatenated along the channel dimension, and the concatenated features are reduced in dimensionality and integrated through a one-to-one convolutional layer to generate a joint feature map that integrates multi-scale information. Apply global average pooling to the joint feature map to compress it into an initial feature vector of fixed dimensions.

3. The online detection system for oxidation defects on the surface of copper wire in cables according to claim 1, characterized in that, The specific construction process of the composite loss function is as follows: The first loss term is the classification loss, which is calculated based on the difference between the essential feature components of the defect and the true defect label, and aims to minimize the classification error. The second loss term is the decoupling loss, which is calculated based on the difference between the environment-related feature components and the true defect labels. Its objective is the opposite of the first loss term, aiming to maximize this difference so that the environment-related feature components cannot be used for correct classification. The third loss term is the orthogonal constraint loss, which is calculated based on the correlation between the defect essential feature components and the environment-related feature components. The aim is to minimize this correlation to promote their independence.

4. The online detection system for oxidation defects on the surface of copper wire in cables according to claim 3, characterized in that, The first, second, and third loss terms in the composite loss function employ a dynamic weight adjustment strategy, specifically including: The dynamic weight adjustment strategy automatically calculates the weights of each loss term based on their relative size in the current training batch. It focuses on rapid convergence in the early stages of training and on fine decoupling in the later stages.

5. The online detection system for oxidation defects on the surface of copper wire in cables according to claim 1, characterized in that, The classification decision for oxidation defects based on the obtained essential characteristic components of the defects specifically includes: The essential feature components of the defect are used as the only input to a pre-trained Softmax classifier. The Softmax classifier outputs a probability distribution vector, where each element corresponds to the predicted probability of a defect category. The category with the highest probability is determined as the final classification result, and its corresponding probability value is used as the confidence level of this classification. The final classification result and its confidence level are output together as the defect classification.

6. The online detection system for oxidation defects on the surface of copper wire in cables according to claim 1, characterized in that, The sorting control specifically includes: For copper wire segments that are determined to have oxidation defects and whose confidence level is higher than the threshold, the system generates a sorting trigger signal. Based on the production line speed and the physical distance from the detection point to the sorting execution device, the delay time is calculated to ensure that the sorting signal is issued on time when the corresponding defective copper wire segment arrives at the sorting port. A sorting trigger signal controls a sorting execution mechanism to automatically remove defective products from the production line.

Citation Information

Patent Citations

  • Visual defect detection method of deep convolutional neural network

    CN110610475A