Cable defect detection method and system in cable trench based on machine vision

Through deep convolution to generate an adversarial network and a multi-dimensional weak attention residual network model, it solves the problems of poor image quality and limited field of view in traditional cable trench detection methods, achieves high-quality cable defect detection, and enhances the accuracy of detection. performance and robustness.

CN118674724BInactive Publication Date: 2024-10-25STATE GRID SHANDONG ELECTRIC POWER CO LIAOCHENG POWER SUPPLY CO
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411164172.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-23
Publication Date
2024-10-25
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

Traditional cable defect detection methods in cable trenches are limited by lighting conditions and environmental noise, resulting in uneven image quality, low image diversity, inability to handle small defects and weak signals, and difficulty in adapting to a variety of different scale image features.

Method used

A deep convolutional generative adversarial network model is used to enhance cable image data and enrich the training data set, and a multi-dimensional weak attention residual network model is used to combine the weak signal attention mechanism and multi-scale perception to enhance detail capture capabilities and feature fusion.

Benefits of technology

It improves the generalization ability and detection accuracy of the model, can more effectively handle small defects and weak signals in cable images, adapts to a variety of different scale image features, and improves the accuracy and robustness of detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118674724B_ABST
    Figure CN118674724B_ABST
Patent Text Reader

Abstract

The present invention discloses a method and system for detecting cable defects in a cable trench based on machine vision, and the method includes image acquisition, image preprocessing, cable image data enhancement, cable defect detection model construction, and cable defect detection in a cable trench. The present invention relates to the field of cable defect detection technology, and specifically refers to a method and system for detecting cable defects in a cable trench based on machine vision. The present invention obtains a historical image of cable defect detection through image acquisition; an image preprocessing method of image annotation, size adjustment, image denoising, and image contrast enhancement is adopted; a deep convolution generative adversarial network model is adopted to enhance cable image data, enrich training data, and improve the generalization ability of the model; a multi-dimensional weak attention residual network model is adopted to perform cable defect detection in a cable trench, and the accuracy and robustness of detection are improved by enhancing the ability to capture details and integrating features of different scales.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of cable defect detection, and in particular to a method and system for detecting cable defects in a cable trench based on machine vision. Background Art

[0002] Cable defect detection in cable trenches refers to the systematic inspection and diagnosis of cables in cable trenches to identify and locate possible defects. This process is usually carried out through detection technologies and equipment such as infrared thermal imagers, endoscope technology and ultrasonic detection. This detection can improve the operating stability of the power system and avoid potential risks caused by cable faults.

[0003] However, traditional cable defect detection methods in cable trenches are limited by lighting conditions and environmental noise, resulting in uneven image quality and low image diversity, and cannot fully cover various scenarios and conditions in practical applications. There are also technical problems such as limited field of view and poor visual effects in the cable trench, inability to process small defects and weak signals in cable images, and difficulty in adapting to various image features of different scales in the cable trench. Summary of the invention

[0004] In view of the above situation, in order to overcome the defects of the prior art, the present invention provides a cable defect detection method and system in a cable trench based on machine vision. In view of the technical problems that the traditional cable defect detection method in the cable trench is limited by lighting conditions and environmental noise, resulting in uneven image quality and low image diversity, and cannot fully cover various scenes and conditions in practical applications, this solution creatively adopts a method of cable image data enhancement using a deep convolutional generative adversarial network model. By enhancing the preprocessed data set, a high-quality, high-image diversity data set is obtained, which enriches the training data and improves the generalization ability of the model. In view of the technical problems that the traditional cable defect detection method in the cable trench has a limited field of view in the cable trench and poor visual effects, it cannot process small defects and weak signals in the cable image and is difficult to adapt to various different scale image features in the cable trench, this solution creatively adopts a multidimensional weak attention residual network model for cable defect detection in the cable trench, combines the weak signal attention mechanism and multi-scale perception, and improves the accuracy and robustness of detection by enhancing the ability to capture details and integrating features of different scales.

[0005] The technical solution adopted by the present invention is as follows: The present invention provides a method for detecting cable defects in a cable trench based on machine vision, the method comprising the following steps:

[0006] Step S1: image acquisition;

[0007] Step S2: image preprocessing;

[0008] Step S3: cable image data enhancement;

[0009] Step S4: constructing a cable defect detection model;

[0010] Step S5: Cable defect detection in the cable trench.

[0011] Furthermore, in step S1, the image acquisition is used to acquire historical images required for cable defect detection in the cable trench, specifically to obtain a cable defect detection historical image set from the cable safety management system, and the cable defect detection historical image set specifically includes a defect-free cable historical image set and a defective cable historical image set.

[0012] Furthermore, in step S2, the image preprocessing is used to perform image preprocessing on the historical image, and specifically includes the following steps:

