A Method and System for Detecting Uneven Thickness of Nylon Filaments Based on Multi-Scale Image Segmentation

By improving the SegNeXt network for multi-scale image segmentation and edge feature correction, the problem of unstable edge response in nylon fiber detection was solved, and accurate detection of uneven nylon fiber thickness was achieved, thus improving the accuracy and consistency of detection.

CN123118632APending Publication Date: 2026-11-17NANTONG JINYU TEXTILE PLASTIC CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611612924.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-10-19
Publication Date
2026-11-17

AI Technical Summary

Technical Problem

Existing technologies are easily affected by factors such as posture deflection, bending vibration, motion blur, and surface reflection when detecting uneven thickness of nylon filaments. This leads to unstable edge response, making it difficult to accurately distinguish between actual thickness changes and spatial posture changes. Furthermore, traditional methods are prone to false alarms due to noise and inaccurate identification of abnormal sections.

Method used

A multi-scale image segmentation method is adopted. The image preprocessing and feature extraction are performed by improving the SegNeXt network. Multi-scale convolution in the axial and normal directions is combined to generate the initial segmentation results and edge features of nylon yarn. The centerline geometric benchmark is established, the spatial distance between the two sides is calculated and the boundary is corrected to generate a continuous yarn diameter sequence and identify thick sections, thin sections and gradual thickness unevenness.

Benefits of technology

It enhances the ability to characterize the continuous structure of slender subjects and local thickness variations, improves the spatial continuity and stability of edge features, reduces the interference of pose changes on detection, and improves the accuracy and consistency of detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123118632A_ABST
    Figure CN123118632A_ABST
Patent Text Reader

Abstract

This invention discloses a method and system for detecting uneven thickness of nylon filaments based on multi-scale image segmentation, relating to the technical field of uneven thickness of nylon filaments. The method includes: generating nylon filament image scale calibration; generating initial segmentation results and initial edge features of the nylon filaments; generating the geometric reference of the nylon filament centerline; generating the distance field of the nylon filament centerline; generating the corrected bilateral boundaries of the nylon filaments; generating a continuous nylon filament diameter sequence; and generating the uneven thickness detection results of the nylon filaments. This invention enhances and improves the SegNeXt network's ability to represent continuous structures, weak edges, and local thickness variations in slender subjects, resulting in more stable spatial continuity for subsequent initial segmentation results and initial edge features.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of nylon yarn thickness unevenness technology, and in particular to a method and system for detecting nylon yarn thickness unevenness based on multi-scale image segmentation. Background Technology

[0002] With the increasing demand for high-speed continuous production and online quality inspection of nylon filament, non-contact inspection of the uniformity of nylon filament thickness using machine vision has become an important technical means. Current technologies typically acquire nylon filament images using industrial cameras and extract the main nylon filament region using grayscale thresholding, edge detection, morphological processing, or deep learning semantic segmentation methods. The filament diameter is estimated based on the edge spacing in the image, and changes in filament diameter are used to identify thick sections and fine quality anomalies. Nylon filament is a long, continuous object, easily affected by factors such as attitude deflection, bending vibration, motion blur, surface reflection, fuzz, and fluctuations in imaging brightness during continuous transport. This leads to unstable grayscale differences and edge responses between the main filament region and the background. Traditional fixed threshold or local edge detection methods are prone to edge breakage, unilateral expansion, and positional drift.

[0003] Existing semantic segmentation methods can improve the ability to identify the main body region, but they usually focus on pixel classification results and lack constraints on the spatial correspondence between the two sides of the nylon yarn, the continuity along the yarn extension direction, and local geometric changes. Local interference can easily be directly converted into yarn diameter measurement error.

[0004] Current methods for detecting yarn diameter typically involve calculating the distance between the two edges along a fixed image direction or using local single-point or segmental average values ​​for judgment. When nylon yarn tilts, bends, or vibrates laterally, the fixed-direction measurement results are easily mixed with apparent width changes caused by posture changes, making it difficult to accurately distinguish between actual thickness changes and spatial posture changes. Anomaly judgments based solely on single-point yarn diameter deviations or fixed thresholds are insufficient to comprehensively characterize the degree of yarn diameter deviation, the trend of change along the extension direction of the nylon yarn, and the continuous range of abnormal segments. This can easily lead to problems such as false alarms due to short-term noise, incorrect merging of adjacent abnormal segments, and inaccurate identification of gradually uneven thickness regions. Summary of the Invention

[0005] One objective of this invention is to propose a method and system for detecting uneven thickness of nylon yarn based on multi-scale image segmentation. This invention enhances the network's ability to represent continuous structures, weak edges, and local thickness variations of slender main bodies, thereby enabling subsequent initial segmentation results and initial edge features to have more stable spatial continuity.

[0006] A method for detecting uneven thickness of nylon filaments based on multi-scale image segmentation according to an embodiment of the present invention includes: Acquire continuous imaging images and perform preprocessing to obtain a standardized image sequence of nylon filament. At the same time, perform scale mapping to generate nylon filament image scale calibration. The normalized image sequence of nylon yarn is input into the improved SegNeXt. After 5×5 depth convolution and axial-normal direction mapping, the fixed strip convolution is converted into orientation-adaptive multi-scale convolution. The axial and normal strip features are fused and decoded to generate the initial segmentation result and initial edge features. Based on the initial segmentation results of the nylon filament, the continuous extension path of the main body region of the nylon filament is determined, and the center position of the continuous extension path is extracted to generate the geometric reference of the center line of the nylon filament. Based on the geometric reference of the nylon filament centerline, the initial boundaries on both sides of the nylon filament are determined at each centerline position along the corresponding local normal direction. The bilateral spatial distance from each centerline position to the initial boundaries on both sides is calculated, and the nylon filament centerline distance field is generated. The geometric consistency of the bilateral boundaries corresponding to each centerline position is determined based on the centerline distance field of the nylon filament. Centerline distance field guidance information is generated based on the geometric consistency of the bilateral boundaries. The centerline distance field guidance information is fused with the initial edge features of the nylon filament to generate the corrected bilateral boundaries of the nylon filament. Based on the geometric reference of the nylon filament centerline and the corrected double-sided boundary of the nylon filament, the actual filament diameter is calculated along the local normal and arranged in the order of the centerline to generate a continuous nylon filament diameter sequence. The normal filament diameter benchmark is determined based on the continuous filament diameter sequence of nylon filament. Thick spots, thin spots, and gradual thickness unevenness are identified by filament diameter deviation, change trend, and continuous length, and test results are generated.

[0007] Optionally, the acquisition of continuous imaging images and preprocessing to obtain a nylon filament standardized image sequence includes: An industrial camera is used to continuously acquire original images containing the nylon filaments to be detected in a continuously conveying state, according to a manually set image acquisition frequency. Based on the location of the detection area, the nylon filament detection area is extracted from the original imaging image, and brightness correction, background suppression and image scale unification are performed on the nylon filament detection area to generate a standardized nylon filament image sequence. Based on a calibration reference set within the imaging field of view of an industrial camera and whose actual size is known, the pixel size corresponding to the calibration reference is determined. According to the correspondence between the actual size and the pixel size, a scale mapping relationship between the image pixel size and the actual spatial size is established to generate the nylon filament image scale calibration.

[0008] Optionally, inputting the nylon filament normalized image sequence into the improved SegNeXt includes: The normalized image sequence of nylon filament is input into the improved SegNeXt and then subjected to a 5×5 depth convolution to generate local spatial features of nylon filament. Based on the local spatial features of nylon filament, the channel features are oriented and mapped to generate the local axial direction and local normal direction of nylon filament. Based on the local axial direction and local normal direction of nylon filament, the fixed strip convolution is converted into direction-adaptive convolution to generate axial strip spatial features and normal strip spatial features. By integrating the spatial features of axial and normal stripes at various scales, superimposing the local spatial features of nylon filaments, and performing a one-to-one pointwise convolution, multi-scale visual features of nylon filaments are generated. The multi-scale visual features of nylon filaments are decoded and fused using an improved SegNeXt method and mapped to the pixel space to generate the initial segmentation result of nylon filaments. Based on the initial segmentation results of nylon filament, pixel-level spatial transition positions are determined, corresponding multi-scale fusion features are extracted, and non-transition position responses are suppressed to generate initial edge features of nylon filament.

[0009] Optionally, determining the continuous extension path of the nylon filament main body region based on the initial nylon filament segmentation result, and extracting the center position of the continuous extension path, includes: Based on the initial segmentation results of the nylon filament, a connectivity analysis is performed on the main region of the nylon filament to determine the continuous extension path of the main region of the nylon filament. The shortest spatial distance from each pixel within the nylon filament body region to the non-nylon filament body region is calculated based on the continuous extension path. The candidate center position is determined based on the shortest spatial distance, and the candidate center positions are smoothed and sequentially associated to generate a continuous nylon filament center position sequence. Based on the continuous center position sequence of nylon filament, the local extension direction of nylon filament corresponding to each continuous center position is determined according to the two-dimensional pixel coordinate changes of adjacent continuous center positions. Based on the local extension direction of the nylon filament, the corresponding local normal direction is determined. The continuous center position sequence of the nylon filament, the local extension direction of the nylon filament, and the local normal direction are spatially correlated to generate the geometric reference of the nylon filament centerline.

[0010] Optionally, the step of determining the initial boundaries on both sides of the nylon filament along the corresponding local normal direction at each centerline position based on the geometric reference of the nylon filament centerline includes: Based on the geometric reference of the nylon filament centerline, a two-way spatial search is performed at each continuous center position along the corresponding local normal direction to determine the initial boundaries on both sides of the nylon filament at each continuous center position. Based on each continuous center position and the corresponding initial boundaries on both sides of the nylon filament, calculate the forward spatial distance and the reverse spatial distance respectively, and generate the bilateral spatial distance corresponding to each continuous center position; Based on the bilateral spatial distances corresponding to each continuous center position, the continuity of bilateral spatial distances between adjacent continuous center positions, the bilateral correspondences corresponding to the same continuous center position, and the axial variation trend of bilateral spatial distances along the continuous extension path are determined respectively. According to the spatial connection order of the continuous extension path, the spatial positions of each continuous center position in the continuous center position sequence of nylon yarn are associated one by one with the spatial distance between the two sides, the continuity of the spatial distance between the two sides, the correspondence between the two sides and the trend of axial change, so as to generate the nylon yarn centerline distance field.

[0011] Optionally, determining the geometric consistency of the bilateral boundaries corresponding to the positions of each centerline based on the nylon filament centerline distance field includes: Based on the distance field of the nylon filament centerline, combined with the continuous deviation of the forward spatial distance, the continuous deviation of the reverse spatial distance, the corresponding deviation of the bilateral spatial distance, and the axial change trend of the forward spatial distance and the axial change trend of the reverse spatial distance, the geometric consistency of the bilateral boundaries corresponding to the continuous center position is determined. Based on the geometric consistency of the bilateral boundaries corresponding to each continuous center position, the forward spatial distance and reverse spatial distance corresponding to adjacent continuous center positions are weighted according to consistency to generate the forward local reference spatial distance and the reverse local reference spatial distance. Based on the geometric consistency of the two-sided boundaries, the two-sided spatial distance, the positive local reference spatial distance, and the negative local reference spatial distance are fused to generate positive guidance spatial distance, negative guidance spatial distance, and centerline distance field guidance information; The centerline distance field guidance information is fused with the initial edge features of the nylon filament to generate the double-sided guided edge response of the nylon filament; Based on the edge response of the nylon yarn on both sides, the positive and negative correction boundaries corresponding to each continuous center position are determined, and the nylon yarn correction boundary is generated.

