Quantitative evaluation method and system of chemical fiber quality based on deep learning

By using a deep learning-based method to segment and extract features from images of chemical fiber filament cakes, and combining a self-focus strategy and visual implicit representation, the problems of low efficiency and insufficient accuracy in chemical fiber quality assessment are solved, achieving efficient and accurate quantitative assessment.

CN119048489BActive Publication Date: 2025-01-28CHENGDU LUXINGTONG INFORMATION TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411495760.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-10-25
Publication Date
2025-01-28
Estimated Expiration
2044-10-25

AI Technical Summary

Technical Problem

Existing methods for assessing the quality of synthetic fibers rely on manual inspection, which is inefficient and its accuracy is affected by subjective factors, making it difficult to achieve quantitative assessment. Machine vision methods also face challenges in feature extraction and assessment.

Method used

A deep learning-based approach is adopted to obtain images of chemical fiber cakes, perform image block segmentation, extract image features, implement a self-focus strategy for related feature extraction, use visual implicit representation for overall and local defect detection, and combine the overall image label for comprehensive evaluation.

Benefits of technology

It improves the accuracy and efficiency of chemical fiber quality assessment, realizes the quantitative assessment of chemical fiber cakes, reduces human intervention, and enhances the consistency and stability of assessment results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119048489B_ABST
    Figure CN119048489B_ABST
Patent Text Reader

Abstract

The present invention provides a method and system for quantitatively evaluating chemical fiber quality based on deep learning. The method extracts image features from multiple silk cake image blocks to obtain image feature sequences, extracts associated features using a self-attention strategy for multiple image features, and completes deep integration of overall semantics. When extracting associated features, multiple image features of a target silk cake image block are prevented from paying attention to multiple image features of other silk cake image blocks. After the associated feature extraction is completed, the visual implicit representation of the overall image identification characterizes the overall semantics of the multiple silk cake image blocks. Based on this, overall defect detection information is obtained through the visual implicit representation of the overall image identification, and local image defect detection is performed through the visual implicit representation of multiple image features to obtain local defect detection information. The target defect detection information is determined through the overall defect detection information and the local defect detection information, thereby increasing the defect detection accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of deep learning, and in particular to a method and system for quantitatively evaluating chemical fiber quality based on deep learning. Background Art

[0002] In the field of chemical fiber production, the quality assessment of chemical fiber yarn cakes is a key link in ensuring product quality. The quality status of chemical fiber yarn cakes directly affects the performance of subsequent processing and final products, so it is of great significance to accurately and efficiently assess their quality. Traditional chemical fiber quality assessment methods mostly rely on manual inspection. This manual inspection method has many disadvantages. First, manual inspection is inefficient. Faced with a large number of chemical fiber yarn cakes, manual inspection is difficult to meet the needs of rapid production, resulting in extended production cycles and increased production costs. Secondly, the accuracy of manual inspection is greatly affected by subjective factors such as the experience and fatigue of the inspectors. Different inspectors may have different judgments on the quality of the same yarn cake, which makes the quality assessment results lack consistency and stability. In addition, manual inspection is difficult to achieve quantitative evaluation of the quality of yarn cakes, and can only give qualitative results, which cannot meet the requirements of accurate analysis and traceability of quality data in modern production processes.

[0003] With the development of computer technology and image processing technology, chemical fiber quality assessment methods based on machine vision have gradually attracted attention. Machine vision technology can quickly obtain image information and analyze images through algorithms, which is expected to overcome many shortcomings of manual inspection. However, the existing chemical fiber quality assessment methods based on machine vision still face some challenges. For example, when processing chemical fiber cake images, how to accurately extract image features and effectively use these features for quality assessment is an urgent problem to be solved. Summary of the invention

[0004] The purpose of the present invention is to provide a method and system for quantitative evaluation of chemical fiber quality based on deep learning, which is achieved as follows:

[0005] In a first aspect, the present invention provides a method for quantitatively evaluating chemical fiber quality based on deep learning, comprising: obtaining a chemical fiber silk cake image to be quality evaluated, and splitting the chemical fiber silk cake image into image blocks to obtain multiple silk cake image blocks; performing image feature extraction on the multiple silk cake image blocks to obtain an image feature sequence, and inserting an image overall identifier into the image feature sequence, wherein the image feature sequence includes multiple image features of each silk cake image block; performing associated feature extraction using a self-attention strategy on multiple image features in the image feature sequence, and preventing multiple image features of a target silk cake image block from affecting multiple image features of other silk cake image blocks during associated feature extraction. , obtain visual implicit representations of multiple image features in the image feature sequence, and the target silk cake image block is any silk cake image block among the multiple silk cake image blocks; perform overall image defect detection through the visual implicit representation of the image overall identification, and obtain overall defect detection information of the multiple silk cake image blocks; perform local image defect detection through the visual implicit representation of multiple image features of the target silk cake image block, and obtain local defect detection information of the target silk cake image block; determine the target defect detection information through the overall defect detection information of the multiple silk cake image blocks and the local defect detection information of the target silk cake image block.

[0006] In a second aspect, the present invention provides a computer system comprising: one or more processors; a memory; one or more computer programs; wherein the one or more computer programs are stored in the memory and configured to be executed by the one or more processors, and when the one or more computer programs are executed by the processors, the method as described above is implemented.

[0007] Beneficial effects of the present invention: The present invention extracts image features from multiple silk cake image blocks to obtain image feature sequences, implements self-attention strategy for associated feature extraction for multiple image features in the image feature sequences, completes deep integration of overall semantics, and prevents multiple image features of a target silk cake image block from paying attention to multiple image features of other silk cake image blocks during associated feature extraction, and can mine local semantics for the target silk cake image block. After completing associated feature extraction, the visual implicit representation of the overall image identifier represents the overall semantics of multiple silk cake image blocks. Based on this, overall image defect detection is performed through the visual implicit representation of the overall image identifier to obtain overall defect detection information of multiple silk cake image blocks, and the visual implicit representation of multiple image features of the target silk cake image block represents the local semantics of the target silk cake image block. Based on this, local image defect detection is performed through the visual implicit representation of multiple image features of the target silk cake image block to obtain local defect detection information of the target silk cake image block. The target defect detection information is determined through the overall defect detection information of multiple silk cake image blocks and the local defect detection information of the target silk cake image block, thereby increasing the defect detection accuracy. BRIEF DESCRIPTION OF THE DRAWINGS

[0008] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for describing the embodiments of the present invention are briefly introduced below.

[0009] Figure 1 It is a flow chart of a method for quantitatively evaluating chemical fiber quality based on deep learning provided in an embodiment of the present invention.

[0010] Figure 2 It is a schematic diagram of the composition of a computer system provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0011] The execution subject of the chemical fiber quality quantitative evaluation method based on deep learning in the embodiment of the present invention is a computer system, including but not limited to a server, a personal computer, a laptop computer, a tablet computer, a smart phone, etc. Figure 1 As shown, the method includes:

[0012] Step S100: obtaining a synthetic fiber silk cake image to be evaluated for quality, and splitting the synthetic fiber silk cake image into image blocks to obtain a plurality of silk cake image blocks.

[0013] In the embodiment of the present invention, the chemical fiber cake is a product form in the chemical fiber production process. In the chemical fiber manufacturing process, the silk is formed into a cake through processes such as winding. In order to quantitatively evaluate the quality of the chemical fiber, the computer system first needs to obtain the chemical fiber cake image. This acquisition process can be achieved in many ways.

[0014] For example, in a modern industrial production environment, a computer system can be connected to an image acquisition device. These image acquisition devices can be high-precision cameras specially designed for industrial inspection. The camera can be installed at a specific position on the production line. When the silk cake passes this position, the camera takes a picture of the silk cake to obtain its image information. Assuming that the imaging principle of the camera is based on optical imaging, the image it captures can be represented as a two-dimensional matrix, where each element of the matrix corresponds to a pixel in the image, and the value of the pixel represents the color or grayscale information of the point. If it is a color image, each pixel may be composed of the values ​​of three channels: red (R), green (G), and blue (B). For example, the RGB value of a pixel is (255,0,0), indicating that the pixel is red. For a grayscale image, each pixel has only one grayscale value, and the value range is usually 0-255, with 0 representing black and 255 representing white.

[0015] After acquiring the synthetic fiber silk cake image, the computer system performs an image block splitting operation on it. The purpose of this operation is to decompose a complete synthetic fiber silk cake image into multiple smaller parts, namely, silk cake image blocks. This will help to perform more detailed feature extraction and analysis of the image later.

[0016] The computer system can use a variety of image block splitting techniques. One feasible technique is based on fixed-size grid division. For example, assuming that the acquired chemical fiber silk cake image is a square image of 1000×1000 pixels, if it is to be split into 10×10 image blocks, then the size of each image block is 100×100 pixels. The computer system can start from the upper left corner of the image and divide it to the right and downward in turn according to the pre-set division rules. The specific calculation method can be expressed by a simple mathematical formula. Let the width of the original image be W, the height be H, the number of rows to be divided into is m, and the number of columns is n, then the width of each image block is w=W / n, and the height is h=H / m. This splitting method enables the computer system to convert a large and complex chemical fiber silk cake image into multiple relatively simple and easy-to-process sub-images, namely, silk cake image blocks. Each silk cake image block contains part of the silk cake image information, which can be the local texture, color distribution and other characteristics of the silk cake. For example, in a synthetic fiber yarn cake image, the yarns in different areas may have different winding densities or color differences. By splitting the image blocks, these local features can be extracted and analyzed separately, thus providing a more comprehensive and accurate basis for subsequent quality assessment.

[0017] In industrial production environments, image block splitting can also help improve processing efficiency. Since the computer system can process multiple silk cake image blocks in parallel, the processing time can be greatly shortened compared to directly processing the entire large image. At the same time, this splitting method is also in line with the structural characteristics of the chemical fiber silk cake itself. Because the silk cake is made of layers of silk, the silk in different layers or different areas may have different quality. Image block splitting can analyze these different areas separately and evaluate the quality of chemical fibers more accurately.

[0018] Step S200: extracting image features from a plurality of silk cake image blocks to obtain an image feature sequence, inserting the overall image identifier into the image feature sequence, wherein the image feature sequence includes a plurality of image features of each silk cake image block.

[0019] In the embodiment of the present invention, the image feature is a description of representative and distinguishing information in the image. For the silk cake image block, the image feature can reflect the various characteristics of the silk cake. For example, the pixel value is a basic image feature. In a computer system, the image is stored in the form of a digital matrix, and each element is the value of a pixel. For a grayscale image, the pixel value is between 0-255, and this value directly reflects the grayscale of the pixel. For example, in a silk cake image block, if the pixel value of a certain area is generally low, it may mean that the silk color in the area is darker or the light is darker.

[0020] In addition to pixel values, there can be other types of image features. For example, texture features describe the grayscale variation pattern of pixels in an image. For synthetic fiber yarn cakes, the winding method and density of the yarn will affect the texture of the image. If the yarn is tightly and evenly wound, the texture of the image may show a regular pattern; on the contrary, if the yarn is wound in a disorderly manner, the texture will be more complex and irregular. Computer systems can extract texture features by calculating the grayscale difference between adjacent pixels and other methods.

[0021] Computer systems can use a variety of algorithms to extract image features. Taking pixel value extraction as an example, for a silk cake image block, if it is an m×n matrix (m is the number of rows, n is the number of columns), the computer system can directly read each element in the matrix as a pixel value feature. Assuming that the silk cake image block I has a pixel value matrix of P_{ij} (i=1,2,…,m, j=1,2,…,n), then P_{ij} is the pixel value feature of this position.

[0022] For the extraction of texture features, the gray-level co-occurrence matrix (GLCM) algorithm can be used. First, determine a direction (such as the horizontal direction) and a distance (such as the pixel spacing is 1), and then count the frequency of different gray value combinations in this direction and distance. Suppose the gray value range of the image block is G={g_1,g_2,…,g_k}, and when the horizontal spacing is d, calculate the gray-level co-occurrence matrix C, where C(i,j) represents the number of times a pixel with a gray value of g_i appears at the same time as a pixel with a horizontal distance of d and a gray value of g_j. By analyzing C, texture features such as contrast and correlation can be obtained.

[0023] After the computer system extracts features from each silk cake image block, it arranges these features in a certain order to form an image feature sequence. For example, suppose there are three silk cake image blocks B_1, B_2, and B_3. For B_1, the extracted pixel value features are P_{11}, P_{12}, …, and the texture features are T_{11}, T_{12}, …; for B_2, the extracted pixel value features are P_{21}, P_{22}, …, and the texture features are T_{21}, T_{22}, …; for B_3, the extracted pixel value features are P_{31}, P_{32}, …, and the texture features are T_{31}, T_{32}, …. Then the image feature sequence can be expressed as {P_{11},P_{12},…,T_{11},T_{12},…,P_{21},P_{22},…,T_{21},T_{22},…,P_{31},P_{32},…,T_{31},T_{32},…}. This sequence contains multiple image features of each silk cake image block, which will serve as the basic data structure for subsequent processing.

