A method for detecting abnormalities on the surface of non-woven masks

By constructing and adjusting the filter in mask surface detection, combining Hough transform and filtering effect value analysis, the problem of difficult spectrum filtering parameters in the prior art is solved, and more efficient and accurate detection of mask surface abnormalities is achieved.

CN118898601BActive Publication Date: 2024-12-13HAIMEN QIWEI SWEATER WEAVING
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411375519.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-09-30
Publication Date
2024-12-13
Estimated Expiration
2044-09-30

AI Technical Summary

Technical Problem

In the prior art, in the detection of surface abnormalities of masks, the spectrum filtering parameters are difficult to adapt and intelligently, resulting in unsatisfactory detection results.

Method used

By obtaining the spectrum image of the mask surface, an initial filter is constructed based on the frequency image characteristics, and the filter length is adjusted by preset proportions to obtain filters of different sizes, and the spectrum image is filtered, combined with Hough transformation and filter effect value analysis , select the optimal filtered image for edge detection to determine abnormal surface of the mask.

Benefits of technology

The accuracy and efficiency of the detection results are improved, and the filtering effect is intuitively reflected through the quantized filtering effect value, reducing the amount of calculation, and achieving efficient detection of mask surface abnormalities.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118898601B_ABST
    Figure CN118898601B_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of data processing, and in particular to a method for detecting anomalies on the surface of a non-woven mask. The method comprises the following steps: obtaining a grayscale image and a spectrum image of the mask surface, setting the length and width of an initial filter based on the spectrum image, shrinking the length of the initial filter according to a preset ratio to obtain filters of different sizes; using filters of different sizes to filter the spectrum image respectively to obtain a filtered image of the mask surface; obtaining a difference image between each filtered image and a grayscale image, performing a Hough transform on the difference image to obtain a highlight point and selecting a target point, obtaining a filtering effect value of a difference image where a target point that meets a preset condition is located to obtain an optimal image, performing edge detection on the filtered image corresponding to the optimal image, and judging whether the mask surface has an abnormality according to the edge detection result; performing anomaly detection on an image with a better filtering effect, so that the obtained result is more accurate and more efficient.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of data processing, and in particular to a method for detecting surface abnormalities of a non-woven mask. Background Art

[0002] In recent years, due to the epidemic, the demand for masks, as an important epidemic prevention product, has surged, so people are paying more and more attention to the quality of mask products; and masks are generally produced in large quantities during the normal production process. If there are problems with the raw materials or the machine fails during the production process, it will cause damage to the surface of the mask.

[0003] In the prior art, whether there is damage on the surface of the mask is often determined through machine vision. During the analysis, the spectrum is used to remove the periodic interference noise in the mask image. However, the parameter values ​​of the spectrum filter are often variable, and the optimal parameters corresponding to different images are also different. Therefore, it is generally difficult to achieve adaptive and intelligent setting of the parameter values, resulting in less than ideal results for mask surface detection. Summary of the invention

[0004] In order to solve the above technical problems, the object of the present invention is to provide a method for detecting surface abnormalities of a non-woven mask, the method comprising the following steps:

[0005] Collecting a mask image on the surface of the mask, and gray-scaling the mask image to obtain a grayscale image;

[0006] Acquire a spectrum image of the grayscale image, use the width of the spectrum image as the length of an initial filter, and shrink the length of the initial filter according to a preset ratio to obtain filters of different sizes;

[0007] The spectrum image is filtered by using filters of different sizes to obtain a filtered image of the mask surface; a difference image between each filtered image and the grayscale image is obtained, and a Hough transform is performed on the difference image to obtain a highlight point, and three points with the largest brightness values ​​among all the highlight points are selected as target points, and the slope and the Euclidean distance between the target points are calculated. When the slope and the Euclidean distance meet the preset conditions, the filtering effect value of the difference image where the target point is located is obtained;

[0008] The difference image when the filtering effect value is the largest is selected as the optimal image, edge detection is performed on the filtered image corresponding to the optimal image, and whether there is an abnormality on the surface of the mask is determined according to the edge detection result.

[0009] Preferably, the step of shrinking the length of the initial filter according to a preset ratio to obtain filters of different sizes comprises:

[0010] Obtain the number of currently contracted filters, calculate the product of the number of filters and a preset ratio, and use the difference between 1 and the product as the contraction ratio;