[0012] Optionally, the step of calculating the actual filament diameter along the local normal and arranging it in centerline order based on the geometric reference of the nylon filament centerline and the corrected bilateral boundaries of the nylon filament includes: Based on the geometric reference of the nylon filament centerline and the double-sided boundary of the nylon filament correction, the spatial position of each continuous center position is associated with the corresponding positive correction boundary and reverse correction boundary to determine the position of the two sides of the boundary corresponding to each continuous center position. Based on the corresponding two-sided boundary positions, calculate the two-dimensional pixel Euclidean distance between the positive correction boundary and the negative correction boundary, and generate the two-sided boundary pixel distances corresponding to each continuous center position. Based on the nylon filament image scale calibration results, the pixel distance between the two side boundaries corresponding to each continuous center position is converted into the actual spatial distance and determined as the local filament diameter of the corresponding continuous center position; Arrange the local filament diameters at each continuous center position according to the spatial connection order of the continuous extension path to generate a continuous nylon filament diameter sequence.

[0013] Optionally, the step of determining the normal filament diameter benchmark based on the continuous nylon filament diameter sequence, and calculating the filament diameter deviation corresponding to each centerline position, the filament diameter change trend between adjacent centerline positions, and the duration of continuous abnormal sections includes: Based on the continuous nylon yarn diameter sequence, the normal yarn diameter benchmark is determined, and the yarn diameter deviation corresponding to each continuous center position is calculated. Based on the continuous nylon yarn diameter sequence, the local diameter variation and actual spatial spacing between adjacent continuous center positions are calculated to generate the diameter variation trend between adjacent continuous center positions. The location of the continuous abnormal center is determined based on the wire diameter deviation and the wire diameter change trend. The locations of the continuous abnormal centers that are spatially adjacent are continuously correlated to generate continuous abnormal segments and their corresponding durations. Based on the filament diameter deviation, filament diameter change trend and duration of the continuous abnormal section, the thick section, thin section and the gradually uneven thickness area of ​​nylon filament are classified and judged to generate the classification result of continuous abnormal section. Based on the classification results of continuous abnormal sections, the abnormality type, starting continuous center position, ending continuous center position and duration of each continuous abnormal section are determined, and the detection results of uneven thickness of nylon yarn are generated.

[0014] Optionally, the classification results of the continuous abnormal segments include: Coarse section: The proportion of continuous center positions of positive filament diameter deviation in the continuous abnormal section to be classified is greater than one-half, and the maximum value of the absolute value of the positive filament diameter deviation reaches the filament diameter deviation discrimination threshold. It does not meet the judgment conditions of the gradual uneven thickness area and is identified as a nylon filament coarse section. Details: The proportion of consecutive center positions of negative filament diameter deviation in the continuous abnormal section to be classified is greater than one-half, and the maximum value of the absolute value of negative filament diameter deviation reaches the filament diameter deviation discrimination threshold. It does not meet the judgment conditions of the gradual uneven thickness area and is identified as nylon filament details. Gradual unevenness region: The filament diameter change trend between adjacent continuous center positions in the continuous abnormal segment to be classified maintains the same direction of change, and the absolute value of the filament diameter change trend reaches the filament diameter change trend discrimination threshold. At the same time, the absolute difference between the local filament diameters corresponding to the starting continuous center position and the ending continuous center position of the continuous abnormal segment reaches the filament diameter deviation discrimination threshold. It is determined to be a nylon filament gradual unevenness region.

[0015] The beneficial effects of this invention are: This invention adjusts the original fixed horizontal and vertical strip convolution processing method to perform multi-scale feature extraction along the local axial and local normal directions of the nylon filament. It combines 7-pixel, 11-pixel, and 21-pixel scales to obtain axial strip spatial features and normal strip spatial features. Through axial-normal coupling and attention weighting, multi-scale visual features of the nylon filament are formed. This allows the feature extraction direction to change with the actual extension posture of the nylon filament, reducing the interference of nylon filament tilting, bending, lateral vibration, and local reflection on the feature extraction of the main body area and the two side edges. It enhances the network's ability to represent the continuous structure of slender main bodies, weak edges, and local thickness variations, so that the subsequent initial segmentation results and initial edge features have more stable spatial continuity.

[0016] This invention establishes a continuous extension path and centerline geometric reference based on the initial segmentation results. It determines the forward and reverse spatial distances along the local normal direction at each continuous center position, and constructs a nylon filament centerline distance field by integrating the continuity of bilateral spatial distances, bilateral correspondence, and axial variation trends. It calculates the geometric consistency of the bilateral boundaries, and applies consistency weighting to the bilateral spatial distances at adjacent continuous center positions to form forward guiding spatial distances, reverse guiding spatial distances, and distance field guiding weights. These distance field guiding weights are used to enhance or suppress the initial edge response of the improved SegNeXt, ensuring that boundary correction is simultaneously constrained by depth visual features and the continuous geometric structure of the nylon filament. This suppresses fuzz, local highlights, noisy edges, and isolated erroneous responses, preventing unilateral boundary drift or local breakage from directly converting into filament diameter measurement errors, and improving the consistency and stability of both sides of the boundary in the continuous extension direction. Attached Figure Description

[0017] The accompanying drawings are provided to further illustrate the invention and form part of the specification. They are used in conjunction with embodiments of the invention to explain the invention and do not constitute a limitation thereof. In the drawings: Figure 1 This is a flowchart of a method for detecting uneven thickness of nylon filaments based on multi-scale image segmentation proposed in this invention; Figure 2 This is a structural block diagram of the improved SegNeXt in the multi-scale image segmentation-based method for detecting uneven nylon filament thickness proposed in this invention. Figure 3 This is a structural block diagram of the improved MSCAN Block structure in the multi-scale image segmentation-based method for detecting uneven thickness of nylon filaments proposed in this invention. Figure 4 This is a structural block diagram of the improved MSCA in the multi-scale image segmentation-based method for detecting uneven thickness of nylon filaments proposed in this invention; Figure 5This is a comparison of the initial segmentation results in Example 3 of the multi-scale image segmentation-based method for detecting uneven thickness of nylon filaments proposed in this invention. Figure 6 This is a magnified view of the bend in Example 3 of the method for detecting uneven thickness of nylon yarn based on multi-scale image segmentation proposed in this invention. Figure 7 This is a magnified view of a weak edge in Example 3 of the method for detecting uneven thickness of nylon filaments based on multi-scale image segmentation proposed in this invention. Figure 8 This is a magnified view of a sudden change in the thickness of nylon yarn in Example 3 of the multi-scale image segmentation-based method for detecting uneven thickness of nylon yarn proposed in this invention. Detailed Implementation

[0018] Example 1: Reference Figure 1 A method for detecting uneven thickness of nylon filaments based on multi-scale image segmentation, comprising: Continuous imaging images are acquired and preprocessed to obtain a standardized image sequence of nylon filaments. At the same time, scale mapping relationships are performed to generate nylon filament image scale calibration.

[0019] In this embodiment, the specific steps include: using an industrial camera positioned to detect nylon filaments in a continuously conveying state, continuously acquiring original imaging images containing the nylon filaments to be detected at a manually set image acquisition frequency.

[0020] Based on the location of the detection area, the nylon filament detection area is extracted from the original imaging image, and brightness correction, background suppression, and image scale unification are performed on the nylon filament detection area to generate a standardized nylon filament image sequence.

[0021] In Example 1, the brightness correction uses a limited contrast adaptive histogram equalization algorithm to perform local brightness equalization and contrast enhancement on the nylon filament detection area, thereby reducing grayscale fluctuations caused by local reflections and uneven illumination.

[0022] Background suppression employs a Gaussian mixture model background modeling algorithm to establish a stable background model, and extracts the nylon foreground region by the difference between the current image and the background model, thereby suppressing background texture and fixed interference.

[0023] Image scaling is unified by using a bicubic interpolation algorithm to adjust the nylon filament detection area to a uniform image size, so that different acquisition frames have consistent spatial resolution and meet the improved SegNeXt input size requirements.

[0024] Based on a calibration reference set within the imaging field of view of an industrial camera and whose actual size is known, the pixel size corresponding to the calibration reference is determined. According to the correspondence between the actual size and the pixel size, a scale mapping relationship between the image pixel size and the actual spatial size is established to generate the nylon filament image scale calibration.

[0025] The normalized image sequence of nylon yarn is input into the improved SegNeXt, and multi-scale visual features are extracted from the main body region, the two side edge regions and the local thickness variation region of the nylon yarn. Then, pixel-level segmentation is performed based on the extracted multi-scale visual features to generate the initial segmentation result and initial edge features of the nylon yarn.

[0026] In this embodiment, the specific steps include: inputting a standardized image sequence of nylon filament into an improved SegNeXt, performing a 5×5 depth convolution to generate local spatial features of the nylon filament.

[0027] In Example 1, the standardized nylon filament image sequence is input frame by frame into the improved SegNeXt in the order of continuous imaging. The hierarchical coding structure, feedforward network, and decoding structure of the improved SegNeXt remain unchanged. The multi-scale convolutional attention module in each feature layer of the improved SegNeXt is replaced with the multi-scale convolutional attention module of the improved SegNeXt. The multi-scale convolutional attention module of the improved SegNeXt is an attention module that performs adaptive feature extraction along the local axial direction and local normal direction of the nylon filament. The hierarchical coding structure of the improved SegNeXt is used to perform feature mapping at different spatial scales on each frame of the standardized nylon filament image to obtain the visual feature tensor corresponding to each feature layer. A 5×5 depth convolution is performed on the visual feature tensor corresponding to each feature layer. Under the condition that the spatial size and number of feature channels of the corresponding visual feature tensor remain unchanged, the local responses of adjacent spatial positions are aggregated to generate the local spatial features of the nylon filament.

[0028] Based on the local spatial characteristics of nylon filament, the channel features are mapped to generate the local axial direction and local normal direction of nylon filament.

[0029] In Example 1, based on the local spatial features of nylon filament, the first-order spatial gradient of each feature channel in the local spatial features of nylon filament along the horizontal and vertical spatial directions is calculated respectively. A three-by-three local pixel neighborhood is constructed with each spatial position in the local spatial features of nylon filament as the center.

[0030] Within a 3×3 local pixel neighborhood, channel summation and spatial accumulation are performed on the squared first-order spatial gradient of the horizontal direction, the squared first-order spatial gradient of the vertical direction, and the product of the first-order spatial gradient of the horizontal direction and the first-order spatial gradient of the vertical direction across each feature channel to construct a two-dimensional local orientation structure matrix corresponding to each spatial position.

[0031] The two-dimensional local orientation structure matrix is ​​subjected to eigenvalue decomposition and normalization. The eigenvector corresponding to the minimum eigenvalue is determined as the local axial direction of the nylon filament, and the eigenvector corresponding to the maximum eigenvalue is determined as the local normal direction of the nylon filament. This generates the local axial direction and local normal direction of the nylon filament for each spatial position.

[0032] Based on the local axial direction and local normal direction of nylon filament, the fixed strip convolution is converted into direction-adaptive convolution to generate axial strip spatial features and normal strip spatial features.

[0033] In Example 1, based on the local axial direction and local normal direction of nylon filament, the fixed-direction strip depth convolution in the improved SegNeXt multi-scale convolutional attention module is converted into a direction-adaptive strip depth convolution. Taking each spatial position in the local spatial features of nylon filament as the center, symmetrical sampling positions on continuous spatial coordinates are calculated along the local axial direction and local normal direction of nylon filament, with the direction vector as the offset reference and according to the scales of 7 pixels, 11 pixels and 21 pixels under the current feature layer spatial resolution. Bilinear interpolation is performed on the local spatial features of nylon filament corresponding to each sampling position according to the continuous spatial coordinates. Learnable channel-wise convolution weights with the same number of feature channels in the current feature layer are set for each sampling position in the axial direction and normal direction. The local spatial features of nylon filament obtained by bilinear interpolation at each sampling position are multiplied element-wise with the corresponding learnable channel-wise convolution weights according to the same feature channels, and accumulated along the corresponding sampling direction to generate axial strip spatial features and normal strip spatial features respectively.