[0013] Step S21: image annotation, which is used to annotate historical images, specifically annotating the cable defect detection historical image set and using the annotations as labels to obtain annotated historical image set;

[0014] Step S22: resizing, which is used to adjust the size of the annotated image, specifically, to adjust the image size of the annotated historical image set to a consistent size, so as to obtain a roughly processed historical image set;

[0015] Step S23: image denoising, which is used to reduce the noise in the roughly processed historical image, specifically, using a wavelet transform denoising method to perform image denoising on the roughly processed historical image set to obtain a denoised historical image set;

[0016] Step S24: image contrast enhancement, used to enhance the contrast of the denoised historical image, the steps include:

[0017] Step S241: local contrast enhancement of the image, specifically using contrast-limited adaptive histogram equalization to perform local contrast enhancement;

[0018] Step S242: enhancing the global contrast of the image, specifically using histogram equalization to perform global contrast enhancement;

[0019] Step S243: enhancing the image contrast, specifically by enhancing the contrast of the denoised historical image set through the image local contrast enhancement and the image global contrast enhancement, to obtain a balanced historical image set;

[0020] Step S25: preprocessing, specifically, performing image preprocessing on the cable defect detection historical image set through the image annotation, the size adjustment, the image denoising and the image contrast enhancement to obtain a balanced historical image set.

[0021] Further, in step S3, the cable image data is enhanced to enhance the cable historical image, specifically by using a deep convolutional generative adversarial network model to enhance the equalized historical image set and perform data set segmentation to obtain a cable defect detection training set and a cable defect detection test set;

[0022] The deep convolutional generative adversarial network model specifically includes a generator using a deep convolutional neural network and a discriminator using a deep convolutional neural network;

[0023] The cable image data enhancement specifically includes the following steps:

[0024] Step S31: construct a generator for constructing a generator of a deep convolutional generative adversarial network model. The loss function of the generator is as follows:

[0025] ;

[0026] In the formula, represents the generator loss function value, represents the output of the generator with random noise r as input, r represents random noise, It means that the discriminator outputs the generator with random noise r as input The probability of being true, It means that the discriminator outputs the generator with random noise r as input The logarithmic expected value of the probability of being judged as false;

[0027] Step S32: construct a discriminator for constructing a discriminator of a deep convolutional generative adversarial network model. The loss function of the discriminator is as follows:

[0028] ;

[0029] In the formula, represents the discriminator loss function value, s represents the real image, represents the probability that the discriminator judges the real image s as real, Represents the logarithmic expected value of the probability that the discriminator judges the real image s as real;

[0030] Step S33: Design a feature matching loss function, the formula used is as follows:

[0031] ;

[0032] In the formula, represents the feature matching loss function value, g represents the generated image, represents the output of the real image s in the discriminator feature layer, Represents the output of the generated image g at the discriminator feature layer, represents the mean of the real image s in the discriminator feature layer, Represents the mean of the generated image g in the discriminator feature layer;

[0033] Step S34: enhancing image data, specifically, constructing the deep convolutional generative adversarial network model through the construction generator, the construction discriminator and the design feature matching loss function, and using the deep convolutional generative adversarial network model to perform data enhancement on the equalized historical image set to obtain an enhanced historical image set;

[0034] Step S35: data set segmentation, which is used to segment the data set, specifically, segmenting the enhanced historical image set into a cable defect detection training set and a cable defect detection test set.

[0035] Further, in step S4, the cable defect detection model is constructed to construct a model required for cable defect detection in a cable trench, specifically, a multidimensional weak attention residual network model is constructed and trained to obtain a cable defect detection model;

[0036] The multidimensional weak attention residual network model is specifically a residual network model including a weak signal attention module and a multi-scale perception module;

[0037] The cable defect detection model is constructed, specifically comprising the following steps:

[0038] Step S41: construct a weak signal attention module, the steps include:

[0039] Step S411: Extract features. The formula used is as follows:

[0040] ;

[0041] In the formula, represents the input of the weak signal attention module, represents the convolution operation function of a 3×3 convolution kernel, represents the batch normalization operation function, Represents the extracted features;

[0042] Step S412: Gamma transformation enhances contrast, and the formula used is as follows:

[0043] ;

[0044] In the formula, represents the standardized features, represents the mean function, represents the standard deviation function, represents the contrast enhancement feature, represents the gamma factor;

[0045] Step S413: Design a spatial attention mechanism. The formula used is as follows:

[0046] ;

[0047] In the formula, represents the output of the weak signal attention module, represents the sigmoid function, represents the convolution operation function of the 7×7 convolution kernel, represents the concatenation function, represents the maximum pooling function, represents the average pooling function;

