A method, device and storage medium for online detection of cable surface defects
Through multi-dimensional implicit representation and significant focus technology, the problem of the adaptability and accuracy of existing cable defect detection methods to new defect detection is solved, and real-time and efficient detection of cable surface defects is achieved.
Patent Information
- Application Number
- CN202411397642.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-09
- Publication Date
- 2024-12-17
- Estimated Expiration
- 2044-10-09
AI Technical Summary
Existing cable defect detection methods are difficult to adapt to new defects in real time, and they cannot effectively identify new defects that are not included in the preset category. Traditional methods rely on preset defect categories and classification interfaces, limiting the flexibility and accuracy of detection.
Using multi-dimensional implicit representation mining method, feature extraction is performed on the visual image, acoustic wave detection data and electrical parameter data of the detection cable, combined with convolutional neural network and attention mechanism, a search array is established for significant focus, and matches and mismatches are generated. Sample indicators, real-time detection of cable surface defects.
It improves the accuracy and flexibility of cable surface defect detection, can adapt to new defect types in real time, reduces dependence on preset categories and classification interfaces, and enhances the generalization ability of detection algorithms.
Smart Images

Figure CN118896970B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing, and in particular to an online detection method, device and storage medium for cable surface defects. Background Art
[0002] In the cable manufacturing industry, cable quality control is a key link to ensure the safe and reliable operation of products. Cable surface defects, such as cracks, wear, corrosion, etc., will not only affect the service life of the cable, but may also cause serious safety accidents. Therefore, it is crucial to quickly and accurately detect defects on the cable surface to improve production efficiency and product quality. Traditional cable defect detection methods mainly include manual visual inspection and automated detection methods based on image processing technology. In recent years, with the rapid development of artificial intelligence and machine learning technologies, advanced algorithms such as deep learning have achieved remarkable results in image recognition, natural language processing and other fields. These technologies provide new solutions for cable surface defect detection. However, there are still many challenges in directly applying existing artificial intelligence technologies to the field of cable defect detection. Cable defects have various manifestations, and the characteristics of different defects vary significantly, requiring algorithms to have strong feature extraction and generalization capabilities. In addition, existing automated detection methods often rely on preset defect categories and classification interfaces. The limitation of this method is that it cannot effectively identify new defects that are not included in the preset categories. With the continuous advancement of cable manufacturing processes and the widespread application of new materials, the types and manifestations of cable defects are also constantly changing. Therefore, it is particularly important to develop a method that can adapt to new defect detection in real time. Summary of the invention
[0003] The object of the present invention is to provide a method, device and storage medium for online detection of cable surface defects. This application is implemented as follows:
[0004] In a first aspect, the present application provides an online detection method for cable surface defects, comprising: performing multi-dimensional implicit representation mining on a cable test data set to be detected to obtain a multi-dimensional implicit representation, wherein the cable test data set to be detected includes a visual image, acoustic wave detection data, and electrical parameter data of the cable to be detected, and the multi-dimensionality includes an image dimension, an acoustic wave dimension, and an electrical parameter dimension; performing image implicit representation mining on a first number of preset defect reference images to obtain a corresponding first number of reference image implicit representations; dividing and constructing the first number of reference image implicit representations to obtain a first number of matching sample implicit representations corresponding to one of the first number of reference image implicit representations, and a first number of mismatching sample implicit representations corresponding to one of the first number of reference image implicit representations, wherein each matching sample implicit representation includes a feature indicating that its corresponding preset defect reference image matches the cable test data set to be detected, and each mismatching sample implicit representation includes a feature indicating that its corresponding preset defect reference image matches the cable test data set to be detected. unmatched features; establishing a search array based on the first number of matching sample implicit representations and the first number of unmatched sample implicit representations, performing saliency focusing on the multi-dimensional implicit representation based on the search array, and obtaining a saliency focusing array; the saliency focusing array is used to indicate the correlation between the search array and the multi-dimensional implicit representation; constructing a first number of matching sample indicators corresponding to one of the first number of matching sample implicit representations, and a first number of unmatched sample indicators corresponding to one of the first number of unmatched sample implicit representations based on the saliency focusing array; selecting a target defect reference image related to the test data set of the cable to be detected from the first number of preset defect reference images based on the first number of matching sample indicators and the first number of unmatched sample indicators; the matching sample indicator corresponding to the target defect reference image is greater than the unmatched sample indicator corresponding to the target defect reference image; and taking the defect indication result corresponding to the target defect reference image as the defect detection result of the cable to be detected.
[0005] In a second aspect, the present application provides an online detection device for cable surface defects, including: a data set feature extraction module, used to perform multi-dimensional implicit representation mining on a cable test data set to be detected to obtain a multi-dimensional implicit representation, wherein the cable test data set to be detected includes a visual image, acoustic wave detection data and electrical parameter data of the cable to be detected, and the multi-dimensionality includes an image dimension, an acoustic wave dimension and an electrical parameter dimension; a reference feature extraction module, used to perform image implicit representation mining on a first number of preset defect reference images respectively to obtain a first number of corresponding reference image implicit representations; a feature division and construction module, used to divide and construct the first number of reference image implicit representations respectively to obtain a first number of matching sample implicit representations corresponding to one of the first number of reference image implicit representations, and a first number of mismatching sample implicit representations corresponding to one of the first number of reference image implicit representations, wherein each matching sample implicit representation includes a feature indicating that its corresponding preset defect reference image matches the cable test data set to be detected, and each mismatching sample implicit representation includes a feature indicating that its corresponding preset defect reference image matches the cable test data set to be detected. The invention relates to a method for determining a feature of a data set mismatch; a significant focusing module for establishing a search array based on the first number of implicit representations of matching samples and the first number of implicit representations of mismatching samples, and performing significant focusing on the multi-dimensional implicit representation based on the search array to obtain a significant focusing array; the significant focusing array is used to indicate the correlation between the search array and the multi-dimensional implicit representation; an index determination module for constructing a first number of matching sample indexes corresponding to one of the first number of implicit representations of matching samples and a first number of mismatching sample indexes corresponding to one of the first number of implicit representations of mismatching samples based on the significant focusing array; a defect determination module for selecting a target defect reference image related to the test data set of the cable to be detected from the first number of preset defect reference images based on the first number of matching sample indexes and the first number of mismatching sample indexes; the matching sample index corresponding to the target defect reference image is greater than the mismatching sample index corresponding to the target defect reference image; and taking the defect indication result corresponding to the target defect reference image as the defect detection result of the cable to be detected.
[0006] In a third aspect, the present application provides a computer-readable storage medium having a computer program stored thereon. When the computer program runs on a processor, the processor executes the method described in the first aspect above.
[0007] Beneficial effects of the present application: The present application mines the multi-dimensional implicit representation of the cable test data set to be detected based on the target defect detection algorithm to obtain the multi-dimensional implicit representation. Based on the multi-dimensional implicit representation, more implicit features can be mined, and the image implicit representation mining is performed on the first number of preset defect reference images to obtain the implicit representation of the reference image corresponding to each of the first number of preset defect reference images. The implicit representation of the first number of reference images is divided and constructed to obtain the implicit representation of the matching samples corresponding to each reference image implicit representation, and the implicit representation of the mismatching samples corresponding to each reference image implicit representation. Among them, the implicit representation of the matching sample includes the feature indicating that the corresponding preset defect reference image matches the cable test data set to be detected, and the implicit representation of the mismatching sample includes the feature indicating that the corresponding preset defect reference image does not match the cable test data set to be detected. The implicit representation of the matching sample and the implicit representation of the mismatching sample can indicate the focus of the algorithm, so that the algorithm focuses on the correlation between the preset defect reference image and the cable test data set to be detected, and at the same time focuses on the matching information between the preset defect reference image and the cable test data set to be detected, and the mismatching information between the preset defect reference image and the cable test data set to be detected, so that the generalization of the algorithm is improved. A search array is established based on the first number of matching sample implicit representations and the first number of non-matching sample implicit representations, and a significant focusing array is obtained based on the search array for performing significant focusing on the multi-dimensional implicit representation. Based on the significant focusing array, the correlation between the first number of matching sample implicit representations, the first number of non-matching sample implicit representations and the multi-dimensional implicit representation can be represented. Then, based on the significant focusing array, matching sample indices corresponding to the first number of matching sample implicit representations and non-matching sample indices corresponding to the first number of non-matching sample implicit representations can be generated. According to the first number of matching sample indices and the first number of non-matching sample indices, a target defect reference image related to the cable test data set to be detected is selected from the first number of preset defect reference images. Based on taking the preset defect reference image whose matching sample index is greater than the non-matching sample index as the target defect reference image related to the cable test data set to be detected, there is no need to set a corresponding category classification interface for the classification result of each preset defect reference image, thereby reducing complexity. In addition, since there is no category classification interface, a preset defect reference image that does not reach the classification interface but has a large difference between the matching and non-matching samples can be obtained, thereby increasing the accuracy of the target defect detection algorithm. At the same time, a search array is established based on all preset defect reference images, and the matching sample indicators and non-matching sample indicators corresponding to each preset defect reference image can be obtained. The search array can be generated in real time. When there is an updated defect type, a new search array can be generated to obtain the matching sample indicators and non-matching sample indicators corresponding to the new defect type, and the correlation between the new defect type and the cable test data set to be detected can be detected in real time and efficiently. BRIEF DESCRIPTION OF THE DRAWINGS
[0008] Figure 1 It is a flow chart of a method for online detection of cable surface defects provided in an embodiment of the present application.
[0009] Figure 2 It is a schematic diagram of an online detection device for cable surface defects provided in an embodiment of the present application. DETAILED DESCRIPTION
[0010] The execution subject of the online cable surface defect detection method in the embodiment of the present application is a computer system, including but not limited to a server, a personal computer, a laptop, a tablet computer, a smart phone, etc. Figure 1 As shown, the method includes:
[0011] Step S100: Perform multi-dimensional implicit representation mining on the cable test data set to be detected to obtain a multi-dimensional implicit representation. The cable test data set to be detected includes a visual image, acoustic wave detection data and electrical parameter data of the cable to be detected. The multi-dimensionality includes an image dimension, an acoustic wave dimension and an electrical parameter dimension.
[0012] The cable test data set to be tested covers three important dimensions of data: visual images, acoustic wave detection data, and electrical parameter data. In the scenario of online detection of cable surface defects, visual image data is an intuitive record of the appearance of the cable surface. For example, these images can be taken by industrial cameras on the cable production line or during daily inspection. Assuming that the visual image is a high-resolution color image with a resolution of 1920×1080 pixels, the image is stored in RGB mode, and each pixel is represented by the values of the three channels of red, green, and blue. This is a very intuitive two-dimensional matrix data. From this visual image data, you can directly see the texture, color, and whether there is obvious physical damage (such as scratches, holes, etc.) on the cable surface, but this is only superficial and explicit information. The computer system needs to mine its implicit representation, that is, those potential features related to cable surface defects, which may not be directly judged from the pixel values of the image. Acoustic wave detection data reflects the status of the cable from another perspective. When a sound wave signal of a specific frequency and intensity is sent to the cable, the internal structure and surface state of the cable will produce different reflection, refraction and absorption effects on the sound wave, and the receiving device will record these changes and convert them into sound wave detection data. For example, assuming that the sound wave detection equipment collects data at a sampling frequency of 1000 times per second and the collection time is 5 seconds, a time series data with a length of 5000 will be obtained. The value of each data point in this time series data represents the intensity of the sound wave signal received at the corresponding time point. For normal cables and cables with surface defects (such as cracks that affect the propagation path of sound waves), the sound wave detection data will show different patterns, but this pattern is complex and not a simple numerical difference. It is necessary to dig out its implicit representation to reveal the relationship with the surface defects of the cable. Electrical parameter data is a quantitative embodiment of the electrical characteristics of the cable, including parameters such as resistance, capacitance, and inductance. For example, the resistance value can be measured by a specific electrical measuring instrument. Assuming that the measured resistance value is 10 ohms, the capacitance value is 0.1 microfarads, and the inductance value is 0.05 millihenry, these electrical parameters constitute the electrical parameter data. When there are defects on the cable surface, such as surface damage or corrosion, the cross-sectional area or dielectric properties of the cable may change, thereby affecting its electrical parameters such as resistance, capacitance and inductance. However, this influence is multifaceted and intertwined with other factors, so it is necessary to mine the implicit representation of electrical parameter data to accurately determine the surface defects of the cable.
[0013] The process of computer system mining multi-dimensional implicit representation can be based on a variety of machine learning techniques or data analysis methods. Take principal component analysis (PCA) as an example, which is a commonly used data dimension reduction and feature extraction method. For visual image data, the computer system regards it as a high-dimensional data matrix (taking 1920×1080×3 RGB image as an example, its dimension is very high). The PCA algorithm first calculates the covariance matrix of the image data matrix, which reflects the correlation between each pixel in the image. Then, by solving the eigenvalues and eigenvectors of the covariance matrix, the most important eigenvectors are selected (for example, the first 100 eigenvectors are selected). These eigenvectors constitute a new space, and the original image data can be projected into this new space. The projection result is the implicit representation of the visual image. This implicit representation is no longer the original pixel value matrix, but a vector after dimensionality reduction and feature extraction. Assuming that the dimension of this vector is 100 dimensions, it condenses the main feature information related to the cable surface defects in the original image. PCA can also be applied to the time series of acoustic wave detection data. Consider the acoustic wave detection data as a vector (a one-dimensional vector with a length of 5000), calculate its covariance matrix and solve the eigenvalue and eigenvector. Select several important eigenvectors (for example, the first 50), project the original acoustic wave detection data vector into the new space formed by these eigenvectors, and obtain a 50-dimensional vector as the implicit representation of the acoustic wave detection data. This vector can reflect the patterns and features related to cable surface defects hidden in the acoustic wave detection data, such as the change trend of specific frequency components. For electrical parameter data, since its own dimension is relatively low (here only three parameters are included: resistance, capacitance, and inductance), a simple linear transformation model can be constructed to mine the implicit representation. Assume that a 3×5 weight matrix is constructed, and the electrical parameter data vector [10, 0.1, 0.05] is multiplied by this weight matrix to obtain a 5-dimensional vector as the implicit representation of the electrical parameter data. This implicit representation maps the electrical parameter data to a new feature space through linear transformation. In this new space, the relationship between different electrical parameter combinations and cable surface defects may be clearer.
[0014] Finally, the computer system combines the implicit representation of the visual image, the implicit representation of the acoustic wave detection data, and the implicit representation of the electrical parameter data to form a multi-dimensional implicit representation. For example, if the implicit representation of the visual image is a 100-dimensional vector, the implicit representation of the acoustic wave detection data is a 50-dimensional vector, and the implicit representation of the electrical parameter data is a 5-dimensional vector, then they can be sequentially spliced into a 155-dimensional vector as a multi-dimensional implicit representation. This multi-dimensional implicit representation integrates the potential feature information of the cable in the three dimensions of image, acoustic wave, and electrical parameters, providing a more comprehensive and in-depth data foundation for subsequent cable surface defect detection.
[0015] Step S200: performing image implicit representation mining on a first number of preset defect reference images respectively to obtain corresponding first number of reference image implicit representations.
[0016] Step S200 performs image implicit representation mining on the first number of preset defect reference images to obtain corresponding first number of reference image implicit representations. This process aims to deeply mine the potential features related to cable surface defects in the preset defect reference images, and provide a basis for subsequent comparison and analysis with the cable data to be tested.
[0017] In the embodiment of the present application, the preset defect reference image is a cable surface image with a known specific defect type. These defect types may include scratches, wear, corrosion, pits, etc. on the cable surface. For example, we assume that the first number is 50, and these 50 preset defect reference images cover cable surface defects of different degrees and types. In order to mine the implicit representation of the image, the computer system may adopt a variety of methods, which are described here by taking the convolutional neural network (CNN) as an example.
[0018] For each preset defect reference image, the input layer of CNN first receives image data. Assuming that these preset defect reference images are color images with a size of 224×224 pixels, and each pixel is represented by three RGB channels, the input image is a 224×224×3 three-dimensional array.
[0019] The convolution layer in CNN is the key part. The convolution layer contains multiple convolution kernels. For example, the first convolution layer may have 32 convolution kernels of size 3×3×3 (here 3 corresponds to the three channels of RGB). Each convolution kernel slides on the image to perform convolution operations to extract local features of the image. For a 224×224×3 image, when a 3×3×3 convolution kernel is used for convolution, the convolution kernel slides in the width and height directions of the image, sliding one pixel at a time (with a step size of 1). Taking the first convolution kernel as an example, as it slides on the image, it multiplies and sums the pixel values at the corresponding position of the image to obtain a new value, which constitutes an element in the output feature map. After the convolution operation of 32 convolution kernels, 32 different feature maps will be obtained, each of which is 222×222 in size (because the convolution kernel size is 3×3, the edge of the image cannot be fully convolved, so the size of the output feature map will become smaller). These feature maps can be regarded as the preliminary extraction of local features of the original image, which is the first step in mining the implicit representation of the image. Next, the pooling layer downsamples the feature maps obtained by the convolution layer to reduce the amount of data and retain the main features. For example, a maximum pooling layer is used with a pooling kernel size of 2×2 and a step size of 2. For each 222×222 feature map, the pooling kernel slides on the feature map and selects the maximum value in each 2×2 area as the output, so that the size of each feature map becomes 111×111. The pooling operation further abstracts the features of the image and is an important part of the process of mining the implicit representation of the image. After alternating multiple convolutional layers and pooling layers, the features of the image are gradually extracted and abstracted. For example, after processing by 3 convolutional layers and 2 pooling layers, it is assumed that an 8×8×128 feature map array is obtained (here 8×8 represents the size of the feature map, and 128 represents the number of feature maps, that is, the depth). This feature map array can be regarded as an intermediate representation of the original preset defect reference image after multi-layer processing, but it is not yet the final implicit representation of the reference image. In order to obtain the final implicit representation of the reference image, the computer system can flatten this feature map array. That is, convert the 8×8×128 three-dimensional array into a vector. The calculation method is to arrange the elements in each feature map in a certain order (for example, from left to right, from top to bottom) into a vector, and obtain a 8×8×128 = 8192-dimensional vector. This vector is the implicit representation of the reference image obtained after a preset defect reference image is processed by CNN.
[0020] For these 50 preset defect reference images, the above process is repeated to obtain the corresponding 50 implicit representations of reference images. Each implicit representation of reference image contains the potential feature information about the cable surface defects in the preset defect reference image. These feature information are mined in the form of vectors. They are no longer intuitive pixel information in the original image, but abstract feature representations that are more closely related to the cable surface defects after multi-layer processing of CNN. This implicit representation of reference image provides a basis for subsequent matching and comparison operations with the test data set of the cable to be tested, which helps to accurately determine whether the cable to be tested has surface defects similar to the preset defect reference image.
[0021] Step S300: Divide and construct the implicit representations of the first number of reference images respectively, and obtain a first number of matching sample implicit representations corresponding to one of the implicit representations of the first number of reference images respectively, and a first number of mismatching sample implicit representations corresponding to one of the implicit representations of the first number of reference images respectively, wherein each matching sample implicit representation includes a feature indicating that its corresponding preset defect reference image matches the cable test data set to be detected, and each mismatching sample implicit representation includes a feature indicating that its corresponding preset defect reference image does not match the cable test data set to be detected.
[0022] Step S300 divides and constructs the first number of implicit representations of reference images respectively, thereby obtaining the first number of matching sample implicit representations and the first number of non-matching sample implicit representations corresponding to each reference image implicit representation. The key to this step is to classify and construct the obtained implicit representations of reference images according to a certain rule or algorithm parameter to distinguish the implicit representations of samples that match and do not match the cable test data set to be detected, so as to provide more targeted data features for subsequent operations.
[0023] In the scenario of online detection of cable surface defects, it is assumed that the first number is 30, that is, there are already 30 implicit reference image representations, which are the results of image implicit representation mining of preset defect reference images in the previous step (such as step S200). Each reference image implicit representation contains feature information about cable surface defects in a specific preset defect reference image in the form of a vector. For example, one of the reference image implicit representations may be a 100-dimensional vector. Each element in this vector is obtained through complex algorithm processing (such as layer-by-layer operations of convolutional neural networks), representing a mapping of specific cable surface defects (such as scratches, corrosion, etc.) in the image feature space.
[0024] The process of partitioning and constructing by the computer system may involve some predefined algorithm parameters and rules. Taking an algorithm based on distance metric as an example, the computer system first defines a distance metric standard, such as Euclidean distance. For each reference image implicit representation (100-dimensional vector), the computer system will calculate the distance between it and the cable test data set to be detected (assuming that the cable test data set to be detected can also be represented as a vector or a vector set after preliminary processing, such as a 50-dimensional vector).
[0025] For the construction of the implicit representation of the matching sample, the computer system sets a distance threshold. If the calculated Euclidean distance is less than this threshold, it is considered that there is a high possibility that the implicit representation of the reference image has a matching relationship with the cable test data set to be detected. For example, when the distance threshold is set to 10, if the Euclidean distance calculated between the implicit representation of a reference image and the cable test data set to be detected is 8, then the computer system will extract some features from the implicit representation of the reference image to construct the implicit representation of the matching sample. Assuming that the implicit representation of the matching sample needs to include features related to the distance and some key features in the implicit representation of the original reference image, such as the first 50-dimensional features in the original 100-dimensional vector plus the feature representing the distance of 8 (the distance value can be converted into an element in the vector through some encoding method), a matching sample implicit representation is constructed, which can reflect the matching characteristics of the preset defect reference image and the cable test data set to be detected.
[0026] For the construction of the implicit representation of mismatched samples, when the Euclidean distance is greater than the distance threshold (such as 10), the computer system determines that the implicit representation of the reference image does not match the cable test data set to be detected. Similarly, the computer system extracts some features from the implicit representation of the reference image to construct the implicit representation of the mismatched samples. For example, the last 50-dimensional features in the original 100-dimensional vector are selected and the feature representing the distance of 12 (assuming the calculated distance) is added (converted into vector elements through encoding), thereby obtaining an implicit representation of mismatched samples, which can reflect the characteristics that the preset defect reference image does not match the cable test data set to be detected.
[0027] In another possible implementation, an algorithm based on a probability model is used. Assume that there is a pre-trained probability model that has learned the probability relationship between cable surface defects and various image features. For each reference image implicit representation, it is input into this probability model, and the model outputs the probability value that the reference image implicit representation matches the cable test data set to be detected.
[0028] If the probability value is greater than a predefined probability threshold (such as 0.8), an implicit representation of the matching sample is constructed. For example, the implicit representation of the reference image is a 120-dimensional vector, and the probability model outputs a matching probability of 0.85. The computer system constructs an implicit representation of the matching sample based on some intermediate results within the model (such as analysis of different feature weights) and the implicit representation of the original reference image. It can be achieved by selecting 80-dimensional vector elements related to high-weight features in the 120-dimensional vector, and adding coding elements with a representation probability of 0.85 to form an implicit representation of the matching sample.
[0029] If the probability value is less than the probability threshold (such as 0.8), an implicit representation of the mismatched sample is constructed. For example, when the probability is 0.6, the 60-dimensional vector elements related to the low-weight features in the 120-dimensional vector are selected, and the coding elements representing the probability of 0.6 are added to construct the implicit representation of the mismatched sample.
[0030] Through this division and construction process, the computer system constructs the corresponding matching sample implicit representation and mismatching sample implicit representation for the 30 reference image implicit representations. These constructed sample implicit representations contain feature information that matches or does not match the cable test data set to be detected, providing a key data basis for subsequent steps (such as establishing a search array based on these sample implicit representations for significant focusing operations), which helps to detect cable surface defects more accurately.
[0031] Step S400: Establish a search array based on a first number of matching sample implicit representations and a first number of non-matching sample implicit representations, perform saliency focusing on the multi-dimensional implicit representation based on the search array, and obtain a saliency focusing array; the saliency focusing array is used to indicate the correlation between the search array and the multi-dimensional implicit representation.
[0032] Step S400 establishes a search array (i.e., Query) based on the first number of matching sample implicit representations and the first number of non-matching sample implicit representations, and performs saliency focusing on the multi-dimensional implicit representation based on the search array, thereby obtaining a saliency focusing array. The purpose of this step is to explore the correlation between the matching sample implicit representation and the non-matching sample implicit representation and the multi-dimensional implicit representation by establishing a search array, and then obtain a saliency focusing array to highlight the key information in the data, so as to provide a more targeted basis for subsequent cable surface defect detection.
[0033] In the embodiment of the present application, it is assumed that the first number is 50, that is, there are 50 implicit representations of matching samples and 50 implicit representations of mismatching samples. These implicit representations are obtained through the previous steps (such as step S300), and each implicit representation contains feature information related to the cable surface defects. For example, the implicit representation of matching samples may be a 100-dimensional vector, in which the value of each dimension represents a quantitative representation of a certain feature (such as image feature, acoustic wave feature, electrical parameter feature, etc.) that matches a specific preset defect reference image with the test data set of the cable to be detected; the same is true for the implicit representation of mismatching samples, except that it represents mismatching features.
[0034] When the computer system establishes a search array, a method based on feature fusion can be used. First, the implicit representations of 50 matching samples and 50 non-matching samples are considered as a whole data set. Assume that the implicit representation vector set of matching samples is , the implicit representation vector set of mismatched samples is For each vector (whether it is matched or not), the computer system recombines and weights it according to certain rules. For example, for the matching sample implicit representation ( ) in the jth dimension ( )element , the computer system assigns a weight according to its importance in the overall matching feature , similarly for mismatched samples, implicit representation The Dimensional elements Assign weight The computer system then uses the formula ( ) Calculate the search array Each element of This search array Q combines the feature information of the implicit representation of the matching samples and the implicit representation of the non-matching samples, and reflects the importance of different features through weights.
[0035] Next, the computer system performs saliency focus on the multi-dimensional implicit representation based on this search array. Assume that the multi-dimensional implicit representation is a 200-dimensional vector , which is obtained by mining the visual image, acoustic wave detection data and electrical parameter data of the cable to be detected in step S100, and contains various characteristic information of the cable. The computer system can use the attention mechanism to perform saliency focusing. For example, define a correlation function ( ), ) to measure the search array element Implicitly represent elements with multiple dimensions A simple correlation function can be The computer system then calculates each The significance score of Through this calculation, we get a significance score vector .
[0036] Finally, the computer system constructs a saliency focus array based on the saliency score vector S. For example, a threshold T is set, if , then Retain in the saliency focus array; if , then The value of is set to 0 or other processing is performed (such as reducing it by a certain ratio). Assuming the threshold T=100, the significant focus array is obtained after processing ,This array highlights the elements in the multi-dimensional implicit representation that have a higher correlation with the search array, i.e., the feature elements that may be more critical in cable surface defect detection.
[0037] Through such step S400, the computer system uses the implicit representation of matching samples and the implicit representation of non-matching samples to establish a search array, and performs saliency focusing on the multi-dimensional implicit representation to obtain a saliency focusing array. This saliency focusing array provides an important data basis for the subsequent construction of matching sample indicators and non-matching sample indicators (step S500) and the final selection of target defect reference images related to the cable test data set to be detected (step S600), which helps to detect cable surface defects more accurately.
[0038] Step S500: constructing a first number of matching sample indicators corresponding to one of the first number of matching sample implicit representations and a first number of non-matching sample indicators corresponding to one of the first number of non-matching sample implicit representations based on the saliency focus array.
[0039] Step S500 constructs a first number of matching sample indices corresponding to one of the first number of matching sample implicit representations, and a first number of mismatching sample indices corresponding to one of the first number of mismatching sample implicit representations, based on the saliency focus array. This step aims to generate corresponding indices for the previously constructed sample implicit representations through the saliency focus array, and these indices will be used to subsequently screen out a target defect reference image related to the cable test data set to be detected from the preset defect reference images.
[0040] In the embodiment of the present application, it is assumed that the saliency focus array obtained in the previous step (such as step S400) is , where n represents the dimension of the saliency focus array, assuming n=20. This saliency focus array is obtained by saliency focusing on the multi-dimensional implicit representation. It highlights the elements with high correlation with the search array (constructed by the matching sample implicit representation and the mismatching sample implicit representation). These elements contain key feature information in cable surface defect detection. Assume that the first number is 30, that is, there are 30 matching sample implicit representations and 30 mismatching sample implicit representations (this is the result obtained in the previous steps such as step S300). Each matching sample implicit representation and mismatching sample implicit representation contains feature information related to cable surface defects. For example, a matching sample implicit representation may be a 100-dimensional vector ( ), where the value of each dimension reflects the quantitative representation of a certain feature (such as specific image texture features, acoustic frequency features, electrical parameter change features, etc.) that matches the preset defect reference image with the cable test data set to be detected; the implicit representation of mismatched samples is similar, set to The process of constructing matching sample indicators by the computer system is as follows:
[0041] First, the computer system needs to determine a way to establish a connection between the saliency focus array and the implicit representation of the matching sample. A method based on element-by-element multiplication and summation can be used to construct the matching sample index. For the implicit representation of the i-th matching sample , the computer system defines an indicator algorithm parameter vector ,The elements in this vector are weight values pre-set according to the requirements of cable surface defect detection and data characteristics, for example Then, by calculating Get the matching sample index corresponding to the implicit representation of the i-th matching sample For example, for the first matching sample, the implicit representation is , assuming Etc., calculated according to the above formula This matches the sample index Combined with matching sample implicit representation The feature information in the saliency focus array, the relevant feature information in the saliency focus array, and the pre-set weight information reflect the degree of association between the implicit representation of the matching sample and the key features highlighted by the saliency focus array.
[0042] The process by which a computer system constructs an indicator of an unmatched sample is similar to that of a matched sample:
[0043] For the i-th mismatched sample, implicit representation , also using the indicator algorithm parameter vector A. By calculating Get the corresponding mismatch sample index of the i-th mismatch sample implicit representation For example, for the first mismatched sample, the implicit representation is , calculated according to the formula , this does not match the sample index It reflects the degree of association between the implicit representation of the mismatched sample and the key features highlighted by the saliency focus array.
[0044] In this way, the computer system constructs the corresponding matching sample index and the non-matching sample index for the implicit representation of 30 matching samples and the implicit representation of 30 non-matching samples, respectively. These indexes provide an important basis for selecting the target defect reference image related to the test data set of the cable to be detected from the first number of preset defect reference images in the subsequent steps (such as step S600), which helps to more accurately determine which preset defect reference images are more relevant to the actual situation of the cable to be detected, thereby improving the accuracy of cable surface defect detection.
[0045] Step S600: Based on a first number of matching sample indicators and a first number of non-matching sample indicators, select a target defect reference image related to the test data set of the cable to be detected from a first number of preset defect reference images; the matching sample indicator corresponding to the target defect reference image is greater than the non-matching sample indicator corresponding to the target defect reference image; and use the defect indication result corresponding to the target defect reference image as the defect detection result of the cable to be detected.
[0046] Step S600 selects a target defect reference image related to the cable test data set to be detected from the first number of preset defect reference images based on the first number of matching sample indicators and the first number of mismatching sample indicators. This step is a key decision-making link in the entire online detection process of cable surface defects. The preset defect reference image that is most relevant to the cable test data set to be detected is determined by comparing the matching sample indicators and the mismatching sample indicators, thereby obtaining the defect detection result of the cable to be detected. In the embodiment of the present application, it is assumed that the first number is 50, that is, there are 50 preset defect reference images. In the previous steps (such as step S500), the computer system has constructed matching sample indicators and mismatching sample indicators for these 50 preset defect reference images. For example, each matching sample indicator may be a numerical value, which represents the quantitative result of the degree of matching between the corresponding preset defect reference image and the cable test data set to be detected, such as the matching sample indicator of the first preset defect reference image. =0.8; the same is true for each mismatch sample index. Assume that the mismatch sample index of the first preset defect reference image is =0.3. The matching sample index and the mismatching sample index here are calculated by combining the implicit representation of the preset defect reference image in the previous step, the saliency focus array, and the pre-set algorithm parameters. The process of selecting the target defect reference image by the computer system is as follows:
[0047] For each preset defect reference image (from the 1st to the 50th), the computer system compares its corresponding matching sample index and mismatching sample index. If the matching sample index is greater than the mismatching sample index, for example, for the 1st preset defect reference image, due to =0.8, =0.3, the computer system uses this preset defect reference image as the target defect reference image related to the test data set of the cable to be detected. This means that the preset defect reference image has a higher degree of matching with the test data set of the cable to be detected in the multi-dimensional feature comparison (including comprehensive considerations such as image features, acoustic wave features, and electrical parameter features), and is more likely to reflect the actual defect situation of the cable to be detected. Assume that there is a variant algorithm based on the naive Bayes classifier to assist this decision-making process (although this is not necessary, it can be used as a way of understanding). In this algorithm, the matching sample index can be regarded as a probability estimate of the preset defect reference image belonging to "matching the cable to be detected (positive class)", and the mismatching sample index can be regarded as a probability estimate of "mismatching the cable to be detected (negative class)". When the matching sample index is greater than the mismatching sample index, it is equivalent to that under this algorithm, the probability of the preset defect reference image being judged as the positive class is higher.
[0048] Once the target defect reference image is determined, the computer system uses the defect indication result corresponding to the target defect reference image as the defect detection result of the cable to be detected. For example, if the defect indication result corresponding to the first target defect reference image is "scratches on the cable surface", the computer system determines that the defect of the cable to be detected is scratches on the surface. The defect indication result here is the known defect information pre-associated with the preset defect reference image, which is determined when the preset defect reference image library is constructed.
[0049] This method of selecting the target defect reference image by comparing the matching sample index and the mismatching sample index has certain advantages over the traditional method of setting a category classification interface for each preset defect reference image for classification. It does not require clear boundaries between categories, reducing complexity. Moreover, since it does not rely on a strict category classification interface, preset defect reference images that have large differences between matching and mismatching samples but may not meet the traditional classification interface standards can also be effectively identified, thereby increasing the accuracy of the target defect detection algorithm. At the same time, this method based on index comparison can adapt to different types of cable defect detection needs, and can easily update the preset defect reference image library and its related indicators as new defect types are discovered, thereby achieving effective and flexible detection of cable surface defects.
[0050] As an implementation manner, step S100, performing multi-dimensional implicit representation mining on the cable test data set to be detected to obtain a multi-dimensional implicit representation, may include:
[0051] Step S110: obtaining a test data set of a cable to be detected, and loading the test data set of the cable to be detected into a target defect detection algorithm; the target defect detection algorithm includes an image embedding mapping operator, an acoustic wave embedding mapping operator, and an electrical parameter embedding mapping operator;
[0052] Step S120: performing implicit representation mining on the visual images in the cable test data set to be detected based on the image embedding mapping operator to obtain the image implicit representation;
[0053] Step S130: performing implicit representation mining on the acoustic wave detection data in the cable test data set to be detected based on the acoustic wave embedding mapping operator to obtain the acoustic wave implicit representation;
[0054] Step S140: performing implicit representation mining on the electrical parameter data in the cable test data set to be detected based on the electrical parameter embedding mapping operator to obtain the electrical parameter implicit representation;
[0055] Step S150: Generate a multi-dimensional implicit representation based on the image implicit representation, the sound wave implicit representation and the electrical parameter implicit representation.
[0056] Step S110 obtains the cable test data set to be tested and loads it into the target defect detection algorithm. This target defect detection algorithm is specially designed for cable surface defect detection, and contains image embedding mapping operators, acoustic wave embedding mapping operators and electrical parameter embedding mapping operators, which are specific modules in the algorithm for processing different types of data (visual images, acoustic wave detection data and electrical parameter data).
[0057] The computer system integrates different types of data into a test data set of the cable to be tested and loads it into the target defect detection algorithm. It is assumed that the target defect detection algorithm is built based on a deep learning framework, which is similar to a neural network model with a specific structure. This model is designed to process multi-type data in the cable surface defect detection task.
[0058] In step S120, the computer system mines the visual images in the test data set of the cable to be detected based on the image embedding mapping operator to obtain the implicit representation of the image. The image embedding mapping operator is a key component in the target defect detection algorithm. Its function is to convert the original visual image data into an implicit representation that can better reflect the characteristics of the cable surface defects. This conversion process involves complex feature extraction and mapping operations on the image.
[0059] Take the implementation of convolutional neural network (CNN) as an example of an image embedding mapping operator. For the 1920×1080 pixel RGB color cable surface image mentioned above, the input layer of CNN receives this image data. Assume that the first convolution layer of CNN contains 32 convolution kernels of size 3×3×3 (here 3×3 is the size of the convolution kernel on the image plane, and the last 3 is because the image is in RGB mode and has 3 channels). In the convolution operation, each convolution kernel slides on the image, and for each 3×3×3 small cube area in the image (corresponding to the three RGB channels), the elements in the convolution kernel are multiplied by the pixel values in the area and then summed to obtain a new value, which constitutes an element in the output feature map. For example, for the first 3×3×3 area in the upper left corner of the image, a value is obtained after calculation with the first convolution kernel, and then the convolution kernel slides one pixel to the right and continues to calculate until the width of the image is traversed, and then moves down one pixel, and repeats this process until the entire image is traversed. In this way, after the operation of 32 convolution kernels, 32 different feature maps will be obtained. Assume that the size of these feature maps is 1918×1078 (since the convolution kernel size is 3×3, complete convolution cannot be performed on the edge of the image, so the output feature map size will become smaller). Each element in these feature maps is a feature extracted from the original image through the convolution operation, and they are part of the implicit representation of the image. As the CNN network goes deeper, subsequent convolution layers, pooling layers, etc. continue to process these feature maps to further extract and abstract image features. For example, after 5 convolution layers and 3 pooling layers, an 8×8×128 feature map array may be obtained (here 8×8 represents the size of the feature map, and 128 represents the number of feature maps, that is, the depth). This feature map array can be regarded as a form of implicit image representation obtained by mining the implicit representation of the original visual image. It is no longer the intuitive pixel information in the original image, but an abstract feature representation that is more closely related to the surface defects of the cable after being processed by a multi-layer neural network.
[0060] In step S130, the computer system mines the acoustic wave detection data for implicit representation based on the acoustic wave embedding mapping operator to obtain the acoustic wave implicit representation. The acoustic wave embedding mapping operator is designed to process special time series data such as acoustic wave detection data. It mines hidden features related to cable surface defects in the acoustic wave data through specific algorithm operations.
[0061] Assume that a long short-term memory network (LSTM) is used as the acoustic wave embedding mapping operator. For the acoustic wave detection data time series of length 10,000 mentioned above, it is input into the LSTM network as an input sequence. Each unit in the LSTM network contains structures such as input gate, forget gate, and output gate. For example, at the first time step, the input acoustic wave data value (such as the value of the first sampling point) is multiplied by the weight matrix in the LSTM unit, plus the bias term, and then the hidden state of the unit is updated through the control mechanism of the input gate, forget gate, and output gate. As the time step advances, the acoustic wave data at each time step will have an impact on the hidden state of the LSTM unit. Assuming that the LSTM network contains 100 hidden units, after processing the entire 10,000 time steps of acoustic wave detection data, a 100-dimensional vector is finally obtained as the output of the LSTM network. This output vector is the acoustic wave implicit representation. This 100-dimensional vector contains hidden features in the acoustic wave detection data, such as the frequency change pattern of the acoustic wave, the amplitude fluctuation characteristics, and other information related to the surface defects of the cable. These features are not obvious in the original acoustic wave detection data time series, but they are mined out and represented in the form of vectors after LSTM processing, so as to facilitate subsequent comprehensive analysis with implicit representations of other dimensions.
[0062] In step S140, the computer system performs implicit representation mining on the electrical parameter data based on the electrical parameter embedding mapping operator to obtain the electrical parameter implicit representation. The electrical parameter embedding mapping operator is used to convert simple electrical parameter values (such as resistance, capacitance, and inductance) into an implicit representation that can better reflect the relationship between the cable surface defects and the electrical parameters.
[0063] Assume that the electrical parameter embedding mapping operator adopts a simple linear transformation method. For the electrical parameter data mentioned above, that is, the resistance value is 5 ohms, the capacitance value is 0.05 microfarads, and the inductance value is 0.1 millihenry. The computer system constructs a 3×5 weight matrix W, such as , the electrical parameter data is combined into a vector . Through matrix multiplication , get a 5-dimensional vector Y, , this 5-dimensional vector Y is the implicit representation of the electrical parameters. This linear transformation maps the electrical parameter data to a new feature space through the weight matrix W. In this new space, the relationship between different electrical parameter combinations and cable surface defects may be clearer, and this 5-dimensional vector can be better integrated with the implicit representation of the image and the implicit representation of the acoustic wave, providing a unified data format for subsequent comprehensive analysis.
[0064] In step S150, the computer system generates a multi-dimensional implicit representation based on the image implicit representation, the acoustic wave implicit representation and the electrical parameter implicit representation. This multi-dimensional implicit representation integrates the implicit representations previously mined in different dimensions (image, acoustic wave, electrical parameter) to form a representation that can comprehensively reflect the relationship between the various characteristics of the cable and the surface defects.
[0065] Assume that the implicit representation of the image is a 1024-dimensional vector obtained by flattening the 8×8×128 feature map array obtained above, the implicit representation of the sound wave is a 100-dimensional vector obtained through LSTM, and the implicit representation of the electrical parameter is a 5-dimensional vector obtained through linear transformation. The computer system combines these three vectors in order to obtain a new vector ,in are the elements of the implicit representation vector of the image, are the elements of the implicit representation vector of the sound wave, is the element of the electrical parameter implicit representation vector. This 1129-dimensional vector Z is the multi-dimensional implicit representation. This multi-dimensional implicit representation integrates the potential feature information of the cable in three dimensions: image, sound wave, and electrical parameters, providing a more comprehensive and in-depth data foundation for subsequent cable surface defect detection. For example, in subsequent steps, it is possible to determine whether the cable has surface defects and the type of defects by calculating the similarity between this multi-dimensional implicit representation and the preset defect reference data.
[0066] As an implementation manner, step S200, performing image implicit representation mining on a first number of preset defect reference images respectively to obtain corresponding first number of reference image implicit representations, may include:
[0067] Step S210: obtaining a first number of preset defect reference images, and loading the first number of preset defect reference images into a target defect detection algorithm; the target defect detection algorithm includes a defect image embedding mapping operator;
[0068] Step S220: performing image block division on a first number of preset defect reference images respectively to obtain a first number of corresponding image block matrices; an image block in the image block matrix represents a component element obtained after performing image block division on a preset defect reference image;
[0069] Step S230: embed a first number of image block matrices according to the defect image embedding mapping operator to obtain image representation arrays corresponding to the first number of image block matrices, perform implicit representation mining on the first number of image representation arrays to obtain implicit representations of reference images corresponding to the first number of defect reference images.
[0070] Step S210 obtains a first number of preset defect reference images and loads these images into a target defect detection algorithm. The target defect detection algorithm here includes a defect image embedding mapping operator, which is a specific module specially used to process the preset defect reference images to mine their implicit representations.
[0071] In the embodiment of the present application, assuming that the first number is 50, these 50 preset defect reference images cover various known types of cable surface defects. For example, some of the images may be images of scratches on the cable surface, and the length, width and depth of the scratches vary; another part of the images may be images of corrosion on the cable surface, and the degree and range of corrosion also vary; and some images may be images of deformation of the cable surface due to external force compression, etc. The computer system reads these 50 preset defect reference images one by one and loads them as input into the target defect detection algorithm. Assume that the target defect detection algorithm is built based on an improved convolutional neural network (CNN) structure, and the defect image embedding mapping operator in this structure is a specific layer or module combination designed specifically for processing these preset defect reference images.
[0072] In step S220, the computer system performs image segmentation on the first number of preset defect reference images to obtain the corresponding first number of image block matrices. Image segmentation is to divide the original preset defect reference image into smaller image blocks, each image block can be regarded as a local component of the original image, and these image block matrices will serve as the basic unit for subsequent processing, which is helpful to more carefully mine the features in the image.
[0073] For example, for the preset defect reference image with a resolution of 1280×720 pixels mentioned above, the computer system divides each image into blocks of 16×16 pixels. For an image, the number of blocks that can be divided in the width direction is The number of blocks that can be divided in the height direction is So the total number can be divided into image blocks. Each image block can be represented as a (The 3 here is because the RGB mode has 3 channels) small matrices, these small matrices constitute the image block matrix corresponding to the preset defect reference image. For example, for a preset defect reference image representing a scratch defect on the cable surface, each small matrix (image block) in its image block matrix contains the image information of the scratch in the local area, such as the direction of the scratch, color change, etc., in this small area. In this way, for 50 preset defect reference images, the computer system will obtain 50 corresponding image block matrices respectively.
[0074] In step S230, the computer system embeds the first number of image block matrices according to the defect image embedding mapping operator to obtain image representation arrays corresponding to the first number of image block matrices, and then performs implicit representation mining on these image representation arrays to finally obtain implicit representations of reference images corresponding to the first number of defect reference images. This process is to perform a series of complex operations on the image block matrix through the defect image embedding mapping operator to mine the deep-level features related to the cable surface defects in the image and represent them as implicit representations of the reference image.
[0075] Take the defect image embedding mapping operator based on convolutional neural network (CNN) as an example. For each image block matrix The image block is input into CNN. Assume that the first convolution layer of CNN contains 16 convolution kernels of size 3×3×3. In the convolution operation, each convolution kernel performs a convolution operation on each image block. The small cubic area (corresponding to the three RGB channels) is multiplied and summed to obtain a new value, which constitutes an element in the output feature map. After the operation of 16 convolution kernels, 16 different feature maps will be obtained for an image block. Assume that the size of these feature maps is 14×14 (since the size of the convolution kernel is 3×3, complete convolution cannot be performed on the edge of the image block, so the size of the output feature map will become smaller). As the CNN network goes deeper, subsequent convolution layers, pooling layers, etc. continue to process these feature maps. For example, after 3 convolution layers and 2 pooling layers, a 2×2×32 feature map array may be obtained for an image block (here 2×2 represents the size of the feature map, and 32 represents the number of feature maps, that is, the depth). This feature map array is the image representation array corresponding to the image block. For the image representation arrays corresponding to all image blocks of a preset defect reference image, the computer system can combine them in some way. For example, the image representation arrays of all image blocks are concatenated. Assuming that a preset defect reference image has 3600 image blocks, the image representation array of each image block is a 2×2×32 feature map array. After concatenating them, a very large array is obtained. Then this large array is further processed, such as mapping through a fully connected layer. Assuming that the fully connected layer maps this large array to a 512-dimensional vector, this 512-dimensional vector is the implicit representation of the reference image corresponding to the preset defect reference image. This implicit representation of the reference image contains the potential feature information about the surface defects of the cable in the preset defect reference image, such as the shape of the scratches, the corrosion pattern, and other deep features in the image. These features are obtained after multi-layer processing of CNN and are represented in the form of vectors, which provides a basis for subsequent comparison and matching with the test data set of the cable to be detected. For 50 preset defect reference images, the computer system will repeat the above process to obtain the corresponding 50 implicit representations of the reference image.
[0076] As an implementation manner, step S300, dividing and constructing the first number of implicit representations of reference images respectively to obtain a first number of implicit representations of matching samples respectively corresponding to one of the first number of implicit representations of reference images, and a first number of implicit representations of mismatching samples respectively corresponding to one of the first number of implicit representations of reference images, may include:
[0077] Step S310: loading implicit representations of a first number of reference images into a target defect detection algorithm; the target defect detection algorithm includes an embedding mapping operator;
[0078] Step S320: obtaining the matching sample universal parameters and the mismatching sample universal parameters embedded in the mapping operator; the matching sample universal parameters represent the algorithm parameters used to guide the matching information, the matching information represents the information that the defect reference image matches the cable test data set to be detected, the mismatching sample universal parameters represent the algorithm parameters used to guide the mismatching information, and the mismatching information represents the information that the defect reference image does not match the cable test data set to be detected;
[0079] Step S330: Based on the matching sample universal parameters and the first number of implicit representations of reference images, generate a first number of matching sample implicit representations corresponding to one of the first number of implicit representations of reference images; based on the mismatching sample universal parameters and the first number of implicit representations of reference images, generate a first number of mismatching sample implicit representations corresponding to one of the first number of implicit representations of reference images.
[0080] Step S310 loads the first number of implicit representations of reference images into the target defect detection algorithm. The target defect detection algorithm here includes an embedding mapping operator, which is a module specifically used for subsequent processing (such as division and construction operations) of the implicit representation of the reference image.
[0081] For example, in the embodiment of the present application, it is assumed that the first number is 30. 30 implicit representations of reference images have been obtained in the previous steps. These implicit representations of reference images are the results obtained after processing the preset defect reference images, and each implicit representation of reference images contains characteristic information about the cable surface defects in the specific preset defect reference images. The computer system loads these 30 256-dimensional implicit representations of reference images as input data into the target defect detection algorithm. In step S320, the computer system obtains the universal parameters of matching samples and the universal parameters of mismatching samples embedded in the mapping operator. The universal parameters of matching samples are algorithm parameters used to guide matching information, which are related to the information indicating that the defect reference image matches the test data set of the cable to be detected; the universal parameters of mismatching samples are algorithm parameters used to guide mismatching information, which are related to the information indicating that the defect reference image does not match the test data set of the cable to be detected. These parameters are pre-defined by the algorithm or obtained through pre-training, and they play a key guiding role in the subsequent construction of implicit representations of matching samples and implicit representations of mismatching samples.
[0082] Assume that the embedding mapping operator is constructed based on a pre-trained neural network model. During the pre-training process, the model learns some common feature patterns about the matching and mismatching of cable surface defects. The matching sample universal parameters and the mismatching sample universal parameters can be parameters in the form of some weight matrices or bias vectors in this neural network model. These parameters are obtained through pre-training with a large amount of cable surface defect sample data, and they contain a general understanding of the matching and mismatching of cable surface defects. For example, in the pre-training data set, if there are many cable surface scratch defect images and specific acoustic wave and electrical parameter data combinations marked as matching samples, then the matching sample universal parameters will reflect the parameter values related to the matching pattern of this scratch defect in the comprehensive feature space of image, acoustic wave and electrical parameters.
[0083] In step S330, the computer system generates a first number of matching sample implicit representations corresponding to one of the first number of reference image implicit representations based on the matching sample universal parameter and the first number of reference image implicit representations, and generates a first number of non-matching sample implicit representations corresponding to one of the first number of reference image implicit representations based on the non-matching sample universal parameter and the first number of reference image implicit representations. This step processes the reference image implicit representation through specific parameters, thereby constructing two different types of (matching and non-matching) sample implicit representations, providing more targeted data for subsequent operations.
[0084] For example, for the \(i\)th reference image implicitly represented ( ), assuming that the reference image is implicitly represented as a 256-dimensional vector), the computer system matches the sample universal parameters ( and ) to construct the implicit representation of the matching sample The calculation method can be ,in is an activation function, such as It can be a ReLU function ( ). Assume that after calculation, is a 100-dimensional vector. The elements in this vector represent the feature information of the i-th reference image implicitly representing the match with the test data set of the cable to be detected. For example, if the value of one of the elements is large, it may indicate that the defect features in the reference image (such as the length and depth of the scratches) have some correlation with the test data set of the cable to be detected in terms of matching (such as being similar to the scratch features that may exist on the surface of the cable to be detected).
[0085] Similarly, for mismatched samples, the implicit representation The computer system uses the universal parameters of mismatched samples ( and ), calculated as , assuming Is another activation function, such as the Sigmoid function After calculation, is an 80-dimensional vector, the elements of which represent the feature information of the i-th reference image that implicitly represents the mismatch between the test data set of the cable to be tested. For example, a large value of an element may indicate a certain correlation between the defect feature in the reference image and the test data set of the cable to be tested in terms of mismatch (e.g., the corrosion feature in the reference image is quite different from the actual surface of the cable to be tested).
[0086] The implicit representation of matching samples and the implicit representation of mismatching samples focus on the matching and mismatching features of the reference image and the cable test data set to be detected, respectively. This makes the feature representation of the data more targeted and can better reflect the different situations in cable surface defect detection. This division construction helps to narrow the search space for subsequent operations (such as establishing a search array, performing saliency focusing, etc.). Since the implicit representation of matching samples and the implicit representation of mismatching samples have classified the data according to the characteristics of matching and mismatching, the algorithm can perform calculations more targetedly when processing these data, avoiding indiscriminate processing of all data, thereby improving the overall operation efficiency of the algorithm. Furthermore, from the perspective of generalization ability, this construction method helps to improve the generalization ability of the model. By clearly distinguishing the implicit representation of matching and mismatching samples, the model can better learn various situations in cable surface defect detection, including the similarities and differences between different types of defects. When faced with new cable surface defect data, the model can make more accurate judgments.
[0087] As an implementation manner, step S400, establishing a search array according to a first number of matching sample implicit representations and a first number of non-matching sample implicit representations, performing saliency focusing on the multi-dimensional implicit representations based on the search array, and obtaining a saliency focusing array may include:
[0088] Step S410: loading the first number of matching sample implicit representations, the first number of non-matching sample implicit representations, and the multi-dimensional implicit representation into a target defect detection algorithm; the target defect detection algorithm includes a saliency focusing operator;
[0089] Step S420: establishing a search array of an association mapping mechanism based on a first number of implicit representations of matching samples and a first number of implicit representations of non-matching samples according to a saliency focus operator, establishing an anchor array of an association mapping mechanism according to a multi-dimensional implicit representation, and establishing a result array of an association mapping mechanism according to a multi-dimensional implicit representation;
[0090] Step S430: construct an initial saliency focus array based on the search array, the anchor array, the result array and the dimensions corresponding to the multi-dimensional implicit representation, perform feedforward calculation on the initial saliency focus array, and obtain a saliency focus array corresponding to the multi-dimensional implicit representation.
[0091] Step S410 loads the first number of implicit representations of matching samples, the first number of implicit representations of mismatching samples, and the multi-dimensional implicit representation into the target defect detection algorithm. Assume that the first number is 20. The previous step obtains 20 implicit representations of matching samples and 20 implicit representations of mismatching samples. For example, each implicit representation of matching samples may be a 100-dimensional vector, the elements of which are obtained by processing the previous step (such as step S300), and contain feature information of matching the preset defect reference image with the test data set of the cable to be detected, such as the mapping of the length and depth of the scratches on the cable surface in a specific representation space; each implicit representation of mismatching samples may be an 80-dimensional vector, containing mismatching feature information. The multi-dimensional implicit representation is mined from the test data set of the cable to be detected (including visual images, acoustic wave detection data, and electrical parameter data). Assume that it is a 300-dimensional vector, which integrates various feature information of the cable, such as the mapping of the texture features extracted from the visual image, the frequency features in the acoustic wave detection data, and the resistance-capacitance relationship in the electrical parameters in a specific representation space. The computer system loads these 20 100-dimensional implicit representations of matching samples, 20 80-dimensional implicit representations of mismatching samples, and 300-dimensional multi-dimensional implicit representation as input data into the target defect detection algorithm, and the saliency focusing operator in the algorithm will subsequently process these data.
[0092] In step S420, the computer system establishes a search array (i.e., Query) of an association mapping mechanism (i.e., a cross-attention mechanism) based on the implicit representation of the first number of matching samples and the implicit representation of the first number of non-matching samples according to the saliency focusing operator, an anchor array (i.e., Key) of the association mapping mechanism according to the multi-dimensional implicit representation, and a result array (i.e., Value) of the association mapping mechanism according to the multi-dimensional implicit representation. This step constructs key arrays for subsequent saliency focusing operations through specific calculations and mapping relationships, and these arrays play an important role in associating different data features.
[0093] For example, suppose that the saliency focus operator is built based on the principle of the attention mechanism in the Transformer architecture. For the construction of the search array, the computer system first processes the implicit representation of the matching samples and the implicit representation of the non-matching samples. For example, 20 100-dimensional implicit representations of matching samples and 20 80-dimensional implicit representations of non-matching samples are concatenated to obtain a vector of length 3600. Then, this vector is transformed by a learnable linear transformation matrix Wq (assuming that Wq is a 3600×500 matrix) to obtain a 500-dimensional search array Q. Each element of this search array Q combines the information of the implicit representation of the matching samples and the implicit representation of the non-matching samples, and is mapped to a new feature space through linear transformation for subsequent association operations with other arrays.
[0094] For the anchor array and the result array, you can refer to the above process and transform the multi-dimensional implicit representation based on a linear transformation matrix to obtain the result array.
[0095] In step S430, the computer system constructs an initial saliency focus array based on the search array, the anchor array, the result array, and the dimensions corresponding to the multi-dimensional implicit representation, performs feedforward calculation on the initial saliency focus array, and obtains a saliency focus array corresponding to the multi-dimensional implicit representation.
[0096] For example, an initial saliency focus array is first constructed. The computer system calculates the similarity score between the search array Q and the anchor array K. For example, the method for calculating the similarity score is to perform a dot product operation followed by normalization.
[0097] Next, the feedforward calculation is performed. Assume that there is a feedforward neural network FFN, whose structure is two linear layers with an activation function (such as ReLU) in the middle. The initial saliency focus array A is flattened into a vector (assuming the length is 500×400=200000) and input into the FFN. After the calculation of FFN, a new vector is obtained, and then this vector is reshaped into an array of the same dimension (300 dimensions) as the multi-dimensional implicit representation. This array is the saliency focus array corresponding to the multi-dimensional implicit representation. For example, if the value of an element in the saliency focus array is large, it means that the corresponding feature in the multi-dimensional implicit representation has a high correlation with the search array (constructed by the implicit representation of matching samples and the implicit representation of unmatched samples), and these features may have more important significance in cable surface defect detection.
[0098] The above-mentioned search array, anchor array and result array are constructed to establish an association mapping mechanism. This mechanism can effectively link the implicit representation of matching samples and the implicit representation of mismatching samples with the multi-dimensional implicit representation. For example, in the online detection of cable surface defects, the search array integrates the information related to defect matching and mismatching. Through the association calculation with the anchor array (built based on the multi-dimensional implicit representation), the feature parts in the multi-dimensional implicit representation that are most related to defect matching and mismatching can be found, thereby providing a basis for the subsequent saliency focusing. The saliency focusing array can highlight the important feature information related to the search array in the multi-dimensional implicit representation. This helps to focus the algorithm's attention on those cable features that are closely related to the matching and mismatching relationship of the preset defect reference image in the cable surface defect detection. The method based on the association mapping mechanism and saliency focusing avoids the indiscriminate treatment of all data features. By focusing on important features, unnecessary calculations can be reduced and the algorithm's operating efficiency in the cable surface defect detection task can be improved.
[0099] As an implementation manner, step S420, establishing a search array of an association mapping mechanism according to a first number of implicit representations of matching samples and a first number of implicit representations of non-matching samples, establishing an anchor array of an association mapping mechanism according to a multi-dimensional implicit representation, and establishing a result array of an association mapping mechanism according to a multi-dimensional implicit representation, may include:
[0100] Step S421: performing inner product calculation on the search mapping matrix in the saliency focus operator, the implicit representations of the first number of matching samples, and the implicit representations of the first number of non-matching samples to obtain a search array of the association mapping mechanism;
[0101] Step S422: performing inner product calculation on the anchor mapping matrix in the saliency focusing operator and the multi-dimensional implicit representation to obtain the anchor array of the association mapping mechanism;
[0102] Step S423: perform inner product calculation on the result mapping matrix in the saliency focusing operator and the multi-dimensional implicit representation to obtain the result array of the association mapping mechanism; the search mapping matrix, the anchor mapping matrix and the result mapping matrix are all composed of adjustable parameters in the saliency focusing operator.
[0103] Step S421 performs inner product calculation on the search mapping matrix in the saliency focus operator, the implicit representations of the first number of matching samples, and the implicit representations of the first number of non-matching samples to obtain a search array of the association mapping mechanism. This search mapping matrix is a key component in the saliency focus operator. By performing inner product calculation with the implicit representation of the sample, the implicit representation of the sample can be converted into a search array, which will be used for subsequent association operations with other arrays to explore the relationship between the data.
[0104] For example, in the embodiment of the present application, it is assumed that the saliency focus operator is based on an improved attention mechanism. Assume that the first number is 30, that is, there are 30 implicitly represented matching samples and 30 implicitly represented non-matching samples. Each matching sample is implicitly represented as a 120-dimensional vector, for example, the elements of which may represent the matching-related features of specific defects (such as scratches, corrosion, etc.) on the cable surface in the comprehensive feature space of images, sound waves, electrical parameters, etc. Each non-matching sample is implicitly represented as a 100-dimensional vector, containing feature information related to the non-matching.
[0105] Assume that the search mapping matrix in the saliency focusing operator is a (Here, the total dimension of the implicit representation of matching samples and the implicit representation of non-matching samples is mapped to a matrix of 500 dimensions). The computer system first concatenates the implicit representations of 30 matching samples and 30 non-matching samples to obtain a matrix of length The computer system then performs the inner product calculation , and a 500-dimensional search array Q is obtained. Each element in this search array Q integrates the information of the implicit representation of the matching sample and the implicit representation of the mismatching sample, and is mapped to a new feature space through the inner product calculation with the search mapping matrix. For example, if the value of an element in Q is large, it may mean that there is a feature combination with a strong matching or mismatching relationship with the cable surface defects in the original sample implicit representation, which is prominently reflected in this new feature space after mapping.
[0106] This application obtains a search array by calculating the inner product of the search mapping matrix and the sample implicit representation, thereby realizing a re-encoding and feature conversion of the sample implicit representation data. This conversion represents the feature information originally scattered in the matching sample implicit representation and the mismatching sample implicit representation in the search array in a new and more concentrated way. For example, different types of defect features (such as scratches and corrosion) may be distributed in different dimensions and vector elements in the original sample implicit representation. After the search array is obtained through the inner product calculation, the common and difference features related to the defects can be reflected in the search array in a more unified way, which is convenient for subsequent association operations with other arrays.
[0107] In step S422, the computer system performs inner product calculation on the anchor mapping matrix in the saliency focus operator and the multi-dimensional implicit representation to obtain the anchor array of the association mapping mechanism. The anchor mapping matrix is a component of the saliency focus operator, and the anchor array will be used as a reference standard to measure the degree of association between the search array and the multi-dimensional implicit representation.
[0108] Assume that the multi-dimensional implicit representation is a 300-dimensional vector mined from the visual image, acoustic wave detection data, and electrical parameter data of the cable to be detected. For example, the elements in this vector contain the mapping of the texture features of the cable surface (extracted from the visual image), the frequency features of the acoustic wave (extracted from the acoustic wave detection data), and the resistance-capacitance relationship in the electrical parameters (extracted from the electrical parameter data) in a specific representation space.
[0109] The anchor mapping matrix Wanchor in the saliency focus operator is a 300×400 matrix. The computer system performs inner product calculations to obtain a 400-dimensional anchor array K. Each element in this anchor array K is the result of mapping the features in the multi-dimensional implicit representation through the anchor mapping matrix.
[0110] In the embodiment of the present application, the anchor array provides a standard reference for the association between the search array and the multi-dimensional implicit representation. By mapping the multi-dimensional implicit representation to the anchor array, the search array (related to the implicit representation of matching samples and the implicit representation of non-matching samples) and the multi-dimensional implicit representation can be compared and interacted under the same association framework. In the detection of cable surface defects, the search array contains information that matches and does not match the preset defect reference image, while the anchor array represents the multi-dimensional features of the cable to be detected in a specific way. The association calculation between the two can reveal the similarities and differences between the preset defects and the actual features of the cable to be detected.
[0111] In step S423, the computer system performs inner product calculation on the result mapping matrix in the saliency focus operator and the multi-dimensional implicit representation to obtain a result array of the association mapping mechanism. The result mapping matrix is part of the saliency focus operator, and the result array will provide result information related to the association relationship in subsequent calculations.
[0112] For example, it is also assumed that the multi-dimensional implicit representation is a 300-dimensional vector, which contains a comprehensive representation of various cable features. The result mapping matrix Wresult in the saliency focusing operator is a 300×400 matrix. The computer system performs inner product calculations to obtain a 400-dimensional result array V. For example, the elements in the result array V reflect the results of the features in the multi-dimensional implicit representation after being mapped by the result mapping matrix. Assuming that an element in the multi-dimensional implicit representation is related to the acoustic wave frequency characteristics of the cable surface, after the inner product calculation with the result mapping matrix, the corresponding element in the result array will contain the new representation information of this acoustic wave frequency feature under a specific association relationship, and this information will play a role in subsequent calculations.
[0113] The result array provides important result information for the final association operation. It participates in the calculation together with the search array and the anchor array, and can accurately reflect the association relationship between the data. For example, in the detection of cable surface defects, the search array contains the matching and non-matching information of the preset defect reference image, the anchor array provides a reference mapping of the multi-dimensional implicit representation of the cable to be detected, and the result array provides further result information about the features in the multi-dimensional implicit representation under this association framework. The collaborative calculation between the three can more accurately determine whether there are defects on the cable surface and the type of defects.
[0114] As an implementation mode, step S430, constructing an initial saliency focus array based on the search array, the anchor array, the result array and the dimensions corresponding to the multi-dimensional implicit representation, may include: flipping the result array to obtain a first aggregation parameter, using the inner product calculation result of the search array and the first aggregation parameter as the second aggregation parameter, generating a third aggregation parameter based on the second aggregation parameter and the dimensions corresponding to the multi-dimensional implicit representation, standardizing the third aggregation parameter to obtain a standardized parameter, and using the inner product calculation result of the standardized parameter and the result array as the initial saliency focus array.
[0115] The above implementation method constructs an initial saliency focus array according to the search array, the anchor array, the result array, and the corresponding dimensions of the multi-dimensional implicit representation.
[0116] Assume that in the embodiment of the present application, the search array Q is a 500-dimensional vector, which is constructed based on the implicit representation of matching samples and the implicit representation of mismatching samples in the previous step (such as step S421), and its elements contain comprehensive feature information related to the matching and mismatching of cable surface defects. For example, some elements in the vector may be related to the mapping of features such as the length and depth of scratches on the cable surface in a specific representation space, and this information reflects the relationship between the preset defect reference image and the test data set of the cable to be detected in terms of matching or mismatching.
[0117] The result array V is assumed to be a 400-dimensional vector, which is obtained by calculating the inner product of the result mapping matrix in the saliency focusing operator and the multi-dimensional implicit representation (step S423). The multi-dimensional implicit representation integrates the feature information obtained by mining the visual image of the cable, the acoustic wave detection data, and the electrical parameter data. For example, the elements in the result array V may contain information such as the cable surface texture features, the acoustic wave frequency features, and the resistance-capacitance relationship in the electrical parameters after specific mapping.
[0118] First, the computer system performs a flip operation on the result array V to obtain the first aggregate parameter. The flip operation can be performed by reversing the order of the elements. Assume , after flipping, we get ,this This is the first aggregation parameter. The purpose of this flipping operation may be to change the relative position relationship between the elements of the result array to meet the needs of subsequent calculations and to explore the relationship between data from different angles.
[0119] Next, the computer system performs an inner product calculation on the search array Q and the first aggregation parameter \(V'\) to obtain a second aggregation parameter. For example, the inner product calculation , a scalar value is obtained, which is the second aggregation parameter. This calculation result combines the information of the search array and the flipped result array, reflecting a degree of correlation between the two. In cable surface defect detection, this degree of correlation may imply a potential connection between the preset defect reference image and the actual characteristics of the cable to be detected (reflected by the result array), which is based on the perspective of matches and mismatches contained in the search array.
[0120] Then, the third aggregation parameter is generated according to the second aggregation parameter and the corresponding dimension of the multi-dimensional implicit representation (assuming that the multi-dimensional implicit representation is 300 dimensions). For example, if the second aggregation parameter is s, the third aggregation parameter can be generated through a certain functional relationship, such as , and a 300-dimensional vector P is obtained as the third aggregation parameter. This operation combines the previously obtained correlation degree information (the second aggregation parameter) with the dimensionality of the multi-dimensional implicit representation, and introduces the dimensionality information of the multi-dimensional implicit representation for the subsequent construction of the initial saliency focus array, which helps to consider the comprehensive influence of various aspects of the cable in the construction process.
[0121] Afterwards, the computer system performs a normalization operation on the third aggregate parameter P to obtain a normalized parameter. The normalization operation may be to divide each element in P by the norm of P (such as the L2 norm). Assume , whose L2 norm is , then the standardized elements are , the resulting vector It is the standardized parameter. The standardization operation helps to adjust the data to a uniform scale, avoiding the magnitude difference of the data from having too much impact on subsequent calculations, making the contribution of different features in subsequent calculations more balanced.
[0122] Finally, the computer system calculates the inner product of the normalized parameter and the result array \(V\) to obtain the initial saliency focus array. , and obtain a 400-dimensional vector as the initial saliency focus array.
[0123] This method of constructing the initial saliency focus array makes full use of the information of the search array, the result array, and the multi-dimensional implicit representation. Through a series of operations, the data features from different sources (matching sample implicit representation, unmatching sample implicit representation, multi-dimensional implicit representation) are fused together to form a comprehensive initial saliency focus array. For example, in cable surface defect detection, this array can simultaneously consider the relationship between the preset defect reference image and the cable to be detected in multiple dimensions (image, acoustic wave, electrical parameters), so as to more comprehensively reflect the situation of cable surface defects. The standardization operation ensures the stability of the data during the calculation process. Since different feature data may have different magnitudes, the standardization operation avoids the situation where some features dominate the calculation due to their large magnitude or are ignored due to their small magnitude. In cable surface defect detection, this helps to accurately identify various types of defect features, whether they are large-scale features such as obvious scratches and corrosion, or small-scale features such as some subtle acoustic or electrical parameter changes, which can be reasonably reflected in the initial saliency focus array.
[0124] As an implementation of step S400, that is, establishing a search array according to the first number of matching sample implicit representations and the first number of non-matching sample implicit representations, performing saliency focusing on the multi-dimensional implicit representation based on the search array, and obtaining a saliency focusing array may include:
[0125] Step S401: loading a first number of matching sample implicit representations, a first number of mismatching sample implicit representations, and a multi-dimensional implicit representation into a target defect detection algorithm, wherein the target defect detection algorithm includes a saliency focus operator, and the saliency focus operator includes a second number of node working areas;
[0126] Step S402: Based on the second number of node working areas, the first number of matching sample implicit representations and the first number of non-matching sample implicit representations are respectively established as search arrays, and the search arrays and the multi-dimensional implicit representations are significantly focused to obtain regional focused implicit representations corresponding to the second number of node working areas;
[0127] Step S403: Combine the second number of regional focus implicit representations to obtain a multi-channel focus implicit representation, solve the inner product of the multi-channel focus implicit representation and the multi-channel focus parameter matrix to obtain an initial saliency focus array, perform feedforward calculation on the initial saliency focus array to obtain a saliency focus array corresponding to the multi-dimensional implicit representation; the multi-channel focus parameter matrix is an adjustable parameter in the saliency focus operator.
[0128] Step S401 loads a first number of matching sample implicit representations, a first number of non-matching sample implicit representations and a multi-dimensional implicit representation into a target defect detection algorithm. The target defect detection algorithm here includes a saliency focus operator, and the saliency focus operator includes a second number of node working areas.
[0129] In the embodiment of the present application, it is assumed that the first number is 25. The implicit representations of the 25 matching samples and the implicit representations of the 25 non-matching samples are the results obtained in the previous step (such as step S300). For example, each matching sample implicit representation may be a 120-dimensional vector, the elements of which represent the feature information of the preset defect reference image matching the test data set of the cable to be detected, such as the length and depth of the scratches on the cable surface and its mapping in the image, sound wave, and electrical parameter comprehensive feature space; each non-matching sample implicit representation may be a 100-dimensional vector, containing the non-matching feature information. It is assumed that the multi-dimensional implicit representation is a 300-dimensional vector mined from the visual image, sound wave detection data, and electrical parameter data of the cable to be detected. The elements in this vector include the mapping of the texture features of the cable surface (extracted from the visual image), the frequency features of the sound wave (extracted from the sound wave detection data), and the resistance-capacitance relationship in the electrical parameters (extracted from the electrical parameter data) in a specific representation space. It is assumed that the second number of node working areas in the saliency focusing operator is 5. These node working areas can be regarded as different functional partitions within the saliency focusing operator, each with specific computational logic and parameter settings, similar to different layers or submodules in a neural network. The computer system loads these 25 120-dimensional matching sample implicit representations, 25 100-dimensional mismatching sample implicit representations, and 300-dimensional multi-dimensional implicit representations into the target defect detection algorithm containing these five node working areas.
[0130] This step brings together data from different sources and types into the target defect detection algorithm, providing a data basis for subsequent comprehensive processing.
[0131] In step S402, the computer system establishes the first number of matching sample implicit representations and the first number of unmatched sample implicit representations as search arrays based on the second number of node working areas, performs saliency focusing on the search array and the multi-dimensional implicit representation, and obtains region-focused implicit representations corresponding to the second number of node working areas.
[0132] For example, for each node working area (taking the first node working area as an example), the computer system first processes 25 matching sample implicit representations and 25 non-matching sample implicit representations to construct a search array. Assume that for the matching sample implicit representation, the computer system uses a specific linear transformation matrix (For example is a 120×25×200 matrix) transforms the 25 120-dimensional matching sample implicit representations to obtain a 200-dimensional vector part; for the unmatched sample implicit representation, another linear transformation matrix (For example is a 100×25×150\) matrix) transforms the implicit representation of 25 100-dimensional mismatched samples to obtain a 150-dimensional vector part. Then these two vector parts are concatenated to obtain a 350-dimensional search array (Corresponding to the first node working area).
[0133] Search array The 300-dimensional multi-dimensional implicit representation performs a saliency focus operation. Assuming that a calculation method based on the attention mechanism is adopted, the similarity score is first calculated. , where K is a linear transformation matrix (For example is a 300×400 matrix) to transform the multi-dimensional implicit representation to obtain a 400-dimensional anchor array (similar to the key in the standard attention mechanism), Then calculate , where V is another linear transformation matrix (For example is a 300×400 matrix) to transform the multi-dimensional implicit representation to obtain a 400-dimensional array of results (similar to the standard attention mechanism , obtained It is the implicit representation of the area focus corresponding to the working area of the first node. Assume is a 400-dimensional vector.
[0134] In the same way, the computer system repeats the above operations in the other 4 node working areas (a total of 5 node working areas), and obtains These four search arrays are obtained by focusing on the saliency of the multi-dimensional implicit representation These four areas focus on implicit representation.
[0135] By constructing search arrays in different node working areas and performing significant focusing, the relationship between data can be mined from multiple perspectives. In cable surface defect detection, different node working areas may focus on different aspects of feature associations. For example, a node working area may focus more on the relationship between cable surface scratch defects and acoustic frequency characteristics, and another node working area may focus more on the relationship between corrosion defects and electrical parameters. This multi-perspective feature mining helps to capture the complex relationship between cable surface defects and various features more comprehensively. The operation mode based on node working areas increases the interpretability of the algorithm. Each node working area can be regarded as a relatively independent processing unit, and the regional focus implicit representation of its output has a specific meaning and can be associated with specific concepts or features in cable surface defect detection. This helps to understand how the algorithm processes data and discovers feature relationships at different levels, and has better interpretability than traditional black-box algorithms.
[0136] In step S403, the computer system combines the second number of regional focus implicit representations to obtain a multi-channel focus implicit representation, performs inner product calculation on the multi-channel focus implicit representation and the multi-channel focus parameter matrix (which is a weight matrix) to obtain an initial saliency focus array, performs feedforward calculation on the initial saliency focus array, and obtains a saliency focus array corresponding to the multi-dimensional implicit representation. This step combines the regional focus implicit representation, performs inner product calculation and feedforward calculation with the weight matrix, and finally obtains a saliency focus array corresponding to the multi-dimensional implicit representation. This array can comprehensively reflect the overall correlation characteristics between the data.
[0137] Assume that 5 regions of focus implicit representation have been obtained , each of which is a 400-dimensional vector. The computer system combines these five vectors, for example, by a simple concatenation operation to obtain a multi-channel focused implicit representation M = , which is a 2000-dimensional (400×5) vector.
[0138] Assume that the multi-channel focusing parameter matrix is a 2000×300 weight matrix. The computer system calculates the multi-channel focusing implicit representation M and the multi-channel focusing parameter matrix The inner product I=MWp of , we get a 300-dimensional initial saliency focus array I. The elements in this initial saliency focus array are obtained by multiplying the multi-channel focus implicit representation with the weight matrix. The elements in the weight matrix determine the contribution of different channels (regional focus implicit representation) to the final result. For example, if If a row of elements in has a larger weight associated with a specific feature in the implicit representation of a certain region focus, then the element corresponding to this feature will be more affected in the initial saliency focus array.
[0139] Next, the initial saliency focus array I is fed forward. Assume that the feedforward calculation is implemented by a simple three-layer neural network. The first layer has 300 input neurons and 150 output neurons, and the activation function is the ReLU function; the second layer has 150 input neurons and 100 output neurons, and the activation function is the Sigmoid function; the third layer has 100 input neurons and 300 output neurons, and the activation function is the Tanh function. The computer system inputs the initial saliency focus array I into this neural network, and after three layers of calculation, the saliency focus array F corresponding to the final multi-dimensional implicit representation is obtained. The elements in this saliency focus array F integrate the results of all previous operations and can more accurately reflect the overall correlation between the multi-dimensional implicit representation and the implicit representation of matching samples and the implicit representation of non-matching samples.
[0140] Multiple regional focus implicit representations are combined into a multi-channel focus implicit representation, and then the results of different node working areas are integrated through the inner product operation with the multi-channel focus parameter matrix. In cable surface defect detection, this means that the feature relationships mined from various angles can be integrated to obtain a more comprehensive and integrated representation of the relationship between cable surface defects and various features. Feedforward calculation further optimizes the results. Through the feedforward calculation of the neural network, the initial saliency focus array can be nonlinearly transformed to better fit the complex relationship between the data. In cable surface defect detection, this nonlinear transformation helps to more accurately capture those complex and nonlinear feature associations, such as the possible nonlinear relationship between cable surface defects and various electrical parameters, thereby improving the accuracy of defect detection.
[0141] As an implementation manner, step S500, constructing a first number of matching sample indicators corresponding to one of the first number of matching sample implicit representations, and a first number of non-matching sample indicators corresponding to one of the first number of non-matching sample implicit representations, based on the saliency focus array, may include:
[0142] Step S510: taking the focusing results corresponding to the implicit representations of the first number of matching samples in the saliency focusing array as the first number of matching sample parameters, performing inner product calculations on the first number of matching sample parameters and the index algorithm parameters respectively, and obtaining the matching sample indexes corresponding to the implicit representations of the first number of matching samples respectively;
[0143] Step S520: taking the focusing results corresponding to the implicit representations of the first number of mismatched samples in the saliency focusing array as the first number of mismatched sample parameters, performing inner product calculations on the first number of mismatched sample parameters and the indicator algorithm parameters respectively, to obtain the mismatched sample indicators corresponding to the implicit representations of the first number of mismatched samples respectively.
[0144] The saliency focus array includes focus results related to the first number of implicit representations of matching samples and the implicit representations of non-matching samples. For the implicit representations of matching samples, the computer system defines the corresponding focus results as the first number of matching sample parameters. These parameters are the basis for the subsequent calculation of matching sample indicators. Then, the computer system introduces the indicator algorithm parameter, which is pre-set and used to perform inner product calculation with the matching sample parameters.
[0145] Assume that in the embodiment of the present application, the first number is set to 3, that is, there are 3 matching samples implicitly represented. The focusing results (matching sample parameters) corresponding to the implicit representations of the 3 matching samples in the saliency focusing array are in vector form: [1,2,3], [4,5,6], [7,8,9]. The indicator algorithm parameter is set to the vector [0.1, 0.2, 0.3].
[0146] The computer system calculates the inner product of the first matching sample parameter [1, 2, 3] and the indicator algorithm parameter [0.1, 0.2, 0.3], that is: (1*0.1)+(2*0.2)+(3*0.3)=0.1+0.4+0.9=1.4. In the same way, the other two matching sample parameters are calculated to obtain the corresponding results.
[0147] Through the inner product calculation, the focusing results in the significant focusing array can be effectively associated with the pre-set index algorithm parameters. The index algorithm parameters can be customized according to the needs of cable surface defect detection. For example, it can reflect the importance weights of different dimensions (such as image dimension, acoustic wave dimension, and electrical parameter dimension) when judging matching samples. In this way, the matching sample index obtained can comprehensively consider multi-dimensional information, thereby more accurately measuring the correlation between the implicit representation of each matching sample and the overall detection target, which helps to improve the accuracy of defect detection.
[0148] Step S520 is similar to step S510, but is for the implicit representation of mismatched samples. The computer system uses the focusing results corresponding to the implicit representation of the first number of mismatched samples in the saliency focusing array as the first number of mismatched sample parameters. Similarly, the inner product calculation is performed using the pre-set indicator algorithm parameters and these mismatched sample parameters.
[0149] This way of calculating the mismatched sample index corresponds to the way of calculating the matched sample index. In cable surface defect detection, such calculations can clarify the degree of relationship between the implicit representation of each mismatched sample and the detection target. Combined with the matched sample index, the relationship between the preset defect reference image and the test data set of the cable to be detected can be comprehensively evaluated. For example, if the matched sample index of a preset defect reference image is significantly higher than the mismatched sample index, then the image is more likely to be related to the actual defect of the cable to be detected. This helps to accurately screen out the target defect reference image related to the test data set of the cable to be detected from many preset defect reference images, thereby improving the accuracy and effectiveness of the entire detection algorithm.
[0150] Steps S510 and S520 can make full use of the information in the saliency focus array and comprehensively consider the characteristic relationship of multi-dimensional data (such as the visual image of the cable, the acoustic wave detection data and the electrical parameter data) in the matching and non-matching situations. This avoids the complexity of setting a category classification interface for each preset defect reference image in the traditional classification method, and improves the generalization ability of the algorithm.
[0151] As an implementation manner, the first number of preset defect reference images includes a candidate defect reference image, the first number of matching sample indicators includes a candidate matching sample indicator corresponding to the candidate defect reference image, and the first number of non-matching sample indicators includes a candidate non-matching sample indicator corresponding to the candidate defect reference image. Based on this, step S600, based on the first number of matching sample indicators and the first number of non-matching sample indicators, selects a target defect reference image related to the cable test data set to be detected from the first number of preset defect reference images, which may include:
[0152] Step S610: if the candidate matching sample index is greater than the candidate non-matching sample index, the candidate defect reference image is used as a target defect reference image associated with the cable test data set to be detected;
[0153] Step S620: If the candidate matching sample index is not greater than the candidate non-matching sample index, it is determined that the candidate defect reference image is not related to the cable test data set to be detected.
[0154] In step S610, for each candidate defect reference image, the corresponding candidate matching sample index and candidate mismatching sample index are compared. The candidate matching sample index and candidate mismatching sample index are calculated based on the saliency focus array in the previous step (such as step S500), and these indexes reflect the degree of association between the candidate defect reference image and the cable test data set to be detected in terms of matching and mismatching.
[0155] Assume that in an embodiment of the present application, there are 5 candidate defect reference images (i.e., the first number is 5). For the first candidate defect reference image, the calculation result of its candidate matching sample index is 0.8, and the candidate mismatching sample index is 0.3. The index value here can be understood as being obtained through a series of calculations based on a multi-dimensional implicit representation (including a comprehensive consideration of the visual image of the cable, acoustic wave detection data, and electrical parameter data), for example, it may be the result obtained by weighted summation of feature vectors of different dimensions. The computer system compares these two indicators, 0.8 is greater than 0.3, so the computer system determines that this candidate defect reference image is related to the cable test data set to be detected, and uses it as the target defect reference image.
[0156] For other candidate defect reference images, such as the second candidate defect reference image, the candidate matching sample index is 0.6, and the candidate mismatching sample index is 0.55. Although the difference is small, since 0.6 is greater than 0.55, the computer system also determines it as the target defect reference image related to the cable test data set to be detected.
[0157] By comparing the matching and non-matching sample indicators, the defect reference images related to the cable test data set to be tested can be effectively screened out. In cable surface defect detection, this helps to accurately identify the types of defects that may exist on the cable surface. Compared with traditional classification methods, there is no need to set a complex classification interface for each candidate defect reference image, which reduces the complexity of the algorithm. At the same time, this method based on indicator comparison can better adapt to the comprehensive judgment of multi-dimensional data (visual images, acoustic wave detection data, and electrical parameter data), and improve the accuracy of detection.
[0158] In step S620, the operation is also performed for each candidate defect reference image. When the candidate matching sample index is not greater than the candidate mismatching sample index, it indicates that the candidate defect reference image is more strongly associated with the cable test data set to be detected in terms of mismatching features, or is less associated with the matching features. Based on this situation, the computer system determines that the candidate defect reference image is not related to the cable test data set to be detected.
[0159] This judgment method helps to exclude candidate defect reference images that are not related to the cable test data set to be detected, further improving the accuracy of defect detection. In the cable surface defect detection scenario, due to the large number of candidate defect reference images, many of them may be irrelevant to the actual cable surface conditions. In this way, misjudgment can be effectively reduced, and irrelevant images can be avoided from being misidentified as images related to cable surface defects, thereby improving the reliability of the entire detection algorithm. At the same time, this indicator comparison-based method can quickly screen a large number of candidate defect reference images, improving the efficiency of detection.
[0160] The present application embodiment also provides a training process of a target defect detection algorithm, which may specifically include the following steps:
[0161] Step S10: obtaining a cable test data set template to be detected and a priori mark of the cable test data set template to be detected, loading the cable test data set template to be detected into the initial defect detection algorithm, and performing multi-dimensional implicit representation mining on the cable test data set template to be detected based on the multi-dimensional embedding mapping operator of the initial defect detection algorithm to obtain a multi-dimensional template implicit representation; the initial defect detection algorithm also includes a defect image embedding mapping operator, an embedding mapping operator and a saliency focusing operator;
[0162] Step S20: obtaining a defect reference image set, and performing implicit representation mining on the defect reference images in the defect reference image set according to the defect image embedding mapping operator to obtain an implicit representation of the defect reference image;
[0163] Step S30: dividing and constructing the implicit representation of the defect reference image according to the embedding mapping operator, obtaining an implicit representation of a matching template corresponding to the implicit representation of the defect reference image, and an implicit representation of a mismatching template corresponding to the implicit representation of the defect reference image; the implicit representation of the matching template includes a feature indicating that the corresponding defect reference image matches the template of the cable test data set to be detected, and the implicit representation of the mismatching template includes a feature indicating that the corresponding defect reference image does not match the template of the cable test data set to be detected;
[0164] Step S40: according to the saliency focusing operator, the matching template implicit representation and the non-matching template implicit representation are established as a search array, and the multi-dimensional template implicit representation is saliency focused based on the search array to obtain a template saliency focusing array, and a matching template index corresponding to the matching template implicit representation and a non-matching template index corresponding to the non-matching template implicit representation are generated according to the template saliency focusing array; the template saliency focusing array is used to characterize the correlation between the search array and the multi-dimensional template implicit representation;
[0165] Step S50: Generate defect reference image confidence based on matching template index and non-matching template index, generate algorithm training cost based on prior label of cable test data set template to be detected and defect reference image confidence, optimize algorithm parameters of embedding mapping operator and saliency focusing operator of initial defect detection algorithm according to algorithm training cost, until initial defect detection algorithm meets preset training stop condition, use multi-dimensional embedding mapping operator, defect image embedding mapping operator, optimized embedding mapping operator and optimized saliency focusing operator as target defect detection algorithm; target defect detection algorithm is used to detect defect reference image related to cable test data set to be detected.
[0166] In step S10, the data structure of the cable test data set template to be detected can refer to the aforementioned cable test data set to be detected. The priori mark is the information in advance whether there are defects on the cable surface and the defect type in these data sets. Then, the computer system loads the cable test data set template to be detected into the initial defect detection algorithm. This initial defect detection algorithm is an algorithm framework that has not been fully trained, and it contains components such as multi-dimensional embedding mapping operators. Finally, the multi-dimensional embedding mapping operator based on the initial defect detection algorithm performs multi-dimensional implicit representation mining on the cable test data set template to be detected, thereby obtaining a multi-dimensional template implicit representation.
[0167] In step S20, the computer system obtains a defect reference image set. The images in this set are all cable surface images known to have certain defects, and these images will serve as important references for subsequent algorithm training. Then, based on the defect image embedding mapping operator in the initial defect detection algorithm, the defect reference images in the defect reference image set are mined for implicit representation, thereby obtaining the implicit representation of the defect reference images.
[0168] In step S30, the implicit representation of the defect reference image is divided and constructed according to the embedding mapping operator in the initial defect detection algorithm. In this process, the implicit representation of the matching template and the implicit representation of the mismatching template corresponding to the implicit representation of the defect reference image are obtained. Among them, the implicit representation of the matching template contains features indicating that the corresponding defect reference image matches the template of the cable test data set to be detected, and the implicit representation of the mismatching template contains features indicating that the corresponding defect reference image does not match the template of the cable test data set to be detected.
[0169] In step S40, according to the saliency focusing operator in the initial defect detection algorithm, the implicit representation of the matching template and the implicit representation of the non-matching template are established as a search array. Then, based on this search array, the multi-dimensional template implicit representation of the cable test data set template to be detected is saliency focused to obtain a template saliency focusing array. Finally, according to the template saliency focusing array, a matching template index corresponding to the implicit representation of the matching template and a non-matching template index corresponding to the implicit representation of the non-matching template are generated. The template saliency focusing array here is used to characterize the correlation between the search array and the multi-dimensional template implicit representation.
[0170] In step S50, the computer system generates the confidence of the defect reference image based on the matching template index and the mismatching template index obtained in the previous steps, and then further generates the algorithm training cost in combination with the prior label of the cable test data set template to be detected, so as to optimize the algorithm parameters of the relevant operators (embedding mapping operator and saliency focusing operator) in the initial defect detection algorithm until the algorithm meets the preset training stop condition, thereby obtaining the target defect detection algorithm.
[0171] The computer system first generates the confidence of the defect reference image using the matching template index and the mismatching template index. The confidence of the defect reference image here is a value that comprehensively measures the credibility of the matching degree between the defect reference image and the template of the cable test data set to be detected. Its generation method is not a simple direct calculation, but may involve comprehensive consideration of multiple factors. For example, the matching template index reflects the degree of matching between the defect reference image and the data set template in certain features, and the mismatching template index reflects the degree of mismatch. The computer system may generate confidence based on these two indicators through a predefined function or model. This function may be designed based on experience or data statistics in the cable surface defect detection scenario. For example, if the matching template index is very high and the mismatching template index is very low, then the confidence of the generated defect reference image will be relatively high, indicating that the defect reference image is more likely to be related to the data set template; conversely, if the matching template index and the mismatching template index are close, then the confidence will be relatively low.
[0172] The computer system then generates the algorithm training cost based on the prior label of the cable test data set template to be tested and the confidence of the generated defect reference image. The prior label plays the role of a "standard answer" here. If the result predicted by the algorithm (the prediction of the relationship between the defect reference image and the data set template obtained based on the previous matching and mismatching template indicators) is consistent with the prior label, it means that the prediction of the algorithm at this data point is correct. Then, when calculating the training cost, it will be calculated in a way that is conducive to algorithm optimization based on the confidence of the defect reference image. For example, if the confidence of the defect reference image is very high, it means that the algorithm is very confident and correct in predicting this data point, then the training cost may be relatively low, so that the algorithm can continue to optimize in this direction without over-adjusting the algorithm parameters of the relevant operators. On the contrary, if the prediction result is inconsistent with the prior label, it means that the algorithm is wrong at this data point. Then, when calculating the training cost, it will be calculated in a way that prompts the algorithm to adjust quickly based on the confidence of the defect reference image, which may make the training cost relatively high, thereby prompting the algorithm to make a large adjustment to the algorithm parameters of the embedding mapping operator and the saliency focusing operator to improve the accuracy of the algorithm.
[0173] The entire step S50 is a key part of the target defect detection algorithm training process. By reasonably generating the defect reference image confidence and algorithm training cost, the algorithm can be effectively optimized so that it can more accurately identify and classify defects in online detection of cable surface defects.
[0174] As an implementation manner, step S50, generating the confidence of the defect reference image according to the matching template index and the non-matching template index, may include:
[0175] Step S51: Obtain a smoothing parameter, generate a first confidence parameter according to the matching template index and the smoothing parameter, and generate a second confidence parameter according to the mismatching template index and the smoothing parameter; the smoothing parameter is a hyperparameter for adjusting the stability efficiency of the initial defect detection algorithm;
[0176] Step S52: Generate defect reference image confidence according to the first confidence parameter and the second confidence parameter.
[0177] In an embodiment of the present application, a computer system pre-sets a smoothing parameter. This smoothing parameter is determined based on the characteristics of the cable detection data and the requirements of the algorithm. For example, suppose that when the cable surface is detected, it is found that the cable surface defect data has a certain amount of noise or the data fluctuates greatly. In order to enable the algorithm to run more stably and accurately evaluate the relationship between the defect reference image and the cable test data set template to be detected, the computer system may set a smoothing parameter, such as a smoothing parameter of 0.3. The setting of this value is based on previous experience in analyzing similar cable detection data and an estimate of the amount of adjustment required for the algorithm to run stably in this data environment.
[0178] After the computer system obtains the smoothing parameter, it generates a first confidence parameter based on the matching template index and the smoothing parameter. The matching template index is a value obtained by processing the implicit representation of the matching template according to the saliency focusing operator in the previous step, which reflects the degree of matching between the defect reference image and the cable test data set template to be detected. Assume that in the cable surface defect detection, for a certain type of defect (such as a scratch defect on the cable surface), after a series of calculations, the matching template index is 0.8. The computer system multiplies this matching template index with the smoothing parameter (0.3) to obtain a first confidence parameter of 0.8×0.3=0.24. This first confidence parameter represents a quantitative representation of the degree of matching between the defect reference image and the data set template under the consideration of the smoothing factor. Similarly, the computer system generates a second confidence parameter based on the mismatching template index and the smoothing parameter. The mismatching template index reflects the degree of mismatch between the defect reference image and the cable test data set template to be detected. This second confidence parameter represents a quantitative representation of the degree of mismatch between the defect reference image and the data set template under the consideration of the smoothing factor.
[0179] In step S52, the defect reference image confidence is generated according to the first confidence parameter and the second confidence parameter obtained in the previous step. The defect reference image confidence is a comprehensive evaluation of the credibility of the relationship between the defect reference image and the cable test data set template to be detected.
[0180] In an embodiment of the present application, the computer system may use a variety of methods to generate a defect reference image confidence based on the first confidence parameter and the second confidence parameter. A simple way is to add the first confidence parameter and the second confidence parameter. This calculation method represents an overall evaluation of the credibility of the relationship between the defect reference image and the data set template after comprehensively considering the matching and mismatching situations. Of course, in the actual algorithm, a more complex calculation method may be used. For example, according to the characteristics of the cable detection data and the optimization requirements of the algorithm, a weighted summation or other nonlinear calculation method is used to generate the defect reference image confidence. For example, the computer system may assign different weights to the first confidence parameter and the second confidence parameter according to the different importance of different types of defects on the cable surface to the detection results, and then perform a summation calculation to obtain the defect reference image confidence.
[0181] As an implementation manner, step S50, generating an algorithm training cost based on a priori label of the cable test data set template to be detected and confidence of the defect reference image, may include:
[0182] Step S53: determining a predicted defect reference image corresponding to the cable test data set template to be detected according to the matching template index and the non-matching template index;
[0183] Step S54: if the predicted defect reference image is consistent with the prior mark of the cable test data set template to be detected, the confidence of the defect reference image is used as the first cost parameter, and the algorithm training cost is generated according to the template influence factor (which is a weight) and the first cost parameter; the template influence factor is determined according to the number of matching template templates, and the matching template template is the cable test data set template to be detected that contains the prior mark of the cable test data set template to be detected in the cable test data set template set to be detected;
[0184] Step S55: If the predicted defect reference image is inconsistent with the prior label of the cable test data set template to be detected, a second cost parameter is generated according to the defect reference image confidence, and an algorithm training cost is generated according to the template influence factor and the second cost parameter.
[0185] In step S53, the computer system determines the predicted defect reference image corresponding to the cable test data set template to be detected based on the matching template index and the mismatching template index. The matching template index reflects the degree of matching between the defect reference image and the cable test data set template to be detected in certain features, and the mismatching template index reflects the degree of mismatch between the two. Through the comprehensive analysis of these two indicators, the computer system can make a judgment on the predicted defect reference image.
[0186] In an embodiment of the present application, it is assumed that there is a set of cable test data set templates, which contain multi-dimensional information such as visual images of cables, acoustic wave detection data, and electrical parameter data. At the same time, there are a series of defect reference images, which correspond to different types of cable surface defects, such as scratches, corrosion, bulges, etc. For each defect reference image, there are corresponding matching template indicators and mismatching template indicators. The computer system compares these indicators according to pre-set rules. This rule may be that if the matching template indicator is greater than the mismatching template indicator, and the difference between the two exceeds a certain threshold (for example, 0.2), then the computer system will determine this defect reference image as the predicted defect reference image corresponding to the cable test data set template to be detected. The computer system judges all defect reference images one by one in this way, thereby determining the predicted defect reference image corresponding to the cable test data set template to be detected.
[0187] In step S54, when the computer system finds that the predicted defect reference image is consistent with the prior mark of the cable test data set template to be detected, it will use the defect reference image confidence as the first cost parameter, and then generate the algorithm training cost according to the template influence factor and the first cost parameter. The template influence factor here is a weight, which is determined according to the number of matching template templates, and the matching template template is the cable test data set template to be detected that contains the prior mark of the cable test data set template to be detected in the cable test data set template set to be detected.
[0188] In an embodiment of the present application, it is assumed that there is a set of templates of a cable test data set to be tested containing 100 samples. Among them, the prior mark indicates that 30 samples have scratch defects on the cable surface. In the previous step, for an image determined as a predicted defect reference image (assuming that it represents a scratch defect), the defect reference image confidence is 0.6. The computer system first needs to determine the template influence factor. Assuming that among these 100 samples, 50 samples are matching template templates related to scratch defects (that is, samples containing scratch defect prior marks), then the template influence factor can be determined in some way based on this number. For example, the template influence factor can be set as the ratio of the number of matching template templates to the total number of samples, that is, the template influence factor = 50 / 100 = 0.5. Then, the computer system uses the defect reference image confidence (0.6) as the first cost parameter, and generates the algorithm training cost based on the template influence factor (0.5) and the first cost parameter. The way to generate the algorithm training cost here can be a simple multiplication, that is, the algorithm training cost = 0.5×0.6=0.3. The significance of this calculation method is that when the predicted defect reference image is consistent with the prior mark, the algorithm training cost is adjusted according to the defect reference image confidence and the template influence factor. If the defect reference image confidence is high and the template influence factor is also large, it means that the prediction result is relatively reliable, then the algorithm training cost is relatively low, because the algorithm performs well on this prediction and does not need to be adjusted significantly. On the contrary, if the defect reference image confidence is low or the template influence factor is small, the algorithm training cost will be relatively high, prompting the algorithm to perform more optimization.
[0189] In step S55, when the computer system finds that the predicted defect reference image is inconsistent with the prior label of the cable test data set template to be detected, it generates a second cost parameter based on the confidence of the defect reference image, and then generates an algorithm training cost based on the template influence factor and the second cost parameter.
[0190] In the embodiment of the present application, it is assumed that for a predicted defect reference image predicted as a corrosion defect, the priori mark of the cable test data set template to be detected indicates that it is a scratch defect, that is, the prediction is inconsistent with the priori mark. Assume that the defect reference image confidence of this predicted defect reference image is 0.4. The computer system first generates a second cost parameter. The way to generate the second cost parameter here can be the opposite of the correct prediction. For example, the second cost parameter can be set to 1-defect reference image confidence, that is, the second cost parameter = 1-0.4 = 0.6. Then the computer system determines the template influence factor. Assume that in the cable test data set template set to be detected, the number of matching template templates related to scratch defects is 30, and the total number of samples is 100, then the template influence factor = 30 / 100 = 0.3. Finally, the algorithm training cost is generated based on the template influence factor and the second cost parameter, for example, the algorithm training cost = 0.3×0.6 = 0.18. The significance of this calculation method is that when the prediction is wrong, the algorithm training cost is adjusted according to the defect reference image confidence and the template influence factor. Due to the prediction error, it is hoped that the algorithm can be adjusted to a greater extent. Therefore, the calculation method of the second cost parameter makes the cost relatively high. The template influence factor is combined to further adjust the algorithm training cost, prompting the algorithm to adjust the algorithm parameters of related operators (such as embedding mapping operator and saliency focusing operator) to improve the accuracy of the algorithm.
[0191] Through steps S53-S55, the computer system can reasonably generate the algorithm training cost according to the consistency between the prediction result and the prior mark, thereby effectively optimizing the initial defect detection algorithm so that it can more accurately identify and classify the defects on the cable surface during the online detection of cable surface defects.
[0192] Based on Figure 1 Based on the same principle as the method shown in , the present application also provides an online cable surface defect detection device 10, such as Figure 2 As shown, the device 10 comprises:
[0193] The data set feature extraction module 11 is used to perform multi-dimensional implicit representation mining on the cable test data set to be detected to obtain a multi-dimensional implicit representation. The cable test data set to be detected includes a visual image, acoustic wave detection data and electrical parameter data of the cable to be detected. The multi-dimensionality includes an image dimension, an acoustic wave dimension and an electrical parameter dimension.
[0194] A reference feature extraction module 12 is used to perform image implicit representation mining on a first number of preset defect reference images to obtain corresponding first number of reference image implicit representations;
[0195] A feature division construction module 13 is used to divide and construct the first number of reference image implicit representations respectively, to obtain a first number of matching sample implicit representations respectively corresponding to one of the first number of reference image implicit representations, and a first number of mismatching sample implicit representations respectively corresponding to one of the first number of reference image implicit representations, each matching sample implicit representation includes a feature indicating that its corresponding preset defect reference image matches the cable test data set to be detected, and each mismatching sample implicit representation includes a feature indicating that its corresponding preset defect reference image does not match the cable test data set to be detected;
[0196] A significant focusing module 14 is used to establish a search array according to a first number of matching sample implicit representations and a first number of non-matching sample implicit representations, and perform significant focusing on the multi-dimensional implicit representation based on the search array to obtain a significant focusing array; the significant focusing array is used to indicate the correlation between the search array and the multi-dimensional implicit representation;
[0197] An indicator determination module 15 is used to construct a first number of matching sample indicators corresponding to one of the first number of matching sample implicit representations, and a first number of non-matching sample indicators corresponding to one of the first number of non-matching sample implicit representations, based on the saliency focus array;
[0198] The defect determination module 16 is used to select a target defect reference image related to the test data set of the cable to be detected from a first number of preset defect reference images based on a first number of matching sample indicators and a first number of non-matching sample indicators; the matching sample indicator corresponding to the target defect reference image is greater than the non-matching sample indicator corresponding to the target defect reference image; and the defect indication result corresponding to the target defect reference image is used as the defect detection result of the cable to be detected.
[0199] The principle of the cable surface defect online detection device 10 can refer to the aforementioned cable surface defect online detection method, which will not be described in detail here.
[0200] An embodiment of the present application further provides a computer-readable storage medium on which a computer program is stored. When the computer program runs on a processor, the processor can execute corresponding contents in the aforementioned method embodiment.
[0201] The above description is only a partial implementation method of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.
Claims
1. A method for online detection of cable surface defects, characterized in that: include: Performing multi-dimensional implicit representation mining on a test data set of a cable to be detected to obtain a multi-dimensional implicit representation, wherein the test data set of a cable to be detected includes a visual image, acoustic wave detection data, and electrical parameter data of the cable to be detected, and the multi-dimensionality includes an image dimension, an acoustic wave dimension, and an electrical parameter dimension; Performing image implicit representation mining on a first number of preset defect reference images respectively to obtain corresponding first number of reference image implicit representations; The first number of implicit representations of reference images are divided and constructed respectively to obtain a first number of matching sample implicit representations corresponding to one of the first number of implicit representations of reference images, and a first number of mismatching sample implicit representations corresponding to one of the first number of implicit representations of reference images, each of the matching sample implicit representations includes a feature indicating that its corresponding preset defect reference image matches the cable test data set to be detected, and each of the mismatching sample implicit representations includes a feature indicating that its corresponding preset defect reference image does not match the cable test data set to be detected; Establishing a search array according to the first number of matching sample implicit representations and the first number of non-matching sample implicit representations, and performing saliency focusing on the multi-dimensional implicit representation based on the search array to obtain a saliency focusing array; the saliency focusing array is used to indicate the correlation between the search array and the multi-dimensional implicit representation; Constructing, based on the saliency focus array, a first number of matching sample indicators respectively corresponding to one of the first number of matching sample implicit representations, and a first number of non-matching sample indicators respectively corresponding to one of the first number of non-matching sample implicit representations; According to the first number of matching sample indicators and the first number of non-matching sample indicators, selecting a target defect reference image related to the cable test data set to be detected from the first number of preset defect reference images; The matching sample index corresponding to the target defect reference image is greater than the non-matching sample index corresponding to the target defect reference image; Using the defect indication result corresponding to the target defect reference image as the defect detection result of the cable to be detected; The step of dividing and constructing the first number of implicit representations of reference images respectively to obtain a first number of implicit representations of matching samples respectively corresponding to one of the first number of implicit representations of reference images, and a first number of implicit representations of mismatching samples respectively corresponding to one of the first number of implicit representations of reference images, comprises: loading the implicit representation of the first number of reference images into a target defect detection algorithm; the target defect detection algorithm includes an embedding mapping operator; Acquire the matching sample universal parameter and the mismatching sample universal parameter in the embedded mapping operator; the matching sample universal parameter represents the algorithm parameter used to guide the matching information, the matching information represents the information that the defect reference image matches the cable test data set to be detected, the mismatching sample universal parameter represents the algorithm parameter used to guide the mismatching information, and the mismatching information represents the information that the defect reference image does not match the cable test data set to be detected; Generate a first number of matching sample implicit representations corresponding to one of the first number of reference image implicit representations based on the matching sample universal parameter and the first number of reference image implicit representations, and generate a first number of mismatching sample implicit representations corresponding to one of the first number of reference image implicit representations based on the mismatching sample universal parameter and the first number of reference image implicit representations; The step of establishing a search array based on the first number of matching sample implicit representations and the first number of non-matching sample implicit representations, and performing saliency focusing on the multi-dimensional implicit representation based on the search array to obtain a saliency focusing array includes: Loading the first number of matching sample implicit representations, the first number of non-matching sample implicit representations, and the multi-dimensional implicit representation into a target defect detection algorithm; the target defect detection algorithm includes a saliency focusing operator; According to the saliency focusing operator, a search array of an association mapping mechanism is established based on the first number of implicit representations of matching samples and the first number of implicit representations of non-matching samples, an anchor array of the association mapping mechanism is established according to the multi-dimensional implicit representation, and a result array of the association mapping mechanism is established according to the multi-dimensional implicit representation; According to the search array, the anchor array, the result array and the dimension corresponding to the multi-dimensional implicit representation, an initial saliency focus array is constructed, and a feed-forward calculation is performed on the initial saliency focus array to obtain a saliency focus array corresponding to the multi-dimensional implicit representation; The search array of the association mapping mechanism is established according to the first number of implicit representations of matching samples and the first number of implicit representations of non-matching samples, the anchor array of the association mapping mechanism is established according to the multi-dimensional implicit representation, and the result array of the association mapping mechanism is established according to the multi-dimensional implicit representation, including: Performing inner product calculation on the search mapping matrix in the saliency focusing operator, the implicit representations of the first number of matching samples, and the implicit representations of the first number of non-matching samples to obtain a search array of an association mapping mechanism; Performing inner product calculation on the anchor mapping matrix in the saliency focusing operator and the multi-dimensional implicit representation to obtain the anchor array of the association mapping mechanism; Performing inner product calculation on the result mapping matrix in the saliency focusing operator and the multi-dimensional implicit representation to obtain a result array of the association mapping mechanism; the search mapping matrix, the anchor mapping matrix and the result mapping matrix are all composed of adjustable parameters in the saliency focusing operator; The constructing an initial saliency focus array according to the search array, the anchor array, the result array and the dimensions corresponding to the multi-dimensional implicit representation includes: The result array is flipped to obtain a first aggregation parameter, and the inner product calculation result of the search array and the first aggregation parameter is used as the second aggregation parameter, and a third aggregation parameter is generated according to the second aggregation parameter and the dimension corresponding to the multi-dimensional implicit representation, and the third aggregation parameter is standardized to obtain a standardized parameter, and the inner product calculation result of the standardized parameter and the result array is used as the initial saliency focus array.
2. The method according to claim 1, characterized in that The step of establishing a search array based on the first number of matching sample implicit representations and the first number of non-matching sample implicit representations, and performing saliency focusing on the multi-dimensional implicit representation based on the search array to obtain a saliency focusing array includes: Loading the first number of matching sample implicit representations, the first number of non-matching sample implicit representations, and the multi-dimensional implicit representation into a target defect detection algorithm, wherein the target defect detection algorithm includes a saliency focusing operator, and the saliency focusing operator includes a second number of node working areas; Based on the second number of node working areas, the first number of matching sample implicit representations and the first number of non-matching sample implicit representations are respectively established as search arrays, and the search arrays and the multi-dimensional implicit representations are significantly focused to obtain regional focused implicit representations corresponding to the second number of node working areas; The second number of regional focus implicit representations are combined to obtain a multi-channel focus implicit representation, the inner product of the multi-channel focus implicit representation and the multi-channel focus parameter matrix is solved to obtain an initial saliency focus array, and the initial saliency focus array is feedforward calculated to obtain a saliency focus array corresponding to the multi-dimensional implicit representation; the multi-channel focus parameter matrix is an adjustable parameter in the saliency focus operator.
3. The method according to claim 1, characterized in that The constructing, based on the saliency focus array, a first number of matching sample indicators respectively corresponding to one of the first number of matching sample implicit representations, and a first number of non-matching sample indicators respectively corresponding to one of the first number of non-matching sample implicit representations, comprises: Taking the focusing results corresponding to the implicit representations of the first number of matching samples in the saliency focusing array as the first number of matching sample parameters, performing inner product calculations on the first number of matching sample parameters and the index algorithm parameters respectively, to obtain the matching sample indexes corresponding to the implicit representations of the first number of matching samples respectively; The focusing results corresponding to the implicit representations of the first number of mismatched samples in the saliency focusing array are taken as the first number of mismatched sample parameters, and the inner product calculations are performed on the first number of mismatched sample parameters and the indicator algorithm parameters respectively to obtain the mismatched sample indicators corresponding to the implicit representations of the first number of mismatched samples.
4. The method according to claim 1, characterized in that The first number of preset defect reference images includes candidate defect reference images, the first number of matching sample indicators includes candidate matching sample indicators corresponding to the candidate defect reference images, and the first number of non-matching sample indicators includes candidate non-matching sample indicators corresponding to the candidate defect reference images; selecting a target defect reference image related to the to-be-detected cable test data set from the first number of preset defect reference images according to the first number of matching sample indicators and the first number of non-matching sample indicators includes: If the candidate matching sample index is greater than the candidate non-matching sample index, taking the candidate defect reference image as a target defect reference image associated with the cable test data set to be detected; If the candidate matching sample index is not greater than the candidate non-matching sample index, it is determined that the candidate defect reference image is not related to the cable test data set to be detected.
5. The method according to claim 1, characterized in that The multi-dimensional implicit representation mining is performed on the cable test data set to be detected to obtain the multi-dimensional implicit representation, including: Acquire a test data set of a cable to be detected, and load the test data set of the cable to be detected into a target defect detection algorithm; the target defect detection algorithm includes an image embedding mapping operator, an acoustic wave embedding mapping operator, and an electrical parameter embedding mapping operator; Based on the image embedding mapping operator, the visual images in the cable test data set to be detected are mined for implicit representation to obtain implicit representation of the image; Based on the acoustic wave embedding mapping operator, implicit representation mining is performed on the acoustic wave detection data in the cable test data set to be detected to obtain an acoustic wave implicit representation; Based on the electrical parameter embedding mapping operator, the electrical parameter data in the cable test data set to be detected is subjected to implicit representation mining to obtain an electrical parameter implicit representation; A multi-dimensional implicit representation is generated according to the image implicit representation, the sound wave implicit representation and the electrical parameter implicit representation.
6. The method according to claim 1, characterized in that The step of performing image implicit representation mining on the first number of preset defect reference images respectively to obtain corresponding first number of reference image implicit representations includes: Acquire a first number of preset defect reference images, and load the first number of preset defect reference images into a target defect detection algorithm; the target defect detection algorithm includes a defect image embedding mapping operator; Performing image block division on the first number of preset defect reference images respectively to obtain a corresponding first number of image block matrices; an image block in the image block matrix represents a component element obtained after performing image block division on a preset defect reference image; According to the defect image embedding mapping operator, the first number of image block matrices are embedded to obtain image representation arrays corresponding to the first number of image block matrices respectively, and implicit representation mining is performed on the first number of image representation arrays to obtain implicit representations of reference images corresponding to the first number of defect reference images respectively.
7. An online detection device for cable surface defects, characterized in that: include: A data set feature extraction module is used to perform multi-dimensional implicit representation mining on a test data set of a cable to be detected to obtain a multi-dimensional implicit representation, wherein the test data set of the cable to be detected includes a visual image, acoustic wave detection data, and electrical parameter data of the cable to be detected, and the multi-dimensionality includes an image dimension, an acoustic wave dimension, and an electrical parameter dimension; A reference feature extraction module, used to perform image implicit representation mining on a first number of preset defect reference images respectively, to obtain corresponding first number of reference image implicit representations; A feature division and construction module, used to divide and construct the first number of implicit representations of reference images respectively, to obtain a first number of matching sample implicit representations corresponding to one of the first number of implicit representations of reference images respectively, and a first number of non-matching sample implicit representations corresponding to one of the first number of implicit representations of reference images respectively, each of the matching sample implicit representations includes a feature indicating that its corresponding preset defect reference image matches the cable test data set to be detected, and each of the non-matching sample implicit representations includes a feature indicating that its corresponding preset defect reference image does not match the cable test data set to be detected; a saliency focusing module, configured to establish a search array according to the first number of matching sample implicit representations and the first number of non-matching sample implicit representations, and perform saliency focusing on the multi-dimensional implicit representation based on the search array to obtain a saliency focusing array; the saliency focusing array is used to indicate the correlation between the search array and the multi-dimensional implicit representation; an indicator determination module, configured to construct, based on the saliency focus array, a first number of matching sample indicators respectively corresponding to one of the first number of matching sample implicit representations, and a first number of non-matching sample indicators respectively corresponding to one of the first number of non-matching sample implicit representations; A defect determination module, configured to select a target defect reference image related to the cable test data set to be detected from the first number of preset defect reference images according to the first number of matching sample indicators and the first number of non-matching sample indicators; The matching sample index corresponding to the target defect reference image is greater than the non-matching sample index corresponding to the target defect reference image; the defect indication result corresponding to the target defect reference image is used as the defect detection result of the cable to be detected; The step of dividing and constructing the first number of implicit representations of reference images respectively to obtain a first number of implicit representations of matching samples respectively corresponding to one of the first number of implicit representations of reference images, and a first number of implicit representations of mismatching samples respectively corresponding to one of the first number of implicit representations of reference images, comprises: loading the implicit representation of the first number of reference images into a target defect detection algorithm; the target defect detection algorithm includes an embedding mapping operator; Acquire the matching sample universal parameter and the mismatching sample universal parameter in the embedded mapping operator; the matching sample universal parameter represents the algorithm parameter used to guide the matching information, the matching information represents the information that the defect reference image matches the cable test data set to be detected, the mismatching sample universal parameter represents the algorithm parameter used to guide the mismatching information, and the mismatching information represents the information that the defect reference image does not match the cable test data set to be detected; Generate a first number of matching sample implicit representations corresponding to one of the first number of reference image implicit representations based on the matching sample universal parameter and the first number of reference image implicit representations, and generate a first number of mismatching sample implicit representations corresponding to one of the first number of reference image implicit representations based on the mismatching sample universal parameter and the first number of reference image implicit representations; The step of establishing a search array based on the first number of matching sample implicit representations and the first number of non-matching sample implicit representations, and performing saliency focusing on the multi-dimensional implicit representation based on the search array to obtain a saliency focusing array includes: Loading the first number of matching sample implicit representations, the first number of non-matching sample implicit representations, and the multi-dimensional implicit representation into a target defect detection algorithm; the target defect detection algorithm includes a saliency focusing operator; According to the saliency focusing operator, a search array of an association mapping mechanism is established based on the first number of implicit representations of matching samples and the first number of implicit representations of non-matching samples, an anchor array of the association mapping mechanism is established according to the multi-dimensional implicit representation, and a result array of the association mapping mechanism is established according to the multi-dimensional implicit representation; According to the search array, the anchor array, the result array and the dimension corresponding to the multi-dimensional implicit representation, an initial saliency focus array is constructed, and a feed-forward calculation is performed on the initial saliency focus array to obtain a saliency focus array corresponding to the multi-dimensional implicit representation; The search array of the association mapping mechanism is established according to the first number of implicit representations of matching samples and the first number of implicit representations of non-matching samples, the anchor array of the association mapping mechanism is established according to the multi-dimensional implicit representation, and the result array of the association mapping mechanism is established according to the multi-dimensional implicit representation, including: Performing inner product calculation on the search mapping matrix in the saliency focusing operator, the implicit representations of the first number of matching samples, and the implicit representations of the first number of non-matching samples to obtain a search array of an association mapping mechanism; Performing inner product calculation on the anchor mapping matrix in the saliency focusing operator and the multi-dimensional implicit representation to obtain the anchor array of the association mapping mechanism; Performing inner product calculation on the result mapping matrix in the saliency focusing operator and the multi-dimensional implicit representation to obtain a result array of the association mapping mechanism; the search mapping matrix, the anchor mapping matrix and the result mapping matrix are all composed of adjustable parameters in the saliency focusing operator; The constructing an initial saliency focus array according to the search array, the anchor array, the result array and the dimensions corresponding to the multi-dimensional implicit representation includes: The result array is flipped to obtain a first aggregation parameter, and the inner product calculation result of the search array and the first aggregation parameter is used as the second aggregation parameter, and a third aggregation parameter is generated according to the second aggregation parameter and the dimension corresponding to the multi-dimensional implicit representation, and the third aggregation parameter is standardized to obtain a standardized parameter, and the inner product calculation result of the standardized parameter and the result array is used as the initial saliency focus array.
8. A computer-readable storage medium, characterized in that: A computer program is stored thereon, and when the computer program runs on a processor, the processor is caused to execute the method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Aluminum material surface defect detection device and method
CN113808099A
Plastic film production defect detection method and system
CN117670820A
Intelligent sound equipment scene identification and adaptive adjustment method and system
CN118737187A
Deep-learning-based surface defect detection method for mobile phone battery
WO2023155069A1