[0034] Among them, the learnable channel-wise convolution weights are updated iteratively by backpropagation of the gradient of the weights of each feature channel according to the segmentation loss function during the training of the improved SegNeXt, and then normalized to the range of [-1, 1] by the hyperbolic tangent function.

[0035] By integrating the spatial features of axial and normal stripes at various scales, superimposing the local spatial features of nylon filaments, and performing a one-to-one pointwise convolution, multi-scale visual features of nylon filaments are generated.

[0036] In Example 1, for the three scales of 7 pixels, 11 pixels, and 21 pixels, axial-normal coupling is performed on the axial strip spatial features and normal strip spatial features corresponding to the same scale. The axial strip spatial features and normal strip spatial features corresponding to the same scale are multiplied element-wise according to the same feature channel. Learnable axial-normal coupling weights are set for the element-wise products corresponding to each scale in each feature layer. After multiplying the element-wise products with the corresponding learnable axial-normal coupling weights, the product is superimposed with the corresponding axial strip spatial features and normal strip spatial features channel-wise to generate the axial-normal coupling features corresponding to each scale.

[0037] The learnable axial-normal coupling weights are obtained by performing a Sigmoid mapping on the trainable scalar parameters corresponding to each convolution scale of each feature layer, and are iteratively updated through backpropagation during the training of the improved SegNeXt, with a value range of 0 to 1.

[0038] The axial-normal coupling features corresponding to each scale are superimposed with the local spatial features of nylon filament. The channel is mixed by one-to-one pointwise convolution and mapped to the 0~1 interval by Sigmoid nonlinear activation to generate the axial-normal multi-scale attention weight features of nylon filament.

[0039] The axial-normal multi-scale attention weight features of nylon filament are multiplied element-wise with the visual feature tensors of the corresponding feature layers according to the same spatial position and the same feature channels to generate the multi-scale attention features of nylon filament for each feature layer. These features are then input into the improved SegNeXt original feedforward network and subsequent hierarchical coding structure to generate multi-scale visual features of nylon filament.

[0040] The multi-scale visual features of nylon fibers are decoded and fused using an improved SegNeXt method and mapped to the pixel space to generate the initial segmentation result of nylon fibers.

[0041] In Example 1, the multi-scale visual features of nylon filament are input into the improved SegNeXt decoding structure, and the multi-scale visual features of nylon filament corresponding to different feature layers are mapped to a unified spatial resolution. They are then fused according to the feature channels to generate multi-scale fused features of nylon filament.

[0042] The multi-scale fusion features of nylon yarn are mapped to the pixel space corresponding to the standardized image of nylon yarn. The nylon yarn subject category mapping is performed on each pixel position to obtain the probability of each pixel position belonging to the nylon yarn subject region.

[0043] The probability of the nylon filament as the main body is compared with a preset segmentation probability threshold. The pixel positions where the probability of the nylon filament as the main body reaches the preset segmentation probability threshold are determined as the nylon filament main body region, and the pixel positions where the probability of the nylon filament as the main body does not reach the preset segmentation probability threshold are determined as the non-nylon filament main body region. The nylon filament main body region is combined according to the spatial position of each pixel position in the nylon filament standardized image to generate the initial nylon filament segmentation result.

[0044] The preset segmentation probability threshold is calculated by iterating through the comprehensive evaluation values ​​of nylon filament segmentation accuracy and boundary integrity corresponding to different candidate probability thresholds in the verification sample, and the probability threshold corresponding to the maximum comprehensive evaluation value is taken as the preset segmentation probability threshold, with a value range of 0 to 1.

[0045] Based on the initial segmentation results of nylon filament, pixel-level spatial transition positions are determined, corresponding multi-scale fusion features are extracted, and non-transition position responses are suppressed to generate initial edge features of nylon filament.

[0046] In Example 1, based on the initial segmentation result of nylon filament, the pixel positions in the 3×3 local pixel neighborhood where both the nylon filament main body region and the non-nylon filament main body region exist are determined as the pixel-level spatial transition positions between the nylon filament main body region and the non-nylon filament main body region.

[0047] The feature responses corresponding to each pixel-level spatial transition position are extracted from the multi-scale fusion features of nylon filament. The feature responses corresponding to the pixel-level spatial transition positions are preserved, while the feature responses corresponding to the non-pixel-level spatial transition positions are suppressed to generate the initial edge features of nylon filament.

[0048] refer to Figures 2-4 This implementation uses an improved SegNeXt as the initial segmentation network for nylon filaments. Based on the MSCAN encoding backbone of SegNeXt-T and the LightHamHead decoding structure, the input is a standardized nylon filament image obtained after detection region localization and imaging consistency processing. The tensor dimension of a single batch input is B×3×H×W, where B represents the number of batch images, and H and W represent the height and width of the standardized nylon filament image, respectively. The Stem consists of two 3×3 convolutional layers with a stride of 2, reducing the image spatial size to H / 4×W / 4. Subsequently, four feature extraction stages are set, with the number of feature channels being 32, 64, 160, and 256 respectively, and the spatial sizes being H / 4×W / 4, H / 8×W / 8, H / 16×W / 16, and H / 32×W / 32 respectively. Each stage has 3, 3, 5, and 2 MSCAN blocks respectively, containing a total of 13 MSCAN blocks. Each MSCAN Block retains its original normalization, residual connection, and feedforward network structure, except that the original multi-scale convolutional attention module in the MSCAN Block is replaced with the improved SegNeXt multi-scale convolutional attention module.

[0049] For the visual feature tensors corresponding to each feature layer, a 5×5 depthwise convolution is performed. While maintaining the spatial size of the visual feature tensor and the number of feature channels, the local responses of adjacent spatial locations are aggregated to generate local spatial features of the nylon filament. Based on these local spatial features, the first-order spatial gradients of each feature channel along the horizontal and vertical spatial directions are calculated, and a 3×3 local pixel neighborhood is constructed centered on each spatial location. Within this 3×3 local pixel neighborhood, channel summation and spatial accumulation are performed across each feature channel on the squares of the horizontal and vertical first-order spatial gradients, as well as the product of the horizontal and vertical first-order spatial gradients, respectively, to construct a two-dimensional local orientation structure matrix. The two-dimensional local orientation structure matrix is ​​then subjected to eigenvalue decomposition and normalization. The eigenvector corresponding to the smallest eigenvalue is determined as the local axial direction of the nylon filament, and the eigenvector corresponding to the largest eigenvalue is determined as the local normal direction of the nylon filament.

[0050] The fixed-direction strip depth convolution in the original multi-scale convolutional attention module of SegNeXt is transformed into an orientation-adaptive strip depth convolution. Centered on each spatial location in the local spatial features of nylon filament, symmetrical sampling positions on continuous spatial coordinates are determined in parallel at three scales: 7 pixels, 11 pixels, and 21 pixels, along the local axial and normal directions of the nylon filament. Bilinear interpolation is performed on the corresponding local spatial features of the nylon filament based on the continuous spatial coordinates. Learnable channel-wise convolution weights, consistent with the number of feature channels in the current feature layer, are set for each sampling position in both the axial and normal directions. The bilinearly interpolated local spatial features of the nylon filament are then multiplied element-wise with the corresponding learnable channel-wise convolution weights along the same feature channels and accumulated along the corresponding sampling directions, generating axial and normal strip spatial features at scales of 7 pixels, 11 pixels, and 21 pixels, respectively.

[0051] For the three scales of 7 pixels, 11 pixels, and 21 pixels, the axial and normal spatial features corresponding to the same scale are multiplied element-wise along the same feature channels. The element-wise product is then multiplied with the corresponding learnable axial-normal coupling weights, and finally superimposed channel-wise with the corresponding axial and normal spatial features to generate axial-normal coupling features for each of the three scales. The learnable axial-normal coupling weights are obtained from the corresponding trainable scalar parameters via Sigmoid mapping and are iteratively updated through backpropagation during training. Furthermore, the axial-normal coupling features corresponding to the three scales are superimposed with the local spatial features of nylon filament, and channel mixing is performed through 1×1 pointwise convolution followed by Sigmoid nonlinear activation mapping to the 0-1 interval to generate nylon filament axial-normal multi-scale attention weight features.

[0052] The axial-normal multi-scale attention weight features of nylon filament are multiplied element-wise with the visual feature tensor corresponding to the current feature layer according to the same spatial location and the same feature channel to generate the multi-scale attention features of nylon filament corresponding to the current feature layer. This is then input into the original feedforward network and subsequent hierarchical coding structure of SegNeXt to form multi-scale visual features of nylon filament corresponding to different feature layers. Thus, within each MSCAN Block, only the multi-scale convolutional attention processing method is changed, without altering the original feedforward network, hierarchical coding structure, normalization structure, residual connections, and decoding structure of SegNeXt.

[0053] In the decoding stage, the multi-scale visual features of nylon fibers corresponding to different feature layers are input into the LightHamHead decoding structure, mapped to a unified spatial resolution, and fused according to feature channels to generate multi-scale fused features of nylon fibers. These multi-scale fused features are then mapped to the pixel space corresponding to the standardized nylon fiber image to obtain the probability that each pixel location belongs to the nylon fiber main body region. After processing with a preset segmentation probability threshold, the initial segmentation result of the nylon fiber is generated. Simultaneously, based on the initial segmentation result, the pixel-level spatial transition positions between the nylon fiber main body region and the non-nylon fiber main body region are determined. Feature responses corresponding to each pixel-level spatial transition position are extracted from the multi-scale fused features of the nylon fiber, and feature responses corresponding to non-pixel-level spatial transition positions are suppressed to generate initial edge features of the nylon fiber.

[0054] During training, pixel-level manual annotation of the main nylon filament region was performed on the standardized nylon filament images, and the training set, validation set, and test set were divided according to the collection batch. Supervised semantic segmentation training was adopted, and ImageNet-1K pre-trained MSCAN-T parameters could be loaded as the initial weights of the encoding backbone. The newly added parameters in the improved SegNeXt multi-scale convolutional attention module were initialized. Cross-entropy segmentation loss was used for end-to-end backpropagation, and the AdamW optimizer was adopted. The initial learning rate was set to 6×10^-5, the weight decay was set to 0.01, and a linear warm-up and multinomial learning rate decay strategy was adopted to enable the learnable channel-wise convolutional weights, learnable axial-normal coupling weights, and the original trainable parameters of SegNeXt to be updated iteratively.

[0055] Based on the initial segmentation results of the nylon filament, the continuous extension path of the main nylon filament region is determined. The center position of the continuous extension path is extracted, and the local extension direction and corresponding local normal direction of the nylon filament are determined based on the continuous center position, thus generating the geometric reference of the nylon filament centerline.

[0056] In this embodiment, the specific steps include: performing connectivity analysis on the main body region of the nylon filament based on the initial segmentation results of the nylon filament to determine the continuous extension path of the main body region of the nylon filament.

[0057] In Example 1, based on the initial segmentation result of the nylon filament, each pixel in the main region of the nylon filament is taken as the processing object, and the pixels in the main region of the nylon filament that are spatially adjacent are connected and merged according to the eight-neighbor spatial connection relationship to form the main connected region of the nylon filament.

[0058] The interconnected pixels within each nylon filament body are refined layer by layer to maintain regional connectivity, forming a single-pixel-width connected skeleton. Skeleton connection paths are established based on the eight-neighbor spatial connection relationships between skeleton pixels in the connected skeleton, and the path length of each skeleton connection path is determined. The skeleton connection path with the longest path length is determined as the continuous extension path of the nylon filament body region.