[0024] The overall image identification can be a global mark for the entire synthetic fiber yarn cake image. It can contain some basic information about the yarn cake, such as the production batch of the yarn cake, the production equipment number, etc. Although this information is not a visual feature directly extracted from the image, it is of great significance for the evaluation of chemical fiber quality. For example, yarn cakes from different production batches may have quality differences due to differences in raw materials or fine-tuning of the production process. If the production batch identification of the yarn cake is known, the computer system can combine historical data or known quality characteristics of the batch to make a more accurate judgment when conducting quality assessment.

[0025] The computer system inserts the overall image identification into the image feature sequence. Assuming that the overall image identification is ID={batch_number=123,equipment_id=456} and the image feature sequence is F={f_1,f_2,…}, the new sequence after insertion can be expressed as {batch_number=123,equipment_id=456,f_1,f_2,…}. This insertion operation makes it easy to obtain the overall identification information of the image when processing the image feature sequence later, and can comprehensively consider the local features of the image (from the silk cake image blocks) and the global identification information in the process of feature extraction and quality assessment, thereby improving the accuracy and comprehensiveness of the quantitative evaluation of chemical fiber quality.

[0026] Step S300: extract associated features using a self-attention strategy for multiple image features in the image feature sequence, prevent multiple image features of a target silk cake image block from paying attention to multiple image features of other silk cake image blocks during associated feature extraction, and obtain a visual implicit representation of multiple image features in the image feature sequence. The target silk cake image block is any silk cake image block among the multiple silk cake image blocks.

[0027] In the embodiment of the present invention, when evaluating the quality of a synthetic fiber silk cake image, there are complex relationships between the image features. The purpose of correlation feature extraction is to explore the intrinsic relationship between these image features so as to better understand the semantic information of the image. For example, for the pixel value features and texture features in a silk cake image block, there may be a certain correlation between them. The distribution of pixel values ​​may affect the performance of texture, and vice versa. Through correlation feature extraction, the computer system can discover this hidden relationship, thereby more comprehensively describing the characteristics of the silk cake image.

[0028] To illustrate with a simple example, if the pixel values ​​in a certain area of ​​the silk cake image block are generally high (lighter in color) and the texture shows regular parallel lines, this may mean that the silk is loosely and evenly wound in this area. This correlation between pixel values ​​and texture is very important for judging the quality of the silk cake, because the winding of the silk is directly related to the quality of the chemical fiber.

[0029] The self-attention strategy is an effective method for processing sequence data in deep learning. In this scenario, the image feature sequence is regarded as a sequence data. The self-attention strategy allows each image feature to pay attention to other image features in the sequence, thereby calculating the correlation weight between them. For example, for a pixel value feature in the image feature sequence, the self-attention strategy can determine the degree of correlation between it and other pixel value features, texture features, and other types of features.

[0030] Assuming that there is a pixel value feature f_p and a texture feature f_t in the image feature sequence, the self-attention strategy will calculate the attention weight w_{pt} of f_p to f_t based on their numerical features and their positions in the entire sequence. This weight represents the degree of association between f_p and f_t. The higher the weight, the closer the relationship between them.

[0031] When processing silk cake image blocks, each block has its own local features, and these local features are crucial for judging the quality of the block. Without this restriction, the image features of one block may excessively affect the feature analysis of other blocks, resulting in erroneous quality assessment results. For example, a silk cake image block may have some special image features due to local stains or small defects in the production process. If these features affect the analysis of other normal blocks, it will interfere with the accuracy of the entire silk cake quality assessment.

[0032] Consider a silk cake image block B_1 with local color deviation. If the influence of its image features on other blocks is not restricted, during the association feature extraction process, the special color deviation features of B_1 may cause the features of other normal blocks to be incorrectly associated, causing the computer system to mistakenly believe that other blocks also have similar quality problems, while in fact other blocks are normal.

[0033] Computer systems can use a variety of technical means to achieve this restriction. One possible way is to set an independent identifier or mask for each silk cake image block when calculating the association relationship. When calculating the association between a target silk cake image block and other blocks, this mask is used to shield the target block from unnecessary attention to other blocks. Assume that the image features in the image feature sequence are organized into a matrix form F, where the rows represent different image features and the columns represent different silk cake image blocks. If you want to prevent the image features of the i-th silk cake image block (target block) from affecting other blocks, you can create a mask matrix M, in which the column elements corresponding to the i-th block are set to 0 (indicating shielding), and the column elements corresponding to other blocks are set to 1 (indicating normal association). When calculating the association features, F and M are subjected to some operation (such as element-level multiplication) to achieve the restriction on the target block.

[0034] Visual implicit representation is an abstract representation of image features after complex processing. It combines the correlation between image features and the above-mentioned constraints, and can more effectively reflect the essential characteristics of the image. This representation is not as intuitive as the original image features, but it is more suitable for subsequent tasks such as image defect detection. For example, after the original pixel value features and texture features are extracted through the correlation features of the self-attention strategy and the constraints between blocks are considered, the resulting visual implicit representation may be a low-dimensional vector, which contains information such as the deep relationship between image features and the independence of local features.

[0035] Assuming that the original image feature sequence contains features of multiple dimensions, the visual implicit representation obtained after the above processing may be an n-dimensional vector vec{v}=(v_1,v_2,…,v_n), where the value of each dimension is not a simple combination of original features, but is obtained through complex association calculations and restriction processing. This vector vec{v} can more comprehensively describe the characteristics of the image, and can be analyzed as a whole feature in subsequent quality assessment.

[0036] Computer systems can use the neural network structure in deep learning to achieve the conversion from raw image features to visual implicit representations. For example, a multi-layer perceptron (MLP) can be used. Assume that the image feature matrix after correlation feature extraction and restriction processing is F', and F' is used as the input of the multi-layer perceptron. The hidden layer of the multi-layer perceptron processes the input through a series of linear transformations and nonlinear activation functions (such as ReLU function: y=max(0,x)), and finally the output layer obtains the visual implicit representation vector vec{v}. Specifically, for each element x_{ij} in the input F', after the hidden layer calculation: h_1=\sum_{k=1}^{m}w_{1k}x_{ij}+b_1, a_1=ReLU(h_1),…, h_l=\sum_{k=1}^{m}w_{lk}a_{l-1}+b_l, a_l=ReLU(h_l) (where w_{lk} is the weight, b_l is the bias, and l is the number of hidden layers), and finally the output layer obtains the visual implicit representation \vec{v}.

[0037] Step S400: performing overall image defect detection through visual implicit representation of the overall image identification to obtain overall defect detection information of multiple silk cake image blocks.

[0038] The overall image identification contains global information about the entire synthetic fiber yarn cake image, such as production batch, equipment number, etc. After being processed in the previous steps, its visual implicit representation integrates the correlation between these global information and image features. This correlation is an abstract representation at the level of the entire image. For example, different production batches may use different raw materials or production processes. This information is related to the image's pixel values, texture and other features in a complex way in the visual implicit representation. If a batch of raw materials is of poor quality, it may be reflected in the visual implicit representation as certain specific numerical combinations or feature patterns, which reflect the quality problem tendency of the entire yarn cake image at the macro level.

[0039] Taking the production equipment number as an example, a specific production equipment may have some inherent characteristics, such as slight differences in winding tension, which will affect the quality of the yarn cake. In the visual implicit representation of the overall image identification, the information related to the equipment number is combined with the image features to form an overall description of the quality of the entire yarn cake image. The computer system can use this integrated representation to perform overall image defect detection.

[0040] Visual implicit representation is a processed abstract form. It is not as intuitive and interpretable as the original image features, but it contains rich information. For example, it may be a vector after dimensionality reduction, and each element in this vector represents the comprehensive performance of the overall image features in a certain dimension. Assume that the visual implicit representation is an n-dimensional vector \vec{v}=(v_1,v_2,…,v_n), v_1 ​​may be related to the quality tendency related to the production batch, v_2 may be related to the image features related to the equipment characteristics, etc. These dimensions are interrelated and together constitute an abstract description of the entire silk cake image, providing a comprehensive feature basis for overall image defect detection.

[0041] The overall image defect detection aims to determine whether there are quality problems in the entire synthetic fiber cake image from a macroscopic perspective. This corresponds to the local detection of a single cake image block. The overall image defects may include problems such as the irregular shape of the entire cake and uneven color distribution, which are manifested at the level of the entire image. For example, if the cake is eccentric during the winding process, it may appear in the image that the density of the yarn on one side is significantly higher than that on the other side. This overall unevenness is a possible defect.

[0042] From the perspective of image features, overall defects are related to the global statistical characteristics of the image. For example, the grayscale mean and variance of the entire silk cake image are calculated. If the grayscale mean is within a certain range and the variance is small, it may indicate that the color of the silk cake is relatively uniform; conversely, if the variance is large, it may indicate that there is a problem of uneven color, which may be caused by uneven mixing of raw materials or certain interference factors in the production process. Computer systems can calculate various statistical features of the visual implicit representation of the overall image identification for defect detection. In addition to the mean and variance mentioned above, statistics such as skewness and kurtosis can also be calculated. Skewness is used to measure the asymmetry of the data distribution, and kurtosis is used to describe the degree of peak in the data distribution. For the visual implicit representation vector vec{v}, its skewness S and kurtosis K can be calculated by the following formulas:

[0043] Skewness S=\frac{n}{(n-1)(n-2)}\sum_{i=1}^{n}(\frac{v_i-\bar{v}}{s})^3, where \bar{v} is the mean of the vector \vec{v} and s is the standard deviation.

[0044] Kurtosis K=\frac{n(n+1)}{(n-1)(n-2)(n-3)}\sum_{i=1}^{n}(\frac{v_i-\bar{v}}{s})^4-\frac{3(n-1)^2}{(n-2)(n-3)}.

[0045] If the skewness and kurtosis values ​​exceed the pre-set normal range, it may indicate that there is an overall image defect. For example, for a normal silk cake image, the skewness and kurtosis of its visual implicit representation vector may be within a certain range. If the overall characteristics of the silk cake change due to anomalies in the production process (such as sudden changes in raw materials), the skewness and kurtosis may exceed this range and be detected as an overall defect.

[0046] Computer systems can build classification models to perform overall image defect detection. A large number of known visual implicit representations of normal and defective image overall identifications are used as training data to train a classifier, such as a support vector machine (SVM) or a neural network classifier. For example, for a neural network classifier, the visual implicit representation vector vec{v} is used as input, and is calculated by the neurons of the hidden layer (assuming that the calculation of the hidden layer neurons is h_j=\sum_{i=1}^{n}w_{ij}v_i+b_j, where w_{ij} is the weight and b_j is the bias), and finally the classification result (such as normal or defective) is obtained through the output layer.

[0047] In actual detection, the visual implicit representation of the overall identification of the image to be detected is input into the trained classifier to obtain the overall defect detection information. This method can use a large amount of historical data and complex model structure to accurately determine whether there are defects in the overall image.

[0048] Step S500: performing local image defect detection through visual implicit representation of multiple image features of the target silk cake image block to obtain local defect detection information of the target silk cake image block.

[0049] In the embodiment of the present invention, multiple image features of the target silk cake image block are obtained through the previous steps. These image features include pixel values, texture features, etc., which reflect the local characteristics of the silk cake image block. For example, the pixel value can reflect the color depth of the silk cake in the local area, and the texture feature can reflect the winding method and density of the silk. In the previous steps, these image features are converted into visual implicit representations through operations such as the associated feature extraction of the self-attention strategy.

[0050] Take a silk cake image block as an example, assuming that its original pixel value matrix is ​​P and the texture feature matrix is ​​T. In the process of extracting associated features, the computer system considers the relationship between these features and may convert them into visual implicit representations through some linear transformations and nonlinear activation functions. This visual implicit representation is an abstract and comprehensive feature representation. It is no longer a simple combination of original pixel values ​​and texture features, but a vector form after deep integration, such as an n-dimensional vector vec{v}=(v_1,v_2,…,v_n), in which the value of each dimension contains the complex association between the original image features.

[0051] This visual implicit representation can represent the characteristics of the target silk cake image block in a more compact and efficient way, so that the computer system can better identify local abnormalities. For example, in a normal silk cake image block, the winding of the silk should be relatively uniform, which may be reflected in the visual implicit representation as the values ​​of certain dimensions being within a specific range, and there is a certain relationship pattern between these dimensions. If there are problems such as local silk winding disorder or silk breakage during the production process, then the visual implicit representation will be manifested as a deviation from the normal pattern, and this deviation can be used as a basis for detecting local defects.

[0052] Local image defect detection is a quality inspection for local areas of the silk cake image blocks. Different from the overall image defect detection, it focuses on the possible problems in a specific part of the silk cake image block. These local defects may include local breakage of the silk, local color abnormality, local uneven winding of the silk, etc. For example, in a corner of the silk cake, the silk may be broken due to mechanical collision during the production process, or the local color may be too dark or too light due to uneven dyeing. These are all manifestations of local defects.

