Substation defect detection method, system and storage medium based on positive sample images

By combining the SIFT algorithm and the hash perception algorithm, the feature points and difference areas of the positive sample image and the image to be detected in the substation are extracted, which solves the problem of low defect detection accuracy and efficiency in the digital twin substation and achieves high-accuracy defect detection detection.

CN118691847BActive Publication Date: 2024-10-29CHANGSHA NENGCHUAN INFORMATION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411169130.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-23
Publication Date
2024-10-29
Estimated Expiration
2044-08-23

AI Technical Summary

Technical Problem

The efficiency and accuracy of defect detection methods based on positive samples in existing digital twin substations are not high, especially in image similarity judgment and difference area position judgment. Traditional methods have insufficient generalization capabilities. Deep learning methods have high data requirements and small sample sizes. Recognition ability is weak.

Method used

The SIFT algorithm is used to extract key feature points and descriptors, the knnMatch and RANSAC algorithms are used for feature matching, the hash perception algorithm is combined to calculate the degree of difference, the candidate difference areas are screened and the defect areas are judged through thresholds.

Benefits of technology

It improves the accuracy of traditional image algorithms, reduces the data requirements of deep learning methods, reduces sample collection and labeling costs, reduces the probability of misjudgment, and improves the accuracy of defect detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118691847B_ABST
    Figure CN118691847B_ABST
Patent Text Reader

Abstract

The present invention relates to the technical field of digital twins of substations, and in particular to a method and system for detecting substation defects based on positive sample images. The method comprises the steps of: S1, extracting key feature point information by SIFT algorithm; S2, matching key feature points by knnMatch feature matching algorithm; S3, calculating difference points; S4, obtaining candidate difference regions; and S5, calculating the degree of difference by using hash perception algorithm. The present invention adopts the optimization idea of ​​traditional image processing algorithms as a whole, reduces data costs compared with deep learning methods, avoids time-consuming and labor-intensive collection of substation defect samples and data annotation, adds an improved clustering machine learning algorithm to process intermediate data compared with traditional image processing algorithms, and uses image information encoding to reduce environmental interference in the final result judgment, which reduces the probability of misjudgment and improves accuracy overall.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of substation digital twin, and in particular to a substation defect detection method, system and storage medium based on positive sample images. Background Art

[0002] A digital twin substation refers to a technology that uses advanced digital technology to simulate and replicate the various components and operating conditions of an actual substation. Through mathematical modeling and simulation technology, the physical equipment, electrical parameters, operating conditions and other information of the actual substation are digitized to form a virtual model that is completely consistent with the actual substation.

[0003] Among them, the centralized monitoring function based on digital twins can realize virtual mapping and online monitoring of equipment status and environmental status. By using artificial intelligence image recognition algorithms, defective images can be detected quickly and automatically, realizing machine replacement of the original manual reporting mode.

[0004] At present, the core problem of defect detection based on positive samples in digital twin substations is the judgment of image similarity and the location of difference areas.

[0005] The methods for calculating image similarity are usually divided into two categories: traditional image algorithms and methods based on deep learning. The histogram method based on pixel distribution, the cosine similarity method based on feature vectors, the global hash method based on image coding distance, the SIFT algorithm and ORB algorithm based on feature point matching are all traditional image algorithms, while the twin neural network is based on deep learning.

[0006] Similarly, for the determination of the difference position, the difference area between the positive sample image and the image to be detected can also be found based on feature point matching or image encoding. For defect detection in such a specific scenario as the substation, the deep learning method of target detection can also be used to handle it.

[0007] However, the efficiency and accuracy of traditional methods are not high enough, their generalization ability is relatively insufficient compared to deep learning methods, and the effect of extracting some complex image features is not sufficient. Although deep learning methods have high accuracy and generalization ability, they require a large amount of image data in specific scenarios for training. However, it is difficult to collect samples of substation-related defects, and deep learning models with small sample sizes have weak recognition capabilities. Summary of the invention

[0008] Based on this, it is necessary for the present invention to provide a substation defect detection method and system based on positive sample images to solve at least one of the above technical problems.

[0009] To achieve the above object, a substation defect detection method based on positive sample images comprises the following steps:

[0010] Step S1, extraction of key feature point information: after converting the positive sample template image and the image to be detected into grayscale images, the SIFT algorithm is used to obtain key feature points in the positive sample template image and the image to be detected and calculate the descriptors of the key feature points respectively; wherein the descriptors include the position, direction, scale of the key feature points and the 128-dimensional feature vector information formed by the gradient amplitude and direction of the pixels of the 16*16 window centered on the key feature points;

