An image recognition-based bearing surface defect automatic detection system
By employing image acquisition and preprocessing, image pyramid decomposition, and filtering to extract local contrast and feature extraction and enhancement, combined with the U-Net network, a bearing surface defect detection system is developed. This system addresses existing technical issues and achieves improved accuracy and robustness in bearing surface defect detection. The system is applied to bearing surface defect detection systems.
Patent Information
- Application Number
- CN202510221809.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-27
- Publication Date
- 2025-12-23
- Estimated Expiration
- 2045-02-27
AI Technical Summary
Existing technologies do not fully consider the contrast difference between the defect area and the background, causing minor defects to be masked by strong contrast background information, reducing detection accuracy. Furthermore, the robustness of defect classification is low, and the severity assessment method is simplistic, making it difficult to meet the detection needs under complex working conditions.
The image acquisition and preprocessing module is used for cropping and filtering to adjust contrast. Local contrast and texture features are extracted through image pyramid decomposition. The U-Net network is used for defect identification and classification. The severity score is calculated by combining the defect location, area and boundary gradient distribution.
It improves the distinction between defect areas and background, enhances the ability to identify fine cracks and large-area spalling defects, and achieves effective identification of fine cracks and large-area spalling defects. Technical application phrase: Technical application: This patent can be applied to the field of environmental pollution prevention and control technology, specifically involving an automatic detection system for bearing surface defects based on image recognition, and is specifically applied to the detection of bearing surface defects.
Smart Images

