A cashmere wool microscopic image component detection method and system

CN122385595BActive Publication Date: 2026-09-11HEBEI PROVINCIAL INST OF PROD QUALITY SUPERVISION & INSPECTION
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202610864203.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2026-06-16
Publication Date
2026-09-11
Estimated Expiration
2046-06-16

AI Technical Summary

Technical Problem

[0010]本发明的目的,是要提供一种羊绒羊毛显微图像成分检测方法,通过设计模型架构与优化图像处理流程,在显著提升纤维类别识别精度的同时,实现模型的高度轻量化,使得检测系统能够在普通硬件环境下实时、准确、自动化地完成从图像采集到国标报告生成的全流程,解决了现有技术中存在的质检主观性强、一致性差、深度学习模型误检漏检率高以及硬件依赖严重的技术问题;

Benefits of technology

[0058]本发明由于采用了上述的技术方案,其与现有技术相比,所取得的技术进步在于:

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122385595B_ABST
    Figure CN122385595B_ABST
Patent Text Reader

Abstract

The present application belongs to the technical field of automatic detection of textile fibers, and specifically discloses a cashmere and wool microscopic image component detection method and system. The method disclosed by the present application comprises: collecting microscopic images and optimizing quality, proposing an FGD-YOLO model: embedding a FreqBlock module in the backbone network to enhance frequency domain features, introducing a DTSM module at the neck P3 / 8 layer to adaptively select dense / sparse textures, and replacing the original convolution module with a Ghost-PANet lightweight fusion network; the FGD-YOLO identifies fiber categories and masks, counts and measures diameters using the orthogonal skeleton method, and calculates component indicators according to national standards after cycle accumulation and setting of a threshold. The present application significantly reduces the false detection rate and the missed detection rate, and the model parameter quantity is only 2.67M, which can be run in real time on a general CPU, realizing full-process automatic detection. The present application can be widely applied to the detection of cashmere and wool.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of automatic detection technology of textile fibers, and specifically relates to a method and system for detecting the composition of cashmere and wool microscopic images. Background Technology

[0002] The identification and compositional analysis of cashmere and wool are core aspects of quality inspection in the textile industry, directly impacting textile grading, trade settlement, and brand reputation. Because cashmere and wool fibers share similar biological origins, both being composed of keratin, their microscopic morphological characteristics are extremely similar, with the main differences lying only in subtle details such as the thickness, spacing, covering morphology, and edge tilt angle of the surface scales. Currently, mainstream testing methods both domestically and internationally still heavily rely on professional inspectors conducting manual visual inspections, measurements, and counts under optical microscopes. However, this traditional method has several inherent problems: firstly, inspectors need to observe hundreds or thousands of fibers under a microscope for extended periods, resulting in extremely heavy workloads and visual fatigue; secondly, test results are highly dependent on individual experience, with poor consistency and repeatability between different inspectors, and even among the same inspector at different times; and thirdly, manual testing is inefficient, failing to meet the demands of the modern textile industry for high-throughput, real-time quality inspection.

[0003] To overcome the limitations of manual testing, the industry has attempted to introduce auxiliary identification methods, such as near-infrared spectroscopy (NIR) and Raman spectroscopy for chemical composition analysis. Theoretically, the molecular vibrational spectra of different fibers differ, which can be used for differentiation. However, in practical applications, because cashmere and wool have highly similar chemical compositions, their spectral characteristics differ extremely slightly and are easily obscured by factors such as sample moisture content, ambient temperature and humidity, residual chemicals from pretreatment, or impurities. Furthermore, high-precision spectroscopic analysis equipment is expensive and has stringent environmental requirements, making it difficult to widely adopt and promote in resource-constrained settings such as production workshops and grassroots quality inspection stations.

[0004] With the development of computer vision technology, machine vision detection methods based on traditional image processing have emerged. These methods typically attempt to identify fibers by combining hand-designed features (such as texture, Histogram of Oriented Gradients (HOG), Local Binary Patterns (LBP), etc.) with classifiers such as Support Vector Machines (SVM). However, the widespread problems in fiber microscopic images, such as overlapping, background noise, uneven illumination, and defocusing, make accurate image segmentation and robust feature extraction extremely difficult. Traditional methods also have poor generalization ability, require extremely high sample quality, and struggle to meet the stability requirements of industrial applications.

[0005] In recent years, deep learning methods, represented by convolutional neural networks (CNNs), have achieved great success in image recognition and have also been introduced into fiber recognition research. Some studies have achieved high classification accuracy on standard datasets. However, existing deep learning solutions still face the following prominent technical bottlenecks:

[0006] First, most studies overemphasize mean accuracy (mAP) while neglecting the false positive rate and false negative rate, which are crucial in real-world industrial scenarios. For example, misidentifying a wool strand as cashmere or missing a cashmere strand can lead to significant deviations in the final percentage composition calculation, resulting in economic losses.

[0007] Second, existing high-performance deep learning models (such as Transformer-based detectors or large-scale YOLO variants) have a huge number of parameters (often tens or even hundreds of megabytes), high computational complexity, and rely heavily on servers or workstations equipped with high-performance graphics processing units (GPUs) for runtime. This makes it difficult to integrate detection systems into portable terminal devices or deploy them in production sites with limited power and space, thus limiting the widespread adoption of the technology.

[0008] Third, the general detection model has not been optimized for the domain-specific prior knowledge of cashmere and wool fibers, which have "subtle texture differences and long, curved shapes". This results in the model being inefficient in extracting high-frequency texture details and low-frequency structural information, and there is a phenomenon of "overcapacity" or "capacity mismatch".