[0053] From the perspective of image features, local defects can cause local changes in image features. For example, the breakage of a silk thread may cause a sudden interruption in the texture features, which may be manifested in the pixel value as a difference in color between the break and the surrounding area or a sudden change in grayscale value. The computer system captures these local changes by analyzing the visual implicit representation of the target silk cake image blocks to determine whether there are local defects.

[0054] Local image defect detection is crucial for accurately evaluating the quality of chemical fibers. Even if the entire silk cake does not appear to have obvious problems, local defects may affect the local performance of the silk cake, which in turn may cause more serious problems during subsequent processing or use. For example, if there is a local breakage of the silk, in further textile processing, the broken silk may be mixed into the finished product, affecting product quality. Moreover, local defect detection can locate the problem more accurately, which helps to take targeted improvement measures in the production process, such as local adjustments to production equipment or local optimization of raw material supply.

[0055] Computer systems can use distance metrics to detect local defects. First, it is necessary to establish a standard template or reference set for the visual implicit representation of normal silk cake image blocks. Assume that the normal visual implicit representation vector set is {\vec{v}_{normal}^1,\vec{v}_{normal}^2,…,\vec{v}_{normal}^m}. For the visual implicit representation vector \vec{v}_{target} of the target silk cake image block, calculate its distance from the vector in the reference set. A feasible distance metric is the Euclidean distance, with the formula d(\vec{v}_{target},\vec{v}_{normal}^i)=\sqrt{\sum_{j=1}^{n}(v_{target,j}-v_{normal,j}^i)^2}, where n is the dimension of the vector.

[0056] If the calculated distance is greater than a pre-set threshold, it can be determined that the target silk cake image block has a local defect. For example, for a normal silk cake image block, the Euclidean distance between its visual implicit representation and the standard template should be within a small range. If the visual implicit representation changes significantly due to a local defect, the distance will exceed the threshold and it will be detected as defective.

[0057] The computer system can construct a machine learning classifier for local defect detection. For example, a decision tree classifier can be used. First, a large number of visual implicit representations of silk cake image blocks with local defect annotations are collected as training data. The decision tree classifier constructs a decision tree model by learning the feature patterns in these data. When constructing the decision tree, the best feature segmentation point is selected according to criteria such as information gain.

[0058] The visual implicit representation vector vec{v}_{target} of the target silk cake image block is input into the trained decision tree classifier. The decision tree makes a series of judgments based on the eigenvalues ​​in the vector and finally outputs the result of whether there are local defects in the target silk cake image block. This method can use a large amount of historical data to accurately identify local defects, and can classify and judge according to different local defect types, providing more detailed local defect detection information.

[0059] Step S600: determining target defect detection information through overall defect detection information of a plurality of silk cake image blocks and local defect detection information of a target silk cake image block.

[0060] In the embodiment of the present invention, the overall defect detection information of multiple yarn cake image blocks reflects the quality status of the entire chemical fiber yarn cake at the macro level. This information is obtained by performing overall image defect detection on the visual implicit representation of the overall image identification in step S400. For example, the overall defect detection information may include evaluation results of the overall shape integrity of the yarn cake, the uniformity of the overall color distribution, etc. If the overall detection finds that the shape of the yarn cake is irregular, it may indicate that there are problems in the winding process during the production process, such as uneven winding tension or poor concentricity of the winding equipment. Such macro-level problems may affect the overall performance of the yarn cake and the convenience of subsequent processing.

[0061] The acquisition of overall defect detection information is often based on a comprehensive analysis of the entire silk cake image. The computer system may use statistical analysis methods, such as calculating the grayscale histogram features of the entire silk cake image. It is assumed that the peak position, width and other features of the grayscale histogram can reflect the overall color distribution of the silk cake. If the peak of the histogram is too wide or there are multiple peaks, it may indicate uneven color distribution, which is a manifestation of an overall defect.

[0062] The local defect detection information of the target silk cake image block is focused on the local area of ​​the silk cake image block. This is the result of performing local image defect detection through the visual implicit representation of multiple image features of the target silk cake image block in step S500. The local defect detection information may involve the situation of local silk breakage, local color abnormality, local uneven silk winding, etc. In a small area of ​​the silk cake image block, if the local texture feature suddenly breaks or changes, it may indicate that the silk is broken or the winding is chaotic.

[0063] Local defect detection information focuses more on the local feature changes within the silk cake image block. The computer system may obtain this information by analyzing the local changes in the texture feature matrix of the image block. For example, the variance of a local area in the texture feature matrix is ​​calculated. If the variance is too large, it may indicate that the local area has uneven texture, which may be a signal of a local defect.

[0064] The computer system considers the overall defect detection information and the local defect detection information to determine the target defect detection information. This is because the overall and local quality conditions are interrelated. For example, if the overall defect detection information shows that the overall color distribution of the silk cake is uneven, and the local defect detection information shows that a certain image block has a local overly dark color, then it can be inferred that this local overly dark area is a factor that causes the overall color unevenness.

[0065] When determining the target defect detection information, the computer system sets some judgment rules. One possible rule is based on the severity and scope of the defect. For example, if the overall defect detection information shows that the silk cake has slight shape irregularities, but the local defect detection information shows that only a very small number of image blocks have negligible local silk winding unevenness, the computer system may comprehensively judge that the overall quality is basically qualified, but slight adjustments to the production process are required.

[0066] Another judgment rule can be based on the correlation of defect types. For example, if the overall defect detection information shows that the overall grayscale value of the silk cake is too high (the color is too light), and the local defect detection information shows that multiple image blocks have local grayscale values ​​that are too high (the color is too light), and these local areas are widely distributed in the entire silk cake, then the computer system can determine that the target defect detection information is that the silk cake has quality problems, which may be caused by problems with the raw materials or the dyeing process.

[0067] The computer system can establish a rule-based judgment system to determine the target defect detection information. These rules are derived from the analysis of a large number of silk cake samples with known quality conditions. For example, set a rule: if the shape irregularity in the overall defect detection information exceeds a certain threshold T_1, and there are more than N image blocks with broken wires in the local defect detection information, then the target defect detection information is judged to be a silk cake with serious quality problems. For another example, set another rule: if the color distribution unevenness in the overall defect detection information is within a certain range [a, b], and there are no more than M image blocks in the local defect detection information with local color anomalies, and the degree of anomaly is less than a certain value C, then the target defect detection information is judged to be a silk cake with basically qualified quality, but attention needs to be paid to the local area. These rules can be adjusted and optimized according to actual production needs and quality standards.

[0068] The computer system can construct a probability model to determine the target defect detection information. For example, assuming that the overall defect detection information I_{global} and the local defect detection information I_{local} are two random variables, their joint probability distribution P(I_{global},I_{local}) is established based on historical data. Through the Bayesian theorem P(I_{local}|I_{global})=\frac{P(I_{global},I_{local})}{P(I_{global})}, the computer system can infer the probability of local defect detection information based on the known overall defect detection information, and vice versa.

[0069] Then, the target defect detection information is determined according to the set probability threshold. For example, if P(I_{local}|I_{global}) is greater than a certain probability threshold P_T, and the local defect detection information indicates that there is a more serious local defect, then the target defect detection information is determined to be a quality problem of the wire cake. This method based on the probability model can take into account the uncertainty relationship between the overall and local defect detection information, and provide a more flexible and accurate quality assessment.

[0070] In summary, step S600 integrates the overall defect detection information and the local defect detection information, and uses reasonable logic and technical means to determine the target defect detection information, thereby providing a comprehensive and accurate result for the quantitative evaluation of chemical fiber quality, which helps production enterprises to effectively control product quality and improve production efficiency.

[0071] In an independently implementable implementation, the overall image defect detection is a consistency detection process, and the overall defect detection information of multiple silk cake image blocks is the consistency between the multiple silk cake image blocks; the local image defect detection is a defect type detection process, and the local defect detection information of the target silk cake image block is the defect type of the target silk cake image block. Based on this, step S600, determining the target defect detection information through the overall defect detection information of multiple silk cake image blocks and the local defect detection information of the target silk cake image block, may include:

[0072] Step S610: if the consistency between the plurality of silk cake image blocks is greater than the consistency reference value, and the defect type of the target silk cake image block is consistent with the defect types of other silk cake image blocks, then it is determined that the target defect detection information is that the target silk cake image block and the other silk cake image blocks are both normal images;

[0073] Step S620: If the consistency between the plurality of silk cake image blocks is not greater than the consistency reference value, and the number of inconsistencies between the defect type of the target silk cake image block and the defect types of other silk cake image blocks is greater than a preset number, then it is determined that the target defect detection information is that the target silk cake image block contains defects.

[0074] In the embodiment of the present invention, the overall image defect detection in step S400 is a consistency detection process, and the overall defect detection information of multiple silk cake image blocks is the consistency between the multiple silk cake image blocks. The consistency between multiple silk cake image blocks is a concept that comprehensively considers multiple aspects. From the perspective of overall image defect detection, the computer system may have analyzed the similarity of multiple silk cake image blocks in some macro features in the previous steps. For example, in terms of the color characteristics of the silk cake, consistency can be reflected in whether the average grayscale values ​​of each image block are similar. Assuming that through the previous processing, the computer system obtains the average gray value G_i (i=1,2,…,n, n is the number of image blocks) of each silk cake image block, then the consistency can be measured by calculating the standard deviation of these average gray values ​​\sigma=\sqrt{\frac{\sum_{i=1}^{n}(G_i-\overline{G})^2}{n}}, where \overline{G}=\frac{\sum_{i=1}^{n}G_i}{n} is the mean of the average gray values. If \sigma is less than the consistency reference value, it means that there is a high consistency between multiple silk cake image blocks in terms of color.

[0075] In addition to color, there are also consistency considerations in the texture features of the silk. For example, the roughness of the texture or the consistency of the texture direction. The computer system can evaluate this consistency by calculating the correlation coefficient of the texture features. Let T_i be the texture feature vector of the i-th silk cake image block, and calculate the texture feature correlation coefficient r_{ij}=\frac{\sum_{k=1}^{m}(T_{ik}-\overline{T_i})(T_{jk}-\overline{T_j})}{\sqrt{\sum_{k=1}^{m}(T_{ik}-\overline{T_i})^2\sum_{k=1}^{m}(T_{jk}-\overline{T_j})^2}} (where m is the dimension of the texture feature vector). If the average value of r_{ij} between all image blocks is high, it means that there is also good consistency in texture features.

[0076] In this embodiment, the local image defect detection in step S500 is a defect type detection process, and the local defect detection information of the target silk cake image block is the defect type of the target silk cake image block. For example, the defect type may include local breakage of the silk, local color abnormality, or local uneven winding of the silk. For other silk cake image blocks, there are also respective local defect detection results. When the computer system determines that the defect type of the target silk cake image block is consistent with the defect type of other silk cake image blocks, the consistency here means that the types of defects are the same.

[0077] For example, suppose the local defect detection result of the target silk cake image block is that the local color is too dark. The computer system will check the local defect detection results of other silk cake image blocks. If other blocks also have local colors that are too dark or have no local defects (that is, no defects can also be regarded as a consistent situation), then this condition is met. This consistency judgment helps to determine whether there is a common quality problem pattern in the local features of the entire silk cake.

[0078] When the consistency between multiple silk cake image blocks is greater than the consistency reference value, and the defect type of the target silk cake image block is consistent with the defect type of other silk cake image blocks (the consistency here includes the case of no defects), the computer system determines the target defect detection information as the target silk cake image block and other silk cake image blocks are normal images. This judgment is based on a comprehensive consideration of overall and local quality characteristics.

[0079] From the perspective of the production process, this means that during the entire silk cake production process, both the macroscopic overall characteristics and the microscopic local characteristics are in a normal state. For example, in a factory producing chemical fiber silk cakes, if the production process is stable, the quality of the raw materials is uniform, and the equipment operates normally, then in the image detection, it will be shown that the multiple silk cake image blocks have high consistency in color, texture, etc., and each block has no defects locally or exists in the same defect-free state. This situation indicates that the produced silk cakes are of good quality and can smoothly enter the next process or be shipped as qualified products.

[0080] As mentioned above, the consistency between multiple silk cake image blocks can be measured by the statistics of multiple features. When the consistency is not greater than the consistency reference value, it indicates that there are large differences between the multiple image blocks of the silk cake as a whole. For example, in terms of color features, if the consistency reference value is set to sigma_0, and the calculated standard deviation of the average grayscale value of the color sigma>sigma_0, this means that there is a large inhomogeneity between the image blocks in terms of color distribution.

[0081] Similarly, in terms of texture features, if the average value of the texture feature correlation coefficient is lower than a certain set reference value, it also indicates that the consistency of the texture features is poor. This overall inconsistency may be caused by a variety of reasons. For example, during the production process, uneven mixing of raw materials may cause color differences in different areas of the silk cake, and local failure of the equipment may affect the winding method of the silk and cause texture inconsistency.

