A torsion spring quality detection method based on convolutional neural network

By analyzing the texture richness and light spot of the torsion spring feature image, calculating the importance of pooling, and generating a pooled torsion spring image, the problem of insufficient feature extraction capability and illumination influence of the convolutional neural network in torsion spring image detection is solved, and the improvement is improved improve detection accuracy.

CN118334023BActive Publication Date: 2024-08-23SHENZHEN XUNCE TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410756648.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-13
Publication Date
2024-08-23
Estimated Expiration
2044-06-13

AI Technical Summary

Technical Problem

Maximum pooling of existing convolutional neural networks in torsion spring image quality detection may lead to insufficient feature extraction capabilities, and illumination noise affects resolution and reduces detection accuracy.

Method used

By analyzing the texture richness and suspected light spot degree of the pixels of the torsion spring feature image, combined with the texture blur and protrusion, the pooling importance is calculated, and the pooled torsion spring image is generated to improve feature extraction capabilities and reduce the impact of lighting.

Benefits of technology

The resolution enhancement quality of torsion spring characteristic images is improved, the accuracy of torsion spring quality detection is improved, and light interference is avoided.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118334023B
    Figure CN118334023B
Patent Text Reader

Abstract

The present invention relates to the technical field of torsion spring image defect detection, and specifically to a torsion spring quality detection method based on a convolutional neural network. The present invention obtains a torsion spring characteristic image; obtains the texture richness according to the texture distribution within a preset neighborhood range of a target pixel; fits the grayscale values ​​of the pixels within the preset neighborhood range of the target pixel to obtain a grayscale fitting value; and combines the grayscale distribution difference with the grayscale discreteness of the pixel to obtain the suspected light spot degree; combines with the texture richness to obtain the pooling importance; and then obtains the pooling importance coefficient of the target pixel, weights the pixel to obtain the pooling output result; and performs torsion spring quality detection according to the pooling output result. The present invention improves the feature extraction capability of the torsion spring characteristic image, avoids the adverse effects of illumination, and improves the quality of image resolution enhancement, thereby making the quality detection of the torsion spring more accurate.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of torsion spring image defect detection, and in particular to a torsion spring quality detection method based on a convolutional neural network. Background Art

[0002] In the connector contact, the torsion spring can provide appropriate contact pressure to ensure good contact during the plugging and unplugging process of the connector, and can maintain a stable electrical connection in a shock or vibration environment. The torsion spring can also provide mechanical stability for the connector, providing a certain tension or pressure inside the connector, making the plugging and unplugging process of the connector more stable, and reducing looseness or disconnection caused by external forces. If the torsion spring has quality defects, it may suddenly break or deform, causing equipment damage and safety accidents.

[0003] In the prior art, convolutional neural networks are often used to provide high-resolution torsion spring images, and then obtain the most significant feature information of the torsion spring images, so as to perform quality inspection of the torsion springs. In this process, the convolutional neural network is used to obtain the torsion spring feature image and perform maximum pooling on the torsion spring feature image to retain the most significant torsion spring feature detail information. However, in actual situations, maximum pooling may cause the convolutional neural network to pay too much attention to the maximum grayscale value in the image, resulting in insufficient feature extraction capabilities for the torsion spring feature image, and the light spot generated by the illumination will be magnified under the action of maximum pooling, reducing the quality of the torsion spring feature image resolution enhancement, thereby affecting the accuracy of torsion spring quality inspection. Summary of the invention

[0004] In order to solve the technical problem that maximum pooling may lead to insufficient feature extraction ability of torsion spring feature images, and the light spot generated by illumination will be amplified under the action of maximum pooling, reducing the quality of resolution enhancement of torsion spring feature images, thereby affecting the accuracy of quality detection of torsion springs, the purpose of the present invention is to provide a torsion spring quality detection method based on convolutional neural network, and the technical scheme adopted is as follows:

[0005] A torsion spring quality detection method based on convolutional neural network, the method comprising:

[0006] Convolution is performed on the original torsion spring image based on a convolutional neural network to obtain characteristic images of all torsion springs;

[0007] Select any pixel point of a torsion spring feature image as a target pixel point; select any pixel point within a preset neighborhood range of the target pixel point as a neighborhood pixel point; obtain the texture richness of the target pixel point according to the texture distribution characteristics of the target pixel point within the preset neighborhood range;

[0008] A normal distribution fitting is performed on the grayscale value of each neighborhood pixel to obtain the grayscale fitting value of the corresponding neighborhood pixel; the suspected light spot degree of the target pixel is obtained according to the similarity between the grayscale value distribution of all neighborhood pixels and the grayscale fitting value distribution, as well as the grayscale discreteness of the neighborhood pixels;

[0009] According to the texture richness of the target pixel and the suspected light spot degree, the pooling importance of the target pixel is obtained; according to the pooling importance of all neighboring pixels, the pooling output result of the target pixel is obtained; according to the pooling output results of all pixels in each torsion spring feature image, a pooled torsion spring image is obtained;

[0010] The quality of the torsion spring is inspected based on all pooled torsion spring images.

[0011] Furthermore, the method for obtaining the texture richness includes:

[0012] Obtaining corresponding texture feature vectors of all the neighborhood pixels;