[0009] In conclusion, developing a microscopic image component detection method that can balance high recognition accuracy and extremely low false positive / false negative rates, while also possessing lightweight model characteristics to reduce reliance on high-performance GPUs, has become an urgent technological need for promoting the intelligent transformation of the textile quality inspection industry. Summary of the Invention

[0010] The purpose of this invention is to provide a method for detecting the composition of cashmere and wool microscopic images. By designing a model architecture and optimizing the image processing flow, the accuracy of fiber category identification is significantly improved while the model is highly lightweight. This enables the detection system to complete the entire process from image acquisition to national standard report generation in real time, accurately and automatically under ordinary hardware conditions. This solves the technical problems of strong subjectivity in quality inspection, poor consistency, high false detection and false negative rates of deep learning models, and serious hardware dependence in the existing technology.

[0011] The second objective of this invention is to provide a cashmere and wool microscopic image composition detection system for implementing the aforementioned cashmere and wool microscopic image composition detection method.

[0012] To achieve the above objectives, the technical solution adopted by this invention is as follows:

[0013] A method for component detection in microscopic images of cashmere and wool, the method comprising the following steps performed sequentially:

[0014] S1. Use a microscopic vision system to acquire microscopic images of cashmere and wool fiber test sample slides one by one and optimize the image quality.

[0015] S2. Use the FGD-YOLO model to identify the fiber type of the optimized microscopic image and generate a mask image;

[0016] The FGD-YOLO model is an improvement on the YOLOv11-seg model, including three improvements:

[0017] Improvement 1: Introduce the FreqBlock module into the backbone network and embed it as a residual behind each stage of the YOLOv11-seg backbone network;

[0018] Improvement 2: Introduce the Dual Texture Selection Module (DTSM) in the key layer of feature extraction to model dense and sparse textures separately and adaptively fuse them;

[0019] Improvement 3: Replace the feature fusion structure of the original neck network with Ghost-PANet, and replace the original convolutional module with C3Ghost module on the basis of PANet bidirectional path structure;

[0020] S3. Based on the mask image, record and accumulate the number of cashmere and wool fibers in the image, and use the orthogonal skeleton method to calculate the fiber diameter.

[0021] S4. Repeatedly accumulate the number of fibers. Stop accumulating when the total number of fibers is not less than the set threshold.

[0022] S5. Calculate the average diameter, standard deviation, and mass percentage of this batch of fibers according to national standards.

[0023] As a limitation, the image quality optimization in step S1 specifically includes:

[0024] Convert the color image from the BGR color space to the LAB color space to obtain the luminance component L and color components a and b.

[0025] The contrast-limited adaptive histogram equalization (CLAHE) is applied to the luminance component L, where the contrast limit threshold T_clip ranges from 1.5 to 4.0, and the grid size S_grid ranges from 4×4 to 16×16.

[0026] Adaptive weighted sharpening is performed using Unsharp Mask (USM) technology, and the calculation formula is as follows:

[0027]

[0028] In the formula: To preprocess the output image; The image is enhanced using CLAHE. This represents the result of performing Gaussian blur on the enhanced image; The standard deviation of the Gaussian kernel. and For the weighting coefficients, satisfying and , This is a bias term.

[0029] As a second limitation, in the improvement point 1, the FreqBlock module is inserted after each C3k2 module of the backbone network, and the backbone network contains four stages from P2 to P5.

[0030] The calculation process of the FreqBlock module includes:

[0031]

[0032]

[0033]

[0034] In the formula, For the input feature map, The frequency domain representation of the input feature map after Fast Fourier Transform. For global average pooling, It is a lightweight feature transformation function. For normalization function, For the frequency domain weights generated through channel attention, For element-wise multiplication, For feature reconstruction mapping function, This refers to the output characteristics of FreqBlock.

[0035] As a third limitation, in improvement point 2, the DTSM module is introduced into the intermediate scale feature layer P3 / 8 of the feature pyramid, which is the 21st layer of the YOLOv11-seg network.

[0036] The output calculation formula of the DTSM module is as follows:

[0037] In the formula, For input features, For high-frequency texture extraction operators, For low-frequency texture extraction operators, and For input features Adaptive selection weights generated from global statistics.

[0038] As a fourth limitation, in improvement point 3, Ghost-PANet uses the C3Ghost module at a total of 4 feature fusion nodes in the bidirectional feature fusion path from top to bottom and from bottom to top.

[0039] The C3Ghost module is built based on Ghost convolution, which decomposes standard convolution into two stages: intrinsic feature generation and inexpensive linear transformation.

[0040] As a fifth limitation, the calculation of fiber diameter using the orthogonal skeleton method in step S3 specifically includes:

[0041] Morphological optimization of the fiber segmentation mask output by the FGD-YOLO model is performed to obtain a binarized mask M;

[0042] The Chag parallel thinning algorithm and similar skeletonization operators are used to extract the single-pixel skeleton lines of the mask M, and m pixels at each end of the skeleton lines are cropped to obtain the effective skeleton point set. ;

[0043] For each sampling point in the skeleton point set Calculate its tangent direction and derive the normal equation, then detect the two intersection points with the fiber edge along the normal direction. and ;

[0044] Calculate the Euclidean distance between two intersection points as the pixel diameter. And combined with the calibrated pixel equivalent Calculate the actual physical diameter ;

[0045] The final diameter of a single fiber is obtained by taking the arithmetic mean of the diameters of all sampling points on the fiber after outlier suppression. In the formula, This represents the total number of valid sampling points.

[0046] As a sixth limitation, the formulas for calculating the average diameter, standard deviation, and mass percentage in step S5 include:

[0047]