[0011] The product of the contraction ratio and the length of the initial filter is the length of the contracted filter.

[0012] Preferably, the method for obtaining the width of the initial filter is:

[0013] The spectrum image is binarized to obtain the longest vertical line, wherein the maximum width of the vertical line is the width of the initial filter.

[0014] Preferably, the preset condition is that the slope between the first target point and the second target point is equal to the slope between the first target point and the third target point, and the Euclidean distance between the first target point and the second target point is equal to the Euclidean distance between the second target point and the third target point.

[0015] Preferably, the step of obtaining the filtering effect value of the difference image where the target point is located includes:

[0016] Calculating a first cumulative sum of highlight values ​​corresponding to the target point, and a second cumulative sum of highlight values ​​of other highlight points except the target point corresponding to the difference image where the target point is located;

[0017] The difference between the first accumulated sum and the second accumulated sum is the filtering effect value.

[0018] Preferably, after the step of selecting the difference image when the filtering effect value is the largest as the optimal image, the method further includes:

[0019] A size of a corresponding filter obtained based on the optimal image is taken as a basic size, and an initial filter for the next filtering process is constructed according to the basic size.

[0020] The present invention has the following beneficial effects: the embodiment of the present invention obtains a spectrum image corresponding to the mask surface, constructs an initial filter based on the characteristics of the frequency image, and continuously adjusts the length of the initial filter to obtain filters of different sizes, and the adjustment is performed based on the initial filter, thereby reducing the amount of calculation; the spectrum image is filtered by using filters of different sizes to obtain a corresponding filtered image, and a difference image between the filtered image and the original grayscale image of the mask surface is analyzed, which is more intuitive and clear; the difference image is subjected to Hough transformation, and three highlight points with the largest highlight values ​​are selected as target points for analysis based on the actual texture characteristics of the mask surface, and the difference image is preliminarily screened out by using the slope and Euclidean distance characteristics of the target points, that is, the filter size of the difference image is preliminarily screened, and the filter effect value of the screened difference image is analyzed, thereby obtaining a filtered image and a filter size with the best filtering effect, and the filtering effect is more intuitively reflected by the quantified filtering effect value, and then the abnormal damage of the mask is detected according to the filtered image with the best filtering effect, and the accuracy of the detection result is higher. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] 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.

[0022] Figure 1 A flow chart of a method for detecting surface abnormalities of a non-woven mask provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0023] 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 method for detecting abnormalities on the surface of a non-woven mask proposed by the present invention, its specific implementation, structure, characteristics and effects, 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.

[0024] 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.

[0025] The specific scheme of the method for detecting surface abnormalities of a non-woven mask provided by the present invention is described in detail below with reference to the accompanying drawings.

[0026] See also Figure 1, which shows a flow chart of a method for detecting surface abnormalities of a non-woven mask provided by an embodiment of the present invention, the method comprising the following steps:

[0027] Step S100, collecting a mask image on the surface of the mask, and graying the mask image to obtain a grayscale image.

[0028] In the context of the epidemic, masks are an important epidemic prevention product, and their quality directly affects the epidemic prevention effect. The damage defects in the mask quality are the top priority of mask quality inspection, which directly leads to a significant reduction in the epidemic prevention effect. Generally, when the middle part of the mask is damaged, the impact is the greatest, and it is difficult for the user to be found. If it is worn directly, the epidemic prevention effect will be greatly reduced. Damage in other parts such as the ear straps will directly affect the wearing of the mask, which is a defect that users can easily find.

[0029] Because the middle part of the mask is an important area for evaluating the quality of the product and has the greatest impact on the epidemic prevention effect; therefore, in the embodiment of the present invention, after the mask image on the conveyor belt is collected by a camera, the mask image needs to be segmented, and only the mask image in the middle area of ​​the mask is needed. The segmentation method adopts DNN technology for recognition, and semantic segmentation is used to identify the middle area of ​​the mask in the image. The relevant content is as follows:

[0030] 1) The dataset used is the mask image dataset collected in the embodiment of the present invention;

[0031] 2) The pixels to be segmented are divided into two categories, that is, the labeling process of the training set is as follows: single-channel semantic label, the corresponding position pixel belongs to the background class is marked as 0, and the pixel belonging to the middle area of ​​the mask is marked as 1;

[0032] 3) The loss function uses the cross entropy loss function.