[0013] According to the overall change degree of texture features within the preset neighborhood range of the target pixel point, the neighborhood texture distribution features of the target pixel point are obtained;

[0014] According to the difference between the texture feature vector of the target pixel and the texture feature vectors of all neighboring pixels, the texture blurring degree and texture prominence degree of the target pixel are obtained;

[0015] The texture richness of the target pixel is obtained according to the neighborhood texture distribution characteristics, the texture blurring degree and the texture prominence degree; the texture richness is positively correlated with the neighborhood texture distribution characteristics and the texture prominence degree; the texture richness is negatively correlated with the texture blurring degree.

[0016] Furthermore, the method for acquiring the neighborhood texture distribution feature includes:

[0017] Calculate the average value of all texture feature vectors within the preset neighborhood of the target pixel point as the neighborhood overall texture feature vector; calculate the range between the texture feature vectors within the preset neighborhood of the target pixel point as the neighborhood maximum change feature vector;

[0018] The norm of the sum vector between the neighborhood overall texture feature vector and the neighborhood maximum change feature vector is used as the neighborhood texture distribution feature of the target pixel point.

[0019] Furthermore, according to the difference between the texture feature vector of the target pixel and the texture feature vectors of all neighboring pixels, the texture blurring degree and texture prominence degree of the target pixel are obtained, including:

[0020] A first pixel point group and a second pixel point group are obtained according to the difference of the texture feature vectors of the neighborhood pixel points; the modulus of the texture feature vector of each pixel point in the first pixel point group is greater than the modulus of the texture feature vector of each pixel point in the second pixel point group;

[0021] Averaging the difference between the norm of the texture feature vector of the target pixel and the norm of the texture feature vector of each pixel in the first pixel group to obtain the texture blur degree of the target pixel;

[0022] The difference between the norm of the texture feature vector of the target pixel point and the norm of the texture feature vector of each pixel point in the second pixel point group is averaged to obtain the texture prominence degree of the target pixel point.

[0023] Furthermore, the method for obtaining the grayscale fitting value includes:

[0024] The grayscale value of each neighborhood pixel is fitted with a normal distribution using the least squares method to obtain the grayscale fitting value of the corresponding neighborhood pixel.

[0025] Furthermore, the method for obtaining the degree of the suspected light spot includes:

[0026] According to the difference between the grayscale value and the grayscale fitting value of the pixel point within the preset neighborhood of the target pixel point and the texture distribution, the possibility of the suspected light spot of the target pixel point is obtained;

[0027] The inverse of the standard deviation of the grayscale values ​​of the pixels within the preset neighborhood is used as the grayscale diffusion degree of the target pixel;

[0028] According to the suspected light spot possibility and the grayscale diffusion obvious degree, the suspected light spot degree of the target pixel point is obtained; the suspected light spot degree is positively correlated with the suspected light spot possibility and the grayscale diffusion obvious degree.

[0029] Furthermore, the method for obtaining the possibility of the suspected light spot includes:

[0030] In the preset neighborhood range of the target pixel point, the difference between the grayscale value of each pixel point and the grayscale fitting value is calculated, and the ratio between the difference and the texture richness of each pixel point is used as the spot difference degree of each pixel point in the preset neighborhood range;

[0031] The difference degree of the light spot of each pixel in the preset neighborhood is averaged and negatively correlated to obtain the possibility of the suspected light spot of the target pixel.

[0032] Furthermore, the method for obtaining the pooling importance includes:

[0033] The suspected light spot degree of the target pixel is negatively correlated and mapped, and the product of the suspected light spot degree and the texture richness is used as the pooling importance of the target pixel.

[0034] Furthermore, the method for obtaining the pooled torsion spring image includes:

[0035] In a preset neighborhood range, the pooling importance of each pixel is calculated; the ratio between the pooling importance of the target pixel and the sum of the pooling importance of the pixels in the preset neighborhood range is used as the pooling importance coefficient of the target pixel.

[0036] The product of the pooling importance coefficient and the gray value of the target pixel is used as the pooling output result of the target pixel;

[0037] The target pixel point is changed to obtain all pooling output results in each of the torsion spring feature images; and all the pooling output results are used as the pooled torsion spring image.

[0038] Further, the quality of the torsion spring is detected according to the pooled torsion spring image, including:

[0039] The final torsion spring image corresponding to each pooled torsion spring image is obtained by the SRCNN algorithm, and defect detection is performed on the final torsion spring image.

[0040] The present invention has the following beneficial effects:

[0041] In order to obtain the defect characteristics that may exist in the torsion spring, the present invention first obtains the characteristic images of all torsion springs for subsequent analysis; since the quality of the torsion spring is determined by the bending condition of the torsion spring contour and the aperture size, which is reflected in the torsion spring characteristic image as the large difference in texture characteristics between adjacent pixels, the texture richness of the target pixel is obtained according to the texture distribution difference of the target pixel within the preset neighborhood range; since the light spot noise will interfere with the texture characteristics in the torsion spring characteristic image, and the characteristic of the light spot is that the grayscale value gradually decreases from the center to the surrounding area, the grayscale values ​​of the pixels within the preset neighborhood range are first fitted to make the preset neighborhood range The grayscale value of the pixel points within the range is similar to the grayscale value distribution of the spot area; the suspected spot degree of the target pixel point is obtained by analyzing the difference between the grayscale fitting value and the true grayscale value, and the grayscale discreteness within the preset neighborhood range; because the pooling process needs to retain the most significant features of the local area, and in order to exclude the influence of illumination, the texture richness of the target pixel point is combined with the suspected spot degree to obtain the pooling importance of the target pixel point; according to the pooling importance of each pixel point, the pooling output result of the target pixel point is obtained; according to the pooling output result of the target pixel point, the pooled torsion spring image is obtained; the torsion spring quality is detected according to the pooled torsion spring image. The present invention improves the feature extraction capability of the torsion spring feature image, avoids the adverse effects of illumination, improves the quality of image resolution enhancement, and thus makes the quality detection of the torsion spring more accurate. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] In order to more clearly illustrate the technical solutions and advantages in the embodiments of the present invention or the prior art, the drawings required for use in the embodiments or the prior art descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0043] Figure 1 A flow chart of a torsion spring quality detection method based on a convolutional neural network provided by an embodiment of the present invention;

[0044] Figure 2 An original torsion spring image provided by one embodiment of the present invention;

[0045] Figure 3 A flow chart of a method for obtaining texture richness provided by an embodiment of the present invention;

[0046] Figure 4 A flow chart of a method for obtaining a suspected light spot degree provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0047] In order to further explain the technical means and effects adopted by the present invention to achieve the predetermined invention purpose, the following is a detailed description of the specific implementation, structure, features and effects of a torsion spring quality detection method based on a convolutional neural network proposed by the present invention in combination with the accompanying drawings and preferred embodiments. In the following description, different "one embodiment" or "another embodiment" does not necessarily refer to the same embodiment. In addition, specific features, structures or characteristics in one or more embodiments may be combined in any suitable form.

[0048] Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs.

[0049] The specific scheme of a torsion spring quality detection method based on a convolutional neural network provided by the present invention is described in detail below with reference to the accompanying drawings.

[0050] See also Figure 1 , which shows a flow chart of a torsion spring quality detection method based on a convolutional neural network provided by an embodiment of the present invention, the method comprising:

[0051] Step S1: Convolve the original torsion spring image based on the convolutional neural network to obtain the characteristic images of all torsion springs.

[0052] The embodiment of the present invention is mainly used in the torsion spring image defect detection scenario, so the original torsion spring image is first obtained for subsequent processing. In order to detect the defects of the torsion spring, it is necessary to obtain the defect characteristics of the torsion spring. Since the convolutional neural network can highlight the characteristics of the torsion spring, in the embodiment of the present invention, the convolutional neural network is used to process the original torsion spring image. First, the torsion spring image is convolved to obtain the characteristic image of all torsion springs. The grayscale distribution of the pixels in the torsion spring characteristic image is used for subsequent pooling analysis to complete the correction of the pooling process by the convolutional neural network, and then obtain a high-resolution torsion spring image for quality inspection.

[0053] In one embodiment of the present invention, specifically Figure 2 The original torsion spring image shown in the figure is equipped with a CCD industrial high-definition camera for each torsion spring automated production line to obtain the corresponding original torsion spring image of each torsion spring; all the original torsion spring images are convolved to highlight the image feature information in each original torsion spring image. The convolution process includes: setting A convolution kernel of size is convolved on each original torsion spring image, and the depth of the convolution is set to 64, so as to obtain 64 torsion spring feature images corresponding to each original torsion spring image, wherein each torsion spring feature image corresponds to a different feature of the torsion spring.

[0054] In one embodiment of the present invention, a CNN algorithm is used for subsequent analysis. It should be noted that the CNN algorithm is a technical means well known to those skilled in the art and will not be limited or elaborated herein.

[0055] The embodiment of the present invention obtains all torsion spring feature images, obtains the pooling importance coefficient of each pixel point by analyzing the detail richness and the suspected light spot degree of each pixel point in each torsion spring feature image, and pools each torsion spring feature image according to the pooling importance coefficient to obtain a pooled torsion spring image, and performs torsion spring quality detection. Please refer to the following embodiment for the specific process.

[0056] Step S2: Select any pixel point of a torsion spring feature image as a target pixel point; select any pixel point within a preset neighborhood range of the target pixel point as a neighborhood pixel point; obtain the texture richness of the target pixel point based on the texture feature difference of the target pixel point within the preset neighborhood range.

[0057] Since the pooling layer of the neural network needs to retain the characteristics of the torsion spring as much as possible and reduce the interference of non-feature detail information on the torsion spring feature image, the texture features of each torsion spring feature image are analyzed. In the actual production process of torsion springs, the quality of the torsion springs is usually judged based on the bending condition of the torsion spring contour and the aperture size; because the traditional maximum pooling will over-focus on the local maximum grayscale value in the torsion spring feature image, it may lead to the neglect of the surrounding pixels that appear as image contours. Since the texture features of the pixels adjacent to the target pixel in the torsion spring feature image change greatly, and the texture features of the adjacent pixels are only similar to a small number of pixels in the torsion spring feature image, it may reflect that the target pixel is located at the texture edge of the torsion spring, so the texture feature distribution of the pixels within the preset neighborhood of the target pixel is analyzed; because the greater the difference in texture features between other pixels and the target pixel within the preset neighborhood, the richer the texture details of the target pixel within the preset neighborhood, and the more it can reflect that the target pixel represents the contour area of ​​the torsion spring in the torsion spring feature image, so in an embodiment of the present invention, the texture richness of the target pixel is obtained according to the texture feature difference of the target pixel within the preset neighborhood.