[0048]

[0049]

[0050] In the formula, The average diameter of the fiber. The midpoint of the group. To measure the number of roots, Standard deviation This refers to the number of fibers in a certain component. The average diameter of a certain component fiber. The standard deviation of the average diameter of a certain component fiber This represents the density of a certain component of the fiber.

[0051] A cashmere and wool microscopic image composition detection system is used to implement the above-mentioned cashmere and wool microscopic image composition detection method, including: an image acquisition module, an image preprocessing module, an FGD-YOLO model inference module, a counting and measurement module, a loop control module, and a composition calculation module;

[0052] The image acquisition module is used to control the microscopic vision system to acquire microscopic images of the sample slides and output the acquired raw microscopic image data to the image preprocessing module.

[0053] The image preprocessing module, whose input is connected to the output of the image acquisition module, is used to receive the original microscopic image data and sequentially perform color space conversion, CLAHE enhancement and USM sharpening to generate enhanced microscopic image data, which is then transmitted to the FGD-YOLO model inference module.

[0054] The FGD-YOLO model inference module has its input connected to the output of the image preprocessing module. It internally loads pre-trained FGD-YOLO model weights to infer the received enhanced microscopic image data, identify cashmere and wool fibers in the image, and generate corresponding bounding box data and segmentation mask data. The module's first output sends the bounding box data to the counting and measurement module, and its second output sends the segmentation mask data to the counting and measurement module.

[0055] The counting and measurement module receives bounding box data from the FGD-YOLO model inference module at its first input terminal, and uses this data to parse the category labels in the bounding box to update the cashmere counter or wool counter and obtain the counting result. Its second input terminal receives segmentation mask data from the FGD-YOLO model inference module, and uses this data to calculate the diameter of each fiber using the orthogonal skeleton method to obtain the diameter measurement result. This module outputs the counting result and the diameter measurement result to the loop control module and the composition calculation module.

[0056] The loop control module, whose input is connected to the output of the counting and measurement module, is used to receive the current cashmere count, wool count, and total fiber count, and determine whether the total fiber count has reached a set threshold. When the set threshold has not been reached, the module sends a control signal to the image acquisition module to move the field of view and continue acquisition. When the threshold is reached, the module sends an interrupt signal to the composition calculation module to trigger the calculation.

[0057] The component calculation module has its input terminals connected to the output terminals of the counting and measurement module and the trigger signal output terminal of the cycle control module, respectively. After receiving the interrupt signal, it reads the final counting result and diameter measurement result from the counting and measurement module, calculates the average diameter, standard deviation and fiber mass percentage according to national standards, and outputs the final test report.

[0058] The present invention, by adopting the above-described technical solution, achieves the following technical advancements compared to existing technologies:

[0059] (1) The method of the present invention constructs an end-to-end cashmere and wool composition detection scheme through the fully automated steps of image acquisition optimization, FGD-YOLO model recognition, counting and diameter measurement, cyclic accumulation and national standard calculation. Without the need for manual intervention, it can simultaneously achieve high recognition accuracy, extremely low false detection and false negative rate and lightweight model, and completely solve the comprehensive technical problems of strong subjectivity of traditional manual detection, poor robustness of traditional machine vision and high hardware dependence of existing deep learning models.

[0060] (2) In the image quality optimization stage, the method of the present invention decouples brightness and color by converting from BGR to LAB color space, so that subsequent texture enhancement acts independently on the brightness channel without producing color shift; by using the CLAHE algorithm and optimizing the contrast limit threshold and grid size, the contrast of the fiber scale layer is enhanced while effectively suppressing the noise amplification problem caused by global equalization; by using USM adaptive weighted sharpening and optimizing the weighting coefficients, the microscopic differences between cashmere and wool in the scale layer structure are further highlighted; the preprocessing process combining the three provides a more discriminative input image for the subsequent deep learning model, thereby improving the recognition accuracy and robustness without increasing the model burden;

[0061] (3) The method of this invention embeds the FreqBlock module in a residual manner after each C3k2 module of the backbone network (four stages from P2 to P5), maps the features to the frequency domain through fast Fourier transform, generates frequency domain weights using channel attention mechanism to adaptively enhance or suppress each frequency component, and then restores the spatial domain through inverse Fourier transform and fuses it with the original feature residuals. This allows the backbone network to recalibrate features at the global frequency level, effectively enhancing the extraction capability of high-frequency texture details and low-frequency structural information. The residual connections ensure gradient flow and preservation of original information. Compared with pure spatial domain convolution, FreqBlock significantly improves the characterization and discriminative power of fiber micrographs with minimal computational overhead.

[0062] (4) The method of the present invention precisely introduces the DTSM module into the intermediate scale feature layer P3 / 8 (the 21st layer of YOLOv11-seg) of the feature pyramid. This scale balances local details and global semantics, enabling the network to dynamically adjust the feature extraction strategy according to the texture characteristics of the local area of ​​the image, thereby significantly improving the discrimination accuracy of easily confused fibers and directly reducing the false detection rate and false negative rate in actual industrial applications.

[0063] (5) The method of the present invention replaces the PANet structure of the neck network with Ghost-PANet, and adopts the C3Ghost module at four key nodes in the bidirectional feature fusion path from top to bottom and from bottom to top. While maintaining or even enhancing the feature expression ability, it significantly reduces the computational amount and parameter amount of the model, and lowers the deployment cost and threshold.

[0064] (6) The method of the present invention uses the orthogonal skeleton method to measure fiber diameter. Through a series of operations such as morphological optimization of the segmentation mask, single-pixel skeleton extraction and end clipping, detection of intersection points of normal direction edges, Euclidean distance calculation and outlier suppression, the sub-pixel level accurate diameter measurement is achieved. Compared with the traditional manual measurement or simple minimum bounding rectangle method, it has higher accuracy, repeatability and robustness, and provides a reliable diameter data basis for subsequent national standard component calculation.

[0065] This invention belongs to the field of automatic textile fiber detection technology. By designing a model architecture and optimizing the image processing flow, it significantly improves the accuracy of fiber category identification while achieving a highly lightweight model. This enables the detection system to complete the entire process from image acquisition to national standard report generation in real time, accurately and automatically under ordinary hardware conditions. It solves the technical problems of strong subjectivity in quality inspection, poor consistency, high false detection and false negative rates of deep learning models, and serious hardware dependence in the existing technology. Attached Figure Description

[0066] The accompanying drawings are provided to further illustrate the invention and form part of the specification. They are used together with the embodiments of the invention to explain the invention and do not constitute a limitation thereof.

[0067] In the attached diagram: Figure 1 This is a flowchart of the processing in Embodiment 1 of the present invention; Figure 2 This is a display image of a microscopic image after quality optimization in Embodiment 1 of the present invention; Figure 3 for Figure 2 The recognition effect is shown in the figure; Figure 4 This is a network architecture diagram of the FGD-YOLO model in Embodiment 1 of the present invention; Figure 5 This is a schematic diagram of the DTSM module in Embodiment 1 of the present invention; Figure 6 for Figure 3 Mask extraction display diagram; Figure 7 for Figure 6 Diameter measurement display diagram; Figure 8 This is a system structure block diagram of Embodiment 2 of the present invention. Detailed Implementation

[0068] The preferred embodiments of the present invention will now be described with reference to the accompanying drawings. It should be understood that the preferred embodiments described herein are for illustrative and explanatory purposes only and are not intended to limit the scope of the invention.

[0069] Example 1

[0070] like Figure 1 As shown, this embodiment is a method for detecting the composition of cashmere and wool microscopic images. The method includes the following steps performed sequentially:

[0071] S1. Use a microscopic vision system to acquire microscopic images of cashmere and wool fiber test samples one by one and optimize the image quality.

[0072] In this embodiment, an optical microscopic vision system equipped with a digital camera is used to acquire microscopic images of cashmere and wool fiber sample slides (prepared using a standard Hastelloy slicer) field by field, with an objective magnification of 500x and a numerical aperture (NA) of 0.75. The camera output image format is BGR, and the resolution is uniformly 768×576 pixels.

[0073] To maximize the preservation and enhancement of the microscopic morphological differences between cashmere and wool fibers, the following sequential quality optimization operations were performed on the original images:

[0074] Using the `cvtColor` function from the OpenCV library, the original BGR image is converted to the LAB color space to obtain the luminance component L and color components a and b. Through decoupling, the surface feature contrast can be independently enhanced without altering the fiber's inherent color information.

[0075] Contrast-limited adaptive histogram equalization (CLAHE) is applied to the luminance component L. In this embodiment, the contrast limit threshold T_clip is set to 2.5, and the grid size S_grid is set to 8×8. The CLAHE algorithm divides the image into non-overlapping sub-regions, performs histogram equalization on each sub-region, and redistributes pixels exceeding the threshold, thereby avoiding the over-amplification of noise caused by global equalization and highlighting the scale layer on the fiber surface. It should be noted that the contrast limit threshold and grid size can be modified according to the actual situation, as long as the contrast limit threshold T_clip is within the range of 1.5 to 4.0, and the grid size S_grid is between 4×4 and 16×16.

[0076] Unsharpened Masking (USM) technology is used, employing a 3×3 minimal Gaussian kernel to smooth the image and obtain G. Finally, sharpening is achieved through linear weighted fusion. The calculation formula is as follows:

[0077]

[0078] In the formula: To preprocess the output image; The image is enhanced using CLAHE. This represents the result of performing Gaussian blur on the enhanced image; The standard deviation of the Gaussian kernel. and For the weighting coefficients, satisfying and , This is the bias term. In this embodiment, the standard deviation of the Gaussian kernel is 1.0. It is 1.3. It is -0.3. It is 0.

[0079] like Figure 2 As shown, without changing the inherent color of the fibers, the microscopic differences in the scale layer structure between cashmere and wool are highlighted.

[0080] S2. Use the FGD-YOLO model to identify the fiber type of the optimized microscopic image and generate a mask image.

[0081] A cashmere and wool microscopic image dataset was constructed: Sufficient fiber microscopic images were acquired using an optical microscope combined with a cashmere and wool microscopic image synchronous component detection system. The acquired images were uniformly set to 768×576 resolution. After quality optimization, the images were divided into cashmere and wool categories. The dataset was divided into training, testing, and validation sets in an 8:1:1 ratio. The LabelMe image annotation tool was used to perform multi-point annotation on the images, segmenting the fiber contour regions using this method, such as... Figure 3 As shown. Cashmere is labeled "rong", and wool is labeled "mao". After annotation, the generated JSON data is converted into TXT format data that the YOLO model can recognize.

[0082] Environment configuration: Download the official source code of the YOLOv11-seg model from GitHub, create a virtual environment using Anaconda, and install the following dependencies according to the YOLO source code requirements file: matplotlib ≥ 3.2.2, numpy ≥ 1.18.5, opencv-python ≥ 4.1.1, PyYAML ≥ 5.3.1, torch ≥ 1.7.0, torchvision ≥ 0.8.1, tqdm ≥ 4.64.0, pandas ≥ 1.1.4, seaborn ≥ 0.11.0.