[0082] The situation where the defect type of the target silk cake image block is inconsistent with the defect type of other silk cake image blocks needs to be carefully analyzed. First, the computer system needs to determine the defect type of each silk cake image block. For example, some image blocks may have a defect of local silk winding being too dense, while the target silk cake image block may have a defect of local silk breakage. This is a situation where the defect type is inconsistent.

[0083] When the number of such inconsistencies is greater than the preset number, it means that the target silk cake image block has obvious differences in local features from most other image blocks. Assuming the preset number is N_0, if the number of image blocks M that are inconsistent with the defect type of the target silk cake image block among the total n image blocks is greater than N_0, this indicates that the local quality characteristics of the target silk cake image block are different from most other blocks. This situation may imply that the target silk cake image block is affected by special factors during the production process, such as additional mechanical stress or chemical contamination in a certain local area, while most other blocks are not affected or are affected differently.

[0084] When the consistency between multiple silk cake image blocks is not greater than the consistency reference value, and the number of inconsistent defect types of the target silk cake image block and other silk cake image blocks is greater than a preset number, the computer system determines that the target defect detection information is that the target silk cake image block contains defects. This judgment takes into account the overall and local quality conditions.

[0085] For example, in actual chemical fiber production, if most of the image blocks of a silk cake show a certain consistency in color and texture, and the target silk cake image block is obviously darker in color (inconsistent with other blocks), and there is a chaotic winding of silk in the texture (different from the normal texture of other blocks), and the number of such inconsistencies exceeds the preset range, then it can be judged that the target silk cake image block has quality defects. Such defects may affect the performance of the silk cake, for example, in subsequent textile processing, it may cause unstable product quality or defective products.

[0086] In one implementation, step S300, extracting associated features using a self-attention strategy for multiple image features in an image feature sequence, preventing multiple image features of a target silk cake image block from paying attention to multiple image features of other silk cake image blocks during associated feature extraction, and obtaining a visual implicit representation of multiple image features in the image feature sequence may include:

[0087] Step S310: performing self-attention strategy calculation on multiple image features in the image feature sequence, preventing multiple image features of the target silk cake image block from paying attention to multiple image features of other silk cake image blocks during the self-attention strategy calculation, and obtaining a self-attention weight distribution;

[0088] Step S320: performing self-attention strategy feature extraction on multiple image features in the image feature sequence through self-attention weight distribution to obtain self-attention implicit representations of the multiple image features in the image feature sequence;

[0089] Step S330: performing deep feature processing on the self-attention implicit representations of multiple image features in the image feature sequence to obtain visual implicit representations of multiple image features in the image feature sequence.

[0090] In step S310 of the embodiment of the present invention, the self-attention strategy calculation is a calculation method for mining the correlation between each image feature in the image feature sequence, such as self-attention calculation. In the embodiment of the present invention, the image feature sequence contains various image features of multiple silk cake image blocks. The computer system regards each image feature as an element with specific semantic information, and determines the relationship between these elements through self-attention strategy calculation. For example, for the pixel value features and texture features in the silk cake image blocks, the self-attention strategy can reveal the potential connection between them. If the change pattern of the pixel value is associated with a certain pattern of the texture feature, then this association can be reflected by the self-attention weight. Assuming that the image features in the image feature sequence can be expressed in vector form, let the image feature matrix be X\inR^{n×d}, where n is the number of image features and d is the dimension of each image feature. The core of the self-attention strategy is to calculate the attention weight by performing a series of linear transformations on X.

[0091] The computer system linearly maps the feature matrix through the request conversion weight distribution (query), index conversion weight distribution (key), and content conversion weight distribution (value). These weight distributions are essentially some learnable matrices. Let the request conversion weight matrix be W_Q\inR^{d×d_k}, the index conversion weight matrix be W_K\inR^{d×d_k}, and the content conversion weight matrix be W_V\inR^{d×d_v}. Through linear mapping, we get the request matrix Q=XW_Q, the index matrix K=XW_K, and the content matrix V=XW_V.

[0092] For example, for a specific silk cake image block, its image feature vector x_i\inR^d, after linear mapping of the request conversion weight matrix W_Q, obtains the request vector q_i=x_iW_Q\inR^{d_k}. This operation converts the original image features into different representations so that the correlation between them can be calculated later.

[0093] After obtaining the request matrix Q and the index matrix K, the computer system calculates the commonality of the request matrix and the index matrix. Specifically, the attention matrix A=QK^T is calculated, where K^T is the transpose of the index matrix K. Each element a_{ij} of this attention matrix A represents the attention score between the i-th request vector and the j-th index vector. This score reflects the degree of correlation between the two image features. For example, if the value of a_{ij} is large, it means that there is a strong correlation between the i-th image feature and the j-th image feature.

[0094] To illustrate with a simple example, suppose there are two image features in the silk cake image block, one is the pixel value feature representing the color, and the other is the texture feature representing the silk winding direction. If the corresponding element a_{ij} in the attention matrix is ​​large, it means that under this particular representation, there is a strong correlation between the color feature and the silk winding direction feature, which may imply that there is some intrinsic connection between the color and the silk winding method. For example, the change in color may be related to the tightness of the silk winding, and the tightness affects the winding direction reflected by the texture feature.

[0095] In order to make the values ​​in the attention matrix within a suitable range, and to prevent the multiple image features of the target silk cake image block from paying attention to the multiple image features of other silk cake image blocks, the computer system normalizes the attention matrix. A feasible normalization method is to use the Softmax function. Let the normalized self-attention weight distribution be S, for each element a_{ij} in the attention matrix A, its corresponding element s_{ij}=\frac{\exp(a_{ij})}{\sum_{k=1}^{n}\exp(a_{ik})} in S.

[0096] In terms of preventing multiple image features of the target silk cake image block from paying attention to multiple image features of other silk cake image blocks, assuming that the image feature index range corresponding to the target silk cake image block is [m_1, m_2], the computer system can set a_{ij} to a very small value (close to 0) when calculating the attention matrix A for the case where i\in[m_1, m_2] and j\notin[m_1, m_2] (or vice versa), so that after Softmax normalization, s_{ij} will also be very small, thereby preventing the image features of the target block from paying attention to the image features of other blocks. For example, if there is a local color anomaly in a silk cake image block (the target block), this abnormal color feature may erroneously affect the association calculation between the image features of other normal blocks if it is not restricted. This erroneous influence can be avoided in this way.

[0097] In step S320, the self-attention strategy feature extraction is a process of recombining and representing the image features in the image feature sequence based on the self-attention weight distribution calculated previously. The self-attention weight distribution reflects the correlation between image features. By weighted combination of image features through this weight distribution, an implicit representation that better reflects the intrinsic relationship between features can be obtained. This implicit representation is no longer a simple enumeration of the original image features, but a new feature representation after weighted fusion.

[0098] For example, in the image feature sequence of the silk cake image block, the original pixel value features and texture features are calculated by the self-attention strategy to obtain the self-attention weight distribution. Through this weight distribution, these features are extracted, and the self-attention implicit representation obtained can better reflect the relationship between pixel value and texture in the entire image semantics, which may not be easy to directly observe in the original image features.

[0099] The computer system linearly maps the content matrix through the self-attention weight distribution to obtain the self-attention implicit representation of multiple image features in the image feature sequence. Specifically, let the self-attention implicit representation be H, then H=SV. Here S is the self-attention weight distribution obtained above, and V is the content matrix. Through this linear mapping, each image feature is integrated with the information of other image features related to it in the new representation, and the weight is determined by the self-attention weight distribution.

[0100] For example, for the image features of a silk cake image block, if a texture feature has a higher weight in the self-attention weight distribution, it means that it has a strong correlation with other image features. Then, in the self-attention implicit representation, this texture feature will be more integrated with the information of the pixel value features related to it, thereby obtaining a new feature representation that integrates multiple related feature information. This representation can more comprehensively reflect the semantic role of the image block in the entire image.

[0101] In step S330, deep feature processing is performed on the self-attention implicit representation in order to further mine and refine the information in the image features. Although the self-attention implicit representation has integrated the correlation information between the image features, there may still be some redundancy or parts that can be further optimized. Deep feature processing can enhance the representation ability of features through a variety of operations, making them more suitable for subsequent tasks such as image defect detection.

[0102] For example, in the self-attention implicit representation of the silk cake image blocks, there may be some unstable factors introduced by computational errors or noise in the original image features. Through deep feature processing, these unstable factors can be adjusted to make the obtained visual implicit representation more stable and representative.

[0103] Regularization is a common operation in deep feature processing. Its purpose is to prevent the model from overfitting and make the model have better generalization ability. In this scenario, for the self-attention implicit representation H, the computer system can use L_2 regularization. Let the regularized self-attention implicit representation be H'. For each element h_{ij} in H, the corresponding element h'_{ij} in H' is h'_{ij}=\frac{h_{ij}}{\sqrt{\sum_{k=1}^{n}\sum_{l=1}^{d_v}h_{kl}^2+\lambda}}, where \lambda is the regularization parameter. Through regularization, the element values ​​in the self-attention implicit representation are adjusted, making the distribution of features more reasonable and reducing the risk of overfitting.

[0104] For example, if the value of a feature in the self-attention implicit representation is too large, it may cause this feature to dominate the results in subsequent calculations. The regularization operation can adjust it so that each feature can participate in the subsequent calculations in a more balanced manner as a whole.

[0105] Feedforward processing is an operation that further transforms features through a multi-layer neural network structure. Suppose there is a multi-layer neural network whose input is the regularized self-attention implicit representation H'. In each layer of the neural network, linear transformation and nonlinear activation function operations are performed. For example, for the first layer of the neural network, let the weight matrix be W_1\inR^{d_v×d_{v1}} and the bias vector be b_1\inR^{d_{v1}}, then the output is O_1=sigma(H'W_1+b_1), where \sigma is a nonlinear activation function, such as the ReLU function sigma(x)=max(0,x). Through such multi-layer feedforward processing, the self-attention implicit representation can be converted into a more abstract and advanced feature representation.

[0106] Taking silk cake image segmentation as an example, after feedforward processing, the pixel values ​​and texture features in the original image are converted by a multi-layer neural network to obtain a more advanced feature representation. This representation may better reflect the deep semantic information of the silk cake image, such as the intrinsic connection between the quality of the silk and the image features.

[0107] Residual connection is an operation that adds the input features to the transformed features. In the process of feedforward processing of the implicit representation of self-attention, residual connection can help solve the problem of gradient vanishing or gradient exploding, and also help the model learn features better. Let the feature after feedforward processing be O_l (l represents the number of layers of the neural network), and the feature after residual connection be F, then F=O_l+H' (assuming it is the residual connection of the first layer).

[0108] For example, in the feature processing of silk cake image blocks, if in a certain layer of the neural network, the gradient disappears due to the increase in network depth, the residual connection can directly pass the information of the original self-attention implicit representation H' to the next layer, so that the model can better learn the changes in image features and obtain a more accurate visual implicit representation.

[0109] In one implementation, in step S310, performing self-attention strategy calculation on multiple image features in the image feature sequence may include:

[0110] Step S311: linearly mapping the feature matrix through the request conversion weight distribution, the index conversion weight distribution and the content conversion weight distribution to obtain a request matrix, an index matrix and a content matrix, wherein the feature matrix includes vector representations of multiple image features in the image feature sequence;

[0111] Step S312: Calculate the commonality of the request matrix and the index matrix to obtain an attention matrix;

[0112] Step S313: normalize the attention matrix to obtain the self-attention weight distribution.

[0113] In step S311, when processing the synthetic fiber silk cake image, the computer system first organizes the image features of multiple silk cake image blocks into a feature matrix. This feature matrix contains the image features in all image feature sequences, and each image feature is represented in vector form. For example, for a silk cake image block, there may be pixel value features, texture features, etc. If the pixel value feature is represented by a three-dimensional vector (for example, three channel values ​​in a certain color space), and the texture feature is represented by a five-dimensional vector (obtained by calculating different statistics of the texture), then for this silk cake image block, its comprehensive image feature vector may be an eight-dimensional vector. Arranging such vectors of all silk cake image blocks in a certain order constitutes a feature matrix. Assume that the feature matrix is ​​X\in R^{n×d}, where n represents the number of image features (that is, the total number of image features of all silk cake image blocks), and d represents the dimension of each image feature vector (such as 8 dimensions in the previous example).

[0114] The request conversion weight distribution (query), index conversion weight distribution (key), and content conversion weight distribution (value) are weight matrices used to perform different linear mappings on the feature matrix. These weight matrices are learned during the deep learning model training process. Their function is to convert the original image feature vector into different representations to facilitate the subsequent calculation of the correlation between image features.

[0115] Take the request conversion weight matrix W_Q\in R^{d×d_k} as an example, it converts the original feature vector from d dimensions to d_k dimensions. This conversion can be understood as a re-encoding of the original image features, making it easier to calculate the relationship between features in the new representation space. Similarly, the index conversion weight matrix W_K\in R^{d×d_k} and the content conversion weight matrix W_V\in R^{d×d_v} also play a similar role, but they may be converted to spaces of different dimensions.

