A method, apparatus and system for testing textiles

By introducing a batch reference feature library and a deep fusion technology of cross-branch detection modules into the textile inspection system, the problem of high false alarm rate and false negative rate of commercial textile inspection systems when facing changes in fabric patterns and processes has been solved, achieving high detection accuracy and low-cost model updates.

CN122089667APending Publication Date: 2026-05-26V-TRUST INSPECTION SERVICE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
V-TRUST INSPECTION SERVICE CO LTD
Filing Date
2026-02-03
Publication Date
2026-05-26

AI Technical Summary

Technical Problem

Existing commercial textile inspection systems suffer from high false alarm and false negative rates when faced with changes in fabric patterns and process conditions, resulting in decreased inspection performance. Furthermore, model updates and maintenance are costly and time-consuming.

Method used

A batch reference feature library is constructed by introducing batch-free texture samples. The cross-branch detection module completes the deep fusion of general representation and batch-specific texture features at the feature layer. The same defect detection head is used to simultaneously utilize general defect morphology information and deviation information relative to the normal texture pattern of this batch in a single output.

Benefits of technology

It improves the accuracy of textile inspection, reduces false alarm and false negative rates, enables adaptive detection of changes in fabric patterns and process conditions, and reduces the cost and cycle of model updates and maintenance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122089667A_ABST
    Figure CN122089667A_ABST
Patent Text Reader

Abstract

This invention relates to the field of automated inspection technology, providing a method, apparatus, and system for textile inspection. The method includes: acquiring a texture sample of a defect-free textile; acquiring a defect detection model; extracting texture features from the texture sample to obtain a batch reference feature library; inputting an image of the textile to be inspected into the defect detection model to obtain fused features; and inputting the fused features into the defect detection head to obtain a defect detection result. The advantage of this application lies in that, while maintaining stable general defect detection capabilities, it introduces a batch reference feature library constructed from batches of defect-free texture samples. Furthermore, through a cross-branch detection module, it achieves deep fusion of general representations and batch-specific texture features at the feature layer. This allows the same defect detection head to simultaneously utilize general defect morphology information and deviation information relative to the normal texture pattern of the current batch in a single output, thereby improving detection accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of automated testing technology, and in particular relates to a method, apparatus and system for testing textiles. Background Technology

[0002] Textiles inevitably suffer from various defects during processing and transportation, such as broken yarns, oil stains, and holes. These defects not only affect the appearance quality of the fabric, but also the grade evaluation and market price of the final product.

[0003] With the rise of machine vision and image processing technologies, automated textile defect detection systems are gradually replacing manual inspection. In recent years, deep learning technology has become the mainstream approach in the field of fabric defect detection. Examples include convolutional neural networks, detection and segmentation models based on YOLO and UNet networks, Transformer structures, and attention mechanisms.

[0004] Despite the excellent performance of the aforementioned algorithms under experimental conditions, they still exhibit significant limitations in real-world industrial applications. In particular, with advancements in materials and weaving techniques, fabric textures are becoming increasingly complex. Products such as patterned fabrics, jacquard fabrics, and knitted fabrics are rapidly updated, featuring newer texture backgrounds and detailed structures. This makes it difficult for the model to distinguish between normal texture variations and defect areas. Furthermore, actual industrial production involves diverse defect types and significant morphological differences, while the number of real defect samples is limited. Existing public datasets have a limited variety of fabric types, slow update speeds, and insufficient data scale to cover variations in fiber materials and weaving methods. Consequently, trained models are difficult to transfer or dynamically update after deployment, often requiring extensive re-labeling and retraining with numerous new samples to adapt to new fabric types or defect distributions. This results in high system maintenance costs and long cycles.

[0005] Therefore, it can be seen that current commercial testing systems often use fixed model versions that are difficult to modify, making it difficult to effectively cope with the constantly updated changes in parameters such as fabric patterns and process conditions. This results in high false alarm rates, high false negative rates, and a significant decline in testing performance. On the other hand, replacing or maintaining the testing model is costly, slow to update, and has a long cycle. Summary of the Invention

[0006] The purpose of this application is to provide a textile testing method that addresses the problems of current commercial testing systems often using fixed model versions, resulting in high false alarm and false negative rates and decreased testing performance when faced with changes in parameters such as updated fabric patterns and process conditions; and the high cost, slow update speed, and long cycle of replacing or maintaining the testing model.

[0007] This application provides a method for detecting textiles, the method comprising:

[0008] Obtain batch information of the textiles to be inspected, and obtain several pattern samples of the defect-free textiles corresponding to the batch to be inspected.

[0009] A defect detection model is obtained, which includes a sample encoding branch, an image to be inspected branch, a cross-branch detection module, and a defect detection head. The sample encoding branch and the image to be inspected branch share a feature extraction network. Texture features of the texture sample are extracted to obtain a batch reference feature library.

[0010] The image of the textile to be inspected is input into the defect detection model. Multi-scale features are obtained through the branches of the image to be inspected. Based on the cross-branch detection module, the multi-scale features are compared with the batch reference feature library to obtain fused features.

[0011] The fused features are input into the defect detection head to obtain the defect detection result.

[0012] Another objective of this application is to provide a textile testing device, the device comprising:

[0013] The texture sample acquisition unit is used to acquire batch information of textiles to be inspected and to acquire several texture samples of defect-free textiles corresponding to the batch to be inspected.

[0014] A batch reference feature acquisition unit is used to acquire a defect detection model, which includes a sample encoding branch, an image to be inspected branch, a cross-branch detection module, and a defect detection head. The sample encoding branch and the image to be inspected branch share a feature extraction network. The texture features of the texture sample are extracted to obtain a batch reference feature library.

[0015] The fusion feature acquisition unit is used to input the image of the textile to be inspected into the defect detection model, obtain multi-scale inspection features through the branches of the image to be inspected, and compare the multi-scale inspection features with the batch reference feature library based on the cross-branch detection module to obtain fusion features;

[0016] The detection result acquisition unit is used to input the fused features into the defect detection head to obtain the defect detection result.

[0017] Another objective of this application is to provide a textile inspection system, including a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor performs the steps of the textile inspection method as described above.

[0018] The textile inspection method provided in this application has the following advantages: while maintaining the stability of general defect detection capabilities, it introduces a batch reference feature library constructed from batch-free texture samples, and completes the deep fusion of general characterization and batch-specific texture features at the feature layer through a cross-branch detection module. This allows the same defect detection head to simultaneously utilize general defect morphology information and deviation information relative to the normal texture pattern of the current batch in a single output, thereby improving the accuracy of detection. Attached Figure Description

[0019] Figure 1 An application environment diagram of a textile testing method provided in this application embodiment;

[0020] Figure 2 A flowchart illustrating a textile testing method provided in this application embodiment;

[0021] Figure 3 A flowchart illustrating another textile testing method provided in this application embodiment;

[0022] Figure 4 A structural block diagram of a textile testing device provided in an embodiment of this application;

[0023] Figure 5 This is a block diagram of the internal structure of a computer device in one embodiment. Detailed Implementation

[0024] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.

[0025] It is understood that the terms "first," "second," etc., used in this application may be used herein to describe various elements, but unless otherwise stated, these elements are not limited by these terms. These terms are used only to distinguish the first unit or module from another unit or module. For example, without departing from the scope of this application, the first script may be referred to as the second script, and similarly, the second script may be referred to as the first script.

[0026] Figure 1 This is an application environment diagram of the textile testing method provided in the embodiments of this application, such as... Figure 1 As shown, this application environment includes an image input terminal 110 and a computer device 120.

[0027] Computer device 120 can be a standalone laptop, desktop computer, physical server or terminal, or a server cluster consisting of multiple physical servers.

[0028] The image input terminal 110 can be a scanner, an RGB-D camera, or various imaging devices, but is not limited to these.

[0029] The image input terminal 110 and the computer device 120 can be connected via a network, which is not limited herein.

[0030] like Figure 2 As shown, in one embodiment, a method for detecting textiles is proposed. This embodiment mainly applies this method to the above-mentioned... Figure 1 Taking computer equipment 120 as an example, a method for testing textiles may specifically include the following steps:

[0031] Step S10: Obtain batch information of the textiles to be inspected, and obtain several pattern samples of the defect-free textiles corresponding to the batch to be inspected.