[0083] Hyperparameter configuration: learning rate lr=0.001, batch size=16, number of iterations epochs=300, input image size imgsz=960×960, learning momentum=0.937, weight decay coefficient weight_decay=0.0005.

[0084] Data augmentation: During model training, set the optimized combination of data augmentation parameters: hue gain hsv_h=0.015, saturation gain hsv_s=0.7, brightness gain hsv_v=0.4, translation coefficient translate=0.1, scaling ratio scale=0.5, and horizontal flip flip=0.5.

[0085] In this embodiment, the FGD-YOLO model is an improvement on the YOLOv11-seg model, such as... Figure 4 As shown, there are three areas for improvement:

[0086] Improvement 1: Introduce the FreqBlock module into the backbone network, embedding it as a residual behind each stage of the YOLOv11-seg backbone network. The FreqBlock module is inserted after each C3k2 module in the backbone network, which contains four stages from P2 to P5.

[0087] The calculation process of the FreqBlock module includes:

[0088]

[0089]

[0090]

[0091] In the formula, For the input feature map, The frequency domain representation of the input feature map after Fast Fourier Transform. For global average pooling, It is a lightweight feature transformation function. For normalization function, For the frequency domain weights generated through channel attention, For element-wise multiplication, For feature reconstruction mapping function, This refers to the output characteristics of FreqBlock.

[0092] Through this module, the backbone network can adaptively recalibrate features at the global frequency level, effectively enhancing the ability to capture high-frequency texture details and low-frequency structural information.

[0093] Improvement 2: A Dual Texture Selection (DTSM) module is introduced into the key feature extraction layer to model dense and sparse textures separately and adaptively fuse them. The DTSM module is introduced into the intermediate-scale feature layer P3 / 8 of the feature pyramid, which is the 21st layer of the YOLOv11-seg network. The DTSM module is shown below. Figure 5 As shown.

[0094] The output calculation formula of the DTSM module is as follows:

[0095] In the formula, For input features, For high-frequency texture extraction operators, For low-frequency texture extraction operators, and For input features Adaptive selection weights generated from global statistics.

[0096] Through this design, the network can adaptively select whether to focus on high-frequency details or low-frequency structures based on the texture characteristics of fibers in different regions of an image.

[0097] Improvement 3: Replace the feature fusion structure of the original neck network with Ghost-PANet. Based on the bidirectional path structure of PANet, replace the original convolutional module with the C3Ghost module.

[0098] Ghost-PANet employs the C3Ghost module at four feature fusion nodes in its bidirectional feature fusion path, which is both top-down and bottom-up. The C3Ghost module is built based on Ghost convolution, decomposing the standard convolution into two stages: intrinsic feature generation and inexpensive linear transformation.

[0099] First, a portion of the intrinsic feature map is generated using a small number of standard convolutional kernels (e.g., half the original number). Then, a series of simple linear transformations (e.g., depthwise separable convolution or affine transformation) are applied to the intrinsic feature map channel by channel to generate more "phantom" feature maps. Finally, the intrinsic feature map and the phantom feature map are concatenated to form a feature map of the same size as the output of the standard convolution.

[0100] Using the dataset and hyperparameters described above, an FGD-YOLO model was trained on a GPU-equipped server, and the optimal weight file (best.pt) was saved. During actual detection inference, this weight file was loaded, the preprocessed image was input into the model, and `model.predict()` was executed. The model outputs a list of bounding boxes for each detected object (format: [x1, y1, x2, y2, confidence, class_id]) and the corresponding segmentation mask (pixel-level binary image), as shown below. Figure 6 As shown.

[0101] S3. Based on the mask image, record and accumulate the number of cashmere and wool fibers in the image, and calculate the fiber diameter using the orthogonal skeleton method.

[0102] Fiber Counting: The system automatically identifies the category label of each bounding box. If class_id == 0 (cashmere), the accumulator N_rong is incremented by 1; if class_id == 1 (wool), the accumulator N_mao is incremented by 1. Once the fiber count for the current field of view is complete, the total fiber count N_total = N_rong + N_mao is updated.

[0103] Specifically, such as Figure 7 As shown, the process of calculating fiber diameter using the orthogonal skeleton method includes:

[0104] Morphological optimization is performed on the fiber segmentation mask output by the FGD-YOLO model to obtain a binarized mask M. The original segmentation mask output by the FGD-YOLO model is then processed. Spatial filtering is performed using the area assignment operator S_min=100 pixels to remove small, isolated noise patches. Closing operations (dilation followed by erosion, with a 5×5 ellipse kernel) are applied to fill any possible holes inside the fibers, and opening operations (erosion followed by dilation, with a 3×3 ellipse kernel) are applied to smooth edge burrs, resulting in a topologically complete binary fiber mask M.

[0105] The Chag parallel thinning algorithm and similar skeletonization operators are used to extract the single-pixel skeleton lines of the mask M, and m pixels at each end of the skeleton lines are cropped to obtain the effective skeleton point set. In this embodiment, m is set to 15.

[0106] For each sampling point in the skeleton point set Calculate its tangent direction and derive the normal equation, then detect the two intersection points with the fiber edge along the normal direction. and The tangent direction vector of the point is calculated using its immediate and neighboring points, and the equation of the normal perpendicular to the central axis of the skeleton is derived based on orthogonality. A bidirectional ray probe is then performed along this normal direction towards both sides of the fiber edge. Using the fiber contour boundary extracted by findContours as a stopping condition, a pair of orthogonal intersection points located on both sides of the fiber edge are obtained.