[0059] The shortest spatial distance from each pixel within the nylon filament body region to the non-nylon filament body region is calculated based on the continuous extension path. The candidate center position is determined based on the shortest spatial distance, and the candidate center positions are smoothed and sequentially associated to generate a continuous nylon filament center position sequence.

[0060] In Example 1, based on the continuous extension path, the Euclidean distance from each pixel in the continuous area of ​​the nylon filament body to each pixel in the non-nylon filament body area is calculated, and the smallest Euclidean distance is determined as the shortest spatial distance from the corresponding pixel to the non-nylon filament body area.

[0061] The pixels are arranged in the order of continuous extension path. The shortest spatial distances of each pixel and its adjacent pixels are compared in turn. The pixels whose shortest spatial distance is greater than the shortest spatial distances of the previous and next adjacent pixels in the continuous extension path are determined as candidate center positions. The candidate center positions are then arranged in the order of spatial connection of the continuous extension path.

[0062] Taking each candidate center position as the center, select the two adjacent candidate center positions in front of and behind the current candidate center position respectively. Set the position weight of the current candidate center position to 1, and set the position weight of each adjacent candidate center position to the reciprocal of the corresponding path distance plus 1. After weight normalization, perform weighted summation on the two-dimensional pixel coordinates of each candidate center position to generate a smoothed continuous center position.

[0063] If there are fewer than two adjacent candidate center positions at the start and end of the candidate center position sequence, the window is adaptively adjusted according to the actual adjacent candidate center positions and position-weighted smoothing is performed to maintain the original spatial connection order of each continuous center position along the continuous extension path, thereby generating a continuous center position sequence of nylon filament.

[0064] Based on the continuous center position sequence of nylon filaments, the local extension direction of nylon filaments corresponding to each continuous center position is determined according to the two-dimensional pixel coordinate changes of adjacent continuous center positions.

[0065] In Example 1, based on the continuous center position sequence of nylon filament, the local extension vector corresponding to each continuous center position is determined according to the spatial connection order of each continuous center position along the continuous extension path: For the continuous center positions within the continuous center position sequence of nylon filament, the center difference method is used to subtract the two-dimensional pixel coordinates of the next continuous center position from the previous continuous center position to generate the local extension vector; For the starting continuous center position and the ending continuous center position of the continuous center position sequence of nylon filament, the one-sided difference method is used to calculate the difference between the two-dimensional pixel coordinates of the adjacent continuous center positions to generate the local extension vector.

[0066] Calculate the Euclidean length of each local extension vector, and under the condition that the Euclidean length is greater than zero, normalize each local extension vector by dividing it by the corresponding Euclidean length to generate the local extension direction of the nylon filament corresponding to each continuous center position.

[0067] Based on the local extension direction of the nylon filament, the corresponding local normal direction is determined. The continuous center position sequence of the nylon filament, the local extension direction of the nylon filament, and the local normal direction are spatially correlated to generate the geometric reference of the nylon filament centerline.

[0068] In Example 1, based on the local extension direction of the nylon filament corresponding to each continuous center position, the local extension direction of the nylon filament is rotated 90 degrees counterclockwise in the image coordinate plane to generate a local normal direction orthogonal to the local extension direction of the nylon filament.

[0069] By associating each continuous center position in the continuous center position sequence of nylon filament with the corresponding local extension direction and local normal direction of nylon filament according to their spatial positions, a geometric reference for the center line of nylon filament is generated.

[0070] Based on the geometric reference of the nylon filament centerline, the initial boundaries on both sides of the nylon filament are determined at each centerline position along the corresponding local normal direction. The bilateral spatial distance from each centerline position to the bilateral initial boundaries is calculated. The nylon filament centerline distance field is generated by combining the continuity of the bilateral spatial distances corresponding to adjacent centerline positions, the bilateral correspondence, and the axial change trend.

[0071] In this embodiment, the specific steps include: based on the geometric reference of the nylon filament centerline, performing a bidirectional spatial search along the corresponding local normal direction at each continuous center position to determine the initial boundaries on both sides of the nylon filament corresponding to each continuous center position.

[0072] In Example 1, based on the geometric reference of the nylon filament centerline, each continuous center position in the continuous center position sequence of the nylon filament is taken as the starting position of the normal search, and the corresponding local normal direction and the direction opposite to the local normal direction are determined as the forward search direction and the reverse search direction.

[0073] Starting from each continuous center position, the spatial search distance is increased by one pixel in both the forward and reverse search directions. The corresponding pixel position is obtained by rounding the continuous search coordinates. Without exceeding the image space boundary, the region to which each spatial search position belongs is determined sequentially based on the initial segmentation result of the nylon filament. The spatial transition position corresponding to the first transition from the main nylon filament region to a non-nylon filament region along the forward and reverse search directions is determined as the forward initial boundary and the reverse initial boundary. If no region transition occurs when searching to the image space boundary, the current image space boundary position is determined as the forward initial boundary or the reverse initial boundary. The corresponding continuous center positions are associated to generate the initial boundaries on both sides of the nylon filament corresponding to each continuous center position.

[0074] Based on each continuous center position and the corresponding initial boundaries on both sides of the nylon filament, calculate the forward spatial distance and the reverse spatial distance respectively, and generate the bilateral spatial distance corresponding to each continuous center position; In Example 1, for each continuous center position in the continuous center position sequence of nylon yarn, the two-dimensional pixel Euclidean distance between the current continuous center position and the corresponding forward initial boundary is calculated and determined as the forward spatial distance; the two-dimensional pixel Euclidean distance between the current continuous center position and the corresponding reverse initial boundary is calculated and determined as the reverse spatial distance.

[0075] The forward and reverse spatial distances are associated one by one according to the corresponding continuous center positions to generate the bilateral spatial distances corresponding to each continuous center position.

[0076] Based on the bilateral spatial distances corresponding to each continuous center position, the continuity of bilateral spatial distances between adjacent continuous center positions, the bilateral correspondences corresponding to the same continuous center position, and the axial variation trend of bilateral spatial distances along the continuous extension path are determined respectively.

[0077] In Example 1, according to the spatial connection order of the continuous extension path, for the continuous center positions located within the continuous center position sequence of the nylon filament: For both forward and reverse spatial distances, calculate the average of the absolute differences between the current continuous center position and the previous and next continuous center positions, respectively, and generate the corresponding forward and reverse spatial distance continuous deviations. Combine these deviations to determine the bilateral spatial distance continuity of the corresponding continuous center positions.

[0078] Calculate the absolute difference between the forward and reverse spatial distances corresponding to the same continuous center position, and determine the corresponding deviation and correspondence of the two-sided spatial distances for the corresponding continuous center positions.

[0079] The Euclidean distance between the two consecutive center positions is calculated based on the two-dimensional pixel coordinates of the previous and subsequent consecutive center positions, and is determined as the axial center position spacing. Under the condition that the axial center position spacing is greater than zero, the difference between the forward spatial distance and the reverse spatial distance between the subsequent consecutive center position and the previous consecutive center position is divided by the axial center position spacing, respectively, to generate the axial change trend of the forward spatial distance and the axial change trend of the reverse spatial distance, and the combination is determined as the axial change trend of the bilateral spatial distance along the continuous extension path.

[0080] For the starting and ending continuous center positions in the continuous center position sequence of nylon filament, one-sided difference is performed using the corresponding actual adjacent continuous center positions. The difference between the forward and reverse spatial distances before and after is calculated and divided by the one-sided axial center position spacing to generate the corresponding forward spatial distance continuous deviation, reverse spatial distance continuous deviation, bilateral spatial distance corresponding deviation, forward spatial distance axial change trend, and reverse spatial distance axial change trend, respectively.

[0081] According to the spatial connection order of the continuous extension path, the spatial positions of each continuous center position in the continuous center position sequence of nylon yarn are associated one by one with the spatial distance between the two sides, the continuity of the spatial distance between the two sides, the correspondence between the two sides and the trend of axial change, so as to generate the nylon yarn centerline distance field.

[0082] The geometric consistency of the bilateral boundaries corresponding to each centerline position is determined based on the centerline distance field of the nylon filament. Centerline distance field guidance information is generated based on the geometric consistency of the bilateral boundaries. The centerline distance field guidance information is fused with the initial edge features of the nylon filament. Edge responses that conform to the continuous geometric structure of the nylon filament are enhanced, while edge responses that do not conform to the continuous geometric structure of the nylon filament are suppressed, thus generating the corrected bilateral boundaries of the nylon filament.

[0083] In this embodiment, the specific steps include: based on the distance field of the nylon filament centerline, combined with the continuous deviation of the forward spatial distance, the continuous deviation of the reverse spatial distance, the corresponding deviation of the bilateral spatial distance, and the axial change trend of the forward spatial distance and the axial change trend of the reverse spatial distance, the geometric consistency of the bilateral boundaries corresponding to the continuous center position is determined.

[0084] In Example 1, based on the distance field of the nylon filament centerline, under the condition that the sum of the forward spatial distance and the reverse spatial distance is greater than zero, the absolute difference between the continuous deviation of the forward spatial distance and the continuous deviation of the reverse spatial distance is calculated, and the absolute difference is divided by the sum of the forward spatial distance and the reverse spatial distance to generate the bilateral continuity difference.

[0085] Divide the deviation of the two-sided spatial distance by the sum of the forward and reverse spatial distances to generate the difference in the two-sided distance.

[0086] Calculate the absolute difference between the forward spatial distance axial change trend and the reverse spatial distance axial change trend to generate the bilateral axial change difference.

[0087] The differences in bilateral continuity, bilateral distance correspondence, and bilateral axial variation are summed, and the summation result is subjected to negative exponential decay mapping. The mapping result is determined as the bilateral boundary geometric consistency corresponding to the continuous center position.

[0088] Based on the geometric consistency of the bilateral boundaries corresponding to each continuous center position, the forward spatial distance and reverse spatial distance corresponding to adjacent continuous center positions are weighted according to consistency to generate the forward local reference spatial distance and the reverse local reference spatial distance.

[0089] In Example 1, according to the spatial connection order of the continuous extension path, for the continuous center positions located inside the continuous center position sequence of nylon filament, the geometric consistency of the bilateral boundaries, the forward spatial distance and the reverse spatial distance corresponding to the previous continuous center position and the next continuous center position are determined respectively.

[0090] Normalization calculations are performed based on the geometric consistency of the bilateral boundaries corresponding to the previous and subsequent consecutive center positions. The geometric consistency of the bilateral boundaries corresponding to the previous and subsequent consecutive center positions is divided by the sum of the two values ​​to determine the weighted weights corresponding to the previous and subsequent consecutive center positions. The forward and reverse spatial distances corresponding to the previous and subsequent consecutive center positions are then calculated using the weighted averages to generate the forward and reverse local reference spatial distances corresponding to the current consecutive center position.

[0091] For the starting and ending continuous center positions in the continuous center position sequence of nylon filament, the forward and reverse spatial distances corresponding to the actual existing one-sided adjacent continuous center positions are used to determine the forward local reference spatial distance and the reverse local reference spatial distance, respectively.

[0092] Based on the geometric consistency of the two-sided boundaries, the two-sided spatial distance, the positive local reference spatial distance, and the negative local reference spatial distance are fused to generate positive guidance spatial distance, negative guidance spatial distance, and centerline distance field guidance information.

[0093] In Example 1, for each continuous center position, the geometric consistency of the bilateral boundaries is used as the retention weight, and the difference between the geometric consistency of the bilateral boundaries and 1 is determined as the correction weight. The positive guiding spatial distance is generated by adding the product of the forward spatial distance and the retention weight, and the product of the forward local reference spatial distance and the correction weight. Similarly, the reverse guiding spatial distance is generated by adding the product of the reverse spatial distance and the retention weight, and the product of the reverse local reference spatial distance and the correction weight.

