Defect detection method and device, and computer readable storage medium

Through pre-segmentation processing of high-speed railway track surface images and surface defect prediction model prediction, true positive defects are screened out, which solves the problems of contact error and time-consuming inefficiency in traditional detection technology, and achieves more efficient and accurate defect detection.

CN112541884BActive Publication Date: 2024-10-25ZHEJIANG DAHUA TECH CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202011192922.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-10-30
Publication Date
2024-10-25
Estimated Expiration
2040-10-30

AI Technical Summary

Technical Problem

Traditional manual inspection and non-destructive testing technologies such as electromagnetic, coil eddy current and ultrasonic testing have problems such as contact errors, alarm errors, omissions, time-consuming and inefficient testing of high-speed railway track defects, and cannot meet the needs of advanced railway systems.

Method used

A defect detection method is adopted, by obtaining the basic image of the target object surface, performing pre-segmentation processing to obtain the centroid coordinates of the connected domain, using the surface defect prediction model to predict the defect rectangular area of ​​interest, and based on the pre-segmentation results and the rectangular area of ​​interest Corresponding relationship, true positive defects are screened out, and dual-channel parallel detection is realized.

Benefits of technology

The accuracy of defect detection is improved, false positive interference is eliminated, and the efficiency and accuracy of detection are enhanced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112541884B_ABST
    Figure CN112541884B_ABST
Patent Text Reader

Abstract

The present application discloses a defect detection method and device, and a computer-readable storage medium. The defect detection method includes: obtaining a basic image about the surface of a target object; performing pre-segmentation processing on the basic image to obtain a pre-segmentation result containing the centroid coordinates of a connected domain; using a surface defect prediction model to predict the basic image to obtain a rectangular region of interest of the defect; based on the correspondence between the pre-segmentation result and the rectangular region of interest of the defect, screening out true positive defects on the surface of the target object. The above scheme can accurately detect defects on the surface of the target object.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image processing technology, and in particular to a defect detection method and device, and a computer-readable storage medium. Background Art

[0002] The occurrence of product surface defects is often inevitable, and surface defects not only affect the appearance and comfort of the product, but may also have an adverse effect on its performance. Taking high-speed railway tracks as an example, the health of high-speed railway tracks involves the running order of trains and the personal safety of passengers. Engineering agencies will regularly monitor rail defects and maintain railway quality to prevent major public disasters on operating dedicated lines.

[0003] However, traditional manual inspections and non-destructive testing technologies such as electromagnetic, eddy current, and ultrasonic testing are still used for damage assessment. These technologies have several major shortcomings, including contact between the instrument and the workpiece being tested, false and missed alarms, time-consuming and inefficient engineering, and subjective judgment by technicians. These shortcomings are insufficient to meet the needs of the current advanced railway system. Summary of the invention

[0004] The main technical problem solved by the present application is to provide a defect detection method and device, and a computer-readable storage medium, which can accurately detect defects on the surface of a target object.

[0005] In order to solve the above problems, the first aspect of the present application provides a defect detection method, which includes: obtaining a basic image about the surface of the target object; performing pre-segmentation processing on the basic image to obtain a pre-segmentation result including the centroid coordinates of the connected domain; using a surface defect prediction model to predict the basic image to obtain a rectangular region of interest of the defect; based on the correspondence between the pre-segmentation result and the rectangular region of interest of the defect, screening out true positive defects on the surface of the target object.

[0006] To solve the above problem, the second aspect of the present application provides a defect detection device, which includes a processor and a memory connected to each other, the memory is used to store program instructions, and the processor is used to execute the program instructions to implement the method of the first aspect.

[0007] To solve the above problem, the third aspect of the present application provides a computer-readable storage medium on which program instructions are stored, and when the program instructions are executed by a processor, the method of the first aspect is implemented.

[0008] The beneficial effect of the present invention is as follows: Different from the prior art, after obtaining the basic image on the surface of the target object, the present application performs pre-segmentation processing on the basic image to obtain the pre-segmentation result containing the centroid coordinates of the connected domain, and also uses the surface defect prediction model to predict the basic image to obtain the rectangular region of interest of the defect, and then based on the correspondence between the pre-segmentation result and the rectangular region of interest of the defect, the true positive defects on the surface of the target object are screened out. In the above manner, a two-way parallel detection method is used for the basic image on the surface of the target object, which can obtain both the pre-segmentation result of the image and the positioning information of the target object, wherein the target object is a defect, and its positioning information is a rectangular region of interest, and based on the correspondence between the pre-segmentation result and the rectangular region of interest of the defect, the true positive defects on the surface of the target object can be screened out using corresponding discrimination rules, thereby eliminating false positive interferences and making the detection of defects on the surface of the target object more accurate. BRIEF DESCRIPTION OF THE DRAWINGS