[0116] The computer system performs a linear mapping operation by multiplying the feature matrix X with the corresponding weight matrix. For the request matrix Q, Q=XW_Q is calculated. For example, if an image feature vector x_i\in R^d in X, then it is linearly mapped by the request transformation weight matrix W_Q to obtain the request vector q_i=x_iW_Q\in R^{d_k}. Similarly, for the index matrix K, K=XW_K is calculated; for the content matrix V, V=XW_V is calculated.

[0117] Assume that in a simple example of silk cake image segmentation, a row vector x=[1,2,3,4,5,6,7,8] of the feature matrix X (this is just a simple hypothetical vector, the actual dimension and value depend on the specific image features), if the requested conversion weight matrix W_Q=\begin{bmatrix}0.1&0.2\\0.3&0.4\\0.5&0.6\\0.7&0.8\\0.9&1.0\\1.1&1.2\\1.3&1.4\\1.5&1.6\end{bmatrix} (this is also a simple matrix assumed for the sake of example), then by calculating q=xW_Q, the requested vector q is obtained (here is a 2D vector, the specific value is calculated by matrix multiplication). This requested vector q is the new representation of the original image feature vector x under the action of the requested conversion weight matrix, which is used for subsequent correlation calculations with other vectors.

[0118] In step S312, after obtaining the request matrix Q and the index matrix K, the computer system performs commonality calculation on them to obtain the attention matrix A. The essence of this commonality calculation is to measure a certain correlation or similarity between the request vector (from the request matrix) and the index vector (from the index matrix). Calculate the attention matrix A = QK^T, where K^T is the transpose of the index matrix K.

[0119] The element a_{ij} in each attention matrix A represents the attention score between the i-th request vector and the j-th index vector. This score reflects the degree of correlation between two image features. For example, in the image feature processing of silk cake image blocks, if the value of a_{ij} is large, it means that there is a strong correlation between the i-th image feature (in the sense represented by the request matrix) and the j-th image feature (in the sense represented by the index matrix).

[0120] Assume that there are two types of image features in the silk cake image block, one is the feature representing the thickness of the silk (a numerical feature calculated by a certain algorithm), and the other is the feature representing the glossiness of the silk. In the request matrix Q, the request vector corresponding to the feature of the thickness of the silk is q_1, and in the index matrix K, the index vector corresponding to the feature of the glossiness of the silk is k_1. When calculating the attention matrix A, if the value of a_{11} (i.e., the attention score calculated by q_1 and k_1) is large, it means that there is a strong correlation between the feature of the thickness of the silk and the feature of the glossiness of the silk. This correlation may suggest that during the production process, changes in the thickness of the silk may affect its glossiness, or vice versa. For example, if the thickness of the silk is uneven, it may cause different reflections and refractions of light, thereby affecting the glossiness.

[0121] In step S313, after the attention matrix A is calculated, in order to make the values ​​in the attention matrix within a suitable range and to be expressed as a valid weight distribution, the computer system normalizes the attention matrix. A common and effective normalization method is to use the Softmax function. The Softmax function can convert any real number input into a probability distribution between 0 and 1.

[0122] Suppose the normalized self-attention weight distribution is S. For each element a_{ij} in the attention matrix A, its corresponding element s_{ij}=\frac{\exp(a_{ij})}{\sum_{k=1}^{n}\exp(a_{ik})} in S. Through the calculation of the Softmax function, each element in the attention matrix is ​​converted into a weight value representing relative importance or probability. In this way, each element s_{ij} in the self-attention weight distribution S can be regarded as the attention weight of the i-th request vector to the j-th index vector.

[0123] The self-attention weight distribution S plays a key role in the subsequent self-attention strategy feature extraction. It represents the relative importance or correlation weight between image features. For example, in the image feature processing of silk cake image segmentation, if a certain element s_{ij} in the self-attention weight distribution S is large, it means that under the current self-attention strategy, the i-th image feature has a higher degree of attention to the j-th image feature, that is, there is a strong correlation between the two image features, and more weight should be given in the feature extraction and representation process.

[0124] Based on this, step S320, performing self-attention strategy feature extraction on multiple image features in the image feature sequence through self-attention weight distribution to obtain self-attention implicit representations of multiple image features in the image feature sequence, may include step S321: performing linear mapping on the content matrix through self-attention weight distribution to obtain self-attention implicit representations of multiple image features in the image feature sequence.

[0125] In step S321, the self-attention implicit representation is a result of recombining and representing the image features in the image feature sequence, which integrates the correlation information between the image features. The self-attention implicit representation is obtained by linearly mapping the content matrix through the self-attention weight distribution. This representation is no longer a simple listing of the original image features, but a new feature representation after weighted fusion.

[0126] In the analysis of synthetic fiber yarn cake images, the self-attention implicit representation can better reflect the intrinsic relationship between image features, which is very important for subsequent tasks such as image defect detection. For example, the original image features may include pixel values, textures, etc. These features may not be able to directly reflect the quality of the yarn cake in their original state, but after the self-attention implicit representation, they may be presented in a form that can better reflect the semantic information related to the quality of the yarn cake.

[0127] The computer system obtains the self-attention implicit representation H by calculating H=SV, where S is the self-attention weight distribution obtained previously and V is the content matrix. In this linear mapping process, each image feature is integrated with the information of other image features related to it in the new representation, and the weight is determined by the self-attention weight distribution.

[0128] For example, for an image feature vector v_i in the content matrix V, under the action of the self-attention weight distribution S, its corresponding vector h_i in the self-attention implicit representation H is calculated by h_i=s_{i1}v_1 + s_{i2}v_2+\cdots+s_{in}v_n (where s_{ij} is an element in the self-attention weight distribution S, and v_j is a vector in the content matrix V). In this way, each image feature vector h_i incorporates the information of other image feature vectors, thereby obtaining a self-attention implicit representation that better reflects the correlation between image features.

[0129] In summary, steps S311~S313 and S321 gradually convert the original image features into self-attention implicit representations through a series of linear mapping, correlation calculation and normalization operations. This process effectively mines the correlation between image features and lays the foundation for subsequent deep feature processing and final image defect detection tasks.

[0130] In one implementation, in step S310, preventing multiple image features of the target silk cake image block from paying attention to multiple image features of other silk cake image blocks during the self-attention strategy calculation may include:

[0131] Step S311a: Preventing the multiple image features of the target silk cake image block from paying attention to the multiple image features of other silk cake image blocks in the attention matrix, so as to prevent the multiple image features of the target silk cake image block from paying attention to the multiple image features of other silk cake image blocks.

[0132] In an embodiment of the present invention, the attention matrix is ​​an important intermediate result generated in the calculation process of the self-attention strategy. It is obtained by performing commonality calculation on the request matrix and the index matrix, and its elements represent the attention scores between different image features. In the image feature processing of the synthetic fiber silk cake image blocks, this attention matrix reflects the potential correlation between the various image features. For example, in the silk cake image blocks, the image features may include pixel value features, texture features, etc. The elements in the attention matrix can reveal the degree of attention between the pixel value features and the texture features, that is, the strength of the correlation between them.

[0133] Assume that the attention matrix is ​​A, where the element a_{ij} represents the attention score between the i-th image feature and the j-th image feature. If the value of a_{ij} is large, it means that there is a strong correlation between the i-th image feature and the j-th image feature. This relationship between the two features will play an important role in subsequent feature extraction and analysis.

[0134] The target silk cake image block is any one of the multiple silk cake image blocks. This target silk cake image block contains a series of image features, which together with the image features of other silk cake image blocks constitute the entire image feature system. For example, a target silk cake image block may have different image features from other normal silk cake image blocks due to local problems in the production process, such as uneven winding of local silk threads or local dyeing differences. If these different image features are not restricted, they may have unnecessary effects on the image features of other silk cake image blocks when calculating the attention matrix.

[0135] When analyzing synthetic fiber silk cake images, each silk cake image block has its own local features, and these local features should be analyzed independently to a certain extent. If there are local anomalies in the target silk cake image block, for example, a target silk cake image block shows special pixel values ​​and texture features on the image due to local silk thread breakage. If the image features of this target silk cake image block are not prevented from paying attention to the image features of other silk cake image blocks, then when calculating the attention matrix, these special image features may erroneously affect the relationship calculation between the image features of other normal silk cake image blocks.

[0136] For example, there is a normal correlation pattern between the texture features and pixel value features of a normal silk cake image block, but due to the special situation of the target silk cake image block, its special image features may break this normal pattern, so that the relationship between normal image features is incorrectly adjusted in the attention matrix. This will affect the accuracy of subsequent feature extraction and quality assessment based on the attention matrix.

[0137] The computer system can prevent the multiple image features of the target silk cake image block from paying attention to the multiple image features of other silk cake image blocks by adjusting the elements in the attention matrix. A feasible technical means is to assume that the index range of the image features corresponding to the target silk cake image block in the attention matrix is ​​[m,n] (the index here is determined according to the arrangement order of the image features in the entire feature sequence). When i\in[m,n] and j\notin[m,n] (or vice versa), the computer system sets the element a_{ij} in the attention matrix to a very small value close to 0.

[0138] For example, if the attention matrix A is a 10×10 matrix, the index range of the image features corresponding to the target silk cake image block in the matrix is ​​[3,6]. Then for the case of i\in[3,6] and j\in[1,2]\cup[7,10] (or j\in[3,6] and i\in[1,2]\cup[7,10]), set a_{ij} to a very small value, such as 0.0001. In this way, when performing subsequent normalization operations or other calculations based on the attention matrix, the image features of the target silk cake image block will hardly pay excessive attention to the image features of other silk cake image blocks, thereby ensuring the independence of the image features of each silk cake image block to a certain extent, which helps to more accurately analyze the relationship between image features and improve the accuracy of quantitative evaluation of chemical fiber quality.

[0139] In summary, step S311a effectively prevents the multiple image features of the target silk cake image block from paying attention to the multiple image features of other silk cake image blocks by adjusting specific elements in the attention matrix, laying a foundation for subsequent more accurate image feature processing and chemical fiber quality assessment.

[0140] In one implementation, in step S300, before extracting associated features using a self-attention strategy for a plurality of image features in the image feature sequence, the method may further include:

[0141] Step S301: quantize each image feature in the image feature sequence to obtain an implicit representation of each image feature.

[0142] In the previous steps, the computer system has acquired multiple silk cake image blocks and extracted image features to obtain an image feature sequence. This image feature sequence contains multiple image features of each silk cake image block, such as pixel values, texture features, etc. These image features describe the characteristics of different aspects of the silk cake image blocks. Taking the pixel value as an example, it reflects the color depth of the silk cake image at each position, which has a certain reference value for judging the quality of the silk (such as whether there is uneven dyeing). The texture feature reflects the winding pattern of the silk in the image and other information, which can reflect the quality-related factors such as the winding uniformity of the silk.

[0143] The purpose of quantizing each image feature is to convert image features of different types and value ranges into a form that is more suitable for subsequent processing. The original image features may have complex structures and value ranges, and direct subsequent associated feature extraction may face some difficulties. For example, the pixel value range is 0-255 (for 8-bit images), and the texture feature may be a set of values ​​calculated by a complex algorithm, and its value range and meaning are very different from the pixel value. Through quantitative representation, these different image features can be unified into a representation with similar structure and meaning, so as to better explore the relationship between image features.

[0144] In one implementation, step S301, quantizing each image feature in the image feature sequence to obtain an implicit representation of each image feature, may include:

[0145] Step S3011: implicitly represent each image feature in the image feature sequence to obtain an implicit vector representation of each image feature;

[0146] Step S3012: Obtaining an isolated vector representation of each image feature by dividing the silk cake image into blocks corresponding to each image feature in the image feature sequence;

[0147] Step S3013: obtaining a coordinate vector representation of each image feature through the distribution coordinates of each image feature in the image feature sequence in the corresponding silk cake image block;

[0148] Step S3014: merge the implicit vector representation, the isolation vector representation and the coordinate vector representation of each image feature to obtain the implicit representation of each image feature.

[0149] In step S3011 of the embodiment of the present invention, the computer system implicitly represents each image feature, aiming to find a representation method that can more deeply reflect the intrinsic information of the image feature. This implicit vector representation may be obtained by performing some transformation on the original image feature. For example, for the pixel value feature, if the original is a single numerical value representing the color depth of a pixel, the computer system can convert it into an implicit vector. Assuming that the pixel value p is converted into a three-dimensional implicit vector vec{v}=(v_1,v_2,v_3), it can be converted into an implicit vector by the following simple linear transformation formula v_1=p / 100, v_2=(p\bmod100) / 10, v_3=p\bmod10 (this is just a simple example, and the actual conversion may be based on a more complex mathematical model or algorithm). In this way, the original simple pixel value is converted into an implicit vector containing more information levels. For texture features, a similar method can also be used to convert them into implicit vector representations through some mathematical transformation, such as combining and transforming the statistics of texture features (such as mean, variance, etc.) to obtain implicit vectors.

