[go: up one dir, main page]

CN120747646A - Pipeline image classification method and device and electronic equipment - Google Patents

Pipeline image classification method and device and electronic equipment

Info

Publication number
CN120747646A
CN120747646A CN202511222686.3A CN202511222686A CN120747646A CN 120747646 A CN120747646 A CN 120747646A CN 202511222686 A CN202511222686 A CN 202511222686A CN 120747646 A CN120747646 A CN 120747646A
Authority
CN
China
Prior art keywords
image
pipeline
dictionary database
vector
feature vector
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202511222686.3A
Other languages
Chinese (zh)
Other versions
CN120747646B (en
Inventor
魏俊
申屠华斌
王爱杰
王鸿臣
陈前虎
朱凯
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhejiang University of Technology ZJUT
PowerChina Huadong Engineering Corp Ltd
Harbin Institute of Technology Shenzhen
Original Assignee
Zhejiang University of Technology ZJUT
PowerChina Huadong Engineering Corp Ltd
Harbin Institute of Technology Shenzhen
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhejiang University of Technology ZJUT, PowerChina Huadong Engineering Corp Ltd, Harbin Institute of Technology Shenzhen filed Critical Zhejiang University of Technology ZJUT
Priority to CN202511222686.3A priority Critical patent/CN120747646B/en
Publication of CN120747646A publication Critical patent/CN120747646A/en
Application granted granted Critical
Publication of CN120747646B publication Critical patent/CN120747646B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Image Analysis (AREA)

Abstract

本发明提供了一种管道图像分类方法、装置及电子设备,包括:采集管道图像;提取管道图像的第一图像特征向量;根据第一图像特征向量、多个字典数据库以及多个字典数据库的终态稀疏向量,计算第一图像特征向量与多个字典数据库之间的误差值;从误差值中筛选最小误差值;根据最小误差值对应的目标字典数据库,确定管道图像的缺陷分类;字典数据库的构建方法包括:获取携带缺陷信息的原始管道图像;对原始管道图像进行特征提取,得到第二图像特征向量;根据第二图像特征向量,构建字典数据库以及字典数据库的终态稀疏向量。该方法通过对比管道图像特征与预构建的字典数据库,利用稀疏表示技术对管道图像缺陷分类,提高了管道检测的准确性和效率。

The present invention provides a pipeline image classification method, device, and electronic device, comprising: acquiring a pipeline image; extracting a first image feature vector of the pipeline image; calculating the error between the first image feature vector and the multiple dictionary databases based on the first image feature vector, multiple dictionary databases, and the final-state sparse vectors of the multiple dictionary databases; selecting the minimum error value from the error values; and determining the defect classification of the pipeline image based on the target dictionary database corresponding to the minimum error value. The dictionary database is constructed by: acquiring an original pipeline image carrying defect information; performing feature extraction on the original pipeline image to obtain a second image feature vector; and constructing the dictionary database and the final-state sparse vector of the dictionary database based on the second image feature vector. This method improves the accuracy and efficiency of pipeline inspection by comparing pipeline image features with a pre-constructed dictionary database and utilizing sparse representation technology to classify pipeline image defects.

Description

Pipeline image classification method and device and electronic equipment
Technical Field
The present invention relates to the field of image processing technologies, and in particular, to a method and an apparatus for classifying pipeline images, and an electronic device.
Background
At present, because the water body in the pipeline network conveying operation contains acidic or corrosive substances, functional or structural defects including cracking, leakage, deformation, corrosion, dislocation, intrusion, hidden connection of branch pipes, penetration of foreign matters, deposition, barriers and the like can occur in the drainage pipeline under long-term service operation, and the defects can cause damage to the pipeline to a continuous degree, so that the normal operation of the pipeline is influenced. Therefore, it is necessary to detect the pipeline, and television detection, pipeline periscope detection, sonar detection, manual observation, and the like are generally adopted. The method specifically comprises the step of judging the type of the defect of the identifier for the video shot in the pipeline so as to take a corresponding repairing mode.
Specifically, the method for classifying the pipeline image mainly comprises a support vector machine, a convolutional neural network, a particle swarm optimization algorithm and the like. Wherein the support vector machine only supports the two-classification problem, although it can be extended to the multi-classification problem, this increases the complexity of programming. The number of training samples of the convolutional neural network model can reach tens of thousands, the data processing capacity is high, the intelligent degree is high, and some defects still exist, such as various types of pipeline defects and complex pipeline environments, so that the automatic recognition accuracy of the drainage pipeline defects based on deep learning is low.
Generally, the existing pipeline image classification method has the current situation of high programming complexity and low accuracy.
Disclosure of Invention
The invention aims to provide a pipeline image classification method, a device and electronic equipment, so as to solve the technical problems of high programming complexity and low accuracy of the existing pipeline image classification method, reduce programming difficulty and increase classification accuracy.
The embodiment of the invention provides a pipeline image classification method, which comprises the steps of collecting pipeline images, extracting first image feature vectors of the pipeline images, calculating error values between the first image feature vectors and a plurality of dictionary databases according to the first image feature vectors, a plurality of preset dictionary databases and final sparse vectors of the plurality of dictionary databases, screening minimum error values from the error values, determining defect classifications of the pipeline images according to target dictionary databases corresponding to the minimum error values, and constructing the dictionary databases.
In a preferred embodiment of the present invention, the step of constructing the dictionary database and the final sparse vector of the dictionary database based on the second image feature vector includes determining an atomic unit having the same number of columns as the second image feature vector based on the second image feature vector, constructing an initial dictionary database based on the atomic unit, calculating an intermediate sparse vector based on the second image feature vector, the initial dictionary database, and the initial sparse vector randomly generated, wherein the initial sparse vector has the same dimension as the second image feature, and constructing the dictionary database and the final sparse vector based on the intermediate sparse vector and the initial dictionary database.
In a preferred embodiment of the present invention, the step of calculating the intermediate sparse vector according to the second image feature vector, the initial dictionary database, and the initial sparse vector generated randomly includes a step A1 of calculating a calculation result of a preset objective function and the intermediate sparse vector corresponding to the calculation result according to the second image feature vector, the initial dictionary database, and the initial sparse vector, wherein the objective function is:;|| I o < L, wherein L is a preset sparsity, D is a dictionary library matrix corresponding to the initial dictionary database, F represents the calculation result, X is the second image feature vector, The method comprises the steps of obtaining initial sparse vectors, evaluating performance parameters of each subset in the initial sparse vectors based on a preset defined fitness function, screening target subsets of the initial sparse vectors, wherein the performance parameters are larger than a preset parameter threshold, carrying out genetic operation on the target subsets to obtain sub-intermediate sparse vectors, repeatedly executing the step A1 to the step A4 to reach preset iteration times until the value of the calculated result is minimum, and determining sub-intermediate sparse vectors corresponding to the calculated result with the minimum value as the intermediate sparse vectors in the step A6.
In a preferred embodiment of the present invention, the genetic manipulation includes crossing, mutating and replacing the target subset.
In a preferred embodiment of the present invention, the step of constructing the dictionary database and the final state sparse vector from the intermediate state sparse vector and the initial dictionary database includes the step of constructing an error matrix from the intermediate state sparse vector and the initial dictionary database, the step of performing singular value decomposition on the error matrix to obtain an intermediate state dictionary database and an updated sparse vector, the step of calculating a Froude Luo Beini Usta number between the intermediate state dictionary database and the second image feature vector, the step of determining whether the Froude Luo Beini Usta number is smaller than a predetermined threshold, the step of determining that the Froude Luo Beini Usta number is larger than or equal to the predetermined threshold, and the step of repeating the step A1 to the step A6 and the step B1 to the step B5 until the Froude Luo Beini Usta number is smaller than the predetermined threshold, and the step of updating the intermediate state dictionary database and the final state dictionary database by Luo Beini Usta number smaller than the predetermined threshold are determined as the intermediate state sparse vector and the final state sparse vector, respectively.
In a preferred embodiment of the present invention, the step of extracting the first image feature vector of the pipeline image includes extracting color features and texture features of the pipeline image, and determining the first image feature vector according to the color features and the texture features.
In a preferred embodiment of the present invention, the step of extracting the color features of the pipeline image includes extracting the color features of the pipeline image through a color channel and a luminance model constructed by the color channel, and the step of extracting the texture features of the pipeline image includes converting the pipeline image into a gray scale image, calculating a gray scale co-occurrence matrix in a preset direction according to the gray scale image, and calculating a Haralick texture feature corresponding to each direction according to the gray scale co-occurrence matrix.
In a preferred embodiment of the present invention, the defect information includes defect-free, leak, crack, undulation, and dislocation, and defect level information corresponding to the defect-free, leak, crack, undulation, and dislocation, respectively.
The embodiment of the invention also provides a pipeline image classification device which comprises a data acquisition module, a type determination module, a calculation module, a screening module and a construction method, wherein the data acquisition module is used for acquiring pipeline images, the type determination module is used for extracting first image feature vectors of the pipeline images, calculating error values between the first image feature vectors and the dictionary databases according to the first image feature vectors, a plurality of preset dictionary databases and final sparse vectors of the dictionary databases, screening minimum error values from the error values, determining defect classification of the pipeline images according to target dictionary databases corresponding to the minimum error values, the construction method of the dictionary databases comprises the steps of acquiring original pipeline images carrying defect information, extracting features of the original pipeline images to obtain second image feature vectors, and constructing the dictionary databases and final sparse vectors of the dictionary databases according to the second image feature vectors.
In a third aspect, an embodiment of the present invention further provides an electronic device, where the electronic device includes a processor and a memory, where the memory stores computer executable instructions that can be executed by the processor, and where the processor executes the computer executable instructions to implement the pipeline image classification method.
The embodiment of the invention has the following beneficial technical effects:
The embodiment of the invention provides a pipeline image classification method, a device and electronic equipment, which comprise the steps of collecting pipeline images, extracting first image feature vectors of the pipeline images, calculating error values between the first image feature vectors and a plurality of dictionary databases according to the first image feature vectors, a plurality of preset dictionary databases and final sparse vectors of the plurality of dictionary databases, screening minimum error values from the error values, determining defect classifications of the pipeline images according to target dictionary databases corresponding to the minimum error values, and constructing the dictionary databases. According to the method, the pipeline image characteristics are compared with the pre-constructed dictionary database, and the pipeline image defects are accurately classified by using a sparse representation technology, so that the accuracy and the efficiency of pipeline detection are improved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings that are needed in the description of the embodiments or the prior art will be briefly described, and it is obvious that the drawings in the description below are some embodiments of the present invention, and other drawings can be obtained according to the drawings without inventive effort for a person skilled in the art.
Fig. 1 is a schematic flow chart of a pipeline image classification method according to an embodiment of the present invention;
FIG. 2 is a schematic flow chart of constructing a dictionary database and final sparse vectors of the dictionary database according to an embodiment of the present invention;
Fig. 3 is a schematic structural diagram of a pipeline image classification device according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
The icons are 31-data acquisition module, 32-type determination module, 41-memory, 42-processor, 43-bus, 44-communication interface.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present invention more apparent, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention, and it is apparent that the described embodiments are some embodiments of the present invention, but not all embodiments of the present invention. The components of the embodiments of the present invention generally described and illustrated in the figures herein may be arranged and designed in a wide variety of different configurations.
Because the water body conveyed by the pipe network contains acidic or corrosive substances, the long-term service causes the inside of the drainage pipe to have various functional or structural defects such as cracking, leakage, deformation, corrosion and the like, and the normal operation of the drainage pipe is seriously influenced. In order to detect the defects, methods such as television detection, pipeline periscope detection, sonar detection, manual observation and the like are generally adopted, and the type of the defects is identified by judging and reading the video in the pipeline so as to take repair measures. The existing pipeline image classification method mainly comprises a support vector machine, a convolutional neural network, a particle swarm optimization algorithm and the like, but the support vector machine is complex in programming and difficult to expand to the problem of multi-classification, and the convolutional neural network has the problems of low automatic recognition accuracy rate, high programming complexity and low accuracy rate due to various pipeline defects and complex environment despite of high data processing capacity.
Based on this, the embodiment of the invention provides a pipeline image classification method, a device and electronic equipment, wherein the method compares pipeline image characteristics with a pre-constructed dictionary database, the sparse representation technology is utilized to realize the accurate classification of the pipeline image defects, so that the accuracy and the efficiency of pipeline detection are improved. For ease of understanding, a pipeline image classification method is first described.
Example 1
In this embodiment, fig. 1 is a schematic flow chart of a pipeline image classification method according to an embodiment of the present invention.
As seen in fig. 1, the method comprises:
And S101, collecting pipeline images.
And S102, extracting a first image feature vector of the pipeline image.
In actual operation, the step S102 includes extracting color features and texture features of the pipeline image, and determining the first image feature vector according to the color features and the texture features.
Further, the step of extracting the color features of the pipeline image comprises the steps of extracting the color features of the pipeline image through a color channel and a brightness model constructed by the color channel, and the step of extracting the texture features of the pipeline image comprises the steps of converting the pipeline image into a gray image, calculating a gray level co-occurrence matrix in a preset direction according to the gray level image, and calculating Harfull texture features corresponding to each direction according to the gray level co-occurrence matrix.
Specifically, the luminance model is i=0.21r+0.72g+0.07 b, and the luminance model is a weighted average of RGB channels.
Wherein I is a brightness model, R is a red channel, G is a green channel, and B is a blue channel.
Then, the first-order histogram of the image block of the pipeline image is subjected to pixel feature extraction, and the pixel feature extraction is calculated as follows:
wherein the pixel characteristics are represented by a first-order histogram:
{P(Ik);k=1,2,...,N}
Wherein I k is the luminance model of the kth image block, and the total number of image blocks is N.
From each first order histogram, 3 different features were obtained:
;
;
;
Wherein, the As an average value of the values,As a function of the variance of the values,Kurtosis.
Thus, 12 color feature values can be obtained based on the pipeline image.
Further, the present invention generates GLCM at 0, 45 and 90 from the following 3 angles.
The GLCM of the two pixel intensity values In the pipeline image at a distance d and a direction phi is defined as P (Im, in, d, phi), indicating the probability of occurrence of a pixel pair of pixel intensity values Im and In at a distance d and an angle phi.
Wherein N is the number of pixel intensity values;
im and In, two different gray levels of the gray level image;
d, distance between pixel pairs;
Phi is the direction angle between the pixel pairs;
5 Haralick texture features were obtained from GLCM, including:
;
;
;
;
;
Where ASM is angular second moment, CON is contrast, IDF is inverse differential moment, corr is correlation, var is variance of random variable.
GLCM is calculated for 3 different angles θ, namely 0 °, 45 ° and 90 °, and is generated when two pixel intensity values (Im, in) are at 3 distance values d=1, 2 and 3.
Thus, 9 gray co-occurrence matrices are generated for each image block. Further, 5 texture features are calculated from each gray level co-occurrence matrix, resulting in 45 texture feature vectors, denoted WT.
Further, 12 color features and 45 texture features, cumulatively form 57 image feature vectors denoted as X,. Thus, the total number of entries of the first image feature vector of one image block is 57.
Step S103, calculating error values between the first image feature vector and the dictionary databases according to the first image feature vector, the preset dictionary databases and final sparse vectors of the dictionary databases.
Step S104, screening the minimum error value from the error values.
Step 105, determining defect classification of the pipeline image according to a target dictionary database corresponding to the minimum error value, wherein the dictionary database construction method comprises the steps of obtaining an original pipeline image carrying defect information, carrying out feature extraction on the original pipeline image to obtain a second image feature vector, and constructing the dictionary database and final sparse vectors of the dictionary database according to the second image feature vector.
Wherein the defect information includes defect grade information corresponding to defect-free, leak, crack, undulation, dislocation, defect-free, leak, crack, undulation, and dislocation.
For easy understanding, the present application is described in detail by the following practical examples:
Assume that the plurality of dictionary databases are data in the following table one:
first, by inputting the first image feature vector, the error between the first image feature vector and each dictionary database is calculated respectively:
Wherein Error is Error, Y is first image feature vector, D is dictionary database, and a is final sparse vector of dictionary database.
Then, analyzing and comparing the error values, wherein the defect type corresponding to the minimum error value is the defect classification of the pipeline image:
As shown in the following table two, when the input first image feature vector is Y1, the correspondence error is 0.1, and the defect of the output pipeline image is classified as leakage.
Watch II
The embodiment of the invention provides a pipeline image classification method which comprises the steps of collecting pipeline images, extracting first image feature vectors of the pipeline images, calculating error values between the first image feature vectors and a plurality of dictionary databases according to the first image feature vectors, a plurality of preset dictionary databases and final sparse vectors of the plurality of dictionary databases, screening minimum error values from the error values, determining defect classifications of the pipeline images according to target dictionary databases corresponding to the minimum error values, and constructing the dictionary databases. According to the method, the pipeline image characteristics are compared with the pre-constructed dictionary database, and the pipeline image defects are accurately classified by using a sparse representation technology, so that the accuracy and the efficiency of pipeline detection are improved.
Example 2
In this embodiment, a process of constructing a dictionary database and final sparse vectors of the dictionary database is described with emphasis. Fig. 2 is a schematic flow chart of constructing a dictionary database and final sparse vectors of the dictionary database according to an embodiment of the present invention.
As seen in fig. 2, the method comprises:
step S201, according to the second image feature vector, determining the atomic units with the same column number as the second image feature vector.
To ensure that the number of atomic units in the dictionary matches the number of columns of the second image feature vector, it is first necessary to understand the specific structure of the second image feature vector. The second image feature vector is assumed to be a C-dimensional vector, i.e. it has C columns, each column representing a specific feature (e.g. texture, color or shape, etc.) in the image. Next, a dictionary containing C atomic units needs to be built for this C-dimensional vector. Each atomic unit may be considered as a fundamental mode describing local or global features of an image. During the initialization phase, the C atomic units may be created by random generation or based on a priori knowledge. These atomic units will be used as basic elements of the dictionary to represent and reconstruct image features. In the optimization process, the atomic units are continuously adjusted to fit each column of eigenvalues in the second image eigenvector as much as possible. Eventually, each atomic unit will be able to capture an important aspect of the image feature vector, enabling the entire dictionary to efficiently and accurately represent complex features of the image. In short, the same atomic unit as the number of columns of the feature vectors of the second image is determined to ensure that the number of bases of the dictionary is consistent with the feature vector dimensions, so that the image features can be effectively modeled and compressed in the subsequent sparse representation and optimization process. This not only improves the accuracy of the feature representation, but also enhances the overall performance of the model.
Step S202, constructing an initial dictionary database according to the atomic units.
Here, based on the determined C atomic units, an initial dictionary database containing the atomic units is initialized for subsequent feature representation and optimization processes.
And step 203, calculating an intermediate sparse vector according to the second image feature vector, the initial dictionary database and the initial sparse vector generated randomly, wherein the initial sparse vector and the second image feature have the same dimension.
And S204, constructing the dictionary database and the final sparse vector according to the intermediate sparse vector and the initial dictionary database.
In actual operation, the step of calculating the intermediate sparse vector according to the second image feature vector, the initial dictionary database and the initial sparse vector generated randomly comprises the following steps:
And A1, calculating a calculation result of a preset objective function and the intermediate sparse vector corresponding to the calculation result according to the second image feature vector, the initial dictionary database and the initial sparse vector.
The objective function is as follows:;||||o<L;
Wherein L is a preset sparsity, D is a dictionary library matrix corresponding to the initial dictionary database, F represents the calculation result, X is the second image feature vector, Is the initial sparse vector described above.
And A2, evaluating the performance parameters of each subset in the initial sparse vector based on a preset defined fitness function.
And A3, screening a target subset of the initial sparse vector, wherein the performance parameter of the target subset is larger than a preset parameter threshold.
A4, carrying out genetic operation on the target subset to obtain a sub-intermediate sparse vector;
and step A5, repeatedly executing the step A1 to the step A4 to reach the preset iteration times until the value of the obtained calculation result is minimum.
And A6, determining the sub-intermediate sparse vector corresponding to the calculation result with the minimum value as the intermediate sparse vector.
Further, the genetic manipulation may include crossing, mutating, and replacing the subset of targets.
In some embodiments, the step of constructing the dictionary database and the final state sparse vector from the intermediate state sparse vector and the initial dictionary database includes the step of constructing an error matrix from the intermediate state sparse vector and the initial dictionary database, the step of performing singular value decomposition on the error matrix to obtain an intermediate state dictionary database and an updated sparse vector, the step of calculating a Froude Luo Beini Usta norm between the intermediate state dictionary database and the second image feature vector, the step of determining whether the Froude Luo Beini Usta norm is smaller than a preset threshold, the step of determining that the Froude Luo Beini Usta norm is larger than or equal to the preset threshold, the step of repeating the step of A1 to the step of A6 and the step of B5 until the Froude Luo Beini Usta norm is smaller than the preset threshold, and determining the update vector and the intermediate state dictionary vector corresponding to the Froude Usta norm smaller than the preset threshold as the final state sparse vector and the dictionary database respectively.
The error matrix is constructed according to the intermediate sparse vector and the initial dictionary database based on the following formula:
where Ek is an error matrix, dk is an atomic unit, Ω k is an index set using all signals of the atomic unit, xΩ k is a subset composed of all signals using the atomic unit, dΩ k is a subset composed of atomic units corresponding to the index in Ω k, and αΩ k is a sparse coefficient subset corresponding to the intermediate sparse vector.
Further, singular value decomposition is performed on the error matrix based on the following formula, so as to obtain an intermediate state dictionary database and update sparse vectors:
wherein U, S and V are matrices after singular value decomposition of the error matrix, respectively.
Taking the first column of U as a new atomic unit, and taking the product of the first element of S and the first column of V as an updated sparse vector.
The invention adopts the following practical cases to explain the steps in detail:
Assume that the second image feature vector is Each column represents a set of feature vectors;
The initial dictionary database is Each column represents an atomic unit;
knowing a first set of eigenvectors x1= [1,4,7] t;
x1≈Dα1
the genetic algorithm can be obtained:
Then it is possible to obtain:
the same can be obtained:
Then it is possible to obtain:
Wherein, the Is a subset of the intermediate sparse vector.
The atomic units of the initial dictionary database are used by all signals, so the following calculations are performed:
Next, the initial dictionary database is updated. Knowing d1= [1,0,1] t, an error matrix E1 is constructed:
singular value decomposition of E1 is performed to obtain the following results:
Thus, an updated atomic unit can be obtained, which is represented as I.e.. Meanwhile, the updated sparse vector αΩ k may be obtained by multiplying Σ (1, 1) by the 1 st column of the V matrix, i.e.
Repeating the above operation until the objective function is obtained to obtain the minimum value.
Then, an error of the intermediate dictionary database is calculated, the error of the intermediate dictionary database being obtained by calculating a Fries Luo Beini Usness norm between the second image feature vector and the initial dictionary database and the intermediate dictionary database. The error calculation formula is as follows:
Error=||X−Da||F;
the Fu Luo Beini Usnea norm is calculated according to the following specific calculation formula:
wherein m and n are the number of rows and columns of the second image feature vector, respectively, Is the element of the ith row and jth column in the second image feature vector,Is the element of the ith row and jth column in the intermediate dictionary database.
Further, if the Fructo-Luo Beini Usta norm is smaller than a preset threshold epsilon, the dictionary database is considered to be converged, otherwise, the intermediate state dictionary database needs to be updated continuously.
The embodiment of the invention provides a dictionary database and a final sparse vector constructing method of the dictionary database, which comprises the steps of determining atomic units with the same column number as the second image feature vector according to the second image feature vector, constructing an initial dictionary database according to the atomic units, calculating an intermediate sparse vector according to the second image feature vector, the initial dictionary database and the initial sparse vector randomly generated, wherein the dimension of the initial sparse vector is the same as that of the second image feature, and constructing the dictionary database and the final sparse vector according to the intermediate sparse vector and the initial dictionary database. According to the method, the initial dictionary database is constructed based on the second image feature vector, and the sparse vector is optimized in an iterative mode, so that efficient and accurate representation of pipeline image features is achieved, and accuracy and reliability of pipeline defect classification are improved.
Example 3
On the basis of the above embodiment, fig. 3 is a schematic structural diagram of a pipeline image classification device according to an embodiment of the present invention.
As can be seen in fig. 3, the device comprises:
a data acquisition module 31 for acquiring a pipeline image.
The type determining module 32 is configured to extract a first image feature vector of the pipeline image, calculate error values between the first image feature vector and the dictionary databases according to the first image feature vector, a preset plurality of dictionary databases and final sparse vectors of the dictionary databases, screen minimum error values from the error values, determine defect classification of the pipeline image according to a target dictionary database corresponding to the minimum error values, and construct the dictionary databases.
Wherein the data acquisition module 31 is connected to the type determination module 32.
In one embodiment, the device further comprises a dictionary construction module connected with the type determination module 32, wherein the dictionary construction module is further used for determining atomic units with the same column number as the second image feature vector according to the second image feature vector, constructing an initial dictionary database according to the atomic units, calculating an intermediate sparse vector according to the second image feature vector, the initial dictionary database and an initial sparse vector generated randomly, wherein the initial sparse vector is identical to the second image feature in dimension, and constructing the dictionary database and the final sparse vector according to the intermediate sparse vector and the initial dictionary database.
In one embodiment, the dictionary construction module is further configured to execute step A1, wherein the calculating result of a preset objective function and the intermediate sparse vector corresponding to the calculating result are calculated according to the second image feature vector, the initial dictionary database and the initial sparse vector, and the objective function is:;|| I o < L, wherein L is a preset sparsity, D is a dictionary library matrix corresponding to the initial dictionary database, F represents the calculation result, X is the second image feature vector, The method comprises the steps of obtaining initial sparse vectors, evaluating performance parameters of each subset in the initial sparse vectors based on a preset defined fitness function, screening target subsets of the initial sparse vectors, wherein the performance parameters are larger than a preset parameter threshold, carrying out genetic operation on the target subsets to obtain sub-intermediate sparse vectors, repeatedly executing the step A1 to the step A4 to reach preset iteration times until the value of the calculated result is minimum, and determining sub-intermediate sparse vectors corresponding to the calculated result with the minimum value as the intermediate sparse vectors in the step A6.
In one embodiment, the dictionary construction module is further configured to perform step B1 of constructing an error matrix according to the intermediate state sparse vector and the initial dictionary database, step B2 of performing singular value decomposition on the error matrix to obtain an intermediate state dictionary database and an updated sparse vector, step B3 of calculating a freckles Luo Beini uz norm between the intermediate state dictionary database and the second image feature vector, step B4 of determining whether the freckles Luo Beini uz norm is smaller than a preset threshold, and step B5 of repeating step A1 to step A6 and step B5 until the freckles Luo Beini uz norm is smaller than the preset threshold when the freckles Luo Beini uz norm is greater than or equal to the preset threshold, and determining the updated vector corresponding to the freckles Luo Beini uz norm smaller than the preset threshold and the intermediate state dictionary database as the final state sparse vector and the dictionary database, respectively.
In one embodiment, the type determining module 32 is further configured to extract color features and texture features of the pipeline image, and determine the first image feature vector according to the color features and the texture features.
In one embodiment, the type determining module 32 is further configured to extract color features of the pipeline image through a color channel and a brightness model constructed by the color channel, and the step of extracting texture features of the pipeline image includes converting the pipeline image into a gray scale image, calculating a gray scale co-occurrence matrix in a preset direction according to the gray scale image, and calculating a hargood texture feature corresponding to each direction according to the gray scale co-occurrence matrix.
The pipeline image classification device provided by the embodiment of the invention has the same technical characteristics as the pipeline image classification method provided by the embodiment, so that the same technical problems can be solved, and the same technical effects can be achieved. It will be clear to those skilled in the art that, for convenience and brevity of description, reference may be made to the corresponding process in the foregoing method embodiment for the specific working process of the apparatus described above, which is not described herein again.
Example 4
The present embodiment provides an electronic device comprising a processor and a memory storing computer executable instructions executable by the processor to perform steps of a pipeline image classification method.
The present embodiment provides a computer-readable storage medium in which a computer program is stored which, when executed by a processor, implements the steps of a pipeline image classification method.
Referring to a schematic structural diagram of an electronic device shown in fig. 4, the electronic device includes a memory 41 and a processor 42, wherein a computer program capable of running on the processor 42 is stored in the memory 41, and the processor implements the steps provided by the pipeline image classification method when executing the computer program.
As shown in fig. 4, the device further comprises a bus 43 and a communication interface 44, the processor 42, the communication interface 44 and the memory 41 being connected by the bus 43, the processor 42 being arranged to execute executable modules, such as computer programs, stored in the memory 41.
The memory 41 may include a high-speed random access memory (RAM, random Access Memory), and may further include a non-volatile memory (non-volatile memory), such as at least one magnetic disk memory. The communication connection between the device network element and at least one other network element is achieved through at least one communication interface 44 (which may be wired or wireless), which may use the internet, a wide area network, a local network, a metropolitan area network, etc.
The bus 43 may be an ISA bus, a PCI bus, an EISA bus, or the like. The buses may be divided into address buses, data buses, control buses, etc. For ease of illustration, only one bi-directional arrow is shown in FIG. 4, but not only one bus or type of bus.
The memory 41 is used for storing a program, and the processor 42 executes the program after receiving the execution instruction, so that the method executed by the pipeline image classification device according to any of the embodiments of the present invention can be applied to the processor 42 or implemented by the processor 42. The processor 42 may be an integrated circuit chip having signal processing capabilities. In implementation, the steps of the above method may be performed by integrated logic circuitry in hardware or instructions in software in the processor 42. The processor 42 may be a general-purpose processor including a central Processing unit (Central Processing Unit, CPU), a network processor (Network Processor, NP), a digital signal processor (DIGITAL SIGNAL Processing, DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable GATE ARRAY (FPGA), a discrete gate or transistor logic device, or a discrete hardware component. The disclosed methods, steps, and logic blocks in the embodiments of the present invention may be implemented or performed. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of the method disclosed in connection with the embodiments of the present invention may be embodied directly in the execution of a hardware decoding processor, or in the execution of a combination of hardware and software modules in a decoding processor. The software modules may be located in a random access memory, flash memory, read only memory, programmable read only memory, or electrically erasable programmable memory, registers, etc. as well known in the art. The storage medium is located in a memory 41 and a processor 42 reads information in the memory 41 and in combination with its hardware performs the steps of the method described above.
Further, embodiments of the present invention also provide a machine-readable storage medium storing machine-executable instructions that, when invoked and executed by the processor 42, cause the processor 42 to implement the pipeline image classification method described above.
The electronic equipment and the computer readable storage medium provided by the embodiment of the invention have the same technical characteristics, so that the same technical problems can be solved, and the same technical effects can be achieved.
In addition, in the description of embodiments of the present invention, unless explicitly stated and limited otherwise, the terms "mounted," "connected," and "connected" are to be construed broadly, and may be, for example, fixedly connected, detachably connected, or integrally connected, mechanically connected, electrically connected, directly connected, indirectly connected via an intermediate medium, or in communication between two elements. The specific meaning of the above terms in the present invention will be understood in specific cases by those of ordinary skill in the art.
In the description of the present invention, it should be noted that the directions or positional relationships indicated by the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc. are based on the directions or positional relationships shown in the drawings, are merely for convenience of describing the present invention and simplifying the description, and do not indicate or imply that the devices or elements referred to must have a specific orientation, be configured and operated in a specific orientation, and thus should not be construed as limiting the present invention. Furthermore, the terms "first," "second," and "third" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance.

Claims (10)

1.一种管道图像分类方法,其特征在于,包括:1. A pipeline image classification method, comprising: 采集管道图像;Collect pipeline images; 提取所述管道图像的第一图像特征向量;extracting a first image feature vector of the pipeline image; 根据所述第一图像特征向量、预设的多个字典数据库以及所述多个字典数据库的终态稀疏向量,计算所述第一图像特征向量与所述多个字典数据库之间的误差值;Calculating error values between the first image feature vector and the plurality of dictionary databases according to the first image feature vector, a plurality of preset dictionary databases, and final-state sparse vectors of the plurality of dictionary databases; 从所述误差值中筛选最小误差值;Selecting a minimum error value from the error values; 根据所述最小误差值对应的目标字典数据库,确定所述管道图像的缺陷分类;所述字典数据库的构建方法包括:获取携带缺陷信息的原始管道图像;对所述原始管道图像进行特征提取,得到第二图像特征向量;根据所述第二图像特征向量,构建所述字典数据库以及所述字典数据库的终态稀疏向量。Determining the defect classification of the pipeline image based on a target dictionary database corresponding to the minimum error value; a method for constructing the dictionary database includes: obtaining an original pipeline image carrying defect information; performing feature extraction on the original pipeline image to obtain a second image feature vector; and constructing the dictionary database and a final-state sparse vector of the dictionary database based on the second image feature vector. 2.根据权利要求1所述的管道图像分类方法,其特征在于,根据所述第二图像特征向量,构建所述字典数据库以及所述字典数据库的终态稀疏向量的步骤,包括:2. The pipeline image classification method according to claim 1, wherein the step of constructing the dictionary database and the final sparse vector of the dictionary database based on the second image feature vector comprises: 根据所述第二图像特征向量,确定与所述第二图像特征向量的列数相同的原子单元;determining, according to the second image feature vector, an atomic unit having the same number of columns as the second image feature vector; 根据所述原子单元,构建初始字典数据库;constructing an initial dictionary database based on the atomic units; 根据所述第二图像特征向量、所述初始字典数据库以及与随机生成的初始稀疏向量,计算中间态稀疏向量;所述初始稀疏向量与所述第二图像特征的维度相同;Calculating an intermediate sparse vector based on the second image feature vector, the initial dictionary database, and a randomly generated initial sparse vector; the initial sparse vector has the same dimension as the second image feature; 根据所述中间态稀疏向量以及所述初始字典数据库,构建所述字典数据库以及所述终态稀疏向量。The dictionary database and the final-state sparse vector are constructed according to the intermediate-state sparse vector and the initial dictionary database. 3.根据权利要求2所述的管道图像分类方法,其特征在于,根据所述第二图像特征向量、所述初始字典数据库以及与随机生成的初始稀疏向量,计算中间态稀疏向量的步骤,包括:3. The pipeline image classification method according to claim 2, wherein the step of calculating the intermediate sparse vector based on the second image feature vector, the initial dictionary database, and the randomly generated initial sparse vector comprises: 步骤A1:根据所述第二图像特征向量、所述初始字典数据库以及所述初始稀疏向量,计算预设的目标函数的计算结果以及所述计算结果对应的所述中间态稀疏向量;Step A1: calculating a calculation result of a preset objective function and the intermediate sparse vector corresponding to the calculation result according to the second image feature vector, the initial dictionary database, and the initial sparse vector; 所述目标函数为:;||||o<L;The objective function is: ;|| || o <L; 其中,L为预设的稀疏度,D为所述初始字典数据库对应的字典库矩阵,F表示所述计算结果,X为所述第二图像特征向量,为所述初始稀疏向量;Wherein, L is the preset sparsity, D is the dictionary library matrix corresponding to the initial dictionary database, F represents the calculation result, X is the second image feature vector, is the initial sparse vector; 步骤A2:基于预设的定义适应度函数评估所述初始稀疏向量中每个子集的性能参数;Step A2: evaluating the performance parameters of each subset in the initial sparse vector based on a preset defined fitness function; 步骤A3:筛选所述初始稀疏向量中所述性能参数大于预设参数阈值的目标子集;Step A3: screening the target subset in the initial sparse vector whose performance parameter is greater than a preset parameter threshold; 步骤A4:对所述目标子集进行遗传操作,得到子中间态稀疏向量;Step A4: performing genetic operations on the target subset to obtain a sub-intermediate state sparse vector; 步骤A5:重复执行所述步骤A1至所述步骤A4达到预设的迭代次数,直到得到所述计算结果的值最小;Step A5: Repeating steps A1 to A4 for a preset number of iterations until the value of the calculation result is minimized; 步骤A6:将所述值最小的所述计算结果对应的子中间态稀疏向量,确定为所述中间态稀疏向量。Step A6: Determine the sub-intermediate state sparse vector corresponding to the calculation result with the smallest value as the intermediate state sparse vector. 4.根据权利要求3所述的管道图像分类方法,其特征在于,所述遗传操作包括:对所述目标子集进行交叉、变异以及替换操作。4. The pipeline image classification method according to claim 3, wherein the genetic operation comprises: performing crossover, mutation, and replacement operations on the target subset. 5.根据权利要求3所述的管道图像分类方法,其特征在于,根据所述中间态稀疏向量以及所述初始字典数据库,构建所述字典数据库以及所述终态稀疏向量的步骤,包括:5. The pipeline image classification method according to claim 3, wherein the step of constructing the dictionary database and the final sparse vector according to the intermediate sparse vector and the initial dictionary database comprises: 步骤B1:根据所述中间态稀疏向量以及所述初始字典数据库,构建误差矩阵;Step B1: constructing an error matrix according to the intermediate state sparse vector and the initial dictionary database; 步骤B2:对所述误差矩阵进行奇异值分解,得到中间态字典数据库以及更新稀疏向量;Step B2: performing singular value decomposition on the error matrix to obtain an intermediate state dictionary database and update the sparse vector; 步骤B3:计算所述中间态字典数据库以及所述第二图像特征向量之间的弗罗贝尼乌斯范数;Step B3: calculating the Frobenius norm between the intermediate dictionary database and the second image feature vector; 步骤B4:判断所述弗罗贝尼乌斯范数是否小于预设阈值;Step B4: determining whether the Frobenius norm is less than a preset threshold; 步骤B5:当所述弗罗贝尼乌斯范数大于或等于预设阈值时,重复所述步骤A1至所述步骤A6以及所述步骤B1至所述步骤B5,直到所述弗罗贝尼乌斯范数小于所述预设阈值,将小于所述预设阈值的所述弗罗贝尼乌斯范数对应的更新稀疏向量以及中间态字典数据库,分别确定为所述终态稀疏向量以及所述字典数据库。Step B5: When the Frobenius norm is greater than or equal to a preset threshold, repeat steps A1 to A6 and steps B1 to B5 until the Frobenius norm is less than the preset threshold, and determine the updated sparse vector and the intermediate-state dictionary database corresponding to the Frobenius norm that is less than the preset threshold as the final-state sparse vector and the dictionary database, respectively. 6.根据权利要求1所述的管道图像分类方法,其特征在于,提取所述管道图像的第一图像特征向量的步骤,包括:6. The pipeline image classification method according to claim 1, wherein the step of extracting the first image feature vector of the pipeline image comprises: 提取所述管道图像的颜色特征以及纹理特征;Extracting color features and texture features of the pipeline image; 根据所述颜色特征以及所述纹理特征,确定所述第一图像特征向量。The first image feature vector is determined according to the color feature and the texture feature. 7.根据权利要求2所述的管道图像分类方法,其特征在于,提取所述管道图像的颜色特征的步骤,包括:7. The pipeline image classification method according to claim 2, wherein the step of extracting color features of the pipeline image comprises: 通过色彩通道以及由所述色彩通道构建的亮度模型,提取所述管道图像的颜色特征;Extracting color features of the pipeline image through color channels and a brightness model constructed by the color channels; 提取所述管道图像的纹理特征的步骤,包括:The step of extracting texture features of the pipeline image comprises: 将所述管道图像转化为灰度图像;converting the pipeline image into a grayscale image; 根据所述灰度图像,计算预设方向的灰度共生矩阵;Calculating a gray level co-occurrence matrix in a preset direction according to the gray level image; 根据所述灰度共生矩阵,计算每个所述方向对应的Haralick纹理特征。The Haralick texture feature corresponding to each of the directions is calculated according to the gray level co-occurrence matrix. 8.根据权利要求1所述的管道图像分类方法,其特征在于,所述缺陷信息包括:无缺陷、渗漏、破裂、起伏、错口以及所述无缺陷、所述渗漏、所述破裂、所述起伏、所述错口分别对应的缺陷等级信息。8. The pipeline image classification method according to claim 1 is characterized in that the defect information includes: no defect, leakage, rupture, undulation, misalignment and the defect level information corresponding to the no defect, leakage, rupture, undulation and misalignment respectively. 9.一种管道图像分类装置,其特征在于,包括:9. A pipeline image classification device, comprising: 数据获取模块,用于采集管道图像;A data acquisition module, used for collecting pipeline images; 类型确定模块,用于提取所述管道图像的第一图像特征向量;根据所述第一图像特征向量、预设的多个字典数据库以及所述多个字典数据库的终态稀疏向量,计算所述第一图像特征向量与所述多个字典数据库的之间的误差值;从所述误差值中筛选最小误差值;根据所述最小误差值对应的目标字典数据库,确定所述管道图像的缺陷分类;所述字典数据库的构建方法包括:获取携带缺陷信息的原始管道图像;对所述原始管道图像进行特征提取,得到第二图像特征向量;根据所述第二图像特征向量,构建所述字典数据库以及所述字典数据库的终态稀疏向量。A type determination module is configured to extract a first image feature vector from the pipeline image; calculate an error value between the first image feature vector and the plurality of dictionary databases based on the first image feature vector, a plurality of preset dictionary databases, and the final-state sparse vectors of the plurality of dictionary databases; select a minimum error value from the error values; and determine a defect classification for the pipeline image based on a target dictionary database corresponding to the minimum error value. A method for constructing the dictionary database includes: obtaining an original pipeline image carrying defect information; performing feature extraction on the original pipeline image to obtain a second image feature vector; and constructing the dictionary database and the final-state sparse vector of the dictionary database based on the second image feature vector. 10.一种电子设备,其特征在于,所述电子设备包括处理器和存储器,所述存储器存储有能够被所述处理器执行的计算机可执行指令,所述处理器执行所述计算机可执行指令以实现权利要求1至8任一项所述的管道图像分类方法。10. An electronic device, characterized in that the electronic device comprises a processor and a memory, the memory storing computer-executable instructions that can be executed by the processor, and the processor executing the computer-executable instructions to implement the pipeline image classification method according to any one of claims 1 to 8.
CN202511222686.3A 2025-08-29 2025-08-29 Pipeline image classification methods, devices and electronic equipment Active CN120747646B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202511222686.3A CN120747646B (en) 2025-08-29 2025-08-29 Pipeline image classification methods, devices and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202511222686.3A CN120747646B (en) 2025-08-29 2025-08-29 Pipeline image classification methods, devices and electronic equipment

Publications (2)

Publication Number Publication Date
CN120747646A true CN120747646A (en) 2025-10-03
CN120747646B CN120747646B (en) 2025-12-02

Family

ID=97187551

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202511222686.3A Active CN120747646B (en) 2025-08-29 2025-08-29 Pipeline image classification methods, devices and electronic equipment

Country Status (1)

Country Link
CN (1) CN120747646B (en)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102930301A (en) * 2012-10-16 2013-02-13 西安电子科技大学 Image classification method based on characteristic weight learning and nuclear sparse representation
JP2016015045A (en) * 2014-07-02 2016-01-28 キヤノン株式会社 Image recognition device, image recognition method, and program
EP3166020A1 (en) * 2015-11-06 2017-05-10 Thomson Licensing Method and apparatus for image classification based on dictionary learning
WO2019006835A1 (en) * 2017-07-06 2019-01-10 清华大学深圳研究生院 Target recognition method based on compressed sensing
CN109376802A (en) * 2018-12-12 2019-02-22 浙江工业大学 A dictionary learning-based method for classifying gastroscopic organs
CN112183660A (en) * 2020-10-19 2021-01-05 浙江理工大学 Discriminating dictionary learning textile image classification method based on inter-class fuzzy suppression
CN119251542A (en) * 2024-08-15 2025-01-03 浙江理工大学 An image classification method based on intra-class difference inhibitory dictionary learning

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102930301A (en) * 2012-10-16 2013-02-13 西安电子科技大学 Image classification method based on characteristic weight learning and nuclear sparse representation
JP2016015045A (en) * 2014-07-02 2016-01-28 キヤノン株式会社 Image recognition device, image recognition method, and program
EP3166020A1 (en) * 2015-11-06 2017-05-10 Thomson Licensing Method and apparatus for image classification based on dictionary learning
WO2019006835A1 (en) * 2017-07-06 2019-01-10 清华大学深圳研究生院 Target recognition method based on compressed sensing
CN109376802A (en) * 2018-12-12 2019-02-22 浙江工业大学 A dictionary learning-based method for classifying gastroscopic organs
CN112183660A (en) * 2020-10-19 2021-01-05 浙江理工大学 Discriminating dictionary learning textile image classification method based on inter-class fuzzy suppression
CN119251542A (en) * 2024-08-15 2025-01-03 浙江理工大学 An image classification method based on intra-class difference inhibitory dictionary learning

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
ZHIGUO CHANG等: "Dictionary training with genetic algorithm for sparse representation", 2011 IEEE 3RD INTERNATIONAL CONFERENCE ON COMMUNICATION SOFTWARE AND NETWORKS, 8 September 2011 (2011-09-08), pages 444 - 447 *
肖扬等: "小径管X射线焊缝图像缺陷识别算法", 焊接学报, vol. 45, no. 2, 29 February 2024 (2024-02-29), pages 83 - 86 *

Also Published As

Publication number Publication date
CN120747646B (en) 2025-12-02

Similar Documents

Publication Publication Date Title
CN110263705B (en) Two phases of high-resolution remote sensing image change detection system for the field of remote sensing technology
CN110032998B (en) Method, system, device and storage medium for detecting characters of natural scene picture
CN114067168B (en) Cloth defect image generation system and method based on improved variational autoencoder network
CN112364974B (en) YOLOv3 algorithm based on activation function improvement
CN114120041A (en) A Few-Sample Classification Method Based on Dual Adversarial Variational Autoencoders
CN113592923B (en) Batch image registration method based on depth local feature matching
CN111931763A (en) A deep scene text detection method based on random morphological edge geometric modeling
Lv et al. Few-shot learning combine attention mechanism-based defect detection in bar surface
CN111680759B (en) Power grid inspection insulator detection classification method
CN116309310B (en) A combined global regularization and local adversarial learning method for cell nucleus detection in pathological images
CN111598854A (en) Complex texture small defect segmentation method based on rich robust convolution characteristic model
CN114419406A (en) Image change detection method, training method, device and computer equipment
CN113723482A (en) Hyperspectral target detection method based on multi-example twin network
CN113971737A (en) Object recognition method for robot, electronic device, medium, and program product
CN118329770A (en) Injection mold surface defect detection method and system
CN117292249A (en) Underwater sonar image open set classification method, system, equipment and medium
CN113627538B (en) Method for training asymmetric generation of image generated by countermeasure network and electronic device
CN120747646B (en) Pipeline image classification methods, devices and electronic equipment
CN115908295A (en) A method and system for detecting defects of power grid insulators based on deep learning
Ni et al. Multi-meter intelligent detection and recognition method under complex background
CN116152194B (en) Object defect detection method, system, equipment and medium
CN117455893A (en) A GIS defect classification and assessment method and system based on UV images
CN120747645B (en) Drain pipe image identification method and device based on multi-feature fusion and electronic equipment
CN119167146A (en) A method and device for automatic modulation recognition of small sample signals
CN118587702A (en) A rock lithology classification and recognition method based on multi-scale convolutional neural network

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant