Municipal pipeline image intelligent classification method and device based on dynamic sparse constraint
By employing a dynamic sparse constraint-based intelligent classification method for municipal pipeline images, and utilizing particle swarm optimization to generate a classification dictionary and final state coefficient vector, the method solves the problem of structural damage to underground pipelines caused by corrosive media, achieving efficient and accurate defect identification and classification, and reducing public safety risks.
Patent Information
- Application Number
- CN202511222687.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-29
- Publication Date
- 2025-11-07
AI Technical Summary
During long-term operation, underground pipelines are prone to internal functional degradation and structural damage due to the presence of acidic or corrosive components in the transported medium. This can lead to a decrease in load-bearing capacity, potential fluid leakage that pollutes the surrounding soil and groundwater, and even public safety risks such as ground subsidence or local collapse. Therefore, there is an urgent need for efficient and accurate defect identification technology to support scientific repair solutions.
An intelligent classification method for municipal pipeline images based on dynamic sparse constraints is adopted. By acquiring underground pipeline images, extracting image features, using particle swarm optimization to generate a classification dictionary and final state coefficient vector, calculating error values, selecting the minimum error value to determine the defect type, and constructing a dictionary database to achieve efficient and accurate pipeline defect classification.
It enables efficient and accurate classification of pipeline defect images, improves the automation and reliability of detection, supports the scientific formulation of repair plans, and reduces public safety risks.
Smart Images