[0150] In step S3012, each image feature comes from a specific silk cake image block, and some characteristics of this silk cake image block can provide additional information for the representation of the image feature. The computer system uses this to obtain an isolation vector representation. For example, assuming that the silk cake image block has a number i and its position coordinates (x, y) in the entire silk cake image (the coordinates here are relative to a certain coordinate system of the entire silk cake image), this information can be combined into an isolation vector \vec{u}=(i,x,y). This isolation vector represents the source and position information of the image feature in the silk cake image, which helps to distinguish image features at different positions and different silk cake image blocks in subsequent processing. For different image features, the corresponding isolation vectors will be different depending on the silk cake image block to which they belong. This isolation vector representation adds semantic information related to the position and source to the image feature.

[0151] In step S3013, within the silk cake image block, each image feature has its specific distribution coordinates. For example, in a two-dimensional silk cake image block, if the image block is regarded as a coordinate system, the pixel point where the image feature is located has its coordinates (m, n). The computer system can convert this coordinate information into a coordinate vector representation. Assume that through a simple normalization operation, the coordinate (m, n) is converted into a coordinate vector \vec{w}=(\frac{m}{M},\frac{n}{N}), where M and N are the width and height of the silk cake image block, respectively. This coordinate vector represents the specific location information of the image feature within the silk cake image block, which is very useful for analyzing the spatial relationship between image features.

[0152] In step S3014, the computer system merges the implicit vector representation, the isolation vector representation and the coordinate vector representation obtained previously to obtain the final implicit representation of each image feature. For example, if the implicit vector vec{v}=(v_1,v_2,v_3), the isolation vector vec{u}=(i,x,y), and the coordinate vector vec{w}=(\frac{m}{M},\frac{n}{N}), they can be merged into a new vector vec{z}=(v_1,v_2,v_3,i,x,y,\frac{m}{M},\frac{n}{N}) as the implicit representation of the image feature. This merged implicit representation integrates the intrinsic information, source information and position information of the image feature itself in the image block, providing a richer information basis for the subsequent extraction of associated features of the self-attention strategy.

[0153] Based on this, in step S300, the associated feature extraction of the multiple image features in the image feature sequence is implemented by the self-attention strategy, including:

[0154] Step S300A: extracting associated features using a self-attention strategy for implicit representations of multiple image features in an image feature sequence.

[0155] After obtaining the implicit representation of each image feature, the computer system begins to extract associated features using the self-attention strategy. These implicit representations contain rich information, allowing the computer system to consider the relationship between image features more comprehensively. Since the implicit representation contains the intrinsic information, source information, and location information of the image features, the association between different image features can be more accurately mined when performing self-attention strategy calculations. For example, for two image features, one from the central area of ​​the silk cake image and one from the edge area, the position information (coordinate vector representation part) in their implicit representation can help the computer system consider the impact of this position difference on feature association when calculating the attention.

[0156] The process of extracting associated features of the self-attention strategy is similar to the process of calculating the self-attention strategy on the original image features mentioned above, but here it is based on implicit representation. The computer system can still adopt a similar mechanism, such as linearly mapping the feature matrix containing implicit representation through request conversion weight distribution, index conversion weight distribution and content conversion weight distribution. Let the feature matrix containing implicit representation be X' (where each element is an implicit representation vector of an image feature), the request conversion weight matrix be W_Q', the index conversion weight matrix be W_K', and the content conversion weight matrix be W_V'. Through linear mapping, we get the request matrix Q'=X'W_Q', the index matrix K'=X'W_K', and the content matrix V'=X'W_V'.