[0032] In this embodiment, the textile testing method provided in this application is particularly suitable for import and export quality inspection agencies to perform defect detection and quality assessment of textiles under inspection. This method uses batches as the basic unit of management. Users need to input defect-free pattern samples consistent with the batch to be inspected to establish batch-specific reference features. These samples should include new patterns, new textile designs, and new processes introduced into the batch that differ from conventional patterns on the market. These new pattern features are input into the detection model, which can integrate general defect detection with targeted feature detection for newly introduced patterns in the batch. This allows the system to adaptively acquire changes in current fabric patterns, textures, and processing conditions, improving the robustness of defect detection and reducing false alarms and missed detections. Understandably, image samples of normal textures, patterns, yarn structures, etc., can all be called pattern samples.

[0033] Step S20: Obtain a defect detection model, which includes a sample encoding branch, an image to be inspected branch, a cross-branch detection module, and a defect detection head. The sample encoding branch and the image to be inspected branch share a feature extraction network. Extract the texture features of the texture sample to obtain a batch reference feature library.

[0034] In this embodiment, batch information is used to identify the batch to which the textile to be inspected belongs and the corresponding texture type or pattern type. Texture samples are used to characterize the normal texture pattern of the batch and provide a reference benchmark for subsequent comparative testing. The defect detection model used in this application improves the accuracy of identification by introducing a cross-branch detection module to retrieve the features of newly introduced textures in the batch to be inspected and incorporating them into the defect detection process.

[0035] It is understandable that the samples introduced in each batch will cause changes in the model parameters. However, the original parameters of the model itself will be automatically reset to the default general parameters after the current batch is tested, so that the samples in the current batch will not interfere with the model's testing of other batches of samples.

[0036] In this embodiment, the feature extraction network is used to map the input image into a multi-scale feature representation. "Shared" means that the sample encoding branch and the image to be inspected branch call the same set of feature extraction network structures and parameters, ensuring that the defect-free textured sample image and the image to be inspected are represented in the same feature space, guaranteeing the comparability of subsequent cross-branch comparison operations. The defect detection head receives the fused features output by the cross-branch detection module and outputs the defect detection results, which may include information such as defect location, defect category, and confidence level.

[0037] Step S30: Input the image of the textile to be inspected into the defect detection model, obtain multi-scale inspection features through the branches of the image to be inspected, and compare the multi-scale inspection features with the batch reference feature library based on the cross-branch detection module to obtain fused features.

[0038] In this embodiment, the image to be inspected outputs multi-scale features through the same feature extraction network as the sample image. This multi-scale feature extraction network simultaneously characterizes both small and large-scale defects, such as small yarn breaks and dotted stains, as well as larger-scale defects like wrinkles, weft skew, and structural deformations. Researchers have found that using only a single scale can easily lead to a large number of false alarms when the texture becomes complex. This embodiment addresses this by fusing features to include general defect information. Combined with batch-specific evidence of the current batch to be inspected, it suppresses false alarms caused by new patterns and amplifies weak defect signals. When changing batches, only the batch reference features are changed, without altering the model parameters. This is suitable for quality inspection agencies to quickly switch between a large number of customers or batches, ensuring that different batches do not contaminate each other.

[0039] In this step, the following process is used as an example to illustrate how the fused features can be obtained:

[0040] When detecting a specific image, the image is preprocessed in the same way and then input into a shared feature extraction network. The network outputs multi-scale detection features via the image branch. The cross-branch detection module performs channel space alignment for each scale. Applying the first mapping yields the mapped feature map to be detected. , for reference prototype Applying the second mapping yields the mapping reference feature vector. and will Broadcasting expands the mapping into a spatially aligned reference feature map. .

[0041] Then, a position-by-position comparison is performed within the mapping space, at each spatial position. Place, will and After normalization, the inner product is performed to obtain the similarity response values, which are then used to construct the similarity response map. To characterize the direction and magnitude of the deviation of the detected feature from the normal prototype, a modulation difference feature map is calculated. .

[0042] To further improve accuracy, it is necessary to suppress the large number of spurious differences caused by normal high-frequency textures in complex patterns. The cross-branch detection module further calculates the anomaly intensity map:

[0043] ;

[0044] Will and As the gated input, it is processed by a gated convolutional network and a sigmoid activation layer to obtain a gated weight map. The difference is adaptively modulated using the following formula:

[0045] .

[0046] In the above process, positions with low similarity and high differences are given higher weight, focusing the comparative evidence on areas that are more likely to have defects.

[0047] During the fusion phase, the cross-branch detection module performs feature-level fusion between common detectable features and batch comparison evidence to obtain an intermediate fusion feature map. and to Perform alignment mapping to obtain The final fused features are obtained in the form of residuals: .