[0009] Figure 1 It is a flow chart of an embodiment of a defect detection method of the present application;

[0010] Figure 2 yes Figure 1 A schematic diagram of a flow chart of an embodiment of step S12;

[0011] Figure 3 is a schematic diagram comparing the segmentation results of different rail images using the image segmentation model of the present application and other models;

[0012] Figure 4 is a flow chart of another embodiment of the defect detection method of the present application;

[0013] Figure 5 It is a processing flow diagram of the first application scenario of the defect detection method of the present application;

[0014] Figure 6 It is a structural schematic diagram of an embodiment of a defect detection device of the present application;

[0015] Figure 7 is a structural schematic diagram of another embodiment of the defect detection device of the present application;

[0016] Figure 8 It is a structural diagram of an embodiment of a computer-readable storage medium of the present application. DETAILED DESCRIPTION

[0017] The scheme of the embodiment of the present application is described in detail below in conjunction with the drawings of the specification.

[0018] In the following description, for the purpose of explanation rather than limitation, specific details such as specific system structures, interfaces, and technologies are provided to facilitate a thorough understanding of the present application.

[0019] The terms "system" and "network" are often used interchangeably in this article. The term "and / or" in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship. In addition, "many" in this article means two or more than two.

[0020] See also Figure 1 , Figure 1 1 is a flow chart of an embodiment of a defect detection method of the present application. The defect detection method in this embodiment includes the following steps:

[0021] S11: Acquire a basic image about the surface of the target object.

[0022] The target object of the present application may be steel, circuit boards, glass or other products that require surface defect detection. Taking the target object including rails as an example, the surface condition of the rails is collected to form a basic image of the rail surface; it is understandable that in the basic image of the rail surface, irrelevant background always occupies a considerable part of the basic image, while the rail surface only occupies a part of the basic image. If the entire basic image is processed directly, the defect detection time will be too long. Therefore, after obtaining the basic image of the rail surface, it can be pre-processed to remove the irrelevant part, thereby greatly improving the subsequent defect detection speed.

[0023] S12: performing pre-segmentation processing on the basic image to obtain a pre-segmentation result including the centroid coordinates of the connected domain.

[0024] Please combine Figure 2 , Figure 2 yes Figure 1 Schematic diagram of a flow chart of an embodiment of step S12. In one embodiment, the above step S12 specifically includes:

[0025] S121: Pre-segment the basic image using an image segmentation model to obtain a binary image containing defects and false positive interference items.

[0026] S122: using a connected domain analysis algorithm to obtain a set of connected domains, and calculating the centroid coordinates of each connected domain.

[0027] It can be understood that by inputting the basic image of the rail surface into the image segmentation model for pre-segmentation processing, a binary image of the rail surface can be obtained, and then the binary image analysis can be performed, such as using a connected domain analysis algorithm to mark the connected domain of the target in the binary image, and by marking the white pixels (targets) in the binary image, each individual connected domain forms a marked block, and further geometric parameters such as the centroid coordinates of these blocks can be obtained, that is, the pre-segmentation result containing the centroid coordinates of the connected domain can be obtained. Since the binary image contains true positive defects and false positive interference items on the rail surface, the pre-segmentation result contains true positive defects and false positive interference items on the rail surface.

[0028] Specifically, the basic image of the rail surface is input into the image segmentation model, and the pre-segmentation result containing the true positive defects and false positive interference items of the rail surface can be obtained to obtain the binary image Binary_GMM. Then, the fast connected domain analysis algorithm can be used to extract the connected domain set Blob={blob_1,blob_2,…,blob_n} from the binary image Binary_GMM, and then the centroid coordinates Circle={c1,c2,…,cn} of each single connected domain can be solved, where the i-th centroid ci is a data pair structure, that is, ci=(xi,yi), where xi is the horizontal coordinate of the centroid ci, and yi is the vertical coordinate of the centroid ci.