[0107] Calculate the Euclidean distance between two intersection points as the pixel diameter. And combined with the calibrated pixel equivalent Calculate the actual physical diameter In this embodiment, The value is 0.105μm / pixel.

[0108] The final diameter of a single fiber is obtained by taking the arithmetic mean of the diameters of all sampling points on the fiber after outlier suppression. In the formula, This represents the total number of valid sampling points. Fiber overlap, impurity attachment, or branching can lead to outliers. When suppressing outliers, outliers that deviate from the median by more than 3 standard deviations are automatically identified and removed.

[0109] S4. Repeatedly accumulate the number of fibers. Stop accumulating when the total number of fibers is not less than 1500.

[0110] The system checks whether the total number of cashmere and wool strands detected in the global counter, N_total, reaches the minimum sample size of 1500 strands specified in the national standard. If the total number of strands, N_total, is less than 1500, the system automatically controls the motorized stage to move to the next field of view, continuously acquiring microscopic images, optimizing quality, identifying models, counting, and measuring diameter. If the total number of strands, N_total, is greater than or equal to 1500, a stop signal is triggered, interrupting the cyclic acquisition and proceeding to the next step. In this embodiment, the threshold is set to 1500, which can be adjusted according to actual conditions.

[0111] S5. Calculate the average diameter, standard deviation, and mass percentage of this batch of fibers according to national standards.

[0112] Once the statistical threshold is reached, the average diameter, standard deviation, and fiber mass percentage are calculated according to national standards. Specifically, the formulas for calculating the average diameter, standard deviation, and mass percentage include:

[0113]

[0114]

[0115]

[0116] In the formula, The average diameter of the fiber. The midpoint of the group. To measure the number of roots, Standard deviation This refers to the number of fibers in a certain component. The average diameter of a certain component fiber. The standard deviation of the average diameter of a certain component fiber This represents the density of a certain component of the fiber.

[0117] All calculation results are automatically generated into a test report, including the average diameter, standard deviation, and cashmere / wool weight percentage, rounded to two decimal places.

[0118] To demonstrate the effectiveness of this embodiment, the results are compared with those calculated using other models, as shown in Table 1.

[0119] Table 1. Comparison of the performance of different methods on cashmere and wool fiber image datasets.

[0120]

[0121] As shown in Table 1, this embodiment achieves a better balance between accuracy, efficiency, and reliability. The improved model achieves an average accuracy of 94.2%, ensuring high precision in instance segmentation. It has 2.67 M parameters, a computational cost of 10.3 GFLOPs, and an inference speed of 169.8 FPS, meeting the real-time detection requirements of the scenario. FGD-YOLO's average accuracy is significantly better than other methods, and its false positive and false negative rates remain at extremely low levels, clearly superior to other methods. This better meets the comprehensive requirements of real-time performance, high accuracy, and low false positives in actual industrial testing of cashmere and wool fibers.

[0122] In summary, this embodiment significantly improves the accuracy of fiber category recognition while achieving a highly lightweight model by designing the model architecture and optimizing the image processing flow. This enables the detection system to complete the entire process from image acquisition to national standard report generation in real time, accurately, and automatically under ordinary hardware conditions. It solves the technical problems of strong subjectivity in quality inspection, poor consistency, high false positive and false negative rates of deep learning models, and heavy hardware dependence in the existing technology.

[0123] Example 2

[0124] like Figure 8 As shown, this embodiment is a cashmere and wool microscopic image composition detection system for implementing Embodiment 1, including: an image acquisition module, an image preprocessing module, an FGD-YOLO model inference module, a counting and measurement module, a loop control module, and a composition calculation module.

[0125] The image acquisition module controls the microscopic vision system to acquire microscopic images of the prepared samples and outputs the acquired raw microscopic image data to the image preprocessing module. Specifically, this module connects to an Olympus BX53 optical microscope and a 5-megapixel industrial camera, with the objective lens magnification set to 500x and the numerical aperture (NA) to 0.75. Following the field-of-view movement commands from the cycle control module, the module controls the motorized stage to move to the next field of view, triggering the camera to acquire raw microscopic images of the prepared samples frame by frame. The acquired images are in BGR format with a uniform resolution of 768×576 pixels.

[0126] The image preprocessing module, whose input is connected to the output of the image acquisition module, is used to receive the original microscopic image data and sequentially perform color space conversion, CLAHE enhancement and USM sharpening to generate enhanced microscopic image data, which is then transmitted to the FGD-YOLO model inference module.

[0127] The specific implementation method is as follows:

[0128] Color space conversion: The cvtColor function from the OpenCV library is called to convert the input image from the BGR color space to the LAB color space, decoupling the luminance component L and the color components a and b. This operation is independent of subsequent texture enhancement, avoiding color cast.

[0129] CLAHE Enhancement: This process only applies to the luminance component L. A contrast limit threshold T_clip = 2.5 and a grid size S_grid = 8×8 are set. The createCLAHE function is called to create a CLAHE object and apply it. This step divides the image into non-overlapping sub-regions, performs histogram equalization on each sub-region, and crops and redistributes pixels exceeding the threshold, thereby suppressing noise amplification caused by global equalization and highlighting the scale layer on the fiber surface.

[0130] USM Adaptive Weighted Sharpening: USM sharpening is applied to the L channel enhanced by CLAHE, and the GaussianBlur function is used to obtain the blurred image G. Finally, the sharpened L channel is merged back with the original A and B channels and converted back to the BGR color space to obtain the final enhanced microscopic image data.

[0131] The FGD-YOLO model inference module has its input connected to the output of the image preprocessing module. It is internally loaded with pre-trained FGD-YOLO model weights, which are used to infer the received enhanced microscopic image data, identify cashmere and wool fibers in the image, and generate corresponding bounding box data and segmentation mask data. The first output of this module sends the bounding box data to the counting and measurement module, and the second output sends the segmentation mask data to the counting and measurement module.

