A fabric hair recognition method based on deformable boundary field
By using a deep learning model based on deformable boundary fields, the problems of blurred hair boundaries and missed detection of small hairs in fabric hair recognition are solved, achieving high-precision hair recognition and quantitative analysis, which is applicable to the quality inspection of textile industry fabrics such as cotton yarn and chemical fibers.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- JIANGNAN UNIV
- Filing Date
- 2026-03-30
- Publication Date
- 2026-06-26
AI Technical Summary
Existing methods for identifying fabric hairs suffer from blurred hair boundaries, easy confusion with the background, and a high rate of missed detection for small-sized hairs, making it difficult to meet the high standards of quality inspection in the textile industry.
A deep learning model based on deformable boundary fields is adopted. Through deformable boundary fields and adaptive boundary enhancement mechanisms, the boundary features of feathers are accurately characterized, improving the distinction between feathers and background and reducing the false negative rate.
It significantly improves the automation and detection accuracy of feather recognition, reduces the missed detection rate of small-sized feathers, adapts to various fabric types, and meets the quality inspection needs of the textile industry.
Smart Images

Figure CN122289776A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to a fabric hair recognition method based on deformable boundary fields, belonging to the fields of textile quality inspection and computer vision technology. Background Technology
[0002] Fabric hairiness refers to the bundles or individual fibers protruding from the yarn body on the fabric surface. Their quantity, length, and distribution directly affect the fabric's appearance, feel, abrasion resistance, and subsequent processing performance. Traditional fabric hairiness detection methods mainly rely on manual visual inspection or simple optical instruments. Manual inspection methods are affected by factors such as the inspector's subjective experience and visual fatigue, resulting in low efficiency, poor accuracy, and inconsistent results, making it difficult to meet the high-efficiency quality inspection requirements of modern textile production. While simple optical instruments improve inspection efficiency to some extent, they are limited by fixed optical parameters and simple image processing algorithms, making them unable to effectively handle complex scenarios such as blurred hairiness boundaries, high similarity between hairiness and fabric texture background, and weak features of small-sized hairiness. This leads to high rates of missed and false detections, making accurate hairiness identification and quantitative analysis difficult.
[0003] With the development of computer vision and deep learning technologies, deep learning-based image segmentation methods have been increasingly applied to the field of fabric feather recognition. Among them, the classic fully convolutional image segmentation network UNet and its improved models, proposed in 2015, have become a popular technical solution for fabric feather recognition due to their excellent feature extraction and boundary localization capabilities in fields such as medical image segmentation. However, existing UNet-based feather recognition methods still have significant shortcomings: on the one hand, fabric feathers have large scale differences, insignificant boundary features, and are easily confused with the texture structure of the fabric itself. The multi-scale feature extraction capability of traditional UNet models is insufficient to accurately depict the subtle features of feather boundaries; on the other hand, existing models lack targeted enhancement mechanisms for feather boundaries, and cannot effectively enhance feather region features and suppress background interference during the decoding process. This results in blurred feather boundaries and the easy omission of small-sized feathers in the segmentation results, making it difficult to meet the high standards of industrial quality inspection in terms of recognition accuracy.
[0004] Therefore, developing an identification method that can accurately characterize the boundary features of feathers and effectively improve the distinction between feathers and background, and solve the technical pain points of high feather false negative rate and blurred boundary segmentation in existing technologies, has become an urgent problem to be solved in the field of textile quality inspection. Summary of the Invention
[0005] To address the technical problems of blurred feather boundaries, easy confusion with the background, and high false negative rate of small-sized feathers in existing fabric feather identification methods, this invention provides a fabric feather identification method based on deformable boundary fields. By designing deformable boundary field characterization and adaptive weighted enhancement mechanism, the method achieves accurate extraction and enhancement of feather features, improves the automation level and detection accuracy of feather identification, and meets the high efficiency and accuracy requirements of textile industry quality inspection.
[0006] A fabric hair recognition method based on deformable boundary fields includes: Step S1: Obtain the image of the hairs to be identified on the surface of the cotton fabric, and crop it proportionally into a non-overlapping sub-image of 256×256 pixels. Step S2: Construct a deep learning model for fabric fuzz recognition based on deformable boundary fields to perform fuzz recognition on sub-images. The deep learning model for fabric fuzz recognition based on deformable boundary fields is constructed by... n 1 encoder and n The system consists of two decoders connected in series. Each encoder contains a paired multi-receptive field feature fusion module. There is a deformable boundary field module between the last encoder and the first decoder. Each decoder contains an adaptive boundary enhancement module. Adjacent coding units are downsampled by a factor of 2, and adjacent decoding units are upsampled by a factor of 2. Optionally, in the deep learning model for fabric hair recognition based on deformable boundary fields, the paired multi-receptive field feature fusion module is equipped with 1×1, 3×3, 5×5, and 7×7 convolutional layers to extract features at different scales. The features extracted by the 1×1 and 7×7 convolutional layers are concatenated and then nonlinearly activated. The features extracted by the 3×3 and 5×5 convolutional layers are concatenated and then nonlinearly activated. After that, the features are concatenated and fused to obtain a fused feature map. The paired multi-receptive-field feature fusion module combines receptive field information of different sizes by splicing features extracted at different scales. The calculation process is as follows:
[0007] in The convolution kernels are 1×1, 3×3, 5×5, and 7×7, respectively. It is the input feature map and the output It is the merged multi-scale feature map. , , , This is a two-dimensional convolution operation function. It is a linear rectified activation function. This is the concatenation function for the channel dimension. This is a function for splicing spatial dimensions.
[0008] Optionally, in the deep learning model for fabric hair recognition based on deformable boundary fields, the deformable boundary field module between the last encoder and the first decoder receives the input feature map. 1×1 convolutional layer generation Channel feature map The Channel feature map The former The channels are offset parameters, corresponding to a 3×3 deformable convolution kernel. Horizontal offset of each sampling point Vertical offset ,and , The value range is [-1, 1], and the original sampling position of the convolution kernel is... Adjust the actual sampling position according to the offset. The formula is adjusted as follows:
[0009] The Channel feature map The The channels are normalized using the sigmoid activation function to obtain boundary strengths with values ranging from [0,1]. The calculation formula is:
[0010] Feature map after deformable convolution The modulated feature map is obtained by the boundary intensity weighted modulation. The modulation formula is:
[0011] in, The enhancement factor has a value range of [0.5, 2.0].
[0012] Optionally, in the deep learning model for fabric feather recognition based on deformable boundary fields, the adaptive boundary enhancement module preloads two sets of fixed-weight 3×3 convolution kernels: horizontal Sobel operators. and the vertical Sobel operator ,Will Perform two-dimensional convolutions with the two operators respectively to obtain the horizontal edge feature maps. and vertical edge feature map ;right and Calculate the Euclidean distance pixel by pixel and fuse them to obtain the edge feature map. Then, a boundary attention weight map is generated through sigmoid activation. Finally, through the formula The feature map is weighted and enhanced to obtain the enhanced feature map. ; This is the enhancement coefficient.
[0013] Optionally, during training, the deep learning model for fabric hair recognition based on deformable boundary fields obtains the predicted segmentation result through forward propagation, and calculates the difference between the predicted result and the true label based on a loss function; the loss function for: in: This represents the total number of pixels in the image. For pixel index, ; For the model in the first The probability value of predicting a feathery region at each pixel; For the first The real label of each pixel; The cross-entropy loss function; For spatial gradient operators; The distance between the predicted result and the true label in the gradient space; For the first The set of neighboring pixels centered at a given pixel; This is the accumulation of the difference between the predicted and the actual distribution within the neighborhood; Let be the loss weight coefficient, and satisfy... .
[0014] Cross-entropy loss function The expression is:
[0015] in It is the natural logarithm.
[0016] Optionally, the feather image recognition in step 2 includes: Step 2.1: Upsample the deep semantic features extracted by the deep learning model encoder, and adjust the boundary intensity field generated by the deformable boundary field module to a scale that matches the upsampled features using bilinear interpolation. Upsampling is achieved through transposed convolutional layers to ensure the integrity of the boundary intensity information after scale adjustment and the accuracy of the upsampled features. Step 2.2: Perform channel splicing and fusion of the upsampled features and the corresponding scale features in the encoder; Step 2.3: Using the scaled boundary intensity field, the fused features are weighted and modulated to enhance the features of the feather boundary region, resulting in a feature map that enhances the response of the feather region. The enhanced feature map is then mapped to a segmentation probability map through a convolutional layer. The segmentation threshold is set to 0.5, and the segmentation probability map is binarized. Pixels with probabilities higher than the threshold are identified as feather regions, and pixels with probabilities lower than the threshold are identified as background regions, resulting in a binarized feather segmentation mask, which is the feather image recognition result of the sub-image.
[0017] Optional, the horizontal Sobel operator in the adaptive boundary enhancement module Sobel operator in the vertical direction for: , .
[0018] Optionally, the offset parameters in the deformable boundary field module are constrained to [-1, 1] by a tanh function or a normalization function.
[0019] Optionally, the deep learning model for fabric hair recognition based on deformable boundary fields is trained using stochastic gradient descent (SGD) or Adam optimization algorithms to iteratively update the model parameters until the model converges.
[0020] The present invention also provides a method for reducing the missed detection rate and false detection rate of fabric hair, the method being implemented based on the above-mentioned fabric hair identification method.
[0021] The beneficial effects of this invention are: This invention introduces a deformable boundary field mechanism, generating a deformable boundary field containing boundary intensity field, horizontal offset field, and vertical offset field based on deep semantic features. This accurately characterizes the spatial location and importance of feather boundaries, effectively solving the technical problems of blurred feather boundaries and low positioning accuracy, and providing precise targeting basis for subsequent feature enhancement. Through an adaptive weighted enhancement strategy in the decoding stage, targeted enhancement of feather region features and effective suppression of background interference are achieved, significantly improving the distinction between feathers and background and greatly reducing the false negative rate of small-sized feathers. The entire process does not rely on manual feature design, has a high degree of automation, and is compatible with various fabric types such as cotton yarn and chemical fibers. The detection efficiency and accuracy are superior to traditional methods, and it can be directly applied to the quality inspection scenario of the textile industry, providing reliable technical support for the quality control of textile products. Attached Figure Description
[0022] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0023] Figure 1 This is an overall flowchart of a fabric hair recognition method based on deformable boundary field proposed in one embodiment of the present invention. Figure 2 This is a flowchart of the neutron image recognition process of the present invention; Figure 3 This is a schematic diagram of a paired multi-receptive field feature fusion module; Figure 4 This is a schematic diagram of a deformable boundary field module; Figure 5 This is a schematic diagram of the adaptive boundary enhancement module; Figure 6 This is a comparison chart of the results of cotton fabric hair identification using the proposed solution and existing solutions. Detailed Implementation
[0024] To make the objectives, technical solutions, and advantages of the present invention clearer, the embodiments of the present invention will be described in further detail below with reference to the accompanying drawings.
[0025] Example 1 This embodiment provides a fabric hair recognition method based on deformable boundary fields. See [link to relevant documentation]. Figure 1 The method includes: Step 1, Image cropping; Obtain an image of the hairs to be identified on the surface of the cotton fabric, and crop the image proportionally into non-overlapping sub-images of size 256×256 pixels. ,in i =1,2,3,…, n This refers to the sequence number of the cropped sub-image. n This represents the total number of sub-images after cropping. Step 2: Construct a deep learning model for fabric hair recognition based on deformable boundary fields to perform hair recognition on sub-images; Construct a deep learning model for fabric fuzz recognition based on deformable boundary fields, for each 256×256 pixel sub-image after cropping. The constructed deep learning model is used for image processing to obtain the feather image recognition result (binarized segmentation mask) of each sub-image.
[0026] like Figure 2 As shown, the constructed deep learning model is composed of n 1 encoder andn The model consists of two decoders cascaded together. Each encoder contains a paired multi-receptive-field feature fusion module, and a deformable boundary field module is located between the last encoder and the first decoder. Each decoder contains an adaptive boundary enhancement module. Adjacent encoding units undergo a 2x downsampling process, and adjacent decoding units undergo a 2x upsampling process. The input-output relationship of the deep learning model satisfies the following expression:
[0027] in, This indicates the corresponding feather segmentation result. This represents a nonlinear mapping function composed of an encoder module, a paired multi-receptive field feature fusion module, a deformable boundary field module, an adaptive boundary enhancement module, and a decoder module. This represents all trainable parameters of the model.
[0028] like Figure 3 As shown, each encoder contains a paired multi-receptive field feature fusion module that combines receptive field information of different sizes by splicing features extracted at different scales. The calculation process is as follows:
[0029] in The convolution kernels are 1×1, 3×3, 5×5, and 7×7, respectively. It is the input feature map and the output It is the merged multi-scale feature map. , , , This is a two-dimensional convolution operation function. It is a linear rectified activation function. This is the concatenation function for the channel dimension. This is a function for splicing spatial dimensions.
[0030] This paired multi-receptive field feature fusion module recombines different receptive field features in the spatial dimension through the aforementioned paired spatial recombination and channel fusion process. Unlike the traditional method of directly splicing multi-scale features in the channel dimension, the module in this application is designed to achieve regionalized expression of multi-scale features through spatial dimension recombination, which enhances the model's ability to characterize the local structural differences of fabric hair and effectively improves the modeling ability of fine-grained boundary structures.
[0031] like Figure 4 As shown, the deformable boundary field module between the last encoder and the first decoder receives the input feature map. , 1×1 convolutional layer generation Channel feature map The Channel feature map The former The channels are offset parameters, corresponding to a 3×3 deformable convolution kernel. Horizontal offset of each sampling point Vertical offset ,and , The value range is [-1, 1], and the original sampling position of the convolution kernel is... Adjust the actual sampling position according to the offset. The formula is adjusted as follows:
[0032] The Channel feature map The The channels are normalized using the sigmoid activation function to obtain boundary strengths with values ranging from [0,1]. The calculation formula is:
[0033] Feature map after deformable convolution The modulated feature map is obtained by the boundary intensity weighted modulation. The modulation formula is:
[0034] in, The enhancement coefficient has a value range of [0.5, 2.0] and can be calibrated experimentally according to the fabric type. Its core function is to adaptively capture the irregular boundary features of fabric hairs through deformable convolution, accurately characterize the spatial position and weight of hair boundaries, and perform targeted feature enhancement on important hair boundary areas. At the same time, it suppresses invalid background features, realizes differentiated enhancement of hair boundary features and background features, and significantly improves the distinguishability between hair features and background features.
[0035] The working process of the adaptive boundary enhancement module is as follows: 1. Pre-set two sets of fixed-weight 3×3 convolution kernels, which are Sobel operators in the horizontal direction. Vertical Sobel operator The operator weight matrix is: , ; 2. Enter them separately to load , The convolutional layers obtain horizontal edge feature maps through two-dimensional convolution operations. Vertical edge feature map The convolution formula is: Where * denotes a two-dimensional convolution operation. Characterization Gradient variation in the horizontal direction of mid-pixel. Characterization Gradient variation in the vertical direction of the middle pixel; 3. To and Calculate the Euclidean distance pixel by pixel to obtain the fused horizontal and vertical edge feature maps. The calculation formula is:
[0036] In this application, the edge feature map is obtained by calculating the Euclidean distance pixel by pixel. This approach preserves the gradient intensity in each direction while avoiding incomplete edge characterization caused by missing features in a single direction. It also outputs continuous values to accommodate subsequent boundary attention mechanisms. Finally, the edge feature map... Input the boundary attention weighted layer, and generate the boundary attention weight map through the sigmoid activation function. The calculation formula is: In the formula The pixel values range from [0,1]; using right Weighted enhancement is performed, and the output feature map is enhanced by boundary calculation. The formula for weighted enhancement is:
[0037] in For boundary enhancement feature maps, This is the feature map after intensity modulation. This is the weight enhancement coefficient, used to adjust the influence of boundary attention weights on feature enhancement, with a value range of [0.5, 2.0]. For boundary attention weights.
[0038] This invention employs an adaptive boundary enhancement module, utilizing multi-directional gradient information extraction and boundary attention weighting mechanisms to adaptively enhance the feather boundary region. This effectively preserves boundary details while suppressing interference from fabric texture background, thereby significantly improving the accuracy and feature discrimination of feather boundary localization, reducing the false negative rate of small-sized feathers, and mitigating the problem of blurred boundaries in the segmentation results. Furthermore, this module uses a fixed edge operator, eliminating the need for additional trainable parameters and improving overall segmentation performance while maintaining a lightweight model.
[0039] The three modules—paired multi-receptive field feature fusion module, deformable boundary field module, and adaptive boundary enhancement module—focus on feather scale differences, feather boundary irregularities, and weak feather edge details, respectively. They employ differentiated enhancement mechanisms to address different pain points, complementing each other without redundancy.
[0040] The specific sub-steps for feather image recognition in step 2 are as follows: Step 2.1: Upsample the deep semantic features extracted by the deep learning model encoder, and adjust the boundary intensity field generated by the deformable boundary field module to a scale that matches the upsampled features using bilinear interpolation. Upsampling is achieved through transposed convolutional layers to ensure the integrity of the boundary intensity information after scale adjustment and the accuracy of the upsampled features. Step 2.2: Perform channel splicing and fusion of the upsampled features and the corresponding scale features in the encoder; Step 2.3: Using the scaled boundary intensity field, the fused features are weighted and modulated to enhance the features of the feather boundary region, resulting in a feature map that enhances the response of the feather region. The enhanced feature map is then mapped to a segmentation probability map through a convolutional layer. The segmentation threshold is set to 0.5, and the segmentation probability map is binarized. Pixels with probabilities higher than the threshold are identified as feather regions, and pixels with probabilities lower than the threshold are identified as background regions, resulting in a binarized feather segmentation mask, which is the feather image recognition result of the sub-image.
[0041] During the training phase of the constructed deep learning model for fabric hair recognition based on deformable boundary fields, a fabric hair image dataset is built, in which each image corresponds to a manually labeled hair segmentation label.
[0042] The training data is input into the deep learning model, and the predicted segmentation result is obtained through forward propagation. The difference between the predicted result and the true label is calculated based on the loss function.
[0043] The deep learning model employs the following combined loss function during training: in: This is the total loss function, used to measure the overall difference between the model's predictions and the actual labels; This represents the total number of pixels in the image. For pixel index, ; For the model in the first The probability value of predicting a feathery region at each pixel; For the first The true label of each pixel (1 for feathers, 0 for background); The cross-entropy loss function is expressed as follows:
[0044] This is the spatial gradient operator, representing the rate of change of an image in space; The distance between the predicted result and the true label in the gradient space; For the first A set of neighboring pixels centered on a pixel (e.g., a 3×3 local region). The accumulation of differences between the predicted and the true distribution within the neighborhood is used to characterize the consistency of local structure; Here, represents the loss weighting coefficient, used to balance the contributions of different loss terms, and satisfies:
[0045] Traditional loss functions only focus on pixel-level classification accuracy or region overlap, ignoring feather boundary details and spatial structure, which easily leads to blurred boundaries and missed detection of small feathers. The combined loss function of this invention adds boundary gradient consistency and local neighborhood structure consistency constraints on the basis of pixel classification constraints. It constrains the pixel change law of feather boundary predicted by the model to match the gradient change of the ground truth feather boundary. At the same time, with a single pixel as the center, it constrains the prediction results of the surrounding local area to be consistent with the distribution of the ground truth, ensuring the continuity and integrity of the local feather morphology. By jointly modeling the feather boundary and spatial structure, it significantly improves the recognition ability of small and weak boundary feathers, making the segmentation results more continuous and accurate.
[0046] The model parameters are iteratively updated using stochastic gradient descent (SGD) or Adam optimization algorithms until the model converges.
[0047] Example 2 This embodiment provides a fabric fuzz recognition method based on deformable boundary fields, and describes it using a specific fabric fuzz image as an example. (See [link to relevant documentation]). Figure 1 The method includes: Step 1, Image cropping; The original image has a pixel size of 1024×1024 pixels. It is then cropped proportionally and without overlap to a fixed size of 256×256 pixels, resulting in 16 cropped sub-images. Where i=1,2,3,…,16 are the sub-image numbers after cropping, and the position information of each sub-image in the original image is recorded to provide a basis for subsequent index summarization.
[0048] Step 2, sub-image feather recognition; For each 256×256 pixel sub-image after cropping The constructed deep learning model is used for image processing to obtain the feather image recognition result (binarized segmentation mask) of each sub-image.
[0049] In this embodiment, taking a deep learning model consisting of 3 encoders and 3 decoders connected in series as an example, downsampling between encoders is achieved through 2x max pooling, and upsampling between decoders is achieved through 2×2 transposed convolution (with a stride of 2). The specific processing procedure is as follows: Step (1), encoder feature extraction and multi-scale fusion: The sub-images are input into the model in 3-channel form and pass through 3 levels of encoders for deep semantic feature extraction. Each encoder consists of 2 layers of 3×3 convolutional layers, batch normalization layers, LeakyReLU activation function, and paired multi-receptive field feature fusion module. The convolutional layers use reflection filling mode to ensure the feature map size and do not set bias terms to improve the stability of feature extraction.
[0050] The paired multi-receptive-field feature fusion module in each encoder stage extracts features using convolutional layers with four different kernels: 1×1, 3×3, 5×5, and 7×7. The features extracted by the 1×1 and 7×7 convolutional layers and the features extracted by the 3×3 and 5×5 convolutional layers are then concatenated and fused in the spatial dimension. This reorganizes the features from different receptive fields in the spatial dimension, and after ReLU activation, they are concatenated and fused in the channel dimension. The fused feature map is then downsampled by 2x max pooling and passed to the next encoder stage. Finally, the third encoder stage outputs a 256-channel deep semantic feature map.
[0051] Step (2), deformable boundary field generation; The 256-channel deep semantic feature map output from the third-level encoder is input into the deformable boundary field module. This module consists of a 1×1 convolutional layer with 19 output channels, mapping the deep semantic features into a 19-channel feature field: the first 18 channels are offset fields, corresponding to the horizontal and vertical offsets of the 9 sampling points of the 3×3 deformable convolutional kernel. The offset values are constrained to [-1, 1], and are used to adjust the sampling position of the convolutional kernel to adapt to the irregular boundaries of the feathers; the 19th channel is normalized by the sigmoid activation function to obtain the boundary intensity field, with a value range of [0, 1]. The value represents the confidence that the corresponding pixel position is a feather boundary, and the closer it is to 1, the higher the probability of it being a feather boundary.
[0052] Step (3), decoder upsampling and feature fusion; First, the deep semantic feature map is upsampled by a 2×2 transposed convolution to increase its scale by a factor of 2, restoring it to a size that matches the output feature map of the second-level encoder. At the same time, the boundary intensity field generated by the deformable boundary field module is adjusted to the same scale as the upsampled feature map using bilinear interpolation, so as to obtain the appropriate intensity weights and ensure the integrity of the boundary intensity information after scale adjustment.
[0053] The upsampled feature map is directly concatenated and fused with the feature map of the corresponding scale in the encoder at the channel dimension. The number of channels in the fused feature map is the sum of the number of channels of the two (256+256=512 channels in this embodiment), realizing the combination of shallow detail features and deep semantic features.
[0054] Step (4), intensity modulation; In this embodiment, an enhancement coefficient is set. =1.0, using the scaled boundary intensity field to perform pixel-wise weighted modulation on the fused feature map, the modulation formula is:
[0055] in This is the feature map after deformable convolution processing. The boundary intensity field after upsampling is modulated to amplify the features of the high-confidence region of the feather boundary and suppress interference from the background region.
[0056] Step (5), adaptive boundary enhancement; Modulated feature map Input adaptive boundary enhancement module: This module preloads two sets of fixed-weight 3×3 convolution kernels (horizontal Sobel operators) Vertical Sobel operator ),Will Perform two-dimensional convolutions with the two operators respectively to obtain the horizontal edge feature maps. and vertical edge feature map ;right and Calculate the Euclidean distance pixel by pixel and fuse them to obtain the edge feature map. Then, a boundary attention weight map is generated through sigmoid activation. In this embodiment, an enhancement coefficient is set. =0.5; finally, through the formula
[0057] Weighted enhancement is applied to the feature map to strengthen its representation ability of feather edge features.
[0058] Step (6), binarize and segment the output; The feature map after adaptive boundary enhancement is input to the convolutional layer of the decoder for feature optimization. Then, a 1×1 convolutional layer maps the feature map into a single-channel segmentation probability map. Each pixel value in the segmentation probability map represents the probability that the location is a feathery region.
[0059] In this embodiment, the segmentation threshold is set to 0.5, and the segmentation probability map is binarized: Pixels with a probability value higher than 0.5 are identified as feather regions and assigned a value of 1; pixels with a probability value lower than 0.5 are identified as background regions and assigned a value of 0. The final result is a binarized feather segmentation mask, which is the feather image recognition result of this sub-image.
[0060] Repeat the above steps of upsampling, feature fusion, intensity modulation, boundary enhancement and binarization segmentation of the decoder to complete the feature processing of each level of the decoder in sequence, and finally output the feather recognition result of the sub-image.
[0061] Step 3, calculate the feather index of the sub-image; Based on the sub-image binarization segmentation mask obtained in step 2, two core parameters are statistically obtained: the number of pixels at the edge of the fabric hair. (Number of edge pixels in the feather region of the segmentation mask), number of pixels in the sub-image along the fabric direction. (In this embodiment) (The pixel size is consistent with the fabric orientation pixel size of the sub-image).
[0062] According to the formula Calculate the feather index for each sub-image This index quantifies the feather distribution and edge feature intensity of a single sub-image.
[0063] Step 4, calculate the feather index of the entire image: Feather index based on the 16 sub-images obtained in step 3 According to the formula The arithmetic mean of the feather indexes of all sub-images is used to obtain the overall feather index of the original cotton fabric feather image. This indicator is the overall quantitative evaluation result of fabric hairiness, completing the hairiness identification and quantitative analysis of the entire fabric image.
[0064] During the model training phase, a fabric fuzz image dataset was constructed, where each image corresponds to a manually labeled fuzz segmentation label. In this embodiment, the fabric fuzz image dataset was collected and constructed independently. 300 images of fabric fuzz in different areas of a sample fabric were taken using an industrial camera. After cropping and removing blurry images, more than 2,500 fabric fuzz images for training were obtained, which were then manually labeled to create the dataset used for training this example model.
[0065] The training data is input into the deep learning model, and the predicted segmentation result is obtained through forward propagation. The difference between the predicted result and the true label is calculated based on the loss function.
[0066] The deep learning model employs the following combined loss function during training: in: This is the total loss function, used to measure the overall difference between the model's predictions and the actual labels; This represents the total number of pixels in the image. For pixel index, ; For the model in the first The probability value of predicting a feathery region at each pixel; For the first The true label of each pixel (1 for feathers, 0 for background); The cross-entropy loss function is expressed as follows:
[0067] This is the spatial gradient operator, representing the rate of change of an image in space; The distance between the predicted result and the true label in the gradient space; For the first A set of neighboring pixels centered on a pixel (e.g., a 3×3 local region). The accumulation of differences between the predicted and the true distribution within the neighborhood is used to characterize the consistency of local structure; Here, represents the loss weighting coefficient, used to balance the contributions of different loss terms, and satisfies:
[0068] The model parameters are iteratively updated using stochastic gradient descent (SGD) or Adam optimization algorithms until the model converges.
[0069] To verify the effectiveness of the method of this invention, the feather recognition results obtained by the method of this invention were compared with the recognition results of the traditional UNet model, the CNN-Transformer hybrid model, and the VDMNet model. The comparison indicators included detection accuracy, F1 score, detection speed, and the number of model parameters. The specific comparison results are shown in Table 1. Here, "UNet model" refers to the model used in the deep learning-based blood vessel image segmentation method provided in Chinese invention patent publication number CN113205537A; "CNN-Transformer hybrid model" refers to the model used in the CNN-Transformer-based feather image segmentation method provided in Chinese invention patent publication number CN119007173A; and "VDMNet model" refers to the model used in the multi-scale large kernel attention decoder and decoding method for medical image segmentation provided in Chinese invention patent publication number CN119762492A.
[0070] Table 1 Comparison of Fabric Hair Image Algorithm Results for Different Models
[0071] In Table 1, segmentation accuracy is used to characterize the degree of overlap between the model segmentation results and the real annotations. It can be seen that the segmentation accuracy of the proposed solution is significantly better than that of the other models. The F1 score is a comprehensive evaluation index that measures the accuracy and completeness of the model's feather segmentation results. The value range is [0,1], and the closer it is to 1, the better the model's segmentation performance. The number of model parameters refers to the total number of all trainable parameters in the deep learning model. It mainly includes parameters that need to be updated through training iterations, such as the weights and bias terms of the convolutional layers. The larger the number of parameters, the stronger the feature fitting ability of the model, but it is prone to overfitting (such as overlearning the fabric texture noise). The smaller the number of parameters, the lighter the model is, and the stronger its generalization ability (adapting to different fabric types such as cotton yarn and chemical fiber). At the same time, the model with a small number of parameters has lower hardware resource requirements and can be directly deployed on embedded equipment or ordinary industrial computers in textile production lines, reducing the implementation cost.
[0072] Figure 6The images show the results of cotton fabric feather recognition using the proposed method, combined with traditional UNet, CNN-Transformer hybrid, and VDMNet models. Image a represents the original image, image b represents the segmentation result of the traditional UNet model, image c represents the segmentation result of the CNN-Transformer hybrid model, image d represents the segmentation result of the VDMNet model, and image e represents the segmentation result of the proposed method. Comparative analysis of the red-boxed areas reveals that traditional UNet and VDMNet models exhibit significant recognition gaps in the feather tip region, failing to fully represent the slender structure of the feathers. Furthermore, comparison of the blue-boxed areas shows that the CNN-Transformer hybrid model lacks responsiveness to fine feathers, exhibiting missed detections for low-salience, small-scale feather features. In contrast, the proposed method demonstrates superior performance in feather boundary delineation and detail preservation, effectively addressing issues such as irregular feather boundaries, weak edge features, and large scale differences, achieving more complete and refined recognition of the feather structure, thus obtaining higher-quality segmentation results.
[0073] Some steps in the embodiments of the present invention can be implemented using software, and the corresponding software program can be stored in a readable storage medium, such as an optical disc or a hard disk.
[0074] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A method for identifying fabric hair based on deformable boundary fields, characterized in that, The method includes: Step S1: Obtain the image of the hairs to be identified on the surface of the cotton fabric, and crop it proportionally into a non-overlapping sub-image of 256×256 pixels. Step S2: Construct a deep learning model for fabric fuzz recognition based on deformable boundary fields to perform fuzz recognition on sub-images. The deep learning model for fabric fuzz recognition based on deformable boundary fields is constructed by... n 1 encoder and n The system consists of two decoders connected in series. Each encoder contains a paired multi-receptive field feature fusion module. There is a deformable boundary field module between the last encoder and the first decoder. Each decoder contains an adaptive boundary enhancement module. Adjacent coding units are downsampled by a factor of 2, and adjacent decoding units are upsampled by a factor of 2.
2. The method according to claim 1, characterized in that, In the deep learning model for fabric hair recognition based on deformable boundary fields, the paired multi-receptive field feature fusion module is equipped with 1×1, 3×3, 5×5, and 7×7 convolutional layers to extract features at different scales. The features extracted by the 1×1 and 7×7 convolutional layers are concatenated and then nonlinearly activated. The features extracted by the 3×3 and 5×5 convolutional layers are concatenated and then nonlinearly activated. After that, the features are concatenated and fused to obtain a fused feature map. The paired multi-receptive-field feature fusion module combines receptive field information of different sizes by splicing features extracted at different scales. The calculation process is as follows: in The convolution kernels are 1×1, 3×3, 5×5, and 7×7, respectively. It is the input feature map and the output It is the merged multi-scale feature map. , , , This is a two-dimensional convolution operation function. It is a linear rectified activation function. This is the concatenation function for the channel dimension. This is a function for splicing spatial dimensions.
3. The method according to claim 2, characterized in that, In the deep learning model for fabric hair recognition based on deformable boundary fields, the deformable boundary field module between the last encoder and the first decoder receives the input feature map. 1×1 convolutional layer generation Channel feature map The Channel feature map The former The channels are offset parameters, corresponding to a 3×3 deformable convolution kernel. Horizontal offset of each sampling point Vertical offset ,and , The value range is [-1, 1], and the original sampling position of the convolution kernel is... Adjust the actual sampling position according to the offset. The formula is adjusted as follows: The Channel feature map The The channels are normalized using the sigmoid activation function to obtain boundary strengths with values ranging from [0,1]. The calculation formula is: Feature map after deformable convolution The modulated feature map is obtained by the boundary intensity weighted modulation. The modulation formula is: in, The enhancement factor has a value range of [0.5, 2.0].
4. The method according to claim 3, characterized in that, In the deep learning model for fabric hair recognition based on deformable boundary fields, the adaptive boundary enhancement module preloads two sets of fixed-weight 3×3 convolution kernels: a horizontal Sobel operator. Sobel operator in the vertical direction ,Will Perform two-dimensional convolutions with the two operators respectively to obtain the horizontal edge feature maps. and vertical edge feature map ;right and Calculate the Euclidean distance pixel by pixel and fuse them to obtain the edge feature map. Then, a boundary attention weight map is generated through sigmoid activation. Finally, through the formula The feature map is weighted and enhanced to obtain the enhanced feature map. ; This is the enhancement coefficient.
5. The method according to claim 4, characterized in that, The deep learning model for fabric hair recognition based on deformable boundary fields obtains predicted segmentation results through forward propagation during training, and calculates the difference between the predicted results and the true labels based on a loss function; the loss function for: in: This represents the total number of pixels in the image. For pixel index, ; For the model in the first The probability value of predicting a feathery region at each pixel; For the first The real label of each pixel; The cross-entropy loss function; For spatial gradient operators; The distance between the predicted result and the true label in the gradient space; For the first The set of neighboring pixels centered at a given pixel; This is the accumulation of the difference between the predicted and the actual distribution within the neighborhood; Let the loss weight coefficients be, and satisfy the following conditions: .
6. The method according to claim 5, characterized in that, Step 2, the feather image recognition, includes: Step 2.1: Upsample the deep semantic features extracted by the deep learning model encoder, and adjust the boundary intensity field generated by the deformable boundary field module to a scale that matches the upsampled features using bilinear interpolation. Upsampling is achieved through transposed convolutional layers to ensure the integrity of the boundary intensity information after scale adjustment and the accuracy of the upsampled features. Step 2.2: Perform channel splicing and fusion of the upsampled features and the corresponding scale features in the encoder; Step 2.3: Using the scaled boundary intensity field, the fused features are weighted and modulated to enhance the features of the feather boundary region, resulting in a feature map that enhances the response of the feather region. The enhanced feature map is then mapped to a segmentation probability map through a convolutional layer. The segmentation threshold is set to 0.5, and the segmentation probability map is binarized. Pixels with probabilities higher than the threshold are identified as feather regions, and pixels with probabilities lower than the threshold are identified as background regions, resulting in a binarized feather segmentation mask, which is the feather image recognition result of the sub-image.
7. The method according to claim 6, characterized in that, Sobel operator in the horizontal direction of the adaptive boundary enhancement module Sobel operator in the vertical direction for: , .
8. The method according to claim 7, characterized in that, In the deformable boundary field module, the offset parameter is constrained to [-1, 1] by the tanh function or normalization function.
9. The method according to claim 8, characterized in that, The deep learning model for fabric hair recognition based on deformable boundary fields is trained using stochastic gradient descent (SGD) or Adam optimization algorithms to iteratively update the model parameters until the model converges.
10. A method for reducing the false negative rate and false positive rate of feather detection, characterized in that, The method is implemented based on the fabric hair identification method according to any one of claims 1-9.
Citation Information
Patent Citations
Blood vessel image segmentation method and device based on deep learning, equipment and medium
CN113205537A
CNN-Transformer-based hairiness detection method
CN119007173A
Multi-scale large-kernel attention decoder and decoding method for medical image segmentation
CN119762492A