[0058] In one embodiment of the present invention, the preset neighborhood range is set to be centered on the target pixel point. It should be noted that the preset neighborhood range can be set by oneself and is not limited here.

[0059] See also Figure 3 , which shows a flow chart of a method for obtaining texture richness, the method comprising:

[0060] Step S201: Obtaining the corresponding texture feature vectors of all neighborhood pixels.

[0061] In one embodiment of the present invention, by Texture features are used to represent the corresponding texture feature vectors of all neighboring pixels. Texture features are well known to those skilled in the art and will not be described in detail here. It should be noted that in other embodiments of the present invention, other methods such as gray-level co-occurrence matrix may be used to represent the corresponding texture feature vectors of all neighborhood pixels. The above methods are well known to those skilled in the art and will not be limited or described in detail here.

[0062] Step S202: Obtaining neighborhood texture distribution features of the target pixel point according to the overall change degree of the texture features within a preset neighborhood range of the target pixel point.

[0063] The change of texture features within the preset neighborhood range can reflect whether there is an obvious change in the torsion spring texture within the preset neighborhood range, so the neighborhood texture distribution characteristics of the target pixel point are analyzed.

[0064] Preferably, in one embodiment of the present invention, the method for acquiring neighborhood texture distribution features includes:

[0065] Calculate the average value of all texture feature vectors within the preset neighborhood of the target pixel as the overall texture feature vector of the neighborhood; calculate the range between the texture feature vectors within the preset neighborhood of the target pixel as the neighborhood maximum change feature vector; that is, obtain the texture feature vector with the largest modulus and the texture feature vector with the smallest modulus within the preset neighborhood of the target pixel, and calculate the difference vector between the two as the neighborhood maximum change feature vector;

[0066] The norm of the sum vector between the neighborhood overall texture feature vector and the neighborhood maximum change feature vector is used as the neighborhood texture distribution feature of the target pixel. In one embodiment of the present invention, the neighborhood texture distribution feature calculation formula is as follows:

[0067] ;

[0068] In the formula, Represents the neighborhood texture distribution characteristics of the target pixel; Indicates the number of pixels within the preset neighborhood of the target pixel; Indicates the number of pixels within the preset neighborhood of the target pixel. Texture feature vector of pixels; Represents the texture feature vector with the largest modulus among the texture feature vectors of the pixels within the preset neighborhood of the target pixel; Represents the texture feature vector with the smallest modulus among the texture feature vectors of the pixels within the preset neighborhood of the target pixel; Represents the norm of a vector.

[0069] In the neighborhood texture distribution feature calculation formula, the overall texture feature vector within the preset neighborhood range of the target pixel is The larger the value, the richer the texture information in the neighborhood, that is, the richer the texture information of the target pixel; the maximum value of the texture feature vector in the preset neighborhood With minimum The difference vector between reflects the change of texture features. The larger the modulus of the difference vector, the more obvious the change of texture features within the preset neighborhood range, and the richer the texture information of the target pixel point. The maximum change eigenvector of the neighborhood The norm of the sum vector between is taken as the neighborhood texture distribution feature of the target pixel. The larger the neighborhood texture distribution feature, the richer the texture information of the target pixel.

[0070] Step S203: Obtain the texture blurring degree and texture prominence degree of the target pixel point according to the difference between the texture feature vector of the target pixel point and the texture feature vectors of all neighboring pixels points.

[0071] The first pixel point group and the second pixel point group are obtained according to the difference of the texture feature vectors of the neighborhood pixel points; the modulus of the texture feature vector of each pixel point in the first pixel point group is greater than the modulus of the texture feature vector of each pixel point in the second pixel point group. In one embodiment of the present invention, the maximum inter-class variance method is used to divide all the neighborhood pixel points into two pixel point groups by dividing the modulus of the texture feature vectors of all the neighborhood pixel points, wherein the pixel point group with a larger average modulus length is used as the first pixel point group, and the pixel point group with a smaller average modulus length is used as the second pixel point group, at this time, the texture feature vector of each pixel point in the first pixel point group is greater than the texture feature vector of each pixel point in the second pixel point group.

[0072] It should be noted that, in other embodiments of the present invention, the moduli of the texture feature vectors of all neighborhood pixels can be arranged from small to large to obtain a neighborhood pixel sequence, and the first half of the pixels in the neighborhood pixel sequence are selected to form a first pixel group, and the second half of the pixels are selected to form a second pixel group. At this time, the texture feature vector of each pixel in the first pixel group is greater than the texture feature vector of each pixel in the second pixel group.

[0073] The difference between the norm of the texture feature vector of the target pixel and the norm of the texture feature vector of each pixel in the first pixel group is averaged to obtain the texture blur degree of the target pixel; wherein the texture blur degree calculation formula is as follows:

[0074]

[0075] In the formula, Indicates the texture blur degree of the target pixel; Indicates the number of pixels in the first pixel group; Represents the texture feature vector of the target pixel; Indicates the first pixel point in the first pixel group Texture feature vector of pixels; represents the norm of a vector; Represents an exponential function with a natural constant as base.