[0132] This module is a secondary development based on YOLOv11-seg, embedding three improvements (FreqBlock, DTSM, and Ghost-PANet) in the model configuration file. The specific model structure and training process are as follows:

[0133] Model structure:

[0134] Backbone Network: In the four stages P2 to P5 of YOLOv11-seg, a FreqBlock module is embedded after each C3k2 module in a residual manner. FreqBlock maps features to the frequency domain through Fast Fourier Transform (FFT), generates frequency domain weights through channel attention for adaptive modulation, and then restores the spatial domain through Inverse Fourier Transform (IFFT) and fuses them with the original feature residuals, thereby enhancing the ability to extract high-frequency texture details and low-frequency structural information.

[0135] Neck Network: A DTSM module is introduced in the intermediate-scale feature layer P3 / 8 of the feature pyramid (i.e., the original network layer 21) to replace the original EMA module. DTSM includes a high-frequency texture branch (multi-scale Sobel / Gabor filter bank) and a low-frequency texture branch (large receptive field smooth convolution), and generates adaptive weights based on global statistics of input features. The outputs of the two branches are weighted and fused and then added to the input residual to achieve adaptive selection of dense texture (wool) and sparse texture (cashmere).

[0136] Feature Fusion Network: The original PANet structure in the neck region is replaced with Ghost-PANet. C3Ghost modules are used at four key nodes in the bidirectional feature fusion path, which runs from top to bottom and bottom to top. The C3Ghost module is based on Ghost convolution and decomposes standard convolution into two stages: intrinsic feature generation (using half the number of standard convolution kernels) and inexpensive linear transformation (channel-wise depthwise separable convolution). The output is then concatenated, which significantly reduces the number of parameters and computation while maintaining feature expressive power.

[0137] Training configuration: A cashmere and wool microscopic image dataset (8:1:1 split for training / validation / test, 10,000 images in total) was used. Input image size was imgsz=960×960, batch size=16, training epochs=300, SGD optimizer was used, initial learning rate lr=0.001, momentum=0.937, weight decay=0.0005, and cosine annealing was used for learning rate scheduling. Data augmentation parameters: hsv_h=0.015, hsv_s=0.7, hsv_v=0.4, translate=0.1, scale=0.5, fliplr=0.5.

[0138] The counting and measurement module receives bounding box data from the FGD-YOLO model inference module at its first input terminal, and uses this data to parse the category labels in the bounding box to update the cashmere counter or wool counter and obtain the counting result. Its second input terminal receives segmentation mask data from the FGD-YOLO model inference module, and uses this data to calculate the diameter of each fiber using the orthogonal skeleton method to obtain the diameter measurement result. This module outputs the counting result and the diameter measurement result to the loop control module and the composition calculation module.

[0139] The loop control module, whose input is connected to the output of the counting and measurement module, is used to receive the current cashmere count, wool count, and total fiber count, and determine whether the total fiber count has reached a set threshold. When the set threshold has not been reached, the module sends a control signal to the image acquisition module to move the field of view and continue acquisition. When the threshold is reached, the module sends an interrupt signal to the composition calculation module to trigger the calculation.

[0140] The component calculation module has its input terminals connected to the output terminals of the counting and measurement module and the trigger signal output terminal of the cycle control module, respectively. After receiving the interrupt signal, it reads the final counting result and diameter measurement result from the counting and measurement module, calculates the average diameter, standard deviation and fiber mass percentage according to national standards, and outputs the final test report.

[0141] All calculation results are rounded to two decimal places according to national standards. Finally, the composition calculation module automatically generates a test report containing sample information, test date, number of cashmere / wool strands, average diameter, standard deviation of diameter, and mass percentage, which can be exported as PDF or Excel format.

Claims

1. A method for detecting the composition of cashmere and wool microscopic images, characterized in that, The method includes the following steps performed sequentially: S1. Use a microscopic vision system to acquire microscopic images of cashmere and wool fiber test sample slides one by one and optimize the image quality. S2. Use the FGD-YOLO model to identify the fiber type of the optimized microscopic image and generate a mask image; The FGD-YOLO model is an improvement on the YOLOv11-seg model, including three improvements: Improvement 1: Introduce the FreqBlock module into the backbone network and embed it in a residual manner after each stage of the YOLOv11-seg backbone network; specifically, the FreqBlock module is inserted after each C3k2 module in the backbone network, which contains four stages from P2 to P5. The calculation process of the FreqBlock module includes: In the formula, For the input feature map, The frequency domain representation of the input feature map after Fast Fourier Transform. For global average pooling, It is a lightweight feature transformation function. For normalization function, For the frequency domain weights generated through channel attention, For element-wise multiplication, For feature reconstruction mapping function, For the output characteristics of FreqBlock; Improvement 2: The Dual Texture Selection Module (DTSM) is introduced into the key layer of feature extraction to model dense and sparse textures separately and adaptively fuse them. Specifically, the DTSM module is introduced into the intermediate scale feature layer P3 / 8 of the feature pyramid, which is the 21st layer of the YOLOv11-seg network. The output calculation formula of the DTSM module is as follows: In the formula, For input features, For high-frequency texture extraction operators, For low-frequency texture extraction operators, and For input features Adaptive selection weights generated from global statistics; Improvement 3: Replace the feature fusion structure of the original neck network with Ghost-PANet, and replace the original convolutional module with C3Ghost module on the basis of PANet bidirectional path structure; S3. Based on the mask image, record and accumulate the number of cashmere and wool fibers in the image, and use the orthogonal skeleton method to calculate the fiber diameter. S4. Repeatedly accumulate the number of fibers. Stop accumulating when the total number of fibers is not less than the set threshold. S5. Calculate the average diameter, standard deviation, and mass percentage of this batch of fibers according to national standards.