[0029] S13: using the surface defect prediction model to predict the basic image and obtain a rectangular region of interest of the defect.

[0030] While the basic image of the rail surface is pre-segmented, the surface defect prediction model can be used to predict the target of the basic image to obtain the position of the target object. Since the defect is the target object, the rectangular region of interest of the defect on the rail surface can be obtained.

[0031] Specifically, by inputting the basic image of the rail surface into the surface defect prediction model, the range of the area of ​​interest of the defects on the rail surface can be obtained, and a set of rectangular boxes for predicting defect positions Rectangle = {rect_1, rect_2, ..., rect_m} is obtained, where the j-th rectangular box rect_j is a data tuple rect_j = (xj, yj, wj, hj), where xj and yj are the horizontal and vertical coordinates of the upper left corner of the rectangular box, and wj and hj are the length and width of the rectangular box.

[0032] S14: based on the correspondence between the pre-segmentation result and the rectangular region of interest of the defect, screen out true positive defects on the surface of the target object.

[0033] Specifically, according to the results outputted respectively in steps S12 and S13, namely, the pre-segmentation result of the centroid coordinate set Circle of the simply connected domain and the rectangular frame set Rectangle of the predicted defect position, the discrimination rules of the centroid coordinate set Circle and the rectangular frame set Rectangle can be used to judge whether the binary connected domain in the pre-segmentation result hits the rectangular frame of the predicted defect position, thereby screening out the true positive defects on the rail surface, thereby excluding false positive interferents and obtaining the true positive defect set Defect.

[0034] The above scheme can obtain both the pre-segmentation result of the image and the positioning information of the target object by adopting a dual-path parallel detection method for the basic image of the surface of the target object, wherein the target object is a defect, and its positioning information is a rectangular region of interest. Based on the correspondence between the pre-segmentation result and the rectangular region of interest of the defect, the true positive defects on the surface of the target object can be screened out by using corresponding discrimination rules, thereby eliminating false positive interferents and making the detection of defects on the surface of the target object more accurate.

[0035] In one embodiment, the above step S14 specifically includes: based on the pre-segmentation result and the rectangular region of interest of the defect, screening out a connected domain whose centroid coordinates are within any rectangular region of interest as a true positive defect on the surface of the target object.

[0036] It can be understood that since step S12 obtains the pre-segmentation result of the centroid coordinate set Circle containing the simply connected domain, and the pre-segmentation result contains true positive defects and false positive interference items on the rail surface, and step S13 obtains the rectangular frame set Rectangle of the predicted defect position, therefore, if the centroid coordinate of a simply connected domain in the pre-segmentation result is located within the rectangular frame, the simply connected domain can be considered as a true positive defect object, thereby excluding false positive interference objects.

[0037] Specifically, the screening rules for true positive defects are: |ci.x-rect_j.x|<=rect_j.w and |ci.y-rect_j.y|<=rect_j.h. Among them, ci.x is the horizontal coordinate of the centroid of the i-th simply connected domain, ci.y is the vertical coordinate, rect_j.x is the horizontal coordinate of the j-th rectangular box, rect_j.y is the vertical coordinate, rect_j.w and rect_j.h are the length and width of the j-th rectangular box respectively. Therefore, by traversing i=1,2,...,n and j=1,2,...,m, if the screening rules are met, the i-th simply connected domain can be determined to be a true positive defect.

[0038] Furthermore, the image segmentation model of the present application is obtained by improving the Gaussian mixture model using the Markov random field. In one embodiment, before the above step S121, the defect detection method further includes obtaining the image segmentation model, which may specifically include:

[0039] S1201: Introduce Markov random field to perform spatial constraints on the Gaussian mixture model to obtain an initial image segmentation model.

[0040] As a sample clusterer, the Gaussian mixture model segments (clusters) an image consisting of N pixels into K clusters, where the probability density of a pixel xi is expressed as:

[0041]

[0042] Among them, φ(x i |Θ j ) is the Gaussian distribution of the mixed component, Θ j ={μ j ,∑ j}, j = {1, 2, ..., K}, μ j is the vector mean, ∑ j is the covariance matrix, ∏={π ij}, i = {1, 2, ..., N}, j = {1, 2, ..., K} is the data set of the prior distribution. The prior term is the pixel point x i In the label Ω j The probability model on satisfies the following constraints:

[0043]