[0076] In the texture blur calculation formula, the smaller the norm difference between the texture feature vector of the target pixel and the texture feature vector of each pixel in the first pixel group, the higher the similarity between the texture feature of the target pixel and the neighboring pixel with the most obvious texture feature, that is, the more obvious the texture feature of the target pixel is, and the richer the texture information of the target pixel is.

[0077] The difference between the norm of the texture feature vector of the target pixel and the norm of the texture feature vector of each pixel in the second pixel group is averaged to obtain the texture prominence of the target pixel; wherein the texture prominence calculation formula is as follows:

[0078] ;

[0079] In the formula, Indicates the texture prominence of the target pixel; Indicates the number of neighborhood pixels; Indicates the number of pixels in the first pixel group; represents the number of pixels in the second pixel group; Represents the texture feature vector of the target pixel; Indicates the first pixel in the second pixel group Texture feature vector of pixels; represents the norm of a vector; Represents an exponential function with a natural constant as base.

[0080] In the texture prominence calculation formula, the greater the norm difference between the texture feature vector of the target pixel point and the texture feature vector of the pixel points of the second pixel point group, the more obvious the texture feature of the target pixel point is and the richer the texture feature is compared with the neighboring pixels with a smaller norm length of the texture feature vector.

[0081] Step S204: according to the neighborhood texture distribution characteristics, texture blur and texture prominence, the texture richness of the target pixel is obtained; the texture richness is positively correlated with the neighborhood texture distribution characteristics and texture prominence; the texture richness is negatively correlated with the texture blur.

[0082] In one embodiment of the present invention, the texture richness calculation formula is as follows:

[0083] ;

[0084] In the formula, Indicates the texture richness of the target pixel; Represents the neighborhood texture distribution characteristics of the target pixel; Indicates the texture prominence of the target pixel; Indicates the texture blur degree of the target pixel.

[0085] In the texture richness calculation formula, the greater the texture prominence of the target pixel, the greater the texture change between the target pixel and the pixel with the smaller texture feature vector, and the more obvious the texture feature of the target pixel; the smaller the texture blur of the target pixel, the greater the texture similarity between the target pixel and the pixel with the largest texture feature, that is, the more obvious the texture feature of the target pixel; the larger the ratio of the two, the greater the change of the texture feature vector of the target pixel compared with other pixels in the preset neighborhood, and the more obvious the texture information of the target pixel is, and the richer the texture information; the neighborhood texture distribution characteristics of the target pixel The larger it is, the richer the texture features in the preset neighborhood are, and the richer the texture information of the target pixel is.

[0086] Step S3: Fit the grayscale value of each neighborhood pixel with a normal distribution to obtain the grayscale fitting value of the corresponding neighborhood pixel; obtain the suspected light spot degree of the target pixel based on the similarity between the grayscale value distribution of all neighborhood pixels and the grayscale fitting value distribution, as well as the grayscale discreteness of the neighborhood pixels.

[0087] In actual situations, the process of acquiring the torsion spring image is easily affected by light, resulting in the presence of spot noise in the torsion spring characteristic image obtained by convolution. The spot noise also shows a large grayscale difference compared to the surrounding pixels on the torsion spring characteristic image. At this time, the spot noise also has a high degree of texture richness and cannot be distinguished from the pixels in the torsion spring contour area, so the influence of light on the torsion spring characteristic image should be eliminated. Since the grayscale value of the pixels around the center of the spot gradually decreases, and the farther away from the center of the spot, the closer the grayscale value of the pixel is to the true grayscale value of the torsion spring, that is, the grayscale distribution of the spot area presents a normal distribution. Therefore, in the embodiment of the present invention, the grayscale value of each neighborhood pixel is fitted with a normal distribution to obtain the grayscale fitting value of the corresponding neighborhood pixel.

[0088] Preferably, in one embodiment of the present invention, the method for obtaining the grayscale fitting value includes:

[0089] Since the light spot usually appears as a circle with a large grayscale value, it is believed that pixels with high grayscale values ​​are more likely to be located in the center of the light spot. Since the grayscale value of the light spot gradually decreases from the center to the surrounding areas, its grayscale value distribution conforms to the two-dimensional normal distribution. Therefore, the grayscale value of each pixel in the preset neighborhood is fitted with a normal distribution through the least squares method to obtain the grayscale fitting value of each pixel, so that the grayscale value distribution of the neighborhood pixel is similar to the grayscale value distribution of the light spot area. The difference between the grayscale fitting value of the pixel and the true grayscale value is used to analyze whether the pixel belongs to the light spot area.

[0090] In other embodiments of the present invention, the maximum likelihood estimation method can also be used to fit the grayscale value of each neighborhood pixel to a two-dimensional normal distribution. It should be noted that the two-dimensional normal distribution, the maximum likelihood estimation method and the least squares method are all technical means well known to those skilled in the art and will not be described in detail here.

[0091] See also Figure 4 , which shows a flow chart of a method for obtaining the suspected light spot degree, the method comprising:

[0092] Step S301: Obtain the possibility of a suspected light spot of a target pixel according to the difference between the grayscale value and the grayscale fitting value of the pixel within a preset neighborhood of the target pixel and the texture distribution.