[0094] Along the forward and reverse search directions corresponding to each continuous center position, starting from the continuous center position, the candidate spatial distance is determined by a step size of one pixel. The absolute difference between each candidate spatial distance and the corresponding forward or reverse guiding spatial distance is calculated. Using one pixel as the exponential decay distance scale, the absolute difference corresponding to each candidate spatial distance is mapped by negative exponential decay to generate the forward distance field guiding weight and the reverse distance field guiding weight, respectively.

[0095] According to the spatial connection order of the continuous extension path, each continuous center position is associated with the corresponding forward guiding spatial distance, reverse guiding spatial distance, forward distance field guiding weight and reverse distance field guiding weight one by one to generate centerline distance field guiding information.

[0096] The centerline distance field guidance information is fused with the initial edge features of the nylon filament to generate the double-sided guided edge response of the nylon filament.

[0097] In Example 1, based on the initial edge features of nylon yarn, candidate pixel positions are determined sequentially along the forward and reverse search directions corresponding to each continuous center position with a step size of one pixel. The initial edge feature response of the corresponding pixel position is obtained by rounding and mapping, and the Euclidean norm is calculated to generate the initial edge response.

[0098] Add the forward or reverse distance field guiding weights of the corresponding candidate pixel position to half of the original weights to generate the edge response modulation coefficients. Then multiply the initial edge response by the edge response modulation coefficients to generate the guided edge response of the corresponding candidate pixel position.

[0099] The guiding edge responses corresponding to the forward search direction and the reverse search direction are determined as the forward guiding edge response and the reverse guiding edge response, respectively, and associated according to the corresponding continuous center positions to generate the double-sided guiding edge response of the nylon yarn.

[0100] Based on the edge response of the nylon yarn on both sides, the positive and negative correction boundaries corresponding to each continuous center position are determined, and the nylon yarn correction boundary is generated.

[0101] In Example 1, for each continuous center position, the candidate pixel position with the largest positive guiding edge response and the largest negative guiding edge response are determined as the positive correction boundary and the negative correction boundary in the forward search direction and the reverse search direction, respectively; when there are multiple largest candidate pixel positions in the same search direction, the one with the smallest absolute difference between the candidate spatial distance and the corresponding positive guiding spatial distance or the negative guiding spatial distance is determined as the positive correction boundary or the negative correction boundary.

[0102] By associating the positive and negative correction boundaries corresponding to each continuous center position one by one according to the spatial connection order of the continuous extension path, the double-sided boundary of nylon yarn correction is generated.

[0103] Based on the geometric reference of the nylon filament centerline and the corrected bilateral boundaries of the nylon filament, the positions of the two sides of the boundary are determined along the corresponding local normal direction at each centerline position. The pixel distance between the two sides of the boundary is converted into the actual spatial distance according to the nylon filament image scale calibration. The local filament diameter corresponding to each centerline position is continuously calculated. The local filament diameters are arranged according to the extension direction of the nylon filament centerline to generate a continuous nylon filament diameter sequence.

[0104] In this embodiment, the specific steps include: based on the geometric reference of the nylon filament centerline and the double-sided boundary of the nylon filament correction, spatially associating each continuous center position with the corresponding positive correction boundary and reverse correction boundary to determine the position of the two side boundaries corresponding to each continuous center position.

[0105] In Example 1, based on the geometric reference of the nylon filament centerline and the corrected bilateral boundaries of the nylon filament, the continuous center positions and corresponding local normal directions in the continuous center position sequence of the nylon filament are determined sequentially according to the spatial connection order of the continuous extension path. The positive correction boundary is determined as the boundary position on one side along the local normal direction, and the negative correction boundary is determined as the boundary position on the side opposite to the local normal direction. The current continuous center position is associated with the corresponding positive correction boundary and negative correction boundary one by one to generate the bilateral boundary positions corresponding to each continuous center position.

[0106] Based on the corresponding positions of the two side boundaries, calculate the two-dimensional pixel Euclidean distance between the positive correction boundary and the negative correction boundary, and generate the pixel distance between the two side boundaries corresponding to each continuous center position.

[0107] In Example 1, based on the two side boundary positions corresponding to each continuous center position, the two-dimensional pixel Euclidean distance between the corresponding positive correction boundary and the negative correction boundary is calculated and determined as the pixel distance between the two side boundaries of the corresponding continuous center position.

[0108] Based on the nylon filament image scale calibration results, the pixel distance between the two side boundaries corresponding to each continuous center position is converted into the actual spatial distance and determined as the local filament diameter of the corresponding continuous center position.

[0109] In Example 1, the actual spatial size corresponding to a unit pixel is determined based on the nylon filament image scale calibration result, and is used as the scale conversion coefficient.

[0110] Multiply the pixel distance between the two side boundaries corresponding to each continuous center position by the scale conversion factor to determine the actual spatial distance between the corresponding positive correction boundary and the negative correction boundary, and determine the local wire diameter of the corresponding center position.

[0111] Arrange the local filament diameters at each continuous center position according to the spatial connection order of the continuous extension path to generate a continuous nylon filament diameter sequence.

[0112] In Example 1, according to the spatial connection order of the continuous extension path, each continuous center position in the continuous center position sequence of nylon yarn is associated with the corresponding local yarn diameter one by one. The local yarn diameters corresponding to each continuous center position are arranged sequentially from the starting end to the other end of the continuous extension path, so that the local yarn diameters corresponding to adjacent continuous center positions maintain the same adjacent relationship as the continuous center position sequence of nylon yarn during the arrangement process, thereby generating a continuous yarn diameter sequence of nylon yarn.

[0113] Based on the continuous nylon yarn diameter sequence, the normal yarn diameter benchmark is determined. The yarn diameter deviation corresponding to each center line position, the yarn diameter change trend between adjacent center line positions, and the continuous length of continuous abnormal sections are calculated. Based on the yarn diameter deviation, yarn diameter change trend, and continuous length, thick sections, thin sections, and gradually uneven thickness areas of nylon yarn are identified, and the nylon yarn thickness unevenness detection results are generated.

[0114] In this embodiment, the specific steps include: determining the normal filament diameter benchmark based on the continuous filament diameter sequence of nylon filament, and calculating the filament diameter deviation corresponding to each continuous center position.

[0115] In Example 1, based on the continuous nylon yarn diameter sequence, the local yarn diameters corresponding to each continuous center position are sorted according to their numerical values. When the number of local yarn diameters is odd, the local yarn diameter located in the middle position after sorting is determined as the normal yarn diameter benchmark. When the number of local yarn diameters is even, the average value of the local yarn diameters located in the middle two positions after sorting is determined as the normal yarn diameter benchmark.

[0116] For each continuous center position in the continuous nylon yarn diameter sequence, the corresponding local yarn diameter is subtracted from the normal yarn diameter reference to generate the yarn diameter deviation for the corresponding continuous center position. A yarn diameter deviation greater than 0 indicates that the local yarn diameter at the corresponding continuous center position is greater than the normal yarn diameter reference, and a yarn diameter deviation less than 0 indicates that the local yarn diameter at the corresponding continuous center position is less than the normal yarn diameter reference.

[0117] Based on the continuous nylon yarn diameter sequence, the local diameter variation and actual spatial spacing between adjacent continuous center positions are calculated to generate the diameter variation trend between adjacent continuous center positions.

[0118] In Example 1, the local wire diameters corresponding to two adjacent consecutive center positions are determined sequentially according to the spatial connection order of the continuous extension path. The local wire diameter corresponding to the next consecutive center position is subtracted from the local wire diameter corresponding to the previous consecutive center position to generate the change in local wire diameter between adjacent consecutive center positions.

[0119] Calculate the two-dimensional pixel Euclidean distance between two adjacent consecutive center positions. Convert the two-dimensional pixel Euclidean distance into the actual spatial spacing according to the scale conversion factor. Under the condition that the actual spatial spacing is greater than 0, divide the local filament diameter change by the actual spatial spacing to generate the filament diameter change trend between adjacent consecutive center positions, and determine it as the filament diameter change trend corresponding to the previous consecutive center position. For the terminating consecutive center position in the nylon filament consecutive center position sequence, determine the filament diameter change trend corresponding to the immediately preceding consecutive center position as the filament diameter change trend corresponding to the terminating consecutive center position. Here, a filament diameter change trend greater than 0 indicates that the local filament diameter gradually increases along the continuous extension path, and a filament diameter change trend less than 0 indicates that the local filament diameter gradually decreases along the continuous extension path.

[0120] The location of the continuous abnormal center is determined based on the wire diameter deviation and the wire diameter change trend. The locations of the continuous abnormal centers that are spatially adjacent are continuously correlated to generate continuous abnormal segments and their corresponding durations.

[0121] In Example 1, based on the spatial connection order of the continuous extension path, the upper quartile and interquartile range of the absolute value of the absolute value of the nylon yarn diameter deviation are calculated according to the absolute value of the diameter deviation corresponding to each continuous center position in the continuous nylon yarn diameter sequence. The sum of the upper quartile of the absolute value of the diameter deviation and 1.5 times the interquartile range is determined as the diameter deviation discrimination threshold.

[0122] Based on the absolute value of the diameter change trend corresponding to each continuous center position in the continuous nylon yarn diameter sequence, the upper quartile and interquartile range of the absolute value of the diameter change trend are calculated. The sum of the upper quartile of the absolute value of the diameter change trend and 1.5 times the interquartile range is determined as the diameter change trend discrimination threshold. The values ​​of the diameter deviation discrimination threshold and the diameter change trend discrimination threshold are both greater than or equal to 0.

[0123] Based on the wire diameter deviation and the corresponding wire diameter change trend corresponding to each continuous center position, if the absolute value of the wire diameter deviation is greater than the wire diameter deviation discrimination threshold or the absolute value of the wire diameter change trend is greater than the wire diameter change trend discrimination threshold, the corresponding continuous center position is determined as an abnormal continuous center position.

[0124] By continuously associating the spatially adjacent continuous center locations of anomalies, the continuously distributed continuous center locations of anomalies are determined as continuous anomaly segments.

[0125] For each continuous anomalous segment, the two-dimensional pixel Euclidean distance between adjacent continuous center positions within the continuous anomalous segment is calculated sequentially according to the spatial connection order of the continuous extension path. The two-dimensional pixel Euclidean distance is then converted into actual spatial distance according to the scale conversion coefficient. The actual spatial distances between adjacent continuous center positions within the continuous anomalous segment are accumulated to generate the continuous length of the corresponding continuous anomalous segment.

[0126] Based on the diameter deviation, diameter change trend and duration of the continuous abnormal sections, the thick sections, thin sections and gradually uneven thickness areas of nylon yarn are classified and judged to generate the classification results of continuous abnormal sections.

[0127] In Example 1, based on the duration of each continuous abnormal segment, the upper quartile and interquartile range of the duration are calculated. The sum of the upper quartile and 1.5 times the interquartile range is determined as the duration discrimination threshold. The duration discrimination threshold is greater than or equal to 0.