[0048] Step S414: module construction, specifically, constructing the weak signal attention module by extracting features, enhancing contrast by gamma transformation and designing the spatial attention mechanism, so as to obtain the weak signal attention module;

[0049] Step S42: constructing a multi-scale perception module, the steps include:

[0050] Step S421: Calculate the dilated convolution, the formula used is as follows:

[0051] ;

[0052] Where A is the coefficient used to control the characteristic intensity. represents the dilated convolution function of a 3×3 convolution kernel with a dilation rate of 1, represents the dilated convolution function of a 3×3 convolution kernel with a dilation rate of 2, represents the dilated convolution function of a 3×3 convolution kernel with a dilation rate of 3, represents the dilated convolution function of a 1×1 convolution kernel with a dilation rate of 1, represents the input of the multi-scale perception module, represents the dilated convolution output of a 3×3 convolution kernel with a dilation rate of 1, represents the dilated convolution output of a 3×3 convolution kernel with a dilation rate of 2, represents the dilated convolution output of a 3×3 convolution kernel with a dilation rate of 3,

[0053] represents the dilated convolution output of a 1×1 convolution kernel with a dilation rate of 1;

[0054] Step S422: construct a residual connection, the formula used is as follows:

[0055] ;

[0056] In the formula, represents element-by-element addition, Represents the dilated convolution output With the dilated convolution output The residual connection output of Represents the residual connection output With the dilated convolution output The residual connection output of Represents the residual connection output With the dilated convolution output The residual connection output of

[0057] Step S423: Multi-scale feature fusion, the formula used is as follows:

[0058] ;

[0059] Where Fm represents the output of the multi-scale perception module;

[0060] Step S424: module construction, specifically, constructing the multi-scale perception module by calculating the dilated convolution, constructing the residual connection and fusing the multi-scale features to obtain the multi-scale perception module;

[0061] Step S43: Calculate the model output using the following formula:

[0062] ;

[0063] In the formula, Y represents the output of the model, represents the softmax function, W represents the output weight matrix, b represents the output bias term, and X represents the input of the output layer;

[0064] Step S44: construct a loss function, the formula used is as follows:

[0065] ;

[0066] In the formula, represents the model loss function value, K represents the total number of image categories, represents the label of the i-th image, x represents the input of the model, Represents the model's predicted probability for the i-th category image under input x;

[0067] Step S45: model construction and training, specifically, through the construction of the weak signal attention module, the construction of the multi-scale perception module, the calculation model output and the construction loss function, the multi-dimensional weak attention residual network model is constructed and the model training is performed based on the cable defect detection training set, and the model performance is verified based on the cable defect detection test set to obtain the cable defect detection model.

[0068] Furthermore, in step S5, the cable defect detection in the cable trench is specifically performed by using the cable defect detection model to perform cable defect detection in the cable trench, obtaining cable defect detection reference data, and analyzing the cable condition in the cable trench based on the cable defect detection reference data.

[0069] The cable defect detection system in the cable trench based on machine vision provided by the present invention comprises an image acquisition module, an image preprocessing module, a cable image data enhancement module, a cable defect detection model construction module and a cable defect detection module in the cable trench;

[0070] The image acquisition module is used for image acquisition, and obtains a cable defect detection historical image set through image acquisition, and sends the cable defect detection historical image set to the image preprocessing module;

[0071] The image preprocessing module is used for image preprocessing, and obtains a balanced historical image set through image preprocessing, and sends the balanced historical image set to the cable image data enhancement module;

[0072] The cable image data enhancement module is used for cable image data enhancement, which generates an adversarial network model through deep convolution to enhance the cable image data and perform data set segmentation to obtain a cable defect detection training set and a cable defect detection test set, and sends the cable defect detection training set and the cable defect detection test set to the cable defect detection model construction module;

[0073] The cable defect detection model construction module is used to construct a cable defect detection model, obtain the cable defect detection model by constructing and training a multidimensional weak attention residual network model, and send the cable defect detection model to the cable defect detection module in the cable trench;

[0074] The cable defect detection module in the cable trench is used for cable defect detection in the cable trench. Cable defect detection in the cable trench is performed by adopting the cable defect detection model to obtain cable defect detection reference data.

[0075] The beneficial effects achieved by the present invention using the above scheme are as follows:

[0076] (1) In order to address the technical problems that traditional cable defect detection methods in cable trenches are limited by lighting conditions and environmental noise, resulting in uneven image quality and low image diversity, and cannot fully cover various scenarios and conditions in practical applications, this solution creatively uses a deep convolutional generative adversarial network model to enhance cable image data. By enhancing the preprocessed dataset, a high-quality, high-image diversity dataset is obtained, which enriches the training data while improving the generalization ability of the model.