2. The method for detecting the composition of cashmere and wool microscopic images according to claim 1, characterized in that, The image quality optimization in step S1 specifically includes: Convert the color image from the BGR color space to the LAB color space to obtain the luminance component L and color components a and b. The contrast-limited adaptive histogram equalization (CLAHE) is applied to the luminance component L, where the contrast limit threshold T_clip ranges from 1.5 to 4.0, and the grid size S_grid ranges from 4×4 to 16×16. Adaptive weighted sharpening is performed using Unsharp Mask (USM) technology, and the calculation formula is as follows: In the formula: To preprocess the output image; The image is enhanced using CLAHE. This represents the result of performing Gaussian blur on the enhanced image; The standard deviation of the Gaussian kernel. and For the weighting coefficients, satisfying and , This is a bias term.

3. The method for detecting the composition of cashmere and wool microscopic images according to claim 1, characterized in that, In improvement point 3, Ghost-PANet uses the C3Ghost module at a total of 4 feature fusion nodes in the bidirectional feature fusion path from top to bottom and from bottom to top. The C3Ghost module is built based on Ghost convolution, which decomposes standard convolution into two stages: intrinsic feature generation and inexpensive linear transformation.

4. The method for detecting the composition of cashmere and wool microscopic images according to claim 1, characterized in that, The calculation of fiber diameter using the orthogonal skeleton method in step S3 specifically includes: Morphological optimization of the fiber segmentation mask output by the FGD-YOLO model is performed to obtain a binarized mask M; The Chag parallel thinning algorithm and similar skeletonization operators are used to extract the single-pixel skeleton lines of the mask M, and m pixels at each end of the skeleton lines are cropped to obtain the effective skeleton point set. ; For each sampling point in the skeleton point set Calculate its tangent direction and derive the normal equation, then detect the two intersection points with the fiber edge along the normal direction. and ; Calculate the Euclidean distance between two intersection points as the pixel diameter. And combined with the calibrated pixel equivalent Calculate the actual physical diameter ; The final diameter of a single fiber is obtained by taking the arithmetic mean of the diameters of all sampling points on the fiber after outlier suppression. In the formula, This represents the total number of valid sampling points.

5. The method for detecting the composition of cashmere and wool microscopic images according to claim 1, characterized in that, The formulas for calculating the average diameter, standard deviation, and mass percentage in step S5 include: In the formula, The average diameter of the fiber. The midpoint of the group. To measure the number of roots, Standard deviation This refers to the number of fibers in a certain component. The average diameter of a certain component fiber. The standard deviation of the average diameter of a certain component fiber This represents the density of a certain component of the fiber.

6. A microscopic image composition detection system for cashmere and wool, used to implement the microscopic image composition detection method for cashmere and wool as described in any one of claims 1 to 5, characterized in that, include: Image acquisition module, image preprocessing module, FGD-YOLO model inference module, counting and measurement module, loop control module, and component calculation module; The image acquisition module is used to control the microscopic vision system to acquire microscopic images of the sample slides and output the acquired raw microscopic image data to the image preprocessing module. The image preprocessing module, whose input is connected to the output of the image acquisition module, is used to receive the original microscopic image data and sequentially perform color space conversion, CLAHE enhancement and USM sharpening to generate enhanced microscopic image data, which is then transmitted to the FGD-YOLO model inference module. The FGD-YOLO model inference module has its input connected to the output of the image preprocessing module. It internally loads pre-trained FGD-YOLO model weights to infer the received enhanced microscopic image data, identify cashmere and wool fibers in the image, and generate corresponding bounding box data and segmentation mask data. The module's first output sends the bounding box data to the counting and measurement module, and its second output sends the segmentation mask data to the counting and measurement module. The counting and measurement module receives bounding box data from the FGD-YOLO model inference module at its first input terminal, and uses it to parse the category labels in the bounding box to update the cashmere counter or wool counter and obtain the counting result. Its second input terminal receives segmentation mask data from the FGD-YOLO model inference module, which is used to calculate the diameter of each fiber using the orthogonal skeleton method to obtain the diameter measurement result; the module outputs the counting result and the diameter measurement result to the loop control module and the composition calculation module; The loop control module, whose input is connected to the output of the counting and measuring module, is used to receive the current cashmere count, wool count and total fiber count, and to determine whether the total fiber count has reached the set threshold. When the set threshold is not reached, the module sends a control signal to the image acquisition module to move the field of view and continue acquisition; when the threshold is reached, it sends an interrupt signal to the component calculation module to trigger calculation. The component calculation module has its input terminals connected to the output terminals of the counting and measurement module and the trigger signal output terminal of the cycle control module, respectively. After receiving the interrupt signal, it reads the final counting result and diameter measurement result from the counting and measurement module, calculates the average diameter, standard deviation and fiber mass percentage according to national standards, and outputs the final test report.

Citation Information

Patent Citations

  • Method for rapidly detecting wheat scab spike and severity in natural environment

    CN116958784A

  • Leather defect identification method based on double-branch frequency domain feature decoupling and dynamic channel enhancement network

    CN121010819A

  • Cashmere and wool fiber detection method and system, electronic equipment and medium

    CN121304605A

  • Unmanned aerial vehicle aerial photography target detection method based on improved YOLOv11n

    CN122135244A