[0128] Continuous abnormal segments whose duration reaches the duration discrimination threshold are identified as continuous abnormal segments to be classified, and the abnormality type is classified according to the following rules: Coarse section: The proportion of continuous center positions of positive filament diameter deviation in the continuous abnormal section to be classified is greater than one-half, and the maximum value of the absolute value of the positive filament diameter deviation reaches the filament diameter deviation discrimination threshold. It does not meet the judgment conditions of the gradual uneven thickness area and is identified as a nylon filament coarse section. Details: The proportion of consecutive center positions of negative filament diameter deviation in the continuous abnormal section to be classified is greater than one-half, and the maximum value of the absolute value of negative filament diameter deviation reaches the filament diameter deviation discrimination threshold. It does not meet the judgment conditions of the gradual uneven thickness area and is identified as nylon filament details. Gradual unevenness region: The filament diameter change trend between adjacent continuous center positions in the continuous abnormal segment to be classified maintains the same direction of change, and the absolute value of the filament diameter change trend reaches the filament diameter change trend discrimination threshold. At the same time, the absolute difference between the local filament diameters corresponding to the starting continuous center position and the ending continuous center position of the continuous abnormal segment reaches the filament diameter deviation discrimination threshold. It is determined to be a nylon filament gradual unevenness region.

[0129] Based on the anomaly type classification rules, determine the nylon yarn thick sections, thin sections, or gradually uneven thickness regions corresponding to each continuous anomaly segment to be classified, and generate the continuous anomaly segment classification results.

[0130] Based on the classification results of continuous abnormal sections, the abnormality type, starting continuous center position, ending continuous center position and duration of each continuous abnormal section are determined, and the detection results of uneven thickness of nylon yarn are generated.

[0131] In Example 1, based on the classification results of continuous abnormal sections, for continuous abnormal sections that are determined to be thick sections, thin sections, or gradually uneven thickness areas of nylon filaments, the starting and ending continuous center positions of the corresponding continuous abnormal sections are determined respectively. The abnormality type, starting continuous center position, ending continuous center position, and continuous length are associated one by one according to the spatial connection order of the continuous extension path to generate the nylon filament uneven thickness detection results.

[0132] Example 2: A system for detecting uneven thickness of nylon yarn based on multi-scale image segmentation, comprising: The acquisition module is used to acquire and preprocess continuous imaging images, and generate standardized image sequences and scale calibration. The segmentation module is used to input the standardized image sequence into the improved SegNeXt to extract multi-scale features and perform pixel-level segmentation, generating initial segmentation results and initial edge features; The reference module is used to extract the continuous extension path, center position, local extension direction and local normal direction from the initial segmentation result, and generate the centerline geometric reference. The distance field module is used to determine the initial boundaries on both sides and the spatial distance between the two sides based on the centerline geometric reference, and to generate the centerline distance field by combining continuity, bilateral correspondence and axial variation trend. The correction module is used to generate guiding information from the centerline distance field and fuse the initial edge features to generate corrected bilateral boundaries; The wire diameter module is used to calculate and arrange local wire diameters based on the centerline geometric reference, correct the bilateral boundaries and scale calibration, and generate a continuous wire diameter sequence. The detection module is used to determine the normal filament diameter benchmark from the continuous filament diameter sequence, identify thick sections, thin sections and gradually uneven filament diameter areas based on filament diameter deviation, filament diameter change trend and continuous length, and generate uneven filament diameter detection results.

[0133] Example 3: During the detection of a batch of continuously fed nylon filaments, the imaging device continuously acquires images of the nylon filaments. The original image size is 4096×512 pixels. In the field of view, the nylon filaments generally extend laterally along the image, but are not completely horizontal. Some sections exhibit slight bending and lateral swaying, and some locations show strong reflections and fine fuzz. The implementer first selects images with calibration references for scale calibration. The actual length of the calibration reference is 1 mm. The corresponding pixel lengths in the ten calibration images are 249.7 pixels, 250.2 pixels, 249.9 pixels, 250.5 pixels, 250.1 pixels, 249.8 pixels, 250.4 pixels, 250 pixels, 249.6 pixels, and 250.3 pixels, with an average of approximately 250.05 pixels. Therefore, the actual spatial size corresponding to each pixel is determined to be approximately 0.004 mm / pixel. After continuous images undergo detection region localization and imaging consistency processing, background areas unrelated to nylon fibers are removed from the top and bottom sides without altering the image's horizontal size and pixel scale, resulting in a 4096×320 pixel standardized nylon fiber image sequence. Simultaneously, a nylon fiber image scale calibration result of 0.004 mm / pixel is obtained. In one of the standardized images, the apparent width of the nylon fiber body is approximately 49–52 pixels in most locations. However, in a reflective area, the bright spot extends to one side by about 13 pixels. If measured directly using grayscale thresholding or fixed edges, the apparent width at this location exceeds 64 pixels, potentially leading to misclassification as a thick section.

[0134] The data used to train and improve SegNeXt consists of 6000 standardized images of nylon filaments obtained under the same imaging conditions. Of these, 4200 are used as training samples, 900 as validation samples, and 900 as independent test samples. Among the 4200 training samples, 2220 correspond to normal filament thickness, 680 contain thick sections, 630 contain details, and 670 contain gradually varying filament thickness areas. These categories of samples also retain actual imaging interference, with approximately 970 images showing obvious surface reflections, approximately 560 showing filaments, approximately 730 showing bending or tilting, and approximately 390 showing slight motion blur. Different types of interference can appear simultaneously in the same image. In this embodiment, the manually labeled width of a normal training sample is between 49 and 52 pixels, but the nylon filament as a whole forms a curvature of approximately 6° relative to the horizontal direction of the image; in a coarse section training sample, the normal region width is approximately 50 pixels, while the continuous width of the coarse section region increases to 57-60 pixels; in a gradient training sample, the width of the nylon filament gradually increases from 50 pixels to 58 pixels within approximately 760 consecutive pixels. All training samples have pixel-level annotations on the main nylon filament region, so that the network training objective is not simply to learn the difference in brightness, but to learn the continuous spatial structure of the main nylon filament.

[0135] After training the improved SegNeXt using the training samples, refer to Figures 5-8 In the validation sample, different candidate segmentation probability thresholds were traversed. Based on the comprehensive evaluation results of nylon filament segmentation accuracy and boundary integrity, 0.52 was determined as the segmentation probability threshold. The same standardized nylon filament image was input into the original SegNeXt and the improved SegNeXt for pixel-level segmentation, with the corresponding manually annotated ground truth map as a reference. The standardized image simultaneously contains nylon filament bending regions, weak edge regions, and local abrupt thickness change regions. These three regions were designated as local magnification region 1, local magnification region 2, and local magnification region 3, respectively. The improved SegNeXt outputs a nylon filament main body probability of 0.91–0.98 at most pixel positions within the nylon filament main body, while the nylon filament main body probability in the background region is mainly below 0.1. After processing with the segmentation probability threshold, a continuous nylon filament main body region is formed.

[0136] In the curved position of the magnified area 1, the nylon filament in the manually labeled ground truth extends continuously along the actual curvature. The original SegNeXt segmentation result shows local expansion and contraction at both edges. A point-by-point comparison was performed on 126 consecutive boundary positions in this curved region. In the original SegNeXt, 23 boundary positions deviated from the manually labeled ground truth by more than 2 pixels, with the maximum boundary position deviation being 4.6 pixels and the average boundary position deviation being 1.72 pixels. In the improved SegNeXt, only 7 boundary positions in the same region had deviations exceeding 2 pixels, the maximum boundary position deviation was reduced to 2.8 pixels, and the average boundary position deviation was reduced to 0.83 pixels. The segmented nylon filament remains continuous along the curvature, and the two edges are closer to the manually labeled ground truth.

[0137] In the weak edge region of magnified area 2, due to the reduced grayscale difference between the nylon filament side and the background, the actual subject width corresponding to the manually labeled ground truth is mainly 49-51 pixels. The original SegNeXt outputs a nylon filament subject probability of 0.43-0.61 near the edge in this region, with some real subject edge pixels having a nylon filament subject probability below the segmentation probability threshold of 0.52, causing the segmentation result width to decrease to 44-47 pixels in some locations. The improved SegNeXt, after using nylon filament axial-normal adaptive multi-scale convolutional attention to extract features from this region, increases the nylon filament subject probability at the same real subject edge location to 0.63-0.82, and the segmented subject width remains mainly 48-51 pixels. Comparing 118 bilateral boundary locations in this weak edge region with the manually labeled ground truth, the average boundary position deviation of the original SegNeXt is 1.89 pixels, while the average boundary position deviation of the improved SegNeXt is 0.91 pixels.

[0138] In the abrupt change in thickness in the magnified region 3, the nylon filament gradually transitions from a normal width of approximately 50 pixels to a locally thicker area of ​​approximately 58 pixels before returning to its normal width. The manually labeled ground truth preserves this local thickness variation. The original SegNeXt, affected by its fixed-direction multi-scale feature extraction method at the thickness transition point, exhibits local positional shifts in the segmentation boundary. The measured maximum main body width is approximately 63 pixels, a deviation of about 5 pixels compared to the manually labeled ground truth of 58 pixels. The improved SegNeXt, after performing adaptive feature extraction at scales of 7 pixels, 11 pixels, and 21 pixels along the local axial and normal directions of the nylon filament, preserves the local morphology of the thickness abrupt change region. The maximum main body width obtained is approximately 59 pixels, a difference of about 1 pixel from the manually labeled ground truth width. Comparing 104 consecutive boundary positions in this region, the average boundary position deviation of the original SegNeXt is 1.76 pixels, while the average boundary position deviation of the improved SegNeXt is 0.87 pixels.

[0139] Statistical analysis of the three magnified regions showed that the average boundary position deviation between the original SegNeXt segmentation result and the manually labeled ground truth was 1.79 pixels, while the average boundary position deviation of the improved SegNeXt was 0.87 pixels. The cross-union ratios (CUI) of the main body regions in the original SegNeXt segmentation results were 0.921, 0.903, and 0.914, respectively, while the CUI of the main body regions corresponding to the improved SegNeXt were increased to 0.965, 0.951, and 0.958, respectively. Comparison results from the same standardized image show that the improved SegNeXt can maintain the continuous representation of the main body along the actual extension direction at the bending position of the nylon filament, improve the feature response corresponding to the real edge at weak edge positions, and more completely maintain the actual thickness variation shape at local abrupt changes in thickness, thus generating the initial segmentation result and initial edge features of the nylon filament. At another location with strong reflection in the image, the initial edge feature response near the edge of the real nylon filament is 0.74, while the response of the pseudo-edge formed by the reflection reaches 0.91. This indicates that although the improved SegNeXt improves the stability of subject segmentation and edge feature extraction, local strong reflection may still form a pseudo-edge response higher than the real edge. Therefore, we continue to use the distance field of the nylon filament centerline to perform geometric constraints and boundary correction on the initial edge features of the nylon filament.

[0140] Connectivity analysis was performed on the initial nylon filament segmentation results of the image. The main nylon filament region formed a primary connected region with an area of ​​179,436 pixels, while three isolated smaller regions with areas of 16 pixels, 11 pixels, and 7 pixels respectively existed. After refining each connected region layer by layer, the primary connected region formed a continuous skeleton, with the longest skeleton connection path length being 3,548 pixels. The skeleton lengths corresponding to the other three smaller regions were all less than 15 pixels. Therefore, the skeleton connection path with a length of 3,548 pixels was determined as the continuous extension path of the main nylon filament region. The shortest spatial distance from pixels within the main nylon filament region to non-nylon filament regions was calculated along this continuous extension path, resulting in continuously distributed candidate center positions. After weighted smoothing of adjacent candidate center positions, 3,316 continuous center positions were obtained. Taking the 1638th consecutive center position as an example, its two-dimensional pixel coordinates are 817.3 and 160.4. The coordinates of the adjacent preceding consecutive center position are 816.3 and 160.3, and the coordinates of the adjacent following consecutive center position are 818.3 and 160.5. Based on the coordinate difference between the two consecutive center positions, the local extension direction is approximately 0.995 and 0.1. After rotating this direction counterclockwise by 90 degrees, the local normal direction is approximately -0.1 and 0.995. The same method is used to calculate each of the 3316 consecutive center positions to form the geometric reference for the nylon filament centerline.