[0044] According to Bayes' rule, the posterior probability (also called the conditional expectation of the latent variable in the expectation maximization algorithm for the mixed model) is defined as follows:

[0045]

[0046] Where t is the number of iterations of the expectation maximization algorithm, π ij (t) is the pixel x at the tth iteration i In the label Ω j The prior distribution on φ(x i |Θ j ) (t) is the pixel x at the tth iteration i In the label Ω j The goal of the expectation maximization algorithm iteration is to solve the parameters {Π, Θ} of the mixture model.

[0047] Since the Gaussian mixture model assumes that each pixel x of the two-dimensional imagei , i = {1, 2, ..., N} is independent of neighboring pixels and their label values ​​Ω j , j = {1, 2, ..., K} and j ≠ i, which causes the Gaussian mixture model to ignore the spatial correlation between adjacent pixels, and thus is extremely insensitive to complex scenes of illumination or noise in image segmentation applications. Therefore, the present application spatially constrains the Gaussian mixture model by introducing a Markov random field, thereby obtaining an initial image segmentation model.

[0048] Specifically, the prior distribution of the Gaussian mixture model can be constrained by Markov distribution, that is, adding constraints to the above prior terms, namely Markov distribution, to merge the spatial information between label values, thereby solving the deficiency of the traditional Gaussian mixture model that ignores the spatial correlation of adjacent pixels and enhancing the noise robustness of image segmentation. The definition of Markov distribution is as follows:

[0049]

[0050] Among them, ∏={π ij}, i = {1,2,...,N}, j = {1,2,...,K} is the data set of the prior distribution, Z is the normal constant, T is the temperature constant, and U(Π) is the smoothing prior term.

[0051] It should be noted that different forms of smooth prior terms U(Π) will directly determine different types of mixture models, which is conducive to overcoming the disadvantage of the traditional Gaussian mixture model of ignoring the correlation between adjacent pixels, but on the other hand, it will increase the computational complexity of model optimization. To this end, this application defines a new smooth prior term U(Π), which is as follows:

[0052]

[0053] Among them, t is the number of iterations of the expectation maximization algorithm, G ij (t) is the parameter factor, π ij (t+1) is the neighborhood pixel x at the t+1th iteration i In the label Ω j It can be found that in a certain iteration, for example, in the t+1 iteration step, the smoothing prior term U(Π) is proportional to the prior distribution π ij (t+1) The derivative of ij (t+1) That is, when performing iterative optimization, the smoothing prior term is related to the prior distribution; therefore, for the image segmentation model of this application, the expectation maximization algorithm can be directly applied to the prior distribution π ijThe optimization solution can reduce the extra calculation amount in the maximization stage and enhance the real-time performance of image segmentation applications.

[0054] In addition, this application introduces a new parameter factor G ij To define the smooth prior term U(Π) in the Markov distribution, it is described as the product of the posterior probability and the prior distribution. Specifically, for a pixel x i ,i={1,2,...,N} in the label Ω j , parameter factor G on j = {1,2,...,K} ij Through its neighborhood The posterior probability z of all pixels in (including the pixel itself) mj , and the prior distribution π mj , To implement this definition, the pixel x i ,i={1,2,...,N} in the label Ω j , parameter factor G on j = {1,2,...,K} ij It is related to the posterior probability and prior distribution of all pixels in the neighborhood of the pixel. It should be noted that this definition directly determines that the image segmentation model of this application is conducive to the merging of local spatial information, thereby enhancing the spatial correlation between adjacent pixels and the noise robustness of image segmentation applications. Parameter factor G ij The expression is as follows:

[0055]

[0056] Among them, z mj (t-1) is the neighborhood pixel x at the t-1th iteration m In the label Ω j The posterior probability, π mj (t-1) is the neighborhood pixel x at the t-1th iteration m In the label Ω j The prior distribution of , β is the temperature coefficient of the control smoothing prior term, is the neighborhood of the ith pixel including itself, N i Is a neighborhood In one embodiment, a 5×5 window may be used, where N i =25. ij (t) It only depends on the numerical values ​​of the prior distribution and the posterior probability in the t-1th iteration, so the above smooth prior term U(Π) is about the prior distribution π ij (t+1) The derivative of is only related to πij (t+1) term, and the parameter factor G ij (t) Therefore, for the image segmentation model of the present application, the expectation maximization algorithm can be used to directly solve the prior distribution, thereby enhancing the real-time performance of the image segmentation application.