[0011] Step S2, matching of key feature points: using the knnMatch feature matching algorithm to perform one-to-many matching on the descriptors of all key feature points of the positive sample template image and the descriptors of all key feature points of the image to be detected, obtaining matching point pairs, and using the RANSAC algorithm to remove outlier matching point pairs and calculate the homography matrix of the image to be detected for the positive sample template image; the homography matrix includes the corresponding relationship between the coordinates of the points of the image to be detected and the positive sample template image;

[0012] Step S3, difference point calculation:

[0013] S31, selecting S first detection points on the positive sample template image, and affine-mapping the S first detection points to corresponding positions on the image to be detected through the homography matrix, to obtain S second detection points corresponding to the S first detection points;

[0014] S32, calculating descriptors of the S first detection points in the positive sample template image and calculating descriptors of the S second detection points in the image to be detected respectively by using the SIFT algorithm;

[0015] S33, calculating the Euclidean distance between the feature vectors of each pair of the first detection point and the second detection point, and if the Euclidean distance is greater than a preset difference threshold, defining the pair of the first detection point and the second detection point as a difference point;

[0016] Step S4, obtaining candidate difference regions: obtaining candidate difference regions between the image to be detected and the positive sample template image according to the coordinates of the difference points;

[0017] Step S5, calculating the degree of difference: using a hash perception algorithm to respectively calculate the degree of difference between each pair of the candidate difference regions on the image to be detected and the positive sample template image, and determining the difference region with a degree of difference greater than a set threshold as a defect of the image to be detected.

[0018] Furthermore, the step S1 specifically includes:

[0019] S11, converting the positive sample template image and the image to be detected into grayscale images;

[0020] S12, constructing a multi-scale space: constructing a Gaussian pyramid for the converted grayscale image, performing Gaussian smoothing on the original image to remove high-frequency noise, then downsampling the smoothed image, repeatedly filtering and downsampling the downsampled image to obtain multiple groups of images, each group of images includes multiple layers of images, wherein the scale space of the two-dimensional image is defined as: L(x,y,σ)=G(x,y,σ)*I(x,y); the difference scale space is defined as: D(x,y,σ)=L(x,y,kσ)-L(x,y,σ); σ is the standard deviation of the Gaussian normal distribution, x is the horizontal axis coordinate, and y is the vertical axis coordinate;

[0021] S13, detecting local extreme points with directional information in the multiple groups of images as key feature points through DoG space detection at different scales;

[0022] S14, obtaining the descriptor of the key feature point.

[0023] Furthermore, the step S13 includes: comparing each pixel point in the multiple groups of images with all adjacent points in the scale space corresponding to the pixel point and the adjacent scale space; when the pixel value of the pixel point is greater than or less than all adjacent points, the pixel point is taken as an extreme point; and the extreme points that exist at different scales of the multiple groups of images are taken as the key feature points.

[0024] Furthermore, the step S14 includes:

[0025] Acquire scale information and position information of the key feature points in the images at different scales;

[0026] Determine the direction information of the key feature point by using the gradient distribution characteristics of the area pixels of the key feature point;

[0027] The gradient amplitude and direction of the pixels of a 16*16 window centered on the key feature point divide the pixels in the window into 16 blocks, each of which is a histogram statistic of 8 directions within its pixels, forming a 128-dimensional feature vector information of the key feature point.

[0028] Furthermore, the step S2 includes:

[0029] Using the knnMatch feature matching algorithm to perform one-to-many matching on the descriptors of all key feature points of the positive sample template image and the descriptors of all key feature points of the image to be detected, taking k=2 in the knnMatch feature matching algorithm, and obtaining the two descriptors of the nearest neighbor and the second nearest neighbor in the feature space between the image to be detected and the positive sample template image;

[0030] When the ratio of the similarity distance in the feature space between the nearest neighbor descriptor and the second nearest descriptor is between 0.4 and 0.6, determining the key feature points corresponding to the nearest neighbor descriptor and the second nearest descriptor as a matching point pair;

[0031] All matching point pairs are passed through the RANSAC algorithm, outlier matching point pairs are eliminated, and the homography matrix of the image to be detected for the positive sample template image is calculated.

[0032] Furthermore, in step S31, detection points are selected at a fixed interval i on the positive sample template image, and the straight-line distance between each detection point and the detection points above, below, left and right is i; wherein the number of the first detection points is S = (w / i+1)*(h / i+1), where w and h are the length and width of the positive sample template image, respectively.

[0033] Further, the step S4 includes:

[0034] S41, all the difference point data are taken as a data set Q, and the Euclidean distance between each point in the data set Q and all the points is recorded as , ; Wherein, the number of difference points is n; Sort the elements of each row in ascending order, then the distance vector D1 composed of the elements in the first column represents the distance from the object to itself, all of which are 0; the elements in the Kth column constitute the vector Dk of the K-nearest neighbor distances of all points; average the elements in the vector Dk to obtain the K-average nearest neighbor distance D of the vector Dk, and use it as a candidate Eps parameter, calculate all the K-average nearest neighbor distances D to obtain the Eps parameter list ;