Figure CN120912992A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of image processing, in particular to a municipal pipeline image intelligent classification method and device based on dynamic sparse constraint. BACKGROUND
[0002] In the long-term operation of underground pipelines, due to the presence of acidic or corrosive components in the transported medium, internal functional degradation and structural damage of the pipeline body are easily induced. Common damage types include pipeline body rupture, joint leakage, morphological distortion, metal corrosion, interface misplacement, pipe joint shedding, external foreign matter invasion, illegal access of branch pipes, and silt blockage. Such damage can significantly reduce the load capacity of the pipeline, leading to fluid leakage and pollution of the surrounding soil and groundwater, and in extreme cases, may induce ground subsidence or local collapse and other public safety risks.
[0003] Therefore, it is urgent to use advanced detection technology to accurately identify defects and provide support for scientific repair scheme. SUMMARY
[0004] The present application aims to provide a municipal pipeline image intelligent classification method and device based on dynamic sparse constraint to alleviate the technical problem of pipeline load capacity decline, leading to fluid leakage and pollution of the surrounding soil and groundwater, and in extreme cases, may induce ground subsidence or local collapse and other public safety risks, and to provide an efficient and accurate means for determining the defect type of underground pipelines to provide support for scientific repair scheme.
[0005] In a first aspect, the present application provides a municipal pipeline image intelligent classification method based on dynamic sparse constraint, comprising: acquiring an underground pipeline image; extracting image features of the underground pipeline image to obtain a to-be-matched image feature; calculating error values between the to-be-matched image feature and each classification dictionary based on the to-be-matched image feature, a plurality of preset classification dictionaries, and the final state feature coefficient vector of the plurality of classification dictionaries; the plurality of classification dictionaries are generated by the following steps: collecting original underground pipeline images with known pipeline defect types; extracting image features of the original underground pipeline images to obtain original image features; generating the classification dictionary and the final state coefficient vector of the classification dictionary based on the particle swarm algorithm and the original image features; selecting the minimum error value from the error values; determining the defect type of the underground pipeline image according to the classification dictionary corresponding to the minimum error value.
[0006] In a preferred embodiment of the present invention, the step of generating the classification dictionary and the final state coefficient vector of the classification dictionary based on the original image features using the particle swarm optimization algorithm includes: determining atomic units with the same number of columns as the original image features based on the original image features; constructing an initial dictionary database based on the atomic units; calculating an intermediate state coefficient vector based on the original image features, the initial dictionary database, and a randomly generated initial coefficient vector using the particle swarm optimization algorithm; wherein the initial coefficient vector is a binary vector with the same dimension as the original image features; and constructing the classification dictionary and the final state coefficient vector of the classification dictionary based on the intermediate state coefficient vector and the initial dictionary database. In a preferred embodiment of the present invention, the step of calculating the intermediate state coefficient vector based on the particle swarm optimization algorithm, according to the original image features, the initial dictionary database, and the randomly generated initial coefficient vector, includes: Step A1: Calculating the result of a preset objective function and the corresponding initial coefficient vector based on the original image features, the initial dictionary database, and the initial coefficient vector; the objective function is: ;|| ||o<L; where L is the preset coefficient, D is the dictionary database matrix corresponding to the initial dictionary database, F represents the calculation result, and X is the original image feature. The above is the initial coefficient vector; Step A2: Evaluate the performance parameters of each sub-vector in the above initial coefficient vector based on the preset fitness function to obtain the first updated initial coefficient vector corresponding to minimizing the reconstruction error; Step A3: Based on the historical best position of each particle in the above first updated initial coefficient vector, the corresponding fitness value, and the position with the highest fitness in the above updated initial coefficient vector, determine the above intermediate state coefficient vector.
[0007] In the preferred embodiment of the present application, based on the history optimal position of each particle in the first updated initial coefficient vector, the corresponding fitness value, and the highest fitness position in the updated initial coefficient vector, the step of determining the intermediate state coefficient vector comprises: step A4: updating the individual optimal particle and the global optimal particle in the first updated initial coefficient vector to obtain a second updated initial coefficient vector; step A5: generating the binary position corresponding to the second updated initial coefficient vector; step A6: updating the binary position and the speed of each particle in the second updated initial coefficient vector by using a preset position updating formula and a preset speed updating formula to obtain a third updated initial coefficient vector; step A7: replacing the initial coefficient vector with the third updated initial coefficient vector, repeating the steps A1 to A6 until the value of the calculation result is minimum; and the sub-intermediate state coefficient vector corresponding to the calculation result with the minimum value.
[0008] In the preferred embodiment of the present application, the speed updating formula is as follows:
[0009] wherein w represents a preset inertia weight, c1 represents a preset first learning factor, c2 represents a preset second learning factor, r1 represents a preset first random number, r2 represents a preset second random number, represents the individual optimal position in the second updated initial coefficient vector, represents the global optimal position in the second updated initial coefficient vector, represents the speed of the particle in the second updated initial coefficient vector after updating in the dimension d at t+1 time, represents the speed of the particle in the second updated initial coefficient vector at t time in the dimension d, represents the position of the particle at t time in the dimension d.
[0010] In the preferred embodiment of the present application, the position updating formula is as follows:
[0011] represents the probability value of mapping the speed to the interval (0, 1) by using a Sigmoid conversion function, represents the updated position of the i-th particle in the d-th dimension, which is 0 or 1, and rand() represents a random number in the interval [0, 1), which is used for comparing with the probability value to determine the updating of the position of the particle.
[0012] In the preferred embodiment of the present application, based on the intermediate state coefficient vector and the initial dictionary database, the step of constructing the classification dictionary and the final state coefficient vector of the classification dictionary comprises: step B1: constructing an error matrix based on the intermediate state coefficient vector and the initial dictionary database; step B2: performing singular value decomposition on the error matrix to obtain an intermediate state dictionary database and an update coefficient vector; step B3: calculating the Frobenius norm between the intermediate state dictionary database and the original image features; step B4: determining whether the Frobenius norm is less than a preset threshold; step B5: when the Frobenius norm is greater than or equal to the preset threshold, repeating steps A1 to A7 and B1 to B5 until the Frobenius norm is less than the preset threshold, and determining the update coefficient vector and the intermediate state dictionary database corresponding to the Frobenius norm less than the preset threshold as the final state coefficient vector and the classification dictionary, respectively.
[0013] In the preferred embodiment of the present application, the pipeline defect types include: no defect, leakage, rupture, fluctuation, misalignment, and defect level information corresponding to each of the no defect, leakage, rupture, fluctuation, and misalignment.
[0014] In a second aspect, the embodiments of the present application further provide an intelligent classification device for municipal pipeline images based on dynamic sparse constraints, which comprises: a data acquisition module configured to acquire underground pipeline images; a determination module configured to extract image features of the underground pipeline images to obtain to-be-matched image features; calculate error values between the to-be-matched image features and each classification dictionary according to the to-be-matched image features, a plurality of preset classification dictionaries, and final state feature coefficient vectors of the plurality of classification dictionaries; and the plurality of classification dictionaries are generated by the following steps: collecting original underground pipeline images with known pipeline defect types; extracting image features of the original underground pipeline images to obtain original image features; generating the classification dictionaries and the final state coefficient vectors of the classification dictionaries based on the original image features according to a particle swarm algorithm; selecting a minimum error value from the error values; and determining a defect type of the underground pipeline images according to a classification dictionary corresponding to the minimum error value.
[0015] In a third aspect, the embodiments of the present application provide an electronic device, which comprises a processor and a memory, the memory stores computer executable instructions capable of being executed by the processor, and the processor executes the computer executable instructions to implement the intelligent classification method for municipal pipeline images based on dynamic sparse constraints.
[0016] In a fourth aspect, the embodiments of the present application further provide a computer storage medium, which stores a computer program, and the computer program includes program instructions, which, when executed by a processor, cause the processor to execute the intelligent classification method for municipal pipeline images based on dynamic sparse constraints.
[0017] The present application has the following beneficial technical effects: The embodiments of the present application provide an intelligent classification method for municipal pipeline images based on dynamic sparse constraints and a device thereof, which comprises the following steps: obtaining an underground pipeline image; extracting image features of the underground pipeline image to obtain image features to be matched; calculating error values between the image features to be matched and each classification dictionary according to the image features to be matched, a plurality of preset classification dictionaries and terminal state feature coefficient vectors of the plurality of classification dictionaries; generating the plurality of classification dictionaries through the following steps: collecting original underground pipeline images with known pipeline defect types; extracting image features of the original underground pipeline images to obtain original image features; generating the classification dictionaries and the terminal state coefficient vectors of the classification dictionaries according to the original image features based on a particle swarm algorithm; selecting a minimum error value from the error values; and determining a defect type of the underground pipeline image according to a classification dictionary corresponding to the minimum error value. The method constructs a dictionary database through a particle swarm algorithm, realizes efficient and accurate classification of pipeline defect images, and improves the automation and reliability of detection. BRIEF DESCRIPTION OF DRAWINGS
[0018] In order to more clearly illustrate the specific embodiments of the present application or the technical solutions in the prior art, the following will briefly introduce the drawings needed to be used in the specific embodiments or prior art description. Obviously, the drawings in the following description are some embodiments of the present application, and for those skilled in the art, other drawings can also be obtained without creative labor on the basis of these drawings.
[0019] Figure 1 A flowchart of an intelligent classification method for municipal pipeline images based on dynamic sparse constraints provided by the embodiments of the present application; Figure 2 A flowchart of a classification dictionary and a terminal state coefficient vector construction method provided by the embodiments of the present application; Figure 3 A structural diagram of an intelligent classification device for municipal pipeline images based on dynamic sparse constraints provided by the embodiments of the present application; Figure 4 A structural diagram of an electronic device provided by the embodiments of the present application.
[0020] Icon: 31 - data acquisition module; 32 - determination module; 41 - memory; 42 - processor; 43 - bus; 44 - communication interface. DETAILED DESCRIPTION
[0021] For the purposes of the embodiments of the present application, the technical solutions and advantages will be clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. The components of the embodiments of the present application described and shown in the drawings can be arranged and designed in various different configurations.
[0022] In long-term operation, underground pipelines are prone to internal functional degradation and structural damage due to the presence of acidic or corrosive components in the transported medium. Common damage types include pipe body rupture, joint leakage, shape distortion, metal corrosion, interface misplacement, pipe joint shedding, external foreign matter invasion, illegal access of branch pipes, and sediment blockage. Such damage can significantly reduce the load capacity of the pipeline, leading to fluid leakage and pollution of surrounding soil and groundwater, and in extreme cases, may induce ground subsidence or local collapse, posing a public safety risk. Therefore, it is urgent to use advanced detection technology to accurately identify defects and provide support for scientific repair plan.
[0023] Based on this, the embodiments of the present application provide a municipal pipeline image intelligent classification method and device based on dynamic sparse constraint. The method constructs a dictionary database through a particle swarm algorithm, realizes efficient and accurate classification of pipeline defect images, and improves the automation and reliability of detection. In order to facilitate understanding, first introduce a municipal pipeline image intelligent classification method based on dynamic sparse constraint.
[0024] Embodiment 1 In this embodiment, Figure 1 A flowchart of a municipal pipeline image intelligent classification method based on dynamic sparse constraint provided by the embodiments of the present application.
[0025] From Figure 1 As seen, the method comprises: Step S101: acquiring an underground pipeline image.
[0026] In this embodiment, the underground pipeline image is generally acquired by a camera. Here, the underground pipeline image is generally an internal image of the underground pipeline.
[0027] Step S102: extracting image features of the above-mentioned underground pipeline image to obtain image features to be matched.
[0028] Herein, the step S102 comprises: extracting color features, pixel features, texture features and shape features of the underground pipeline image to obtain image features to be matched.
[0029] The step S103 comprises: calculating error values between the image features to be matched and each of the classification dictionaries according to the image features to be matched, the plurality of classification dictionaries and the terminal state feature coefficient vectors of the plurality of classification dictionaries; the plurality of classification dictionaries are generated by the following steps: collecting original underground pipeline images with known pipeline defect types; extracting image features of the original underground pipeline images to obtain original image features; generating the classification dictionaries and the terminal state coefficient vectors of the classification dictionaries according to the original image features based on a particle swarm algorithm.
[0030] The pipeline defect types comprise: no defect, leakage, rupture, upheaval, misalignment and defect level information corresponding to the no defect, the leakage, the rupture, the upheaval and the misalignment respectively.
[0031] In the embodiment, the original underground pipeline image is subjected to feature extraction to generate original image features, which comprises: extracting color features, pixel features, texture features and shape features of the original underground pipeline image to generate the original image features.
[0032] Herein, the step of extracting the color features of the original underground pipeline image comprises: extracting the color features of the original underground pipeline image through a color channel and a brightness model constructed by the color channel.
[0033] Specifically, the brightness model is I=0.21R+0.72G+0.07B, which is a weighted average value of RGB channels. I is the brightness model, R is a red channel, G is a green channel and B is a blue channel.
[0034] Further, the step of extracting the pixel features of the original underground pipeline image comprises: dividing the original underground pipeline image into a plurality of image blocks based on a preset parameter; determining pixel mean values, pixel variances and pixel kurtoses of each of the image blocks according to a preset weight of a corresponding region of the image block and pixel values of each of the image blocks; a multiplication result of the preset weights of the plurality of image blocks is 1; and determining the pixel features of the original underground pipeline image according to the pixel mean values, the pixel variances and the pixel kurtoses.
[0035] Herein, the pixel values of each of the image blocks are determined by a ratio of a number of pixels with a preset pixel intensity in the image block to a number of pixels in the image block.
[0036] The step of determining the pixel average value, the pixel variance and the pixel kurtosis of each image block according to the preset weight of the corresponding region of the image block and the pixel value of each image block comprises: calculating the pixel average value of each image block according to the preset weight of the corresponding region of the image block and the pixel value of each image block; calculating the local variance and the overall variance of each pixel point in each image block according to the pixel value of each image block, the pixel average value and the window pixel average value corresponding to the sliding window; calculating the pixel variance according to the local variance and the overall variance; and calculating the pixel kurtosis according to the pixel variance, the pixel value of each image block and the pixel average value.
[0037] Further, the step of calculating the local variance and the overall variance of each pixel point in each image block according to the pixel value of each image block, the pixel average value and the window pixel average value corresponding to the sliding window comprises: calculating the local variance according to the following formula:
[0038] wherein, the local variance is, the preset size of the sliding window is, the pixel value of the i+mth row and the j+nth column in the image block is, the window pixel average value when the center pixel position is the ith row and the jth column of the sliding window is; the overall variance is calculated according to the following formula:
[0039] wherein, the overall variance is, the number of rows of the image block is M, the number of columns of the image block is N, and the pixel value of the ith row and the jth column in the image block is I(i,j), the pixel average value is; The step of calculating the pixel variance according to the local variance and the overall variance comprises: the pixel variance is calculated according to the following formula:
[0040] wherein, the pixel variance is, the preset coefficient is.
[0041] Further, the step of extracting the shape features of the original underground pipeline image comprises: extracting first-order invariant moments, second-order invariant moments, third-order invariant moments, fourth-order invariant moments, fifth-order invariant moments, sixth-order invariant moments and seventh-order invariant moments of the original underground pipeline image; and determining the shape features of the original underground pipeline image according to the first-order invariant moments, the second-order invariant moments, the third-order invariant moments, the fourth-order invariant moments, the fifth-order invariant moments, the sixth-order invariant moments and the seventh-order invariant moments.
[0042] Further, the step of extracting the first-order invariant moments, the second-order invariant moments, the third-order invariant moments, the fourth-order invariant moments, the fifth-order invariant moments, the sixth-order invariant moments and the seventh-order invariant moments of the original underground pipeline image comprises: extracting the first-order invariant moments of the original underground pipeline image based on the following formula:
[0043] wherein, the first-order invariant moments are a second-order central moment of the original underground pipeline image in a horizontal direction, a second-order central moment of the original underground pipeline image in a vertical direction; extracting the second-order invariant moments of the original underground pipeline image based on the following formula:
[0044] wherein, the second-order invariant moments are a first-order central moment in the horizontal direction and a first-order central moment in the vertical direction; extracting the third-order invariant moments of the original underground pipeline image based on the following formula:
[0045] wherein, the third-order invariant moments are a third-order central moment in the horizontal direction, a third-order central moment in the vertical direction, a second-order central moment in the horizontal direction and a first-order central moment in the vertical direction, a first-order central moment in the horizontal direction and a second-order central moment in the vertical direction; extracting the fourth-order invariant moments of the original underground pipeline image based on the following formula:
[0046] wherein, the fourth-order invariant moments are extracting the fifth-order invariant moments of the original underground pipeline image based on the following formula:
[0047] wherein, is the above-mentioned five-order moment of inertia; The seven-order moment of inertia of the original underground pipeline image is extracted based on the following formula:
[0048] wherein, is the above-mentioned seven-order moment of inertia; The seven-order moment of inertia of the original underground pipeline image is extracted based on the following formula:
[0049] wherein, is the above-mentioned seven-order moment of inertia.
[0050] Further, the step of extracting the texture feature of the original underground pipeline image comprises: converting the original underground pipeline image into a gray-scale image; calculating a gray-scale co-occurrence matrix of a preset direction according to the above-mentioned gray-scale image; and calculating a Haralick texture feature corresponding to each of the above-mentioned directions according to the above-mentioned gray-scale co-occurrence matrix.
[0051] wherein, the GLCM is generated from three angles: 0°, 45° and 90°.
[0052] The GLCM of two pixel intensity values in the above-mentioned pipeline image at a distance d and a direction is defined as , which represents the probability of the pixel pair with pixel intensity values of Im and In appearing at a distance d and an angle φ. Wherein is the ratio of the number of (Im, In) pairs at a distance d and an angle to the total number of pixel pairs.
[0053] wherein, N is the number of pixel intensity values; Im and In: two different gray levels of the above-mentioned gray-scale image; d: the distance between the pixel pairs; φ: the direction angle between the pixel pairs; Five Haralick texture features are obtained from the GLCM, specifically including: ; wherein, ; ; ; ; ; where ASM is the angular second moment, CON is the contrast, IDF is the inverse different moment, Corr is the correlation, and Var is the variance.
[0054] The GLCM is computed for 3 different angles, namely 0°, 45° and 90°, and the GLCM is two pixel intensity values are generated at 3 distance values d = 1, 2 and 3.
[0055] Thus, 9 gray level co-occurrence matrices are generated for each image patch. Further, 5 texture features are computed from each gray level co-occurrence matrix, resulting in 45 texture feature vectors, denoted as WT.
[0056] In some embodiments of the above method, after the step of extracting the color features, pixel features, texture features and shape features of the original underground pipeline images to generate the original image features, the method comprises: normalizing the original image features to obtain normalized features; and based on the second generation non-dominated sorting genetic algorithm, constructing the dictionary database and the terminal state coefficient vector of the dictionary database according to the original image features, comprises: based on the second generation non-dominated sorting genetic algorithm, constructing the dictionary database and the terminal state coefficient vector of the dictionary database according to the normalized features.
[0057] Further, the step of normalizing the original image features to obtain normalized features comprises: determining the number of groups according to the feature dimension of the original image features; the square of the number of groups is equal to the feature dimension; dividing the original image features into a plurality of groups of sub-feature combinations according to the number of groups; calculating the mean and variance of each group of sub-feature combinations; normalizing the original image features according to the mean and variance of the sub-feature combinations to obtain intermediate state normalized features; adjusting the intermediate state normalized features based on a preset scaling coefficient and an offset coefficient to obtain normalized features.
[0058] For ease of understanding, it is assumed that there are N original image feature samples, each of which is composed of color features, texture features and shape features, and the feature dimension is 64. It is assumed that the number of groups is 8, so that each group corresponds to 8 features. Then, for each original image feature sample, the mean and variance of each group of features are calculated.
[0059] where the mean and variance of each group of features are calculated by the following formula: ;
[0060] where, is the mean of the gth group of feature values, is the variance of the gth group of feature values, is the gth group of feature values of the ith original image feature sample, H and W are the width and height of the feature map, H = W = 1.
[0061] Then, the original image features are normalized according to the mean and variance of the above-mentioned sub-feature combination to obtain intermediate state normalized features; the intermediate state normalized features are adjusted based on a preset scaling coefficient and an offset coefficient to obtain normalized features.
[0062] The calculation formula is:
[0063]
[0064] wherein the is the gth group of feature values of the intermediate state normalized features of the ith original image feature sample, is a non-zero positive number, is a scaling coefficient, is an offset coefficient, is a normalized feature.
[0065] Step S104: selecting a minimum error value from the error values.
[0066] Step S105: determining the defect type of the underground pipeline image according to the classification dictionary corresponding to the minimum error value.
[0067] The embodiment of the present application provides a municipal pipeline image intelligent classification method based on dynamic sparse constraint, which comprises the following steps: acquiring an underground pipeline image; extracting image features of the underground pipeline image to obtain to-be-matched image features; calculating error values between the to-be-matched image features and each classification dictionary according to the to-be-matched image features, a plurality of preset classification dictionaries and terminal state feature coefficient vectors of the plurality of classification dictionaries; the plurality of classification dictionaries are generated through the following steps: collecting original underground pipeline images with known pipeline defect types; extracting image features of the original underground pipeline images to obtain original image features; generating the classification dictionaries and the terminal state coefficient vectors of the classification dictionaries according to the original image features based on a particle swarm algorithm; selecting a minimum error value from the error values; determining the defect type of the underground pipeline image according to the classification dictionary corresponding to the minimum error value. The method constructs a dictionary database through a particle swarm algorithm, realizes efficient and accurate classification of pipeline defect images, and improves the automation and reliability of detection.
[0068] Embodiment 2 On the basis of the above-mentioned embodiments, the embodiment of the present application focuses on introducing the steps of generating the classification dictionary and the final state coefficient vector of the classification dictionary based on the particle swarm algorithm according to the original image features. Figure 2 A flowchart of a classification dictionary and a classification dictionary final state coefficient vector construction method provided by the embodiment of the present application.
[0069] By Figure 2 It is found that the method comprises: Step S201: determining an atomic unit according to the original image features, the atomic unit being the same as the column number of the original image features.
[0070] Step S202: constructing an initial dictionary database according to the atomic unit.
[0071] Step S203: calculating an intermediate state coefficient vector based on the particle swarm algorithm according to the original image features, the initial dictionary database, and a randomly generated initial coefficient vector, the initial coefficient vector being a binary vector with the same dimension as the original image features.
[0072] Step S204: constructing the classification dictionary and the final state coefficient vector of the classification dictionary according to the intermediate state coefficient vector and the initial dictionary database. The step of calculating the intermediate state coefficient vector based on the particle swarm algorithm according to the original image features, the initial dictionary database, and a randomly generated initial coefficient vector comprises: In the preferred embodiment of the present application, the step of calculating the intermediate state coefficient vector based on the particle swarm algorithm according to the original image features, the initial dictionary database, and a randomly generated initial coefficient vector comprises: Step A1: calculating the calculation result of a preset target function and the initial coefficient vector corresponding to the calculation result according to the original image features, the initial dictionary database, and the initial coefficient vector; the target function is: ;|| ||o<L; wherein L is a preset coefficient degree, D is a dictionary database matrix corresponding to the initial dictionary database, F represents the calculation result, X is the original image features, is the initial coefficient vector; Step A2: evaluating the performance parameters of each sub-vector in the initial coefficient vector based on a preset fitness function to obtain a first updated initial coefficient vector corresponding to the minimum reconstruction error; Step A3: determining the intermediate state coefficient vector based on the historical optimal position of each particle in the first updated initial coefficient vector, the corresponding fitness value, and the position with the highest fitness in the updated initial coefficient vector.
[0073] Further, based on the history optimal position of each particle in the first updated initial coefficient vector, the corresponding fitness value, and the highest fitness position in the updated initial coefficient vector, the step of determining the intermediate state coefficient vector comprises: step A4: updating the individual optimal particle and the global optimal particle in the first updated initial coefficient vector to obtain a second updated initial coefficient vector; step A5: generating a binary position corresponding to the second updated initial coefficient vector; step A6: updating the binary position and the speed of each particle in the second updated initial coefficient vector by a preset position updating formula and a preset speed updating formula to obtain a third updated initial coefficient vector; step A7: replacing the initial coefficient vector with the third updated initial coefficient vector, repeating the steps A1 to A6 until a preset iteration number is reached, until the value of the calculation result is minimum; the sub-intermediate state coefficient vector corresponding to the calculation result with the minimum value.
[0074] The speed updating formula is as follows:
[0075] wherein w represents a preset inertia weight, c1 represents a preset first learning factor, c2 represents a preset second learning factor, r1 represents a preset first random number, and r2 represents a preset second random number, represents the individual optimal position in the second updated initial coefficient vector, represents the global optimal position in the second updated initial coefficient vector, represents the speed of the particle in the second updated initial coefficient vector after updating in dimension d at t+1 time, represents the speed of the particle in the second updated initial coefficient vector at t time in dimension d, represents the position of the particle at t time in dimension d.
[0076] The position updating formula is as follows:
[0077] represents the probability value of mapping the speed to the interval (0, 1) by the Sigmoid conversion function, represents the updated position of the i-th particle in the d-th dimension, taking the value of 0 or 1, rand() represents a random number in the interval [0, 1), which is used for comparison with the probability value to determine the update of the particle position.
[0078] After the step of updating the binary position of each particle by a preset position updating formula to obtain a third updated initial coefficient vector, the method further includes: determining whether the number of non-zero elements of the third updated initial coefficient vector exceeds the coefficient degree; if yes, calculating the local reconstruction error contribution of each particle in the third updated initial coefficient vector; retaining the elements of the coefficient degree with the largest local reconstruction error contribution to obtain a fourth updated initial coefficient vector; replacing the initial coefficient vector with the third updated initial coefficient vector, and repeatedly performing the steps A1 to A5 until a preset iteration number is reached, until the step of obtaining the minimum value of the calculation result, including: replacing the initial coefficient vector with the fourth updated initial coefficient vector, and repeatedly performing the steps A1 to A5 until a preset iteration number is reached, until the minimum value of the calculation result is obtained.
[0079] Finally, the step of constructing the classification dictionary and the final state coefficient vector of the classification dictionary according to the intermediate state coefficient vector and the initial dictionary database includes: step B1: constructing an error matrix according to the intermediate state coefficient vector and the initial dictionary database; step B2: performing singular value decomposition on the error matrix to obtain an intermediate state dictionary database and an updated coefficient vector; step B3: calculating the Frobenius norm between the intermediate state dictionary database and the original image feature; step B4: determining whether the Frobenius norm is less than a preset threshold; step B5: when the Frobenius norm is greater than or equal to the preset threshold, repeatedly performing the steps A1 to A7 and the steps B1 to B5 until the Frobenius norm is less than the preset threshold, and determining the updated coefficient vector and the intermediate state dictionary database corresponding to the Frobenius norm less than the preset threshold as the final state coefficient vector and the classification dictionary, respectively.
[0080] For the convenience of understanding, the present application is described by the following examples: The classification dictionary D is composed of n-dimensional vectors, where the vector X ∈ Rn. The orthogonal basis in Rn is a set of vectors, called atomic units, (D = {d1, d2...dn}).
[0081] Further, the original image feature X can be represented by the following calculation formula: ; wherein α represents the coefficient vector, X can be represented by a few atomic units in the classification dictionary D in a linear combination manner, α = [α1, α2,...αn]T ∈ Rn.
[0082] The original image feature X of a certain original underground pipeline image is [3, 1, 4, 1, 5], and the classification dictionary D is: Then the coefficient vector α = [1, 0, 1, 0, 1] The final output feature vector X'=Dα can be obtained. The output feature vector X' is
[0083] The above example uses an idealized approach, where the original image features X and the output feature vector X' are equal. However, in reality, errors exist. To ensure that the difference between the original input feature vector and the output feature vector is minimized, an objective function needs to be constructed.
[0084] The objective function is st ||a||o<L;where L represents the preset sparsity, which is a positive integer, indicating that each input data can be represented by a linear combination of at most L atoms in the dictionary database D; To find the minimum value of the objective function F, this invention uses the particle swarm optimization algorithm, and the specific steps are as follows: First, initialize the particle swarm; specifically, each particle represents a coefficient vector. Where n is the number of atoms in the classification dictionary D, This is a binary subvector (0 indicates not selecting the corresponding atom, 1 indicates selecting it). Set the particle swarm size N (e.g., N=100) and randomly generate N binary subvectors. Satisfying sparsity constraints (Non-zero elements do not exceed L).
[0085] Randomly initialize vectors for each subvector ,scope The calculation formula is: .
[0086] Then, the performance of each subvector is evaluated using a predefined fitness function. In sparse reconstruction, the fitness function can be the negative of the reconstruction error. Constraint function: If The subvector is either directly removed or reset to have L non-zero elements. The goal is to minimize the reconstruction error. A smaller error results in a higher fitness, thus yielding the first updated initial coefficient vector corresponding to minimizing the reconstruction error.
[0087] Next, the historical best position and fitness value of each subvector are recorded, along with the position with the highest fitness in the entire particle swarm. Here, pbest represents the individual best, and gbest represents the global best. Then, an updating rule is formulated to update the individual best particle and the global best particle in the first updated initial coefficient vector based on the historical best position of each particle in the first updated initial coefficient vector, the corresponding fitness value, and the position with the highest fitness value in the first updated initial coefficient vector, to obtain a second updated initial coefficient vector.
[0088] The updating rule is expressed by the following formula:
[0089] Further, the binary particle swarm model is adopted, and the second updated initial coefficient vector is mapped to a probability value by a sigmoid function to generate the binary position of each particle in the second updated initial coefficient vector.
[0090] The velocity updating formula is expressed as follows:
[0091] wherein w represents a preset inertia weight, c1 represents a preset first learning factor, c2 represents a preset second learning factor, r1 represents a preset first random number, r2 represents a preset second random number, represents the individual best in the second updated initial coefficient vector, represents the global best in the second updated initial coefficient vector, represents the updated velocity of the particle in the second updated initial coefficient vector, represents the velocity of the particle in the second updated initial coefficient vector, represents the position of the particle in the d-th dimension at the t-th moment; The position updating formula is expressed as follows:
[0092] represents the probability value mapped from the velocity to the interval (0, 1) by the sigmoid conversion function, represents the updated position of the i-th particle in the d-th dimension, and takes the value of 0 or 1, rand() represents a random number in the interval [0, 1), which is used for comparison with the probability value to determine the update of the particle position.
[0093] After each position update, the non-zero elements of the coefficient vector are forced to be no more than L, if the local reconstruction error contribution of each non-zero element is calculated:
[0094] Further, the top L elements with the largest contribution are reserved and the rest are set to zero. If a = [1, 1, 1, 0] and L = 3, the top 3 elements with the largest contribution are reserved and the rest are set to zero.
[0095] After obtaining the solution of the minimum value of the objective function F, the classification dictionary D is then updated, and the updating steps are as follows: First, for each dictionary atom dk, the updating process includes: constructing an error matrix: Ek = XΩk - DΩkαΩk; where Ωk is the index set of all signals using the dictionary atom dk; XΩk is a subset composed of all signals using dk; DΩk is a subset composed of dictionary atoms corresponding to the indexes in Ωk; and αΩk is a subset of the corresponding coefficient vector. Then, SVD updating is performed: [U, S, V] = SVD(Ek), taking the first column of U as the new atom as dk, and the product of the first element of S and the first column of V as the new sparse coefficient αk,i. Then, the atom is updated: . Finally, when the reconstruction ( represents a threshold value, which can be 0.01, or the maximum number of iterations: the maximum preset number of iterations T (such as T = 1000) is reached.
[0096] The present application further adopts the following embodiments to explain the above steps in detail; the input original image features are assumed as follows: Then, the classification dictionary D contains 9 atoms (each atom is a 9-dimensional vector, corresponding to the dimension after the 3x3 matrix is flattened).
[0097] When the classification dictionary is the initial dictionary database D, it is a unit matrix: The sparsity constraint is L = 3, that is, the coefficient vector α contains at most 3 non-zero elements (with a value of 1).
[0098] Then, the original image features X are flattened into a 9-dimensional vector: X flat = [120, 135, 90, 85, 110, 75, 95, 100, 80]; X flat is a 9-dimensional vector.
[0099] Then, the particle swarm size is N = 4 (simplified calculation), and the initial particle position (binary coefficient vector) is: particle 1: = [1, 0, 0, 0, 1, 0, 0, 0, 1] (selecting the 1st, 5th, and 9th atoms); particle 2: = [0, 1, 1, 0, 0, 0, 0, 0, 0] (selecting the 2nd and 3rd atoms); particle 3: = [1, 1, 0, 0, 0, 1, 0, 0, 0] (selecting the 1st, 2nd, and 6th atoms); and particle 4: =[0,0,0,1,0,0,1,0,0] (select the 4th, 7th atom); initial velocity: randomly generated (e.g. v1=[0.5,-0.3,0.2,-0.7,0.4,0.1,-0.6,0.3,-0.2]).
[0100] Then, the objective function is , and the fitness function is .
[0101] Taking the above particle 1 as an example, , the error is , and the fitness is -285.3; particle 2: error is about 320.1, fitness is about -320.1; particle 3: error is about 275.8, fitness is about -275.8; particle 4: error is about 310.5, fitness is about -310.5; therefore, the current optimal is particle 3 with the highest fitness, which is set as the global optimal .
[0102] Then, update the particle velocity and position, and set the parameters as w=0.7, c1=c2=1.5, r1=0.4, r2=0.6.
[0103] Taking the above particle 1 as an example: Original velocity:
[0104] Velocity update:
[0105] Since , calculate the difference: . Updated velocity:
[0106] Position update: map the velocity through the Sigmoid function:
[0107] ; new position of particle 1: , the number of non-zero elements is 2 (consistent with L=3), and no adjustment is needed.
[0108] If the number of non-zero elements of the new position of the particle exceeds 3: for example , the first 3 elements with the largest contribution are retained.
[0109] Then, update the dictionary database according to the global optimal , update the dictionary atoms: construct the error matrix:
[0110] Then, singular value decomposition is performed on E to update the atoms .
[0111] When the maximum number of iterations is reached or the convergence threshold is reached, i.e., when the reconstruction error is terminated.
[0112] Here, the reconstruction dictionary database error is obtained by calculating the Frobenius norm between the original image feature X and the classification dictionary D and the coefficient matrix X reconstructed data matrix Da. The error calculation formula is as follows: ; The Frobenius norm is calculated, and the specific calculation formula is as follows:
[0113] Where m and n are the number of rows and columns of the original image feature X, is the element in the ith row and jth column of X, is the element in the ith row and jth column of the reconstruction matrix.
[0114] If the reconstruction dictionary database error is less than a preset threshold ε, it is considered to have converged, otherwise the dictionary database needs to be updated.
[0115] The above steps construct a powerful and complete classification dictionary, which has a pipeline class category and a defect class category i and its defect level The defect class includes: no defect image, background noise image, leakage, rupture, fluctuation, and misalignment; the defect level includes: first-level defect image, second-level defect image, and third-level defect image.
[0116] Then, for the above-mentioned category and defect level images, a classification dictionary D is established respectively, each classification dictionary has a corresponding coefficient vector a, and it is assumed that there are n classification dictionaries D, as shown in Table 1 below: Table 1
[0117] The input to-be-matched image feature is Y, and the error between the to-be-matched image feature and the n classification dictionaries D is calculated respectively:
[0118] The value of Error is analyzed and compared, and the defect type corresponding to the minimum error is the defect type of the to-be-matched image feature.
[0119] For example, as shown in Table 2, when Y1 is input, E1=0.15, which is the minimum; the others are E2=0.47 and E3=0.32. It can be obtained that the defect type corresponding to the to-be-matched image feature is leakage.
[0120] Table II
[0121] The embodiment of the present application provides a method for generating a classification dictionary and a final state coefficient vector of the classification dictionary based on a particle swarm algorithm according to the original image features, comprising the following steps: determining an atomic unit same in column number with the original image features according to the original image features; constructing an initial dictionary database according to the atomic unit; calculating an intermediate state coefficient vector based on the particle swarm algorithm, the original image features, the initial dictionary database and a randomly generated initial coefficient vector; the initial coefficient vector is a binary vector same in dimension with the original image features; and constructing the dictionary database and the final state coefficient vector according to the intermediate state coefficient vector and the initial dictionary database. The method optimizes the binary coefficient vector and the dictionary library through the particle swarm algorithm, significantly improves the feature sparse representation capability and the calculation efficiency in the classification task, simultaneously realizes the adaptive and collaborative optimization of the dictionary structure and the coefficient, and enhances the image classification accuracy and the model robustness.
[0122] Embodiment 3 On the basis of the above-mentioned embodiments, Figure 3 A structure schematic diagram of a municipal pipeline image intelligent classification device based on dynamic sparse constraint is provided for the embodiment of the present application.
[0123] As seen from Figure 3 The device comprises: A data acquisition module 31, configured to acquire an underground pipeline image.
[0124] A determination module 32, configured to extract image features of the underground pipeline image to obtain to-be-matched image features, calculate error values between the to-be-matched image features and each classification dictionary according to the to-be-matched image features, a plurality of classification dictionaries and final state feature coefficient vectors of the plurality of classification dictionaries, and determine a defect type of the underground pipeline image according to a classification dictionary corresponding to a minimum error value.
[0125] The data acquisition module 31 is connected with the determination module 32.
[0126] In one of the embodiments, the determining module 32 is further configured to determine, according to the original image features, atomic units same in number as columns of the original image features; construct an initial dictionary database according to the atomic units; calculate, based on a particle swarm algorithm, an intermediate state coefficient vector according to the original image features, the initial dictionary database, and an initial coefficient vector randomly generated, the initial coefficient vector being a binary vector same in dimension as the original image features; and construct the dictionary database and a final state coefficient vector according to the intermediate state coefficient vector and the initial dictionary database. In one of the embodiments, the determining module 32 is further configured to perform step A1: calculate a calculation result of a preset target function and an intermediate state coefficient vector corresponding to the calculation result according to the original image features, the initial dictionary database, and the initial coefficient vector; the target function being: wherein L is a preset coefficient degree, D is a dictionary database matrix corresponding to the initial dictionary database, F represents the calculation result, X is the original image features, and X is the initial coefficient vector; step A2: evaluate performance parameters of each sub-vector in the initial coefficient vector based on a preset fitness function; wherein the fitness function is represented by the following formula: wherein if , eliminate or reset the target sub-vector to the coefficient degree to obtain a first updated initial coefficient vector corresponding to a minimum reconstruction error; step A3: update an individual optimal particle and a global optimal particle in the first updated initial coefficient vector based on a historical optimal position of each particle in the first updated initial coefficient vector, a corresponding fitness value, and a position with the highest fitness in the updated initial coefficient vector to obtain a second updated initial coefficient vector; step A4: map the second updated initial coefficient vector to probability values by a sigmoid function to generate binary positions of each particle in the second updated initial coefficient vector by using a binary particle swarm model; step A5: update the binary positions and velocities of each particle in the second updated initial coefficient vector by a preset position update formula and a preset velocity update formula to obtain a third updated initial coefficient vector; the number of non-zero elements of the third updated initial coefficient vector does not exceed the preset coefficient degree; step A6: replace the initial coefficient vector with the third updated initial coefficient vector, and repeat the steps A1 to A5 until a value of the calculation result is minimum; and step A7: determine a sub-intermediate state coefficient vector corresponding to the calculation result with the minimum value as the intermediate state coefficient vector.
[0127] In one of the embodiments, the determining module 32 is further configured to determine whether the number of non-zero elements of the third updated initial coefficient vector exceeds the coefficient degree, and if yes, calculate the local reconstruction error contribution of each particle in the third updated initial coefficient vector; retain the first coefficient degree number of elements with the largest local reconstruction error contribution to obtain a fourth updated initial coefficient vector; replace the initial coefficient vector with the third updated initial coefficient vector, and repeat steps A1 to A5 until a step of obtaining the minimum value of the calculation result, including replacing the initial coefficient vector with the fourth updated initial coefficient vector, and repeating steps A1 to A5 until a step of obtaining the minimum value of the calculation result.
[0128] In one of the embodiments, the determining module 32 is further configured to perform the following steps: B1, constructing an error matrix according to the intermediate state coefficient vector and the initial dictionary database; B2, performing singular value decomposition on the error matrix to obtain an intermediate state dictionary database and an updated coefficient vector; B3, calculating the Frobenius norm between the intermediate state dictionary database and the original image feature; B4, determining whether the Frobenius norm is less than a preset threshold; B5, when the Frobenius norm is greater than or equal to the preset threshold, repeating steps A1 to A7 and B1 to B5 until the Frobenius norm is less than the preset threshold, and determining the updated coefficient vector and the intermediate state dictionary database corresponding to the Frobenius norm less than the preset threshold as the final state coefficient vector and the dictionary database, respectively.
[0129] The device for intelligently classifying municipal pipeline images based on dynamic sparse constraints provided by the embodiments has the same technical features as the method for intelligently classifying municipal pipeline images based on dynamic sparse constraints provided by the above embodiments, and can solve the same technical problems and achieve the same technical effects. Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the device described above can refer to the corresponding process in the foregoing method embodiments, which will not be described herein.
[0130] Embodiment 4 The embodiment provides an electronic device, including a processor and a memory, the memory stores computer executable instructions capable of being executed by the processor, and the processor executes the computer executable instructions to implement the steps of the method for intelligently classifying municipal pipeline images based on dynamic sparse constraints.
[0131] The embodiment provides a computer readable storage medium, wherein the computer readable storage medium stores a computer program, and the computer program is executed by a processor to implement steps of the municipal pipeline image intelligent classification method based on dynamic sparse constraint.
[0132] Referring to Figure 4 A structural diagram of an electronic device is shown, and the electronic device comprises a memory 41 and a processor 42. The memory 41 stores a computer program capable of running on the processor 42. When the processor executes the computer program, the steps provided by the municipal pipeline image intelligent classification method based on dynamic sparse constraint are implemented.
[0133] As Figure 4 The device further comprises a bus 43 and a communication interface 44. The processor 42, the communication interface 44 and the memory 41 are connected through the bus 43. The processor 42 is configured to execute an executable module stored in the memory 41, for example, a computer program.
[0134] The memory 41 can include a high-speed random access memory (RAM) and can also include a non-volatile memory such as at least one disk memory. The communication connection between the device network element and at least one other network element is realized through at least one communication interface 44 (which can be wired or wireless), and the Internet, a wide area network, a local area network, a metropolitan area network, etc. can be used.
[0135] The bus 43 can be an ISA bus, a PCI bus or an EISA bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For the convenience of representation, Figure 4 Only one bidirectional arrow is used in the figure, but it does not mean that there is only one bus or only one type of bus.
[0136] The memory 41 is configured to store a program, and the processor 42 is configured to execute the program after receiving an execution instruction. The method performed by the device for intelligently classifying municipal pipeline images based on dynamic sparse constraints according to any of the embodiments of the present application can be applied to the processor 42 or implemented by the processor 42. The processor 42 can be an integrated circuit chip with a signal processing capability. In the implementation process, each step of the above method can be completed by an integrated logic circuit of hardware in the processor 42 or an instruction in the form of software. The processor 42 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; or a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. Each method, step and logic block disclosed in the embodiments of the present application can be implemented or executed. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in combination with the embodiments of the present application can be directly embodied as a hardware decoding processor for execution, or a combination of hardware and software modules in the decoding processor for execution. The software module can be located in a random access memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register or other mature storage media in the art. The storage medium is located in the memory 41, and the processor 42 reads information in the memory 41 and combines the hardware to complete the steps of the above method.
[0137] Further, the embodiments of the present application also provide a machine readable storage medium, which stores machine executable instructions. When the machine executable instructions are called and executed by the processor 42, the machine executable instructions cause the processor 42 to implement the above method for intelligently classifying municipal pipeline images based on dynamic sparse constraints.
[0138] The electronic device and the computer readable storage medium provided by the embodiments of the present application have the same technical features, so they can also solve the same technical problems and achieve the same technical effects.
[0139] In addition, in the description of the embodiments of the present application, unless specifically defined and limited, the terms "mounting", "connection", "connecting" should be understood in a broad sense, for example, can be fixedly connected, can also be detachably connected, or integrally connected; can be mechanically connected, can also be electrically connected; can be directly connected, can also be indirectly connected through an intermediate medium, can be internal communication of two elements. For those skilled in the art, the specific meaning of the above terms in the present application can be understood according to the specific circumstances.
[0140] In the description of the present application, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer" and the like indicate the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present application and simplifying the description, and do not indicate or imply that the devices or elements referred to must have a particular orientation, be constructed and operated in a particular orientation, and therefore cannot be understood as a limitation on the present application. In addition, the terms "first", "second", "third" are only for the purpose of description, and cannot be understood as indicating or implying relative importance.
Claims
1. A municipal pipeline image intelligent classification method based on dynamic sparse constraint, characterized in that, The method comprises the following steps: acquiring an underground pipeline image; extracting image features of the underground pipeline image to obtain image features to be matched; calculating error values between the image features to be matched and each of a plurality of preset classification dictionaries according to the image features to be matched, the plurality of classification dictionaries, and terminal state feature coefficient vectors of the plurality of classification dictionaries, wherein the plurality of classification dictionaries are generated by the following steps: collecting original underground pipeline images with known pipeline defect types; and extracting image features of the original underground pipeline images to obtain original image features; generating the classification dictionaries and the terminal state coefficient vectors of the classification dictionaries according to the original image features based on a particle swarm algorithm; selecting a minimum error value from the error values; determining a defect type of the underground pipeline image according to a classification dictionary corresponding to the minimum error value.
2. The method of claim 1, wherein, The step of generating the classification dictionaries and the terminal state coefficient vectors of the classification dictionaries according to the original image features based on a particle swarm algorithm comprises the following steps: determining an atomic unit with a same number of columns as the original image features according to the original image features; constructing an initial dictionary database according to the atomic unit; calculating an intermediate state coefficient vector according to the original image features, the initial dictionary database, and a randomly generated initial coefficient vector based on a particle swarm algorithm, wherein the initial coefficient vector is a binary vector with a same dimension as the original image features; constructing the classification dictionaries and the terminal state coefficient vectors of the classification dictionaries according to the intermediate state coefficient vector and the initial dictionary database.
3. The method of claim 2, wherein, The step of calculating an intermediate state coefficient vector according to the original image features, the initial dictionary database, and a randomly generated initial coefficient vector based on a particle swarm algorithm comprises the following steps: Step A1: calculating a calculation result of a preset target function and an initial coefficient vector corresponding to the calculation result according to the original image features, the initial dictionary database, and the initial coefficient vector; The objective function is: o < L; Wherein, L is a preset coefficient degree, D is a dictionary database matrix corresponding to the initial dictionary database, F represents the calculation result, X is the original image feature, is the initial coefficient vector; Step A2: evaluating performance parameters of each sub-vector in the initial coefficient vector based on a preset fitness function to obtain a first updated initial coefficient vector corresponding to a minimum reconstruction error; Step A3: determining the intermediate state coefficient vector based on a historical optimal position of each particle in the first updated initial coefficient vector, a corresponding fitness value, and a position with a highest fitness in the updated initial coefficient vector.
4. The method of claim 3, wherein, The step of determining the intermediate state coefficient vector based on a historical optimal position of each particle in the first updated initial coefficient vector, a corresponding fitness value, and a position with a highest fitness in the updated initial coefficient vector comprises the following steps: Step A4: updating a particle with an individual optimal value and a particle with a global optimal value in the first updated initial coefficient vector to obtain a second updated initial coefficient vector; Step A5: generating a binary position corresponding to the second updated initial coefficient vector; Step A6: updating the binary position and a velocity of each particle in the second updated initial coefficient vector by a preset position updating formula and a preset velocity updating formula to obtain a third updated initial coefficient vector; and Step A7: determining the intermediate state coefficient vector based on a historical optimal position of each particle in the third updated initial coefficient vector, a corresponding fitness value, and a position with a highest fitness in the third updated initial coefficient vector. Step A7: replacing the initial coefficient vector with the third updated initial coefficient vector, repeating the steps A1 to A6 for a preset number of iterations until a value of the calculation result is minimum; and obtaining a sub-intermediate state coefficient vector corresponding to the calculation result with the minimum value.
5. The method of claim 4, wherein, The velocity update formula is expressed as follows: wherein w represents a preset inertia weight, c1 represents a preset first learning factor, c2 represents a preset second learning factor, r1 represents a preset first random number, and r2 represents a preset second random number, represents an individual optimal position in the second updated initial coefficient vector, represents a global optimal position in the second updated initial coefficient vector, represents a velocity of a particle in the second updated initial coefficient vector after being updated in dimension d at time t+1, represents a velocity of a particle in the second updated initial coefficient vector in dimension d at time t, represents a position of a particle in dimension d at time t.
6. The method of claim 4, wherein, The position update formula is expressed as follows: : represents the probability value mapped from the velocity to the interval (0,1) by the Sigmoid transformation function, represents the updated position of the i-th particle in the d-th dimension, taking values 0 or 1, rand() represents a random number in the interval [0,1), used to compare with the probability value to determine the update of the particle position.
7. The method of claim 4, wherein, According to the intermediate state coefficient vector and the initial dictionary database, the step of constructing the classification dictionary and the final state coefficient vector of the classification dictionary comprises: Step B1: constructing an error matrix according to the intermediate state coefficient vector and the initial dictionary database; Step B2: performing singular value decomposition on the error matrix to obtain an intermediate state dictionary database and an update coefficient vector; Step B3: calculating a Frobenius norm between the intermediate state dictionary database and the original image feature; Step B4: determining whether the Frobenius norm is less than a preset threshold; Step B5: when the Frobenius norm is greater than or equal to the preset threshold, repeating the steps A1 to A7 and the steps B1 to B5 until the Frobenius norm is less than the preset threshold, and determining the update coefficient vector and the intermediate state dictionary database corresponding to the Frobenius norm less than the preset threshold as the final state coefficient vector and the classification dictionary respectively.
8. The method of claim 1, wherein, The pipeline defect types include: no defect, leakage, rupture, fluctuation, misalignment, and defect level information corresponding to the no defect, the leakage, the rupture, the fluctuation, and the misalignment respectively.
9. A municipal pipeline image intelligent classification device based on dynamic sparse constraints, characterized in that, Comprise: The data acquisition module is used for acquiring an underground pipeline image; The determination module is used for extracting image features of the underground pipeline image to obtain image features to be matched; According to the image features to be matched, a plurality of preset classification dictionaries, and final state feature coefficient vectors of the plurality of classification dictionaries, an error value between the image features to be matched and each of the classification dictionaries is calculated; the plurality of classification dictionaries are generated by the following steps: collecting original underground pipeline images with known pipeline defect types; and extracting image features of the original underground pipeline images to obtain original image features; Based on a particle swarm algorithm, the classification dictionaries and the final state coefficient vectors of the classification dictionaries are generated according to the original image features; a minimum error value is selected from the error values; and a defect type of the underground pipeline image is determined according to a classification dictionary corresponding to the minimum error value.
10. An electronic device, comprising: The electronic device comprises a processor and a memory, the memory stores computer executable instructions capable of being executed by the processor, and the processor executes the computer executable instructions to implement the municipal pipeline image intelligent classification method based on dynamic sparse constraints in any one of claims 1 to 8.
Citation Information
Patent Citations
Image structure-based particle swarm optimization non-convex compressed sensing image reconstruction method
CN105354800A
Super-resolution image reconstruction method and apparatus based on classified dictionary database
US20170200258A1