[0057] S1202: Iteratively optimize the initial image segmentation model using an expectation-maximization algorithm to obtain a final image segmentation model.

[0058] The expectation maximization algorithm is a maximum likelihood estimation solution for a mixture model with hidden variables. Its essence is to optimize the parameter set {Π, Θ} to maximize the objective function J(Π, Θ|X). The expression of the existing objective function is:

[0059]

[0060] Where X is the pixel point set X = (x1, x2, ..., x N ), z ij is the conditional expectation or posterior probability of the latent variable, and the normal constant Z and temperature constant T are both set to 1.

[0061] Consider that after t+1 iterations, when the differential equation Then after t+1 iterations μ j Get the minimum value:

[0062]

[0063] Consider that after t+1 iterations, when the differential equation Then after t+1 iterations Get the minimum value:

[0064]

[0065] Consider that after t+1 iterations, when the differential equation Then after t+1 iterations π ij Get the minimum value:

[0066]

[0067] Finally, when the model parameters {μ j ,∑ j ,π ij}After completing parameter convergence, the final image segmentation model is obtained.

[0068] Then, the final image segmentation model can be used for image segmentation application, where the image segmentation application is described as each pixel xi In the final image segmentation model, it will be assigned to satisfy the maximum posterior probability z ij Tags of Ω j , expressed as follows:

[0069] x i ∈Ω j :IF z ij ≥z ik j,k={1,2,...,K} (11)

[0070] In an application scenario, the image segmentation model can implement the image segmentation application through the following pseudo code:

[0071]

[0072]

[0073] Using the image segmentation model of the present application to perform image pre-segmentation has stronger noise robustness, faster calculation speed, and greater granularity of object edge segmentation.

[0074] Please combine Figure 3 , Figure 3 It is a schematic diagram comparing the segmentation results of different rail images using the image segmentation model of the present application and other models. Figure 3 The comparative results of several advanced hybrid models and the image segmentation model of the present application on different rail images are shown in the figure, wherein letters af represent rail images I-VI, and numbers 1-9 represent different models, i.e. (a1-a9) are image I, (b1-b9) are image II, (c1-c9) are image III, (d1-d9) are image IV, (e1-e9) are image V, and (f1-f9) are image VI; (a1-f1) are the input base images, (a2-f2) are the true labels (GT), (a3-f3) are the K-means models, (a4-f4) are the Gaussian mixture models, (a5-f5) are the spatially variant finite mixture models (SVFMM), (a6-f6) are the simulated field models (SIMF), and (a7-f7) are the mean field models (Mean). field, MEANF), (a8-f8) is the Student-T hybrid model, and (a9-f9) is the image segmentation model of the present application. It can be found that the image segmentation model of the present application is used to pre-segment the input basic image (a1-f1), and the accuracy between the obtained pre-segmentation result (a9-f9) and the real label of the image (a2-f2) is high, which verifies the effectiveness of the image segmentation model of the present application.

[0075] Further, the surface defect prediction model of the present application is obtained by improving the YOLOv3 network based on the residual pyramid pooling network. In one embodiment, based on the YOLOv3 network and combined with the residual pyramid pooling network, the surface defect prediction model of the present application is constructed, so the surface defect prediction model of the present application includes a feature extraction module and a prediction output module. At the input port of the model, the basic image of the rail surface is used as the input layer (0 layer) of the surface defect prediction model, and then in the feature extraction module, i.e., the residual pyramid pooling network, multi-scale feature extraction is realized, and then the prediction result is obtained after passing through the prediction output module.