[0035] S42, for the Eps parameter list, find out the number of Eps neighborhood objects corresponding to each candidate Eps parameter in turn, and calculate the mathematical expectation value of the number of Eps neighborhood objects of all objects as the neighborhood density value MinPts parameter of the data set Q , ;

[0036] S43, sequentially selecting different elements in the vector Dk as Eps parameters and the corresponding MinPts parameters, inputting the DBSCAN algorithm to perform clustering analysis on the data set Q, and obtaining the number of clusters generated under different K values, respectively. When the number of generated clusters is the same for three consecutive times, it is considered that the clustering result is stable, and the number of clusters N is recorded as the optimal number;

[0037] S44, continue to execute the above step S43 until the number of generated clusters is no longer N, and select the maximum K value corresponding to the number of clusters N as the optimal K value, the K-average nearest neighbor distance D corresponding to the optimal K value is the optimal Eps parameter, and the corresponding MinPis parameter is the optimal MinPts parameter;

[0038] S45, bringing the optimal Eps parameter and the optimal MinPts parameter selected for the image to be detected into the calculation of the clustering result, and taking the circumscribed rectangle of each cluster area of ​​the image to be detected as the candidate difference area;

[0039] S46, calculating the average offset of the coordinate offsets between all the matching point pairs, and finding an area corresponding to the candidate difference area of ​​the image to be detected in the positive sample template image according to the average offset as the candidate difference area of ​​the positive sample template image.

[0040] Furthermore, the step S5 comprises:

[0041] S51, performing hash perception processing on the candidate difference region between the image to be detected and the positive sample template image to generate a corresponding hash code;

[0042] S52, calculating the Hamming distance between two hash codes;

[0043] S531, if the Hamming distances of all the candidate difference regions are less than 5, it is determined that the entire image has no defects;

[0044] S532, if there are multiple candidate difference regions whose Hamming distances are greater than or equal to 5, select the candidate difference region with the largest Hamming distance and all the candidate difference regions whose Hamming distances differ from the maximum Hamming distance by less than or equal to 2 as the defect region of the image to be detected.

[0045] The present invention also provides a substation defect detection system based on positive sample images, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the steps of the substation defect detection method based on positive sample images as described in any one of the above items are implemented.

[0046] The present invention also provides a computer-readable storage medium storing a computer program, wherein when the computer program is executed by a processor, the steps of the substation defect detection method based on positive sample images as described in any one of the above items are implemented.

[0047] In order to reduce the high data cost requirements of deep learning technology in substation defect detection, the substation defect detection method based on positive sample images of the present invention adopts an overall optimization idea for traditional image processing algorithms. By extracting key points through SIFT features, matching point pairs between the positive sample image and the image to be detected are screened out, and the difference points are preliminarily divided into several candidate difference areas. Then, a hash perception algorithm is used to encode all candidate difference areas, and the final regional difference judgment and abnormal position locking are determined by threshold setting, which solves the problem of high data requirements for using deep learning methods and improves the accuracy of traditional image algorithms. Compared with deep learning methods, the present invention reduces data costs and avoids time-consuming and labor-intensive collection of substation defect samples and data labeling. Compared with traditional image processing algorithms, an improved clustering machine learning algorithm is added to process intermediate data. Image information encoding is used in the final result judgment to reduce environmental interference, which reduces the probability of misjudgment overall and improves accuracy. BRIEF DESCRIPTION OF THE DRAWINGS

[0048] Other features, objectives and advantages of the present invention will become more apparent from a reading of the detailed description of a non-limiting implementation made with reference to the following accompanying drawings.

[0049] Figure 1 It is a flow chart of a substation defect detection method based on positive sample images provided by the present invention.

[0050] Figure 2 yes Figure 1 Sub-flow chart of step S3 in .

[0051] Figure 3 yes Figure 1 Sub-flow chart of step S4 in . DETAILED DESCRIPTION

[0052] The following is a clear and complete description of the technical method of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by technicians in this field without creative work are within the scope of protection of the present invention.

[0053] In addition, the accompanying drawings are only schematic illustrations of the present invention and are not necessarily drawn to scale. The same reference numerals in the figures represent the same or similar parts, and their repeated description will be omitted. Some of the block diagrams shown in the accompanying drawings are functional entities and do not necessarily correspond to physically or logically independent entities. The functional entities can be implemented in software form, or implemented in one or more hardware modules or integrated circuits, or implemented in different networks and / or processor methods and / or microcontroller methods.

[0054] It should be understood that, although the terms "first", "second", etc. may be used herein to describe various units, these units should not be limited by these terms. These terms are used only to distinguish one unit from another unit. For example, without departing from the scope of the exemplary embodiments, the first unit may be referred to as the second unit, and similarly the second unit may be referred to as the first unit. The term "and / or" used herein includes any and all combinations of one or more of the listed associated items.