[0157] Then, the computer system calculates the commonality of the request matrix and the index matrix to obtain the attention matrix A'=Q'K'^T. The attention matrix is ​​normalized, for example, the self-attention weight distribution S' is obtained using the Softmax function. For each element a_{ij}' in the attention matrix A', its corresponding element s_{ij}'=\frac{\exp(a_{ij}')}{\sum_{k=1}^{n}\exp(a_{ik}')} in S'. Finally, the content matrix is ​​linearly mapped through the self-attention weight distribution to obtain the self-attention implicit representation of multiple image features in the image feature sequence. Assuming that the implicit representation of self-attention is H', then H'=S'V'. This self-attention implicit representation is obtained by extracting associated features based on the implicit representation of image features through the self-attention strategy. It integrates the correlation information between image features based on the implicit representation, and provides a more effective feature basis for subsequent deep feature processing (such as regularization, feedforward processing, residual connection and other operations in step S330) and final image defect detection (steps S400 and S500).

[0158] In one implementation, step S300, extracting associated features using a self-attention strategy for multiple image features in an image feature sequence, preventing multiple image features of a target silk cake image block from paying attention to multiple image features of other silk cake image blocks during associated feature extraction, and obtaining a visual implicit representation of multiple image features in the image feature sequence may include:

[0159] Step S310A: performing multiple rounds of associated feature extraction using a self-attention strategy on multiple image features in the image feature sequence one by one, preventing multiple image features of a target silk cake image block from paying attention to multiple image features of other silk cake image blocks in each round of associated feature extraction, and obtaining a visual implicit representation of multiple image features in the image feature sequence obtained by the last round of associated feature extraction.

[0160] In an embodiment of the present invention, when processing the feature sequence of a synthetic fiber silk cake image, a single round of self-attention strategy for correlation feature extraction may not be sufficient to fully explore the complex relationship between image features. Multiple rounds of correlation feature extraction can gradually deepen the understanding of image features, allowing the computer system to capture more subtle and complex feature associations. For example, in the first round of correlation feature extraction, the computer system may preliminarily identify some simple associations between pixel value features and texture features, such as certain pixel value ranges may correspond to specific texture patterns. However, as the number of rounds increases, it may be found that these associations have more subtle changes in different silk cake image blocks or in different areas of the entire image. For example, in the edge area of ​​the silk cake image, this association between pixel values ​​and texture features may be affected by the winding direction of the silk or the change in tension, and multiple rounds of correlation feature extraction help to discover these deep relationships.

[0161] In each round of associated feature extraction, the computer system performs an associated feature extraction operation of the self-attention strategy on multiple image features in the image feature sequence. This operation is similar to the process of calculating the self-attention strategy on the image features, obtaining the self-attention weight distribution, and performing self-attention strategy feature extraction in the previous steps. Taking the first round of associated feature extraction as an example, the computer system first performs a linear mapping operation on the image features in the image feature sequence. Assuming that the image feature matrix in the image feature sequence is X, the request conversion weight distribution W_Q, the index conversion weight matrix W_K, and the content conversion weight matrix W_V are linearly mapped to X to obtain the request matrix Q=XW_Q, the index matrix K=XW_K, and the content matrix V=XW_V. Then the attention matrix A=QK^T is calculated, the attention matrix is ​​normalized to obtain the self-attention weight distribution S, and finally the first round of self-attention implicit representation H is obtained through H=SV. Subsequent rounds are also carried out according to a similar process, but each round is further feature mining based on the results of the previous round.

[0162] In the process of multiple rounds of correlation feature extraction, it is very important to prevent the multiple image features of the target silk cake image block from paying attention to the multiple image features of other silk cake image blocks. Because each silk cake image block has its own local features, if not restricted, it may lead to incorrect feature association. For example, assuming that a certain target silk cake image block has a local color anomaly (possibly due to uneven dyeing), if this local abnormal color feature is not restricted during the process of correlation feature extraction, it may erroneously affect the association calculation between the texture features and color features of other normal silk cake image blocks. This may cause the computer system to incorrectly judge the quality status of the entire silk cake image, for example, judging the relationship between the originally normal texture features and color features as abnormal, simply because it is interfered by the local abnormal color features of the target silk cake image block.

[0163] In each round of associated feature extraction, the computer system must take measures to prevent multiple image features of the target silk cake image block from paying attention to multiple image features of other silk cake image blocks. One implementation method is to make adjustments when calculating the attention matrix. Assume that the index range of the image features corresponding to the target silk cake image block in the image feature matrix X is [m,n]. When calculating the attention matrix A, when i\in[m,n] and j\notin[m,n] (or vice versa), set the element a_{ij} in A to a very small value close to 0. For example, if the attention matrix A is a 10×10 matrix, and the index range of the image features corresponding to the target silk cake image block in the matrix is ​​[3,6], then for i\in[3,6] and j\in[1,2]\cup[7,10] (or j\in[3,6] and i\in[1,2]\cup[7,10]), set a_{ij} to 0.0001. In this way, in subsequent normalization and feature extraction operations, the image features of the target silk cake image block will hardly pay excessive attention to the image features of other silk cake image blocks.

[0164] After multiple rounds of associated feature extraction and preventing interference from the target silk cake image blocks in each round, the visual implicit representation of multiple image features in the image feature sequence obtained in the last round is a highly abstract feature representation that integrates rich information. It is no longer a simple combination of original image features, but the result of multiple rounds of self-attention strategy mining and adjustment. This visual implicit representation can more effectively reflect the deep relationship between image features, which is of great significance for subsequent overall image defect detection (such as step S400) and local image defect detection (such as step S500). For example, in overall image defect detection, some features in the visual implicit representation may be associated with the overall shape integrity or color distribution uniformity of the silk cake image; in local image defect detection, it can help the computer system more accurately identify local silk breakage, color anomalies and other problems.

[0165] Each round of associated feature extraction will adjust and optimize the image features to a certain extent, and the result of the last round is the visual implicit representation of multiple image features in the image feature sequence. To illustrate with a simple example, if after the first round of associated feature extraction, the representation of image features begins to change from the original simple vector form to a form that better reflects the local feature relationship, then as the rounds increase, this representation will continue to integrate more global and local relationship information. Assuming that the original image features are simple vectors about pixel values ​​and texture features, after multiple rounds of associated feature extraction, the visual implicit representation may become a complex vector that integrates the relationship between pixel values ​​and texture features in different silk cake image blocks and different regions. Each element in this vector contains rich semantic information, which is gradually accumulated and refined through multiple rounds of self-attention strategy associated feature extraction.

[0166] In one implementation, the method is implemented by an image detector, and the image detector is trained by the following steps:

[0167] Step S1: extracting image features from a plurality of training silk cake image blocks to obtain a training image feature sequence, inserting the overall training image feature into the training image feature sequence, wherein the training image feature sequence includes a plurality of training image features of each training silk cake image block;

[0168] Step S2: using an image detector to extract associated features using a self-attention strategy for multiple training image features in a training image feature sequence, preventing multiple training image features of a target training silk cake image block from paying attention to multiple training image features of other training silk cake image blocks during the associated feature extraction, and obtaining a visual implicit representation of multiple training image features in the training image feature sequence, wherein the target training silk cake image block is any training silk cake image block among the multiple training silk cake image blocks;

[0169] Step S3: using an image detector to perform overall image defect detection through visual implicit representation of overall training image features, and obtaining overall defect detection information of multiple training silk cake image blocks;

[0170] Step S4: using an image detector to perform local image defect detection through visual implicit representation of multiple training image features of the target training silk cake image block, to obtain local defect detection information of the target training silk cake image block;

[0171] Step S5: determining a target cost value through the overall defect detection information of a plurality of training silk cake image blocks and the local defect detection information of a target training silk cake image block, so as to optimize the image detector through the target cost value.

[0172] In step S1 of the embodiment of the present invention, the computer system first processes a plurality of training silk cake image blocks. These training silk cake image blocks are selected from a large number of silk cake images of known quality conditions (including defective and non-defective) and are used to train the image detector. For each training silk cake image block, the computer system performs an image feature extraction operation. The image feature is a description of the intrinsic characteristics of the silk cake image block, such as pixel values, texture features, etc.

[0173] Taking pixel value features as an example, assuming that a training silk cake image block is an m×n matrix (in digital images, images can be represented as pixel matrices), the computer system can directly read each element in the matrix as a pixel value feature. For texture features, the computer system may use some special algorithms, such as the gray level co-occurrence matrix (GLCM) algorithm. Texture features are obtained by calculating the frequency of different gray value combinations in a certain direction and distance. For example, when the horizontal spacing is d, the frequency of different gray value combinations is counted, and then the statistics reflecting the texture features, such as contrast, correlation, etc., are obtained.

[0174] After extracting the image features of each training silk cake image block, the computer system arranges these features in a certain order to form a training image feature sequence. This sequence contains multiple training image features of each training silk cake image block. Assume that there are three training silk cake image blocks B_1, B_2, and B_3. For B_1, the extracted pixel value features are P_{11}, P_{12}, …, and the texture features are T_{11}, T_{12}, …; for B_2, the extracted pixel value features are P_{21}, P_{22}, …, and the texture features are T_{21}, T_{22}, …; for B_3, the extracted pixel value features are P_{31}, P_{32}, …, and the texture features are T_{31}, T_{32}, …. Then the training image feature sequence can be expressed as {P_{11},P_{12},…,T_{11},T_{12},…,P_{21},P_{22},…,T_{21},T_{22},…,P_{31},P_{32},…,T_{31},T_{32},…}.

[0175] The overall training image feature is a global description of the entire training silk cake image. It can contain some basic information about the silk cake, such as production batch, production equipment number, etc. Although this information is not directly extracted from the visual content of the image, it is very important for the image detector to understand the overall context of the image and potential quality influencing factors.

[0176] The computer system inserts the overall training image features into the training image feature sequence. For example, assuming that the overall training image features are ID={batch_number=123,equipment_id=456} and the training image feature sequence is F={f_1,f_2,…}, then the new sequence after insertion can be expressed as {batch_number=123,equipment_id=456,f_1,f_2,…}. This insertion operation enables the training image feature sequence to contain not only local image features but also overall image-related information, which helps the image detector learn more comprehensive feature relationships during the training process.

[0177] In step S2, the image detector uses a self-attention strategy to mine the association relationship between multiple training image features in the training image feature sequence. The self-attention strategy is an effective method for processing sequence data in deep learning, which allows each training image feature to pay attention to other training image features in the sequence, thereby calculating the correlation weight between them.

[0178] For example, for a pixel value feature and a texture feature in the training image feature sequence, the self-attention strategy will calculate the attention weight of the pixel value feature to the texture feature based on their numerical features and their positions in the entire sequence. Assuming that the training image feature matrix is ​​X\inR^{n×d} (n is the number of training image features, d is the dimension of each training image feature), X is linearly mapped by the request conversion weight distribution (query) W_Q\inR^{d×d_k}, the index conversion weight distribution (key) W_K\inR^{d×d_k} and the content conversion weight distribution (value) W_V\inR^{d×d_v}, respectively, to obtain the request matrix Q=XW_Q, the index matrix K=XW_K, and the content matrix V=XW_V. Then calculate the attention matrix A=QK^T, where K^T is the transpose of the index matrix K. Each element a_{ij} in the attention matrix A represents the attention score between the i-th request vector and the j-th index vector, reflecting the degree of correlation between the two training image features.

[0179] When extracting associated features, it is very important to prevent multiple training image features of the target training silk cake image block from paying attention to multiple training image features of other training silk cake image blocks. Because each training silk cake image block has its own local features, if not restricted, it may lead to erroneous feature association.

[0180] For example, suppose a target training silk cake image block has a local color anomaly (due to a defect in some training setting). If the color feature of this local anomaly is not restricted, it may erroneously affect the calculation of the association between the texture features and color features of other normal training silk cake image blocks. The computer system can implement this restriction by making adjustments when calculating the attention matrix. Assuming that the index range of the training image features corresponding to the target training silk cake image block in the training image feature matrix X is [m,n], when calculating the attention matrix A, when i\in[m,n] and j\notin[m,n] (or vice versa), set the element a_{ij} in A to a very small value close to 0.

[0181] After completing the above operations, the computer system normalizes the attention matrix, for example, using the Softmax function to obtain the self-attention weight distribution S. For each element a_{ij} in the attention matrix A, its corresponding element s_{ij}=\frac{\exp(a_{ij})}{\sum_{k=1}^{n}\exp(a_{ik})} in S. Finally, the content matrix is ​​linearly mapped through the self-attention weight distribution to obtain the visual implicit representation of multiple training image features in the training image feature sequence. Assuming that the visual implicit representation is H, then H=SV. This visual implicit representation is a processed abstract form that integrates the correlation between the training image features and the above-mentioned constraints, and can more effectively reflect the essential characteristics of the training image, providing a more effective feature representation for subsequent defect detection.

[0182] In step S3, the overall image defect detection is to determine whether there are quality problems in the entire training silk cake image from a macroscopic perspective. This corresponds to the local detection of a single training silk cake image block. The overall image defects may include problems such as the irregular shape of the entire silk cake and uneven color distribution, which are manifested at the level of the entire image. For example, if the silk cake is eccentric during the winding process, it may appear on the image that the silk density on one side is significantly higher than that on the other side. This overall unevenness is a possible defect.

[0183] From the perspective of the visual implicit representation of the overall training image features, this visual implicit representation contains the information of the overall training image features after complex processing, and it has a potential correlation with the quality status of the entire training silk cake image. By analyzing this visual implicit representation, the computer system can detect the defects of the overall image.

[0184] Computer systems can use a variety of technical means to detect overall image defects. One feasible method is detection based on statistical features. For example, statistics such as the mean and variance of the visual implicit representation of the overall training image features are calculated. If the mean is within a certain range and the variance is small, it may mean that the overall characteristics of the silk cake are relatively stable and there are no obvious overall defects; on the contrary, if the variance is large, it may indicate the existence of overall image defects, such as uneven color distribution.

[0185] Another method is to build a classification model for detection. For example, a support vector machine (SVM) or a neural network classifier is used. A large number of known visual implicit representations of normal and defective overall training image features are used as training data to train the classifier. The visual implicit representation of the overall training image features to be detected is input into the trained classifier to obtain the overall defect detection information (such as normal or defective).

[0186] In step S4, local image defect detection is a quality inspection performed on a local area of ​​the training silk cake image block. Different from the overall image defect detection, it focuses on the possible problems in a specific part of the training silk cake image block. These local defects may include local breakage of the silk, local color abnormality, local uneven winding of the silk, etc. For example, a corner of the training silk cake may be broken due to mechanical collision in the simulated production process, or the local color may be too dark or too light due to uneven dyeing. These are all manifestations of local defects.

[0187] The visual implicit representation of multiple training image features of the target training silk cake image block contains the feature information of the block after processing. By analyzing this visual implicit representation, local defects can be accurately detected, which is very important for more accurate evaluation of the quality of the training silk cake image.

[0188] The computer system can use the distance measurement method to detect local image defects. First, establish a standard template or reference set for the visual implicit representation of a normal training silk cake image block. For the visual implicit representation vector vec{v} of the target training silk cake image block, calculate its distance from the vector in the reference set. A feasible distance measurement method is the Euclidean distance, and the formula is d(\vec{v},\vec{v}_{normal})=\sqrt{\sum_{i=1}^{n}(v_i-v_{normal,i})^2}, where n is the dimension of the vector. If the calculated distance is greater than a pre-set threshold, it can be determined that the target training silk cake image block has a local defect.

[0189] It is also possible to use machine learning classifiers for local defect detection. For example, a decision tree classifier is constructed. A large number of visual implicit representations of training silk cake image blocks with local defect annotations are collected as training data. The decision tree classifier constructs a decision tree model by learning the characteristic patterns in these data. The visual implicit representation vector of the target training silk cake image block is input into the trained decision tree classifier. The decision tree performs a series of judgments based on the characteristic values ​​in the vector, and finally outputs the result of whether the target training silk cake image block has a local defect.

[0190] In step S5, the target cost value is an indicator used to measure the performance of the image detector during the training process. It combines the overall defect detection information of multiple training silk cake image blocks and the local defect detection information of the target training silk cake image blocks. By minimizing the target cost value, the parameters of the image detector can be optimized to make it more accurate in detecting overall and local defects.

[0191] The computer system determines the first generation value through the overall defect detection information of multiple training silk cake image blocks and the overall annotation labels of multiple training silk cake image blocks. The overall annotation label is the actual overall defect situation of the training silk cake image known in advance (such as normal or defective manually marked). Assuming that the overall defect detection information is D_{global} and the overall annotation label is A_{global}, the first generation value J_1 can be determined by calculating the difference between the two. For example, the mean square error (MSE) formula J_1=\frac{1}{m}\sum_{i=1}^{m}(D_{global,i}-A_{global,i})^2 can be used, where m is the number of training silk cake images. If the first generation value is small, it means that the image detector has a good performance in overall defect detection.

[0192] The computer system determines the second generation value through the local defect detection information of the target training silk cake image block and the local annotation mark of the target training silk cake image block. The local annotation mark is the real local defect situation of the target training silk cake image block that is known in advance. Assuming that the local defect detection information is D_{local} and the local annotation mark is A_{local}, the second generation value J_2 can be similarly determined by calculating the difference between the two. For example, the cross-entropy formula J_2=-\sum_{i=1}^{n}A_{local,i}\log(D_{local,i}) is used, where n is the number of local defect types (if it is a binary classification, such as normal and defective, then n=2). A smaller second generation value indicates that the image detector has better performance in local defect detection.

[0193] The computer system merges the first generation value J_1 and the second generation value J_2 to obtain the target cost value J. A simple merging method is weighted summation, for example, J=αJ_1+(1-α)J_2, where α is the weight coefficient, which can be adjusted according to actual conditions. By minimizing the target cost value J, the computer system can use an optimization algorithm (such as gradient descent) to adjust the parameters of the image detector. In each iteration, the parameters of the image detector are updated according to the target cost value, so that the performance of the image detector in overall and local defect detection is continuously improved until the preset stop condition is reached (such as the target cost value converges or the maximum number of iterations is reached).

[0194] In one implementation, step S5, determining a target cost value by using overall defect detection information of a plurality of training silk cake image blocks and local defect detection information of a target training silk cake image block, may include:

[0195] Step S51: determining the first generation value through the overall defect detection information of multiple training silk cake image blocks and the overall annotation marks of multiple training silk cake image blocks;

[0196] Step S52: determining the second generation value through the local defect detection information of the target training silk cake image block and the local annotation mark of the target training silk cake image block;

[0197] Step S53: Merge the first generation value and the second generation value to obtain a target cost value.

[0198] In step S51 of the embodiment of the present invention, the overall defect detection information of multiple training silk cake image blocks is the result obtained by the computer system through the previous step (such as step S3) to perform overall image defect detection on the visual implicit representation of the overall training image features. This result reflects the judgment of the computer system on whether each training silk cake image has defects at the overall level. For example, the overall defect detection information may be represented in the form of a vector, where each element corresponds to a training silk cake image, and the value of the element may be 0 or 1 (0 means no defect, 1 means defect), or a numerical value indicating the degree of defect (such as a real number between 0 and 1, 0 means completely no defect, 1 means severe defect).

[0199] The overall annotation marks of the multiple training silk cake image blocks are the real overall defect conditions of these training silk cake images that are known in advance. These annotation marks are determined by manual annotation or other reliable methods. For example, in a training data set, for each training silk cake image, the manual judgement is made based on some standards (such as whether the shape of the silk cake is regular, whether the color distribution is uniform, etc.) to determine whether it has overall defects and mark it with corresponding values. These marks are used as the real situation to compare with the overall defect detection information obtained by the computer system.

[0200] The significance of determining the first generation value is to measure the accuracy of the image detector in overall defect detection. The computer system uses a quantitative indicator to evaluate the difference between its detection results and the actual situation, so as to optimize the image detector in the future.

[0201] A feasible technical approach is to use mean square error (MSE) to calculate the first generation value. Assume that the overall defect detection information is D_{global}, which is a vector (d_{1}, d_{2}, …, d_{n}), where n is the number of training silk cake images; the overall annotation label is A_{global}, which is a vector (a_{1}, a_{2}, …, a_{n}). The calculation formula of the first generation value J_1 is J_1=\frac{1}{n}\sum_{i=1}^{n}(d_{i}-a_{i})^2. For example, if D_{global}=(0.2,0.3,0.1) (indicating the overall defect detection results of the computer system for the three training silk cake images), A_{global}=(0,0,0) (indicating that the three training silk cake images actually have no overall defects), then J_1=\frac{1}{3}[(0.2-0)^2+(0.3-0)^2+(0.1-0)^2]=\frac{1}{3}(0.04+0.09+0.01)=\frac{0.14}{3}\approx0.047. This value indicates the degree of deviation of the image detector from the actual situation in terms of overall defect detection. The smaller the value, the more accurate the overall defect detection.

[0202] In step S52, the local defect detection information of the target training silk cake image block is the result obtained by the computer system performing local image defect detection on the visual implicit representation of multiple training image features of the target training silk cake image block in step S4. This result reflects the judgment of the computer system on whether there are defects in the local area of ​​the target training silk cake image block and the type of defects. For example, the local defect detection information may be a vector or a classification result (such as classification labels such as normal, broken silk, color abnormality, etc.).

[0203] The local annotation mark of the target training silk cake image block is the real local defect situation of the target training silk cake image block known in advance. Again, this is determined by manual annotation or other accurate methods. For example, for a target training silk cake image block, after careful manual inspection, it is determined that there is a wire breakage in a local area, then this local annotation mark will be recorded as wire breakage.

[0204] The significance of determining the second-generation value is to measure the performance of the image detector in local defect detection. Similar to overall defect detection, the computer system uses a quantitative indicator to evaluate the difference between its local defect detection results and the actual situation, so as to optimize the image detector in a targeted manner.

[0205] A feasible technical means is to use cross-entropy to calculate the second-generation value. Assume that the local defect detection information is D_{local}. If it is a classification result, it is assumed to be a probability distribution vector (d_{1}, d_{2}, …, d_{m}) (for example, in the case of binary classification, d_{1} represents the probability of no defect, and d_{2} represents the probability of defect); the local annotation is marked as A_{local}, which is a one-hot encoding vector (for example, in the binary classification, no defect is (1,0) and defect is (0,1)). The calculation formula of the second-generation value J_2 is J_2=-\sum_{i=1}^{m}a_{i}\log(d_{i}). For example, in the case of binary classification, if D_{local}=(0.8,0.2) (indicating that the probability that the computer system judges that there is no defect is 0.8 and the probability that there is a defect is 0.2), A_{local}=(1,0) (indicating that there is actually no defect), then J_2=-[1×\log(0.8)+0×\log(0.2)]=-\log(0.8)\approx0.223. This value indicates the degree of deviation of the image detector from the actual situation in terms of local defect detection. The smaller the value, the more accurate the local defect detection is.

[0206] In step S53, the cost value merging can comprehensively consider the performance of the image detector in terms of overall and local defect detection, thereby obtaining a target cost value that fully reflects the performance of the image detector. This target cost value will be used to optimize the image detector so that the image detector can achieve better performance in terms of overall and local defect detection.

[0207] The purpose is to minimize this target cost value by adjusting the parameters of the image detector, thereby improving the accuracy and effectiveness of the image detector.

[0208] A feasible cost value merging technology is weighted summation. The computer system can determine the weights according to the importance of overall and local defect detection in practical applications. Let the first cost value be J_1, the second cost value be J_2, the weight coefficient be α (0\leqα\leq1), and the calculation formula of the target cost value J be J=αJ_1+(1-α)J_2. For example, if α=0.6, according to J_1\approx0.047 and J_2\approx0.223 calculated above, then J=0.6×0.047+(1-0.6)×0.223=0.0282+0.0892=0.1174.

[0209] The choice of weight α depends on the specific application scenario and requirements. If the accuracy of overall defect detection is more important in actual applications, α can be set larger; conversely, if the accuracy of local defect detection is more critical, α can be set smaller. By adjusting the value of α, the computer system can optimize the performance of the image detector according to different requirements.

[0210] In one implementation, the process of the image detector implementing the above method of the present invention may include:

[0211] Step S10: extracting image features from a plurality of silk cake image blocks to obtain an image feature sequence, and inserting the overall image identifier into the image feature sequence, wherein the image feature sequence includes a plurality of image features of each silk cake image block;

[0212] Step S20: extracting associated features using a self-attention strategy from multiple image features in the image feature sequence using an optimized image detector, preventing multiple image features of a target silk cake image block from paying attention to multiple image features of other silk cake image blocks during the associated feature extraction, and obtaining a visual implicit representation of multiple image features in the image feature sequence, wherein the target silk cake image block is any silk cake image block among the multiple silk cake image blocks;

[0213] Step S30: using the optimized image detector to perform overall image defect detection through the visual implicit representation of the overall image identification, and obtaining overall defect detection information of multiple silk cake image blocks;

[0214] Step S40: using the optimized image detector to perform local image defect detection through the visual implicit representation of multiple image features of the target silk cake image block, and obtaining local defect detection information of the target silk cake image block;

[0215] Step S50: determining target defect detection information according to the overall defect detection information of the plurality of silk cake image blocks and the local defect detection information of the target silk cake image block.

[0216] Since the specific principles have been described in the foregoing content, they will not be repeated here.

[0217] An embodiment of the present invention provides a computer system, such as Figure 2 As shown, the computer system 100 includes: a processor 101 and a memory 103. The processor 101 and the memory 103 are connected, such as through a bus 102. Optionally, the computer system 100 may also include a transceiver 104. It should be noted that in actual applications, the transceiver 104 is not limited to one, and the structure of the computer system 100 does not constitute a limitation on the embodiments of the present invention.

[0218] The above descriptions are only some embodiments of the present invention. It should be pointed out that, for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.

Claims

1. A method for quantitative evaluation of chemical fiber quality based on deep learning, characterized in that: include: Acquire a synthetic fiber silk cake image to be evaluated for quality, and split the synthetic fiber silk cake image into image blocks to obtain a plurality of silk cake image blocks; Extracting image features from the plurality of silk cake image blocks to obtain an image feature sequence, inserting the overall image identifier into the image feature sequence, wherein the image feature sequence includes a plurality of image features of each silk cake image block; Extracting associated features using a self-attention strategy for multiple image features in the image feature sequence, preventing multiple image features of a target silk cake image block from paying attention to multiple image features of other silk cake image blocks during the associated feature extraction, and obtaining a visual implicit representation of multiple image features in the image feature sequence, wherein the target silk cake image block is any silk cake image block among the multiple silk cake image blocks; Performing overall image defect detection through the visual implicit representation of the overall image identification to obtain overall defect detection information of the plurality of silk cake image blocks; Performing local image defect detection through visual implicit representation of multiple image features of the target silk cake image block to obtain local defect detection information of the target silk cake image block; Determine target defect detection information through the overall defect detection information of the plurality of silk cake image blocks and the local defect detection information of the target silk cake image block; The overall image defect detection is a consistency detection process, and the overall defect detection information of the multiple silk cake image blocks is the consistency between the multiple silk cake image blocks; the local image defect detection is a defect type detection process, and the local defect detection information of the target silk cake image block is the defect type of the target silk cake image block; The determining target defect detection information by using the overall defect detection information of the plurality of silk cake image blocks and the local defect detection information of the target silk cake image block comprises: If the consistency between the plurality of silk cake image blocks is greater than the consistency reference value, and the defect type of the target silk cake image block is consistent with the defect types of other silk cake image blocks, then it is determined that the target defect detection information is that the target silk cake image block and the other silk cake image blocks are both normal images; If the consistency between the plurality of silk cake image blocks is not greater than the consistency reference value, and the number of inconsistencies between the defect type of the target silk cake image block and the defect types of other silk cake image blocks is greater than a preset number, then determining the target defect detection information as the target silk cake image block containing a defect; The method is implemented by an image detector, and the image detector is trained by the following steps: Extracting image features from a plurality of training silk cake image blocks to obtain a training image feature sequence, inserting the overall training image feature into the training image feature sequence, wherein the training image feature sequence includes a plurality of training image features of each training silk cake image block; An image detector is used to extract associated features using a self-attention strategy for a plurality of training image features in the training image feature sequence, and when extracting associated features, the plurality of training image features of a target training silk cake image block are prevented from paying attention to a plurality of training image features of other training silk cake image blocks, so as to obtain a visual implicit representation of the plurality of training image features in the training image feature sequence, wherein the target training silk cake image block is any one of the plurality of training silk cake image blocks; Using an image detector to perform overall image defect detection through the visual implicit representation of the overall training image features, to obtain overall defect detection information of the plurality of training silk cake image blocks; Using an image detector to perform local image defect detection through visual implicit representation of multiple training image features of the target training silk cake image block, to obtain local defect detection information of the target training silk cake image block; A target cost value is determined by the overall defect detection information of the plurality of training silk cake image blocks and the local defect detection information of the target training silk cake image blocks, so as to optimize the image detector by the target cost value.

2. The method according to claim 1, characterized in that The extracting of associated features by implementing a self-attention strategy on the multiple image features in the image feature sequence, preventing the multiple image features of the target silk cake image block from paying attention to the multiple image features of other silk cake image blocks during the extraction of associated features, and obtaining the visual implicit representation of the multiple image features in the image feature sequence, comprises: Performing self-attention strategy calculation on multiple image features in the image feature sequence, preventing multiple image features of a target silk cake image block from paying attention to multiple image features of other silk cake image blocks during the self-attention strategy calculation, and obtaining a self-attention weight distribution; Performing self-attention strategy feature extraction on multiple image features in the image feature sequence through the self-attention weight distribution to obtain self-attention implicit representations of the multiple image features in the image feature sequence; Deep feature processing is performed on the self-attention implicit representations of multiple image features in the image feature sequence to obtain visual implicit representations of the multiple image features in the image feature sequence.

3. The method according to claim 2, characterized in that The performing self-attention strategy calculation on the plurality of image features in the image feature sequence comprises: Linearly mapping the feature matrix through the request conversion weight distribution, the index conversion weight distribution and the content conversion weight distribution to obtain a request matrix, an index matrix and a content matrix, wherein the feature matrix includes vector representations of multiple image features in the image feature sequence; Calculate the commonality of the request matrix and the index matrix to obtain an attention matrix; Normalizing the attention matrix to obtain a self-attention weight distribution; The step of performing self-attention strategy feature extraction on multiple image features in the image feature sequence by using the self-attention weight distribution to obtain self-attention implicit representations of the multiple image features in the image feature sequence includes: Linearly mapping the content matrix through the self-attention weight distribution to obtain self-attention implicit representations of multiple image features in the image feature sequence; The method of preventing the multiple image features of the target silk cake image block from paying attention to the multiple image features of other silk cake image blocks during the self-attention strategy calculation includes: In the attention matrix, the multiple image features of the target silk cake image block are prevented from paying attention to the multiple image features of other silk cake image blocks, so as to prevent the multiple image features of the target silk cake image block from paying attention to the multiple image features of other silk cake image blocks.

4. The method according to claim 1, characterized in that Before extracting associated features by implementing a self-attention strategy on a plurality of image features in the image feature sequence, the method further comprises: Quantifying each image feature in the image feature sequence to obtain an implicit representation of each image feature; The extracting of associated features by implementing a self-attention strategy on a plurality of image features in the image feature sequence comprises: The associated feature extraction is implemented by a self-attention strategy on the implicit representation of multiple image features in the image feature sequence.

5. The method according to claim 4, characterized in that The step of quantizing each image feature in the image feature sequence to obtain an implicit representation of each image feature includes: Implicitly representing each image feature in the image feature sequence to obtain an implicit vector representation of each image feature; Obtaining an isolated vector representation of each image feature by dividing the silk cake image into blocks corresponding to each image feature in the image feature sequence; Obtaining a coordinate vector representation of each image feature through the distribution coordinates of each image feature in the image feature sequence in the corresponding silk cake image block; The implicit vector representation, the isolation vector representation and the coordinate vector representation of each image feature are merged to obtain the implicit representation of each image feature.

6. The method according to claim 1, characterized in that The extracting of associated features by implementing a self-attention strategy on the multiple image features in the image feature sequence, preventing the multiple image features of the target silk cake image block from paying attention to the multiple image features of other silk cake image blocks during the extraction of associated features, and obtaining the visual implicit representation of the multiple image features in the image feature sequence, comprises: The associated feature extraction of the self-attention strategy is implemented for multiple image features in the image feature sequence one by one for multiple rounds, and in each round of associated feature extraction, the multiple image features of the target silk cake image block are prevented from paying attention to the multiple image features of other silk cake image blocks, so as to obtain the visual implicit representation of the multiple image features in the image feature sequence obtained by the last round of associated feature extraction.

7. The method according to claim 1, characterized in that The determining of the target cost value by using the overall defect detection information of the plurality of training silk cake image blocks and the local defect detection information of the target training silk cake image blocks comprises: Determine a first generation value by using the overall defect detection information of the plurality of training silk cake image blocks and the overall annotation labels of the plurality of training silk cake image blocks; Determine the second generation value by using the local defect detection information of the target training silk cake image block and the local annotation mark of the target training silk cake image block; The first generation value and the second generation value are cost-valued and merged to obtain a target cost value.

8. The method according to claim 7, characterized in that The process of implementing the method by the image detector includes: Extracting image features from a plurality of silk cake image blocks to obtain an image feature sequence, and inserting the overall image identifier into the image feature sequence, wherein the image feature sequence includes a plurality of image features of each silk cake image block; The optimized image detector is used to extract associated features of the plurality of image features in the image feature sequence using a self-attention strategy, and when extracting associated features, the plurality of image features of the target silk cake image block are prevented from paying attention to the plurality of image features of other silk cake image blocks, so as to obtain a visual implicit representation of the plurality of image features in the image feature sequence, wherein the target silk cake image block is any silk cake image block among the plurality of silk cake image blocks; Using an optimized image detector to perform overall image defect detection through a visual implicit representation of the overall image identification, and obtaining overall defect detection information of the plurality of silk cake image blocks; Using an optimized image detector to perform local image defect detection through visual implicit representation of multiple image features of the target silk cake image block, to obtain local defect detection information of the target silk cake image block; The target defect detection information is determined by the overall defect detection information of the plurality of silk cake image blocks and the local defect detection information of the target silk cake image block.

9. A computer system, characterized in that: include: one or more processors; Memory; one or more computer programs; The one or more computer programs are stored in the memory and configured to be executed by the one or more processors, and when the one or more computer programs are executed by the processors, the method according to any one of claims 1 to 8 is implemented.

Citation Information

Patent Citations

  • Spinning cake side surface defect identification method based on textural features

    CN110415222A

  • Spinning cake defect visual detection system and method based on deep learning

    CN112964732A