[0048] This residual fusion allows the fusion features to explicitly retain the original multi-scale representations relied upon by general detection while superimposing batch-specific contrast evidence. Its advantage lies in avoiding the model from degenerating into a targeted detection that only relies on contrast differences, and simultaneously achieving false alarm suppression and false negative reduction under new patterns and new process conditions.

[0049] Step S40: Input the fused features into the defect detection head to obtain the defect detection result.

[0050] In this embodiment, the output defect detection results may include the position and size of the defect candidate box, defect category, confidence level, etc. The defect detection head is a prediction module, which may specifically include feature pyramid fusion, classification and regression branches, etc. Mainstream general-purpose defect detection heads can be used. Since the input of the detection head is already a feature expression after deep fusion of general features and batch comparison features, the detection head only needs to perform forward prediction once to simultaneously utilize general defect morphology information and deviation information relative to the normal texture of this batch to complete localization and classification.

[0051] Those skilled in the art will know that traditional commercial inspection systems often rely on fixed model versions or fixed threshold strategies. When faced with new patterns, new processes, or shifts in imaging conditions, they are prone to misjudging normal texture differences as defects, leading to increased false alarm rates and introducing significant manual review costs. Relying solely on conventional methods such as template matching or background subtraction makes it difficult to cover complex patterns and multi-scale defect morphologies, and their ability to detect weak defects and low-contrast defects is insufficient.

[0052] In this embodiment,

[0053] The method provided in this application has the advantage of introducing a batch reference feature library constructed from batch-free texture samples while maintaining the stability of general defect detection capabilities. It also achieves deep fusion of general characterization and batch-specific textures at the feature layer through a cross-branch detection module, enabling the same defect detection head to utilize both general defect morphology information and deviation information relative to the current batch in a single output, resulting in higher detection accuracy.

[0054] In a preferred embodiment, the method for extracting the texture features of the texture sample based on the defect detection model to obtain the batch reference feature library is as follows:

[0055] Extract the batch ID from the batch information of the textiles to be inspected, and obtain the corresponding batch ID. Zhang's flawless texture sample image ;

[0056] Preprocessing of defect-free texture sample images yields The texture features of the multi-scale samples are then input into a feature extraction network.

[0057] ;

[0058] in, ; ; This is a sample image after preprocessing; Features of the texture; For feature extraction networks; The scale number;

[0059] For sample feature sets at the same scale Aggregation is performed to obtain the reference prototype features for the batch. The aggregation method is;

[0060] ; ;

[0061] in For global pooling, For attention scoring functions;

[0062] Features of the reference prototype at each scale With batch identifier Associated storage forms a batch reference feature library. .

[0063] In this embodiment, a reference feature library representing the defect-free standard texture of each batch of textiles is constructed. Specifically, the preprocessed images are fed into a convolutional neural network to extract multi-level features. After obtaining the multi-scale features of all K samples, attention aggregation is used to construct a reference prototype feature representing the commonality of the entire batch for each scale. The attention scoring function g(⋅) is used to calculate the importance score. Then, a global pooling operation is performed to compress it into a feature vector. The reference prototype feature for each scale is the weighted sum of the feature vectors after pooling all samples.

[0064] Preferably, the attention scoring function used in this application first performs global pooling on the input sample features to obtain a one-dimensional feature vector, and then inputs the vector into a two-layer fully connected network for nonlinear mapping. The first fully connected layer maps the input vector to a fixed dimension, and then enhances the nonlinear expressive power through the ReLU activation function. The second fully connected layer maps the features to scalar scoring values.

[0065] In a preferred embodiment, such as Figure 3 As shown, the method for obtaining fused features by comparing the multi-scale features to be detected with the batch reference feature library based on the cross-branch detection module is as follows:

[0066] S31: Perform a first feature mapping operation on the multi-scale feature map to be detected to obtain a mapped feature map to be detected;

[0067] S32: Perform a second feature mapping operation on the batch reference prototype features to obtain a mapped reference feature vector, and expand the mapped reference feature vector into a spatially aligned mapped reference feature map through broadcasting;

[0068] S33: Calculate a similarity response map and a difference feature map based on the mapped feature map to be detected and the mapped reference feature map, and modulate the difference feature map based on the gating weight to obtain a modulated difference feature map;