[0093] In the preset neighborhood range of the target pixel point, the difference between the grayscale value of each pixel point and the grayscale fitting value is calculated, and the ratio between the difference and the texture richness of each pixel point is used as the spot difference degree of each pixel point in the preset neighborhood range, wherein the smaller the difference between the grayscale value of each pixel point and the grayscale fitting value, the more the pixel point conforms to the two-dimensional normal distribution, and the greater the possibility that the pixel point is a pixel point in the spot area; the greater the texture richness of the pixel point, the greater the difference in texture characteristics between the pixel point and the adjacent pixel points, and the greater the possibility that the pixel point is a pixel point in the spot area;

[0094] The difference degree of the light spot of each pixel point in the preset neighborhood is averaged and negatively correlated to obtain the suspected light spot possibility of the target pixel point. In one embodiment of the present invention, the suspected light spot possibility calculation formula is as follows:

[0095] ;

[0096] In the formula, Indicates the possibility of suspected light spot at the target pixel; Indicates the number of neighborhood pixels; Indicates Gray value of neighboring pixels; Indicates Grayscale fitting value of neighborhood pixels; Indicates The texture richness of the neighboring pixels; Represents an exponential function with a natural constant as base.

[0097] In the calculation formula for the possibility of suspected light spots, The smaller the difference between the grayscale value of the neighborhood pixel and the grayscale fitting value, the more the pixel conforms to the two-dimensional normal distribution, and the greater the possibility that the pixel is the pixel in the spot area. The greater the texture richness of a neighborhood pixel, the greater the difference in texture features between the pixel and its neighboring pixels, and the greater the possibility that the pixel is a pixel in the spot area.

[0098] Step S302: taking the inverse of the standard deviation of the grayscale values ​​of the pixels within a preset neighborhood as the grayscale diffusion level of the target pixel.

[0099] The smaller the standard deviation of the grayscale values ​​of the pixels within the preset neighborhood of the target pixel, the more obvious the grayscale diffusion from the target pixel to the surrounding area is, and the greater the possibility that the target pixel is a pixel in the spot area. Therefore, the reciprocal of the standard deviation of the grayscale values ​​of the pixels within the preset neighborhood is used as the obvious degree of grayscale diffusion of the target pixel for subsequent analysis. In one embodiment of the present invention, the formula for calculating the obvious degree of grayscale diffusion is as follows:

[0100] ;

[0101] In the formula, Indicates the obvious degree of grayscale diffusion of the target pixel; Indicates the standard deviation of the grayscale values ​​of pixels within the preset neighborhood of the target pixel.

[0102] Step S303: obtaining the suspected light spot degree of the target pixel point according to the suspected light spot possibility and the obvious degree of grayscale diffusion; the suspected light spot degree is positively correlated with the suspected light spot possibility and the obvious degree of grayscale diffusion.

[0103] In one embodiment of the present invention, the calculation formula for the suspected light spot degree is as follows:

[0104] ;

[0105] In the formula, Indicates the suspected light spot degree of the target pixel; Indicates the obvious degree of grayscale diffusion of the target pixel; Indicates the possibility of a suspected light spot at the target pixel.

[0106] In the calculation formula of suspected light spot degree, the gray diffusion degree of the target pixel point is The larger the value, the smaller the standard deviation of the grayscale value of the neighboring pixels, indicating that the grayscale diffusion around the target pixel is more obvious. At this time, the possibility that the target pixel is a pixel in the spot area is greater, that is, the degree of suspected spot of the target pixel is greater; the possibility of suspected spot of the target pixel is greater. The larger it is, the smaller the difference between the grayscale value of each pixel point in the preset neighborhood range and the grayscale fitting value is, which means that the pixel point conforms to the two-dimensional normal distribution more, and the possibility that the pixel point is a pixel point in the light spot area is greater, and the richer the texture of the pixel point is, the greater the difference in texture features between the pixel point and the adjacent pixels, and the greater the possibility that the pixel point is a pixel point in the light spot area, that is, the greater the suspected light spot degree of the target pixel point.

[0107] Step S4: According to the texture richness and suspected light spot degree of the target pixel, the pooling importance of the target pixel is obtained; according to the pooling importance of all neighborhood pixels, the pooling output result of the target pixel is obtained; according to the pooling output result of all pixels in each torsion spring feature image, a pooled torsion spring image is obtained.

[0108] Since the embodiment of the present invention needs to highlight the contour and texture features of the torsion spring, under traditional circumstances, the pooling layer of the convolutional neural network usually needs to perform maximum pooling on the pixels within each preset neighborhood range to retain the most significant features of the local area, that is, the texture features within the preset neighborhood range. Since the most significant features in part of the preset neighborhood range may be affected by lighting, in the embodiment of the present invention, the pooling importance of the target pixel point is obtained by combining the texture richness of the target pixel point and the degree of suspected light spot.

[0109] Preferably, in one embodiment of the present invention, the method for obtaining the pooling importance includes:

[0110] The suspected light spot degree of the target pixel is negatively correlated and mapped, and the product of the suspected light spot degree and the texture richness is used as the pooling importance of the target pixel. In one embodiment of the present invention, the calculation formula of the pooling importance is as follows:

[0111] ;