[0077] (2) In view of the technical problems that the traditional cable defect detection method in the cable trench has limited field of view and poor visual effect in the cable trench, it is unable to process small defects and weak signals in the cable image and is difficult to adapt to the various image features of different scales in the cable trench, this scheme creatively adopts a multi-dimensional weak attention residual network model for cable defect detection in the cable trench, combines the weak signal attention mechanism and multi-scale perception, and improves the accuracy and robustness of detection by enhancing the ability to capture details and integrating features of different scales. BRIEF DESCRIPTION OF THE DRAWINGS

[0078] Figure 1 A schematic diagram of the flow of a method for detecting cable defects in a cable trench based on machine vision provided by the present invention;

[0079] Figure 2 A schematic diagram of a module of a cable defect detection system in a cable trench based on machine vision provided by the present invention;

[0080] Figure 3 This is a schematic diagram of the image preprocessing process in step S2;

[0081] Figure 4 It is a schematic diagram of the process of enhancing the cable image data in step S3;

[0082] Figure 5 Schematic diagram of the process of building a cable defect detection model in step S4.

[0083] The accompanying drawings are used to provide further understanding of the present invention and constitute a part of the specification. They are used to explain the present invention together with the embodiments of the present invention and do not constitute a limitation of the present invention. DETAILED DESCRIPTION

[0084] The technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments; based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.

[0085] In the description of the present invention, it should be understood that terms such as “upper”, “lower”, “front”, “back”, “left”, “right”, “top”, “bottom”, “inside” and “outside” indicating directions or positional relationships are based on the directions or positional relationships shown in the accompanying drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific direction, be constructed and operated in a specific direction, and therefore should not be understood as limiting the present invention.

[0086] Example 1, see Figure 1 The technical solution adopted by the present invention is as follows: The present invention provides a method for detecting cable defects in a cable trench based on machine vision, and the method comprises the following steps:

[0087] Step S1: image acquisition;

[0088] Step S2: image preprocessing;

[0089] Step S3: cable image data enhancement;

[0090] Step S4: constructing a cable defect detection model;

[0091] Step S5: Cable defect detection in the cable trench.

[0092] Example 2, see Figure 1 and Figure 2 In step S1, the image acquisition is used to acquire historical images required for cable defect detection in the cable trench, specifically, to obtain a cable defect detection historical image set from the cable safety management system, and the cable defect detection historical image set specifically includes a defect-free cable historical image set and a defective cable historical image set.

[0093] Example 3, see Figure 1 , Figure 2 and Figure 3 This embodiment is based on the above embodiment. In step S2, the image preprocessing is used to perform image preprocessing on the historical image, and specifically includes the following steps:

[0094] Step S21: image annotation, which is used to annotate historical images, specifically annotating the cable defect detection historical image set and using the annotations as labels to obtain annotated historical image set;

[0095] Step S22: resizing, which is used to adjust the size of the annotated image, specifically, to adjust the image size of the annotated historical image set to a consistent size, so as to obtain a roughly processed historical image set;

[0096] Step S23: Image denoising, which is used to reduce the noise in the roughly processed historical image. Specifically, a wavelet transform denoising method is used to perform image denoising on the roughly processed historical image set to obtain a denoised historical image set. The formula used is as follows:

[0097] ;

[0098] In the formula, represents the denoised image, represents the value of I that minimizes the objective function, and I represents the independent variable in the calculation process. represents an image with noise, represents the regularization parameter, represents the wavelet transform coefficient function, represents the square of the Euclidean norm, represents the Manhattan norm;

[0099] Step S24: image contrast enhancement, used to enhance the contrast of the denoised historical image, the steps include:

[0100] Step S241: local contrast enhancement of the image, specifically using contrast-limited adaptive histogram equalization to perform local contrast enhancement, the formula used is as follows:

[0101] ;

[0102] In the formula, represents the cumulative distribution function, represents the minimum function, represents the maximum function, LM represents the total number of image gray levels, Indicates the denoised image at coordinates The pixel value of Indicates the coordinates of the image after equalization The pixel value of Represents the image at coordinates The limit threshold, Indicates the image after local contrast enhancement at coordinate The pixel value of

[0103] Step S242: Global contrast enhancement of the image, specifically, using histogram equalization to perform global contrast enhancement, the formula used is as follows:

[0104] ;

[0105] In the formula, Indicates the image after global contrast enhancement at coordinate The pixel value of

[0106] Step S243: enhancing the image contrast, specifically by enhancing the contrast of the denoised historical image set through the image local contrast enhancement and the image global contrast enhancement, to obtain a balanced historical image set;

[0107] Step S25: preprocessing, specifically, performing image preprocessing on the cable defect detection historical image set through the image annotation, the size adjustment, the image denoising and the image contrast enhancement to obtain a balanced historical image set.