[0076] Specifically, the surface defect prediction model may include several convolutional layers, residual integrated blocks, shortcut layers, BN layers and yolo layers. In one embodiment, the surface defect prediction model includes a total of 110 layers (starting from layer 0), of which 55 are convolutional layers, 16 are residual integrated blocks, 16 are shortcut layers, 35 are BN layers, and 4 are yolo layers. At the input port, the basic image of the rail surface is scaled to 448*448*3 as the input layer (0 layer) of the model, and then multi-scale feature extraction is implemented in the feature extraction module; after entering the prediction output module, the first yolo layer output is performed on the 103th layer with an output dimension of 28*28*512, and the second yolo layer output is performed on the 104th layer with an output dimension of 28*28*512. Similarly, the third yolo layer output is performed on the 105th layer with an output dimension of 14*14*512, and the fourth yolo layer output is performed on the 106th layer with an output dimension of 7*7*512. The convolutional layers of this embodiment mainly use 1*1 and 3*3 convolution kernels. The purpose of using the 1*1 convolutional layer is to change the number of channels to reduce the number of parameters, and the purpose of using the 3*3 convolutional layer is feature mapping; the residual integrated block uses the bottleneck structure of the residual network ResNet, and the shortcut layer uses the shortcut connection method of the residual network ResNet to fuse the head and tail features of the three convolutional layers across the bottleneck to reduce the training difficulty of the deep network and improve the prediction accuracy; the yolo layer uses the yolo prediction method of the YOLO v3 network to output the horizontal and vertical coordinates, length and width scales, and category confidence of the target rectangular box.

[0077] In one embodiment, the feature extraction module, i.e., the order of some layers of the residual pyramid pooling network, may be: input layer [448, 448, 3], convolution layer [224, 224, 64], BN layer, convolution layer [224, 224, 64], BN layer, convolution layer [224, 224, 64], BN layer, residual integrated block #1 {convolution layer [224, 224, 64], BN layer, convolution layer [112, 112, 64], convolution layer [112, 112, 256], BN layer}, residual integrated block #2 {convolution layer [112, 112, 128], BN layer, convolution layer [56, 56, 1 28], convolutional layer [56, 56, 512], BN layer}, residual integrated block #3 {convolutional layer [56, 56, 256], BN layer, convolutional layer [28, 28, 256], convolutional layer [28, 28, 1024], BN layer}, residual integrated block #4 {convolutional layer [28, 28, 512], BN layer, convolutional layer [28, 28, 512], convolutional layer [28, 28, 1024], BN layer}, pyramid pooling (4-way) layer {convolutional layer [28, 28, 512], convolutional layer [14, 14, 512], convolutional layer [7, 7, 512], convolutional layer [1, 1, 512]}.

[0078] Using the surface defect prediction model of the present application to locate the target object, deep learning technology has better real-time performance and higher accuracy.

[0079] See also Figure 4 , Figure 4 1 is a flow chart of another embodiment of the defect detection method of the present application. The defect detection method in this embodiment includes the following steps:

[0080] S41: Acquire a basic image about the surface of the target object.

[0081] S42: Pre-segment the basic image to obtain a pre-segmentation result including the centroid coordinates of the connected domain.

[0082] S43: Use the surface defect prediction model to predict the basic image to obtain a rectangular region of interest of the defect.

[0083] S44: based on the correspondence between the pre-segmentation result and the rectangular region of interest of the defect, screen out true positive defects on the surface of the target object.

[0084] Steps S41 to S44 in this embodiment are substantially similar to steps S11 to S14 in the previous embodiment of the defect detection method of the present application, and are not described in detail here.

[0085] S45: Obtain the minimum bounding rectangle of the connected component of the true positive defect, and determine the defect type of the true positive defect based on the size relationship between the aspect ratio of the minimum bounding rectangle and a preset threshold.

[0086] For the set of true positive defects Defect, the minimum bounding rectangle of the k-th true positive defect can be calculated to obtain its aspect ratio value p_k. Then, according to the size relationship between the aspect ratio of the minimum bounding rectangle and the preset threshold, the defect type of this true positive defect can be determined. In one embodiment, a first preset threshold T1 = 2.5 and a second preset threshold T2 = 5 can be set; if the condition 1 <= p_k < T1 is satisfied, it is considered that the k-th true positive defect belongs to the collapse type; if the condition T1 <= p_k < T2 is satisfied, it is considered that the k-th true positive defect belongs to the side wear type; if the condition p_k >= T2 is satisfied, it is considered that the k-th true positive defect belongs to the crack type.

[0087] In the above method, by calculating the minimum bounding rectangle of the binary connected component of the true positive defect and using the scale feature and the discriminant condition of setting the preset threshold, the defect type can be mined, and the functionality is better.