[0069] S34: The multi-scale feature map to be inspected, the similarity response map, and the modulation difference feature map are fused to obtain a fused intermediate feature map. Based on the fused intermediate feature map and the aligned feature map to be inspected, a fused feature is obtained. The residual fusion is used to retain the multi-scale feature information to be inspected on which general defect detection depends and to superimpose the texture features unique to the batch to be inspected.

[0070] In this embodiment, gating weights driven by similarity and difference are used to suppress false differences caused by normal textures and highlight structural deviations that are more likely to be caused by defects. The general features to be detected are convolved and fused with the above-mentioned comparative evidence at the feature layer, and the basic representation on which the general defect detection depends is explicitly preserved through residual method, thereby obtaining a fused feature that simultaneously contains general defect information and texture comparison information specific to the batch to be detected, for subsequent output of defect detection results by the same defect detection head.

[0071] In a preferred embodiment, the method for obtaining the mapped feature map to be detected, the mapped reference feature vector, and the broadcast expansion method are as follows:

[0072] The following mapping is performed on the multi-scale feature map to be detected:

[0073] ;

[0074] in, Indicates the first Features at each scale This represents the mapping of the feature map to be detected. Denotes the first feature mapping function. Indicates the first Multi-scale feature maps to be inspected at various scales;

[0075] The reference prototype vector is mapped to the same channel space as the mapped feature map through a learnable linear mapping: ,

[0076] in This represents a linear mapping of the fully connected layer. Represents the mapping reference eigenvector; Represents the reference prototype vector;

[0077] Broadcast the mapping reference feature vector to the spatial dimension, making it consistent with... Consistent dimensions:

[0078] ;

[0079] Broadcast means copying the vector to a spatial location; The dimension is The real tensor space, The number of channels after mapping. , The first The height and width of the feature map at each scale.

[0080] In this embodiment of the application, a first feature mapping operation and a second feature mapping operation are first performed to obtain a mapped feature map to be detected and a mapped reference feature vector, respectively. The preset number of levels is 3 in this scheme. The function is a block module in the model, specifically: it puts the first... The input feature map is subjected to channel transformation at each scale, and through normalization and nonlinear enhancement, a mapped input feature map is obtained for comparison with the reference prototype. Then, three sub-steps are executed sequentially: first, the input feature map is processed... Using a 1×1 convolution, we get: The number of output channels has increased from become Space size The transformation remains unchanged. Treating the vector at each spatial location as a feature vector, the above operation is equivalent to performing a linear transformation on each location: ; to conduct Normalization: , This represents the normalization function; finally, nonlinear activation is performed. , This represents a non-linear activation function.

[0081] In the embodiments of this application, This indicates that a learnable affine transformation is performed on the input vector, which will... Projected onto the target channel space, through The learning-based projection avoids channel semantic mismatch caused by direct comparison. The dimension is The real tensor space, Indicates the process and The number of target channels after mapping , They represent the first The height and width of the feature map at each scale; and Maintaining consistency in the number of channels and spatial dimensions allows subsequent cross-branch comparisons to be performed stably between tensors of the same scale and shape.

[0082] In a preferred embodiment, the similarity response map and the difference feature map are calculated as follows:

[0083] For any scale Mapping of the feature map to be detected With the mapping reference feature vector, at any spatial location The feature vector of the mapped feature map to be detected is taken at the location. Calculate the similarity response value:

[0084] ;

[0085] Each spatial location The similarity response values ​​are used to construct a similarity response map, and the difference feature map is calculated:

[0086] ;

[0087] in, Indicates the first Features at each scale This indicates the spatial location of the mapped feature map to be detected. Indicates the first Similarity response maps at various scales, Indicates the first Each scale in spatial location Similarity response value at the location, Indicates the first Differential feature maps at various scales This represents the spatially aligned mapping reference feature map obtained by broadcasting the mapping reference feature vector. This represents the inner product operation. The normalization function is as follows:

[0088] ;

[0089] Representing vectors The 2-norm, It is a stable term.