[0108] Example 4, see Figure 1 , Figure 2 and Figure 4, This embodiment is based on the above embodiment. In step S3, the cable image data is enhanced to enhance the cable history image, specifically by using a deep convolutional generative adversarial network to enhance the equalized history image set and perform data set segmentation to obtain a cable defect detection training set and a cable defect detection test set;

[0109] The deep convolutional generative adversarial network specifically includes a generator using a deep convolutional neural network and a discriminator using a deep convolutional neural network;

[0110] The cable image data enhancement specifically includes the following steps:

[0111] Step S31: construct a generator for constructing a deep convolutional generative adversarial network generator, and the loss function of the generator is as follows:

[0112] ;

[0113] In the formula, represents the generator loss function value, represents the output of the generator with random noise r as input, r represents random noise, It means that the discriminator outputs the generator with random noise r as input The probability of being true, It means that the discriminator outputs the generator with random noise r as input The logarithmic expected value of the probability of being judged as false;

[0114] Step S32: construct a discriminator for constructing a discriminator of a deep convolutional generative adversarial network. The loss function of the discriminator is as follows:

[0115] ;

[0116] In the formula, represents the discriminator loss function value, s represents the real image, represents the probability that the discriminator judges the real image s as real, Represents the logarithmic expected value of the probability that the discriminator judges the real image s as real;

[0117] Step S33: Design a feature matching loss function, the formula used is as follows:

[0118] ;

[0119] In the formula, represents the feature matching loss function value, g represents the generated image, represents the output of the real image s in the discriminator feature layer, Represents the output of the generated image g at the discriminator feature layer, represents the mean of the real image s in the discriminator feature layer, Represents the mean of the generated image g in the discriminator feature layer;

[0120] Step S34: enhancing image data, specifically, constructing the deep convolutional generative adversarial network through the construction generator, the construction discriminator and the design feature matching loss function, and using the deep convolutional generative adversarial network to perform data enhancement on the equalized historical image set to obtain an enhanced historical image set;

[0121] Step S35: data set segmentation, which is used to segment the data set, specifically, segmenting the enhanced historical image set into a cable defect detection training set and a cable defect detection test set.

[0122] By performing the above operations, this solution creatively uses a deep convolutional generative adversarial network model to enhance cable image data in order to solve the technical problem that the traditional cable defect detection method in the cable trench is limited by lighting conditions and environmental noise, resulting in uneven image quality and low image diversity, and cannot fully cover various scenarios and conditions in practical applications. By enhancing the preprocessed data set, a high-quality and high-image diversity data set is obtained, which enriches the training data while improving the generalization ability of the model.

[0123] Example 5, see Figure 1 , Figure 2 and Figure 5 , This embodiment is based on the above embodiment. In step S4, the cable defect detection model is constructed to construct a model required for cable defect detection in a cable trench, specifically, a multidimensional weak attention residual network model is constructed and trained to obtain a cable defect detection model;

[0124] The multidimensional weak attention residual network model is specifically a residual network model including a weak signal attention module and a multi-scale perception module;

[0125] The cable defect detection model is constructed, specifically comprising the following steps:

[0126] Step S41: construct a weak signal attention module, the steps include:

[0127] Step S411: Extract features. The formula used is as follows:

[0128] ;

[0129] In the formula, represents the input of the weak signal attention module, represents the convolution operation function of a 3×3 convolution kernel, represents the batch normalization operation function, Represents the extracted features;

[0130] Step S412: Gamma transformation enhances contrast, and the formula used is as follows:

[0131] ;

[0132] In the formula, represents the standardized features, represents the mean function, represents the standard deviation function, represents the contrast enhancement feature, represents the gamma factor;

[0133] Step S413: Design a spatial attention mechanism. The formula used is as follows:

[0134] ;

[0135] In the formula, represents the output of the weak signal attention module, represents the sigmoid function, represents the convolution operation function of the 7×7 convolution kernel, represents the concatenation function, represents the maximum pooling function, represents the average pooling function;

[0136] Step S414: module construction, specifically, constructing the weak signal attention module by extracting features, enhancing contrast by gamma transformation and designing the spatial attention mechanism, so as to obtain the weak signal attention module;

[0137] Step S42: constructing a multi-scale perception module, the steps include:

[0138] Step S421: Calculate the dilated convolution, the formula used is as follows:

[0139] ;

