Model training, underground cable pipeline defect identification methods, products and equipment
By acquiring and adjusting sample images of underground cable ducts and their labels, generating target images, and enhancing the quality and quantity of the training set, the problem of low accuracy in defect detection of underground cable ducts is solved, the detection accuracy is improved, and the risk of accidents is reduced.
Patent Information
- Application Number
- CN202410789811.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-19
- Publication Date
- 2024-09-06
- Estimated Expiration
- 2044-06-19
AI Technical Summary
In the existing technology, the detection accuracy of underground cable duct defect detection models is low, mainly due to insufficient quantity and quality of sample images and poor imaging conditions, which makes it difficult to identify defects in underground cable ducts and poses potential accident risks.
By obtaining sample images and their corresponding labels, potential features are extracted, and pre-trained hierarchical models are used for image adjustment and text generation to generate target images, enhance the quantity and quality of the training set, and improve detection accuracy.
It improves the detection accuracy of the underground cable duct defect recognition model, enhances the quantity and quality of the training set, solves the problems of insufficient sample images and poor imaging conditions, and reduces the risk of accidents.
Smart Images

Figure CN118366011B
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing technology, and in particular to a model training, underground cable pipeline defect recognition method, product and equipment. Background Art
[0002] High-voltage cable pipeline laying (installing high-voltage cables underground) has been widely promoted and used in cable lines due to its advantages of convenient construction, relatively low cost, little impact on traffic in later maintenance, and low cost. However, the cable pipes in underground cable pipelines are prone to defects due to construction and other reasons (for example, pipeline docking misalignment, and foreign matter such as sand and gravel gradually appearing in the pipeline over time), which can easily cause the outer insulation layer of the cable to be scratched during threading, burying potential accidents in the operation of the power grid.
[0003] In the prior art, intelligent inspection robots with target detection models are usually used to automatically inspect underground cable pipelines and automatically identify defects in underground cable pipelines to notify users for timely maintenance. However, the detection accuracy of the target detection model is heavily dependent on the number and quality of sample images in the training set. Since underground cable pipelines are located underground, it is difficult to collect sample images. In addition, because the imaging conditions are generally poor (for example, insufficient light, humid underground environment causing lens fogging, etc.), most of the collected images have some deficiencies, and only a small part can be directly used as sample images, which is difficult to meet the training requirements of the target detection model. Summary of the invention
[0004] In order to solve the above technical problems, the embodiments of the present application propose a model training, underground cable pipeline defect identification method, product and equipment, which can increase the number of training sets and improve the quality, thereby improving the detection accuracy of the trained underground cable pipeline defect identification model.
[0005] In order to achieve the above objectives, the present application provides a model training method, including:
[0006] Acquire a sample image and a first label corresponding to the sample image, wherein the first label is used to indicate a defect of an underground cable conduit in the sample image;
[0007] Extracting a first latent feature of the sample image, and extracting a second latent feature of the first label;
[0008] Inputting the first latent feature and the second latent feature into a pre-trained hierarchical model for stratification to obtain a target level;
[0009] Based on the target level, determining a target image adjustment method from a plurality of pre-configured image adjustment methods corresponding to the plurality of levels, so as to adjust the sample image to obtain an adjusted image;
[0010] generating a corresponding text description based on the adjusted image, and combining the text description and the first label to obtain a composite text;
[0011] generating a target image corresponding to the synthesized text;
[0012] The target image and the sample image are used to train a target detection model to obtain an underground cable pipeline defect recognition model.
[0013] Furthermore, the extracting the first latent feature of the sample image and extracting the second latent feature of the first label includes:
[0014] Based on the sample image, extract features through an image diffusion model to generate the first latent feature;
[0015] The first label is encoded by a variational autoencoder to generate the second latent feature.
[0016] Furthermore, the extracting features based on the sample image by using an image diffusion model to generate the first latent features includes:
[0017] Performing image content recognition on the sample image to obtain image content information;
[0018] The sample image and the image content information are input into the image diffusion model, so that the image diffusion model extracts features from the sample image according to the image content information and outputs the first latent feature.
[0019] Furthermore, the training method of the hierarchical model includes:
[0020] Acquire a hierarchical training sample and its corresponding second label and calibration level, wherein the hierarchical training sample is a historical image taken in an underground cable duct, the second label indicates an underground cable duct defect in the historical image, and the calibration level indicates an imaging defect level corresponding to the historical image;
[0021] The hierarchical model to be trained is trained for multiple rounds of iterations using the hierarchical training samples, the second labels and the calibration levels until an iteration stop condition is met, thereby obtaining the hierarchical model.
[0022] Furthermore, the number of the stratified training samples is multiple, each stratified training sample corresponds to a second label and a calibration level, and in each round of iterative training for the stratified model to be trained, the following steps are performed:
[0023] Randomly selecting a stratified training sample from the plurality of stratified training samples;
[0024] Extracting a third latent feature of the one stratified training sample, and extracting a fourth latent feature from a second label corresponding to the one stratified training sample;
[0025] Inputting the third potential feature and the fourth potential feature into the to-be-trained stratification model for stratification to obtain a predicted level;
[0026] Based on the first similarity between the predicted level and the calibrated level, the hierarchical model to be trained is trained.
[0027] Furthermore, generating a corresponding text description based on the adjusted image includes:
[0028] Inputting the adjusted image into a convolutional neural network for feature extraction to obtain a first adjusted image feature;
[0029] Inputting the first adjusted image feature into a converter model to obtain a second adjusted image feature output by the converter model;
[0030] The second adjusted image feature is input into a large language model, so that the large language model generates a text description according to the second adjusted image feature.
[0031] Furthermore, generating a target image corresponding to the synthesized text includes:
[0032] Determining a second similarity between the synthetic text and the sample image;
[0033] Determining whether the second similarity is within a preset similarity threshold range;
[0034] If yes, the synthesized text is input into the image generation model to obtain the target image output by the image generation model;
[0035] If not, based on the second similarity, the adjustment image is adjusted using the sample image, and a new synthetic text is obtained according to the adjusted adjustment image, so as to re-execute the above steps until the new second similarity is within the preset similarity threshold range.
[0036] Furthermore, the determining a second similarity between the synthetic text and the sample image includes:
[0037] Performing image recognition on the sample image to obtain an image element vector, wherein the image element vector is used to indicate an image element in the sample image;
[0038] Extracting a plurality of keyword vectors from the synthetic text;
[0039] For each keyword vector, calculating a third similarity between the keyword vector and the image element vector;
[0040] An average value of all the calculated third similarities is used as the second similarity.
[0041] Further, the sample image at least includes at least one first image obtained by optical imaging and at least one second image obtained by other imaging modes different from optical imaging, and the at least one first image corresponds to the at least one second image one by one, and the corresponding first image and second image respectively contain the same underground cable pipeline defect. Before extracting the first potential feature of the sample image and extracting the second potential feature of the first label, the method further includes:
[0042] For each first image, if a region to be supplemented is detected in the first image, the first image is processed using a second image corresponding to the first image to obtain a third image, and the first image is replaced with the third image in the sample image to update the sample image;
[0043] The step of processing the first image using the second image corresponding to the first image to obtain the third image includes:
[0044] Based on the to-be-complemented area in the first image, adjusting a second image corresponding to the first image;
[0045] Based on the adjusted second image, at least one of pixel filling processing and pixel modification processing is performed on the to-be-complemented area in the first image to obtain the third image.
[0046] Furthermore, adjusting the second image corresponding to the first image based on the to-be-complemented area in the first image includes:
[0047] Converting the first image into the frequency domain to obtain a first transformed image;
[0048] Determine a transformed region in the first transformed image corresponding to the region to be supplemented, and calculate a frequency mean of corresponding frequencies in the transformed region;
[0049] Converting a second image corresponding to the first image into the frequency domain to obtain a second transformed image;
[0050] Using the pixel value of the first target pixel point in the first transformed image, the pixel value of the second target pixel point in the second transformed image is replaced to adjust the second transformed image, wherein the second target pixel point is all the pixel points in the second transformed image whose corresponding frequency is not greater than the frequency mean, and the first target pixel point is the pixel point in the first transformed image that is in the same area as that indicated by the second target pixel point;
[0051] The adjusted second transformed image is converted into a spatial domain to obtain the adjusted second image.
[0052] Furthermore, there are multiple sample images, and before extracting the first latent feature of the sample image and extracting the second latent feature of the first label, the method further includes:
[0053] For each sample image, perform the following steps:
[0054] Randomly select at least one target data enhancement processing method from a plurality of pre-configured data enhancement processing methods;
[0055] The sample image is processed using the target data enhancement processing method to update the sample image.
[0056] Furthermore, the multiple data enhancement processing methods include at least one of the following: vertical flipping, horizontal flipping, random rotation, gamma adjustment, random grid rearrangement, color jittering, perspective transformation, piecewise affine transformation, and grid distortion.
[0057] The present application also provides a method for identifying underground cable conduit defects, including:
[0058] Acquire an image to be identified that is taken in an underground cable duct;
[0059] The image to be identified is input into an underground cable pipeline defect recognition model to obtain a defect recognition result output by the underground cable pipeline defect recognition model, wherein the underground cable pipeline defect recognition model is trained based on any of the model training methods described above.
[0060] An embodiment of the present application also provides a computer program product, including computer instructions, which, when executed by a processor, implement the steps of any of the above-mentioned model training methods or underground cable pipeline defect identification methods.
[0061] The embodiment of the present application also provides a computer device, including a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein when the processor executes the computer program, the steps of the model training method or the underground cable pipeline defect identification method described in any one of the above are implemented.
[0062] In summary, the embodiments of the present application have at least the following beneficial effects:
[0063] By obtaining a sample image and its corresponding first label, wherein the first label is used to indicate an underground cable pipeline defect in the sample image; extracting a first potential feature of the sample image and extracting a second potential feature of the first label; inputting the first potential feature and the second potential feature into a pre-trained hierarchical model for stratification to obtain a target level; based on the target level, determining a target image adjustment method from a plurality of image adjustment methods pre-configured and corresponding to a plurality of levels to adjust the sample image to obtain an adjusted image; generating a corresponding text description based on the adjusted image, and merging the text description and the first label to obtain a synthetic text; generating a target image corresponding to the synthetic text; using the target image and the sample image, training a target detection model to obtain an underground cable pipeline defect recognition model, so that the sample image and its corresponding first label can be used to find out the deficiencies in the sample image, so as to make targeted adjustments, so that the corresponding deficiencies in the adjusted image can be corrected, and further using the adjusted image to generate a target image as a supplement to the training set, so that the number of training sets is increased and the quality is improved, and finally the detection accuracy of the underground cable pipeline defect recognition model obtained by training is improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0064] Figure 1 It is a flowchart of the model training method provided in the embodiment of the present application;
[0065] Figure 2 It is a flow chart of the underground cable pipeline defect identification method provided in the embodiment of the present application;
[0066] Figure 3 It is a schematic diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0067] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0068] In the description of the present application, the terms "first", "second", "third", etc. are used for descriptive purposes only and are not to be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, features defined as "first", "second", "third", etc. may explicitly or implicitly include one or more of the features. In the description of the present application, unless otherwise specified, the meaning of "multiple" is two or more. In the description of the present application, the term "including" and its variations are open inclusions, i.e., "including but not limited to". The term "based on" means "at least partially based on". The term "according to" means "at least partially based on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one other embodiment"; the term "some embodiments" means "at least some embodiments".
[0069] In the description of this application, it should be noted that, unless otherwise clearly specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium, or it can be the internal communication of two components. For ordinary technicians in this field, the specific meanings of the above terms in this application can be understood according to specific circumstances.
[0070] In the description of this application, it should be noted that, unless otherwise defined, all technical and scientific terms used in this application have the same meaning as those commonly understood by those skilled in the art. The terms used in the specification of this application are only for the purpose of describing specific embodiments and are not intended to limit this application. For those of ordinary skill in the art, the specific meanings of the above terms in this application can be understood by specific circumstances.
[0071] See also Figure 1 , shows a flow chart of a model training method provided in an embodiment of the present application, the method includes steps S101-S107, which are as follows:
[0072] S101, obtaining a sample image and a first label corresponding to the sample image, wherein the first label is used to indicate a defect of an underground cable conduit in the sample image.
[0073] In one example, the sample image may be acquired and stored by the imaging device mounted on the pipeline robot during the inspection of the underground cable pipeline, wherein the imaging device may include a high-definition camera, which includes a front-view, side-view, tilt and / or 360-degree panoramic camera, and the high-definition camera may also have the ability of multiple optical zoom, so as to shoot the same underground cable pipeline defect based on different shooting angles and ensure that the images shot at different shooting angles have sufficient clarity. In addition, the imaging device may also include an integrated laser scanning or 3D imaging system (such as time-of-flight method, laser scanning method) to obtain the three-dimensional structural information of the pipeline.
[0074] It should be noted that there may be multiple sample images in this embodiment, which are images containing underground cable pipeline defects screened out from the collected images, wherein each sample image is labeled with a corresponding first label to describe the underground cable pipeline defects in the sample image. It is not difficult to understand that each sample image can be labeled with one or more first labels to describe one or more underground cable pipeline defects one by one, and different sample images may also contain the same underground cable pipeline defect.
[0075] It should be noted that the first tag in this embodiment can be represented by at least one text and / or keyword.
[0076] S102: extracting a first latent feature of the sample image, and extracting a second latent feature of the first label.
[0077] Among them, latent features are features converted to latent space. Latent space refers to a low-dimensional, compact and information-rich representation space obtained through model learning. Generally, high-dimensional data is mapped to a lower-dimensional space through dimensionality reduction technology. This process aims to retain the important structure and features of the original data while removing noise and redundant information.
[0078] It should be noted that for image data, common methods for extracting latent features include: using models such as Convolutional Neural Networks (CNN), Variational Auto-Encoder (VAE), Generative Adversarial Networks (GAN) to learn latent space features.
[0079] In one example, a convolutional neural network (CNN) is used to extract a first potential feature of the sample image, including: inputting the sample image into the CNN, and using the output of the middle layer or the last layer of the CNN as the first potential feature. In this embodiment, the features output by the middle layer or the last layer of the CNN often reflect the high-level semantic information of the image, such as object category, texture, etc.
[0080] Furthermore, in pre-trained convolutional neural networks such as Residual Network (ResNet) and VGG (Visual Geometry Group), the output of the penultimate layer can be used as the first potential feature of the sample image.
[0081] In one example, a variational autoencoder (VAE) is used to extract a first latent feature of the sample image, including: inputting the sample image into the VAE, so that the VAE compresses the sample image into a low-dimensional first latent feature through an encoder network.
[0082] In one example, a generative adversarial network (GAN) is used to extract a first latent feature of the sample image, including: inputting the sample image into the GAN so that a generator in the GAN can learn the latent space of the sample image to generate the first latent feature.
[0083] It should be noted that, from the above description, it can be seen that the first label is usually represented by text data. For text data, the extraction of its potential features mainly depends on technologies in the field of natural language processing, such as word embeddings, recurrent neural networks (RNN), Transformer models, etc.
[0084] In one example, a recurrent neural network (RNN) is used to extract a second potential feature of the first label, including: inputting the first label into the RNN so that the RNN learns the dependency between words in a text sequence represented by the first label, and obtains a fixed-length vector representation of the text sequence as the second potential feature.
[0085] In one example, a Transformer model is used to extract a second potential feature of the first label, including: inputting the first label into the Transformer model so that the Transformer model captures the long-distance dependency in the text represented by the first label through a self-attention mechanism to obtain the second potential feature, wherein the second potential feature is a hidden layer output of the Transformer model. The Transformer model includes: Bidirectional Encoder Representations from Transformers (BERT) and Generative Pre-Trained (GPT).
[0086] S103: Input the first potential feature and the second potential feature into a pre-trained hierarchical model for stratification to obtain a target level.
[0087] It should be noted that the target level in this embodiment is one of multiple levels, and one level can be used to correspond to the degree of deficiency of one aspect of the image. For example, it can be the degree of deficiency in imaging (such as the degree of overexposure, the degree of insufficient contrast, the degree of noise interference, etc.), or it can be the deficiency in clarity and completeness of the underground cable pipeline defect indicated by the first label in the sample image.
[0088] In one example, the hierarchical model can be obtained by training a pre-built multimodal fusion model using pre-acquired historical hierarchical sample data, wherein the historical hierarchical sample data includes at least two types of potential features and hierarchical labels, and the two types of potential features are potential features extracted from images and potential features extracted from texts, respectively.
[0089] In this embodiment, the training process of the multimodal fusion model may include:
[0090] 1) Use the multimodal fusion model to fuse two types of potential features through any of the following fusion methods to obtain fused features:
[0091] Early fusion: directly concatenate two types of latent features.
[0092] Late fusion: The two types of latent features are processed by independent networks respectively, and then the processed two types of latent features are merged in the final stage of network processing.
[0093] Intermediate fusion: Two types of potential features are fused at multiple levels of the model to increase the flexibility and expressiveness of the model.
[0094] 2) Classifier: Add a fully connected layer to classify the fused features. The number of layers and nodes in the fully connected layer is adjusted according to the complexity of the task. The last layer can use the softmax function to output the probability distribution of each layer of the fully connected layer.
[0095] 3) According to the output of the above classifier, use the set loss function (with the layer label and the output of the classifier as the input of the loss function), optimizer and training strategy for training. Among them, the loss function can select a loss function suitable for multi-classification tasks (such as cross entropy loss), the optimizer can use Adam, SGD, etc. and adjust the learning rate according to the experiment, and the training strategy can use batch gradient descent.
[0096] In an example, the hierarchical model may also be trained by a neural network-based hierarchical model training method. In this embodiment, a joint embedding strategy may be used.
[0097] 1) Feature alignment: A fusion layer or mapping layer is designed to map the first latent feature and the second latent feature into a shared feature space so that some features with the same semantics in the first latent feature and the second latent feature can be close to each other in the space.
[0098] 2) Hierarchical model construction: A hierarchical model is constructed on the shared feature space. It can be a multilayer perceptron (MLP), Siamese network or other deep learning architectures to learn higher-level abstract features and perform stratification.
[0099] 3) Loss function design: Using a suitable loss function, such as Contrastive Loss or Triplet Loss, can encourage positive pairs (feature pairs with the same semantic first latent feature and second latent feature) to be close and negative pairs (with different semantics) to be far away.
[0100] 4) Training and fine-tuning: Use a labeled dataset (the label here refers to the layer to which the image used for training belongs) for training and fine-tune the entire model to optimize the layering effect.
[0101] S104: Based on the target level, determine a target image adjustment method from a plurality of image adjustment methods pre-configured and corresponding to the plurality of levels, so as to adjust the sample image to obtain an adjusted image.
[0102] In one example, if the target level indicates a target overexposure degree, the corresponding target image adjustment method may include: adjusting the exposure, brightness and contrast to reduce the intensity of the overbright area; and / or, using the Curves tool to fine-tune the tonal range of the image to restore the lost details in the highlight area; and / or, using color grading software to adjust the overexposed area in the sample image, for example, using DaVinci color grading software, using the Luma (brightness) limit control in the HSL (Hue, Saturation, Lightness) color selection tool to isolate the overexposed highlight area, or adjusting the Gain (gain) to a certain color to color the overexposed area to make it more coordinated with the surrounding environment.
[0103] In one example, if the target level indicates the lack of clarity and completeness of the underground cable duct defect indicated by the first label in the sample image, other sample images containing the underground cable duct defect may be used for repair.
[0104] S105: Generate a corresponding text description based on the adjusted image, and merge the text description and the first label to obtain a composite text.
[0105] It should be noted that in this embodiment, the adjusted image can be input into a general trained image-to-text model to generate a corresponding text description, wherein the image-to-text model can convert the input image into a natural language description, and the image-to-text model is usually based on a deep learning architecture, especially a model that can establish a connection between visual and language modalities. For example, a multimodal model such as Constrastive Language-Image Pre-training (CLIP) or a Foundational Language And Vision Alignment (FLAVA) model can be used, both of which can achieve general image recognition and image-to-text generation tasks.
[0106] In a specific implementation example, a convolutional neural network can be used to perform image analysis on the adjusted image, and a recurrent neural network or a Transformer model can be used to generate a text sequence using the analysis results.
[0107] It should be noted that, from the above description, it can be known that the first label can also be represented as a corresponding text. In this embodiment, the first label and the text description can be directly spliced to obtain a composite text.
[0108] S106, generating a target image corresponding to the synthesized text.
[0109] It should be noted that in this embodiment, the synthesized text can be input into a general trained text-to-image model to generate a corresponding target image.
[0110] In one example, the synthesized text can be input into a generative adversarial network to generate a corresponding target image.
[0111] In one example, synthetic text can be input into a variational autoencoder to generate a corresponding target image.
[0112] In one example, the synthesized text may be input into a diffusion model to generate a corresponding target image.
[0113] S107, using the target image and the sample image, training the target detection model to obtain an underground cable pipeline defect recognition model.
[0114] It should be noted that, in this embodiment, the target image and sample image can together constitute the training data, and are divided into a training set, a test set, and a validation set according to a preset ratio. The specific training method can be various training methods for target detection models commonly used in this field, which will not be repeated here.
[0115] In an embodiment of the present application, the potential features of the sample image and its corresponding first label can be used to find out the deficiencies in the sample image so as to make targeted adjustments so that the corresponding deficiencies in the adjusted image can be corrected, and the adjusted image can be further used to generate a target image as a supplement to the training set, so that the number of training sets is increased and the quality is improved, and ultimately the detection accuracy of the underground cable pipeline defect recognition model obtained through training is improved.
[0116] In addition, since the synthetic text used to generate the target image integrates both the first label and the text description generated based on the adjusted image, where the first label represents the key defect to be identified in the sample image, and the adjusted image is an adjusted image that is not exactly the same as the sample image, it is not difficult to understand that the target image generated at this time not only carries the information of the defect to be identified (will not deviate too far from the training target), but also avoids the problem of overfitting of the trained model due to being too similar to the sample image. This solves the problem that directly generating a new target image with the original sample image will cause the two to be too similar and thus have low robustness, and at the same time, a large number of training samples can be obtained to improve the detection accuracy of the trained model.
[0117] In an optional implementation, extracting the first latent feature of the sample image and extracting the second latent feature of the first label includes:
[0118] Based on the sample image, extract features through an image diffusion model to generate the first latent feature;
[0119] The first label is encoded by a variational autoencoder to generate the second latent feature.
[0120] In one example, the sample image may be directly input into the image diffusion model to extract features of the sample image to obtain the first potential feature.
[0121] It should be noted that the image diffusion model is a generative model that has excellent performance in image synthesis, restoration, super-resolution and other image processing tasks. The basic working principle of the image diffusion model can be summarized into two core processes: forward diffusion process and reverse diffusion process.
[0122] Forward Diffusion Process: In the forward diffusion stage, the model gradually adds Gaussian noise to the original image to convert a clear image into a pure noise image. This process can be decomposed into multiple small time steps, each of which injects noise into the image according to certain rules, eventually leading to the gradual loss of image information until the image becomes completely unrecognizable noise. This series of steps can be regarded as the "blurring" or "diffusion" of image information.
[0123] Reverse Diffusion Process: The reverse process is the key to generating images. The goal is to start from a completely noisy image, gradually remove the noise and restore a clear image. This process is usually implemented by one or a series of deep learning models (such as convolutional neural networks), which need to learn how to predict and reverse the noise impact of each step, so as to reversely "gather" information and gradually clarify the image. Each step is a denoising step under a conditional probability distribution until an image close to the original data distribution is finally generated.
[0124] It should be noted that the Variational Autoencoder (VAE) is a generative model that combines the idea of autoencoders and the variational inference method in Bayesian inference. It is mainly used for effective data representation learning and generating new data samples. The core of VAE is not only to learn the compact representation (encoding) of data, but also to ensure that this representation has the ability to generate new samples.
[0125] In an optional implementation, the extracting features based on the sample image by using an image diffusion model to generate the first potential feature includes:
[0126] Performing image content recognition on the sample image to obtain image content information;
[0127] The sample image and the image content information are input into the image diffusion model, so that the image diffusion model extracts features from the sample image according to the image content information and outputs the first latent feature.
[0128] In this embodiment, image content recognition is first performed on the sample image to extract the key information in the image, and then the sample image and the image content information are input into the image diffusion model together, so that the image diffusion model can perform targeted feature extraction on the sample image based on the key information in the image in advance (focusing on extracting the key features corresponding to the key information), and the first potential feature finally outputted is the key feature of the sample image.
[0129] In one example, performing image content recognition on the sample image to obtain image content information may include: using a target detection algorithm to recognize the sample image, marking key content in the image to generate image content information. In addition, some general image recognition algorithms may also be used to recognize the sample image.
[0130] In an optional implementation, the training method of the hierarchical model includes:
[0131] Acquire a hierarchical training sample and its corresponding second label and calibration level, wherein the hierarchical training sample is a historical image taken in an underground cable duct, the second label indicates an underground cable duct defect in the historical image, and the calibration level indicates an imaging defect level corresponding to the historical image;
[0132] The hierarchical model to be trained is trained for multiple rounds of iterations using the hierarchical training samples, the second labels and the calibration levels until an iteration stop condition is met, thereby obtaining the hierarchical model.
[0133] Among them, the imaging defect level may refer to the degree of overexposure, insufficient contrast, noise interference, etc., and the iteration stop conditions may include: the number of iterative training times reaches a preset iteration number threshold, the trained hierarchical model converges, etc.
[0134] In one example, using the hierarchical training samples, the second labels, and the calibration levels, performing multiple rounds of iterative training on the hierarchical model to be trained until an iteration stop condition is met, and obtaining the hierarchical model may include:
[0135] The potential features extracted from the hierarchical training samples and the second labels are combined into feature pairs, and the feature pairs are used as training data, and the calibration levels are used as the labels marked in the training data. Combined with the above-mentioned neural network-based hierarchical model training method, multiple rounds of iterative training are performed on the hierarchical model to be trained.
[0136] In an optional implementation, the number of the stratified training samples is multiple, each stratified training sample corresponds to a second label and a calibration level, and in each round of iterative training for the stratified model to be trained, the following steps are performed:
[0137] Randomly selecting a stratified training sample from the plurality of stratified training samples;
[0138] Extracting a third latent feature of the one stratified training sample, and extracting a fourth latent feature from a second label corresponding to the one stratified training sample;
[0139] Inputting the third potential feature and the fourth potential feature into the to-be-trained stratification model for stratification to obtain a predicted level;
[0140] Based on the first similarity between the predicted level and the calibrated level, the hierarchical model to be trained is trained.
[0141] In this embodiment, it is possible to judge whether the effect of the prediction level output by the current iteration meets the requirements based on the first similarity between the prediction level and the calibration level (for example, it meets the requirements when the first similarity is greater than the preset first similarity threshold), thereby adjusting the various model parameters in the hierarchical model to be trained accordingly, so that the trained model can accurately predict the corresponding prediction level.
[0142] In an optional implementation, the generating a corresponding text description based on the adjusted image includes:
[0143] Inputting the adjusted image into a convolutional neural network for feature extraction to obtain a first adjusted image feature;
[0144] Inputting the first adjusted image feature into a converter model to obtain a second adjusted image feature output by the converter model;
[0145] The second adjusted image feature is input into a large language model, so that the large language model generates a text description according to the second adjusted image feature.
[0146] Specifically, the convolutional neural network (CNN) can extract image features layer by layer through multiple convolutional layers, pooling layers, and possible fully connected layers. These features are gradually abstracted from low-level (such as edges, textures) to high-level (such as shapes, object parts). The last few layers of features are often rich in semantic information and can be regarded as compact and expressive representations of the image. The last few layers of features can be called "first adjusted image features". The converter model (such as Transformer) further refines and reorganizes the first adjusted image features through self-attention mechanisms and other complex interaction processes to obtain "second adjusted image features". The second adjusted image features can be regarded as high-level abstractions of image content, focusing more on global context understanding and cross-regional relationship modeling, and are therefore usually regarded as key image features. Finally, the key image features are input into a large language model, which has powerful text generation capabilities (such as the GPT series of models).
[0147] In an optional implementation, generating a target image corresponding to the synthetic text includes:
[0148] Determining a second similarity between the synthetic text and the sample image;
[0149] Determining whether the second similarity is within a preset similarity threshold range;
[0150] If yes, the synthesized text is input into the image generation model to obtain the target image output by the image generation model;
[0151] If not, based on the second similarity, the adjustment image is adjusted using the sample image, and a new synthetic text is obtained according to the adjusted adjustment image, so as to re-execute the above steps until the new second similarity is within the preset similarity threshold range.
[0152] In this embodiment, by controlling the second similarity to be within a reasonable threshold range, it can be ensured that the generated target image is neither too similar to the original image nor deviates too far from the training target, thereby improving the detection accuracy of the trained model.
[0153] In one example, determining the second similarity between the synthetic text and the sample image may include:
[0154] The feature vectors of the synthesized text and the sample image are extracted respectively, and the cosine distance between the feature vectors of the synthesized text and the sample image is calculated as the second similarity.
[0155] In an optional implementation, the determining the second similarity between the synthetic text and the sample image includes:
[0156] Performing image recognition on the sample image to obtain an image element vector, wherein the image element vector is used to indicate an image element in the sample image;
[0157] Extracting a plurality of keyword vectors from the synthetic text;
[0158] For each keyword vector, calculating a third similarity between the keyword vector and the image element vector;
[0159] An average value of all the calculated third similarities is used as the second similarity.
[0160] It should be noted that the image elements in this embodiment can be understood as various objects in the sample image, which are used to distinguish them from the background.
[0161] In an optional embodiment, the sample image at least includes at least one first image obtained by optical imaging and at least one second image obtained by other imaging modes different from optical imaging, and the at least one first image corresponds to the at least one second image one by one, and the corresponding first image and second image respectively contain the same underground cable pipeline defect. Before extracting the first potential feature of the sample image and extracting the second potential feature of the first label, the method further includes:
[0162] For each first image, if a region to be supplemented is detected in the first image, the first image is processed using a second image corresponding to the first image to obtain a third image, and the first image is replaced with the third image in the sample image to update the sample image;
[0163] The step of processing the first image using the second image corresponding to the first image to obtain the third image includes:
[0164] Based on the to-be-complemented area in the first image, adjusting a second image corresponding to the first image;
[0165] Based on the adjusted second image, at least one of pixel filling processing and pixel modification processing is performed on the to-be-complemented area in the first image to obtain the third image.
[0166] Because underground pipelines are usually relatively humid, the lens may be fogged during the process of taking sample images, resulting in unclear images (with missing information).
[0167] In view of this, in this embodiment, other imaging modes different from optical imaging can be used to capture the second image, and for the partial area where information is missing in the first image (i.e., the detected area to be supplemented), the corresponding second image can be used to repair the area to be supplemented, so as to improve the quality of the sample image.
[0168] In one example, adjusting the second image corresponding to the first image based on the area to be supplemented in the first image includes: performing image enhancement processing on an area in the second image corresponding to an area within the area to be supplemented.
[0169] In an optional implementation, adjusting the second image corresponding to the first image based on the to-be-complemented area in the first image includes:
[0170] Converting the first image into the frequency domain to obtain a first transformed image;
[0171] Determine a transformed region in the first transformed image corresponding to the region to be supplemented, and calculate a frequency mean of corresponding frequencies in the transformed region;
[0172] Converting a second image corresponding to the first image into the frequency domain to obtain a second transformed image;
[0173] Using the pixel value of the first target pixel point in the first transformed image, the pixel value of the second target pixel point in the second transformed image is replaced to adjust the second transformed image, wherein the second target pixel point is all the pixel points in the second transformed image whose corresponding frequency is not greater than the frequency mean, and the first target pixel point is the pixel point in the first transformed image that is in the same area as that indicated by the second target pixel point;
[0174] The adjusted second transformed image is converted into a spatial domain to obtain the adjusted second image.
[0175] In this embodiment, the image can be converted into the frequency domain for processing, so as to intuitively determine the part where the information is missing by using the characteristics of the frequency domain. Since there is some missing information in the area to be supplemented, the average value of the frequency in the first transformed image corresponding to each pixel point in the entire area to be supplemented can be used as a threshold to determine the pixel points in the second transformed image that are lower than the threshold and need to be replaced, so as to ensure that the information in the adjusted second transformed image is rich enough.
[0176] It should be noted that the frequency mean of the corresponding frequencies in the transformed area refers to the mean of the frequencies corresponding to all the pixel points in the area closed with the area to be supplemented as a boundary in the first transformed image.
[0177] It should be noted that the pixel points in the transformed image refer to the meaning in the frequency domain, which is different from the pixel points in the spatial domain. In the spatial domain, the pixel points directly correspond to the color or grayscale value of a specific position in the image. In the frequency domain, the pixel points actually represent the components of different frequencies and directions in the image and their relative intensities.
[0178] In one example, the first image and / or the second image may be converted into the frequency domain by using a discrete Fourier transform or a fast discrete Fourier transform, while the image in the frequency domain may be converted into the spatial domain by using an inverse discrete Fourier transform or a fast inverse discrete Fourier transform.
[0179] In an optional implementation, there are multiple sample images, and before extracting the first latent feature of the sample image and extracting the second latent feature of the first label, the method further includes:
[0180] For each sample image, perform the following steps:
[0181] Randomly select at least one target data enhancement processing method from a plurality of pre-configured data enhancement processing methods;
[0182] The sample image is processed using the target data enhancement processing method to update the sample image.
[0183] In an optional embodiment, the multiple data enhancement processing methods include at least one of the following: vertical flipping, horizontal flipping, random rotation, gamma adjustment, random grid rearrangement, color jittering, perspective transformation, piecewise affine transformation, and grid distortion.
[0184] In this embodiment, different sample images can be data enhanced separately to increase the amount of data and enhance the robustness of the algorithm. Specifically, a random data enhancement method is used to perform data enhancement on different sample images to generate new images that have certain differences but are related to the original sample images. This allows the model to be exposed to more diverse data during the training process and improves the model's adaptability to different scenarios and changes. At the same time, data enhancement can also increase the scale and diversity of the data set and improve the generalization and robustness of the model. The image size can also be adjusted to 3*640*640 to have a uniform input image size.
[0185] In one example, the target detection model can be an existing general target detection model, such as YOLOV5, etc., and can also be pre-built in the following ways: based on the YOLOv8 model, and introducing the Atrous spatial pyramid pooling (ASPP) and ShuffleNet basic modules in the backbone network (Backbone) of the model to help the model focus more specifically on the defective parts in the input image data and reduce the number of model parameters, thereby improving the model detection accuracy and speed; adding a convolutional block-based attention mechanism (Convolutional Block Attention Module, CBAM) before the detection head to improve the model detection efficiency and remove useless noise interference in the image.
[0186] Furthermore, after obtaining the trained underground cable pipeline defect recognition model, the improved Backbone network and the hollow spatial convolutional pooling pyramid ASPP can be used to extract features from the image to be recognized, and a series of feature maps of different scales can be obtained. Based on the feature maps of different scales, the Neck network is used to fuse the features of different scales, and then the convolutional block-based attention mechanism CBAM is used to streamline the channel and spatial information, remove environmental noise, and obtain the processed feature map. Finally, based on the processed feature map, the detection head Head is used to classify and detect the processed feature map to obtain the final recognition result.
[0187] Optionally, the Backbone network includes ten operation layers cascaded in sequence, wherein the first operation layer, the second operation layer, the fourth operation layer, the sixth operation layer and the eighth operation layer are all Conv convolution modules, the third operation layer, the fifth operation layer and the seventh operation layer all contain several ShuffleNet basic modules, and the tenth operation layer is a hollow spatial convolution pooling pyramid ASPP. In this embodiment, the ShuffleNet basic module is introduced in Backbone to replace the C2f module, which can reduce the number of model parameters and speed up the model recognition speed; the Spatial Pyramid Pooling Feature Module (SPPF) is replaced with ASPP to expand the receptive field to better capture multi-scale features, and better utilize global information and improve the accuracy of the model while only increasing a small amount of calculation. Specifically, the Backbone network uses different operation layers to downsample the image of the input model. The fifth operation layer outputs a feature map with a scale of 80×80, the seventh operation layer outputs a feature map with a scale of 40×40, and the tenth operation layer outputs a feature map with a scale of 20×20, thereby obtaining feature maps of different sizes. As a result, the Backbone network obtains three feature maps with scales of 80×80, 40×40, and 20×20 through downsampling of the operation layers, which reduces the resolution and floating-point operations of the feature maps, reduces the amount of calculation and memory usage, and improves the subsequent network reasoning speed.
[0188] Specifically, the principle of the ShuffeNet basic module is as follows:
[0189] In order to achieve lightweight model, this embodiment uses the basic module in ShuffleNet V2 to replace the C2f module in the YOLOv8 backbone network. ShuffleNet V2 is a lightweight convolutional neural network architecture designed to achieve efficient computing and model parameter compression. The core idea is to reduce the computational complexity and model size by introducing deep separable convolution and channel shuffle (ChannelShuffle). In deep separable convolution, the convolution operation is decomposed into two steps: deep convolution and point-by-point convolution to reduce the number of parameters and computational cost. Channel shuffling groups the input channels, performs convolution operations within the groups, and then remixes the channels to achieve cross-channel information exchange and feature reorganization, effectively improving the expression ability and performance of the model. This design allows the model to maintain high accuracy while having a smaller model size and faster inference speed, which is suitable for resource-constrained scenarios and mobile deployment.
[0190] Specifically, the principle of the dilated spatial convolutional pooling pyramid is as follows:
[0191] The atrous spatial convolution pooling pyramid is a network module for image semantic segmentation tasks, which aims to capture contextual information at different scales. This embodiment applies it to replace the SPPF in YOLOv8. Compared with the traditional pooling operation, the atrous spatial convolution pooling pyramid can increase the receptive field without introducing downsampling, effectively improving the model's ability to detect and recognize targets. The atrous spatial convolution pooling pyramid performs multi-scale convolution operations on the input feature map with convolution kernels at different atrous rates, and fuses information at different scales, thereby enhancing the network's perception and semantic understanding of the target, improving the model's detection capabilities for different multi-scale targets, and can better adapt to the complex scenes of underground cable pipe defects and defect targets of different scales, thereby improving the detection accuracy and robustness of the model.
[0192] Optionally, the Neck network is used to fuse features of different scales, and then the CBAM based on the convolutional block is used to simplify the channel and spatial information and remove the environmental noise to obtain the processed feature map, including:
[0193] The upsampling layer is used to enlarge the small-scale feature map and perform the Concat feature fusion operation with the previous level feature map;
[0194] The Conv convolution module is used to downsample the feature map after the feature fusion operation, and after feature fusion with the next level feature map, the channel information and spatial information are simplified through the CBAM attention mechanism to obtain the processed feature map.
[0195] In this embodiment, the Neck network performs multi-scale feature fusion on feature maps of different scales to enhance the model's detection capability for targets of different sizes, and enables the model to adaptively capture global information and channel features through CBAM, thereby improving the local and global perception capabilities of the target, thereby improving the accuracy and robustness of image recognition.
[0196] See also Figure 2 , shows a schematic flow chart of a method for identifying underground cable conduit defects provided by an embodiment of the present application, the method comprising steps S201-S202, which are specifically as follows:
[0197] S201, obtaining an image to be identified that is taken in an underground cable duct.
[0198] S202, inputting the image to be identified into an underground cable pipeline defect recognition model to obtain a defect recognition result output by the underground cable pipeline defect recognition model, wherein the underground cable pipeline defect recognition model is trained based on any of the model training methods described above.
[0199] An embodiment of the present application also provides a computer program product, including computer instructions, which, when executed by a processor, implement the steps of any of the above-mentioned model training methods or underground cable pipeline defect identification methods.
[0200] An embodiment of the present application also provides a computer device, including a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein the processor implements the steps of any of the above-mentioned model training methods or underground cable pipeline defect identification methods when executing the computer program.
[0201] See also Figure 3 The computer device of this embodiment includes: a processor 301, a memory 302, and a computer program stored in the memory 302 and executable on the processor 301, such as a model training program and / or an underground cable pipeline defect identification program. When the processor 301 executes the computer program, the steps in the above-mentioned model training method embodiments and / or underground cable pipeline defect identification method embodiments are implemented.
[0202] Exemplarily, the computer program may be divided into one or more modules / units, which are stored in the memory 302 and executed by the processor 301 to complete the present application. The one or more modules / units may be a series of computer program instruction segments capable of completing specific functions, which are used to describe the execution process of the computer program in the computer device.
[0203] The computer device may be a computing device such as a desktop computer, a notebook, a PDA, a cloud server, etc. The computer device may include, but is not limited to, a processor 301 and a memory 302. Those skilled in the art will appreciate that the schematic diagram is merely an example of a computer device and does not constitute a limitation on the computer device. The computer device may include more or fewer components than shown in the diagram, or may combine certain components, or different components. For example, the computer device may also include input and output devices, network access devices, buses, etc.
[0204] The processor 301 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or the processor 301 may also be any conventional processor, etc. The processor 301 is the control center of the computer device, and uses various interfaces and lines to connect various parts of the entire computer device.
[0205] The memory 302 can be used to store the computer program and / or module. The processor 301 implements various functions of the computer device by running or executing the computer program and / or module stored in the memory 302 and calling the data stored in the memory 302. The memory 302 can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.); the data storage area can store data created according to the use of the mobile phone (such as audio data, a phone book, etc.). In addition, the memory 302 can include a high-speed random access memory, and can also include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (SecureDigital, SD) card, a flash card (Flash Card), at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.
[0206] Wherein, if the module / unit integrated in the computer device is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor 301. Wherein, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electrical carrier signal, telecommunication signal and software distribution medium, etc.
[0207] In summary, the embodiments of the present application have at least the following beneficial effects:
[0208] By obtaining a sample image and its corresponding first label, wherein the first label is used to indicate an underground cable pipeline defect in the sample image; extracting a first potential feature of the sample image and extracting a second potential feature of the first label; inputting the first potential feature and the second potential feature into a pre-trained hierarchical model for stratification to obtain a target level; based on the target level, determining a target image adjustment method from a plurality of image adjustment methods pre-configured and corresponding to a plurality of levels to adjust the sample image to obtain an adjusted image; generating a corresponding text description based on the adjusted image, and merging the text description and the first label to obtain a synthetic text; generating a target image corresponding to the synthetic text; using the target image and the sample image, training a target detection model to obtain an underground cable pipeline defect recognition model, so that the sample image and its corresponding first label can be used to find out the deficiencies in the sample image, so as to make targeted adjustments, so that the corresponding deficiencies in the adjusted image can be corrected, and further using the adjusted image to generate a target image as a supplement to the training set, so that the number of training sets is increased and the quality is improved, and finally the detection accuracy of the underground cable pipeline defect recognition model obtained by training is improved.
[0209] Through the description of the above implementation methods, those skilled in the art can clearly understand that the present application can be implemented by means of software plus a necessary hardware platform, and of course, it can also be implemented entirely by hardware. Based on such an understanding, all or part of the contribution of the technical solution of the present application to the background technology can be embodied in the form of a software product, and the computer software product can be stored in a storage medium, such as ROM / RAM, a magnetic disk, an optical disk, etc., including a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present application or some parts of the embodiments.
[0210] The above is a preferred embodiment 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 are also considered to be within the scope of protection of the present application.
Claims
1. A model training method, characterized in that: include: Acquire a sample image and a first label corresponding to the sample image, wherein the first label is used to indicate a defect of an underground cable conduit in the sample image; Extracting a first latent feature of the sample image, and extracting a second latent feature of the first label; Inputting the first latent feature and the second latent feature into a pre-trained hierarchical model for stratification to obtain a target level; Based on the target level, determining a target image adjustment method from a plurality of pre-configured image adjustment methods corresponding to the plurality of levels, so as to adjust the sample image to obtain an adjusted image; generating a corresponding text description based on the adjusted image, and combining the text description and the first label to obtain a composite text; generating a target image corresponding to the synthesized text; The target image and the sample image are used to train a target detection model to obtain an underground cable pipeline defect recognition model.
2. The model training method according to claim 1, characterized in that: The extracting the first potential feature of the sample image and the extracting the second potential feature of the first label includes: Based on the sample image, extract features through an image diffusion model to generate the first latent feature; The first label is encoded by a variational autoencoder to generate the second latent feature.
3. The model training method according to claim 2, characterized in that: The step of extracting features based on the sample image by using an image diffusion model to generate the first potential features includes: Performing image content recognition on the sample image to obtain image content information; The sample image and the image content information are input into the image diffusion model, so that the image diffusion model extracts features from the sample image according to the image content information and outputs the first latent feature.
4. The model training method according to claim 1, characterized in that: The training method of the hierarchical model comprises: Acquire a hierarchical training sample and its corresponding second label and calibration level, wherein the hierarchical training sample is a historical image taken in an underground cable duct, the second label indicates an underground cable duct defect in the historical image, and the calibration level indicates an imaging defect level corresponding to the historical image; The hierarchical model to be trained is trained for multiple rounds of iterations using the hierarchical training samples, the second labels and the calibration levels until an iteration stop condition is met, thereby obtaining the hierarchical model.
5. The model training method according to claim 4, characterized in that: There are multiple stratified training samples, each of which corresponds to a second label and a calibration level. In each round of iterative training for the stratified model to be trained, the following steps are performed: Randomly selecting a stratified training sample from the plurality of stratified training samples; Extracting a third latent feature of the one stratified training sample, and extracting a fourth latent feature from a second label corresponding to the one stratified training sample; Inputting the third potential feature and the fourth potential feature into the to-be-trained stratification model for stratification to obtain a predicted level; Based on the first similarity between the predicted level and the calibrated level, the hierarchical model to be trained is trained.
6. The model training method according to claim 1, characterized in that: The generating a corresponding text description based on the adjusted image includes: Inputting the adjusted image into a convolutional neural network for feature extraction to obtain a first adjusted image feature; Inputting the first adjusted image feature into a converter model to obtain a second adjusted image feature output by the converter model; The second adjusted image feature is input into a large language model, so that the large language model generates a text description according to the second adjusted image feature.
7. The model training method according to claim 1, characterized in that: The generating a target image corresponding to the synthesized text comprises: Determining a second similarity between the synthetic text and the sample image; Determining whether the second similarity is within a preset similarity threshold range; If yes, the synthesized text is input into the image generation model to obtain the target image output by the image generation model; If not, based on the second similarity, the adjustment image is adjusted using the sample image, and a new synthetic text is obtained according to the adjusted adjustment image, so as to re-execute the above steps until the new second similarity is within the preset similarity threshold range.
8. The model training method according to claim 7, characterized in that: The determining a second similarity between the synthetic text and the sample image comprises: Performing image recognition on the sample image to obtain an image element vector, wherein the image element vector is used to indicate an image element in the sample image; Extracting a plurality of keyword vectors from the synthetic text; For each keyword vector, calculating a third similarity between the keyword vector and the image element vector; An average value of all the calculated third similarities is used as the second similarity.
9. The model training method according to any one of claims 1 to 8, characterized in that: The sample image at least includes at least one first image obtained by optical imaging and at least one second image obtained by other imaging modes different from optical imaging, and the at least one first image corresponds to the at least one second image one by one, and the corresponding first image and second image respectively contain the same underground cable pipeline defect. Before extracting the first potential feature of the sample image and extracting the second potential feature of the first label, the method further includes: For each first image, if a region to be supplemented is detected in the first image, the first image is processed using a second image corresponding to the first image to obtain a third image, and the first image is replaced with the third image in the sample image to update the sample image; The step of processing the first image using the second image corresponding to the first image to obtain the third image includes: Based on the to-be-complemented area in the first image, adjusting a second image corresponding to the first image; Based on the adjusted second image, at least one of pixel filling processing and pixel modification processing is performed on the to-be-complemented area in the first image to obtain the third image.
10. The model training method according to claim 9, characterized in that: The adjusting, based on the to-be-complemented area in the first image, the second image corresponding to the first image includes: Converting the first image into the frequency domain to obtain a first transformed image; Determine a transformed region in the first transformed image corresponding to the region to be supplemented, and calculate a frequency mean of corresponding frequencies in the transformed region; Converting a second image corresponding to the first image into the frequency domain to obtain a second transformed image; Using the pixel value of the first target pixel point in the first transformed image, the pixel value of the second target pixel point in the second transformed image is replaced to adjust the second transformed image, wherein the second target pixel point is all the pixel points in the second transformed image whose corresponding frequency is not greater than the frequency mean, and the first target pixel point is the pixel point in the first transformed image that is in the same area as that indicated by the second target pixel point; The adjusted second transformed image is converted into a spatial domain to obtain the adjusted second image.
11. The model training method according to any one of claims 1 to 8, characterized in that: The number of the sample images is multiple. Before extracting the first potential feature of the sample image and extracting the second potential feature of the first label, the method further includes: For each sample image, perform the following steps: Randomly select at least one target data enhancement processing method from a plurality of pre-configured data enhancement processing methods; The sample image is processed using the target data enhancement processing method to update the sample image.
12. The model training method according to claim 11, characterized in that: The multiple data enhancement processing methods include at least one of the following: vertical flipping, horizontal flipping, random rotation, gamma adjustment, random grid rearrangement, color jittering, perspective transformation, piecewise affine transformation, and grid distortion.
13. A method for identifying defects in underground cable pipelines, characterized in that: include: Acquire an image to be identified that is taken in an underground cable duct; The image to be identified is input into an underground cable pipeline defect recognition model to obtain a defect recognition result output by the underground cable pipeline defect recognition model, wherein the underground cable pipeline defect recognition model is trained based on the model training method described in any one of claims 1 to 12.
14. A computer program product comprising computer instructions, characterized in that When the computer instructions are executed by the processor, the model training method described in any one of claims 1 to 12 or the underground cable pipeline defect identification method described in claim 13 is implemented.
15. A computer device, characterized in that: It includes a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor. When the processor executes the computer program, it implements the model training method described in any one of claims 1 to 12, or the underground cable pipeline defect identification method described in claim 13.
