A method for detecting environmentally friendly yarn defects
By acquiring spinning grayscale images, calculating the abnormality index and DTW distance of the yarn width sequence, dimensionality reduction processing, and calculating the yarn abnormality coefficient, the problem of low accuracy of yarn defect detection in the existing technology is solved, and high accuracy is achieved Rate and low cost yarn defect detection.
Patent Information
- Application Number
- CN202410942318.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-15
- Publication Date
- 2025-01-03
- Estimated Expiration
- 2044-07-15
AI Technical Summary
The prior art detects defects of environmentally friendly yarns with low accuracy, especially because the diameter of spinning is small and the diameter difference caused by adhesion is small, making it difficult to accurately determine whether the yarn has defects, and high-precision cameras increase costs. .
By obtaining at least three frames of spinning grayscale images, the abnormality index and DTW distance of the spinning width sequence are calculated, and the yarn abnormality coefficient is calculated through dimensionality reduction and normalization processing to determine whether there are defects in the yarn.
It improves the accuracy of yarn defect detection, can detect yarn defects in real time, reduces the production of excessive defective yarns due to detection errors, and reduces cost requirements.
Smart Images

Figure CN118470029B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image data processing. The present invention relates to a method for detecting environmentally friendly yarn defects. Background Art
[0002] Environmentally friendly yarn is produced from polyester materials. Specifically, recycled plastic bottles can be processed to obtain polyester materials. The polyester material can then be melted, and the molten polyester material passes through a "shower head" and relies on the polyester material's own gravity to achieve wire drawing, thereby obtaining spinning. Afterwards, the spinning can be gathered and other treatments can be performed to obtain yarn. Among them, in the process of making yarn, the spinning will shake, and the molten polyester material may stick together, thereby forming spinning adhesion. When spinning adhesion occurs, it will affect the quality of the yarn, and it is considered that the yarn is defective.
[0003] Related prior art, such as the patent document with authorization announcement number CN110298840B, discloses an image-based yarn defect detection method, which includes: using image processing technology to obtain a finished yarn image, and then determining the yarn diameter, and comparing the diameter with a standard diameter to determine whether the yarn has defects.
[0004] When using the above method to detect yarn defects: Due to the small diameter of the yarn, the accuracy of measuring the yarn diameter using ordinary cameras and image processing technology may be low. If a high-precision camera is used, the cost will increase.
[0005] The defect of the polyester fiber yarn may be caused by adhesion of part of the spinning used to produce the yarn; when adhesion occurs in part of the spinning during the production process of the yarn, the difference between the diameter of the sticking yarn and the standard diameter may be small. Since the difference between the yarn diameter and the standard diameter is likely to be small when the polyester fiber yarn of the present scheme has defects, the accuracy of defect detection of the polyester fiber yarn using the above method is low. Summary of the invention
[0006] In order to solve the above-mentioned technical problem of low accuracy in yarn defect detection, the present invention proposes an environmentally friendly yarn defect detection method. The method comprises:
[0007] At least three frames of spinning grayscale images are obtained; the first irrelevant index corresponding to the same reference area in any two adjacent frames of images is calculated, and the maximum value of the abnormal index of the spinning width sequence of any frame of grayscale image is determined and recorded as the reference index; the same reference area refers to the row area of spinning at the same horizontal position, and the spinning is arranged vertically; wherein the process of obtaining the abnormal index and the first irrelevant index of any spinning width sequence includes:
[0008] Peak point detection is performed on a row of grayscale sequences in the same reference area of any grayscale image to obtain all peak points, and then all spinning width sequences, the width distances of the first and last peak points are obtained, wherein the total number of grayscale values in any spinning width sequence represents the width of the corresponding spinning, and the spinning width sequence is composed of the pixel grayscale values between the odd peak point and its next peak point and the pixel points corresponding to these two peak points, and the peak point is the grayscale value; the abnormal index is positively correlated with the first difference, and the first difference is the absolute difference between the total number of grayscale values in the spinning width sequence and the standard value, and the standard value is the spinning width corresponding to normal spinning. The total number of gray values in the width sequence, the standard value is a preset value; calculating the two-dimensional data of the spinning width sequence, the two-dimensional data consists of a first distance and an abnormality index, the first distance is the distance between the pixel point corresponding to the gray value at the center of each spinning width sequence and the pixel point of the first peak point; all two-dimensional data form a two-dimensional sequence; reducing the dimension of the data in the two-dimensional sequence of all gray images to obtain a reduced dimension sequence corresponding to each gray image; using the DTW algorithm to calculate the DTW distance of the reduced dimension sequence of any two adjacent gray images, recorded as the first irrelevant index; and then obtaining the first irrelevant index of each two adjacent gray images;
[0009] The means of all the first irrelevant indicators are negatively normalized to obtain the relevant indicators, and the product of the relevant indicators and the means of all the reference indicators is used as the yarn abnormality coefficient. In response to the yarn abnormality coefficient being greater than a preset threshold, it is considered that the yarn is defective.
[0010] The present invention takes into account the relationship between the spinning width and the yarn defect, wherein the greater the difference between the spinning width and the standard value, the greater the possibility that the yarn has defects. The reason is that when the spinning has abnormal conditions such as adhesion, the difference between the spinning width and the standard value is large. The present invention also determines the two-dimensional sequence of different grayscale images based on the spinning position and the spinning width. Then the data in all two-dimensional sequences are reduced in dimension to obtain the reduced dimension sequence corresponding to the different grayscale images for subsequent analysis and processing. The first irrelevant index of the adjacent reduced dimension sequence is calculated. The smaller the mean of the first irrelevant index and the greater the difference between the spinning width and the standard value, the more likely the yarn is to have defects, and the defect may be caused by spinning adhesion. The reason is that if the difference between the spinning width and the standard value is large, and the yarn is normal, the reason for the large difference is spinning shaking, which further indicates that the first irrelevant index of the reduced dimension sequence of the adjacent image is large, that is, the correlation is small. It should be noted that: the possibility of separation of the adhered spinning is small, therefore, the correlation caused by the spinning adhesion is small; affected by the spinning shaking, the degree of variation of the abnormal index of the spinning width sequence corresponding to the same spinning area is large, therefore, the correlation of the dimensionality reduction sequence caused by the spinning shaking is small. Based on this, when the calculated yarn abnormality coefficient is greater than the preset threshold, it is considered that there are defects in the spinning. The present invention takes into account the relationship between various factors and spinning defects, including the spinning width and the changes in the same spinning area, so that the accuracy of determining whether the yarn is defective based on the calculated yarn abnormality coefficient is high. Moreover, the present invention performs defect detection on the yarn during the yarn production process, and can detect defects in the yarn in real time. For example, if the finished yarn is defectively detected, it may lead to the production of too many defective yarns.
[0011] Since the amount of data in the reduced dimensionality sequence may be different, the first irrelevant index calculated using the DTW algorithm can better reflect the irrelevance between the reduced dimensionality sequences.
[0012] In one embodiment, the expression of the abnormality indicator is:
[0013] ,in, is the abnormal index of the t-th spinning width sequence, is the total number of all gray values contained in the t-th spinning width sequence, Called the standard value.
[0014] The larger the value is, the more likely it is that the yarn area corresponding to the t-th spinning width sequence has defects. The reason is that when the yarn has abnormal conditions such as adhesion, The bigger the chances are.
[0015] In one embodiment, the abnormal index is also positively correlated with the mean of all gray values in the spinning width sequence; the expression of the abnormal index is:
[0016] ,in, is the abnormal index of the t-th spinning width sequence, is the mean of all gray values contained in the t-th spinning width sequence, is the total number of all gray values contained in the t-th spinning width sequence, is called the standard value, It is the total number of gray values in the spinning width sequence corresponding to normal spinning, and the standard value is a preset value.
[0017] Taking into account the spinning vibration, the calculated The accuracy is reduced, so the relationship between the mean of all gray values in the spinning width sequence and the abnormal index is also considered. The larger the mean, the clearer the image, and the calculated The higher the accuracy of , the greater the probability, which makes the calculated abnormal index more reliable. and The relationship with the abnormal index enables the calculated abnormal index to better reflect the abnormal degree of the spinning area corresponding to the corresponding spinning width sequence.
[0018] In one embodiment, the data in the two-dimensional sequence of all grayscale images is reduced in dimension to obtain the reduced-dimensional sequence corresponding to each grayscale image, including:
[0019] The PCA algorithm is used to reduce the dimension of the data in the two-dimensional sequence of all grayscale images to obtain the reduced dimension sequence corresponding to each grayscale image.
[0020] The PCA algorithm is used on all data to obtain the sequence after dimensionality reduction, which is more convenient for the subsequent calculation of the first irrelevant index of adjacent dimensionality reduction sequences.
[0021] In one embodiment, negative correlation normalization is performed on the means of all first irrelevant indicators to obtain relevant indicators, including: the expression of the relevant indicator is:
[0022] ,in, For related indicators, is the mean of all first irrelevant indices, is a natural exponential function.
[0023] Beneficial effects of the present invention:
[0024] The present invention determines the yarn abnormality index based on the first related index of the dimension reduction sequence corresponding to the grayscale images of adjacent frames and the abnormality index corresponding to the spinning width sequence. The yarn abnormality index reflects whether the yarn has defects. Specifically, the yarn abnormality index can reflect whether the spinning corresponding to the yarn has adhesion. The present invention considers the relationship between multiple factors and the yarn abnormality index, and improves the accuracy of yarn defect detection.
[0025] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] The above and other objects, features and advantages of the exemplary embodiments of the present invention will become readily understood by reading the detailed description below with reference to the accompanying drawings. In the accompanying drawings, several embodiments of the present invention are shown in an exemplary and non-limiting manner, and the same or corresponding reference numerals represent the same or corresponding parts, wherein:
[0027] Figure 1 is a flow chart schematically showing an environmentally friendly yarn defect detection method according to an embodiment of the present invention;
[0028] Figure 2 is a schematic diagram schematically showing an image of spinning taken by a camera according to an embodiment of the present invention;
[0029] Figure 3 is a schematic diagram schematically illustrating a reference image according to an embodiment of the present invention;
[0030] Figure 4 is a schematic diagram schematically illustrating a first horizontal straight line of a first grayscale image according to an embodiment of the present invention;
[0031] Figure 5 is a schematic diagram schematically illustrating a second horizontal straight line of a second grayscale image according to an embodiment of the present invention;
[0032] Figure 6 is a schematic diagram schematically showing a first grayscale image according to an embodiment of the present invention;
[0033] Figure 7 FIG. 4 is a schematic diagram schematically showing a second grayscale image according to an embodiment of the present invention. DETAILED DESCRIPTION
[0034] In some of the processes described in the specification and claims of the present invention and the above-mentioned figures, multiple operations appearing in a specific order are included, but it should be clearly understood that these operations may not be executed in the order in which they appear in this article or executed in parallel, and the serial numbers of the operations, such as 101, 102, etc., are only used to distinguish different operations, and the serial numbers themselves do not represent any execution order. In addition, these processes may include more or fewer operations, and these operations may be executed in sequence or in parallel. It should be noted that the descriptions of "first", "second", "A1", "B1", etc. in this article are used to distinguish different messages, devices, modules, etc., and do not represent the order of precedence, nor do they limit "A1", "B1", "first" and "second" to be different types; in other words, the serial numbers themselves for the components in this article, such as "A1", "B1", "first", "second", etc., are only used to distinguish the objects described, and do not have any order or technical meaning. For example: the first horizontal straight line of a grayscale image is the horizontal straight line of the grayscale image. The first has no technical meaning and is only used to distinguish objects. The role of adding "first" includes: facilitating description, understanding and explanation, and facilitating citing different objects, making the article more concise and clear. For example: the first horizontal straight line and the second horizontal straight line are different horizontal straight lines.
[0035] One of the functions of the drawings of the present invention is to facilitate description and understanding. The drawings are exemplary.
[0036] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0037] The specific embodiments of the present invention are described in detail below with reference to the accompanying drawings.
[0038] Figure 1 FIG. 1 is a flow chart schematically showing a method for detecting environmentally friendly yarn defects according to an embodiment of the present invention. Figure 1 shown.
[0039] The description is as follows, including steps S1 to S4:
[0040] S1: Acquire at least two frames of spinning grayscale images.
[0041] The following first explains the general formation process of yarn and the causes of yarn defects.
[0042] Environmentally friendly yarn is made of polyester material. For example, the specific production process of environmentally friendly yarn is: first, plastic bottles can be crushed and cleaned to obtain polyester material, then the polyester material is dried, then the polyester material is melted and drawn to obtain spinning, then the spinning can be gathered to make fibers, and finally the fibers are processed to obtain yarn. However, during the spinning and gathering process, if the spinning is adhered or other abnormalities occur, it will cause defects in the subsequent yarn.
[0043] The following describes the specific formation process of the yarn and detailed information on defects.
[0044] In the process of making environmentally friendly yarn, physical methods are usually used to melt and draw polyester materials to obtain spinning. For example, the molten polyester material is drawn according to the gravity of the polyester material. More specifically, the polyester material is drawn through a "shower head" according to the gravity of the material. Then the spinning is gathered together to form yarn. Among them, if individual spinning is abnormal during the spinning process to form yarn, the corresponding yarn will be defective.
[0045] During the spinning and yarn forming process, the spinning will shake, which may cause multiple spinnings to stick together, resulting in yarn defects. Since the polyester material is spun according to gravity after melting, if the polyester material is heated unevenly during melting, the thickness of the obtained spinning will be uneven, that is, some spinnings are thinner and some spinnings are thicker.
[0046] When a camera is used to collect images of the spinning process, the camera is arranged on a horizontal plane above the spinning converging port.
[0047] For example: Figure 2 Schematic diagram of an image of spinning captured by a camera according to an embodiment of the present invention. Figure 2 As shown, 201 is spinning, and the color of the spinning is white in the actual image.
[0048] The camera is a fixed-focus camera, and its position is fixed. In order to highlight the spinning in the captured image, the background when capturing the image should be darker, or a black background board should be arranged. The reason is that the color of spinning is white.
[0049] The collected images are grayed out to obtain a spinning gray image, and then a continuous multi-frame gray image of the spinning can be obtained through a camera.
[0050] In one embodiment, a grayscale image can be obtained by a black and white camera. A frame rate of 12 frames per second can be set for shooting. The implementer can set the frame rate according to the specific scene.
[0051] S2: calculating the abnormal index of the spinning width sequence of the first and second grayscale images, and calculating the first irrelevant index corresponding to the first and second grayscale images.
[0052] The first grayscale image is any frame of grayscale image. The second grayscale image is the next frame of grayscale image adjacent to the first grayscale image.
[0053] The instructions are as follows:
[0054] Let's take a grayscale image as an example to calculate the corresponding sequence. The sequence is the two-dimensional sequence corresponding to the grayscale image. For the sake of convenience, the two-dimensional sequence is referred to as Sequence, that is, a two-dimensional sequence and The sequences have the same meaning.
[0055] Any grayscale image is called a reference image. The reference image is analyzed to determine the corresponding sequence.
[0056] Since the polyester material melt drawing relies on gravity drawing, the spinning is nearly vertical. Therefore, for ease of understanding, a horizontal straight line of the reference image is first determined, and the horizontal straight line is called the reference straight line.
[0057] For example, Figure 3 Schematic diagram of a reference image according to an embodiment of the present invention. Figure 3 As shown, 301 is a reference straight line, 302 is spinning, 303, 304, 305, 306, 307, 308 are intersection points between spinning and the reference straight line, wherein the intersection points are pixel points.
[0058] The grayscale values of the pixels on the reference line are extracted to form a one-dimensional grayscale sequence, which is recorded as a one-dimensional sequence. The pixels on the reference line are a row of pixels.
[0059] The spinning has a certain width, so the width of the spinning in the image is the width of multiple columns of pixels. For example, if the width of a pixel is 1, the width of the spinning in the image is greater than 1. Therefore, the peak point detection is performed on the one-dimensional sequence to obtain multiple peak points, where the peak point is the grayscale value of the intersection of the spinning and the background. It can be seen that: one spinning corresponds to 2 peak points. The Euclidean distance between the pixel point corresponding to the first peak point corresponding to the reference straight line and the pixel point corresponding to the last peak point is called the width distance. The width distance represents the distance between the first spinning and the last spinning. For example, the Euclidean distance between point 303 and point 308 is the width distance.
[0060] It should be noted that the grayscale value of the pixel corresponding to the peak point is greater than or equal to the grayscale value of the pixel in its adjacent area.
[0061] Obtain the grayscale data between the pixel corresponding to the first peak point and the pixel corresponding to the second peak point, and record the sequence consisting of the first peak point, the grayscale data and the second peak point as the first spinning width sequence. By analogy, all spinning width sequences corresponding to the reference straight line are obtained. For example, the sequence consisting of the grayscale value corresponding to point 303, the grayscale value of the pixel between point 303 and point 304, and the grayscale value corresponding to point 304 is the first spinning width sequence. By analogy, point 305 and point 306 correspond to the second spinning width sequence, and point 307 and point 308 correspond to the third spinning width sequence.
[0062] So far, all spinning width sequences corresponding to the reference straight line have been obtained.
[0063] In one embodiment, the expression of the abnormal index of each spinning width sequence corresponding to the reference straight line is: ,in, is the abnormal index of the t-th spinning width sequence, is the total number of gray values contained in the t-th spinning width sequence, reflects the spinning width corresponding to the t-th spinning width sequence. is called the standard value, is the total number of gray values in the spinning width sequence corresponding to normal spinning, and the standard value is a preset value. express and The difference is recorded as the first difference (the first difference has the same meaning as the difference A1). The implementer can set the size of the standard value according to the specific scenario. The standard value can be an empirical value of 5. Relevant experienced personnel can determine the standard value through the calibration relationship between the image coordinate system and the real coordinate system.
[0064] The standard value is called the spinning standard width value, which can be obtained by relevant experienced personnel. Specifically, the numerical value of the pixel points corresponding to the spinning standard width value in the image is obtained through the calibration relationship between the image coordinate system and the real coordinate system.
[0065] Preferably, in one embodiment, the expression of the abnormality index is: ,in, is the mean of all grayscale values contained in the tth spinning width sequence.
[0066] The specific instructions are as follows:
[0067] Characterizes the abnormal degree of spinning corresponding to the tth spinning width sequence.
[0068] The larger the value, the greater the possibility that the abnormality of the spinning corresponding to the t-th spinning width sequence is. , The larger the value is, the greater the possibility that the spinning corresponding to the t-th spinning width sequence will stick to other spinnings, which means that the spinning corresponding to the t-th spinning width sequence is more likely to be thicker due to a lower degree of melting, and thus the greater the possibility that the corresponding spinning is abnormal. Larger. , The smaller it is, the more likely that the corresponding spinning is thinner due to a lower degree of melting, which further indicates that the corresponding spinning is more likely to be abnormal.
[0069] The larger the value, the clearer the spinning image corresponding to the t-th spinning width sequence is, which means that the spinning image is less likely to be affected by spinning shaking. The more credible the abnormal index is, the more credible the calculated abnormal index is, and the greater the probability that the abnormal index is accurate. The reason is that when the degree of spinning shaking is greater, the blurriness of the spinning image is greater, which makes the calculated The lower the accuracy, the greater the probability.
[0070] In short, if only , and when the grayscale image is blurred due to shaking, the calculated Therefore, when calculating the abnormal index, we also consider .
[0071] Calculate the tth spinning width sequence ,in, The meaning is the same as that of two-dimensional data. is the abnormal index of the t-th spinning width sequence, It is the ratio of the distance B1 (the distance B1 has the same meaning as the first distance) of the t-th spinning width sequence to the width distance corresponding to the reference straight line.
[0072] In one embodiment, the distance B1 is the Euclidean distance between the pixel point corresponding to the first peak point of the t-th spinning width sequence and the pixel point corresponding to the first peak point corresponding to the reference straight line, the first peak point being the peak point closest to the first peak point corresponding to the reference straight line among the two peak points, and the two peak points being the two peak points corresponding to the t-th spinning width sequence. Figure 3As shown, for example, the peak point corresponding to 303 is the first peak point corresponding to the reference straight line, and the peak point corresponding to 307 is the first peak point corresponding to the third spinning width sequence.
[0073] In another embodiment, the distance B1 is the Euclidean distance between the pixel point corresponding to the grayscale value at the center of the t-th spinning width sequence and the pixel point corresponding to the first peak point corresponding to the reference straight line. For example, if the t-th spinning width sequence has 5 grayscale values, the third grayscale value is the grayscale value at the center.
[0074] Then we can get the corresponding values of all spinning width sequences corresponding to the reference straight line. sequence, The sequence is: , where n is the total number of all spinning width sequences corresponding to the reference straight line.
[0075] So far, the reference straight line corresponding to sequence.
[0076] Next, determine the horizontal straight line and dimensionality reduction sequence of the first grayscale image and the second grayscale image.
[0077] In one embodiment, the first grayscale image and the second grayscale image are grayscale images corresponding to two adjacent frame images in continuous frame images taken by a camera.
[0078] A first horizontal straight line of the first grayscale image may be determined first. Figure 4 Schematic diagram schematically showing a first horizontal straight line of a first grayscale image according to an embodiment of the present invention. Figure 4 As shown, 401 is the first horizontal straight line, and 402 is the first spinning pixel point, which is a pixel point of any spinning.
[0079] Next, a second horizontal straight line of the second grayscale image is determined.
[0080] In one embodiment, relevant personnel first detect the speed of the spinning motion and calibrate the camera coordinate system and the real coordinate system, and then determine the vertical distance between the second horizontal line and the first horizontal line according to the frame rate of the camera and the speed.
[0081] Then, a second horizontal straight line of the second grayscale image is determined according to the vertical distance and the first horizontal straight line. Figure 5 Schematic diagram schematically showing a second horizontal straight line of a second grayscale image according to an embodiment of the present invention. Figure 5As shown, 501 is the second horizontal straight line, 502 is the position of the first horizontal straight line in the image, the dotted line 503 is the vertical distance, 504 is the second spinning pixel point, 505 is the pixel point corresponding to the spinning width sequence P1, 506 is the pixel point corresponding to the spinning width sequence P2, 507 is the pixel point corresponding to the spinning width sequence P3, and 508 is the pixel point corresponding to the spinning width sequence P4.
[0082] For example, at the moment corresponding to the frame of the first grayscale image, the first spinning pixel reflects the position of a certain spinning in the image. In the two adjacent frames, the certain spinning moves a certain distance, and the second spinning pixel reflects the position of the certain spinning after the movement. The distance between the first spinning pixel and the second spinning pixel is the vertical distance between the second horizontal straight line and the first horizontal straight line.
[0083] That is, the vertical distance is the distance in the image corresponding to the distance of the spinning movement within the time of adjacent frames.
[0084] According to the above method for obtaining the abnormal index of the spinning width sequence corresponding to the reference straight line, the abnormal index of each spinning width sequence corresponding to the first horizontal straight line and the second horizontal straight line can be obtained.
[0085] It should be noted that the area of a row of grayscale sequences corresponding to the first horizontal straight line and the area of a row of grayscale sequences corresponding to the second horizontal straight line are the same reference area, and the same reference area is used to refer to the row area of spinning at the same horizontal position. It is easy to understand in conjunction with the accompanying drawings that the spinning area corresponding to the same reference area is the spinning area at the same horizontal position. The purpose of determining the same reference area is to determine whether a larger abnormal index is caused by spinning adhesion. Among them, the larger abnormal index may also be caused by spinning shaking.
[0086] According to the above, the reference straight line corresponds to The sequence method can obtain the first horizontal line corresponding to the first The second sequence and the second horizontal line correspond to the second sequence.
[0087] To the first sequence and second All spinning width sequences in the sequence use the PCA algorithm to obtain the first principal component direction, and obtain the projection value of each spinning width sequence in the first principal component direction. The projection value is the data after dimensionality reduction. The first dimensionality reduction sequence corresponding to the sequence and the second The second dimension reduction sequence corresponding to the sequence. For example, let For the first sequence, then the first dimension reduction sequence is ,in for The corresponding projection value.
[0088] The DTW algorithm (dynamic time warping algorithm) is used together with the first dimensionality reduction sequence and the second dimensionality reduction sequence to obtain the corresponding DTW distance, and the DTW distance is recorded as the DTW value (the DTW value and the first irrelevant indicator have the same meaning). It should be noted that, for example, the DTW value and the first irrelevant indicator have the same meaning, which means that the DTW value and the first irrelevant indicator refer to the same thing, and the DTW value and the first irrelevant indicator can replace each other. For example, the first irrelevant indicator can replace the DTW value.
[0089] The reason for using the DTW algorithm is that the spinning may stick and shake, resulting in unequal lengths of the first and second dimensionality reduction sequences. The shaking of the spinning is random, and the parts of the two shaking spinnings may overlap, and the overlapping parts appear as one spinning in the image. That is, part of one spinning obscures part of another spinning.
[0090] In another embodiment, if the total number M1 of data in the first dimensionality reduction sequence is different from the total number M2 of data in the second dimensionality reduction sequence, the total number M1 and the total number M2 may be made the same by intercepting part of the data, and then the correlation or similarity of the first dimensionality reduction sequence and the second dimensionality reduction sequence is calculated using other algorithms in the prior art. For example, if there are 5 data in the first dimensionality reduction sequence and 6 data in the second dimensionality reduction sequence, the last data in the second dimensionality reduction sequence is removed so that the total number of data in the second dimensionality reduction sequence is 5.
[0091] So far, the abnormal index, the first dimension reduction sequence, the second dimension reduction sequence and the DTW value of each spinning width sequence corresponding to the first horizontal straight line and the second horizontal straight line are obtained.
[0092] S3: Calculating the yarn abnormality coefficient based on the abnormality index and the first irrelevant index.
[0093] Preferably, in one embodiment, the expression of the yarn abnormality coefficient is:
[0094] , where: G is the yarn anomaly coefficient, a is the value of negative correlation normalization of the DTW values of the first and second grayscale images, recorded as the correlation index; k is the maximum value of the anomaly index of all spinning width sequences corresponding to the first horizontal straight line and the second horizontal straight line.
[0095] In one embodiment, the expression of the relevant index a is:
[0096] , is the DTW value of the first and second grayscale images, is a natural exponential function.
[0097] The instructions are as follows:
[0098] The yarn abnormality coefficient represents the abnormality degree of the yarn, or in other words, the possibility of yarn defects.
[0099] It can be understood that the larger the maximum value k of the abnormality index is, the greater the possibility that the abnormality of spinning is, or the greater the possibility that there is a defect in spinning. The reason is that if there is a defect in a certain part of spinning, it can be considered that there is a defect in spinning. At this time, there may be certain problems with the machine producing the yarn, and the machine and the production process should be checked.
[0100] The larger the value, the smaller the correlation between the first dimensionality reduction sequence and the second dimensionality reduction sequence. sequence and second The smaller the correlation of the sequence, the greater the possibility that the yarn is less abnormal, or in other words, the smaller the possibility that the yarn has defects. The explanation is as follows:
[0101] When the yarn is normal: at the moment corresponding to the first grayscale image, due to the influence of spinning shaking, the abnormal index of the part of the spinning width sequence corresponding to the spinning may be large. Because shaking may cause two spinnings to be superimposed together, so that the two spinnings are displayed as one spinning in the image, the width of the superimposed spinning may be large, and then the abnormal index of the corresponding spinning width sequence may be large. At the moment corresponding to the second grayscale image, it is more likely that the above-mentioned two superimposed spinnings will separate, and then the abnormal index of the corresponding spinning width sequence is smaller. In short, when the yarn is normal, the possibility that the abnormal indexes of the spinning width sequence P1 and the spinning width sequence P2 are both large is low, and the possibility that the absolute value of the difference between the abnormal indexes of the spinning width sequence P1 and the spinning width sequence P2 is large is greater. Among them, the spinning width sequence P1 is a spinning width sequence corresponding to the first horizontal straight line, and the spinning width sequence P2 is a spinning width sequence corresponding to the second horizontal straight line.
[0102] When there are defects in the yarn: at the moment corresponding to the first grayscale image, due to the influence of spinning adhesion, the abnormal index of the spinning width sequence P3 is large; at the moment corresponding to the second grayscale image, the abnormal index of the spinning width sequence P4 is still large. It is more likely that the difference between the abnormal indexes of the spinning width sequence P3 and the spinning width sequence P4 is small. This is because the possibility of multiple spinnings separating after adhesion is low. Among them, the spinning width sequence P3 is another spinning width sequence corresponding to the first horizontal straight line, and the spinning width sequence P4 is another spinning width sequence corresponding to the second horizontal straight line.
[0103] therefore, The larger it is, the less likely the yarn is to have defects. When it is larger, it is more likely that the larger abnormal indicator among the abnormal indicators of the spinning width sequence is caused by spinning shaking, and it is more likely that the absolute value of the difference between the abnormal indicators of the spinning width sequence Y1 is larger, and the spinning width sequence Y1 refers to the same spinning part; it is less likely that the larger abnormal indicator among the abnormal indicators of the spinning width sequence is caused by spinning adhesion.
[0104] It is understandable that: The smaller, The larger the When is small and k is large, it means that there is a high possibility that the yarn has defects, which are caused by abnormalities such as spinning adhesion.
[0105] It should be noted that: Not more than 1. When there are defects in the yarn, is smaller and k is larger. When the yarn is affected by shaking, Larger.
[0106] There are four situations in total. First: Larger and k is larger; Second: Smaller and k is smaller; Third: is larger and k is smaller; Fourth: Smaller and k larger. It is easy to know that the first case corresponds to the largest yarn abnormality coefficient, and the first case corresponds to defects caused by abnormalities such as yarn adhesion. If the yarn is normal and k is larger, the reason for the larger k is spinning shaking, which further explains Larger.
[0107] Further explanation: when k is large: the first case is that the yarn has defects. In the second case, the yarn is normal, so it can be inferred that the reason why k is larger is the spinning shake, which explains Therefore, when k is large and When it is smaller, there is a greater possibility that the yarn is defective.
[0108] S4: Based on the yarn abnormality coefficient and the preset threshold, determine whether the yarn has defects.
[0109] In response to the yarn abnormality coefficient being greater than the preset threshold, the yarn is considered to be defective. Otherwise, the yarn is not considered to be defective. The implementer may set the preset threshold according to the specific scenario. The preset threshold may be an empirical value of 0.55.
[0110] A brief summary of the above solutions:
[0111] Acquire at least two frames of spinning grayscale images; calculate the yarn abnormality coefficient G, , a is the normalized value of the negative correlation of the DTW value, and k is the maximum value of the abnormal index of all spinning width sequences; if the yarn abnormality coefficient is greater than the preset threshold, it is considered that the yarn is defective.
[0112] The process of obtaining abnormal indicators and DTW values includes:
[0113] Peak point detection is performed on a one-dimensional sequence of gray values on a horizontal straight line of the gray image to obtain the width distance between the pixels corresponding to the first peak point and the last peak point, and also obtain the spinning width sequence, which includes the gray data of the corresponding spinning area; the abnormal index of the t-th spinning width sequence It is positively correlated with the difference A1, which is the difference between the total number of gray values in the t-th spinning width sequence and the standard value; calculate the corresponding , is the ratio of distance B1 to width distance, where distance B1 is the distance between the position corresponding to the t-th spinning width sequence and the pixel point of the first peak point; and then the corresponding values of all spinning width sequences are obtained. sequence.
[0114] The first grayscale image corresponds to the first horizontal straight line, the first sequence and the first dimension reduction sequence; the second grayscale image corresponds to the second horizontal straight line, the second sequence and the second reduced dimensionality sequence; the reduced dimensionality sequence is the first sequence and second The sequence after all data in the sequence are reduced in dimension; the DTW value is obtained by using the DTW algorithm on the first and second reduced dimensionality sequences; the distance between the first and second horizontal straight lines is the distance of the pixel point movement caused by the spinning movement within the time corresponding to the first and second grayscale images.
[0115] The above-described embodiments are intended to be exemplary only.
[0116] In another embodiment: at least three frames of spinning grayscale images are obtained. The third grayscale image is the grayscale image of the next frame of the second grayscale image. According to the above method, the third horizontal straight line corresponding to the third grayscale image and the abnormal index of each spinning width sequence corresponding to the third horizontal straight line can be obtained, and the third dimension reduction sequence corresponding to the third horizontal straight line can also be obtained. And so on. The expression of the yarn abnormality coefficient G is:
[0117] , ,in: It is a related indicator. The explanation is as follows:
[0118] A total of n continuous grayscale images are determined and analyzed. Each grayscale image corresponds to a horizontal line and a dimensionality reduction sequence.
[0119] For any horizontal straight line, determine the maximum value of the abnormal index of the spinning width sequence corresponding to it, and record it as the first maximum value (the first maximum value has the same meaning as the reference index). Traverse all the remaining horizontal straight lines to obtain the first maximum value corresponding to each remaining horizontal straight line. is the average of all first maximum values.
[0120] For any two adjacent grayscale images, calculate the DTW value between the dimensionality reduction sequences corresponding to the horizontal straight lines corresponding to any two adjacent grayscale images, and record it as the first DTW value. Traverse all the remaining two adjacent grayscale images to obtain the first DTW value corresponding to each of the remaining two adjacent grayscale images. is the mean of all first DTW values.
[0121] In one embodiment, the expression of the yarn abnormality coefficient G is:
[0122] ,in: It is the maximum value of all abnormal indicators corresponding to all horizontal lines.
[0123] It can be understood that the position of the first horizontal straight line in the first grayscale image corresponds to a yarn abnormality coefficient. Different positions may correspond to different yarn abnormality coefficients, that is, horizontal straight lines at different positions in the first grayscale image may correspond to different yarn abnormality coefficients. The reason is that horizontal straight lines at different positions in the first grayscale image correspond to different spinning areas.
[0124] In one embodiment, a horizontal straight line at a position other than the position of the first horizontal straight line in the first grayscale image is identified, which is recorded as a horizontal straight line at position R1, and the horizontal straight line at position R1 corresponds to a yarn abnormality coefficient. The maximum value of the two yarn abnormality coefficients corresponding to the first horizontal straight line and the horizontal straight line at position R1 is determined. In response to the maximum value being greater than a preset threshold, it is considered that the yarn is abnormal. And so on, no further details are given. Based on the horizontal straight lines at multiple positions in the first grayscale image, the corresponding multiple yarn abnormality coefficients can be determined, and the maximum value of the multiple yarn abnormality coefficients is determined. If the maximum value is greater than the preset threshold, it is considered that the yarn is abnormal. In another embodiment, the mean of the multiple yarn abnormality coefficients is determined, and if the mean is greater than the preset threshold, it is considered that the yarn is abnormal.
[0125] For easier understanding, a schematic diagram of spinning is drawn. Figure 6 FIG. 1 is a schematic diagram schematically showing a first grayscale image according to an embodiment of the present invention. Figure 6 As shown, 601 is a first horizontal straight line, 602 is the position of spinning adhesion, and 603 is the position where parts of two spinnings overlap due to spinning shaking. Figure 7 FIG. 2 is a schematic diagram schematically showing a second grayscale image according to an embodiment of the present invention. Figure 7 As shown: 701 is the position corresponding to the first horizontal straight line. It should be noted that the first horizontal straight line is not marked in the second grayscale image. The function of 701 is for easy understanding. 702 is the second horizontal straight line. 703 is the position where the spinning sticks. 703 corresponds to 602, and 704 corresponds to 603. At 603, the two spinnings overlap due to shaking. At the moment corresponding to the second grayscale image, the two spinnings separate again. 704 is the position where the two spinnings separate.
[0126] In the description of this specification, "plurality" or "several" means at least two, such as two, three or more, etc., unless otherwise clearly and specifically defined.
[0127] As used herein, the term "or" is intended to mean an inclusive "or" rather than an exclusive "or." Additionally, the articles "a" and "an" as used in this application and the appended claims are generally understood to mean "one or more" unless specified otherwise or clear from context to be directed to a singular form.
[0128] Where the terms "includes," "having," "having," "having," or variations thereof are used in the detailed description or claims, such terms are intended to be inclusive in a manner similar to the term "comprising."
[0129] Although this specification has shown and described a number of embodiments of the present invention, it will be apparent to those skilled in the art that such embodiments are provided by way of example only. Those skilled in the art will conceive of many modifications, changes and alternatives without departing from the ideas and spirit of the present invention. It should be understood that in the practice of the present invention, various alternatives to the embodiments of the present invention described herein may be employed.
Claims
1. A method for detecting environmentally friendly yarn defects, characterized in that: include: Acquire at least three frames of spinning grayscale images; The first irrelevant index corresponding to the same reference area in any two adjacent frames of images is calculated, and the maximum value of the abnormal index of the spinning width sequence of any frame of grayscale image is determined and recorded as the reference index; the same reference area refers to the row area of spinning at the same horizontal position, and the spinning is arranged vertically; wherein the abnormal index and the first irrelevant index of any spinning width sequence are obtained by: Peak point detection is performed on a row of grayscale sequences in the same reference area of any grayscale image to obtain all peak points, and then all spinning width sequences, the width distances of the first and last peak points are obtained, wherein the total number of grayscale values in any spinning width sequence represents the width of the corresponding spinning, and the spinning width sequence is composed of the pixel grayscale values between the odd peak point and its next peak point and the pixel points corresponding to these two peak points, and the peak point is the grayscale value; the abnormal index is positively correlated with the first difference, and the first difference is the absolute difference between the total number of grayscale values in the spinning width sequence and the standard value, and the standard value is the normal spinning width. The total number of gray values in the spinning width sequence corresponding to the silk; calculating the two-dimensional data of the spinning width sequence, the two-dimensional data consists of a first distance and an abnormal index, the first distance is the distance between the pixel point corresponding to the gray value at the center of each spinning width sequence and the pixel point of the first peak point; all two-dimensional data form a two-dimensional sequence; the data in the two-dimensional sequence of all gray images are reduced in dimension to obtain a reduced dimension sequence corresponding to each gray image; using the DTW algorithm to calculate the DTW distance of the reduced dimension sequence of any two adjacent frames of gray images, recorded as the first irrelevant index; obtaining the first irrelevant index of each two adjacent frames of gray images; Performing negative correlation normalization on the means of all the first irrelevant indicators to obtain a relevant indicator, taking the product of the relevant indicator and the means of all the reference indicators as a yarn abnormality coefficient, and in response to the yarn abnormality coefficient being greater than a preset threshold, considering that the yarn is defective; Abnormal indicator expression: ,in, is the abnormal index of the t-th spinning width sequence, is the total number of all gray values contained in the t-th spinning width sequence, Called the standard value.
2. The method for detecting environmentally friendly yarn defects according to claim 1, characterized in that: The means of all the first irrelevant indicators are negatively normalized to obtain relevant indicators, including: The expression of the relevant indicator is: ,in, For related indicators, is the mean of all first irrelevant indices, is a natural exponential function.
3. The method for detecting environmentally friendly yarn defects according to claim 1, characterized in that: The data in the two-dimensional sequence of all grayscale images are reduced in dimension to obtain the reduced-dimensional sequence corresponding to each grayscale image, including: The PCA algorithm is used to reduce the dimension of the data in the two-dimensional sequence of all grayscale images to obtain the reduced dimension sequence corresponding to each grayscale image.