[0112] In the formula, Indicates the pooling importance of the target pixel; Indicates the texture richness of the target pixel; Indicates the suspected light spot degree of the target pixel; Represents an exponential function with a natural constant as base.

[0113] In the pooling importance calculation formula, the richer the texture of the target pixel, the more likely the target pixel is a pixel in the torsion spring contour area, and the more important it is in subsequent defect detection, that is, the higher the importance of the target pixel in the pooling process; the greater the suspected light spot of the target pixel, the more likely the target pixel is to belong to the light spot area and the more it should be removed, that is, the lower the importance of the target pixel in the pooling process.

[0114] Preferably, in one embodiment of the present invention, the method for obtaining the pooling output result includes:

[0115] In a preset neighborhood range, the pooling importance of each pixel is calculated; the ratio between the pooling importance of the target pixel and the sum of the pooling importance of the pixels in the preset neighborhood range is used as the pooling importance coefficient of the target pixel.

[0116] In one embodiment of the present invention, the calculation formula of the pooling importance coefficient is as follows:

[0117] ;

[0118] In the formula, Indicates The pooling importance coefficient of the neighborhood pixels; Indicates The importance of pooling of neighborhood pixels; Indicates the number of neighborhood pixels.

[0119] The weight of the grayscale value of each pixel in the pooling process is determined according to the pooling importance coefficient, and the pooling output result of each pixel can be obtained, thereby obtaining the corresponding pooled torsion spring image of each torsion spring feature image.

[0120] The product of the pooling importance coefficient and the gray value of the target pixel is used as the pooling output result of the target pixel. In one embodiment of the present invention, the pooling output result calculation formula is as follows:

[0121]

[0122] In the formula, Represents the pooling output result of the target pixel; Represents the pooling importance coefficient of the target pixel; Indicates the grayscale value of the target pixel.

[0123] The target pixel is changed to obtain all pooling output results in each torsion spring feature image; all pooling output results are used as pooled torsion spring images.

[0124] Step S5: Detect the quality of the torsion spring based on all the pooled torsion spring images.

[0125] Since the pooling process extracts the most significant features in each torsion spring feature image, the pooled torsion spring image after pooling is actually a low-resolution image, which needs to be processed to obtain a high-resolution final torsion spring image corresponding to each torsion spring feature image in order to facilitate the quality inspection of the torsion spring.

[0126] Preferably, in one embodiment of the present invention, the quality of the torsion spring is detected according to the pooled torsion spring image, including:

[0127] The 64 pooled torsion spring images corresponding to each torsion spring are input into the SRCNN model to convert all low-resolution pooled torsion spring images into high-resolution final torsion spring images.

[0128] The Sobel edge detection algorithm is used on all final torsion spring images to detect defective areas in the final torsion spring images; the defective areas in each final torsion spring image are integrated to complete the quality inspection of the torsion spring.

[0129] It should be noted that the SRCNN model and the Sobel edge detection algorithm are both technical means well known to those skilled in the art and will not be described in detail here.

[0130] In summary, the original torsion spring image is convolved based on the convolutional neural network to obtain all torsion spring feature images; any pixel point of a torsion spring feature image is selected as the target pixel point; any pixel point within the preset neighborhood range of the target pixel point is selected as the neighborhood pixel point; according to the texture distribution characteristics of the target pixel point within the preset neighborhood range, the texture richness of the target pixel point is obtained; the grayscale value of each neighborhood pixel point is fitted with a normal distribution to obtain the grayscale fitting value of the corresponding neighborhood pixel point; according to the similarity between the grayscale value distribution of all neighborhood pixels and the grayscale fitting value distribution, and the grayscale discreteness of the neighborhood pixels, the suspected light spot degree of the target pixel point is obtained; according to the texture richness and the suspected light spot degree of the target pixel point, the pooling importance of the target pixel point is obtained; according to the pooling importance of all neighborhood pixels, the pooling output result of the target pixel point is obtained; the pooled torsion spring image is obtained according to the pooling output result of all pixels in each torsion spring feature image; the torsion spring quality is detected according to the pooled torsion spring image.

[0131] It should be noted that the sequence of the above embodiments of the present invention is only for description and does not represent the advantages and disadvantages of the embodiments. The processes depicted in the accompanying drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0132] The various embodiments in this specification are described in a progressive manner, and the same or similar parts between the various embodiments can be referenced to each other, and each embodiment focuses on the differences from other embodiments.

Claims

1. A torsion spring quality detection method based on convolutional neural network, It is characterized in that The method comprises: Convolution is performed on the original torsion spring image based on a convolutional neural network to obtain characteristic images of all torsion springs; Select any pixel point of a torsion spring feature image as a target pixel point; select any pixel point within a preset neighborhood range of the target pixel point as a neighborhood pixel point; obtain the texture richness of the target pixel point according to the texture distribution characteristics of the target pixel point within the preset neighborhood range; A normal distribution fitting is performed on the grayscale value of each neighborhood pixel to obtain the grayscale fitting value of the corresponding neighborhood pixel; the suspected light spot degree of the target pixel is obtained according to the similarity between the grayscale value distribution of all neighborhood pixels and the grayscale fitting value distribution, as well as the grayscale discreteness of the neighborhood pixels; According to the texture richness of the target pixel and the suspected light spot degree, the pooling importance of the target pixel is obtained; according to the pooling importance of all neighboring pixels, the pooling output result of the target pixel is obtained; according to the pooling output results of all pixels in each torsion spring feature image, a pooled torsion spring image is obtained; The quality of the torsion spring is inspected based on all pooled torsion spring images.

