Quality detection method of cashmere product
The method improves wool quality detection by segmenting images into superpixels, calculating similarity, merging blocks with low differentiation, and using a trained model to enhance accuracy.
Patent Information
- Application Number
- CN202510612129.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-13
- Publication Date
- 2025-07-15
- Estimated Expiration
- 2045-05-13
AI Technical Summary
In the prior art, the quality detection accuracy of cashmere products is low, and it is difficult to effectively identify cashmere products with diverse texture characteristics, resulting in a high misjudgment rate.
By superpixel segmenting the grayscale images of cashmere products, combining pixel blocks with high similarity, and using a pre-trained cashmere quality detection model for detection, combining shape and grayscale feature similarity to reduce the impact of fiber oversegmentation.
It improves the accuracy of cashmere product quality inspection, reduces misjudgment, and ensures the integrity of cashmere fiber characteristics and the accuracy of detection.
Smart Images

Figure CN120318215A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of image data processing, and particularly relates to a method for quality inspection of cashmere products. Background Art
[0002] Cashmere is a layer of fine hair growing on the outer cortex of goats. Due to its good warmth retention and soft handfeel, cashmere is commonly used to make cashmere sweaters, cashmere coats, cashmere shirts, cashmere pants, cashmere scarves, cashmere shawls, cashmere gloves, and cashmere hats, etc.
[0003] In order to realize the quality inspection of textiles including cashmere products, in related technologies, for example, in the Chinese patent application document with the publication number CN111784691A, a method for detecting textile defects is provided, including: obtaining the texture feature data of the fabric in the surface image of the defective textile; obtaining the texture feature data of the fabric in the surface image of the qualified textile; a first detection camera takes pictures of the surface of the produced textile. If the threshold of the texture feature data of the captured image is not greater than the threshold of the texture feature data of the qualified product image, the product is determined to be a qualified product; if the threshold of the texture feature data of the captured image is greater than the threshold of the texture feature data of the qualified product image, a second detection camera is activated to take pictures of the surface of the produced textile again, and the image captured by the second camera is compared with the threshold of the texture feature data of the defective product again. If the comparison result shows that it is not greater than the threshold of the texture feature data of the defective product, the product is determined to be a defective product.
[0004] When conducting quality inspection on cashmere products, the texture features existing on the surface of cashmere products may be relatively diverse. Comparing the texture features of the product to be inspected with those of the qualified product, or comparing the texture features of the product to be inspected with those of the defective product, it is difficult to effectively detect the quality of cashmere products, and the accuracy rate of quality inspection for cashmere products is relatively low. Summary of the Invention
[0005] To overcome the problem of low accuracy in quality inspection of cashmere products in related technologies, the present application provides a quality inspection method for cashmere products, including: obtaining a first grayscale image of the surface of the cashmere product to be inspected, and performing superpixel segmentation on the first grayscale image to obtain a plurality of pixel blocks; determining the shape similarity between the first pixel block and the second pixel block, and determining the grayscale feature similarity between the first pixel block and the second pixel block; the first pixel block and the second pixel block are adjacent pixel blocks among the plurality of pixel blocks; determining a first distance between the first pixel block and the second pixel block, and determining a target parameter value between the first pixel block and the second pixel block according to the first distance, the shape similarity, and the grayscale feature similarity, where the target parameter value is used to characterize the probability that the first pixel block and the second pixel block belong to different cashmere fibers; in the case where the target parameter value is less than a preset parameter threshold, merging the first pixel block and the second pixel block into the same pixel block to obtain a second grayscale image after pixel block merging; inputting the second grayscale image into a pre-trained cashmere quality inspection model to obtain the quality inspection result of the second grayscale image output by the cashmere quality inspection model.
[0006] In this way, a first grayscale image of the surface of the cashmere product to be inspected is subjected to superpixel segmentation to obtain a plurality of pixel blocks, and two adjacent pixel blocks with a probability of belonging to different cashmere fibers less than a preset parameter threshold are merged into the same pixel block to obtain a second grayscale image after the pixel block merging operation. The characteristics of cashmere fibers can be better reflected in the second grayscale image. Therefore, a more accurate quality inspection result for the cashmere product to be inspected can be obtained by using the second grayscale image.
[0007] Optionally, the performing superpixel segmentation on the first grayscale image to obtain a plurality of pixel blocks includes: determining a texture feature value of a target pixel point in the first grayscale image, where the texture feature value is determined according to the LBP values of the pixel points in the neighborhood range of the target pixel point; performing superpixel segmentation on the first grayscale image according to the texture feature values of the pixel points in the first grayscale image to obtain a plurality of pixel blocks.
[0008] In this way, since the LBP value has rotational invariance and grayscale invariance, the texture feature value obtained by using the LBP value can better characterize the texture feature of the target pixel point.
[0009] Optionally, the texture feature value of the target pixel point is determined by the following method: ; where represents the texture feature value of the target pixel point, represents the LBP value of the i-th pixel point in the neighborhood range of the target pixel point, B represents the mean value of the LBP values of the pixel points in the neighborhood range, n represents the number of pixel points in the neighborhood range, Represents the maximum value of the LBP values of the pixel points within the neighborhood range, Represents the minimum value of the LBP values of the pixel points within the neighborhood range.
[0010] In this way, the LBP values within the neighborhood range of the target pixel point in the image can reflect a higher degree of texture complexity of the area where the target pixel is located. Therefore, the texture feature value of the target pixel point can better describe the texture of the target pixel point.
[0011] Optionally, performing superpixel segmentation on the first grayscale image according to the texture feature values of the pixel points in the first grayscale image to obtain a plurality of pixel blocks, including: performing superpixel segmentation on the first grayscale image according to the texture feature values of the pixel points in the first grayscale image and the distances between the pixel points to obtain a plurality of pixel blocks; a plurality of pixel points that are adjacent to each other and have similar texture feature values are included in the same pixel block.
[0012] Optionally, determining the shape similarity between the first pixel block and the second pixel block includes: , where P is the shape similarity between the first pixel block and the second pixel block, exp is the exponential function with the natural constant as the base, is the distance between the a-th edge pixel point in the first pixel block and the seed point of the first pixel block, is the number of edge pixel points in the first pixel block, is the distance between the b-th edge pixel point in the second pixel block and the seed point of the second pixel block, is the number of edge pixel points in the second pixel block, is the absolute value operation.
[0013] Optionally, determining the gray-scale feature similarity between the first pixel block and the second pixel block includes: , where Q is the gray-scale feature similarity between the first pixel block and the second pixel block, exp is the exponential function with the natural constant as the base, is the gray value of the d-th boundary pixel point in the first pixel block, is the number of boundary pixel points in the first pixel block, is the gray value of the e-th boundary pixel point in the second pixel block, is the number of boundary pixel points in the second pixel block, is the absolute value operation.
[0014] In this way, through the gray-scale feature similarity between the first pixel block and the pixel blocks, over-segmentation of the cashmere fibers in the first grayscale image can be avoided.
[0015] Optionally, the determining the target parameter value between the first pixel block and the second pixel block according to the first distance, shape similarity, and gray-scale feature similarity includes: ; where S is the target parameter value between the first pixel block and the second pixel block, D is the first distance between the first pixel block and the second pixel block, exp is the exponential function with the natural constant as the base, P is the shape similarity between the first pixel block and the second pixel block, and Q is the gray - level feature similarity between the first pixel block and the second pixel block.
[0016] Optionally, the cashmere quality detection model is obtained in the following manner: obtaining a training sample set and a test set corresponding to the training sample set, where the training sample set includes grayscale images of the surface of cashmere products, and the test set includes quality detection results obtained by pre - performing quality detection on the grayscale images of the surface of cashmere products; using the training sample set and the test set to train a pre - constructed initial quality detection model to obtain a trained cashmere quality detection model.
[0017] In this way, by training the pre - constructed initial quality detection model to obtain a cashmere quality detection model, the quality detection of the cashmere product to be detected can be realized through the pre - deployed cashmere quality detection model, reducing the labor intensity of subsequent quality detection of the cashmere product to be detected.
[0018] Optionally, the method further includes: when the quality detection result indicates that the quality of the cashmere product to be detected is unqualified, prompting that the quality of the cashmere product to be detected is unqualified.
[0019] Optionally, the method further includes: when the quality detection result indicates that the quality of the cashmere product to be detected is qualified, prompting that the quality of the cashmere product to be detected is qualified.
[0020] The technical solution provided by the embodiments of the present application may include the following beneficial effects: performing super - pixel segmentation on the first grayscale image of the surface of the cashmere product to be detected to obtain a plurality of pixel blocks, determining the target parameter value between the first pixel block and the second pixel block among the plurality of pixel blocks, where the target parameter value is used to characterize the probability that the first pixel block and the second pixel block belong to different cashmere fibers. When the target parameter value is less than the preset parameter threshold, the first pixel block and the second pixel block can be merged into the same pixel block to obtain a second grayscale image, in which the characteristics of cashmere fibers can be better reflected. Inputting the second grayscale image into the pre - trained cashmere quality detection model can obtain a more accurate quality detection result for the cashmere product to be detected.
[0021] At the same time, compared with directly comparing the texture features of the cashmere image with the pre - set texture feature threshold, since the pre - trained cashmere quality detection model can learn the texture features of cashmere in a more complex scenario, it can better realize the detection of cashmere quality to obtain a more accurate quality detection result for cashmere products.
[0022] It should be understood that the above general description and the following detailed description are only exemplary and explanatory, and do not limit this application. Brief Description of the Drawings
[0023] Figure 1 is a flowchart of a method for detecting the quality of a cashmere product shown according to an exemplary embodiment. Detailed Embodiments
[0024] First, a simple introduction to the application scenario of the embodiments of this application is given. In the application scenario of this application, for the convenience of realizing the automatic detection of cashmere products, an image acquisition device can be used to acquire the surface image of a cashmere product, and the texture features of the surface image of the cashmere product are compared with a preset texture feature threshold. However, the texture features of cashmere products may be relatively diverse, and it is difficult to achieve relatively accurate quality detection of cashmere products through the preset texture feature threshold, and the accuracy rate of quality detection of cashmere products is relatively low.
[0025] For example, due to the relatively diverse texture features of cashmere products, when using the preset texture feature threshold to detect the quality of cashmere products, a cashmere product without defects may be misjudged as a cashmere product with defects, resulting in waste of cashmere products; or, a cashmere product with defects may be misjudged as a cashmere product without defects.
[0026] In view of the above technical problems, the embodiments of this application provide a method for detecting the quality of a cashmere product. Superpixel segmentation is performed on the first grayscale image of the surface of the cashmere product to be detected to obtain a plurality of pixel blocks, and the target parameter value between the first pixel block and the second pixel block among the plurality of pixel blocks is determined. The target parameter value is used to characterize the probability that the first pixel block and the second pixel block belong to different cashmere fibers. When the target parameter value is less than the preset parameter threshold, the first pixel block and the second pixel block can be merged into the same pixel block to obtain a second grayscale image, in which the characteristics of cashmere fibers can be better reflected. When the second grayscale image is input into a pre-trained cashmere quality detection model, a more accurate quality detection result for the cashmere product to be detected can be obtained.
[0027] At the same time, compared with directly comparing the texture features of the cashmere image with the preset texture feature threshold, since the pre-trained cashmere quality detection model can learn the texture features of cashmere in a more complex scenario, it can better realize the detection of cashmere quality to obtain a more accurate quality detection result for cashmere products.
[0028] Figure 1The flowchart shows a method for quality inspection of cashmere products according to an exemplary embodiment, which can be applied to quality inspection equipment for cashmere products, such as Figure 1 shown. The method includes the following steps.
[0029] In step S101, a first grayscale image of the surface of the cashmere product to be inspected is obtained, and the first grayscale image is subjected to superpixel segmentation to obtain a plurality of pixel blocks.
[0030] For example, an image acquisition device can be set near the production line of cashmere products, and the grayscale image of the surface of the cashmere product during the production process is obtained through the image acquisition device, so as to realize the quality inspection of the cashmere product during the production process; for another example, the grayscale image of the surface of the cashmere product after production is also collected through the image acquisition device, so as to realize the quality inspection of the cashmere product after production. For example, sampling inspection or full inspection of cashmere products can be realized.
[0031] By performing superpixel segmentation on the image, the image can be divided into a plurality of pixel blocks; a plurality of pixel points similar in features such as color, texture, and brightness are included in the same pixel block, and the divided pixel blocks can be called superpixels.
[0032] When performing superpixel segmentation on the image, multiple seed points can usually be preset in the image, and according to the similarity degree of non-seed points and seed points in the image in features such as color, texture, and brightness, the division of non-seed points in the image is realized to obtain the pixel block corresponding to the seed point, that is, to determine the superpixel corresponding to the seed point and realize the superpixel division of the image.
[0033] Among them, algorithms such as the SLIC (Simple Linear Iterative Clustering) algorithm, SEEDS algorithm, and K-means clustering algorithm can be used to realize the superpixel segmentation of the image and obtain a plurality of pixel blocks in the image after superpixel segmentation.
[0034] By performing superpixel segmentation on the first grayscale image to obtain a plurality of pixel blocks, it is convenient to process the pixel blocks individually, and through superpixel segmentation, it is convenient for the obtained pixel blocks to correspond to cashmere fibers.
[0035] In step S102, the shape similarity between the first pixel block and the second pixel block is determined, and the grayscale feature similarity between the first pixel block and the second pixel block is determined.
[0036] The first pixel block and the second pixel block are adjacent pixel blocks among multiple pixel blocks. Among them, the first pixel block and the second pixel block may respectively correspond to two different cashmere fibers; or, after superpixel segmentation of the first grayscale image, there may be an over-segmentation situation among the obtained multiple pixel blocks, such that the same cashmere fiber is segmented into different pixel blocks, forming the first pixel block and the second pixel block.
[0037] In the case of superpixel segmenting a complete cashmere fiber into multiple segments of cashmere fibers, it may misjudge a originally qualified cashmere fiber product as an unqualified one, affecting the accuracy of the quality inspection of cashmere products. Therefore, the shape similarity between the first pixel block and the second pixel block can be determined, and the gray-level feature similarity between the first pixel block and the second pixel block can be determined, so as to determine whether the first pixel block and the second pixel block are the results of over-segmenting the same cashmere fiber.
[0038] In one embodiment, determining the shape similarity between the first pixel block and the second pixel block includes: , where P is the shape similarity between the first pixel block and the second pixel block, exp is the exponential function with the natural constant as the base, is the distance from the a-th edge pixel point in the first pixel block to the seed point of the first pixel block, is the number of edge pixel points in the first pixel block, is the distance from the b-th edge pixel point in the second pixel block to the seed point of the second pixel block, is the number of edge pixel points in the second pixel block, is the absolute value operation.
[0039] The superpixel segmentation of the image is carried out according to the seed points. The pixel blocks obtained after superpixel segmentation are the pixel regions where the seed points are located. According to the distance from the edge pixel points of the pixel block to the seed point of the pixel block, it may reflect the shape characteristics of the pixel block. Therefore, according to the similarity degree of the distances from the respective edge pixel points of the two pixel blocks to the respective seed points of the pixel blocks, the similarity degree of the two pixel blocks in shape characteristics can be characterized.
[0040] The more similar the first pixel block and the second pixel block are in shape characteristics, for example, the more similar the first pixel block and the second pixel block are in shape and size, the greater the shape similarity between the first pixel block and the second pixel block; on the contrary, the lower the similarity degree of the first pixel block and the second pixel block in shape and size, the smaller the shape similarity between the first pixel block and the second pixel block; by determining the shape similarity between the first pixel block and the second pixel block, it helps to determine whether to merge the regions of the first pixel block and the second pixel block subsequently to obtain a more accurate quality inspection result.
[0041] In one embodiment, determining the grayscale feature similarity between a first pixel block and a second pixel block includes: where Q is the grayscale feature similarity between the first pixel block and the second pixel block, exp is the exponential function with the natural constant as the base, is the grayscale value of the d-th boundary pixel point in the first pixel block, is the number of boundary pixel points in the first pixel block, is the grayscale value of the e-th boundary pixel point in the second pixel block, is the number of boundary pixel points in the second pixel block, is the absolute value operation.
[0042] When performing superpixel segmentation on the first grayscale image, the superpixel segmentation is non - based on seed points. Since the preset seed points may be adjacent to each other, it is possible to divide the same pixel region with similar grayscale features in the first grayscale image into two or more pixel blocks. For example, the same cashmere fiber may be divided into multiple segments of different cashmere fibers, affecting the quality assessment result of cashmere products.
[0043] The boundary pixel points in a pixel block are the pixel points located at the boundary of the pixel block, and the non - boundary pixel points in a pixel block are the other pixel points within the boundary pixel points in the pixel block; the grayscale feature similarity between the first pixel block and the second pixel block can characterize the similarity degree of the grayscale features of the boundary pixel points in the first pixel block and the boundary pixel points in the second pixel block.
[0044] Since the same cashmere fiber has similar characteristics in the local area of the boundary pixel points, therefore, determining the similarity of the grayscale values of the boundary pixel points in two adjacent pixel blocks helps to determine the complete cashmere fiber that is divided into multiple pixel blocks during the superpixel segmentation process.
[0045] In this way, by determining the grayscale feature similarity between the first pixel block and the pixel block, it helps to determine whether there is over - segmentation of the cashmere fiber in the first grayscale image, so as to obtain a more accurate quality detection result for cashmere products.
[0046] In step S103, determine the first distance between the first pixel block and the second pixel block, and determine the target parameter value between the first pixel block and the second pixel block according to the first distance, the shape similarity, and the grayscale feature similarity.
[0047] The target parameter value is used to characterize the probability that the first pixel block and the second pixel block belong to different cashmere fibers.
[0048] In one embodiment, determining the target parameter value between the first pixel block and the second pixel block according to the first distance, shape similarity, and gray feature similarity includes: ; where S is the target parameter value between the first pixel block and the second pixel block, D is the first distance between the first pixel block and the second pixel block, exp is the exponential function with the natural constant as the base, P is the shape similarity between the first pixel block and the second pixel block, and Q is the gray feature similarity between the first pixel block and the second pixel block.
[0049] The first distance between the first pixel block and the second pixel block may refer to the distance between the central pixel point of the first pixel block and the central pixel point of the second pixel block; the greater the first distance between the first pixel block and the second pixel block, the higher the probability that the first pixel block and the second pixel block are located on different cashmere fibers; on the contrary, the smaller the first distance between the first pixel block and the second pixel block, the lower the probability that the first pixel block and the second pixel block are located on different cashmere fibers.
[0050] In this way, determining the target parameter value between the first pixel block and the second pixel block according to the first distance, shape similarity, and gray feature similarity, the obtained target parameter value can better characterize the probability that the first pixel block and the second pixel block belong to different cashmere fibers.
[0051] In step S104, when the target parameter value is less than the preset parameter threshold, the first pixel block and the second pixel block are merged into the same pixel block to obtain the second gray image after pixel block merging.
[0052] The target parameter value is determined according to the first distance, shape similarity, and gray feature similarity. The target parameter value is used to characterize the probability that the first pixel block and the second pixel block belong to different cashmere fibers. The greater the target parameter value between the first pixel block and the second pixel block, the greater the distance between the first pixel block and the second pixel block, or the lower the shape similarity degree between the first pixel block and the second pixel block, or the lower the similarity degree of the gray features between the first pixel block and the second pixel block. Therefore, the probability that the first pixel block and the second pixel block are obtained by dividing different cashmere fibers is higher, or the probability that the first pixel block and the second pixel block are obtained by over-segmenting the same cashmere fiber is lower.
[0053] On the contrary, the smaller the target parameter value between the first pixel block and the second pixel block, the lower the probability that the first pixel block and the second pixel block are obtained by dividing different cashmere fibers, or the higher the probability that the first pixel block and the second pixel block are obtained by over-segmenting the same cashmere fiber.
[0054] In the case where the target parameter value is less than the preset parameter threshold, merging the first pixel block and the second pixel block into the same pixel block can avoid the adverse effect of over-segmenting the same cashmere fiber into different pixel blocks on the quality detection result, so as to obtain a more accurate quality detection result for the cashmere product.
[0055] In the case where the region merging of the first pixel block and the second pixel block is completed, two adjacent pixel blocks can be re-determined from the multiple pixel blocks that have not undergone region merging, such as the third pixel block and the fourth pixel block adjacent to each other.
[0056] Referring to the determination process of the target parameter value between the first pixel block and the second pixel block, the target parameter value between the third pixel block and the fourth pixel block can be determined. In the case where the target parameter value between the third pixel block and the fourth pixel block is less than the preset parameter threshold, the third pixel block and the fourth pixel block are merged into the same pixel block, so as to realize the merging between two adjacent pixel blocks in the multiple pixel blocks of the first grayscale image whose target parameter value is less than the preset parameter threshold, and avoid the influence of over-segmentation that may exist in the superpixel segmentation process on the quality detection result.
[0057] In the case where the target parameter value between any two adjacent pixel blocks in the first grayscale image is greater than or equal to the preset parameter threshold, it indicates that through the merging operation of the pixel blocks in the first grayscale image, all the pixel blocks that actually belong to the same cashmere fiber have been merged into the same pixel block, and the first grayscale image after the pixel block merging operation can be used as the second grayscale image.
[0058] Among them, the value of the preset parameter threshold can be set according to the actual situation. For example, in the case where the numerical range of the target parameter value is between 0 and 1, the preset parameter threshold can be set between 0.1 and 0.25.
[0059] In step S105, the second grayscale image is input into a pre-trained cashmere quality detection model, and the quality detection result of the second grayscale image output by the cashmere quality detection model is obtained.
[0060] The quality of cashmere products is usually affected by parameters such as the integrity of cashmere fibers, the length of cashmere fibers, and the width of cashmere fibers. Inputting the second grayscale image into a pre-trained cashmere quality detection model, compared with directly inputting the first grayscale image on the surface of the cashmere product to be detected into the cashmere quality detection model, the second grayscale image includes the pixel blocks obtained after superpixel segmentation of the first grayscale image. Therefore, it can more conveniently realize the detection of parameters such as the integrity of cashmere fibers, the length of cashmere fibers, and the width of cashmere fibers, so as to obtain the quality detection result of cashmere products.
[0061] Meanwhile, since the second grayscale image is obtained by region merging of adjacent pixel blocks in the first grayscale image where the target parameter value is less than the preset parameter threshold, and the target parameter value can characterize the probability that adjacent pixel blocks belong to different cashmere fibers, therefore, the degree of over-segmentation of cashmere fibers in the second grayscale image is lower, or over-segmentation of cashmere fibers is avoided in the second grayscale image. Inputting the second grayscale image into the cashmere quality detection model can more conveniently detect parameters such as the integrity of cashmere fibers, the length of cashmere fibers, and the width of cashmere fibers, so as to obtain the quality detection result of cashmere products.
[0062] The quality detection result of cashmere products can be a quality score or a quality evaluation grade for cashmere products, and the quality of cashmere products is characterized by the quality score or the quality evaluation grade.
[0063] In one embodiment, it is also possible to prompt that the quality of the cashmere product to be detected is unqualified when the quality detection result characterizes that the quality of the cashmere product to be detected is unqualified.
[0064] For example, when the quality score of the cashmere product to be detected is less than the preset score, or when the quality grade of the cashmere product to be detected is less than the preset grade, the quality detection device of the cashmere product can output prompt information such as audio, light, and text to prompt that there is an abnormality in the quality of the cashmere product.
[0065] Or, when the quality detection result characterizes that the quality of the cashmere product to be detected is unqualified, the quality detection device of the cashmere product can also send a control instruction to the sorting device so that the sorting device can sort out the cashmere products with unqualified quality and avoid the confusion of qualified products and unqualified products.
[0066] In one embodiment, the cashmere quality detection model is obtained in the following manner: obtaining a training sample set and a test set corresponding to the training sample set, where the training sample set includes grayscale images of the surface of cashmere products, and the test set includes quality detection results obtained by pre-performing quality detection on the grayscale images of the surface of cashmere products; using the training sample set and the test set to train a pre-constructed initial quality detection model to obtain a trained cashmere quality detection model.
[0067] For example, it is possible to collect grayscale images of the surface of cashmere products, pre-perform quality detection on the cashmere products to obtain quality detection results, and use the grayscale images of the surface of cashmere products and the corresponding quality detection results of the cashmere products to train a pre-constructed initial quality detection model. When the training process meets the preset conditions, the model obtained by training is used as the cashmere quality detection model.
[0068] Among them, the quality and purity of the cashmere product can be determined by pre-testing the tensile strength and abrasion resistance of the cashmere product, or by observing the morphology, diameter, and surface characteristics of the cashmere fiber through a microscope, etc., to obtain the quality inspection result of pre-quality inspection of the cashmere product.
[0069] In this way, by training the pre-constructed initial quality inspection model, a cashmere quality inspection model can be obtained, which can realize the quality inspection of the cashmere product to be detected through the pre-deployed cashmere quality inspection model, reducing the labor intensity of subsequent quality inspection of the cashmere product to be detected.
[0070] Through the quality inspection method of cashmere products provided by the embodiments of the present application, superpixel segmentation is performed on the first grayscale image of the surface of the cashmere product to be detected to obtain a plurality of pixel blocks, and the target parameter value between the first pixel block and the second pixel block among the plurality of pixel blocks is determined. The target parameter value is used to characterize the probability that the first pixel block and the second pixel block belong to different cashmere fibers. When the target parameter value is less than the preset parameter threshold, the first pixel block and the second pixel block can be merged into the same pixel block to obtain a second grayscale image, in which the characteristics of the cashmere fiber can be better reflected. Inputting the second grayscale image into the pre-trained cashmere quality inspection model can obtain a more accurate quality inspection result for the cashmere product to be detected.
[0071] At the same time, compared with directly comparing the texture features of the cashmere image with the preset texture feature threshold, since the pre-trained cashmere quality inspection model can learn the texture features of cashmere in more complex scenarios, it can better realize the detection of cashmere quality to obtain a more accurate quality inspection result for the cashmere product.
[0072] In one embodiment, performing superpixel segmentation on the first grayscale image to obtain a plurality of pixel blocks includes: determining the texture feature value of the target pixel point in the first grayscale image, where the texture feature value is determined according to the LBP values of the pixel points within the neighborhood range of the target pixel point; performing superpixel segmentation on the first grayscale image according to the texture feature values of the pixel points in the first grayscale image to obtain a plurality of pixel blocks.
[0073] The neighborhood range can be a range formed with the target pixel point as the center. For example, the size of the neighborhood range can be a range such as 5×5 or 7×7, etc.; the LBP (Local Binary Pattern) value is an operator used to describe the local texture features of an image, and the LBP value is determined according to the grayscale values of the pixel point and other pixel points within its neighborhood.
[0074] The calculation steps of the LBP value of the target pixel point in the grayscale image include: comparing the grayscale value of the target pixel point with the grayscale values of other pixel points in the neighborhood. If the grayscale value of another pixel in the neighborhood is greater than or equal to the grayscale value of the target pixel point, mark the position of this other pixel as 1; on the contrary, if the grayscale value of this other pixel point is less than the grayscale value of the target pixel point, mark the position of this other pixel point as 0.
[0075] According to the comparison results of the grayscale value of the target pixel point and the grayscale values of other pixel points in the neighborhood, a binary number can be generated for each pixel in the neighborhood. These binary numbers are arranged in a clockwise or counterclockwise direction to form a binary sequence, and this binary sequence is converted from binary to decimal. The obtained decimal value is the LBP value of the target pixel point.
[0076] For example, if there are 8 other pixel points in the neighborhood of the target pixel point, the comparison results of the grayscale values of the 8 other pixel points in the neighborhood of the target pixel point and the grayscale value of the target pixel point can be [0, 1, 1, 0, 0, 0, 1, 1]. Among them, the first number in the comparison result is 0, indicating that the grayscale value of the first pixel point whose grayscale value is compared with the target pixel point is less than the grayscale value of the target pixel point. The LBP code corresponding to the comparison result is 01100011. Converting 01100011 from binary to decimal gives the value 103, which is the LBP value of the target pixel point.
[0077] Since the LBP value has rotational invariance and grayscale invariance and can better describe the characteristics of the target pixel point, the texture feature value of the target pixel point in the first grayscale image is determined according to the LBP values of the pixel points within the neighborhood range of the target pixel point. Therefore, the obtained texture feature value can better characterize the texture feature of the target pixel point.
[0078] In one embodiment, the texture feature value of the target pixel point is determined in the following manner: ; where represents the texture feature value of the target pixel point, represents the LBP value of the i-th pixel point within the neighborhood range of the target pixel point, B represents the mean value of the LBP values of the pixel points within the neighborhood range, n represents the number of pixel points within the neighborhood range, represents the maximum of the LBP values of the pixel points within the neighborhood range, represents the minimum of the LBP values of the pixel points within the neighborhood range.
[0079] The difference between the maximum LBP value of the pixel points within the neighborhood range of the target pixel point and the minimum LBP value of the pixel points within the neighborhood range can characterize the variation amplitude of the LBP values of the pixel points within the neighborhood range of the target pixel point; by comparing the average value of the LBP values of the pixel points within the neighborhood range with the LBP values of the pixel points within the neighborhood range, the variation frequency of the LBP values of the pixel points within the neighborhood range of the target pixel point can be characterized. Therefore, the texture feature value in the embodiment of the present application can preferably characterize the variation degree of the LBP values of the pixel points within the neighborhood range.
[0080] The greater the variation degree of the LBP values of the pixel points within the neighborhood range of the target pixel point in the image, the higher the texture complexity of the region where the target pixel is located. And due to the rotation invariance and gray-scale invariance of the LBP value of the pixel point, therefore, the texture feature value of the target pixel point can preferably describe the texture of the target pixel point, so as to realize the superpixel segmentation of the first grayscale image and reduce the over-segmentation in the process of superpixel segmentation of the first grayscale image.
[0081] In one embodiment, according to the texture feature values of the pixel points in the first grayscale image, performing superpixel segmentation on the first grayscale image to obtain a plurality of pixel blocks, including: performing superpixel segmentation on the first grayscale image according to the texture feature values of the pixel points in the first grayscale image and the distances between the pixel points to obtain a plurality of pixel blocks; a plurality of pixel points that are adjacent to each other and have similar texture feature values are included in the same pixel block.
[0082] Since the texture feature value of the pixel point can preferably characterize the texture feature of the pixel point compared with the gray-scale value of the pixel point, according to the texture feature values of the pixel points in the first grayscale image, the superpixel segmentation of the first grayscale image can be better realized.
[0083] Those skilled in the art will readily conceive of other embodiments of the present application after considering the specification and the invention disclosed herein. The present application is intended to cover any variations, uses, or adaptations of the present application, which follow the general principles of the present application and include the common general knowledge or conventional technical means in the technical field not disclosed in the present application. The specification and the embodiments are only regarded as exemplary.
[0084] It should be understood that the present application is not limited to the exact structure already described and shown in the drawings, and various modifications and changes can be made without departing from its scope.
Claims
1. A quality inspection method for cashmere products, characterized in that, Including: Obtain a first grayscale image of the surface of the cashmere product to be detected, and perform superpixel segmentation on the first grayscale image to obtain a plurality of pixel blocks; Determine the shape similarity between the first pixel block and the second pixel block, and determine the grayscale feature similarity between the first pixel block and the second pixel block; The first pixel block and the second pixel block are adjacent pixel blocks among the plurality of pixel blocks; Determine the first distance between the first pixel block and the second pixel block, and determine the target parameter value between the first pixel block and the second pixel block according to the first distance, shape similarity, and grayscale feature similarity. The target parameter value is used to characterize the probability that the first pixel block and the second pixel block belong to different cashmere fibers; In the case where the target parameter value is less than the preset parameter threshold, merge the first pixel block and the second pixel block into the same pixel block to obtain a second grayscale image after pixel block merging; Input the second grayscale image into a pre-trained cashmere quality detection model to obtain the quality detection result of the second grayscale image output by the cashmere quality detection model.
2. The quality inspection method of the cashmere product according to claim 1, characterized in that, The performing superpixel segmentation on the first grayscale image to obtain a plurality of pixel blocks includes: Determine the texture feature value of the target pixel point in the first grayscale image, and the texture feature value is determined according to the LBP values of the pixel points within the neighborhood range of the target pixel point; Perform superpixel segmentation on the first grayscale image according to the texture feature values of the pixel points in the first grayscale image to obtain a plurality of pixel blocks.
3. The quality inspection method of the cashmere product according to claim 2, characterized in that, The texture feature value of the target pixel point is determined by the following method: ; wherein, represents the texture feature value of the target pixel point, represents the LBP value of the i-th pixel point within the neighborhood range of the target pixel point, B represents the mean value of the LBP values of the pixel points within the neighborhood range, and n represents the number of pixel points within the neighborhood range, represents the maximum value of the LBP values of the pixel points within the neighborhood range, represents the minimum value of the LBP values of the pixel points within the neighborhood range.
4. The quality inspection method of the cashmere product according to claim 2, characterized in that, Performing superpixel segmentation on the first grayscale image according to the texture feature values of the pixel points in the first grayscale image to obtain a plurality of pixel blocks includes: Perform superpixel segmentation on the first grayscale image according to the texture feature values of the pixel points in the first grayscale image and the distance between the pixel points to obtain a plurality of pixel blocks; a plurality of adjacent pixel points with similar texture feature values are included in the same pixel block.
5. The quality inspection method of the cashmere product according to claim 1, characterized in that, Determine the shape similarity between the first pixel block and the second pixel block, including: , where P is the shape similarity between the first pixel block and the second pixel block, exp is the exponential function with the natural constant as the base, is the distance between the a-th edge pixel point in the first pixel block and the seed point of the first pixel block, is the number of edge pixel points in the first pixel block, is the distance between the b-th edge pixel point in the second pixel block and the seed point of the second pixel block, is the number of edge pixel points in the second pixel block, is the absolute value operation.
6. The quality inspection method for cashmere products according to claim 1, characterized in that, Determine the grayscale feature similarity between the first pixel block and the second pixel block, including: , where Q is the gray feature similarity between the first pixel block and the second pixel block, exp is the exponential function with the natural constant as the base, is the gray value of the d-th boundary pixel point in the first pixel block, is the number of boundary pixel points in the first pixel block, is the gray value of the e-th boundary pixel point in the second pixel block, is the number of boundary pixel points in the second pixel block, is the absolute value operation.
7. The quality inspection method of the cashmere product according to claim 1, characterized in that, The determining the target parameter value between the first pixel block and the second pixel block according to the first distance, shape similarity, and grayscale feature similarity includes: ; where S is the target parameter value between the first pixel block and the second pixel block, D is the first distance between the first pixel block and the second pixel block, exp is the exponential function with the natural constant as the base, P is the shape similarity between the first pixel block and the second pixel block, and Q is the gray-scale feature similarity between the first pixel block and the second pixel block.
8. The quality inspection method of the cashmere product according to claim 1, characterized in that, The cashmere quality detection model is obtained by the following method: Obtain a training sample set and a test set corresponding to the training sample set. The training sample set includes grayscale images of the surface of cashmere products, and the test set includes the quality detection results obtained by pre-performing quality detection on the grayscale images of the surface of cashmere products; Use the training sample set and the test set to train a pre-constructed initial quality detection model to obtain a trained cashmere quality detection model.
9. The quality inspection method of the cashmere product according to claim 1, characterized in that, The method further includes: In the case where the quality detection result indicates that the quality of the cashmere product to be detected is unqualified, prompt that the quality of the cashmere product to be detected is unqualified.
10. The quality inspection method of the cashmere product according to claim 1, characterized in that, The method further includes: In the case where the quality detection result indicates that the quality of the cashmere product to be detected is qualified, prompt that the quality of the cashmere product to be detected is qualified.
Citation Information
Patent Citations
Cloth defect detection method and device
CN111929327A
Textile defect detection method based on machine vision
CN115272321A
Image segmentation method based on superpixel region merging
CN117611620A
Rock debris particle image instance segmentation method under white light condition
CN119027435A
System and Method for Detecting Plant Diseases
US20200320682A1
Cited By
Cashmere product defect detection method based on machine vision
CN122063123A
Machine vision based method for detecting defects in cashmere products
CN122063123B