[0140] Where A is the coefficient used to control the characteristic intensity. represents the dilated convolution function of a 3×3 convolution kernel with a dilation rate of 1, represents the dilated convolution function of a 3×3 convolution kernel with a dilation rate of 2, represents the dilated convolution function of a 3×3 convolution kernel with a dilation rate of 3, represents the dilated convolution function of a 1×1 convolution kernel with a dilation rate of 1, represents the input of the multi-scale perception module, represents the dilated convolution output of a 3×3 convolution kernel with a dilation rate of 1, represents the dilated convolution output of a 3×3 convolution kernel with a dilation rate of 2, represents the dilated convolution output of a 3×3 convolution kernel with a dilation rate of 3, represents the dilated convolution output of a 1×1 convolution kernel with a dilation rate of 1;

[0141] Step S422: construct a residual connection, the formula used is as follows:

[0142] ;

[0143] In the formula, represents element-by-element addition, Represents the dilated convolution output With the dilated convolution output The residual connection output of Represents the residual connection output With the dilated convolution output The residual connection output of Represents the residual connection output With the dilated convolution output The residual connection output of

[0144] Step S423: Multi-scale feature fusion, the formula used is as follows:

[0145] ;

[0146] Where Fm represents the output of the multi-scale perception module;

[0147] Step S424: module construction, specifically, constructing the multi-scale perception module by calculating the dilated convolution, constructing the residual connection and fusing the multi-scale features to obtain the multi-scale perception module;

[0148] Step S43: Calculate the model output using the following formula:

[0149] ;

[0150] In the formula, Y represents the output of the model, represents the softmax function, W represents the output weight matrix, b represents the output bias term, and X represents the input of the output layer;

[0151] Step S44: construct a loss function, the formula used is as follows:

[0152] ;

[0153] In the formula, represents the model loss function value, K represents the total number of image categories, represents the label of the i-th image, x represents the input of the model, Represents the model's predicted probability for the i-th category image under input x;

[0154] Step S45: model construction and training, specifically, through the construction of the weak signal attention module, the construction of the multi-scale perception module, the calculation model output and the construction loss function, the multi-dimensional weak attention residual network model is constructed and the model training is performed based on the cable defect detection training set, and the model performance is verified based on the cable defect detection test set to obtain the cable defect detection model.

[0155] In view of the technical problems that traditional cable defect detection methods in cable trenches have limited field of view and poor visual effects, cannot handle small defects and weak signals in cable images, and are difficult to adapt to various image features of different scales in the cable trench, this scheme creatively adopts a multi-dimensional weak attention residual network model for cable defect detection in the cable trench, combines the weak signal attention mechanism and multi-scale perception, and improves the accuracy and robustness of detection by enhancing the ability to capture details and integrating features of different scales.

[0156] Example 6, see Figure 1 and Figure 2 This embodiment is based on the above embodiment. In step S5, the cable defect detection in the cable trench is specifically to use the cable defect detection model to perform cable defect detection in the cable trench, obtain cable defect detection reference data, and analyze the cable condition in the cable trench based on the cable defect detection reference data.

[0157] Embodiment 7, see Figure 1 and Figure 2 , this embodiment is based on the above embodiment, and the cable defect detection system in the cable trench based on machine vision provided by the present invention includes an image acquisition module, an image preprocessing module, a cable image data enhancement module, a cable defect detection model construction module and a cable defect detection module in the cable trench;

[0158] The image acquisition module is used for image acquisition, and obtains a cable defect detection historical image set through image acquisition, and sends the cable defect detection historical image set to the image preprocessing module;

[0159] The image preprocessing module is used for image preprocessing, and obtains a balanced historical image set through image preprocessing, and sends the balanced historical image set to the cable image data enhancement module;

[0160] The cable image data enhancement module is used for cable image data enhancement, which generates an adversarial network model through deep convolution to enhance the cable image data and perform data set segmentation to obtain a cable defect detection training set and a cable defect detection test set, and sends the cable defect detection training set and the cable defect detection test set to the cable defect detection model construction module;

[0161] The cable defect detection model construction module is used to construct a cable defect detection model, obtain the cable defect detection model by constructing and training a multidimensional weak attention residual network model, and send the cable defect detection model to the cable defect detection module in the cable trench;

[0162] The cable defect detection module in the cable trench is used for cable defect detection in the cable trench. Cable defect detection in the cable trench is performed by adopting the cable defect detection model to obtain cable defect detection reference data.

[0163] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device.

[0164] While the embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that many changes, modifications, substitutions and variations can be made to the embodiments without departing from the principles and spirit of the invention.

[0165] The present invention and its embodiments are described above, and such description is not restrictive. The drawings show only one embodiment of the present invention, and the actual structure is not limited thereto. In short, if ordinary technicians in the field are inspired by it, without departing from the purpose of the invention, they can design a structure and embodiment similar to the technical solution without creativity, which should belong to the protection scope of the present invention.

Claims