[0033] Then the image of the mask surface is segmented to obtain a mask image including only the middle area of ​​the mask. In order to improve the efficiency of subsequent analysis and eliminate the interference of redundant colors, the mask image is grayed to obtain a corresponding grayscale image. The grayscale processing method is an existing well-known technology and will not be described in detail.

[0034] Step S200 , obtaining a spectrum image of the grayscale image, using the width of the spectrum image as the length of an initial filter, and shrinking the length of the initial filter according to a preset ratio to obtain filters of different sizes.

[0035] The grayscale image obtained in step S100 is subjected to Fourier transform. The Fourier transform can convert the grayscale image in the spatial domain into the frequency domain, which can be observed and processed more intuitively. The formula of two-dimensional Fourier transform is:

[0036]

[0037] in, and is a frequency variable; is the size of the grayscale image; and is the variable in the grayscale image; is a natural constant.

[0038] After Fourier transform, we get the spectrum image, and observe the rules from the spectrum image; the frequency distribution obtained by discrete Fourier transform of two-dimensional signal, and then the spectrum image after the spectrum is centered, the brightest point in the middle is the low-frequency signal, and the surrounding is the high-frequency signal. According to the characteristics of the spectrum graph, set the binary mask as the filter for filtering. Different binary masks can get different filtering effects. What we need is to remove the texture of the mask itself and retain the details of other parts of the mask. Filters of different sizes have different filtering effects. When the filter is too large, the details of other parts of the mask are removed while removing the texture of the mask itself, which is over-filtering; when the filter is too small, the texture of the mask itself is not removed well after filtering, and the effect is relatively poor; therefore, a filter of appropriate size is needed so that the filtered image can remove the texture of the mask itself and retain the details of other parts of the mask.

[0039] Since we want to get the best image, we need to set different filters to compare with each other and select the best one. Different filters can get different filtering effects. We need to set a certain range for the filter, traverse each filter within this range, and then compare the filtered images. According to the characteristics of the spectrum graph, set the filter for filtering. Assume that the size of the spectrum image is , which is long , width is ; Binarize the spectrum image to get the longest vertical line, and find the maximum value of the width of this vertical line and record it as , as the width of the initial filter; set the width B of the spectrum image to the length of the initial filter, denoted as b, and the size of the initial filter is b*a.

[0040] Because the spectrum image is symmetrical, the length of the initial filter shrinks from the center of the image to the upper and lower sides at the same time according to a certain filtering ratio c until it is completely shrunk; the length of the filter after adjusting the length of the initial filter according to the preset ratio is:

[0041]

[0042] in, To adjust the length of the filter; is the length of the initial filter; is the number of filtering times; is a preset ratio. In the embodiment of the present invention, the preset ratio is set to .

[0043] Thus, filters of different sizes can be obtained according to the size of the initial filter and the preset ratio.

[0044] Step S300, filter the spectrum image using filters of different sizes to obtain a filtered image of the mask surface; obtain a difference image between each filtered image and the grayscale image, perform Hough transform on the difference image to obtain highlight points, select the three points with the largest brightness values ​​among all highlight points as target points, calculate the slope and Euclidean distance between the target points, and when the slope and Euclidean distance meet the preset conditions, obtain the filtering effect value of the difference image where the target point is located.

[0045] The spectrum image is processed by binary mask filtering with filters of different sizes to obtain images with different effects. The spectrum images after filtering with filters of different sizes are transformed by inverse Fourier transform to obtain the corresponding filtered images. In order to compare the advantages and disadvantages of the filtering effects, the grayscale image is subtracted from the filtered image to obtain the difference image. All the obtained difference images are compared to select the image with the best filtering effect. In order to make the features clearer, the difference image is binarized by Otsu threshold, and the binarized difference image is subsequently analyzed.