[0088] Please combine Figure 5 , Figure 5It is a schematic diagram of the processing flow of an application scenario of the defect detection method of this application. In an application scenario, a defect detection device is used to detect defects on the surface of a steel rail. First, a sequence of steel rail images Seq = {Img_i, 1 <= i <= T} is input; then, for the i-th frame image Img_i, on the one hand, an improved Gaussian mixture model based on a Markov random field is used for image pre-segmentation to obtain a binary image Binary_GMM containing defects on the steel rail surface and false positive interference terms, and then a connected component analysis algorithm of the binary image is used to obtain a set of connected regions Blob = {blob_1, blob_2,..., blob_n}, and then the centroid coordinates Circle = {c1, c2,..., cn} of each simply connected region are solved. On the other hand, an improved YOLO v3 model based on a residual pyramid pooling network is used to predict the rectangular frame of the target to obtain the localization information of the defects on the steel rail surface, and then a set of rectangular frames Rectangle = {rect_1, rect_2,..., rect_m} of the detection object is extracted, where each rectangular frame contains parameters: horizontal and vertical coordinates x, y and length and width values w, h. Then, it is judged whether the centroid of the connected region is within the predicted rectangular frame, that is, it is judged whether |ci.x - rect_j.x| <= rect_j.w and |ci.y - rect_j.y| <= rect_j.h hold, where ci.x is the abscissa of the centroid of the i-th simply connected region, ci.y is the ordinate, rect_j.x is the abscissa of the j-th rectangular frame, rect_j.y is the ordinate, and rect_j.w and rect_j.h are the length and width values of the j-th rectangular frame respectively; if it holds, it is judged that the binary connected region ci is a true positive steel rail defect, the minimum circumscribed rectangle of the convex polygon contour is obtained, and the ratio p of the length and width of the minimum circumscribed rectangle is calculated. A first preset threshold T1 and a second preset threshold T2 are set; the size of the ratio p and the preset threshold are judged. If the condition 1 <= p < T1 is satisfied, it is considered that the true positive defect ci belongs to collapse; if the condition T1 <= p < T2 is satisfied, it is considered that the true positive defect ci belongs to side wear; if the condition p >= T2 is satisfied, it is considered that the true positive defect ci belongs to crack.

[0089] Please refer to Figure 6 , Figure 6 is a schematic structural diagram of an embodiment of the defect detection device of this application. The defect detection device 60 in this embodiment includes a processor 600 and a memory 602 that are connected to each other; the memory 602 is used to store program instructions, and the processor 600 is used to execute the program instructions to implement the steps of the defect detection method in any of the above embodiments.

[0090] Please refer to Figure 7 , Figure 7It is a structural schematic diagram of another embodiment of the defect detection device of the present application. The defect detection device 70 in this embodiment includes: an image acquisition module 700, which is used to acquire a basic image about the surface of the target object; a pre-segmentation module 702, which is used to perform pre-segmentation processing on the basic image and obtain a pre-segmentation result containing the centroid coordinates of the connected domain; a target prediction module 704, which is used to predict the basic image using a surface defect prediction model and obtain a rectangular region of interest of the defect; a defect screening module 706, which is used to screen out true positive defects on the surface of the target object based on the correspondence between the pre-segmentation result and the rectangular region of interest of the defect.

[0091] In addition, each functional module in the defect detection device 70 can also be used to implement the steps of the defect detection method in any of the above embodiments.

[0092] For specific contents of the defect detection method implemented by the defect detection device of the present application, please refer to the contents in the above-mentioned defect detection method embodiment, which will not be repeated here.

[0093] See also Figure 8 , Figure 8 The computer-readable storage medium 80 of the present application stores program instructions 800 thereon, and when the program instructions 800 are executed by a processor, the steps in any of the above-mentioned defect detection method embodiments are implemented.

[0094] The computer-readable storage medium 80 may specifically be a medium that can store the program instructions 800, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, or may be a server that stores the program instructions 800. The server may send the stored program instructions 800 to other devices for execution, or may execute the stored program instructions 800 by itself.

[0095] In the several embodiments provided in the present application, it should be understood that the disclosed methods, devices and apparatuses can be implemented in other ways. For example, the above-described device and apparatus implementation methods are merely schematic. For example, the division of 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.

[0096] 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 present embodiment.

[0097] In addition, each functional unit in each embodiment of the present application 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.

[0098] If the integrated 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 technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) or a processor (processor) to perform all or part of the steps of each implementation method of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program code.

Claims