2. According to claim 1, a torsion spring quality detection method based on convolutional neural network, It is characterized in that The method for obtaining the texture richness comprises: Obtaining corresponding texture feature vectors of all the neighborhood pixels; According to the overall change degree of texture features within the preset neighborhood range of the target pixel point, the neighborhood texture distribution features of the target pixel point are obtained; According to the difference between the texture feature vector of the target pixel and the texture feature vectors of all neighboring pixels, the texture blurring degree and texture prominence degree of the target pixel are obtained; The texture richness of the target pixel is obtained according to the neighborhood texture distribution characteristics, the texture blurring degree and the texture prominence degree; the texture richness is positively correlated with the neighborhood texture distribution characteristics and the texture prominence degree; the texture richness is negatively correlated with the texture blurring degree.

3. According to claim 2, a torsion spring quality detection method based on convolutional neural network, It is characterized in that The method for acquiring the neighborhood texture distribution feature includes: Calculate the average value of all texture feature vectors within the preset neighborhood of the target pixel point as the neighborhood overall texture feature vector; calculate the range between the texture feature vectors within the preset neighborhood of the target pixel point as the neighborhood maximum change feature vector; The norm of the sum vector between the neighborhood overall texture feature vector and the neighborhood maximum change feature vector is used as the neighborhood texture distribution feature of the target pixel point.

4. According to claim 2, a torsion spring quality detection method based on convolutional neural network, It is characterized in that According to the difference between the texture feature vector of the target pixel and the texture feature vectors of all neighboring pixels, the texture blurring degree and texture prominence degree of the target pixel are obtained, including: A first pixel point group and a second pixel point group are obtained according to the difference of the texture feature vectors of the neighborhood pixel points; the modulus of the texture feature vector of each pixel point in the first pixel point group is greater than the modulus of the texture feature vector of each pixel point in the second pixel point group; Averaging the difference between the norm of the texture feature vector of the target pixel and the norm of the texture feature vector of each pixel in the first pixel group to obtain the texture blur degree of the target pixel; The difference between the norm of the texture feature vector of the target pixel and the norm of the texture feature vector of each pixel in the second pixel group is averaged to obtain the texture prominence degree of the target pixel.

5. According to the method for detecting the quality of torsion springs based on convolutional neural network in claim 1, It is characterized in that The method for obtaining the grayscale fitting value includes: The grayscale value of each neighborhood pixel is fitted with a normal distribution using the least squares method to obtain the grayscale fitting value of the corresponding neighborhood pixel.

6. According to claim 1, a torsion spring quality detection method based on convolutional neural network, It is characterized in that The method for obtaining the suspected light spot degree includes: According to the difference between the grayscale value and the grayscale fitting value of the pixel point within the preset neighborhood of the target pixel point and the texture distribution, the possibility of the suspected light spot of the target pixel point is obtained; The inverse of the standard deviation of the grayscale values ​​of the pixels within the preset neighborhood is used as the grayscale diffusion degree of the target pixel; According to the suspected light spot possibility and the grayscale diffusion obvious degree, the suspected light spot degree of the target pixel point is obtained; the suspected light spot degree is positively correlated with the suspected light spot possibility and the grayscale diffusion obvious degree.

7. A torsion spring quality detection method based on convolutional neural network according to claim 6, It is characterized in that The method for obtaining the possibility of the suspected light spot includes: In the preset neighborhood range of the target pixel point, the difference between the grayscale value of each pixel point and the grayscale fitting value is calculated, and the ratio between the difference and the texture richness of each pixel point is used as the spot difference degree of each pixel point in the preset neighborhood range; The difference degree of the light spot of each pixel in the preset neighborhood is averaged and negatively correlated to obtain the possibility of the suspected light spot of the target pixel.

8. According to claim 1, a torsion spring quality detection method based on convolutional neural network, It is characterized in that The method for obtaining the pooling importance includes: The suspected light spot degree of the target pixel is negatively correlated and mapped, and the product of the suspected light spot degree and the texture richness is used as the pooling importance of the target pixel.

9. The torsion spring quality detection method based on convolutional neural network according to claim 1, It is characterized in that The method for obtaining the pooled torsion spring image includes: In a preset neighborhood range, the pooling importance of each pixel is calculated; the ratio between the pooling importance of the target pixel and the sum of the pooling importance of the pixels in the preset neighborhood range is used as the pooling importance coefficient of the target pixel; The product of the pooling importance coefficient and the gray value of the target pixel is used as the pooling output result of the target pixel; The target pixel point is changed to obtain all pooling output results in each of the torsion spring feature images; and all the pooling output results are used as the pooled torsion spring image.

10. The torsion spring quality detection method based on convolutional neural network according to claim 1, It is characterized in that The quality of the torsion spring is detected according to the pooled torsion spring image, including: The final torsion spring image corresponding to each pooled torsion spring image is obtained by the SRCNN algorithm, and defect detection is performed on the final torsion spring image.