[0090] In this embodiment of the application, the calculation of the similarity response map and the difference feature map is used in the first... The similarity is measured at various scales to determine the degree of matching between the detected texture and the normal texture prototype in the batch at each spatial location, and the deviation of the detected texture from the normal texture is explicitly quantified. The advantage of the inner product after normalization in the above process is that the similarity calculation is no longer directly affected by the magnitude of the vector, but mainly reflects the closeness of the vector directions, thereby reducing interference and making the determination of whether a texture conforms to the normal texture in the batch more stable. This is achieved through the similarity response map. With difference feature map On the same scale, two complementary information types, matching degree and deviation representation, are obtained, which facilitates subsequent steps such as gating modulation to suppress normal texture differences and highlight real defect areas.

[0091] In a preferred embodiment, the modulation difference feature map is calculated as follows:

[0092] Obtain differential feature maps At any spatial location The anomaly intensity value is calculated and an anomaly intensity map is constructed using the following formula:

[0093] ;

[0094] Similarity response map With anomaly intensity map Channel concatenation is performed to obtain the gated input, which is then fed into a gated convolutional network to obtain the gated graph. The gate weights are then obtained by passing the graph through a sigmoid activation function.

[0095] ;

[0096] ;

[0097] Element-wise modulation of the difference feature map yields a modulated difference feature map:

[0098] ;

[0099] in, Indicates the first Anomaly intensity maps at various scales, Indicates the first Each scale in spatial location The abnormal intensity value at that location, Indicates gating input, This represents a gated convolutional network. Represents the sigmoid activation function. Represents the gating weight graph. This indicates a concatenation operation at the channel dimension. Represents element-wise multiplication, and a gated weight graph. Broadcasting along the channel dimension to match the difference feature map The channel dimensions are consistent. Indicates the first Modulation difference feature map at each scale.

[0100] In this embodiment, the calculation of the modulation difference feature map is used to distinguish invalid deviations in the difference feature map caused by normal complex textures from valid deviations that are more likely to be caused by defects. It is a gated convolutional network, which makes the gate weights depend on a single point. and And its response patterns within its neighborhood, thus making it more suitable for processing pattern features with periodic patch structures in textile textures; The sigmoid activation function is used to compress the gate values ​​into a continuous and interpretable weight range, making them stable as suppression or enhancement coefficients. (Gated weight graph) The number of channels can be a single channel or a small number of channels.

[0101] In a preferred embodiment, the method for calculating the fusion feature is as follows:

[0102] The first Multi-scale feature maps of various scales Similarity response graph and modulation difference feature map The fused input is obtained by concatenating the channels, and after performing convolutional fusion operations, a non-linear activation is applied to obtain the fused intermediate feature map:

[0103]

[0104] For the multi-scale feature map to be detected The alignment mapping is performed to obtain the aligned feature map to be detected, and the residuals of the fused intermediate feature map and the aligned feature map to be detected are added to obtain the fused feature:

[0105]

[0106] in, It is a non-linear activation function. For convolution fusion function, This is an alignment mapping function used to... The number of channels is mapped to... Consistent channel count This indicates a channel dimension splicing operation.

[0107] In this embodiment, the calculation of fusion features is used to converge the target characterization relied upon by general defect detection with batch features into a unified feature expression. This solution also provides explicit preservation of general characterization using residual structures, avoiding the model from degenerating into a targeted detection method that relies solely on contrast differences during the fusion process. In this embodiment, the general branch has basic defect morphology analysis capabilities, and cross-branch comparison provides supplementation, resulting in… As the first The fusion features of each scale are input into the defect detection head together with the fusion features of other scales.

[0108] like Figure 4 As shown, in one embodiment, a textile detection device is provided, which can be integrated into the aforementioned computer device 120, and specifically may include:

[0109] The texture sample acquisition unit 510 is used to acquire batch information of textiles to be inspected and to acquire several texture samples of defect-free textiles corresponding to the batch to be inspected.

[0110] Batch reference feature acquisition unit 520 is used to acquire a defect detection model, which includes a sample encoding branch, an image to be inspected branch, a cross-branch detection module, and a defect detection head. The sample encoding branch and the image to be inspected branch share a feature extraction network. The texture features of the texture sample are extracted to obtain a batch reference feature library.

[0111] The fusion feature acquisition unit 530 is used to input the image of the textile to be inspected into the defect detection model, obtain multi-scale inspection features through the branches of the image to be inspected, and compare the multi-scale inspection features with the batch reference feature library based on the cross-branch detection module to obtain fusion features;

[0112] The detection result acquisition unit 540 is used to input the fused features into the defect detection head to obtain the defect detection result.

