A method for monitoring and adjusting abnormalities in the singeing process of grey cloth
Through infrared image processing and sparrow search algorithm optimization, combined with the adaptive t-distribution variation method, real-time abnormality monitoring and adjustment of the grey cloth wool burning process is realized, solving the problems of detection error and hysteresis in the existing technology, and improving product quality.
Patent Information
- Application Number
- CN202411816122.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-11
- Publication Date
- 2025-04-04
AI Technical Summary
The prior art has problems such as error, hysteresis and the inability to realize real-time monitoring in the abnormal detection of grey cloth rinse technology, resulting in a decrease in the yield rate of grey cloth rinse.
Technical methods such as infrared image acquisition, grayscale processing, image smoothing processing, gradient calculation and non-maximum suppression are used, combined with sparrow search algorithm and adaptive t-distribution variation method, the image segmentation threshold is optimized and defect abnormality judgment is carried out.
Real-time abnormality monitoring and adjustment of the grey cloth wool burning process is realized, the detection accuracy and real-time performance are improved, and the defect rate of grey cloth wool burning is reduced.
Smart Images

Figure CN119762446A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of grey cloth production technology, and in particular to a method for monitoring and regulating the abnormality of a grey cloth singeing process. Background Art
[0002] Usually, after entering the printing and dyeing factory from the textile factory, the grey cloth should first go through the processes of inspection, turning, batching, printing and sewing, and then be singed. The specific process of singeing is to quickly pass the fabric through the flame of the singeing machine or rub it over the hot metal surface in a flat state, and use the principle that the heating rate of the cloth body and the fluff is different to burn only the fluff on the surface of the fabric without damaging the fabric itself. This process is crucial to improving the quality and appearance of the fabric. The main purpose of singeing of grey cloth is to remove the fluff on the surface of the fabric, make the cloth surface smooth and beautiful, and prevent uneven dyeing and printing defects caused by the presence of fluff during dyeing and printing. Specifically, the purpose of singeing includes improving the gloss and finish of the cloth surface, preventing uneven dyeing and printing defects, improving anti-pilling performance, and improving fabric style.
[0003] The core purpose of the detection of abnormal singeing of grey fabric is to ensure the quality of the fabric. By detecting the effect of the singeing process, it is determined whether the fabric has reached the expected standard. The detection method mainly includes observing the smoothness of the fabric surface, the neatness of the edge of the fabric, and the residual traces after the fiber is burned. The fabric that has been singed has a better surface finish, significantly reduced long and short hairs, fewer cotton knots, and full and uniform color. The fabric that has not been singed has uneven hairiness and uneven color, with obvious differences in depth. In addition, by observing the residual traces of the weft yarn on the edge of the fabric, it can be determined whether it has been singed, because the fabric after singeing will have traces of chemical fiber melting. At present, the detection basically relies on manual experience for the detection of grey fabric singeing, which has certain errors and hysteresis, and cannot be monitored in real time, resulting in a decrease in the yield rate of grey fabric singeing. Therefore, how to realize real-time monitoring of abnormalities in the singeing process of grey fabric is an urgent problem to be solved to further improve product quality. Summary of the invention
[0004] The purpose of the present invention is to overcome the problems existing in the prior art and provide a method for monitoring and adjusting the abnormality of the singeing process of grey cloth. In order to achieve the above technical purpose and the above technical effect, the present invention is implemented through the following technical solutions:
[0005] A method for monitoring and adjusting abnormalities in a singeing process of grey cloth, the method comprising the following steps:
[0006] Step S1: infrared image acquisition;
[0007] Step S2: grayscale processing of the image;
[0008] Step S3: image smoothing processing;
[0009] Step S4: Calculate the gradient magnitude and gradient direction;
[0010] Step S5: non-maximum suppression;
[0011] Step S6: parameter initialization;
[0012] Step S7: population optimization;
[0013] Step S8: Calculate and sort the fitness values of individual sparrows according to the objective function, and find out the best and worst fitness values and their corresponding positions;
[0014] Step S9: Determine whether the maximum number of iterations is met, if so, jump to step S16, if not, proceed to the next step;
[0015] Step S10: introducing dynamic nonlinear inertia weight w1 to optimize the position of the discoverer and dynamic nonlinear inertia weight w2 to optimize the position of the sentinel;
[0016] Step S11: Introduce the Levy flight strategy to optimize the follower position;
[0017] Step S12: Generate a random number R between 0 and 1;
[0018] Step S13: Determine the size of the random number R and the dynamic selection probability P. If R>P, jump directly to step S8, otherwise proceed to the next step;
[0019] Step S14: introducing an adaptive t-distribution variation method to perturb individual sparrows, thereby improving the algorithm's ability to escape from local optimality;
[0020] Step S15: Jump to step S8 and continue execution;
[0021] Step S16: output the optimal individual and its fitness value to obtain the optimal high and low segmentation threshold;
[0022] Step S17: First, binarize and segment the image, and then, after completing the detection, connect each edge point;
[0023] Step S18: Calculate the area ratio sp of the region enclosed by the defect contour of the singeing process of the grey cloth and the actual total length len of the defect contour;
[0024] Step S19: First, introduce the evaluation index of the defect abnormality of the grey cloth singeing process and set the corresponding defect category warning threshold and alarm threshold; second, make a judgment on the defect abnormality of the grey cloth singeing process.
[0025] Furthermore, in the step S1, a time interval Δt is set, and a corresponding infrared thermal imager is connected to collect the singeing image of the grey cloth in real time, and the sampling interval is set to 30s.
[0026] Furthermore, in step S3, median-Gaussian filtering is used and Laplace transform is integrated to perform image denoising, thereby smoothing the image. Adaptive median filtering dynamically changes the window width of the median filter for specific image conditions to ensure that noise is removed while retaining image detail features. Specifically, the following steps are included:
[0027] Step S3.1: xy The working domain of the filter, the center point of the area covered by the filter window is the pixel in the xth row and yth column in the image; S xy The minimum gray value, maximum gray value, and middle gray value are Z min , Z max , Z med , Z xy Represents the grayscale value of the pixel at the xth row and yth column in the image; S xy The maximum allowed window size is S max ;
[0028] Step S3.2: When (Z med -Z min )>0 and (Z med -Z max )<0, go to step S3.3, otherwise increase the size of the window, and if the increased size is not greater than S max , then re-execute step S3.2, otherwise directly output Z med ;
[0029] Step S3.3: When (Z xy -Z min )>0 and (Z xy -Z max )<0, output Z xy , otherwise output Z med ;
[0030] Step S3.4: After the adaptive median filter is processed to effectively suppress the salt and pepper noise, the adaptive Gaussian filter method is then used to remove the Gaussian noise, and the Gaussian kernel is generated using a two-dimensional Gaussian filter function:
[0031]
[0032] Where: k is the radius of the Gaussian kernel, σ is the standard deviation, the Gaussian kernel coefficient weight has a specific proportional relationship with the variance. When the convolution window slides, the Gaussian kernel standard deviation σ is obtained according to the variance. The variance calculation formula for a certain area of the image is:
[0033]
[0034] Where: S i,jis the convolution window of the center point (i, j), D(i, j) is the variance, and the larger D(i, j), the smaller the pixel value is in S i,j The higher the degree of discreteness in the region, the smaller the Gaussian kernel coefficient weight generated by σ is used to effectively reduce the impact on the region, and thus the following is obtained:
[0035]
[0036] Since D(i, j) is a constant, R(i, j) is a function of k and σ, that is:
[0037]
[0038] When R is 1, the parameter weight in the Gaussian kernel is closest to the pixel value weight. At this time, σ is calculated by S xy The variance D of the pixel values in the area is obtained, and so on, repeated iterations are performed to form an adaptive Gaussian filter, and finally the Gaussian filter processing is completed by convolution of all image pixels;
[0039] Step S3.5: To solve the problem that the image clarity becomes low and the edge information is not easy to reflect after filtering, the Laplace operator is used to sharpen the image. Compared with the first-order differential operator, the positioning tension is relatively strong and the sharpening effect is better. The sharpened image is fused with the original image, the original image information is retained and the pixel value at the image gradient mutation point is enhanced to enhance the image edge. The Laplace operator template is:
[0040]
[0041] The second-order derivative of the Laplace operator is used to describe the homogeneous function of a two-dimensional image, indicating the characteristics and properties of the image:
[0042]
[0043] The edge enhancement formula is:
[0044]
[0045] Where: g is the output, f is the original image, c is the detail coefficient, and whether the pixel is enhanced is determined based on the value of c.
[0046] Furthermore, in step S6, an improved sparrow search algorithm is introduced to optimize the two-dimensional Otsu algorithm threshold.
[0047] Furthermore, in step S7, the sparrow population is initially set by using the Tent mapping method so that the population is more evenly distributed in the search space. The Tent chaotic mapping expression is as follows:
[0048]
[0049] Where: γ∈(0,1).
[0050] Furthermore, in step S8, the optimal threshold is found by maximizing the inter-class variance, and the two-dimensional Otsu algorithm inter-class discrete matrix is used as the objective function. The multi-threshold segmentation searches for a set of thresholds [t1, t2, ..., t n ](n>0), and split it into n+1 parts, where Otsu is a global adaptive threshold selection method. For a given image with gray levels in [0, 1, ..., L-1], the number of images with gray level j is n j , the total number of pixels is N, and the probability distribution is as follows:
[0051] n0+n1+…n L-1 =N (21)
[0052]
[0053] The grayscale mean of each part of the image is expressed as:
[0054]
[0055] Then the inter-class variance of the image is expressed as:
[0056] s 2 =ω0(u0-u T ) 2 +ω1(u1-u T ) 2 +…+ω n (u n -u T ) 2 (27)
[0057] Where: u T Represents the grayscale mean of the entire image, calculated as follows:
[0058]
[0059] When the threshold vector satisfies the following formula (29), it is the optimal threshold, which can be specifically expressed as:
[0060]
[0061] Where: Corresponding 2 When the maximum value is obtained, the corresponding optimal image segmentation threshold array.
[0062] Furthermore, in step S10, when the dynamic nonlinear inertia weight w1 is introduced to optimize the position of the discoverer and the dynamic nonlinear inertia weight w2 is introduced to optimize the position of the alerter, the following steps are specifically included:
[0063] Step S10.1: Introduce the nonlinear increasing inertia weight w1 to optimize the finder position. In the finder position update model, when R2 ≥ ST, the sparrow is in a dangerous state. Introducing the nonlinear increasing inertia weight w1 can reduce the influence of the sparrow's own position in the early stage and accelerate the convergence speed. As the number of iterations increases, the search range is increased and the probability of the sparrow falling into the local optimal solution is reduced. The new finder position update and weight w1 formula are as follows:
[0064]
[0065] Where: m1 and r1 are the adjustment parameters of the weight coefficient;
[0066] Step S10.2: Introduce the nonlinear increasing inertia weight w2 to optimize the position of the sentinel. In the sentinel position update model, when f i >f g When the sparrow is at the edge of the population and is vulnerable to predators, the dynamic nonlinear inertia weight w2 is introduced to reduce the influence of the optimal sparrow position in the early stage, making it easier to find other optimal solutions. As the number of iterations increases, the sparrow gradually approaches the optimal sparrow to forage, and the convergence speed gradually accelerates. The new sentinel position update and weight w2 formula are as follows:
[0067]
[0068] Where: m2 and r2 are the adjustment parameters of the weight coefficient.
[0069] Furthermore, in step S11, the Levy flight strategy is introduced to optimize the follower position to expand the search space, increase its diversity, improve the situation of falling into the local optimum, and enhance the global search capability. The Levy flight strategy expression is as follows:
[0070]
[0071] Where: Levy (τ) is the flight step length; the parameter τ is 1.5; μ and v follow the normal distribution (β) is the gamma function, β is 1.5;
[0072] With this strategy, the follower position is updated as follows:
[0073]
[0074] Furthermore, in step S14, an adaptive t-distribution mutation method is introduced to disturb individual sparrows, so as to improve the ability of the algorithm to jump out of the local optimum. The t-distribution mutation operator with the number of iterations t as the degree of freedom parameter of the t-distribution is used to disturb the position of the sparrows, so that the algorithm has better global development ability in the early stage of iteration, good local exploration ability in the later stage of iteration, and improves the convergence speed of the algorithm. The specific position update method is as follows:
[0075]
[0076] Where: is the position of the sparrow after the disturbance, is the position of sparrow i at the tth iteration, and the update formula is On the basis of It not only makes full use of the current position information, but also adds random interference information to help the algorithm jump out of the local optimum. As the number of iterations t increases, the t distribution gradually approaches the Gaussian distribution, which helps to enhance the convergence speed of the algorithm.
[0077] The dynamic selection probability P is introduced to adjust the use of the adaptive t-distribution mutation operator, and its calculation formula is as follows:
[0078]
[0079] Where: iter max is the maximum number of iterations, t is the current number of iterations, P max is to determine the upper limit of the dynamic probability, ΔP is the range of change that determines the dynamic selection probability, and the dynamic selection probability P makes the algorithm have a greater probability in the early stage of iteration to facilitate the adaptive t-distribution mutation operator to perturb the position of the sparrow, improving the original algorithm's tendency to converge to the optimal solution in the early stage of iteration; at the same time, in the later stage of iteration, the original algorithm's good local development ability is fully utilized, and the t-distribution mutation with a smaller probability is used as a supplement to improve the convergence speed of the algorithm; jump to step S8, and t=t+1.
[0080] Furthermore, in the step S18, the area ratio sp of the region enclosed by the defect contour of the singeing process of the grey cloth and the actual total length len of the defect contour are calculated, which specifically includes the following steps:
[0081] Step S18.1: Calculate the area ratio sp of the area enclosed by the outline of the singeing process defect of the grey cloth. First, obtain the entire area S of the image through OpenCV.cvtColor().size 总 ; Secondly, traverse the image through OpenCV.contourArea(contour) to obtain the defect area S 缺陷, where contour represents the contour parameter; finally, calculate the area ratio sp of the area enclosed by the defect contour, that is, Step S18.2: Calculate the actual total length len of the defect contour of the grey fabric singeing process. First, obtain the defect through OpenCV.threshold(); second, obtain the contour through OpenCV.findContour(); then, traverse the image defect contour through OpenCV.arcLength() and accumulate to obtain the total length len of the defect contour picture ; Finally, the total length of the defect contour len picture Multiply by the measurement ratio rs to obtain the actual total length len of the defect contour, that is, len = len picture ×rs.
[0082] Further, in the step S19, firstly, the evaluation index of the defect abnormality of the singeing process of the grey cloth is introduced and the warning threshold and the alarm threshold of the corresponding defect contour area ratio are set to sp warn 、sp alarm ; The corresponding defect contour length warning threshold and alarm threshold are len warn ,len alarm ; Then, the abnormality of the singeing process defects of the grey cloth is judged, which specifically includes the following steps:
[0083] Step S19.1: If sp<sp warn And len<len warn , the singeing process of the grey cloth is normal, and the process returns to step S1;
[0084] Step S19.2: If sp<sp alarm And sp ≥ sp warn Or satisfy len≥len warn And len<len alarm , then the grey cloth singeing process warning is issued, and the warning information needs to be pushed down to the operator for rework operation, and the process returns to step S1; otherwise, the process continues to execute downward;
[0085] Step S19.3: If sp≥sp aram or len≥len alarm , the grey cloth singeing process alarm needs to be pushed down to the operator for scrapping operation, and return to step S1.
[0086] The beneficial effects of the present invention are:
[0087] The method of the present invention collects infrared images of the grey cloth singeing process in real time, firstly, improves the Canny algorithm through grayscale processing, introducing median-Gaussian filtering and fusing Laplace changes to perform image smoothing processing, increasing the calculated gradient amplitude and gradient direction, and then performs non-maximum suppression processing; then, optimizes the sparrow search algorithm by successively introducing Tent mapping to optimize the sparrow population for initial setting, optimizing the position of the discoverer and the position of the sentinel by dynamic nonlinear inertia weight, optimizing the position of the follower by Levy flight strategy, and disturbing the sparrow individuals by adaptive t distribution mutation method, so that the improved sparrow search algorithm optimizes the two-dimensional Otsu algorithm threshold to obtain the optimal image high and low segmentation threshold; then, the image is segmented, and the edge points are detected and connected by the optimal threshold; finally, the grey cloth singeing process defect abnormality threshold is introduced to perform online abnormality judgment of the grey cloth singeing process defect, so as to effectively solve the problems of complex background, poor detection real-time performance and insufficient precision in the existing grey cloth singeing process defect detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0088] Figure 1 It is a schematic diagram of the abnormal monitoring and adjustment process of the grey cloth singeing process of the present invention. DETAILED DESCRIPTION
[0089] The present invention will be described in detail below with reference to the accompanying drawings and in combination with embodiments.
[0090] like Figure 1 As shown, a method for monitoring and adjusting abnormalities in the singeing process of grey cloth comprises the following steps:
[0091] Step S1: Infrared image acquisition, setting the time interval Δt, connecting the corresponding infrared thermal imager to acquire the singeing image of the grey cloth in real time, and setting the sampling interval to 30s;
[0092] Step S2: Image grayscale processing. For the collected infrared original image of the grey cloth singeing process, it is necessary to convert it into a grayscale image, and then extract the target features in the image. At present, the image grayscale method mainly consists of the maximum value method, the average value method and the OpenCV weighted mean method. By considering the characteristics of the grey cloth singeing process and the image processing environment, the OpenCV weighted mean method with moderate properties is selected in this embodiment to perform necessary grayscale processing on the original color image. The specific operation process is as follows: Assume that the channel coordinates of the red, green and blue of the image are R(x, y), G(x, y) and B(x, y) respectively, then the grayscale image Grey(x, y) is obtained by the OpenCV weighted mean method, and the calculation process is as follows:
[0093] Grey(x, y)=0.299R(x, y)+0.587G(x, y)+0.1148(x, y) (1);
[0094] Step S3: image smoothing processing;
[0095] Step S4: Calculate the gradient magnitude and gradient direction. The traditional Canny algorithm uses the Sobel operator to locate the image gradient, which has poor accuracy and is prone to losing edge information. Therefore, this embodiment extends the 2×2 template calculation of the gradient magnitude and direction in the traditional Canny edge detection algorithm to a 3×3 Sobel convolution template. The commonly used Sobel convolution template has two directions, horizontal and vertical. On this basis, this embodiment adds two directions, 45° and 135°, to retain more edge information. The 3×3 convolution template is:
[0096]
[0097] In formula (11)-(14): G x is the ladder vector in the horizontal direction of the pixel; G y G is the ladder vector in the vertical direction of the pixel; 45° is the ladder vector in the horizontal direction of the pixel; G 135° is the gradient vector in the vertical direction of the pixel; Z is the image; calculate the gradient magnitude G and gradient direction θ of each pixel in the image:
[0098]
[0099]
[0100] Step S5: non-maximum suppression. Based on the gradient amplitude, the non-maximum suppression method is used to refine the Canny edge detection result. Pseudo-edges with small gradient values may appear near edge pixels. In order to ensure the accuracy of the obtained edge, it is necessary to find the local maximum gradient and set the non-maximum pixels to zero to avoid the appearance of pseudo-edges that affect the segmentation accuracy. This step can remove some non-boundary points and emphasize the sharpest part of the image, thereby improving the edge detection accuracy.
[0101] Step S6: parameter initialization;
[0102] Step S7: population optimization;
[0103] Step S8: Calculate and sort the fitness values of individual sparrows according to the objective function, and find out the best and worst fitness values and their corresponding positions;
[0104] Step S9: Determine whether the maximum number of iterations is met. If so, t = iter max , then jump to step S16, if not satisfied, then go to the next step;
[0105] Step S10: introducing dynamic nonlinear inertia weight w1 to optimize the position of the discoverer and dynamic nonlinear inertia weight w2 to optimize the position of the sentinel;
[0106] Step S11: Introduce the Levy flight strategy to optimize the follower position;
[0107] Step S12: Generate a random number R between 0 and 1;
[0108] Step S13: Determine the size of the random number R and the dynamic selection probability P, where R is a random number between [0, 1], and P is the dynamic selection probability, with an initial value of 0.55; if R>P, jump to step S8, and t=t+1; otherwise, continue to execute downward;
[0109] Step S14: introducing an adaptive t-distribution variation method to perturb individual sparrows, thereby improving the algorithm's ability to escape from local optimality; Step S15: jumping to step S8 and continuing to execute;
[0110] Step S16: Output the optimal individual and its fitness value to obtain the optimal high and low segmentation threshold, as follows:
[0111]
[0112] Where: L = 255, the optimal segmentation high threshold and the lowest segmentation threshold are respectively denoted as t high With t lower ,Right now
[0113] Step S17: First, the image is segmented into two values, and the grayscale image is segmented according to the optimal high and low thresholds, that is, the grayscale image pixels are traversed, and if the grayscale value of the pixel is greater than t high , make it 1 or 255, as the extreme point; if the gray value of the pixel is less than t lower , make it 0 and exclude it; the remaining points are determined using the eight-neighborhood algorithm. Secondly, after completing the detection, connect each edge point;
[0114] Step S18: Calculate the area ratio sp of the region enclosed by the defect contour of the singeing process of the grey cloth and the actual total length len of the defect contour;
[0115] Step S19: First, introduce the evaluation index of the defect abnormality of the grey cloth singeing process and set the corresponding defect category warning threshold and alarm threshold; second, make a judgment on the defect abnormality of the grey cloth singeing process.
[0116] In step S3, Gaussian filtering is used for image denoising in view of the traditional Canny algorithm, and the distribution mode of the two-dimensional Gaussian function is used to smooth the image, which can suppress the noise that obeys the normal distribution, but is very sensitive to salt and pepper noise, and the selection of the filter template size is affected by human factors. A small convolution kernel radius will lead to poor noise removal effect, and a large convolution kernel radius will make the image blurred and lose image information. In this embodiment, median-Gaussian filtering is used and Laplace transform is integrated for image denoising to smooth the image. The median filter has a good effect on a small amount of salt and pepper noise in the image, but when the image noise density increases, it is difficult to effectively reduce the noise while retaining the detail information. The adaptive median filter dynamically changes the window width of the median filter for specific image conditions to ensure that the noise is removed while retaining the image detail features. Specifically, the following steps are included:
[0117] Step S3.1: xy The working domain of the filter, the center point of the area covered by the filter window is the pixel in the xth row and yth column in the image; S xy The minimum gray value, maximum gray value, and middle gray value are Z min , Z max , Z med , Z xy Represents the grayscale value of the pixel at the xth row and yth column in the image; S xy The maximum allowed window size is S max ;
[0118] Step S3.2: When (Z med -Z min )>0 and (Z med -Z max )<0, go to step S3.3, otherwise increase the size of the window, and if the increased size is not greater than S max , then re-execute step S3.2, otherwise directly output Z med ;
[0119] Step S3.3: When (Z xy -Z min )>0 and (Z xy -Z max )<0, output Z xy , otherwise output Z med ;
[0120] Step S3.4: After the adaptive median filter is processed to effectively suppress the salt and pepper noise, the adaptive Gaussian filter method is then used to remove the Gaussian noise, and the Gaussian kernel is generated using a two-dimensional Gaussian filter function:
[0121]
[0122] Where: k is the radius of the Gaussian kernel, σ is the standard deviation, the Gaussian kernel coefficient weight has a specific proportional relationship with the variance. When the convolution window slides, the Gaussian kernel standard deviation σ is obtained according to the variance. The variance calculation formula for a certain area of the image is:
[0123]
[0124] Where: S i,j is the convolution window of the center point (i, j), D(i, j) is the variance, and the larger D(i, j), the smaller the pixel value is in S i,j The higher the degree of discreteness in the region, the smaller the Gaussian kernel coefficient weight generated by σ is used to effectively reduce the impact on the region, and thus the following is obtained:
[0125]
[0126] Since D(i, j) is a constant, R(i, j) is a function of k and σ, that is:
[0127]
[0128] When R is 1, the parameter weight in the Gaussian kernel is closest to the pixel value weight. At this time, σ is calculated by S xy The variance D of the pixel values in the area is obtained, and so on, repeated iterations are performed to form an adaptive Gaussian filter, and finally the Gaussian filter processing is completed by convolution of all image pixels;
[0129] Step S3.5: To solve the problem that the image clarity becomes low and the edge information is not easy to reflect after filtering, the Laplace operator is used to sharpen the image. Compared with the first-order differential operator, the positioning tension is relatively strong and the sharpening effect is better. The sharpened image is fused with the original image, the original image information is retained and the pixel value at the image gradient mutation point is enhanced to enhance the image edge. The Laplace operator template is:
[0130]
[0131] The second-order derivative of the Laplace operator is used to describe the homogeneous function of a two-dimensional image, indicating the characteristics and properties of the image:
[0132]
[0133] The edge enhancement formula is:
[0134]
[0135] Where: g is the output, f is the original image, c is the detail coefficient, and whether the pixel is enhanced is determined according to the value of c. In step S6, an improved sparrow search algorithm is introduced to optimize the threshold of the two-dimensional Otsu algorithm. The specific setting parameters are shown in Table 1, including population size pop, spatial dimension d, maximum number of iterations pop, maximum number of iterations iter max , warning value R2, warning value ST, discoverer ratio PR, alerter ratio SD, weight coefficient adjustment parameter m1, weight coefficient adjustment parameter r1, weight coefficient adjustment parameter m2, weight coefficient adjustment parameter r2, dynamic selection probability P, Otsu algorithm image segmentation optimal low threshold t1 and Otsu algorithm image segmentation optimal low threshold t2:
[0136] Table 1 Parameter settings of sparrow search algorithm optimization Otsu algorithm
[0137]
[0138] As a preferred method, the Sparrow Search Algorithm (SSA) is to find the optimal solution to the problem by simulating the process of sparrows looking for food. According to the foraging behavior and anti-predator behavior of the sparrow group, the sparrow population can be abstracted into discoverers, followers and guards. Among them, the discoverer occupies a dominant position in the group, has a good fitness value, is responsible for finding food and providing the foraging direction and area for the entire group; the follower finds food based on the information provided by the discoverer to increase its own fitness value; there will be reconnaissance and alert behavior in the sparrow foraging behavior. When the guard in the population finds predators around, it will send out an alert signal. When the alarm signal is greater than the alarm value, the discoverer will lead the entire population to find another foraging place. In the sparrow search algorithm, there are pop sparrows, and the coordinates of the i-th sparrow in the d-dimensional space are X i =[x i1 , x i2 , …, x id ], and its fitness value is
[0139] Finder position update: In SSA, finders with good fitness values will be given priority in obtaining food during the search process, and their position update formula is as follows:
[0140]
[0141] Where t is the current iteration number, j = 1, 2, ..., d, inter max is the maximum number of iterations. i,jRepresents the position information of the i-th sparrow in the j-th dimension. α∈(0,1] is a random number. R2 and ST are the warning value and alert value respectively, and R2∈[0,1], ST∈[0.5,1]. Q is a random number that obeys the normal distribution. L is a 1×d unit matrix. When R2<ST, it means that there are no predators around the foraging environment, and individual sparrows can perform extensive search operations; when R2≥ST, it means that the sparrows in the population have discovered the predator. At this time, the discoverer needs to lead the sparrow population to fly to other safe places to forage.
[0142] Followers always observe the discoverer and follow the discoverer to find food. If the follower is too hungry, it will fly to other places to find food to get more energy. The identities of followers and discoverers will change as energy reserves change, but the ratio of the two numbers is fixed. The follower position update formula is as follows:
[0143]
[0144] in, Indicates the position of the individual with the worst fitness value at the tth iteration, represents the position of the discoverer with the best fitness value at the t+1th iteration, A represents a 1×d matrix, in which the elements are randomly assigned to -1 or 1, and A + =A T (AA T ) -1 .when When , it indicates that the i-th sparrow with a lower fitness value is in a hungry state. Since there are many hungry sparrows at present, the food in the area cannot meet the needs of the overall sparrows, and then the followers follow the discoverer to search for food in the foraging area; when When , it indicates that there is more food in the area, which can meet the needs of the overall sparrows, and the followers will conduct random searches in the current area.
[0145] Randomly select sparrows from the population as sentinels, indicating that the number of individuals in the population who are aware of danger generally accounts for 10% to 20% of the population. The update formula for the sentinel position is as follows:
[0146]
[0147] in, Indicates the position of the individual with the current optimal fitness value, β is a normally distributed random number with a mean of 0 and a variance of 1, and represents the step control coefficient. K∈[-1, 1] is a random number, f i is the current individual fitness value, f g and f wThey represent the current optimal individual fitness value and the worst individual fitness value respectively. ε is a constant that tends to zero infinitely (to prevent the denominator from being zero). i >f g When the sparrow is far from the optimal position, it is vulnerable to danger and will shrink and move closer to the optimal position; when f i =f g When the sparrows near the best position realize the danger, they will randomly move closer to other sparrows to search and avoid being preyed upon.
[0148] In step S7, the sparrow population is initially set by using the Tent mapping method, so that the population is more evenly distributed in the search space. The design of this initial distribution helps to guide the algorithm to search the space comprehensively, thereby improving the global search ability and convergence speed of SSA in the optimization process. In summary, by introducing the Tent mapping strategy, the lack of diversity and local optimality problems that SSA may encounter in the optimization process are effectively solved, thereby significantly enhancing the performance of the algorithm. The Tent chaos mapping expression is as follows:
[0149]
[0150] Wherein: γ∈(0,1), which takes the value of 0.5 in this embodiment.
[0151] In step S8, the optimal threshold is found by maximizing the inter-class variance, and the two-dimensional Otsu algorithm inter-class discrete matrix is used as the objective function. The multi-threshold segmentation searches for a set of thresholds [t1, t2, ..., t n ](n>0), and split it into n+1 parts, where Otsu is a global adaptive threshold selection method. For a given image with gray levels in [0, 1, ..., L-1] (L is usually 256), the number of images with gray level j is n j , the total number of pixels is N, and the probability distribution is as follows:
[0152] n0+n1+…+n L-1 =N (21)
[0153]
[0154] The grayscale mean of each part of the image is expressed as:
[0155]
[0156]
[0157] Then the inter-class variance of the image is expressed as:
[0158] s2 =ω0(u0-u T ) 2 +ω1(u1-u T ) 2 +…+ω n (u n -u T ) 2 (27)
[0159] Where: u T Represents the grayscale mean of the entire image, calculated as follows:
[0160]
[0161] When the threshold vector satisfies the following formula (29), it is the optimal threshold, which can be specifically expressed as:
[0162]
[0163] Where: Corresponding 2 When the maximum value is obtained, the corresponding optimal image segmentation threshold array, in this embodiment, n is 2.
[0164] In the step S10, when the dynamic nonlinear inertia weight w1 is introduced to optimize the position of the discoverer and the dynamic nonlinear inertia weight w2 is introduced to optimize the position of the alerter, the following steps are specifically included:
[0165] Step S10.1: Introduce nonlinear increasing inertia weight w1 to optimize the finder position. When creatures in nature are in danger, their escape speed generally becomes faster and faster until it reaches the maximum value. The acceleration increases first and then decreases. In the finder position update model of this embodiment, when R2≥ST, the sparrow is in a dangerous state. The nonlinear increasing inertia weight w1 is introduced, which can reduce the influence of the sparrow's own position in the early stage and speed up the convergence speed. As the number of iterations increases, the search range is increased and the probability of the sparrow falling into the local optimal solution is reduced. The new finder position update and weight w1 formula are as follows:
[0166]
[0167] Where: m1 and r1 are adjustment parameters of the weight coefficient. In this embodiment r1=3;
[0168] Step S10.2: Introduce the nonlinear increasing inertia weight w2 to optimize the position of the sentinel. In the sentinel position update model, when f i >f gWhen the sparrow is at the edge of the population and is vulnerable to predators, the dynamic nonlinear inertia weight w2 is introduced to reduce the influence of the optimal sparrow position in the early stage, making it easier to find other optimal solutions. As the number of iterations increases, the sparrow gradually approaches the optimal sparrow to forage, and the convergence speed gradually accelerates. The new sentinel position update and weight w2 formula are as follows:
[0169]
[0170] Where: m2 and r2 are adjustment parameters of the weight coefficient. In this embodiment r2=3.
[0171] In step S11, the Levy flight strategy is introduced to optimize the follower position. The Levy flight strategy simulates the random walk process of animals foraging to expand the search space, increase its diversity, improve the situation of falling into the local optimum, and enhance the global search ability. The Levy flight strategy expression is as follows:
[0172]
[0173]
[0174] Where: Levy (τ) is the flight step length; the parameter τ is 1.5; μ and v follow the normal distribution Γ(β) is the gamma function, β is 1.5;
[0175] With this strategy, the follower position is updated as follows:
[0176]
[0177] In step S14, an adaptive t-distribution mutation method is introduced to disturb individual sparrows, so as to improve the ability of the algorithm to jump out of the local optimum. The t-distribution mutation operator with the number of iterations t as the degree of freedom parameter of the t-distribution is used to disturb the position of the sparrows, so that the algorithm has better global development ability in the early stage of iteration and good local exploration ability in the late stage of iteration, and improves the convergence speed of the algorithm. The specific position update method is as follows:
[0178]
[0179] Where: is the position of the sparrow after the disturbance, is the position of sparrow i at the tth iteration, and the update formula is On the basis of It not only makes full use of the current position information, but also adds random interference information to help the algorithm jump out of the local optimum. As the number of iterations t increases, the t distribution gradually approaches the Gaussian distribution, which helps to enhance the convergence speed of the algorithm.
[0180] Although the introduction of the adaptive t-distribution mutation operator greatly improves the optimization performance of the algorithm, it also has some shortcomings, such as increasing the calculation time of the algorithm, which is not conducive to the characteristics of the original algorithm itself. Therefore, the dynamic selection probability P is introduced to adjust the use of the adaptive t-distribution mutation operator. The calculation formula is as follows:
[0181]
[0182] Where: iter max is the maximum number of iterations, t is the current number of iterations, P max is the upper limit of the dynamic probability, ΔP is the change range of the dynamic selection probability, and in this embodiment, P max =0.55, ΔP=0.1, the dynamic selection probability P makes the algorithm have a greater probability in the early stage of iteration to facilitate the adaptive t distribution mutation operator to perturb the position of the sparrow, improving the original algorithm's tendency to converge to the optimal solution in the early stage of iteration; at the same time, in the later stage of iteration, give full play to the good local development ability of the original algorithm, and use the t distribution mutation with a lower probability as a supplement to improve the convergence speed of the algorithm; jump to step S8, and t=t+1. In the step S18, the area proportion sp of the area enclosed by the defect contour of the singeing process of the grey cloth and the actual total length len of the defect contour are calculated, which specifically includes the following steps:
[0183] Step S18.1: Calculate the area ratio sp of the area enclosed by the outline of the singeing process defect of the grey cloth. First, obtain the entire area S of the image through OpenCV.cvtColor().size 总 ; Secondly, traverse the image through OpenCV.contourArea(contour) to obtain the defect area S 缺陷 , where contour represents the contour parameter; finally, calculate the area ratio sp of the area enclosed by the defect contour, that is, Step S18.2: Calculate the actual total length len of the defect contour of the grey fabric singeing process. First, obtain the defect through OpenCV.threshold(); second, obtain the contour through OpenCV.findContour(); then, traverse the image defect contour through OpenCV.arcLength() and accumulate to obtain the total length len of the defect contour picture ; Finally, the total length of the defect contour len picture Multiply by the measurement ratio rs (unit: pixel / mm) to obtain the actual total length len of the defect contour, that is, len = len picture In the step S19, firstly, the evaluation index of the defect abnormality of the singeing process of the grey cloth is introduced and the early warning threshold and the alarm threshold corresponding to the defect contour area ratio are set to sp warn 、spalarm ; The corresponding defect contour length warning threshold and alarm threshold are len warn ,len alarm ; In this embodiment: sp warn =5%, sp alarm =10%,len warn =1mm,len alarm =10mm, then, the abnormality of the singeing process defect of the grey cloth is judged, which specifically includes the following steps:
[0184] Step S19.1: If sp<sp warn And len<len warn , the singeing process of the grey cloth is normal, and the process returns to step S1;
[0185] Step S19.2: If sp<sp alarm And sp ≥ sp warn Or satisfy len≥len warn And len<len alarm , then the grey cloth singeing process warning is issued, and the warning information needs to be pushed down to the operator for rework operation, and the process returns to step S1; otherwise, the process continues to execute downward;
[0186] Step S19.3: If sp≥sp alarm or len≥len alarm , the grey cloth singeing process alarm needs to be pushed down to the operator for scrapping operation, and return to step S1.
[0187] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A method for monitoring and adjusting the abnormality of the singeing process of grey cloth, characterized in that: The method comprises the following steps: Step S1: infrared image acquisition; Step S2: grayscale processing of the image; Step S3: image smoothing processing; Step S4: Calculate the gradient magnitude and gradient direction; Step S5: non-maximum suppression; Step S6: parameter initialization; Step S7: population optimization; Step S8: Calculate and sort the fitness values of individual sparrows according to the objective function, and find out the best and worst fitness values and their corresponding positions; Step S9: Determine whether the maximum number of iterations is met, if so, jump to step S16, if not, proceed to the next step; Step S10: introducing dynamic nonlinear inertia weight w1 to optimize the position of the discoverer and dynamic nonlinear inertia weight w2 to optimize the position of the sentinel; Step S11: Introduce the Levy flight strategy to optimize the follower position; Step S12: Generate a random number R between 0 and 1; Step S13: Determine the size of the random number R and the dynamic selection probability P. If R>P, jump directly to step S8, otherwise proceed to the next step; Step S14: introducing an adaptive t-distribution variation method to perturb individual sparrows, thereby improving the algorithm's ability to escape from local optimality; Step S15: Jump to step S8 and continue execution; Step S16: output the optimal individual and its fitness value to obtain the optimal high and low segmentation threshold; Step S17: First, binarize and segment the image, and then, after completing the detection, connect each edge point; Step S18: Calculate the area ratio sp of the region enclosed by the defect contour of the singeing process of the grey cloth and the actual total length len of the defect contour; Step S19: First, introduce the evaluation index of the defect abnormality of the grey cloth singeing process and set the corresponding defect category warning threshold and alarm threshold; second, make a judgment on the defect abnormality of the grey cloth singeing process.
2. The method for monitoring and adjusting the abnormality of the singeing process of grey cloth according to claim 1 is characterized in that: In the step S1, a time interval Δt is set, and a corresponding infrared thermal imager is connected to collect the singeing image of the grey cloth in real time, and the sampling interval is set to 30s.
3. The method for monitoring and adjusting the abnormality of the singeing process of grey cloth according to claim 1, characterized in that: In step S3, median-Gaussian filtering is used in combination with Laplace transform to perform image denoising, thereby smoothing the image. Adaptive median filtering dynamically changes the window width of the median filter for specific image conditions to ensure that noise is removed while retaining image detail features. Specifically, the following steps are included: Step S3.1: xy The working domain of the filter, the center point of the area covered by the filter window is the pixel in the xth row and yth column in the image; S xy The minimum gray value, maximum gray value, and middle gray value are Z min , Z max , Z med , Z xy Represents the grayscale value of the pixel at the xth row and yth column in the image; S xy The maximum allowed window size is S max ; Step S3.2: When (Z med -Z min )>0 and (Z med -Z max )<0, go to step S3.3, otherwise increase the size of the window, and if the increased size is not greater than S max , then re-execute step S3.2, otherwise directly output Z med ; Step S3.3: When (Z xy -Z min )>0 and (Z xy -Z max )<0, output Z xy , otherwise output Z med ; Step S3.4: After the adaptive median filter is processed to effectively suppress the salt and pepper noise, the adaptive Gaussian filter method is then used to remove the Gaussian noise, and the Gaussian kernel is generated using a two-dimensional Gaussian filter function: Where: k is the radius of the Gaussian kernel, σ is the standard deviation, the Gaussian kernel coefficient weight has a specific proportional relationship with the variance. When the convolution window slides, the Gaussian kernel standard deviation σ is obtained according to the variance. The variance calculation formula for a certain area of the image is: Where: S i,j is the convolution window of the center point (i, j), D(i, j) is the variance, and the larger D(i, j), the smaller the pixel value is in S i,j The higher the degree of discreteness in the region, the smaller the Gaussian kernel coefficient weight generated by σ is used to effectively reduce the impact on the region, and thus the following is obtained: Since D(i, j) is a constant, R(i, j) is a function of k and σ, that is: When R is 1, the parameter weight in the Gaussian kernel is closest to the pixel value weight. At this time, σ is calculated by S xy The variance D of the pixel values in the area is obtained, and so on, repeated iterations are performed to form an adaptive Gaussian filter, and finally the Gaussian filter processing is completed by convolution of all image pixels; Step S3.5: To solve the problem that the image clarity becomes low and the edge information is not easy to reflect after filtering, the Laplace operator is used to sharpen the image. Compared with the first-order differential operator, the positioning tension is relatively strong and the sharpening effect is better. The sharpened image is fused with the original image, the original image information is retained and the pixel value at the image gradient mutation point is enhanced to enhance the image edge. The Laplace operator template is: The second-order derivative of the Laplace operator is used to describe the homogeneous function of a two-dimensional image, indicating the characteristics and properties of the image: The edge enhancement formula is: Where: g is the output, f is the original image, c is the detail coefficient, and whether the pixel is enhanced is determined based on the value of c.
4. The method for monitoring and adjusting the abnormality of the singeing process of grey cloth according to claim 1, characterized in that: In step S6, an improved sparrow search algorithm is introduced to optimize the two-dimensional Otsu algorithm threshold.
5. The method for monitoring and adjusting the abnormality of the singeing process of grey cloth according to claim 4 is characterized in that: In step S7, the sparrow population is initially set by using the Tent mapping method so that the population is more evenly distributed in the search space. The Tent chaotic mapping expression is as follows: Where: γ∈(0,1).
6. The method for monitoring and adjusting the abnormality of the singeing process of grey cloth according to claim 5, characterized in that: In step S8, the optimal threshold is found by maximizing the inter-class variance, and the two-dimensional Otsu algorithm inter-class discrete matrix is used as the objective function. The multi-threshold segmentation searches for a set of thresholds [t1, t2, ..., t n ](n>0) and split it into n+1 parts, where Otsu is a global adaptive threshold selection method. For a given image with gray levels in [0, 1, ..., L-1], the number of images with gray level j is n j , the total number of pixels is N, and the probability distribution is as follows: n0+n1+…+n L-1 =N (21) The grayscale mean of each part of the image is expressed as: Then the inter-class variance of the image is expressed as: s 2 =ω0(u0-u T ) 2 +ω1(u1-u T ) 2 +…+oh n (u n -u T ) 2 (27) Where: u T Represents the grayscale mean of the entire image, calculated as follows: When the threshold vector satisfies the following formula (29), it is the optimal threshold, which can be specifically expressed as: Where: Corresponding 2 When the maximum value is obtained, the corresponding optimal image segmentation threshold array.
7. The method for monitoring and adjusting the abnormality of the singeing process of grey cloth according to claim 6, characterized in that: In the step S10, when the dynamic nonlinear inertia weight w1 is introduced to optimize the position of the discoverer and the dynamic nonlinear inertia weight w2 is introduced to optimize the position of the alerter, the following steps are specifically included: Step S10.1: Introduce the nonlinear increasing inertia weight w1 to optimize the finder position. In the finder position update model, when R2 ≥ ST, the sparrow is in a dangerous state. Introducing the nonlinear increasing inertia weight w1 can reduce the influence of the sparrow's own position in the early stage and accelerate the convergence speed. As the number of iterations increases, the search range is increased and the probability of the sparrow falling into the local optimal solution is reduced. The new finder position update and weight w1 formula are as follows: Where: m1 and r1 are the adjustment parameters of the weight coefficient; Step S10.2: Introduce the nonlinear increasing inertia weight w2 to optimize the position of the sentinel. In the sentinel position update model, when f i >f g When the sparrow is at the edge of the population and is vulnerable to predators, the dynamic nonlinear inertia weight w2 is introduced to reduce the influence of the optimal sparrow position in the early stage, making it easier to find other optimal solutions. As the number of iterations increases, the sparrow gradually approaches the optimal sparrow to forage, and the convergence speed gradually accelerates. The new sentinel position update and weight w2 formula are as follows: Where: m2 and r2 are the adjustment parameters of the weight coefficient.
8. The method for monitoring and adjusting the abnormality of the singeing process of grey cloth according to claim 7, characterized in that: In step S11, the Levy flight strategy is introduced to optimize the follower position to expand the search space, increase its diversity, improve the situation of falling into the local optimum, and enhance the global search capability. The Levy flight strategy expression is as follows: Where: Levy (τ) is the flight step length; the parameter τ is 1.5; μ and v follow the normal distribution Γ(β) is the gamma function, β is 1.5; With this strategy, the follower position is updated as follows:
9. The method for monitoring and adjusting the abnormality of the singeing process of grey cloth according to claim 8, characterized in that: In step S14, an adaptive t-distribution mutation method is introduced to disturb individual sparrows, so as to improve the ability of the algorithm to jump out of the local optimum. The t-distribution mutation operator with the number of iterations t as the degree of freedom parameter of the t-distribution is used to disturb the position of the sparrows, so that the algorithm has better global development ability in the early stage of iteration and good local exploration ability in the late stage of iteration, and improves the convergence speed of the algorithm. The specific position update method is as follows: Where: is the position of the sparrow after the disturbance, is the position of sparrow i at the tth iteration, and the update formula is On the basis of It not only makes full use of the current position information, but also adds random interference information to help the algorithm jump out of the local optimum. As the number of iterations t increases, the t distribution gradually approaches the Gaussian distribution, which helps to enhance the convergence speed of the algorithm. The dynamic selection probability P is introduced to adjust the use of the adaptive t-distribution mutation operator, and its calculation formula is as follows: Where: iter max is the maximum number of iterations, t is the current number of iterations, P max is to determine the upper limit of the dynamic probability, ΔP is the range of change that determines the dynamic selection probability, and the dynamic selection probability P makes the algorithm more likely to use the adaptive t-distribution mutation operator to perturb the position of the sparrow in the early stage of iteration, improving the original algorithm's tendency to converge to the optimal solution in the early stage of iteration; at the same time, in the later stage of iteration, the original algorithm's good local development ability is fully utilized, and the t-distribution mutation with a smaller probability is used as a supplement to improve the convergence speed of the algorithm; Jump to step S8, and t=t+1.
10. The method for monitoring and adjusting the abnormality of the singeing process of grey cloth according to claim 9, characterized in that: In the step S18, the area ratio sp of the region enclosed by the defect contour of the singeing process of the grey cloth and the actual total length len of the defect contour are calculated, which specifically includes the following steps: Step S18.1: Calculate the area ratio sp of the area enclosed by the outline of the singeing process defect of the grey cloth. First, obtain the entire area S of the image through OpenCV.cvtColor().size 总 ; Secondly, traverse the image through OpenCV.contourArea(contour) to obtain the defect area S 缺陷 , where contour represents the contour parameter; finally, calculate the area ratio sp of the area enclosed by the defect contour, that is, Step S18.2: Calculate the actual total length len of the defect contour of the grey fabric singeing process. First, obtain the defect through OpenCV.threshold(); second, obtain the contour through OpenCV.findContour(); then, traverse the image defect contour through OpenCV.arcLength() and accumulate to obtain the total length len of the defect contour picture ; Finally, the total length of the defect contour len picture Multiply by the measurement ratio rs to obtain the actual total length len of the defect contour, that is, len = len picture ×rs.
11. The method for monitoring and adjusting the abnormality of the singeing process of grey cloth according to claim 10, characterized in that: In the step S19, firstly, the evaluation index of the defect abnormality of the singeing process of the grey cloth is introduced and the warning threshold and the alarm threshold corresponding to the defect contour area ratio are set to sp warn 、sp alarm ; The corresponding defect contour length warning threshold and alarm threshold are len warn ,len alarm ; Then, the abnormality of the singeing process defects of the grey cloth is judged, which specifically includes the following steps: Step S19.1: If sp<sp warn And len<len warn , the singeing process of the grey cloth is normal, and the process returns to step S1; Step S19.2: If sp<sp alarm And sp ≥ sp warn Or satisfy len≥len warn And len<len alarm , then the grey cloth singeing process warning is issued, and the warning information needs to be pushed down to the operator for rework operation, and the process returns to step S1; otherwise, the process continues to execute downward; Step S19.3: If sp≥sp alarm or len≥len alarm , the grey cloth singeing process alarm needs to be pushed down to the operator for scrapping operation, and return to step S1.