[0055] To achieve this, please refer to Figures 1 to 3 The present invention provides a substation defect detection method based on positive sample images, comprising the following steps:

[0056] Step S1, extraction of key feature point information: after converting the positive sample template image and the image to be detected into grayscale images, the SIFT algorithm is used to obtain key feature points in the positive sample template image and the image to be detected and calculate the descriptors of the key feature points respectively; wherein the descriptors include the position, direction, scale of the key feature points and the 128-dimensional feature vector information formed by the gradient amplitude and direction of the pixels of the 16*16 window centered on the key feature points;

[0057] Step S2, matching of key feature points: using the knnMatch feature matching algorithm to perform one-to-many matching on the descriptors of all key feature points of the positive sample template image and the descriptors of all key feature points of the image to be detected, obtaining matching point pairs, and using the RANSAC algorithm to remove outlier matching point pairs and calculate the homography matrix of the image to be detected for the positive sample template image; the homography matrix includes the corresponding relationship between the coordinates of the points of the image to be detected and the positive sample template image;

[0058] Step S3, difference point calculation:

[0059] S31, selecting S first detection points on the positive sample template image, and affine-mapping the S first detection points to corresponding positions on the image to be detected through the homography matrix, to obtain S second detection points corresponding to the S first detection points;

[0060] S32, calculating descriptors of the S first detection points in the positive sample template image and calculating descriptors of the S second detection points in the image to be detected respectively by using the SIFT algorithm;

[0061] S33, calculating the Euclidean distance between the feature vectors of each pair of the first detection point and the second detection point, and if the Euclidean distance is greater than a preset difference threshold, defining the pair of the first detection point and the second detection point as a difference point;

[0062] Step S4, obtaining candidate difference regions: obtaining candidate difference regions between the image to be detected and the positive sample template image according to the coordinates of the difference points;

[0063] Step S5, calculating the degree of difference: using a hash perception algorithm to respectively calculate the degree of difference between each pair of the candidate difference regions on the image to be detected and the positive sample template image, and determining the difference region with a degree of difference greater than a set threshold as a defect of the image to be detected.

[0064] Specifically, in step S1, after obtaining the positive sample template image and the image to be detected, the feature information of the positive sample template image is fully obtained, the purpose is to calculate the vector correlation with the corresponding feature information in the image to be detected, so as to match the key feature points with similar content. After converting the positive sample template image and the image to be detected into grayscale images, the SIFT algorithm is used to obtain the key feature points and calculate the descriptors of the key feature points in the positive sample template image and the image to be detected.

[0065] Furthermore, in a preferred embodiment, the step S1 specifically includes:

[0066] S11, converting the positive sample template image and the image to be detected into grayscale images.

[0067] S12, constructing a multi-scale space: constructing a Gaussian pyramid for the converted grayscale image, performing Gaussian smoothing on the original image to remove high-frequency noise, then downsampling the smoothed image, and repeatedly filtering and downsampling the downsampled image to obtain multiple groups of images, each group of images includes multiple layers of images, wherein the scale space of the two-dimensional image is defined as: L(x,y,σ)=G(x,y,σ)*I(x,y); the difference scale space is defined as: D(x,y,σ)=L(x,y,kσ)-L(x,y,σ).

[0068] Specifically, those skilled in the art should know the method of obtaining key feature points from an image and calculating the descriptors of key feature points by the SIFT algorithm. The following is a brief description. First, a Gaussian pyramid is constructed for the image, and Gaussian smoothing is performed on the original image to remove high-frequency noise. Then, the smoothed image is downsampled. Downsampling will reduce the size of the image. Repeating filtering and downsampling, one image can generate several groups of images. A group of images includes several layers of images, so that the scales of multiple layers in a group of Gaussian pyramids are different, that is, the Gaussian parameters σ used are different, σ is the standard deviation of the Gaussian normal distribution, and each group of Gaussian pyramids is a Gaussian scale space.

[0069] In this field, the bottom layer of the previous group of images is obtained by downsampling the images with a scale of 2σ in the next group with a step size of 2. After the Gaussian pyramid is constructed, the images in adjacent Gaussian spaces are subtracted to obtain the DoG Gaussian difference pyramid. Since the bottom layer of the previous group of images is generated by sampling the second to last layer of the previous group of images at alternate points, the continuity of the scale can be guaranteed.

[0070] The scale space of a two-dimensional image is defined as: L(x,y,σ)=G(x,y,σ)*I(x,y);

[0071] The difference scale space is defined as: D(x,y,σ)=L(x,y,kσ)-L(x,y,σ).

[0072] S13, detecting local extreme points with directional information in the multiple groups of images as key feature points through DoG space detection at different scales.

[0073] Furthermore, the step S13 includes:

[0074] Compare each pixel point in the plurality of groups of images with all adjacent points in the scale space corresponding to the pixel point and the adjacent scale space. When the pixel value of the pixel point is greater than or less than all adjacent points, the pixel point is regarded as an extreme point. Usually, these extreme points are very prominent points that will not disappear due to changes in lighting conditions, such as corner points, edge points, bright spots in dark areas, and dark spots in bright areas.

[0075] The extreme points existing at different scales of the multiple groups of images are used as the key feature points.

[0076] S14, obtaining the descriptor of the key feature point.

[0077] Furthermore, the step S14 includes:

[0078] S141, obtaining scale information and position information of the key feature points in the images at different scales. Specifically, by finding the key feature points that exist at different scales, the scale image where the feature points are located can be obtained.

[0079] S142, determining direction information of the key feature point according to the gradient distribution characteristics of the area pixels of the key feature point.

[0080] Specifically, in order to achieve image rotation invariance, it is necessary to assign a value to the direction of the key feature point. Usually, the gradient distribution characteristics of the neighborhood pixels of the key feature point are used to determine its direction parameter, and then the gradient histogram of the image is used to obtain the stable direction of the local structure of the key feature point.

[0081] The angle and magnitude of the gradient of each pixel are calculated in the area with the key feature point as the center and 3×1.5σ * 3×1.5σ as the radius, and then the angle of the gradient is counted using a histogram. The horizontal axis of the histogram is the direction of the gradient, and the vertical axis is the cumulative value of the gradient magnitude corresponding to the gradient direction. The direction corresponding to the highest peak in the histogram is the direction of the key feature point.

[0082] The calculation formula for coordinates and angles rotated to the main direction as the X axis is:

[0083] xrot=x*cos(Oris)-y*sin(Oris);

[0084] yrot=x*sin(Oris)+y*cos(Oris);

[0085] thetarot=theta-Oris.

[0086] S143, the gradient amplitude and direction of the pixels of a 16*16 window centered on the key feature point, divide the pixels in the window into 16 blocks, each block is a histogram statistic of 8 directions within its pixels, and form a 128-dimensional feature vector information of the key feature point.

[0087] Furthermore, the step S2 comprises:

[0088] Using the knnMatch feature matching algorithm to perform one-to-many matching on the descriptors of all key feature points of the positive sample template image and the descriptors of all key feature points of the image to be detected, taking k=2 in the knnMatch feature matching algorithm, and obtaining the two descriptors of the nearest neighbor and the second nearest neighbor in the feature space between the image to be detected and the positive sample template image;

[0089] When the ratio of the similarity distance in the feature space between the nearest neighbor descriptor and the second nearest descriptor is between 0.4 and 0.6, determining the key feature points corresponding to the nearest neighbor descriptor and the second nearest descriptor as a matching point pair;

[0090] All suitable matching point pairs are passed through the RANSAC algorithm, outlier matching point pairs are eliminated, and the homography matrix of the image to be detected for the positive sample template image is calculated.

[0091] Furthermore, in step S31, detection points are selected at a fixed interval i on the positive sample template image, and the straight-line distance between each detection point and the detection points above, below, left and right is i; wherein the number of the first detection points is S = (w / i+1)*(h / i+1), where w and h are the length and width of the positive sample template image, respectively.

[0092] In step S33, the preset difference threshold may be a fixed ratio, or a pair of the first detection point and the second detection point whose Euclidean distances between the feature vectors of all S pairs of the first detection point and the second detection point are greater than 50% to 80% (for example, 70%) of the maximum difference distance (the largest value in the Euclidean distance) is defined as a difference point.

[0093] Optionally, in the step S4, the candidate difference area may be directly delineated by defining pixels of a preset size near the difference point.

[0094] Furthermore, in a preferred embodiment, step S4 includes:

[0095] S41, all the difference point data are taken as a data set Q, and the Euclidean distance between each point in the data set Q and all the points is recorded as , ; Wherein, the number of difference points is n; The elements of each row in the ascending order are sorted, then the distance vector D1 composed of the elements in the first column represents the distance from the object to itself, which is all 0; the elements in the Kth column constitute the vector D of the K-nearest neighbor distances of all points k ; For the vector D k The elements in are averaged to get vector D k The K-average nearest neighbor distance D is used as the candidate Eps parameter, and all K-average nearest neighbor distances D are calculated to obtain the Eps parameter list .

[0096] S42, for the Eps parameter list, find out the number of Eps neighborhood objects corresponding to each candidate Eps parameter in turn, and calculate the mathematical expectation value of the number of Eps neighborhood objects of all objects as the neighborhood density value MinPts parameter of the data set Q , ;

[0097] S43, sequentially selecting different elements in the vector Dk as Eps parameters and the corresponding MinPts parameters (i.e., sequentially selecting elements in the generated Eps parameter list as Eps parameters and the corresponding MinPts parameters), inputting the DBSCAN algorithm to perform clustering analysis on the data set Q, and obtaining the number of clusters generated under different K values ​​respectively. When the number of generated clusters is the same for three consecutive times, it is considered that the clustering result is stable, and the number of clusters N is recorded as the optimal number;

[0098] S44, continue to execute the above step S43 until the number of generated clusters is no longer N, and select the maximum K value corresponding to the number of clusters N as the optimal K value, the K-average nearest neighbor distance D corresponding to the optimal K value is the optimal Eps parameter, and the corresponding MinPis parameter is the optimal MinPts parameter;

[0099] S45, bringing the optimal Eps parameter and the optimal MinPts parameter selected for the image to be detected into the calculation of the clustering result, and taking the circumscribed rectangle of each cluster area of ​​the image to be detected as the candidate difference area;

[0100] S46, calculating the average offset of the coordinate offsets between all the matching point pairs, and finding an area corresponding to the candidate difference area of ​​the image to be detected in the positive sample template image according to the average offset as the candidate difference area of ​​the positive sample template image.

[0101] Furthermore, the step S5 comprises:

[0102] S51, performing hash perception processing on the candidate difference region between the image to be detected and the positive sample template image to generate a corresponding hash code.

[0103] Specifically, the image (candidate difference area) is first reduced to a pixel image of a fixed size. This step is to remove the details of the image, retain only basic information such as structure and brightness, and discard the image differences caused by different sizes and proportions. The reduced image is converted into a grayscale image and simplified to 64 levels of grayscale, that is, all pixels have a total of 64 colors. The grayscale average of all 64 pixels is calculated, and the grayscale of each pixel is compared with the average value. Pixels greater than or equal to the DCT mean are recorded as 1, and pixels less than the DCT mean are recorded as 0. The comparison results are combined to form a 64-bit integer, and every four bits form a hexadecimal code.

[0104] The calculation formula of DCT mean is:

[0105] cos ,

[0106] ;

[0107] f(i,j) is the original signal, F(u,v) is the coefficient after DCT transformation, N is the number of points of the original signal, and c(u) and c(v) are compensation coefficients.

[0108] S52, calculating the Hamming distance between the two hash codes.

[0109] Specifically, the Hamming distance is the sum of the number of bits at different positions of the two hash codes. Based on the calculated Hamming distance, the degree of difference between the two images can be obtained. In general, the larger the Hamming distance, the greater the difference between the two images. The Hamming distance d between the hash values ​​of the two images, the similarity of the two images is (64-d) / 64. It is generally believed that if the Hamming distance is less than 5, the two images are considered similar.

[0110] S531, if the Hamming distances of all the candidate difference regions are less than 5, it is determined that the entire image has no defects;

[0111] S532, if there are multiple candidate difference regions whose Hamming distances are greater than or equal to 5, select the candidate difference region with the largest Hamming distance and all the candidate difference regions whose Hamming distances differ from the maximum Hamming distance by less than or equal to 2 as the defect region of the image to be detected.

[0112] The substation defect detection method based on positive sample images of the present invention is to reduce the high data cost requirements of deep learning technology in substation defect detection, and the sample images under normal scenarios have rich feature information. These feature information are used to match the key information between the image to be detected and the positive sample template image, and perform differential calculations to quantify the differences into numerical values ​​for judgment.

[0113] The present invention adopts the optimization idea of ​​the traditional image processing algorithm as a whole, combines the advantages of several common image processing algorithms, reduces the data cost compared with the deep learning method, avoids the time-consuming and labor-intensive collection of substation defect samples and data annotation, adds an improved clustering machine learning algorithm to process intermediate data compared with the traditional image processing algorithm, and uses image information encoding in the final result judgment to reduce environmental interference, which reduces the probability of misjudgment and improves accuracy. By extracting key points through SIFT features, matching point pairs between the positive sample image and the image to be detected are screened, and the difference points are preliminarily divided into several candidate difference areas, and then all candidate difference areas are encoded using a hash perception algorithm. The final regional difference judgment and the locking of abnormal positions are determined by threshold setting, which solves the problem of high data requirements for using deep learning methods and improves the accuracy of traditional image algorithms.

[0114] The present invention also provides a substation defect detection system based on positive sample images, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the steps of the substation defect detection method based on positive sample images as described in any one of the above items are implemented.

[0115] Exemplarily, the computer program may be divided into one or more modules / units, which are stored in the memory and executed by the processor to implement the present invention. The one or more modules / units may be a series of computer program instruction segments capable of implementing specific functions, which are used to describe the execution process of the computer program in the computer.

[0116] The processor may be a central processing unit (CPU), other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.