[0113] In the embodiments of this application, the explanation and description of the above-mentioned textile testing device can be referred to the explanation and description of the corresponding method. For the description of the textile testing method, please refer to the above text, which will not be repeated here.

[0114] Figure 5 An internal structural diagram of a computer device in one embodiment is shown. Specifically, this computer device may be... Figure 1 Computer equipment 120. (e.g.) Figure 5 As shown, the computer device includes a processor, memory, network interface, input device, and display screen connected via a system bus. The memory includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores an operating system and may also store a computer program. When executed by the processor, this computer program enables the processor to implement a textile detection method. The internal memory may also store a computer program, which, when executed by the processor, enables the processor to perform the textile detection method.

[0115] Those skilled in the art will understand that Figure 5 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0116] In one embodiment, the textile testing device provided in this application can be implemented as a computer program, which can be implemented in various ways, such as... Figure 5The device operates on the equipment shown. The device's memory can store the various program modules that make up the textile testing device, for example, Figure 4 The texture sample acquisition unit 510 and batch reference feature acquisition unit 520, etc., are shown. The computer program, composed of various program modules, causes the processor to execute the steps in the textile detection methods of the various embodiments described in this specification.

[0117] In one embodiment, a textile inspection system is provided, the system including a memory and a processor, the memory storing a computer program that, when executed by the processor, causes the processor to perform the steps of the textile inspection method as described above.

[0118] In this embodiment, the system can be a computer hardware system that executes its corresponding method when running. The description of the textile detection method is provided above and will not be repeated here.

[0119] It should be understood that although the steps in the flowcharts of the various embodiments of this application are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise expressly stated herein, there is no strict order restriction on the execution of these steps, and these steps may be executed in other orders.

[0120] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Furthermore, any references to memory, storage, databases, or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory.

[0121] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

Claims

1. A method for testing textiles, characterized in that, The method includes: Obtain batch information of the textiles to be inspected, and obtain several pattern samples of the defect-free textiles corresponding to the batch to be inspected. A defect detection model is obtained, which includes a sample encoding branch, an image to be inspected branch, a cross-branch detection module, and a defect detection head. The sample encoding branch and the image to be inspected branch share a feature extraction network. Texture features of the texture sample are extracted to obtain a batch reference feature library. The image of the textile to be inspected is input into the defect detection model. Multi-scale features are obtained through the branches of the image to be inspected. Based on the cross-branch detection module, the multi-scale features are compared with the batch reference feature library to obtain fused features. The fused features are input into the defect detection head to obtain the defect detection result.

2. The textile testing method according to claim 1, characterized in that, The method for extracting texture features from the texture samples based on the defect detection model to obtain the batch reference feature library is as follows: Extract the batch ID from the batch information of the textiles to be inspected, and obtain the corresponding batch ID. Zhang's flawless texture sample image ; Preprocessing of defect-free texture sample images yields The texture features of the multi-scale samples are then input into a feature extraction network. ; in, ; ; This is a sample image after preprocessing; Features of the texture; For feature extraction networks; The scale number; For sample feature sets at the same scale Aggregation is performed to obtain the reference prototype features for the batch. The aggregation method is as follows: ; ; in For global pooling, For attention scoring functions; Features of the reference prototype at each scale Batch Identifier Associated storage forms a batch reference feature library. .

3. The textile testing method according to claim 1, characterized in that, The method for obtaining fused features by comparing the multi-scale features to be detected with the batch reference feature library based on the cross-branch detection module is as follows: Perform a first feature mapping operation on the multi-scale feature map to be detected to obtain a mapped feature map to be detected; A second feature mapping operation is performed on the batch reference prototype features to obtain a mapped reference feature vector, and the mapped reference feature vector is expanded into a spatially aligned mapped reference feature map through broadcasting; Based on the mapped feature map to be detected and the mapped reference feature map, a similarity response map and a difference feature map are calculated, and the difference feature map is modulated based on the gating weight to obtain a modulated difference feature map; The multi-scale feature map to be inspected, the similarity response map, and the modulation difference feature map are fused to obtain a fused intermediate feature map. Based on the fused intermediate feature map and the aligned feature map to be inspected, a fused feature is obtained. The residual fusion is used to retain the multi-scale feature information to be inspected on which general defect detection depends and to superimpose the texture features unique to the batch to be inspected.