1. A cable defect detection method in a cable trench based on machine vision, characterized in that: The method comprises the following steps: Step S1: image acquisition; Step S2: image preprocessing, image annotation, size adjustment, image denoising and image contrast enhancement of the collected historical images; Step S3: cable image data enhancement, specifically using a deep convolutional generative adversarial network model to enhance the cable image data and perform data set segmentation to obtain a cable defect detection training set and a cable defect detection test set; Step S4: constructing a cable defect detection model, specifically constructing and training a multidimensional weak attention residual network model to obtain a cable defect detection model; In step S4, the cable defect detection model is constructed to construct a model required for cable defect detection in a cable trench, specifically, a multidimensional weak attention residual network model is constructed and trained to obtain a cable defect detection model; The multidimensional weak attention residual network model is specifically a residual network model including a weak signal attention module and a multi-scale perception module; The cable defect detection model is constructed, specifically comprising the following steps: Step S41: construct a weak signal attention module, the steps include: Step S411: Extract features. The formula used is as follows: ; In the formula, represents the input of the weak signal attention module, represents the convolution operation function of a 3×3 convolution kernel, represents the batch normalization operation function, Represents the extracted features; Step S412: Gamma transformation enhances contrast, and the formula used is as follows: ; In the formula, represents the standardized features, represents the mean function, represents the standard deviation function, represents the contrast enhancement feature, represents the gamma factor; Step S413: Design a spatial attention mechanism. The formula used is as follows: ; In the formula, represents the output of the weak signal attention module, represents the sigmoid function, represents the convolution operation function of the 7×7 convolution kernel, represents the concatenation function, represents the maximum pooling function, represents the average pooling function; Step S414: module construction, specifically, constructing the weak signal attention module by extracting features, enhancing contrast by gamma transformation and designing the spatial attention mechanism, so as to obtain the weak signal attention module; Step S42: constructing a multi-scale perception module, the steps include: Step S421: Calculate the dilated convolution, the formula used is as follows: ; Where A is the coefficient used to control the characteristic intensity. represents the dilated convolution function of a 3×3 convolution kernel with a dilation rate of 1, represents the dilated convolution function of a 3×3 convolution kernel with a dilation rate of 2, represents the dilated convolution function of a 3×3 convolution kernel with a dilation rate of 3, represents the dilated convolution function of a 1×1 convolution kernel with a dilation rate of 1, represents the input of the multi-scale perception module, represents the dilated convolution output of a 3×3 convolution kernel with a dilation rate of 1, represents the dilated convolution output of a 3×3 convolution kernel with a dilation rate of 2, represents the dilated convolution output of a 3×3 convolution kernel with a dilation rate of 3, represents the dilated convolution output of a 1×1 convolution kernel with a dilation rate of 1; Step S422: construct a residual connection, the formula used is as follows: ; In the formula, represents element-by-element addition, Represents the dilated convolution output With the dilated convolution output The residual connection output of Represents the residual connection output With the dilated convolution output The residual connection output of Represents the residual connection output With the dilated convolution output The residual connection output of Step S423: Multi-scale feature fusion, the formula used is as follows: ; Where Fm represents the output of the multi-scale perception module; Step S424: module construction, specifically, constructing the multi-scale perception module by calculating the dilated convolution, constructing the residual connection and fusing the multi-scale features to obtain the multi-scale perception module; Step S43: Calculate the model output using the following formula: ; In the formula, Y represents the output of the model, represents the softmax function, W represents the output weight matrix, b represents the output bias term, and X represents the input of the output layer; Step S44: construct a loss function, the formula used is as follows: ; In the formula, represents the model loss function value, K represents the total number of image categories, represents the label of the i-th image, x represents the input of the model, Represents the model's predicted probability for the i-th category image under input x; Step S45: model construction and training, specifically, through the construction of the weak signal attention module, the construction of the multi-scale perception module, the calculation model output and the construction loss function, the multi-dimensional weak attention residual network model is constructed and the model training is performed based on the cable defect detection training set, and the model performance is verified based on the cable defect detection test set to obtain the cable defect detection model; Step S5: cable defect detection in the cable trench, specifically using the cable defect detection model to perform cable defect detection in the cable trench to obtain cable defect detection reference data.