[0117] The memory may be an internal storage unit, such as a hard disk or a memory; the memory may also be an external storage device, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. Further, the memory may include both an internal storage unit and an external storage device. The memory is used to store the computer program and other programs and data required by the terminal device. The memory may also be used to temporarily store data that has been output or is to be output.

[0118] The present invention also provides a computer-readable storage medium storing a computer program, wherein when the computer program is executed by a processor, the steps of the substation defect detection method based on positive sample images as described in any one of the above items are implemented.

[0119] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.

[0120] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0121] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.

[0122] In the embodiments provided by the present invention, it should be understood that the disclosed devices / systems and methods can be implemented in other ways. For example, the device / terminal equipment embodiments described above are only schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0123] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0124] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0125] If the integrated module / unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present invention implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium. When the computer program is executed by the processor, the steps of the above-mentioned various method embodiments can be implemented. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electric carrier signal, telecommunication signal and software distribution medium. It should be noted that the content contained in the computer-readable medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media do not include electric carrier signals and telecommunication signals.

[0126] Therefore, the embodiments should be regarded as illustrative and non-restrictive from all points, and the scope of the present invention is limited by the appended claims rather than the above description, and it is therefore intended that all changes falling within the meaning and range of equivalent elements of the application documents are included in the present invention.

[0127] The above description is only a specific embodiment of the present invention, so that those skilled in the art can understand or implement the present invention. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but should conform to the widest scope consistent with the principles and novel features invented herein.

Claims

1. A substation defect detection method based on positive sample images, characterized in that: The following steps are involved: Step S1, extraction of key feature point information: after converting the positive sample template image and the image to be detected into grayscale images, the SIFT algorithm is used to obtain key feature points in the positive sample template image and the image to be detected and calculate the descriptors of the key feature points respectively; wherein the descriptors include the position, direction, scale of the key feature points and the 128-dimensional feature vector information formed by the gradient amplitude and direction of the pixels of the 16*16 window centered on the key feature points; Step S2, matching of key feature points: using the knnMatch feature matching algorithm to perform one-to-many matching on the descriptors of all key feature points of the positive sample template image and the descriptors of all key feature points of the image to be detected, obtaining matching point pairs, and using the RANSAC algorithm to remove outlier matching point pairs and calculate the homography matrix of the image to be detected for the positive sample template image; the homography matrix includes the corresponding relationship between the coordinates of the points of the image to be detected and the positive sample template image; Step S3, difference point calculation: S31, selecting S first detection points on the positive sample template image, and affine-mapping the S first detection points to corresponding positions on the image to be detected through the homography matrix, to obtain S second detection points corresponding to the S first detection points; S32, respectively calculating descriptors of the S first detection points in the positive sample template image and calculating descriptors of the S second detection points in the image to be detected by using the SIFT algorithm; S33, calculating the Euclidean distance between the feature vectors of each pair of the first detection point and the second detection point, and if the Euclidean distance is greater than a preset difference threshold, defining the pair of the first detection point and the second detection point as a difference point; Step S4, obtaining candidate difference regions: obtaining candidate difference regions between the image to be detected and the positive sample template image according to the coordinates of the difference points; Step S5, calculating the degree of difference: using a hash perception algorithm to respectively calculate the degree of difference between each pair of the candidate difference regions on the image to be detected and the positive sample template image, and determining the difference region with a degree of difference greater than a set threshold as a defect of the image to be detected.

2. The method for detecting substation defects based on positive sample images according to claim 1, characterized in that: The step S1 specifically includes: S11, converting the positive sample template image and the image to be detected into grayscale images; S12, constructing a multi-scale space: constructing a Gaussian pyramid for the converted grayscale image, performing Gaussian smoothing on the original image to remove high-frequency noise, then downsampling the smoothed image, repeatedly filtering and downsampling the downsampled image to obtain multiple groups of images, each group of images includes multiple layers of images, wherein the scale space of the two-dimensional image is defined as: L(x,y,σ)=G(x,y,σ)*I(x,y); the difference scale space is defined as: D(x,y,σ)=L(x,y,kσ)-L(x,y,σ); σ is the standard deviation of the Gaussian normal distribution, x is the horizontal axis coordinate, and y is the vertical axis coordinate; S13, detecting local extreme points with directional information in the multiple groups of images as the key feature points through DoG space detection at different scales; S14, obtaining the descriptor of the key feature point.

3. The substation defect detection method based on positive sample images according to claim 2 is characterized in that: The step S13 includes: comparing each pixel point in the multiple groups of images with all adjacent points in the scale space corresponding to the pixel point and the adjacent scale space; when the pixel value of the pixel point is greater than or less than all adjacent points, the pixel point is taken as an extreme point; and the extreme points that exist at different scales of the multiple groups of images are taken as the key feature points.