4. The textile testing method according to claim 3, characterized in that, The methods for obtaining the mapped feature map to be detected, the mapped reference feature vector, and the broadcast expansion method are as follows: The following mapping is performed on the multi-scale feature map to be detected: ; in, Indicates the first Features at each scale This represents the mapping of the feature map to be detected. Denotes the first feature mapping function. Indicates the first Multi-scale feature maps of the target at various scales; The reference prototype vector is mapped to the same channel space as the mapped feature map through a learnable linear mapping: , in This represents a linear mapping of the fully connected layer. Represents the mapping reference eigenvector; Represents the reference prototype vector; Broadcast the mapping reference feature vector to the spatial dimension, making it consistent with... Consistent dimensions: ; Broadcast means copying the vector to a spatial location; The dimension is The real tensor space.

5. The textile testing method according to claim 3, characterized in that, The similarity response map and the difference feature map are calculated as follows: For any scale Mapping of the feature map to be detected With the mapping reference feature vector, at any spatial location The feature vector of the mapped feature map to be detected is taken at the location. Calculate the similarity response value: ; Each spatial location The similarity response values ​​are used to construct a similarity response map, and the difference feature map is calculated: ; in, Indicates the first Features at each scale This indicates the spatial location of the mapped feature map to be detected. Indicates the first Similarity response maps at various scales, Indicates the first Each scale in spatial location Similarity response value at the location, Indicates the first Differential feature maps at various scales This represents the spatially aligned mapping reference feature map obtained by broadcasting the mapping reference feature vector. This represents the inner product operation. The function satisfies: ,in Representing vectors The 2-norm, It is a stable term.

6. The textile testing method according to claim 3, characterized in that, The method for calculating the modulation difference feature map is as follows: Obtain differential feature maps At any spatial location The anomaly intensity value is calculated and an anomaly intensity map is constructed using the following formula: ; Similarity response map With anomaly intensity map Channel concatenation is performed to obtain the gated input, which is then fed into a gated convolutional network to obtain the gated graph. The gate weights are then obtained by passing the graph through a sigmoid activation function. ; ; Element-wise modulation of the difference feature map yields the modulated difference feature map. : ; in, Indicates the first Anomaly intensity maps at various scales, Indicates the first Each scale in spatial location The abnormal intensity value at the location, Indicates gating input, This represents a gated convolutional network. Represents the sigmoid activation function. Represents the gating weight graph. This indicates a concatenation operation at the channel dimension. Represents element-wise multiplication, and a gated weight graph. Broadcasting along the channel dimension to match the difference feature map The channel dimensions are consistent. Indicates the first Modulation difference feature map at each scale.

7. The textile testing method according to claim 3, characterized in that, The calculation method for the fusion feature is as follows: The first Multi-scale feature maps of various scales Similarity response graph and modulation difference feature map The fused input is obtained by concatenating the channels, and after performing convolutional fusion operations, it is further processed by nonlinear activation to obtain the fused intermediate feature map: For the multi-scale feature map to be detected Perform alignment mapping to obtain aligned feature maps to be detected The fused intermediate feature map is added to the aligned feature map to obtain the fused feature by performing residual addition. : in, It is a non-linear activation function. For convolution fusion function, This is an alignment mapping function used to... The number of channels is mapped to... Consistent channel count This indicates a channel dimension splicing operation.

8. A textile testing device, characterized in that, The device includes: The texture sample acquisition unit is used to acquire batch information of textiles to be inspected and to acquire several texture samples of defect-free textiles corresponding to the batch to be inspected. A batch reference feature acquisition unit is used to acquire a defect detection model, which includes a sample encoding branch, an image to be inspected branch, a cross-branch detection module, and a defect detection head. The sample encoding branch and the image to be inspected branch share a feature extraction network. The texture features of the texture sample are extracted to obtain a batch reference feature library. The fusion feature acquisition unit is used to input the image of the textile to be inspected into the defect detection model, obtain multi-scale inspection features through the branches of the image to be inspected, and compare the multi-scale inspection features with the batch reference feature library based on the cross-branch detection module to obtain fusion features; The detection result acquisition unit is used to input the fused features into the defect detection head to obtain the defect detection result.

9. A textile inspection system, characterized in that, It includes a memory and a processor, wherein the memory stores a computer program, which, when executed by the processor, causes the processor to perform the steps of the textile testing method as described in any one of claims 1 to 7.