2. The cable defect detection method in a cable trench based on machine vision according to claim 1 is characterized in that: In step S3, the cable image data is enhanced to enhance the cable historical image, specifically by using a deep convolutional generative adversarial network model to enhance the equalized historical image set and perform data set segmentation to obtain a cable defect detection training set and a cable defect detection test set; The deep convolutional generative adversarial network model specifically includes a generator using a deep convolutional neural network and a discriminator using a deep convolutional neural network; The cable image data enhancement specifically includes the following steps: Step S31: construct a generator for constructing a generator of a deep convolutional generative adversarial network model. The loss function of the generator is as follows: ; In the formula, represents the generator loss function value, represents the output of the generator with random noise r as input, r represents random noise, It means that the discriminator outputs the generator with random noise r as input The probability of being true, It means that the discriminator outputs the generator with random noise r as input The logarithmic expected value of the probability of being judged as false; Step S32: construct a discriminator for constructing a discriminator of a deep convolutional generative adversarial network model. The loss function of the discriminator is as follows: ; In the formula, represents the discriminator loss function value, s represents the real image, represents the probability that the discriminator judges the real image s as real, Represents the logarithmic expected value of the probability that the discriminator judges the real image s as real; Step S33: Design a feature matching loss function, the formula used is as follows: ; In the formula, represents the feature matching loss function value, g represents the generated image, represents the output of the real image s in the discriminator feature layer, Represents the output of the generated image g at the discriminator feature layer, represents the mean of the real image s in the discriminator feature layer, Represents the mean of the generated image g in the discriminator feature layer; Step S34: enhancing image data, specifically, constructing the deep convolutional generative adversarial network model through the construction generator, the construction discriminator and the design feature matching loss function, and using the deep convolutional generative adversarial network model to perform data enhancement on the equalized historical image set to obtain an enhanced historical image set; Step S35: data set segmentation, which is used to segment the data set, specifically, segmenting the enhanced historical image set into a cable defect detection training set and a cable defect detection test set.

3. The cable defect detection method in a cable trench based on machine vision according to claim 1 is characterized in that: In step S2, the image preprocessing is used to perform image preprocessing on the historical image, and specifically includes the following steps: Step S21: image annotation, which is used to annotate historical images, specifically annotating the cable defect detection historical image set and using the annotations as labels to obtain annotated historical image set; Step S22: resizing, which is used to adjust the size of the annotated image, specifically, to adjust the image size of the annotated historical image set to a consistent size, so as to obtain a roughly processed historical image set; Step S23: image denoising, which is used to reduce the noise in the roughly processed historical image, specifically, using a wavelet transform denoising method to perform image denoising on the roughly processed historical image set to obtain a denoised historical image set; Step S24: image contrast enhancement, used to enhance the contrast of the denoised historical image, the steps include: Step S241: local contrast enhancement of the image, specifically using contrast-limited adaptive histogram equalization to perform local contrast enhancement; Step S242: enhancing the global contrast of the image, specifically using histogram equalization to perform global contrast enhancement; Step S243: enhancing the image contrast, specifically by enhancing the contrast of the denoised historical image set through the image local contrast enhancement and the image global contrast enhancement, to obtain a balanced historical image set; Step S25: preprocessing, specifically, performing image preprocessing on the cable defect detection historical image set through the image annotation, the size adjustment, the image denoising and the image contrast enhancement to obtain a balanced historical image set.

4. The cable defect detection method in a cable trench based on machine vision according to claim 1 is characterized in that: In step S5, the cable defect detection in the cable trench is specifically to use the cable defect detection model to perform cable defect detection in the cable trench, obtain cable defect detection reference data, and analyze the cable condition in the cable trench based on the cable defect detection reference data.

5. The cable defect detection method in a cable trench based on machine vision according to claim 1, characterized in that: In step S1, the image acquisition is used to acquire historical images required for cable defect detection in the cable trench, specifically, to obtain a cable defect detection historical image set from the cable safety management system, and the cable defect detection historical image set specifically includes a defect-free cable historical image set and a defective cable historical image set.

6. A cable defect detection system in a cable trench based on machine vision, used to implement a cable defect detection method in a cable trench based on machine vision as claimed in any one of claims 1 to 5, characterized in that: It includes an image acquisition module, an image preprocessing module, a cable image data enhancement module, a cable defect detection model building module and a cable defect detection module in a cable trench.

7. The cable defect detection system in the cable trench based on machine vision according to claim 6 is characterized in that: The image acquisition module is used for image acquisition, and obtains a cable defect detection historical image set through image acquisition, and sends the cable defect detection historical image set to the image preprocessing module; The image preprocessing module is used for image preprocessing, and obtains a balanced historical image set through image preprocessing, and sends the balanced historical image set to the cable image data enhancement module; The cable image data enhancement module is used for cable image data enhancement, which generates an adversarial network model through deep convolution to enhance the cable image data and perform data set segmentation to obtain a cable defect detection training set and a cable defect detection test set, and sends the cable defect detection training set and the cable defect detection test set to the cable defect detection model construction module; The cable defect detection model construction module is used to construct a cable defect detection model, obtain the cable defect detection model by constructing and training a multidimensional weak attention residual network model, and send the cable defect detection model to the cable defect detection module in the cable trench; The cable defect detection module in the cable trench is used for cable defect detection in the cable trench. Cable defect detection in the cable trench is performed by adopting the cable defect detection model to obtain cable defect detection reference data.