Visual inspection acceleration method based on model quantification
By using a model-based visual inspection method, combined with a high-resolution camera and an Encoder-Decoder architecture based on the Transformer layer, the problem of insufficient accuracy in yarn package visual inspection under environmental interference and complex scenarios is solved, achieving high-precision, low-cost automated inspection that is suitable for multi-variety production.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- CMT HICORP MACHINERY QINGDAO
- Filing Date
- 2025-12-25
- Publication Date
- 2026-04-24
AI Technical Summary
Existing visual inspection methods for yarn packages are not accurate enough in environmental interference and complex scenarios, and are prone to misjudging or missing minor defects. In addition, the system development and maintenance costs are high, making it difficult to adapt to the needs of multi-variety production.
A model-based visual inspection method is adopted, which combines a high-resolution industrial camera with image processing algorithms. The Encoder-Decoder architecture of the Transformer layer is used for feature extraction and fusion, and the detection model is optimized by combining domain knowledge to achieve non-contact high-precision analysis.
It significantly improves the accuracy of yarn package inspection and the level of automation in the production process, reduces misjudgments and missed inspections, lowers system maintenance costs, and adapts to the needs of multi-variety production.
Smart Images

Figure CN121921267A_ABST
Abstract
Description
Technical Field
[0001] This invention discloses a visual inspection acceleration method based on model quantization, belonging to the field of visual inspection technology. Background Technology
[0002] Yarn package visual inspection technology is a key component of automated quality control in the textile industry. Its core lies in the real-time identification and processing of continuous defects during yarn production using a machine vision system. This technology primarily relies on high-speed industrial cameras to acquire yarn images and employs image processing algorithms to analyze yarn morphological features, thereby accurately determining abnormal conditions such as yarn breakage. The machine vision system consists of three main modules: an image acquisition module that uses a high-resolution industrial camera to capture the yarn's running status in real time; a data processing module that optimizes image quality through preprocessing operations such as grayscale conversion, noise filtering, and contrast enhancement, and then extracts feature parameters using edge detection and texture analysis algorithms; and a decision execution module that matches the extracted features with preset thresholds, immediately triggering an audible and visual alarm and shutting down the equipment when a yarn breakage feature is detected. A typical detection process includes a closed-loop processing chain of image acquisition → preprocessing → feature extraction → pattern recognition → result feedback, which can be completed within milliseconds.
[0003] Compared to traditional photoelectric sensing technology, visual inspection systems offer the advantage of three-dimensional perception, enabling them to identify complex defects such as yarn morphology variations and abnormal hairiness. With the application of deep learning technology, intelligent detection models based on convolutional neural networks (CNNs), trained on a large number of normal and defective samples, have achieved autonomous learning and adaptive recognition of yarn breakage features, significantly improving detection accuracy and generalization ability. Currently, this technology is widely used in modern spinning production lines such as ring spinning and rotor spinning, effectively increasing product qualification rates to over 99.5%.
[0004] However, existing technologies still have some limitations. Visual inspection systems need to operate in relatively stable environments (such as light, temperature, and humidity). Environmental interference (such as dust and changes in light) may affect image acquisition quality and lead to detection errors. They rely on the standardization of product appearance. If the yarn has non-standardized features such as uneven color, size deviation, or surface contamination, it is easy to cause misjudgment or missed detection. For minor defects that are difficult to detect with the naked eye (such as fiber-level damage or defects of specific shapes), the recognition accuracy of visual inspection may be insufficient, and manual re-inspection is still required. System development, equipment procurement, and subsequent maintenance require a lot of funds, and regular calibration and upgrades are required to adapt to different product needs, which increases the burden on enterprises. In complex scenarios (such as yarn overlap and reflective interference), the algorithm may make misjudgments. Although the accuracy can be improved through optimization, it is challenging to completely eliminate them. Summary of the Invention
[0005] The purpose of this invention is to provide a model-quantized method for accelerating visual inspection, in order to solve the problem of insufficient accuracy in existing yarn bobbin visual inspection methods.
[0006] A model-quantized visual inspection acceleration method is proposed for yarn quality inspection. The method includes acquiring historical data from enterprises, performing data cleaning, data integration, data transformation and data reduction, combining databases for feature selection, feature construction and feature fusion, importing the feature fusion results with domain knowledge into the yarn quality inspection model, and evaluating, comparing and optimizing the model.
[0007] The yarn quality detection model includes an input layer, a CNN layer, a transformer layer, and an output layer. The input layer takes fiber performance indicators and process parameters as input.
[0008] The variety detection includes paper tube image cutout detection and side-view photograph original image detection.
[0009] The quality inspection includes yarn bobbin end face skipping inspection, rewind inspection, mesh inspection, yarn spool inspection, yarn strand inspection, dirt inspection, and paper tube damage inspection.
[0010] The ultraviolet light detection includes detection of yellow-white yarn and detection of foreign fibers.
[0011] The transformer layer includes an encoder and a decoder.
[0012] The Transformer adopts an Encoder-Decoder architecture, with the encoder and decoder each containing 6 stacked layers; The input sequence is first converted into a vector representation through word embedding, and positional encoding is added to preserve the sequence order information. Positional encoding is calculated using sine and cosine functions and supports dynamic expansion to arbitrary sequence lengths.
[0013] Each encoder layer contains two core sub-layers, which include a multi-head self-attention mechanism and a feedforward neural network. Each sub-layer is followed by residual connections and layer normalization. The multi-head self-attention mechanism transforms the input vector into a matrix of query, key, and value. It calculates the dot product score between the query and key, applies scaled dot product attention and Softmax normalization, and then weights and sums the values to generate the output. The multi-head self-attention mechanism enhances the model's ability to capture features from different subspaces by computing multiple attention heads in parallel.
[0014] The feedforward neural network performs a nonlinear transformation on the self-attention output. It consists of two linear layers and a ReLU activation function, and processes the vector at each position in the sequence in parallel.
[0015] Compared with existing technologies, this invention has the following advantages: By integrating a high-resolution industrial camera with advanced image processing algorithms, this invention achieves non-contact, high-precision analysis of the appearance of yarn packages. This technology can capture key information such as the winding shape of the yarn packages, surface defects, and yarn breakage in real time, significantly improving the automation level of the textile production process. Attached Figure Description
[0016] Figure 1 This is a flowchart of the technology of the present invention; Figure 2 This is a structural diagram of the yarn quality detection model of the present invention. Detailed Implementation
[0017] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention are described clearly and completely below. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.
[0018] A model-quantization-based method for accelerating visual detection, such as Figure 1 The visual inspection acceleration method is used for yarn quality inspection. It includes acquiring historical data of enterprises, performing data cleaning, data integration, data transformation and data reduction, combining databases to perform feature selection, feature construction and feature fusion, and importing the feature fusion results with domain knowledge into the yarn quality inspection model for model evaluation, comparison and optimization.
[0019] The yarn quality detection model is as follows: Figure 2 It includes an input layer, a CNN layer, a transformer layer, and an output layer.
[0020] The variety detection includes paper tube image cutout detection and side-view photograph original image detection.
[0021] The quality inspection includes yarn bobbin end face skipping inspection, rewind inspection, mesh inspection, yarn spool inspection, yarn strand inspection, dirt inspection, and paper tube damage inspection.
[0022] The ultraviolet light detection includes detection of yellow-white yarn and detection of foreign fibers.
[0023] The transformer layer includes an encoder and a decoder.
[0024] The Transformer adopts an Encoder-Decoder architecture, with the encoder and decoder each containing 6 stacked layers; The input sequence is first converted into a vector representation through word embedding, and positional encoding is added to preserve the sequence order information. Positional encoding is calculated using sine and cosine functions and supports dynamic expansion to arbitrary sequence lengths.
[0025] Each encoder layer contains two core sub-layers, which include a multi-head self-attention mechanism and a feedforward neural network. Each sub-layer is followed by residual connections and layer normalization. The multi-head self-attention mechanism transforms the input vector into a matrix of query, key, and value. By calculating the dot product score of the query and key, and after scaling the dot product attention and Softmax normalization, the value is weighted and summed to generate the output. The multi-head self-attention mechanism enhances the model's ability to capture features of different subspaces by computing multiple attention heads in parallel.
[0026] The feedforward neural network performs a nonlinear transformation on the self-attention output. It consists of two linear layers and a ReLU activation function, and processes the vector at each position in the sequence in parallel.
[0027] In this embodiment of the invention, when performing variety detection, a larger sample size and a richer detection model result in better detection results. For example, a variety model trained with 50 samples performs better than one trained with 200 samples; 20 types of paper tubes perform better than 10 types. Color difference and pattern deviation are issues caused by variations in color and pattern between different batches or even within the same batch of paper tubes from different suppliers. Significant differences will trigger visual alarms or cause yarn rejection, requiring manual confirmation. Unqualified photos are added to the training library for retraining. Colored yarn masking is not feasible because the color contrast of colored yarns is too varied for software binarization to fully match, thus hindering variety detection. Pure black paper tubes are excluded, resulting in a uniform black and white color after binarization. When selecting patterns, avoid using similar patterns. For example, if a red five-pointed star pattern is produced, do not use a red plum blossom pattern, as the printing images from paper tube manufacturers vary significantly in each position; similar images will negatively impact recognition. The paper tubes on the same production line should have a uniform background color. For example, if the background color is the original color paper tube, avoid having white background tubes on the same production line at the same time. Simultaneous production will cause different exposures, and overexposure or underexposure will affect the cutout and recognition effect. If the white background color is the same as the yarn color, there is no contrast to distinguish it, making it difficult to perform image preprocessing and binarization for cutout.
[0028] In UV light testing of core-spun yarn, which is also called elastic yarn, the yarn is actually composed of two materials. Because these two different materials emit light differently under UV light, even a properly manufactured, qualified core-spun yarn will exhibit two different colors. The principle of UV light testing is to compare the color difference between the two materials. Logically, this type of yarn is considered a defective blended yarn. However, this logic conflicts with that of normal yarn, making testing impossible. In practice, two types of defects appear in core-spun yarn quality testing: 1. Off-center core, lacking outer cotton thread wrapping and appearing bluish (in reality, even a properly manufactured core-spun yarn will appear bluish when wrapped in cotton thread, making it indistinguishable); 2. No spandex filaments, which, due to the lack of elasticity, are generally squeezed out on the yarn surface, resulting in a grayish color. This can be detected except in some special locations.
[0029] In summary, this invention discloses the following five points: 1) Yarn variety identification. Considering the problem of having many yarn varieties, the intelligent full-process packaging line simultaneously matches the problem of producing multiple varieties. Mechanical, program or human error may inevitably cause incorrect packing reports, resulting in variety errors. These errors will flow into the next production stage and cause mis-weaving. By using machine vision detection, a variety model is trained for the yarn tube of each variety, and the unloaded yarn tube is detected to achieve the purpose of variety identification and close the loop of mis-weaving risk.
[0030] 2) Yarn quality inspection: In response to issues related to the winding process in yarn production, machine vision depth algorithms are used to detect surface defects in textiles, such as damage, stains, and color differences, to ensure that the quality of textiles meets standards.
[0031] 3) Yarn and fiber testing: using ultraviolet light to illuminate different textures of the yarn, providing data support for the design and production of textiles.
[0032] 4) Thread breakage detection: During the spinning process of textile machines, machine vision technology can significantly improve the thread breakage detection rate, ensure the normal operation of the production line, and thus promote the overall capacity upgrade of the textile industry.
[0033] 5) Automated production and monitoring: Machine vision and deep learning technologies can be combined with automated equipment to achieve automated monitoring and management of the textile production process, thereby improving production efficiency.
[0034] This invention utilizes multiple production scenarios, employing side and front (image cutout) identification to recognize yarn types. It adapts to various yarn bobbin models and specifications on-site, and leverages visual technology to interface with yarn information systems for yarn type allocation and identification. It is also suitable for detecting mis-weaving defects using ultraviolet light. Due to the complexity of upstream processes in textile enterprises, mis-weaving and missing bobbins are inevitable, leading to blending and mis-weaving of two types of yarn at the winding machine stage. The visual technology, combined with ultraviolet light illumination, can identify blended and mis-weaving, ensuring product quality. Machine vision technology can be applied to quality control in textiles, such as detecting surface defects (e.g., holes, stains), broken threads, and other surface defects. These applications improve the speed and accuracy of inspection, thereby increasing overall production efficiency. For automated production, machine vision technology enables automated monitoring and management of various stages in textile production, reducing manual intervention and improving production continuity and flexibility. Furthermore, it enhances enterprise competitiveness; visual inspection technology has become a crucial tool for enhancing the competitiveness of companies in the automation industry, with increasingly widespread applications, playing a key role in improving product quality and production efficiency.
[0035] The application of machine vision technology in the textile industry is mainly reflected in improving production efficiency, quality control, automated production, and customized solutions. These technologies not only enhance the production quality and efficiency of textiles but also bring greater economic benefits to enterprises. With continuous technological advancements, the application of vision technology in the textile industry will become even more widespread and in-depth in the future.
[0036] The above embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A visual detection acceleration method based on model quantization, characterized in that, The visual inspection acceleration method is used for yarn quality inspection, which includes acquiring historical data of enterprises, performing data cleaning, data integration, data transformation and data reduction, combining databases to perform feature selection, feature construction and feature fusion, and importing the feature fusion results with domain knowledge into the yarn quality inspection model for model evaluation, comparison and optimization.
2. The visual detection acceleration method based on model quantization according to claim 1, characterized in that, The yarn quality detection model includes an input layer, a CNN layer, a transformer layer, and an output layer. The input layer takes fiber performance indicators and process parameters as input.
3. The visual detection acceleration method based on model quantization according to claim 2, characterized in that, The variety detection includes paper tube image cutout detection and side-view photograph original image detection.
4. The visual detection acceleration method based on model quantization according to claim 3, characterized in that, The quality inspection includes yarn bobbin end face skipping inspection, rewind inspection, mesh inspection, yarn spool inspection, yarn strand inspection, dirt inspection, and paper tube damage inspection.
5. The visual detection acceleration method based on model quantization according to claim 4, characterized in that, The ultraviolet light detection includes detection of yellow-white yarn and detection of foreign fibers.
6. The visual detection acceleration method based on model quantization according to claim 5, characterized in that, The transformer layer includes an encoder and a decoder.
7. The visual detection acceleration method based on model quantization according to claim 6, characterized in that, The Transformer adopts an Encoder-Decoder architecture, with the encoder and decoder each containing 6 stacked layers; The input sequence is first converted into a vector representation through word embedding, and positional encoding is added to preserve the sequence order information. Positional encoding is calculated using sine and cosine functions and supports dynamic expansion to arbitrary sequence lengths.
8. The visual detection acceleration method based on model quantization according to claim 7, characterized in that, Each encoder layer contains two core sub-layers, which include a multi-head self-attention mechanism and a feedforward neural network. Each sub-layer is followed by residual connections and layer normalization.
9. The visual detection acceleration method based on model quantization according to claim 8, characterized in that, The multi-head self-attention mechanism transforms the input vector into a matrix of query, key, and value. By calculating the dot product score of the query and key, and after scaling the dot product attention and Softmax normalization, the value is weighted and summed to generate the output. The multi-head self-attention mechanism enhances the model's ability to capture features of different subspaces by computing multiple attention heads in parallel.
10. The visual detection acceleration method based on model quantization according to claim 9, characterized in that, The feedforward neural network performs a nonlinear transformation on the self-attention output. It consists of two linear layers and a ReLU activation function, and processes the vector at each position in the sequence in parallel.