[0141] A bidirectional search is performed, starting from each consecutive center position and proceeding along both the local normal direction and the opposite direction. Taking the 1638th consecutive center position as an example, since this position is located in a highly reflective area, the forward spatial distance obtained when transitioning from the nylon filament main body area to the non-nylon filament main body area for the first time along the forward search direction is 39 pixels, while the reverse spatial distance is 25 pixels. The forward and reverse spatial distances corresponding to the previous consecutive center position are 24.8 pixels and 26.9 pixels, respectively, and those for the subsequent consecutive center position are 25.2 pixels and 23.1 pixels, respectively. Therefore, the calculated continuous deviation of the forward spatial distance for the current consecutive center position is approximately 14 pixels, and the continuous deviation of the reverse spatial distance is approximately 1.9 pixels. The corresponding deviation of the bilateral spatial distance between the forward and reverse spatial distances is 14 pixels. Combined with the approximately 2.01 pixel axial spacing between adjacent center positions, the axial change trend of the forward spatial distance is approximately 0.2, and the axial change trend of the reverse spatial distance is approximately -1.89. This set of data differs significantly from normal locations. For example, in the normal region approximately 40 consecutive center positions away from this location, the forward spatial distance is primarily 24.6–25.4 pixels, and the reverse spatial distance is primarily 24.5–25.5 pixels. The consecutive deviations on both sides are typically less than 0.6 pixels, and the corresponding deviations in bilateral spatial distances are typically less than 0.8 pixels. This demonstrates that the centerline distance field can represent the unilateral abrupt increase caused by reflection as a significant bilateral spatial geometric inconsistency, rather than simply accepting 39 pixels as the true radius.

[0142] At the 1638th consecutive center position, the geometric consistency of the bilateral boundaries is calculated to be approximately 0.082 based on the continuous deviations of the forward spatial distance, the continuous deviations of the reverse spatial distance, the corresponding deviations of the bilateral spatial distances, and the axial variation trends of the forward and reverse spatial distances. The geometric consistency of the bilateral boundaries corresponding to the preceding and following consecutive center positions is approximately 0.88 and 0.91, respectively. Based on the weighted average obtained by normalization of these two values, the forward spatial distances of 24.8 pixels and 25.2 pixels corresponding to the preceding and following consecutive center positions are weighted to obtain a forward local reference spatial distance of approximately 25.0 pixels. After the same processing is applied to the reverse spatial distances of 26.9 pixels and 23.1 pixels, a reverse local reference spatial distance of approximately 24.97 pixels is obtained. Using 0.082 as the retention weight for the current bilateral spatial distance and 0.918 as the correction weight for the local reference spatial distance, the fused result is a forward guiding spatial distance of approximately 26.15 pixels and a reverse guiding spatial distance of approximately 24.97 pixels.

[0143] In the forward search direction, a real nylon filament edge exists 25 pixels from the continuous center position, with an initial edge response of 0.74; a pseudo-edge formed by reflection exists 39 pixels from the continuous center position, with an initial edge response of 0.91. Based on the forward guiding spatial distance of 26.15 pixels, after guiding the distance field with one pixel as the exponential decay distance scale, the forward distance field guiding weight at the 25-pixel position is approximately 0.317, and the corresponding edge response modulation coefficient is approximately 0.817, making the guided edge response of this real edge approximately 0.605; the distance from the 39-pixel position differs from the forward guiding spatial distance by approximately 12.85 pixels, and its forward distance field guiding weight is close to 0, with a corresponding edge response modulation coefficient of approximately 0.500, causing the pseudo-edge response, which originally reached 0.91, to decrease to approximately 0.455. Ultimately, although the reflective pseudo-edge had a higher response in the initial edge features, after centerline distance field guidance, the guided response of the real edge (0.605) was higher than that of the pseudo-edge (0.455). Therefore, the positive correction boundary was determined to be approximately 25 pixels from the continuous center position. The real edge distance in the reverse search direction was approximately 25 pixels, which is basically consistent with the reverse guidance spatial distance of 24.97 pixels. The reverse distance field guidance weight was approximately 0.97, and its initial edge response was enhanced from 0.79 to approximately 1.16, ultimately stabilizing as the reverse correction boundary. This process effectively corrected the 39-pixel positive initial boundary affected by reflection back to approximately 25 pixels.

[0144] For the same continuous center position, the pixel coordinates of the positive correction boundary are finally determined to be 815, 185, and the pixel coordinates of the negative correction boundary are 819, 135. The two-dimensional Euclidean distance between the two points is approximately 50.16 pixels. Based on a scale conversion factor of 0.0040 mm / pixel, the actual spatial filament diameter at this position is approximately 0.2006 mm. If the center line distance field correction is not used, and the positive initial boundary formed by reflection is used directly, the pixel distance between the two side boundaries is approximately 64.2 pixels, and the converted local filament diameter is approximately 0.2568 mm. Compared with the normal filament diameter of approximately 0.20 mm, this will create a false positive deviation of more than 0.05 mm, which is very easy to produce false alarms for coarse sections. After calculating each of the 3316 continuous center positions in the same way, the continuous nylon filament diameter sequence corresponding to this image is obtained, in which the local filament diameter of most of the normal section is concentrated between 0.196 and 0.205 mm.

[0145] After sorting the continuous nylon yarn diameter sequence by numerical value, the median was 0.2008 mm, therefore 0.2008 mm was determined as the normal yarn diameter benchmark. The yarn diameter deviation was obtained by subtracting 0.2008 mm from the local yarn diameter at each continuous center position. In the normal section, most yarn diameter deviations were distributed between -0.0045 and 0.0048 mm, while in one thick section, the local yarn diameter was continuously distributed between 0.224 and 0.238 mm, with a corresponding positive yarn diameter deviation of 0.0232 to 0.0372 mm; in another thin section, the local yarn diameter was continuously distributed between 0.166 and 0.178 mm, with a corresponding negative yarn diameter deviation of -0.0348 to -0.0228 mm; and in yet another gradient section, the local yarn diameter continuously increased from 0.201 mm to 0.231 mm.

[0146] Based on the statistical analysis of the absolute values ​​of diameter deviation at all continuous center positions in the continuous nylon yarn diameter sequence, the lower quartile is approximately 0.0017 mm, the upper quartile is approximately 0.0049 mm, and the interquartile range is approximately 0.0032 mm. Therefore, the diameter deviation discrimination threshold is 0.0097 mm. After statistical analysis of the absolute values ​​of diameter change trends at all continuous center positions, the lower quartile is approximately 0.00035, the upper quartile is approximately 0.00105, and the interquartile range is approximately 0.0007. Therefore, the diameter change trend discrimination threshold is approximately 0.0021. Abnormal continuous center positions are screened based on the condition that the absolute value of the diameter deviation is greater than 0.0097 mm or the absolute value of the diameter change trend is greater than 0.0021. Spatially adjacent abnormal continuous center positions are then continuously correlated, resulting in a total of 9 continuous abnormal segments. The durations of six segments were approximately 0.31 mm, 0.44 mm, 0.58 mm, 0.73 mm, 0.91 mm, and 1.26 mm, respectively, mainly originating from short-term edge fluctuations; the durations of the remaining three segments were approximately 2.84 mm, 3.76 mm, and 4.68 mm, respectively. After statistically analyzing the durations of the nine consecutive abnormal segments, the upper quartile was approximately 1.13 mm, and the interquartile range was approximately 0.67 mm. Therefore, the duration discrimination threshold was approximately 2.14 mm. Since none of the aforementioned six short segments met the duration discrimination threshold, they were not included in the final classification of uneven thickness.

[0147] In a continuous abnormal section of 2.84 mm in length to be classified, approximately 86% of the continuous center positions showed positive filament diameter deviation, with a maximum absolute value of 0.0372 mm, exceeding the filament diameter deviation discrimination threshold of 0.0097 mm. Furthermore, the filament diameter variation trend within this section did not maintain a continuous direction, thus failing to meet the criteria for a gradually thickening uneven region and ultimately being identified as a thick nylon filament. In a continuous abnormal section of 3.76 mm in length to be classified, approximately 89% of the continuous center positions showed negative filament diameter deviation, with a maximum absolute value of 0.0348 mm, also exceeding the filament diameter deviation discrimination threshold and failing to meet the criteria for a gradually thickening uneven region; therefore, it was identified as a thin nylon filament. In another continuous anomaly segment with a length of 4.68 mm, the local filament diameter continuously increases from 0.201 mm to 0.231 mm. The filament diameter change trend between adjacent continuous center positions remains positive throughout the main segment. The absolute value of the filament diameter change trend is mainly distributed between 0.0023 and 0.0047, which is higher than the filament diameter change trend discrimination threshold of 0.0021. The absolute difference between the local filament diameter corresponding to the starting and ending continuous center positions is 0.03 mm, which is also higher than the filament diameter deviation discrimination threshold of 0.0097 mm. Therefore, this segment is identified as a gradually varying thickness uneven region. The system finally outputs three valid anomaly segments and associates them with the corresponding anomaly type, starting continuous center position, ending continuous center position, and duration.

[0148] To verify that the above processing was not a random result of a single image, the same method was used to detect 900 independent test images. Manual verification revealed a total of 212 valid areas of uneven thickness, including 72 coarse sections, 68 fine sections, and 72 gradient-type areas of uneven thickness. Using the traditional method of fixed grayscale threshold, edge extraction, and fixed image orientation width measurement, 152 abnormal areas were correctly identified, 60 were missed, and 37 false positives were generated. Using the original SegNeXt without the adaptive width measurement of this invention for segmentation and direct fixed orientation width measurement, 185 abnormal areas were correctly identified, 27 were missed, and 22 false positives were generated. Using the method of this invention, 202 abnormal areas were correctly identified, 10 were missed, and only 8 false positives were generated. After conversion, the accuracy of the traditional method for identifying abnormal regions is about 80.4% and the recall rate is about 71.7%, the accuracy of the original SegNeXt method is about 89.4% and the recall rate is about 87.3%, and the accuracy of the method of this invention is about 96.2% and the recall rate is about 95.3%.

[0149] From 900 test images, 240 images containing obvious reflections, fuzz, or bends were further extracted for point-by-point boundary checks. The average boundary position error of the traditional method was approximately 2.86 pixels, the original SegNeXt method was approximately 1.61 pixels, and the method of this invention was approximately 0.79 pixels; the corresponding average local filament diameter absolute errors were approximately 11.5 μm, 6.4 μm, and 3.2 μm, respectively. In a strongly reflective area similar to the aforementioned 1638th consecutive center position, the traditional method repeatedly used the outer edge of the reflective area as the actual boundary, measuring a false thick filament diameter of 0.248–0.263 mm, while the actual image width conversion result of manually annotated corresponding positions was mainly 0.198–0.204 mm; after centerline distance field correction, the local filament diameter measured at the same position by this invention was mainly 0.199–0.205 mm.

[0150] The above description is only a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any equivalent substitutions or modifications made by those skilled in the art within the scope of the technology disclosed in the present invention, based on the technical solution and inventive concept of the present invention, should be covered within the scope of protection of the present invention.

Claims