4. The method for detecting substation defects based on positive sample images according to claim 3 is characterized in that: The step S14 comprises: Acquire scale information and position information of the key feature points in the images at different scales; Determine the direction information of the key feature point by using the gradient distribution characteristics of the area pixels of the key feature point; The gradient amplitude and direction of the pixels of a 16*16 window centered on the key feature point divide the pixels in the window into 16 blocks, each of which is a histogram statistic of 8 directions within its pixels, forming a 128-dimensional feature vector information of the key feature point.

5. The method for detecting substation defects based on positive sample images according to claim 1, characterized in that: The step S2 comprises: Using the knnMatch feature matching algorithm to perform one-to-many matching on the descriptors of all key feature points of the positive sample template image and the descriptors of all key feature points of the image to be detected, taking k=2 in the knnMatch feature matching algorithm, and obtaining the two descriptors of the nearest neighbor and the second nearest neighbor in the feature space between the image to be detected and the positive sample template image; When the ratio of the similarity distance in the feature space between the nearest neighbor descriptor and the second nearest descriptor is between 0.4 and 0.6, determining the key feature points corresponding to the nearest neighbor descriptor and the second nearest descriptor as a matching point pair; All matching point pairs are passed through the RANSAC algorithm, outlier matching point pairs are eliminated, and the homography matrix of the image to be detected for the positive sample template image is calculated.

6. The method for detecting substation defects based on positive sample images according to claim 1, characterized in that: In step S31, detection points are selected at a fixed interval i on the positive sample template image, and the straight-line distance between each detection point and the detection points above, below, left and right is i; wherein the number of the first detection points is S = (w / i+1)*(h / i+1), where w and h are the length and width of the positive sample template image, respectively.

7. The method for detecting substation defects based on positive sample images according to claim 1, characterized in that: The step S4 comprises: S41, all the difference point data are taken as a data set Q, and the Euclidean distance between each point in the data set Q and all the points is recorded as , ; Wherein, the number of difference points is n; The elements of each row in the ascending order are sorted, then the distance vector D1 composed of the elements in the first column represents the distance from the object to itself, which is all 0; the elements in the Kth column constitute the vector D of the K-nearest neighbor distances of all points k ; For the vector D k The elements in are averaged to get vector D k The K-average nearest neighbor distance D is used as the candidate Eps parameter, and all K-average nearest neighbor distances D are calculated to obtain the Eps parameter list ; S42, for the Eps parameter list, find out the number of Eps neighborhood objects corresponding to each candidate Eps parameter in turn, and calculate the mathematical expectation value of the number of Eps neighborhood objects of all objects as the neighborhood density value MinPts parameter of the data set Q , ; S43, sequentially selecting different elements in the vector Dk as Eps parameters and the corresponding MinPts parameters, inputting the DBSCAN algorithm to perform clustering analysis on the data set Q, and obtaining the number of clusters generated under different K values, respectively. When the number of generated clusters is the same for three consecutive times, it is considered that the clustering result is stable, and the number of clusters N is recorded as the optimal number; S44, continue to execute the above step S43 until the number of generated clusters is no longer N, and select the maximum K value corresponding to the number of clusters N as the optimal K value, the K-average nearest neighbor distance D corresponding to the optimal K value is the optimal Eps parameter, and the corresponding MinPis parameter is the optimal MinPts parameter; S45, bringing the optimal Eps parameter and the optimal MinPts parameter selected for the image to be detected into the calculation of the clustering result, and taking the circumscribed rectangle of each cluster area of ​​the image to be detected as the candidate difference area; S46, calculating the average offset of the coordinate offsets between all the matching point pairs, and finding an area corresponding to the candidate difference area of ​​the image to be detected in the positive sample template image according to the average offset as the candidate difference area of ​​the positive sample template image.

8. The method for detecting substation defects based on positive sample images according to claim 1, characterized in that: The step S5 comprises: S51, performing hash perception processing on the candidate difference region between the image to be detected and the positive sample template image to generate a corresponding hash code; S52, calculating the Hamming distance between two hash codes; S531, if the Hamming distances of all the candidate difference regions are less than 5, it is determined that the entire image has no defects; S532, if there are multiple candidate difference regions whose Hamming distances are greater than or equal to 5, select the candidate difference region with the largest Hamming distance and all the candidate difference regions whose Hamming distances differ from the maximum Hamming distance by less than or equal to 2 as the defect region of the image to be detected.

9. A substation defect detection system based on positive sample images, characterized in that: The method comprises a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the substation defect detection method based on positive sample images as described in any one of claims 1 to 8 when executing the computer program.

10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the substation defect detection method based on positive sample images as claimed in any one of claims 1 to 8 are implemented.

Citation Information

Patent Citations

  • Method and system for detecting internal defects of drainage pipeline

    CN111553265A

  • Page turning detection method and device, electronic equipment and storage medium

    CN111639713A