[0046] Due to the design of disposable medical surgical masks, there are three texture lines in the middle part; if the texture of the mask itself is perfectly removed and the details of other places are well preserved, three straight lines with a gray value of 1 will appear in the middle part of the difference image after binarization, while the gray values ​​of other places are 0; the texture of the mask itself is not removed or the removal effect is not good, and there are no three straight lines in the middle part of the obtained difference image or it is an intermittent straight line; if the selected filter is too large and belongs to over-filtering, in addition to the texture in the middle part of the mask, a lot of noise will appear in other areas; the three lines in the middle are the three textures in the grayscale image corresponding to the mask. The more obvious the three lines in the middle are, the fewer pixels in other surrounding areas, which means the better the filtering effect; therefore, the difference image is subjected to Hough transform, converted into parameter space, and the three highlights with the largest brightness values ​​are found to determine whether they are on the same straight line. If they are on the same straight line and the distance between two adjacent points is equal, it proves that the three brightest highlights are the three textures of the mask. Then add up the brightness values ​​of these three highlights and subtract the values ​​of other highlights to get the filtering effect to be calculated; the larger the values ​​of the three highlights and the smaller the values ​​of other highlights, the better the filtering effect.

[0047] First, the difference image is subjected to Hough transform, and the difference image is converted into parameter space. The lines in the difference image become points in the parameter space, and the points in the difference image become lines in the parameter space. The collinear points in the difference image are different lines intersecting at one point in the parameter space, and multiple highlight points are obtained. These highlight points in the parameter space contain not only position information, but also brightness information. The brightness value is obtained by continuously accumulating the grayscale value of the curve passing through this point.

[0048] Then, find all the highlights in the parameter space and sort them in order according to the brightness values ​​corresponding to all the highlights to get the sequence According to the characteristics of the mask, there are three textures in the image with better effect, corresponding to the three highlights with the largest brightness values. Therefore, the brightness values ​​of the three highlights with the largest brightness values ​​in the sequence are selected as follows: , and its corresponding highlight point is also marked as , and the selected highlight points are recorded as target points for analysis.

[0049] The three textures in the middle of the mask are three parallel straight lines, and the distances between two adjacent lines are equal; so for the target point in the parameter space , which should be on the same straight line and the distance between two adjacent points is equal, so the slope and Euclidean distance between the target points are analyzed.

[0050] Determine whether the target points are on the same straight line, that is, determine the vector and Are the slopes of the two points equal? ​​If they are equal, it is considered that the target points are on the same straight line. The judgment formula is:

[0051]

[0052] in, Representation vector The slope of Representation vector The slope of , , The target points The coordinates of is the difference in slope. When k=0, it means that the vector The slope and vector The slope is equal to that of In the same straight line.

[0053] Calculate the Euclidean distance between two adjacent target points among the three target points, marked as , , the calculation of Euclidean distance is a well-known technique and will not be described in detail; the Euclidean distance between two adjacent target points is equal, that is, The value of is 0.

[0054] Similarly, the target points in each difference image, as well as the corresponding slope and Euclidean distance between the target points are obtained to obtain a difference image whose slope and Euclidean distance meet the preset conditions; the preset conditions are that the slopes between the target points are equal, that is, the target points are on the same straight line, and the Euclidean distances between two adjacent target points are equal.

[0055] The filtering effect value is calculated for the selected difference images whose slope and Euclidean distance meet the preset conditions. For the difference images whose slope and Euclidean distance do not meet the preset conditions, the filtering effect is poor and the corresponding filtering effect value is 0.

[0056] The filter effect value is obtained based on the brightness value and number of the highlight points in the parameter space, that is, the calculation method of the filter effect value is:

[0057]

[0058] in, is the filtering effect value. The larger the filtering effect value is, the better the filtering effect is. is a sequence of all the highlights in the parameter space Middle elements; Indicates the cumulative sum of the three points with the highest brightness in the sequence, which is also the cumulative sum of the brightness values ​​of the target point; It represents the cumulative sum of the brightness values ​​of all points in the sequence except the three points with the highest brightness values.

[0059] Step S400, selecting the difference image when the filtering effect value is the largest as the optimal image, performing edge detection on the filtered image corresponding to the optimal image, and judging whether there is an abnormality on the mask surface according to the edge detection result.

[0060] The filtering effect values ​​corresponding to different difference images are obtained by the method of step S300, and the difference image corresponding to the maximum filtering effect value is selected as the optimal image. The filtered image corresponding to the optimal image is the image with the best filtering effect. At this time, the size of the filter corresponding to the filtered image is the basic size. When the filtering process is performed next time, the filter of the basic size corresponding to the image with the best filtering effect is used as the initial filter, and then the image with the maximum filtering effect value is obtained based on the filtering ratio, thereby reducing the amount of calculation in the iterative calculation.