Figure CN120147263B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application relates to the technical field of image recognition, in particular to a bearing surface defect automatic detection system based on image recognition. BACKGROUND
[0002] Image recognition is a technical field based on computer vision and pattern recognition, aiming to enable computers to understand and analyze the content in images. The bearing surface defect automatic detection system uses image recognition technology to detect the bearing surface to identify potential defects such as cracks, peeling, and wear.
[0003] However, the prior art does not fully consider the contrast difference between the defect area and the background, which easily causes the small defects to be covered by the strong contrast background information, reducing the detection accuracy. The defect classification method mainly relies on shape feature matching, and the classification robustness for complex defects is low. In the case of fuzzy boundary or similar shape, misclassification problems are easily caused. The severity evaluation method only relies on simple area calculation. Therefore, improvement is needed. SUMMARY
[0004] The purpose of the application is to solve the shortcomings in the prior art and propose a bearing surface defect automatic detection system based on image recognition.
[0005] To achieve the above purpose, the application adopts the following technical scheme: a bearing surface defect automatic detection system based on image recognition comprises:
[0006] An image acquisition and preprocessing module acquires a bearing surface image, crops and filters the image to remove noise and adjust contrast, and obtains a processed image; the processed image is converted to grayscale to generate a preprocessing result;
[0007] A feature extraction and enhancement module extracts local contrast and texture features at each scale based on the preprocessing result by image pyramid decomposition, generates a feature set, and adjusts enhancement parameters according to the statistical distribution of the feature set to obtain an enhanced feature map;
[0008] A defect classification and labeling module uses a U-Net network to analyze the image based on the enhanced feature map, identifies cracks and peeling defects on the bearing surface, and obtains a classified defect result;
[0009] A result output and report module sorts out the position, type, and severity of each detected defect based on the classified defect result, and obtains a defect result.
[0010] Preferably, the step of obtaining the processed image is:
[0011] An image of a bearing surface is acquired, a non-effective area at the edge of the image is cropped, a spatial domain filter is used to optimize the signal-to-noise ratio of the image, and a cropped and filtered image is obtained;
[0012] According to the cropped and filtered image, a contrast enhancement index is calculated, and the calculation formula is:
[0013]
[0014] Wherein, C represents the contrast enhancement index, I i,j represents the pixel gray value of the i-th row and the j-th column in the cropped and filtered image, M represents the global average gray value of the cropped and filtered image, I max represents the maximum gray value in the cropped and filtered image, I min represents the minimum gray value in the cropped and filtered image, and m and n represent the number of rows and columns of the image, respectively.
[0015] According to the contrast enhancement index, the gray histogram distribution of the cropped and filtered image is adjusted, and a processed image is obtained.
[0016] Preferably, the acquisition step of the preprocessing result is:
[0017] The processed image is acquired, the pixel values of the red channel, the green channel and the blue channel are separated, and the image is converted to a standardized color space at the same time, and a separated channel image is obtained.
[0018] According to the separated channel image, the gray value distribution uniformity is calculated, and the calculation formula is:
[0019]
[0020] Wherein, AG represents the gray value distribution uniformity, R represents the pixel value of the red channel in the separated channel image, G represents the pixel value of the green channel in the separated channel image, B represents the pixel value of the blue channel in the separated channel image, and HM represents the global average gray value of the separated channel image.
[0021] According to the gray value distribution uniformity, the gray mapping of the separated channel image is carried out, and the preprocessing result is generated.
[0022] Preferably, the acquisition step of the feature set is:
[0023] The preprocessing result is acquired, the image is decomposed by using an image pyramid, different scale image layers are constructed, and a multi-scale decomposed image is obtained.
[0024] According to the multi-scale decomposed image, a local contrast score is calculated, and the calculation formula is:
[0025]
[0026] wherein CF represents the local contrast score, P i,j represents the gray value of the image after multi-scale decomposition at the jth pixel of the ith scale, N represents the number of local pixel blocks at the current scale, P avg represents the average gray value of all pixels at the current scale, P max represents the maximum gray value of the pixel at the current scale, P min represents the minimum gray value of the pixel at the current scale, k represents the number of scales obtained after image decomposition, and z represents the total number of pixels at the current scale.
[0027] According to the local contrast score, the texture distribution characteristics at different scales are extracted to generate a feature set.
[0028] Preferably, the step of obtaining the enhanced feature map is:
[0029] Based on the feature set, an enhancement parameter is calculated, and the calculation formula is:
[0030]
[0031] wherein E represents the enhancement parameter, F n represents the value of the nth feature, σ n represents the standard deviation of the nth feature, μ n represents the average value of the nth feature, and TN is the total number of features in the feature set.
[0032] According to the enhancement parameter, the intensity of each feature is adjusted to obtain an enhanced feature map.
[0033] Preferably, the step of obtaining the classified defect result is:
[0034] The enhanced feature map is processed using a U-Net network to identify and label the cracks and peeling defects in the image, obtaining an unoptimized defect recognition result.
[0035] Image post-processing is performed on the unoptimized defect recognition result, including using threshold segmentation to separate the foreground and background, applying morphological dilation and erosion to clarify the defect boundary, and generating a classified defect result.
[0036] Preferably, the step of obtaining the defect result is:
[0037] The classified defect result is obtained, the position information of each identified defect is extracted, the boundary shape and size in the image coordinates are analyzed, and the spatial distribution data of the defect is formed.
[0038] Based on the spatial distribution data of the defects, a defect severity score is calculated, and the calculation formula is:
[0039]
[0040] Wherein, D represents the defect severity score, X i ,Y i represents the center coordinates of the i-th defect, X c ,Y c represents the center of gravity coordinates of all defects, FG i represents the average gray gradient of the i-th defect area, A i represents the area of the i-th defect, G med represents the median gray gradient of all defect areas, M represents the total number of defects detected;
[0041] According to the defect severity score, the spatial position, type and severity of each defect are sorted, and a defect result is generated.
[0042] Compared with the prior art, the advantages and positive effects of the present application are:
[0043] In the present application, image cropping and filtering are used to reduce environmental noise interference, and the contrast is adjusted to optimize image quality and improve the distinction between defect areas and background. Gray scale conversion standardizes image channel information, keeps the calculation accuracy of feature extraction consistent, and avoids multi-channel data interference analysis results. Image pyramid method constructs different scale image levels, improves the adaptability to fine cracks and large area peeling defects in local contrast and texture feature extraction process, and enhances the stable recognition ability to defects of different sizes. Feature enhancement based on statistical distribution adjustment makes the high-frequency features of defect areas more prominent, and reduces the interference of surface texture complexity on defect recognition. The severity calculation combines the defect position, area and boundary gradient distribution, so that the influence degree of the defect is more quantized, and the detection demand under various complex conditions is met. The output defect classification and numerical information make the defect data directly usable in maintenance and quality monitoring links, improve the efficiency and operability of the decision-making process. BRIEF DESCRIPTION OF DRAWINGS
[0044] Figure 1 The system flowchart of the present application. DETAILED DESCRIPTION
[0045] In order to make the purpose, technical scheme and advantages of the present application more clear, the present application will be further described in detail below in combination with the drawings and examples. It should be understood that the specific examples described herein are only used to explain the present application, and are not used to limit the present application.
[0046] Please refer to Figure 1The application provides a technical scheme: a bearing surface defect automatic detection system based on image recognition comprises:
[0047] An image acquisition and preprocessing module acquires a bearing surface image, performs cropping and filtering on the image to remove noise and adjust contrast, obtains a processed image, performs gray scale conversion on the processed image, and generates a preprocessing result;
[0048] A feature extraction and enhancement module extracts local contrast and texture features at each scale based on the preprocessing result by decomposing the image through an image pyramid, generates a feature set, adjusts enhancement parameters according to the statistical distribution of the feature set, and obtains an enhanced feature map;
[0049] A defect classification and labeling module uses a U-Net network to analyze the image based on the enhanced feature map, identifies cracks and spalling defects on the bearing surface, and obtains a classified defect result;
[0050] A result output and report module sorts out the position, type and severity of each detected defect based on the classified defect result, and obtains a defect result.
[0051] The acquisition step of the processed image is:
[0052] The bearing surface image is acquired, the non-effective area at the edge of the image is cropped, the signal-to-noise ratio of the image is optimized by using spatial domain filtering, and a cropped and filtered image is obtained;
[0053] The contrast enhancement index is calculated according to the cropped and filtered image, and the calculation formula is:
[0054]
[0055] Wherein, C represents the contrast enhancement index, I i,j represents the pixel gray value of the i-th row and the j-th column in the cropped and filtered image, M represents the global average gray value of the cropped and filtered image, I max represents the maximum gray value in the cropped and filtered image, I min represents the minimum gray value in the cropped and filtered image, and m and n represent the number of rows and columns of the image, respectively.
[0056] The gray histogram distribution of the cropped and filtered image is adjusted according to the contrast enhancement index, and the processed image is obtained.
[0057] Specifically, based on the collected bearing surface original image, an industrial camera with a resolution of 1920x1080 is selected to capture 15 frames per second, the gray value distribution data of the image edge is read from the original frame, the contrast of each pixel in the edge area and the internal pixel is compared, when the continuous numerical fluctuation amplitude of the edge gray value is less than 5 and the corresponding pixel brightness does not exceed 10, the area is determined as a non-effective area, after judging all edge pixels, 15 rows at the top and bottom and 20 columns on the left and right of the image are removed respectively, and the coverage range of the remaining area is determined in the rectangular range of the center 800x1040. Then, the spatial domain filtering process is applied to the remaining area, the filter core size is determined as 3x3 from the noise distribution map collected in the industrial field, and the values of adjacent pixels and the center pixel are matrix operated by combining the convolution method to scan pixel by pixel, and the spatial domain filtering output is obtained. Each pixel point is weighted and accumulated by the values of the surrounding 8 pixels, and then the noise signal level data collected in advance is used for further mean smoothing processing of the pixel points with gray scale jitter exceeding 2 and continuous range greater than 3 rows. In order to avoid the loss of texture details in high brightness or low brightness areas, the noise peak distribution interval recorded in the industrial field is tracked, and the interval of 80 to 220 in the brightness range of 0 to 255 is taken as the contrast boundary. If it exceeds 220, the original value is kept unchanged, and if it is less than 80, it is adjusted by local diffusion. After all the pixels are processed, the cropped and filtered image is obtained.
[0058] The advantage of the formula is that by accumulating the absolute value of the difference between all pixels and the global average value in the numerator, and combining the comprehensive information of the pixel gray level deviation from the mean square deviation and the maximum gray value difference in the denominator, the quantitative evaluation of the overall contrast enhancement requirement is realized, so that the histogram distribution can be adjusted more targeted in the subsequent stage according to the quantitative result.
[0059] I i,j The acquisition step is:
[0060] This is the pixel gray value of the i-th row and j-th column in the cropped and filtered image, which needs to be read from the remaining image pixel array in row and column order after completing the spatial domain filtering and removing the non-effective area. In order to obtain this parameter, first, the edge rows and columns with obvious noise distribution are deducted from the original image collected by the industrial camera, and the known thermal interference data, gray jump and image center segment are compared. Only the pixels that meet the smoothness requirement will be retained. The skilled person will filter out the most suitable stable pixel data for calculation by repeatedly collecting 10 times of the same size image on site. For example, in a 5x5 image matrix, I 1,1 = 90, I 1,2 = 95, I 2,3 = 99, etc.
[0061] The steps to obtain M are as follows:
[0062] This parameter represents the global average grayscale value of the cropped and filtered image. It is obtained by summing the grayscale values of all valid pixels and then dividing by the total number of pixels, m×n. During the acquisition process, an accumulation function can be called on an automated platform to add the grayscale values of each pixel individually, and then divide the result by the total number of pixels to obtain M. In actual data recording, if some pixels are affected by occasional instantaneous lighting fluctuations, the grayscale values of those pixels can be adjusted by referring to the results of multiple on-site acquisitions in the previous step. For example, after statistically analyzing a 5×5 test image, if the sum of all pixels is 2480 and the image has 25 pixels, then M = 2480 / 25 = 99.2.
[0063] I max The steps to obtain it are as follows:
[0064] This is the highest grayscale value in the cropped and filtered image. The highest value is directly selected from the list of all valid pixels and taken as I. max In industrial test images, all pixels are first read in row-major order. Then, the grayscale values of each pixel are compared to identify and record the highest pixel value. This highest value is then used in the denominator of the formula to measure the dynamic range of the entire image's grayscale. In a practical calculation example, if the highest pixel value in a 5×5 test image is 115, then I... max =115.
[0065] I min The steps to obtain it are as follows:
[0066] This parameter corresponds to the minimum grayscale value in the cropped and filtered image, and is determined by I. max A similar scanning method selects the lowest value from all pixel grayscale values as I. min In a computer program, the array index can be first located to the first pixel value and taken as the current minimum value. Then, it can be compared with all subsequent pixels one by one. If a lower grayscale value is found, the minimum value is updated. Taking the 5×5 test image above as an example, the minimum pixel value might be 87, then I min =87.
[0067] The steps to obtain m are as follows:
[0068] This parameter represents the number of rows in the image, typically obtained by acquiring the height information of the image data. In real-world scenarios, the number of remaining pixel rows in an image obtained from an industrial camera may change after filtering or edge removal. In this case, it is necessary to reread the effective area height value of the image to update m. In a 5×5 test image, if 5 rows of pixels are still retained after cropping and filtering, then m = 5.
[0069] The acquisition step of n is:
[0070] This parameter represents the number of columns of the image, and the acquisition process of m is similar. In the field detection, n is acquired according to the width value of the cropped image. Through the row-first or column-first scanning mode, the software can determine the actual number of pixel columns contained in the current image. Taking the 5x5 test image as an example, if 5 columns of pixels can still be maintained, then n = 5.
[0071] Calculation process:
[0072] First, read the data from the pixel matrix of the 5x5 test image, as shown in the following matrix example:
[0073] 90, 95, 100, 105, 110
[0074] 92, 96, 99, 106, 112
[0075] 88, 94, 101, 103, 115
[0076] 87, 97, 98, 108, 113
[0077] 90, 92, 104, 109, 114
[0078] Add all 25 pixel values to get 2480, and then divide by 25 to get M = 99.2. The sum of the absolute values of the differences between all pixels and M can be obtained:
[0079]
[0080] Then calculate the denominator, first find the sum of squares of the differences between the pixels and M:
[0081]
[0082] Add all the squared pixel difference values to get a value (here, the individual items are omitted) of about 1870.24, and find I max = 115 and I min = 87, then calculate the denominator:
[0083]
[0084] Divide the numerator by the denominator to get:
[0085]
[0086] The result shows that the contrast enhancement index of the current image reaches 2.94. In cooperation with the subsequent histogram distribution adjustment, the image contrast increment demand can be judged according to the value of 2.94, and the calculation result can be used to guide the more subdivided gray scale allocation process.
[0087] According to the value of the contrast enhancement index C, it is read that the value is in the range of 2.00 to 3.50, and the gray level histogram of the current image is divided into 16 level distribution intervals, and then the corresponding gray level cumulative number is counted interval by interval, the relative concentration degree of pixel distribution in each interval is judged by counting the mean and median, when a certain interval exceeds 500 pixels in the gray level cumulative number, the gray level distribution of the interval is re-distributed to the adjacent interval in a small range, and in the calculation process, the brightness value exceeding 200 is compressed in combination with the gray level mean sequence collected before, the specific method includes traversing each pixel in row and column order, when the gray level value of the pixel is greater than or equal to 200, it is mapped to 200 plus a random compensation of about 1 to 5, this compensation is obtained by observing the long-term collected brightness record table, at the same time, referring to the gray level difference array obtained by monitoring many times before, for the case that the contrast enhancement index is near 2.94, the pixel accumulation of the highest gray level interval is appropriately reduced to ensure that the distribution of the final gray level in the overall range presents a relative balance, then each interval is stretched or compressed according to the pixel distribution density, the gray level value of the low density interval is shifted upward by 5 to 10 values, and the gray level value of the high density interval is shifted downward by 3 to 7 values, after all the mapping is completed, a global check is performed again, when it is detected that the pixel accumulation number of some intervals is still too high, the same way is continued to be used for fine mapping, finally the pixel number of all intervals is confirmed to be at an acceptable level, and the gray level distribution after the whole mapping is recorded to obtain the processed image.
[0088] The acquisition step of the preprocessing result is:
[0089] The processed image is acquired, the pixel values of the red channel, the green channel and the blue channel are separated, and at the same time, the image after separation of the channels is converted to a standardized color space to obtain the image after separation of the channels;
[0090] According to the image after separation of the channels, the gray value distribution balance degree is calculated, and the calculation formula is:
[0091]
[0092] Among them, AG represents the gray value distribution balance degree, R represents the pixel value of the red channel in the image after separation of the channels, G represents the pixel value of the green channel in the image after separation of the channels, B represents the pixel value of the blue channel in the image after separation of the channels, and HM represents the global average gray value of the image after separation of the channels;
[0093] According to the gray value distribution balance degree, the gray mapping is performed on the image after separation of the channels to generate the preprocessing result.
[0094] Specifically, based on the previously obtained processed image, the gray values of the red channel, green channel and blue channel are read pixel by pixel, and the corresponding position indexes are extracted in the order of the pre-recorded pixel arrangement. Combined with the exposure and gain setting data during the industrial camera acquisition, the original readings of each channel are compared with the on-site measured light compensation table in the internal calculation. When the channel gray value exceeds 255 or is lower than 0, the actual observed channel range is limited, and the extreme over-limit value is corrected to an acceptable range in a linear mapping manner. The three channel values separated above form the original RGB data information, and then the separated red, green and blue values are standardized by matrix multiplication according to the sRGB standard color conversion method. The specific method includes recording the separated channel data in a three-column two-dimensional data table, and then applying the conversion coefficient matrix collected from the industry manual to obtain a more stable color representation. These conversion coefficient matrices are determined by actual multiple color calibration processes and are uniformly fixed in the image processing step. When the converted channel value is distributed within the interval of 0 to 255, the standardized color value of the current pixel is recorded. If it exceeds this interval, it is truncated in combination with the previously measured brightness distribution curve and slightly adjusted with the average value of adjacent pixels. The conversion process maintains the corresponding relationship between the channels, so that the same position pixel channel information can be retrieved in subsequent shape detection or texture recognition. After completing the channel separation and standardization transformation of all pixels, the obtained data is integrated into a new image matrix, and whether there are a large number of pixels concentrated in the same color component in the extreme case is checked in the row and column traversal. If it is found that the channel value is concentrated between 230 and 255 in some rows or columns, the pixels are corrected with reference to the brightness monitoring sequence collected at the same time to avoid distortion problems caused by excessive exposure data in the subsequent stage. The converted image is scanned and counted at the end stage to determine the number of rows, columns and pixel distribution range of each channel of the image, and the separated channel image is obtained.
[0095] The formula is beneficial in that by quantifying the mutual difference degree of the three channels and the deviation of the total channel value from the global average gray value, the balance of color distribution can be comprehensively investigated in the same step, thereby providing executable numerical reference for subsequent gray mapping.
[0096] The R acquisition step is:
[0097] This parameter represents the pixel value of the red channel in the image after separation. The range of all pixel values is usually between 0 and 255. During acquisition, the technician will measure the lighting conditions and the exposure parameters of the industrial camera on site and fix the gain to maintain consistency. After completing the imaging, the red channel is scanned in row-column order, the R value of each pixel is extracted into a list, and its coordinate position in the resolution space is recorded to avoid subsequent calculation offset. If some pixels are detected to have R values exceeding 255 or below 0, the pixel will be re-estimated based on the compensation coefficient measured in advance by the industrial camera to ensure that the final R value falls within the effective range of 0 to 255. For example, if the original read value of a certain pixel in a test image is 270, it is corrected to the range of 230 through on-site calibration, and then 230 is stored as the R value of this pixel.
[0098] The acquisition step of G is:
[0099] This parameter represents the pixel value of the green channel in the image after separation. The same row-column order and coordinate correspondence as R value are required during acquisition. During the scanning of the green channel, the brightness record of the shooting site is first read, and by referring to the exposure reference and noise distribution of the industrial camera at different times, the extreme values that may occur are corrected accordingly. The final range of G value is also between 0 and 255. If individual pixels have a peak value of 310 in the on-site record, the sensor saturation value acquired is cut off, and the pixel is set to the saturated value of 255.
[0100] The acquisition step of B is:
[0101] This parameter represents the pixel value of the blue channel in the image after separation. The acquisition method is consistent with that of R and G. In order to maintain the correspondence with other channels, the row-column coordinates of the same pixel position need to be read at the same time for R, G, and B, so that the differences between the three channels can be correctly reflected in subsequent calculations. The blue value of the same position is compared through multiple shootings on site. If the blue value of the position measured multiple times fluctuates more than 20 up and down, the lighting environment around the pixel will be queried, and combined with the on-site brightness monitoring record to determine whether numerical correction is needed. After the B value is completely acquired, it is placed within the range of 0 to 255 to avoid numerical out-of-range in subsequent operations.
[0102] The acquisition step of HM is:
[0103] This parameter represents the global average gray value of the image after separation of channels, taking the pixel values of R, G, B three channels for comprehensive evaluation. In actual operation, all valid pixels in the image are traversed, the gray approximation value of each pixel is calculated first, then the gray approximation values of all pixels are accumulated and divided by the total number of pixels of the image to obtain HM. In the scene of higher resolution, in order to prevent the excessive influence of shadow or bright spot on statistics, the extreme abnormal value needs to be removed or corrected, and then the average is taken according to the total number of remaining data. The field technician may use the sliding window method to obtain more stable HM by calculating the local mean value of several pixels around each position and then collecting them. In a 10000 pixel example area, if the sum of the gray approximation values of all pixels is 920000, then HM = 920000 / 10000 = 92.
[0104] Calculation process:
[0105] In a certain detection, the red, green and blue channel values of a pixel are R = 130, G = 115 and B = 100 respectively, and HM = 110 is found from the global result of statistics, which is brought into the formula item by item:
[0106]
[0107] First calculate the absolute value difference:
[0108] |130-115| = 15, |115-100| = 15, |100-130| = 30
[0109] Then calculate the square and sum:
[0110] 15 2 +15 2 +30 2 = 225 + 225 + 900 = 1350
[0111] Divide by 3 and then take the square root:
[0112]
[0113] Then calculate the fraction on the right side:
[0114] 130 + 115 + 100
[0115] = 345, 3x110 = 330, 345-330 = 15, |15| = 15, 15 / 3 = 5
[0116] Therefore:
[0117] AG = 21.213 + 5 = 26.213
[0118] The results show that when the value of AG is at 26.213, the difference between the three channels and the deviation of the total channel value from the global average gray level are relatively obvious, which means that the current pixel is relatively large in color deviation. If the value generally exceeds 20 in subsequent global statistics, it indicates that the color balance of the whole image is low, and if the average value is generally lower than 10, it indicates that the image channels tend to be closer.
[0119] According to the gray value distribution balance degree AG obtained in the foregoing, when performing gray mapping on the image after separating the channels, it is first checked whether there is a case that a large area of channel values is concentrated in the interval of 180 to 255 or the interval of 0 to 50 in the collected three-channel matrix. If it is found that the cumulative pixel number of a single channel in the above interval exceeds 30% of the total number of pixels of the image, the pixel value of the excessively concentrated area is proportionally compressed or boosted according to the statistics of the on-site brightness record and the illumination distribution data in the foregoing, and is mapped to the average level of the adjacent interval value. In the mapping process, the recorded color reference table is compared and confirmed to be consistent with the registered industrial camera benchmark shooting parameter, and then each pixel in the image is traversed in the resolution row and column order again, and a new gray value is assigned to each channel by using a linear mapping formula. Through point-by-point checking of the previously obtained bright spot distribution map, it is avoided that a value mutation occurs in the mapping, and the originally bright pixels greater than 220 are dispersed and adjusted to the range of 200 to 220. Similarly, the pixels lower than 30 are boosted and made close to the interval of 40 to 50. Through the channel mapping process, the number of extremely bright or dark areas is reduced. Then, a unified statistics is performed on the reacquired channel values. If it is found that the brightness distribution is still obviously accumulated, further correction is performed according to the second group of brightness monitoring sequences collected from the device site until the main pixel distribution of each channel tends to be centered. Finally, the combined channel is merged to generate a new image matrix, and whether the row and column positions of each pixel are correctly matched with the previously reserved marking information is checked to prevent the occurrence of coordinate misalignment in the merging, to obtain a preprocessing result.
[0120] The feature set acquisition step is:
[0121] The preprocessing result is obtained, the image is decomposed by using an image pyramid, image levels of different scales are constructed, and a multi-scale decomposed image is obtained.
[0122] According to the multi-scale decomposed image, a local contrast score is calculated, and the calculation formula is:
[0123]
[0124] In the formula, CF represents the local contrast score, P represents the pixel value, and S represents the size of the image. i,jrepresents the gray value of the i-th level scale j-th pixel of the image after multi-scale decomposition, N represents the number of local pixel blocks at the current scale, P avg represents the average gray value of all pixels at the current scale, P max represents the maximum gray value of the pixel at the current scale, P min represents the minimum gray value of the pixel at the current scale, k represents the number of scales obtained after image decomposition, and z represents the total number of pixels at the current scale.
[0125] According to the local contrast score, combined with the texture distribution characteristics at different scales, the structural changes of the image at each scale are extracted to generate a feature set.
[0126] Specifically, after obtaining the preprocessing result, the image information corresponding to the result is read and image pyramid decomposition is performed. The obtained image is first divided into several levels in a top-down hierarchical manner. Each level reduces the resolution by a fixed ratio. For example, on the original 1920x1080 resolution image, smaller images such as 960x540 and 480x270 are formed in turn, so that different scales of the same picture can be observed in parallel. After the row and column indexes of the scaled images are rearranged, the sub-images are analyzed row by row, and a preliminary reference value range is set based on the previously recorded pixel gray value distribution. For example, the gray value is compared with the interval of 0 to 255, and the brightness concentration degree is used as a separate observation indicator. If the number of pixels in a certain region of a certain level image is significantly higher than the average in the high-light interval of 180 to 255, the brightness statistics collected in the industrial field for a long time are referred to for further confirmation. If it is confirmed that the high-light interval exceeds the pre-set threshold of 30%, the corresponding region of this level image is subjected to histogram balancing processing and the average value and variance of the pixels during the process are recorded. After the gray balance of all levels is completed, multi-scale image levels are formed. Subsequently, all level images are matched and corresponding to each other pixel by pixel to ensure that consistent coordinate mapping is identified among multiple scales. For regions that do not meet the pixel continuity, unreasonable pixels are investigated and corrected by referring to the previous noise distribution data. Through the observation of the image after multi-scale decomposition, the illumination changes of the same region at different resolutions can be better compared in subsequent processing. Finally, after all the layered image information is collected, the specific number of the current level and the row and column size corresponding to each level are confirmed and recorded to obtain the image after multi-scale decomposition.
[0127] The formula has the benefit that the absolute difference between the pixel at the multi-scale and the average value of the local pixel block is accumulated by the numerator, and the square deviation and the range are combined in the denominator, which can quantize the dispersion of the image in terms of local contrast, helping to analyze the image structure at different scales in detail.
[0128] P i,j The acquisition step is:
[0129] This parameter represents the gray value of the image after multi-scale decomposition at the i-th level scale and the j-th pixel. In actual measurement, the gray value at the corresponding coordinates needs to be extracted and recorded in the field by traversing each level image in row and column order. When performing image pyramid decomposition, since the resolution of each level changes, the row and column indices of the j-th pixel are not exactly the same as those of other levels, but they are unified into an index system to ensure that the order of all pixels can be corresponded. The key to obtaining this parameter is to scale, filter or other types of denoise the original image collected in the field, and then arrange the pixels according to the new resolution, so as to obtain the P i,j of each level. For example, at the 1st level scale, if the image size is 512x384, the total number of pixels is 196608, by extracting the gray value of each of the 196608 pixels, they are named P 1,1 , P 1,2 , … At the 2nd level scale, the image size is 256x192, and the total number of pixels is 49152, and P 2,1 , P 2,2 , … can also be obtained.
[0130] The acquisition step of N is:
[0131] This parameter represents the number of local pixel blocks at the current scale. Each level scale image will be divided into a plurality of pixel blocks according to certain rules, and these blocks can be non-overlapping or partially overlapping. In field detection, the complexity of the bearing surface will be used to determine the size and number of local blocks. If the resolution of the image after pyramid decomposition to a certain level is 256x192, it can be divided into 16x12=192 local blocks, then N=192. In order to determine the accurate value of N, the technician will first determine how large a range of texture he wants to observe at this level scale, and then divide the block size according to the distribution of the texture details, and finally count the total number of pixel blocks. For example, in actual detection, if the size of each block region is set to 16x16 pixels, then the entire image of 256x192 can be subdivided into (256 / 16)x(192 / 16)=16x12=192 blocks, i.e. N=192.
[0132] The acquisition step of P avg is:
[0133] This parameter represents the average gray value of all pixels at the current scale. The total pixel gray value at this scale needs to be accumulated and then divided by the total number of pixels to obtain the overall average gray value. In field application, all pixels retained at this resolution from the image collected by the industrial camera are traversed, and all gray values are accumulated, and then divided by the total number of pixels of the image. In order to eliminate special abnormal pixels, the technical personnel will query the brightness distribution record collected before, and make appropriate correction or elimination of the pixels with high brightness or dark and extremely small number, and then perform the average value operation. If the gray value of each pixel in the 256x192 size image is distributed in the interval of 0 to 255, the worker can record the traversal result, such as the total cumulative value is 286720, then the average gray value P avg = 286720 / (256x192) = 286720 / 49152 ≈ 5.83.
[0134] P max The acquisition steps are:
[0135] This is the maximum gray value of the pixel at the current scale, which needs to be scanned in the same resolution range and find the pixel with the highest gray value, which is taken as P max . In the field, the maximum value of each pixel is compared by using the row-by-row retrieval method, and the maximum value is retained as the final result. For example, in a 256x192 image, it may be found after traversal that the gray value of a pixel reaches 220, and 220 is taken as P max . When acquiring, the original gray value collected also needs to be verified for effectiveness. If some pixels have a reading of 275 due to noise or out-of-range factors, the saturated value 255 of the sensor measured before is referred to for truncation or correction, and finally the value after correction not exceeding 255 is included in the candidate range of P max .
[0136] P min The acquisition steps are:
[0137] This parameter represents the minimum gray value of the pixel at the current scale, which is similar to P max , which is determined by traversing and finding the pixel with the smallest gray value. When recording in the field, an initial minimum value is first set, and then compared with other pixels one by one, and if a smaller value is found, it is updated, and finally the global minimum gray value is obtained after traversing all pixels. If a pixel with a value of -10 is detected, the technical personnel will correct it to 0 according to the zero lower limit obtained before, because the gray value of the industrial camera will not be less than 0 in normal operation. For a certain level image with a total number of pixels of 49152, if the lowest value is found to be 3, then P min = 3.
[0138] The acquisition step of k is:
[0139] The number of scales obtained after image decomposition. The common image pyramid setting in the industry is to generate 2 to 4 scales by successively downsampling the image without affecting the macro details. The specific number of scales needs to be determined according to the actual needs of the bearing surface defect detection task. If precise positioning of smaller cracks is required, k can be increased so that sufficient details can be retained at a smaller resolution level. In the field, technicians will refer to the accuracy requirements, detection time consumption, and hardware resources in the previous round of detection records to determine the number of pyramid layers and record the number in the system. For example, in a 1024x768 image detection task, using a three-layer pyramid can make k=3.
[0140] The acquisition step of z is:
[0141] The total number of pixels at the current scale, which directly corresponds to the resolution of the image at that scale. If the size of a certain level image is 256x192, the total number of pixels is 49152, so z=49152. In field statistics, the actual effective pixels at this resolution need to be traversed and the gray values are recorded. If a small amount of invalid pixels (such as white space caused by uneven lighting at the image edge) are excluded, the pixels can be removed before statistics, and the z obtained will be slightly smaller than the theoretical product of the resolution. However, in most cases, the entire image pixels are counted into statistics, and z is equal to the product of the pixel row and column.
[0142] Calculation process:
[0143] In a detection task, through the multi-scale decomposed image obtained before, k=3 is taken to represent three levels, the number of pixels at a certain scale is set to z=49152, and the number of local pixel blocks is determined as N=192. After traversing the collected gray data, P avg =5.83 is calculated, and P max =220 and P min =3 are obtained when detecting the extreme value. In the numerator part, the gray value of each pixel is first subtracted from the average value of the corresponding local block and the absolute value is accumulated, for example, for the i=1 level, the jth pixel belongs to a certain local block, then the absolute value is subtracted from the average value of the block, and the sum of all pixels at this level is summed up and added to the results of the second and third levels. If a typical pixel gray value is 15 and the corresponding local block average value is 20, the absolute difference is 5, and the rest of the pixels are processed similarly. After the statistics are completed, assume that the sum of the absolute differences of the three layers is A;
[0144] Looking at the denominator part, the gray value of each pixel is subtracted from P avg =5.83, squared and accumulated, then squared, and multiplied by |Pmax P min | = 217 addition, assuming the square root of the sum of the square differences of the gray scale is B, then the denominator is B + 217.
[0145] Therefore:
[0146]
[0147] After all the pixels are traversed, A = 256000, B = 850, the final calculation can be performed:
[0148]
[0149] The results show that under the observation of the three-layer pyramid local block, the local contrast score of the image is 240.11, which belongs to the relatively high range, indicating that there is obvious difference between the bright and dark areas in the multi-scale structure of the image. If the detection process needs lower contrast, the brightness or local equalization range of the image can be adjusted, or the size of the local block can be refined. If the value is lower than 30, it means that the image is relatively smooth and lacks obvious brightness contrast.
[0150] According to the local contrast score CF obtained in the foregoing, the texture distribution record of each level in the three-layer image is processed, and all pixels are traversed in row and column order in each level image. The gray scale mode of each pixel is collected, and the adjacent pixels are compared in sequence. When the comparison result shows that there is a gray scale fluctuation amplitude exceeding the pre-set threshold 10 in the same local area, and the corresponding pixel ratio is higher than 30% of the local block area, the area is marked as a texture mutation area. Then the edge range is scanned along the surrounding to capture the edge range. Through on-site sample comparison, it is found that these texture mutation areas often correspond to the initial traces of wear or cracks on the bearing surface. After confirmation, the spatial coordinates of these mutation areas and the gray scale average distribution under each level are recorded, and they are compared in order from the first level to the third level. If multiple levels contain mutation phenomena with the same or adjacent pixel coordinate range, it is determined as a larger probability of structural change feature, and the structural change features under different scales are collected and formed into a statistical list. In the list, the pixel position, local gray scale distribution and fluctuation value of the mutation area are listed, and its historical appearance frequency in the previous detection sample is marked. After all the statistics are completed, the final output of the multi-scale feature set is output.
[0151] The acquisition steps of the enhanced feature map are:
[0152] Based on the feature set, the enhanced parameter is calculated, and the calculation formula is:
[0153]
[0154] wherein E represents an enhancement parameter, F n represents the value of the nth feature, σ n represents the standard deviation of the nth feature, μ n represents the average value of the nth feature, TN is the total number of features in the feature set;
[0155] According to the enhancement parameter, the intensity of each feature is adjusted to obtain an enhanced feature map.
[0156] Specifically, the formula has the benefit that by introducing This denominator structure makes it possible to maintain a moderate enhancement range in the range of large or small feature values, and after accumulating the products of all features, the cubic root is used, which takes into account the balance between high and low feature values.
[0157] F n The acquisition steps are as follows:
[0158] This parameter represents the value of the nth feature, which can cover, for example, texture directionality, texture detail intensity, local contrast gradient, etc. During data acquisition, the previously obtained feature set needs to be checked one by one, and each feature needs to be expressed in a quantitative way. Taking texture directionality as an example, the gray scale distribution record collected on site can be used to calculate the specific value according to the gradient change curve of the image at different angles, which is used to represent the directionality of the texture. If the feature contains multiple dimensions, the data of different dimensions will be combined into a numerical expression first, and then recorded in the spreadsheet one by one. During the entire process, the light monitoring sequence and texture statistical record saved in the device are used to remove redundant information through continuous contrast analysis and principal component extraction, and finally the deterministic feature value F n is obtained. In one example, 4 significant texture features have been detected, with values of 18, 30, 22, and 35, which correspond to the 1st, 2nd, 3rd, and 4th features in the feature set, i.e. F1=18, F2=30, F3=22, and F4=35.
[0159] σ n The acquisition steps are as follows:
[0160] This parameter represents the standard deviation of the nth feature, which is used to measure the degree of deviation of this feature from uniform distribution in the collected samples. In actual detection, the technician will repeatedly measure the same type of feature under multiple shooting or different working conditions, store the obtained multiple sets of values in a continuous observation sequence, and then calculate the variance of each feature through the variance formula, and then take the square root to obtain the standard deviation σ nFor example, for a certain texture directionality feature, the feature value is repeatedly obtained under different rotation speeds, different loads and different lighting conditions. If 5 values are recorded: 19, 21, 20, 20, 22, the mean value 20.4 of the sequence can be calculated first, then the sum of the square of the difference between each value and the mean value is calculated in turn, and then divided by the sample size to obtain the variance, and finally the square root is obtained σ n In this example, the variance is about 1.84, and the square root is about 1.36, so σ n = 1.36.
[0161] μ n The acquisition steps are:
[0162] This parameter represents the mean value of the nth feature, which is usually obtained by arithmetic mean of the values obtained in multiple sampling of the same feature. When obtained in the field, the values of the same feature at different time points or under different conditions need to be recorded first, and then all the recorded values are added and divided by the sample size. To ensure the stability of the value, the extreme abnormal readings of the sensor may be removed, and the measurement is repeated during the period of large light fluctuation to ensure that μ n can truly reflect the level of the feature under normal detection conditions. For example, if the values of the feature obtained in 5 detections are 10.5, 10.8, 11.2, 9.9 and 10.6, the cumulative result is 53.0, the total sample size is 5, and μ n = 53.0 / 5 = 10.6.
[0163] The acquisition steps of TN are:
[0164] This parameter represents the total number of features in the feature set, which needs to be clearly counted after all feature detection, screening, classification in the early stage. In the acquisition process, the staff will first list all the identifiable and quantifiable features, number them in order, and then confirm whether the complete collection and calculation conditions are met. For features that meet the conditions, they are considered as valid features and are included in the set, and finally the total number of these valid feature entries is recorded as TN. In a complete bearing surface defect detection, common feature types include gray scale change, edge strength, texture direction, first-order difference, second-order difference and other aspects, which can be divided into several dimensions. Relevant personnel will record and number all features during acceptance to facilitate subsequent calling. If the final number of available features is 10, TN = 10.
[0165] Calculation process:
[0166] To give a specific example, combined with the example feature values and standard deviation and mean value listed above, TN = 4 is selected and specified:
[0167] F1 = 18, σ1 = 1.36, μ1 = 10.6
[0168] F2 = 30, σ2 = 1.50, μ2 = 12.0
[0169] F3 = 22, σ3 = 2.00, μ3 = 11.0
[0170] F4 = 35, σ4 = 2.30, μ4 = 9.8
[0171] First, calculate the denominator in the logarithmic operation:
[0172]
[0173] Then, for each feature:
[0174]
[0175] Item-by-item operation, for example:
[0176] The first term:
[0177]
[0178] The second term:
[0179]
[0180] The third term:
[0181]
[0182] The fourth term:
[0183]
[0184] The sum of the four terms is denoted as S:
[0185] S = 32.94 + 66.60 + 43.12 + 84.00 = 226.66
[0186] Substitute into the formula:
[0187] E = (S) 1 / 3 = (226.66) 1 / 3
[0188] E ≈ 6.08
[0189] This result shows that the enhancement parameter corresponding to the current feature set is approximately 6.08, and the value greater than 5 indicates that the overall activity of the features is high, which is easy to enlarge the intensity difference in subsequent enhancement processing, and the value less than 2 represents that the overall feature distribution is stable. The technical personnel can determine the allocation strategy of the increase of each feature according to the comparison relationship between the enhancement parameter and the interval between 5 and 10.
[0190] Based on the obtained enhancement parameter E, the value of which is between 5 and 10, and the corresponding data of local contrast, texture dispersion, and edge sharpness in all the feature records listed above, the gray scale range, gradient range, and spatial distribution degree of each feature in the feature sequence are compared one by one. When the gray scale range of a certain feature is between 50 and 200 and the gradient range is between 10 and 30, it is marked as a normal intensity feature without additional significant enhancement. When the gradient range of certain features in the same sequence is higher than 30 and the feature value is between 220 and 255, the intensity of the features is set to a larger multiple during the enhancement processing. The specific method includes locating the corresponding features in the pixel area in the order of rows and columns, performing a successive addition operation on the gray scale value of each pixel point to ensure that the pixel range of the feature is completely covered during the calculation, and using a truncation method to control the pixel value within 255 when it exceeds the preset threshold 255. The part of the feature value in the low interval, i.e., less than 50, is increased in brightness by multiplying the enhancement parameter by 1.2 to 1.5 times. The part of the feature value very close to the middle interval is recorded in a comparison table for subsequent centralized checking and confirmation of its distribution state. After the statistics are completed, all features are summarized, the gradient mean value and the enhancement results in each pixel range are compared, and the final enhanced feature map is obtained after adjustment.
[0191] The acquisition steps of the classified defect result are as follows:
[0192] The enhanced feature map is processed using the U-Net network to identify and label the cracks and peeling defects in the image, obtaining the unoptimized defect recognition result.
[0193] Image post-processing is performed on the unoptimized defect recognition result, including using threshold segmentation to separate the foreground and background, applying morphological dilation and erosion to clarify the defect boundary, and generating the classified defect result.
[0194] Specifically, based on the previously obtained enhanced feature map, the texture and gray scale features of each pixel and its surrounding neighborhood are mapped for training and testing the U-Net neural network. First, multiple images containing cracks and peeling defects are selected from the previously labeled sample library. Then, all images are divided into training and validation groups in a ratio of 8:2. The training group images are read row by row, and their corresponding real mask distribution data is loaded into memory. The learning rate and batch size of the network are adjusted to control the training convergence process. During training, the features are matched with the target labels pixel by pixel. After one forward propagation, the pixel-level difference is calculated, and the cross-entropy is used as the loss value. The error is backtracked layer by layer, and the learnable parameters of the network are updated. After several hundred iterations, the detection results on the validation group gradually stabilize, confirming that the network has the ability to distinguish between cracks and peeling defects. Then, the trained network is used to infer the previously obtained enhanced feature map pixel by pixel. In the encoding-decoding process under the U-shaped structure, multi-scale features are extracted and mapped to the defect edge and center area. The inference output is integrated, and pixels with a matching degree exceeding the specified value of 0.8 are retained. Finally, the crack and peeling defect mask results are generated for each input image, obtaining the unoptimized defect recognition results.
[0195] According to the unoptimized defect recognition results obtained, the prediction type information of each pixel is read and distinguished from the background pixels. To further distinguish the foreground and background, a threshold segmentation method is used. The gray mean value of typical defect pixels in the field data is calculated and defined as the reference value 150. If some pixels in the detection exceed this reference value, they are classified as foreground, otherwise as background. This threshold value is set by comparing the mean value distribution of 100 defect images. Then, during the morphological dilation operation on the foreground area, each pixel is checked. If multiple consecutive markers are detected in adjacent pixels and the pixel count exceeds the specified number 100, they are classified as the same region. The pixel horizontal and vertical coordinates are recorded and adjacency queries are performed. A 3x3 structure unit is applied to the pixels for dilation. Then, a corrosion operation is performed on the dilation results. If more than half of the neighborhood around any pixel still retains the foreground label during corrosion, the pixel is retained, otherwise it is converted to the background. After morphological processing, the type information of all pixels is checked in row and column order. The final confirmation of the defect area is made, and the crack and peeling ranges and corresponding pixel labels are summarized to generate the classified defect results.
[0196] The steps for obtaining the defect results are as follows:
[0197] Obtain the classified defect results, extract the position information of each recognized defect, analyze the boundary shape and size in the image coordinates, and form the spatial distribution data of the defects.
[0198] Based on the spatial distribution data of defects, the defect severity score is calculated, and the calculation formula is:
[0199]
[0200] Wherein, D represents the defect severity score, X i ,Y i represents the center coordinates of the i-th defect, X c ,Y c represents the center of gravity coordinates of all defects, FG i represents the average gray gradient of the i-th defect area, A i represents the area of the i-th defect, G med represents the median gray gradient of all defect areas, M represents the total number of defects detected;
[0201] According to the defect severity score, the spatial position, type and severity of each defect are sorted to generate the defect result.
[0202] Specifically, the classified defect result is obtained, the position information of each identified defect is extracted, the boundary shape and size in the image coordinates are analyzed, the spatial distribution data of the defect is formed, the previously recorded defect recognition coordinate sequence is read and parsed line by line, each record contains the starting point and ending point of the defect horizontal and vertical coordinates and the possible existence of the arc or fracture trend, it is necessary to compare the previously saved image resolution range to confirm whether these coordinates are located in the effective area, if the coordinate range exceeds the image width or height, the records not in the image effective area are removed by referring to the original resolution upper limit set when the on-site camera is shooting, then the screened coordinate information is associated to the corresponding defect label in a one-to-one manner, through row and column scanning, the outermost boundary of the defect on the image can be found and the number of pixels occupied can be calculated, so that the perimeter and approximate shape of the boundary are obtained, if the number of external edge points of a certain defect exceeds the predetermined standard of 800 pixels, it will be marked as a large range defect, this 800 standard comes from the area ratio statistics when 50 images with defects are measured in the industrial field, the local width and height data of the defect can be obtained by calculating the distance between all external edge points, if the aspect ratio of the defect is greater than 2 and the horizontal span exceeds 150 pixels, it can be identified as an extended defect, the measurement results of the boundary shape and size of these defects are recorded one by one, and then matched with the previously obtained pixel coordinates to generate a complete spatial distribution data.
[0203] The advantage of the formula is that by multiplying the Euclidean distance between the defect center and the centroid of the numerator by the average gray-level gradient, it is possible to comprehensively consider the defect's position on the image plane and its local gray-level gradient. At the same time, the value of the defect area and its gray-level gradient deviation from the median is introduced into the denominator so as to reflect the combined influence of positional dispersion and gray-level complexity in a single score.
[0204] X i ,Y i The steps to obtain it are as follows:
[0205] These represent the center coordinates of the i-th defect. After completing defect boundary tracing and determining the connected regions of the defect, the center position needs to be calculated using the mean or geometric center. On-site, the center point is obtained by averaging the coordinates of all pixels within the defect region, or by combining the centers of the outermost and innermost points. If the pixel set of a certain defect occupies several rows and columns in the image, then the row and column coordinate values can be accumulated pixel by pixel and divided by the number of pixels to obtain (X...). i ,Y i In the example, for a defect with an area of 200, if the sum of its covered row and column coordinates is (24000, 18000), then X i =24000 / 200=120, Y i =18000 / 200=90.
[0206] X c ,Y c The steps to obtain it are as follows:
[0207] These represent the centroid coordinates of all defects and need to be calculated after summing the center coordinates of all defects. If a total of M defects are detected on site, the center of each defect is (X... i ,Y i ), then it is possible to apply this to all X i Take the average or a weighted average (if the defect areas are different) to obtain X. c Similarly, Y can be calculated. c To ensure data accuracy, technicians must first confirm that the centers of these defects are in the same image coordinate system and eliminate errors caused by the edges. If the three defect centers are (120, 90), (205, 95), and (180, 150) respectively, then the global centroid (168.3, 111.7) can be obtained by summing these coordinates and dividing by 3.
[0208] FG i The steps to obtain it are as follows:
[0209] This parameter represents the average grayscale gradient of the i-th defect region. During on-site measurement, the grayscale gradient of each pixel needs to be extracted from the previously separated defect pixel set, and then these gradients are accumulated or weighted to obtain the average value for the entire defect region. In industrial testing, the local gradient of each pixel is obtained through the grayscale difference of its surroundings; for example, the difference between the horizontal and vertical directions at position (x, y) is taken as the gradient magnitude. Then, the gradients of all pixels in the defect region are accumulated and divided by the number of pixels to obtain FG. i In one example, the defect area contains 300 pixels. The technician calculates the local gradient for each pixel and obtains a sum of 1800, then FG i =1800 / 300=6.
[0210] A i The steps to obtain it are as follows:
[0211] This parameter corresponds to the area of the i-th defect, usually measured by the number of pixels the defect area covers on the image coordinates. During field acquisition, if a defect consists of 200 consecutive pixels, then A... i =200. If a higher resolution image is used, the same defect may appear as a larger or smaller value at the pixel level. This needs to be matched with the previously established calibration data based on physical size to compare its area with other defects. When performing area calculations, technicians first mark the defect pixels using connected component search or boundary tracing, and then sum the counts of these marked pixels to obtain A. i If there are multiple defects in the same image, they are distinguished and their area values are recorded according to the different connected regions.
[0212] G med The steps to obtain it are as follows:
[0213] This parameter represents the median grayscale gradient of all defect regions. The FG (Functional Gradient) of each defect needs to be summarized first. i Then a list is formed, and then FG in the list is... i Sort the defects from smallest to largest. For an odd number of defects, take the median value. If the number of defects is even, take the average of the two median values as the median. In industrial settings, the median can be calculated by averaging the gradient FG of all defects after multiple inspections. i Record the data; when dozens of defects occur, calculate G by taking the values from the middle position or two middle positions. med If all defects FG are found in the test i The given numbers are 3, 4, 6, 7, 9. The sorted result is 3, 4, 6, 7, 9. The middle number, 6, is G. med .
[0214] The steps to obtain M are as follows:
[0215] This parameter represents the total number of defects detected, that is, the number of all real defects identified in the current image detection. The final defect count is usually obtained after morphological processing or screening of false defects in the field. If 5 connected domains are found in an image and all are confirmed to be actual defects, then M = 5.
[0216] Calculation process:
[0217] In one detection, the device identifies M = 3 defects, with center coordinates (X1, Y1) = (120, 90), (X2, Y2) = (205, 95), (X3, Y3) = (180, 150), and areas A1 = 200, A2 = 220, A3 = 300, average gray level gradients FG1 = 5, FG2 = 8, FG3 = 10. First, calculate the barycentric coordinates (X c ,Y c ) of all defects, which can be simply averaged:
[0218]
[0219] Subtract each defect center from the barycenter and calculate the Euclidean distance multiplied by its FG i and accumulate:
[0220] Defect 1:
[0221]
[0222] Defect 2:
[0223]
[0224] Defect 3:
[0225]
[0226] The sum of the molecular part is approximately 988.0, i.e., 264.6 + 322.48 + 400.9 = 988.0;
[0227] Looking at the denominator, first calculate the FG i list of all defects, which is 5, 8, 10, and sorted as 5, 8, 10, so the median G med = 8, and then add the area of each defect to |FG i -G med |:
[0228] Defect 1: 200 + |5-8| = 200 + 3 = 203;
[0229] Defect 2: 220 + |8-8| = 220 + 0 = 220;
[0230] Defect 3: 300+|10-8| = 300+2 = 302;
[0231] Sum of denominator parts = 203+220+302 = 725;
[0232] Final score:
[0233]
[0234] The result shows that when the score D is about 1.36, it means that the defects in the current image are at a relatively small comprehensive level in terms of position dispersion and gray gradient features. If the value of D exceeds 2, it means that there are defects with more significant distribution range or larger gradient. The user can set a reference threshold according to the actual detection task needs and judge the size relationship between D and the threshold, so as to further distinguish the severity of the defects.
[0235] According to the aforementioned defect severity score D, the score is read in the interval of 0 to 3, and combined with the spatial distribution data of each defect, when a defect with a score higher than 2 is detected, it is classified as a defect that needs to be paid attention to, and the center point and boundary vertex recorded in the image coordinates are checked in turn. If it is found that the defect area value exceeds 400 pixels and has no obvious overlap with other defect areas, it is determined to be a high-severity defect distributed alone, and the detailed area, gray gradient and boundary features are added to the defect item list. If a defect with a score lower than 1 is detected and the area is less than 150 pixels, it is considered to be a low-severity defect and recorded as a secondary item. For the remaining defects with a score between 1 and 2, they are positioned at an intermediate level, and the boundary concave-convex situation is continued to be viewed. If the boundary irregularity degree exceeds the previously measured threshold value 0.3, it is marked as a complex-shaped moderate defect, and the geometric features of the outermost edge pixels are supplemented in the record for reference for subsequent maintenance. Finally, according to the spatial position and score interval of all defects, the type, center coordinates, boundary shape and severity range of each defect are given, and the defect result is generated.
Claims
1. An image recognition-based automatic detection system for bearing surface defects, characterized by, The system comprises: An image acquisition and preprocessing module acquires a bearing surface image, crops and filters the image to remove noise and adjust the contrast, and obtains a processed image; performs grayscale conversion on the processed image to generate a preprocessing result; A feature extraction and enhancement module extracts local contrast and texture features at each scale based on the preprocessing result by decomposing the image using an image pyramid, and generates a feature set; adjusts enhancement parameters according to the statistical distribution of the feature set to obtain an enhanced feature map; A defect classification and labeling module uses a U-Net network to analyze the image based on the enhanced feature map, identifies cracks and spalling defects on the bearing surface, and obtains a classified defect result; A result output and report module sorts out the position, type and severity of each detected defect based on the classified defect result, and obtains a defect result; The step of obtaining the processed image is: Acquire a bearing surface image, crop the non-effective area at the edge of the image, and use spatial domain filtering to optimize the signal-to-noise ratio of the image to obtain a cropped and filtered image; According to the cropped and filtered image, calculate the contrast enhancement index, and the calculation formula is: wherein C represents a contrast enhancement index, I i,j represents the pixel gray value of the i-th row and j-th column in the cropped filtered image, M represents the global average gray value of the cropped filtered image, I max represents the maximum gray value in the cropped filtered image, I min represents the minimum gray value in the cropped filtered image, and m and n represent the number of rows and columns of the image, respectively. According to the contrast enhancement index, adjust the grayscale histogram distribution of the cropped and filtered image to obtain a processed image; The step of obtaining the defect result is: Obtain the classified defect result, extract the position information of each identified defect, analyze the boundary shape and size in the image coordinates, and form the spatial distribution data of the defect; Based on the spatial distribution data of the defect, calculate the defect severity score, and the calculation formula is: wherein D represents the defect severity score, X i ,Y i represents the center coordinates of the i-th defect, X c ,Y c represents the center of gravity coordinates of all defects, FG i represents the average gray level gradient of the i-th defect region, A i represents the area of the i-th defect, G med represents the median gray level gradient of all defect regions, M represents the total number of defects detected; According to the defect severity score, sort out the spatial position, type and severity of each defect, and generate a defect result.
2. The image recognition based automatic detection system for bearing surface defects according to claim 1, wherein, The step of obtaining the preprocessing result is: Obtain the processed image, separate the pixel values of the red, green and blue channels, and simultaneously convert to a standardized color space to obtain an image after channel separation; According to the image after channel separation, calculate the gray value distribution uniformity, and the calculation formula is: Where AG represents the gray value distribution uniformity, R represents the pixel value of the red channel in the image after channel separation, G represents the pixel value of the green channel in the image after channel separation, B represents the pixel value of the blue channel in the image after channel separation, and HM represents the global average gray value of the image after channel separation; According to the gray value distribution uniformity, perform gray mapping on the image after channel separation to generate a preprocessing result.
3. The image recognition based automatic detection system for bearing surface defects according to claim 1, wherein, The step of obtaining the feature set is: Obtain the preprocessing result, decompose the image using an image pyramid, and construct image levels of different scales to obtain a multi-scale decomposed image; According to the multi-scale decomposed image, calculate the local contrast score, and the calculation formula is: where CF represents the local contrast score, P i,j represents the gray value of the image decomposed by multi-scale at the i-th scale and the j-th pixel, N represents the number of local pixel blocks at the current scale, P avg represents the average gray value of all pixels at the current scale, P max represents the maximum gray value of the pixel at the current scale, P min represents the minimum gray value of the pixel at the current scale, k represents the number of scales obtained after image decomposition, and z represents the total number of pixels at the current scale. According to the local contrast score, combine the texture distribution features at different scales to extract the structural changes of the image at each scale, and generate a feature set.
4. The image recognition based automatic detection system for bearing surface defects according to claim 1, wherein, The step of obtaining the enhanced feature map is: Based on the feature set, calculate the enhancement parameter, and the calculation formula is: where E denotes an enhancement parameter, F n denotes the value of the n-th feature, σ n denotes the standard deviation of the n-th feature, μ n denotes the mean value of the n-th feature, TN is the total number of features in the feature set; According to the enhancement parameter, adjust the intensity of each feature to obtain an enhanced feature map.
5. The image recognition based automatic detection system for bearing surface defects according to claim 1, wherein, The obtaining step of the classified defect result is: The enhanced feature map is processed using a U-Net network to identify and label the cracks and peeling defects in the image, to obtain an unoptimized defect identification result; Image post-processing is performed on the unoptimized defect identification result, including using threshold segmentation to separate the foreground and background, applying morphological dilation and erosion to clarify the defect boundary, to generate a classified defect result.
Citation Information
Patent Citations
Self-supervised water surface image enhancement method and related equipment
CN116579953A
Railway accessory defect detection method and system
CN118037726A
Cited By
Bearing quality detection device
CN224456562U