1. A method for detecting uneven thickness of nylon filaments based on multi-scale image segmentation, characterized in that, include: Acquire continuous imaging images and perform preprocessing to obtain a standardized image sequence of nylon filament. At the same time, perform scale mapping to generate nylon filament image scale calibration. The normalized image sequence of nylon yarn is input into the improved SegNeXt. After depth convolution and axial-normal orientation mapping, the fixed strip convolution is converted into orientation-adaptive multi-scale convolution. The axial and normal strip features are fused and decoded to generate the initial segmentation result and initial edge features. Based on the initial segmentation results of the nylon filament, the continuous extension path of the main body region of the nylon filament is determined, and the center position of the continuous extension path is extracted to generate the geometric reference of the center line of the nylon filament. Based on the geometric reference of the nylon filament centerline, the initial boundaries on both sides of the nylon filament are determined at each centerline position along the corresponding local normal direction. The bilateral spatial distance from each centerline position to the initial boundaries on both sides is calculated, and the nylon filament centerline distance field is generated. The geometric consistency of the bilateral boundaries corresponding to each centerline position is determined based on the centerline distance field of the nylon filament. Centerline distance field guidance information is generated based on the geometric consistency of the bilateral boundaries. The centerline distance field guidance information is fused with the initial edge features of the nylon filament to generate the corrected bilateral boundaries of the nylon filament. Based on the geometric reference of the nylon filament centerline and the corrected double-sided boundary of the nylon filament, the actual filament diameter is calculated along the local normal and arranged in the order of the centerline to generate a continuous nylon filament diameter sequence. The normal filament diameter benchmark is determined based on the continuous filament diameter sequence of nylon filament. Thick spots, thin spots, and gradual thickness unevenness are identified by filament diameter deviation, change trend, and continuous length, and test results are generated.

2. The method for detecting uneven thickness of nylon filaments based on multi-scale image segmentation according to claim 1, characterized in that, The acquisition and preprocessing of continuous imaging images to obtain a standardized image sequence of nylon filaments includes: An industrial camera is used to continuously acquire original images containing the nylon filaments to be detected in a continuously conveying state, according to a manually set image acquisition frequency. Based on the location of the detection area, the nylon filament detection area is extracted from the original imaging image, and brightness correction, background suppression and image scale unification are performed on the nylon filament detection area to generate a standardized nylon filament image sequence. Based on a calibration reference set within the imaging field of view of an industrial camera and whose actual size is known, the pixel size corresponding to the calibration reference is determined. According to the correspondence between the actual size and the pixel size, a scale mapping relationship between the image pixel size and the actual spatial size is established to generate the nylon filament image scale calibration.

3. The method for detecting uneven thickness of nylon filaments based on multi-scale image segmentation according to claim 2, characterized in that, The step of inputting the nylon filament normalized image sequence into the improved SegNeXt includes: The normalized image sequence of nylon filament is input into the improved SegNeXt and then subjected to a 5×5 depth convolution to generate local spatial features of nylon filament. Based on the local spatial features of nylon filament, the channel features are oriented and mapped to generate the local axial direction and local normal direction of nylon filament. Based on the local axial direction and local normal direction of nylon filament, the fixed strip convolution is converted into direction-adaptive convolution to generate axial strip spatial features and normal strip spatial features. By integrating the spatial features of axial and normal stripes at various scales, superimposing the local spatial features of nylon filaments, and performing a one-to-one pointwise convolution, multi-scale visual features of nylon filaments are generated. The multi-scale visual features of nylon filaments are decoded and fused using an improved SegNeXt method and mapped to the pixel space to generate the initial segmentation result of nylon filaments. Based on the initial segmentation results of nylon filament, pixel-level spatial transition positions are determined, corresponding multi-scale fusion features are extracted, and non-transition position responses are suppressed to generate initial edge features of nylon filament.

4. The method for detecting uneven thickness of nylon filaments based on multi-scale image segmentation according to claim 3, characterized in that, The step of determining the continuous extension path of the main body region of the nylon filament based on the initial segmentation result of the nylon filament, and extracting the center position of the continuous extension path, includes: Based on the initial segmentation results of the nylon filament, a connectivity analysis is performed on the main region of the nylon filament to determine the continuous extension path of the main region of the nylon filament. The shortest spatial distance from each pixel within the nylon filament body region to the non-nylon filament body region is calculated based on the continuous extension path. The candidate center position is determined based on the shortest spatial distance, and the candidate center positions are smoothed and sequentially associated to generate a continuous nylon filament center position sequence. Based on the continuous center position sequence of nylon filament, the local extension direction of nylon filament corresponding to each continuous center position is determined according to the two-dimensional pixel coordinate changes of adjacent continuous center positions. Based on the local extension direction of the nylon filament, the corresponding local normal direction is determined. The continuous center position sequence of the nylon filament, the local extension direction of the nylon filament, and the local normal direction are spatially correlated to generate the geometric reference of the nylon filament centerline.

5. The method for detecting uneven thickness of nylon filaments based on multi-scale image segmentation according to claim 4, characterized in that, The method of determining the initial boundaries on both sides of the nylon filament based on the geometric reference of the nylon filament centerline along the corresponding local normal direction at each centerline position includes: Based on the geometric reference of the nylon filament centerline, a two-way spatial search is performed at each continuous center position along the corresponding local normal direction to determine the initial boundaries on both sides of the nylon filament at each continuous center position. Based on each continuous center position and the corresponding initial boundaries on both sides of the nylon filament, calculate the forward spatial distance and the reverse spatial distance respectively, and generate the bilateral spatial distance corresponding to each continuous center position; Based on the bilateral spatial distances corresponding to each continuous center position, the continuity of bilateral spatial distances between adjacent continuous center positions, the bilateral correspondences corresponding to the same continuous center position, and the axial variation trend of bilateral spatial distances along the continuous extension path are determined respectively. According to the spatial connection order of the continuous extension path, the spatial positions of each continuous center position in the continuous center position sequence of nylon yarn are associated one by one with the spatial distance between the two sides, the continuity of the spatial distance between the two sides, the correspondence between the two sides and the trend of axial change, so as to generate the nylon yarn centerline distance field.

6. The method for detecting uneven thickness of nylon filaments based on multi-scale image segmentation according to claim 5, characterized in that, The determination of the geometric consistency of the bilateral boundaries corresponding to the positions of each centerline based on the distance field of the nylon filament centerline includes: Based on the distance field of the nylon filament centerline, combined with the continuous deviation of the forward spatial distance, the continuous deviation of the reverse spatial distance, the corresponding deviation of the bilateral spatial distance, and the axial change trend of the forward spatial distance and the axial change trend of the reverse spatial distance, the geometric consistency of the bilateral boundaries corresponding to the continuous center position is determined. Based on the geometric consistency of the bilateral boundaries corresponding to each continuous center position, the forward spatial distance and reverse spatial distance corresponding to adjacent continuous center positions are weighted according to consistency to generate the forward local reference spatial distance and the reverse local reference spatial distance. Based on the geometric consistency of the two-sided boundaries, the two-sided spatial distance, the positive local reference spatial distance, and the negative local reference spatial distance are fused to generate positive guidance spatial distance, negative guidance spatial distance, and centerline distance field guidance information; The centerline distance field guidance information is fused with the initial edge features of the nylon filament to generate the double-sided guided edge response of the nylon filament; Based on the edge response of the nylon yarn on both sides, the positive and negative correction boundaries corresponding to each continuous center position are determined, and the nylon yarn correction boundary is generated.

7. The method for detecting uneven thickness of nylon filaments based on multi-scale image segmentation according to claim 6, characterized in that, The calculation of the actual yarn diameter along the local normal, based on the geometric reference of the nylon yarn centerline and the corrected bilateral boundaries of the nylon yarn, and arranged in order of the centerline, includes: Based on the geometric reference of the nylon filament centerline and the double-sided boundary of the nylon filament correction, the spatial position of each continuous center position is associated with the corresponding positive correction boundary and reverse correction boundary to determine the position of the two sides of the boundary corresponding to each continuous center position. Based on the corresponding two-sided boundary positions, calculate the two-dimensional pixel Euclidean distance between the positive correction boundary and the negative correction boundary, and generate the two-sided boundary pixel distances corresponding to each continuous center position. Based on the nylon filament image scale calibration results, the pixel distance between the two side boundaries corresponding to each continuous center position is converted into the actual spatial distance and determined as the local filament diameter of the corresponding continuous center position; Arrange the local filament diameters at each continuous center position according to the spatial connection order of the continuous extension path to generate a continuous nylon filament diameter sequence.

8. The method for detecting uneven thickness of nylon filaments based on multi-scale image segmentation according to claim 7, characterized in that, The determination of the normal yarn diameter benchmark based on the continuous yarn diameter sequence of nylon yarn includes: Based on the continuous nylon yarn diameter sequence, the normal yarn diameter benchmark is determined, and the yarn diameter deviation corresponding to each continuous center position is calculated. Based on the continuous nylon yarn diameter sequence, the local diameter variation and actual spatial spacing between adjacent continuous center positions are calculated to generate the diameter variation trend between adjacent continuous center positions. The location of the continuous abnormal center is determined based on the wire diameter deviation and the wire diameter change trend. The locations of the continuous abnormal centers that are spatially adjacent are continuously correlated to generate continuous abnormal segments and their corresponding durations. Based on the filament diameter deviation, filament diameter change trend and duration of the continuous abnormal section, the thick section, thin section and the gradually uneven thickness area of ​​nylon filament are classified and judged to generate the classification result of continuous abnormal section. Based on the classification results of continuous abnormal sections, the abnormality type, starting continuous center position, ending continuous center position and duration of each continuous abnormal section are determined, and the detection results of uneven thickness of nylon yarn are generated.

9. The method for detecting uneven thickness of nylon filaments based on multi-scale image segmentation according to claim 8, characterized in that, The classification results of the continuous abnormal segments include: Coarse section: The proportion of continuous center positions of positive filament diameter deviation in the continuous abnormal section to be classified is greater than one-half, and the maximum value of the absolute value of the positive filament diameter deviation reaches the filament diameter deviation discrimination threshold. It does not meet the judgment conditions of the gradual uneven thickness area and is identified as a nylon filament coarse section. Details: The proportion of consecutive center positions of negative filament diameter deviation in the continuous abnormal section to be classified is greater than one-half, and the maximum value of the absolute value of negative filament diameter deviation reaches the filament diameter deviation discrimination threshold. It does not meet the judgment conditions of the gradual uneven thickness area and is identified as nylon filament details. Gradual unevenness region: The filament diameter change trend between adjacent continuous center positions in the continuous abnormal segment to be classified maintains the same direction of change, and the absolute value of the filament diameter change trend reaches the filament diameter change trend discrimination threshold. At the same time, the absolute difference between the local filament diameters corresponding to the starting continuous center position and the ending continuous center position of the continuous abnormal segment reaches the filament diameter deviation discrimination threshold. It is determined to be a nylon filament gradual unevenness region.

10. A system for detecting uneven thickness of nylon filaments based on multi-scale image segmentation, used to execute the method for detecting uneven thickness of nylon filaments based on multi-scale image segmentation as described in any one of claims 1-9, characterized in that, include: The acquisition module is used to acquire and preprocess continuous imaging images, and generate standardized image sequences and scale calibration. The segmentation module is used to input the standardized image sequence into the improved SegNeXt to extract multi-scale features and perform pixel-level segmentation, generating initial segmentation results and initial edge features; The reference module is used to extract the continuous extension path, center position, local extension direction and local normal direction from the initial segmentation result, and generate the centerline geometric reference. The distance field module is used to determine the initial boundaries on both sides and the spatial distance between the two sides based on the centerline geometric reference, and to generate the centerline distance field by combining continuity, bilateral correspondence and axial variation trend. The correction module is used to generate guiding information from the centerline distance field and fuse the initial edge features to generate corrected bilateral boundaries; The wire diameter module is used to calculate and arrange local wire diameters based on the centerline geometric reference, correct the bilateral boundaries and scale calibration, and generate a continuous wire diameter sequence. The detection module is used to determine the normal filament diameter benchmark from the continuous filament diameter sequence, identify thick sections, thin sections and gradually uneven filament diameter areas based on filament diameter deviation, filament diameter change trend and continuous length, and generate uneven filament diameter detection results.