[0061] After obtaining the filtered image with the best filtering effect, the influence of the mask's own texture has been eliminated. At this time, the mask is detected to see if it is damaged. The canny operator is used for edge detection, and whether the mask is damaged is determined based on the detection results.

[0062] Specifically, the canny operator is used to perform edge detection on the filtered image with the best filtering effect. The gradient change around the texture of the grayscale image after filtering is still relatively large. In order to avoid the texture near the mask being detected, a more appropriate gradient change threshold needs to be set. After the edge in the filtered image is detected, the connected domain of this area is obtained. If no connected domain is detected, it is considered that the surface of the mask is not abnormally damaged. If a connected domain is detected, the connected domain is the place where the mask is abnormally damaged.

[0063] In summary, in the embodiment of the present invention, by collecting a mask image on the surface of the mask, the mask image is grayed to obtain a gray image; the spectrum image of the gray image is obtained, the spectrum image is binarized to obtain the longest vertical line therein, the maximum width of the vertical line is the width of the initial filter, the width of the spectrum image is used as the length of the initial filter, and the length of the initial filter is shrunk according to a preset ratio to obtain filters of different sizes; the spectrum image is filtered using filters of different sizes to obtain a filtered image of the mask surface; a difference image between each filtered image and the gray image is obtained, the difference image is Hough transformed to obtain a highlight point, three points with the largest brightness value among all the highlight points are selected as target points, the slope and the Euclidean distance between the target points are calculated, and when the slope and the Euclidean distance meet the preset conditions, the filtering effect value of the difference image where the target point is located is obtained; the difference image when the filtering effect value is the largest is selected as the optimal image, and the filtered image corresponding to the optimal image is edge detected, and whether there is an abnormality on the mask surface is judged according to the edge detection result; the abnormality detection is performed by using an image with better filtering effect, and the result obtained is more accurate and more efficient.

[0064] 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. In addition, 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.

[0065] 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.

[0066] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the principles of the present invention should be included in the protection scope of the present invention.

Claims

1. A method for detecting abnormalities on the surface of a non-woven mask. It is characterized in that The method comprises the following steps: Collecting a mask image on the surface of the mask, and gray-scaling the mask image to obtain a grayscale image; Acquire a spectrum image of the grayscale image, use the width of the spectrum image as the length of an initial filter, and shrink the length of the initial filter according to a preset ratio to obtain filters of different sizes; The spectrum image is filtered by using filters of different sizes to obtain a filtered image of the mask surface; a difference image between each filtered image and the grayscale image is obtained, a Hough transform is performed on the difference image to obtain a highlight point, three points with the largest brightness values ​​among all the highlight points are selected as target points, and the slope and the Euclidean distance between the target points are calculated. When the slope and the Euclidean distance meet the preset conditions, the filtering effect value of the difference image where the target point is located is obtained; The difference image when the filtering effect value is the largest is selected as the optimal image, edge detection is performed on the filtered image corresponding to the optimal image, and whether there is an abnormality on the surface of the mask is determined according to the edge detection result; The step of shrinking the length of the initial filter according to a preset ratio to obtain filters of different sizes comprises: Obtain the number of currently contracted filters, calculate the product of the number of filters and a preset ratio, and use the difference between 1 and the product as the contraction ratio; The product of the contraction ratio and the length of the initial filter is the length of the contracted filter; The preset conditions are: the slope between the first target point and the second target point is equal to the slope between the first target point and the third target point, and the Euclidean distance between the first target point and the second target point is equal to the Euclidean distance between the second target point and the third target point; The step of obtaining the filtering effect value of the difference image where the target point is located comprises: Calculating a first cumulative sum of highlight values ​​corresponding to the target point, and a second cumulative sum of highlight values ​​of other highlight points except the target point corresponding to the difference image where the target point is located; The difference between the first accumulated sum and the second accumulated sum is the filtering effect value.

2. A method for detecting surface abnormalities of a non-woven mask according to claim 1, It is characterized in that The method for obtaining the width of the initial filter is: The spectrum image is binarized to obtain the longest vertical line, wherein the maximum width of the vertical line is the width of the initial filter.

3. A method for detecting surface abnormalities of a non-woven mask according to claim 1, It is characterized in that After the step of selecting the difference image when the filtering effect value is the largest as the optimal image, the method further includes: A size of a corresponding filter obtained based on the optimal image is taken as a basic size, and an initial filter for the next filtering process is constructed according to the basic size.