1. A defect detection method, It is characterized in that The method comprises: Acquire a basic image about the surface of the target object; Performing pre-segmentation processing on the basic image to obtain a pre-segmentation result including the centroid coordinates of the connected domain; wherein the pre-segmentation result includes defects and false positive interference items; Using a surface defect prediction model to predict the basic image, obtaining a rectangular region of interest of the defect; According to the pre-segmentation result and the rectangular region of interest of the defect, a connected domain whose centroid coordinates are within any rectangular region of interest is screened out as a true positive defect on the surface of the target object; The pre-segmentation process is performed by an image segmentation model, which is obtained by iteratively optimizing the initial image segmentation model using the expectation maximization algorithm; the initial image segmentation model is obtained by subjecting the prior distribution of the Gaussian mixture model to Markov distribution constraints, and the Markov distribution is: Among them, ∏={π ij }, i = {1, 2, ..., N}, j = {1, 2, ..., K} is the data set of the prior distribution, Z is the normal constant, T is the temperature constant, and U(Π) is the smoothing prior term; When performing iterative optimization, the smoothing prior term is related to the prior distribution; Wherein, the smoothing prior term is: Among them, t is the number of iterations of the expectation maximization algorithm, G ij (t) is the parameter factor, pixel x i ,i={1,2,...,N} in the label Ω j , parameter factor G on j = {1,2,...,K} ij Related to the posterior probability and prior distribution of all pixels in the neighborhood of the pixel, π ij (t+1) is the neighborhood pixel x at the t+1th iteration i In the label Ω j The prior distribution of .

2. The method according to claim 1, It is characterized in that The step of performing pre-segmentation processing on the basic image to obtain a pre-segmentation result including the centroid coordinates of the connected domain comprises: The basic image is pre-segmented by using the image segmentation model to obtain a binary image containing defects and false positive interference items; The connected domain analysis algorithm is used to obtain the set of connected domains, and the centroid coordinates of each connected domain are calculated.

3. The method according to claim 2, It is characterized in that The image segmentation model is obtained by improving the Gaussian mixture model using Markov random field; Before the step of using the image segmentation model to pre-segment the basic image to obtain a binary image containing defects and false positive interference items, the method includes: The Markov random field is introduced to constrain the Gaussian mixture model spatially, and the initial image segmentation model is obtained; The initial image segmentation model is iteratively optimized using an expectation maximization algorithm to obtain a final image segmentation model.

4. The method according to claim 3, It is characterized in that The step of introducing a Markov random field to perform spatial constraints on the Gaussian mixture model to obtain an initial image segmentation model includes: The prior distribution of the Gaussian mixture model is subjected to Markov distribution constraints to obtain the initial image segmentation model.

5. The method according to claim 1, It is characterized in that The parameter factors are: Among them, z mj (t-1) is the neighborhood pixel x at the t-1th iteration m In the label Ω j The posterior probability, π mj (t-1) is the neighborhood pixel x at the t-1th iteration m In the label Ω j The prior distribution of , β is the temperature coefficient of the control smoothing prior term, is the neighborhood of the ith pixel including itself, N i Is a neighborhood The total number of pixels within.

6. The method according to claim 1, It is characterized in that The surface defect prediction model is obtained by improving the YOLOv3 network based on the residual pyramid pooling network; The surface defect prediction model includes several convolutional layers, residual integrated blocks, shortcut layers, BN layers and yolo layers.

7. The method according to claim 1, It is characterized in that After the step of screening out true positive defects on the surface of the target object based on the correspondence between the pre-segmentation result and the rectangular region of interest of the defect, the method further comprises: The minimum bounding rectangle of the connected domain of the true positive defect is obtained, and the defect type of the true positive defect is determined based on the relationship between the aspect ratio of the minimum bounding rectangle and a preset threshold.

8. A defect detection device, It is characterized in that The defect detection device comprises a processor and a memory connected to each other, the memory is used to store program instructions, and the processor is used to execute the program instructions to implement the method according to any one of claims 1-7.

9. A computer-readable storage medium, It is characterized in that Program instructions are stored thereon, and when the program instructions are executed by a processor, the method according to any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • Carotid ultrasound image intima media thickness measurement method and system thereof

    CN106485203A

  • Image processing based cable semi-conductive layer automatic detection method

    CN108846397A

  • ''Dessert'' probability direct estimation method and system based on prestack inversion

    CN110208858A

  • Fabric defect detection method based on deep convolutional neural network and visual saliency

    WO2019104767A1