Steel section self-supervision anomaly detection method and system based on dynamic negative sample mining

Through the self-supervised anomaly detection method based on dynamic negative sample mining, the multi-branch network model is used to dynamically generate global anomaly samples, which solves the problems of high training difficulty and low detection accuracy in steel surface defect detection, and achieves efficient and accurate defect detection.

CN119991655AActive Publication Date: 2025-05-13FUZHOU UNIV +1
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202510457255.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-14
Publication Date
2025-05-13
Estimated Expiration
2045-04-14

AI Technical Summary

Technical Problem

The prior art has problems such as high training difficulty, large sample demand, slow detection speed and limited identification ability of micro defects in steel surface defect detection, which cannot meet the needs of modern industry for efficient and accurate defect detection.

Method used

The self-supervised anomaly detection method of steel cross-section based on dynamic negative sample mining is adopted. Through self-supervised learning, no abnormal samples are required, and a multi-branch network model is constructed. The characteristic deviation between the local abnormal samples and the generated image-level local abnormal samples are dynamically generated to dynamically detect the abnormality of the steel cross-section sample diagram.

Benefits of technology

This method is suitable for complex situations where the number of samples is small, the number of defects is large and difficult to train. It has easy to train, high detection ability and excellent detail processing ability. It does not require additional abnormal samples, which significantly improves the efficiency and accuracy of surface defect detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119991655A_ABST
    Figure CN119991655A_ABST
Patent Text Reader

Abstract

The invention provides a steel section self-supervision anomaly detection method and system based on dynamic negative sample mining. The method comprises the following steps: S1, constructing a multi-branch network model; s2, performing edge saliency analysis on the non-abnormal sample graph of the steel section to intercept a saliency region, and obtaining a non-abnormal sample sub-graph and an edge saliency binary graph; s3, combining the random Berlin noise graph with the edge saliency binary image, generating a composite mask I according to a minimum intersection principle, and then obtaining an abnormal mask through abnormal region screening and smoothing processing; generating a synthetic abnormal picture by using the texture data, the abnormal mask and the non-abnormal sample sub-graph; and S4, carrying out multi-branch network model training by using the non-abnormal sample sub-graph and the synthetic abnormal sample, and obtaining a trained multi-branch network model to carry out steel section sample graph anomaly detection. The method is suitable for complex conditions that the number of samples is small, the number of defect categories is large and training is difficult, and has the advantages of easy training, high detection capability and excellent detail processing capability.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of machine vision surface defect detection, and in particular to a steel cross-section self-supervised anomaly detection method and system based on dynamic negative sample mining. Background Art

[0002] In the process of steel production, the analysis of elemental composition is crucial. The mechanical properties (such as strength, hardness, toughness) and corrosion resistance of steel are closely related to its chemical composition. In order to ensure that the various properties of steel meet the standards, its elemental composition needs to be accurately analyzed and controlled during the steel production process. Among them, spark spectroscopy is widely used in the elemental analysis of steel due to its high efficiency and rapidity. This method identifies the chemical element composition of steel by inducing spark discharge on the steel surface and analyzing the spectral signal generated by the spark. However, this method has high requirements for the surface quality of steel. The surface must be smooth, flat, clean and free of contaminants to ensure the stability of spark discharge and the accuracy of spectral signals. If there are defects or impurities on the steel surface, it will affect the discharge process, resulting in unstable spectral signals, which in turn affects the accurate measurement of elemental composition. Therefore, determining the optimal spark excitation position through surface defect detection plays an important role in improving the accuracy of elemental analysis of steel.

[0003] Although traditional surface defect methods are effective in some cases, they cannot meet the needs of modern industry for efficient and accurate defect detection due to their reliance on manual operation, slow detection speed and limited ability to identify tiny defects. With the development of automation technology and artificial intelligence technology, surface defect detection technologies based on machine vision, deep learning and other methods have gradually been widely used, which can overcome the shortcomings of traditional methods and provide more efficient and accurate detection methods. However, due to the large initial labor costs required for the construction of steel surface defect training data and defect location annotation, they often face the problems of high training difficulty and excessive sample demand, and it is still difficult to meet current actual needs. Summary of the invention

[0004] The purpose of the present invention is to propose a self-supervised anomaly detection method and system for steel cross-sections based on dynamic negative sample mining. The method adopts self-supervised learning and does not require abnormal samples. It is suitable for complex situations with a small number of samples, many defect categories and difficult training. It has the advantages of easy training, high detection capability and excellent detail processing capability.

[0005] To achieve the above object, the technical solution of the present invention is as follows: A self-supervised anomaly detection method for steel sections based on dynamic negative sample mining, the method comprising the following steps: Step S1: Construct a multi-branch network model, which includes a feature extraction layer E , Linear Mapping LayerL , multi-branch feature extraction layer M , adaptive parameter generation layer P And the discriminant layer D ; Step S2: The normal sample graph of the steel section is intercepted by edge significance analysis to extract the significant area and obtain the normal sample sub-graph I P and edge saliency binary map M e ; Step S3: Sub-graphs of samples without abnormalities obtained in step S2 I P As the base map for synthesizing abnormal samples; first, generate a random Perlin noise map and combine it with the saliency binary map obtained in step S2 M e , generate a synthetic mask 1 according to the minimum intersection principle; synthesize the mask 1 to obtain an abnormal mask mask after screening and smoothing the abnormal area; then, obtain texture data from the DTD texture database, and distribute the texture data with the non-abnormal sample sub-image according to a preset distribution ratio I P Perform proportional mixing in the abnormal mask area to obtain synthetic abnormal samples I N (Image-level abnormal samples); Step S4: Combine the non-abnormal sample sub-graphs obtained in step S2 and step S3 I P With synthetic abnormal samples I N The multi-branch network model is used as the input for model training, and the trained multi-branch network model is obtained for abnormality detection of steel section sample images; Step S5: Input the sample image of the steel section to be detected into the feature extraction layer E In the process, the feature extraction layers are sequentially E With linear mapping layer L Obtaining high-dimensional feature vectors v , the shape is ( B , C ), B is the output batch size of the feature proposal layer, and C represents the output dimension of the linear mapping layer; High-dimensional feature vector v Input multi-branch feature extraction layer M In the output branch feature vector V , the shape is ( B , C , N ), N Indicates the number of branches in the branch network; According to the branch feature vectorV Get the discriminant layer D Input V o : in, Representation vector A With vector B In vector dimension d To splice, Represents a vector x Along the dimension d Seek hope, Represents the branch feature vector V Expected value along dimension 3; Will V o Input discriminative layer D In the example, get the anomaly score, the shape is ( B ,1), 1 means; reshape the shape to ( b , h , w ) to obtain the spatial anomaly mask of the image to be detected, where b , h and w They represent the input batch, the height of the anomaly mask, and the width of the anomaly mask, respectively.

[0006] Preferably, the multi-branch feature extraction layer M With configurable number of branches N Each branch adopts an asymmetric coding network structure that first reduces the dimension by 4 times and then increases the dimension by 2 times.

[0007] Preferably, the step S2 specifically includes: performing edge saliency analysis on the non-abnormal sample image, and generating k × k Grid saliency matrix; after normalizing the matrix into a discrete probability distribution, select the saliency center with the probability distribution, crop the non-anomaly sample image according to the saliency center and the given size, and obtain the non-anomaly sample sub-image I P ; Obtain edge saliency binary map by applying morphological operation and adaptive binarization operation to the saliency probability map M e .

[0008] Preferably, the step S4 is specifically: Step S4.1: Sub-graph without abnormal samples I P With synthetic abnormal samples I N Input feature extraction layer EIn the process, the feature extraction layers are sequentially E With linear mapping layer L Obtaining high-dimensional feature vectors v p and v S ; Step S4.2: Convert the high-dimensional feature vector v p and v S Input multi-branch feature extraction layer M The output has no abnormal characteristics V P and synthetic abnormal features V S (Image-level abnormal features), the shape is ( B , C , N ); Step S4.3: Calculate the anomaly-free features of each branch output V P The standard deviation of the eigenvector , as an adaptive parameter generation layer P Input to obtain the dynamic adjustment coefficient ; Step S4.4: Extract layer based on branch features M Output synthetic anomaly features V S With no abnormal features V P The feature distribution difference is constructed to construct the clustering loss, which is used to guide the feature space distribution of the multi-branch network model, and based on the no abnormal features V P Dynamically generate global negative Gaussian samples G n As Gaussian anomaly feature V G (Feature-level abnormal features), the shape is ( B , C , N ), and guide the branch network model to learn difference features through the aggregation loss; Step S4.5: Based on the absence of abnormal features V P , Synthetic abnormal features V S and Gaussian anomaly features V G Get the discriminant layer D Input V' o ; Step S4.6: V'o Input discriminative layer D In the discriminative layer D The output features are D m , the shape is (3 B ,1), of which 3 B The dimension of each of the three samples in the training phase is represented by B ;Will D m Reshape into (3, b , h , w ), the reshaped dimension 1 corresponds to Gaussian anomaly samples, synthetic anomaly samples and non-anomaly samples respectively D P The mask output D G , D S and D P ; For Gaussian anomaly samples and non-anomaly samples, binary cross entropy loss is used; for synthetic anomaly samples, focal loss is used; construct the final network mask loss Maskloss Used for model training.

[0009] Preferably, the adaptive parameter generation layer P It is composed of a Z-score normalization module of branch standard deviation and a single-layer fully connected layer; the dynamic adjustment coefficient is obtained Specifically: The Z-score standardization module is used to normalize the non-abnormal features. V P The standard deviation of the eigenvector Perform Z-score normalization and then input it into a single fully connected layer to obtain a dynamic adjustment coefficient .

[0010] Preferably, the method according to which there is no abnormal feature V P , Synthetic abnormal features V S and Gaussian anomaly features V G Get the discriminant layer D Input V' o ; Specifically: No abnormal features V P , Synthetic abnormal features V S and Gaussian anomaly features V G Perform concatenation on vector dimension 1 to obtain comprehensive features V', calculate the comprehensive features on vector dimension 3 V' The expected value of the mean is obtained ; Discriminant layer D Input V' o satisfy: in, Representation vector A、 vector B With vector C In vector dimension d Make stitching.

[0011] Preferably, the branch feature extraction layer M Output synthetic anomaly features V S With no abnormal features V P The feature distribution difference is constructed to construct the clustering loss, which is used to guide the feature space distribution of the multi-branch network model, and based on the no abnormal features V P Dynamically generate global negative Gaussian samples G n ; Specifically: in, and Respectively e In the multi-branch feature extraction layer during round training M The normal features (positive sample feature vector) at The generated global negative Gaussian samples, There are no abnormal features in the e-th round of training The standard deviation of the eigenvector of Generates the layer for adaptive parameters in the e-th round of training P Dynamic adjustment coefficient of output, and Respectively e The learnable adjustment parameters in the round of training and the learning rate corresponding to the learnable adjustment parameters, for , and The product of In the random noise part, Z is a standard Gaussian distribution, satisfying , is the Gaussian abnormal sample loss of the discriminant layer on the feature vector x gradient.

[0012] Preferably, the aggregation loss adrloss In the multi-branch feature extraction layerM is generated and used to guide the branch network model to learn differential features. The clustering loss adrloss satisfy:

[0013] in, is the gradient value of directional noise; for The standard deviation of dimension 3 is updated with the network; for The mean along dimension 3, N is the number of network branches, and No abnormal features V P and synthetic abnormal features V S The standard deviation of the eigenvector of and They represent learnable adjustment parameters and dynamic adjustment coefficients respectively.

[0014] Preferably, the network mask loss Maskloss Specifically: in, and Respectively, vector x and y Binary cross entropy loss and focal loss, mask is the anomaly mask for synthesizing anomaly samples. 1 and 0 represent a 1-filled vector and a 0-filled vector of the same size as the input vector, respectively.

[0015] A steel section self-supervised anomaly detection system based on dynamic negative sample mining includes a processor, a memory, and a computer program stored in the memory. When the processor executes the computer program, it specifically executes the steps in the above-mentioned steel section self-supervised anomaly detection method based on dynamic negative sample mining.

[0016] Compared with the prior art, the present invention has the following beneficial effects: The present invention proposes a new multi-branch network and a self-supervised anomaly detection method based on dynamic negative sample mining. The method dynamically generates feature-level global anomaly samples through the feature deviation between the non-abnormal samples and the image-level local anomaly samples generated by them. It is suitable for complex situations with a small number of samples, many defect categories and difficult training. It has the advantages of easy training, high detection ability and excellent detail processing ability, and does not require additional abnormal samples. It has high practicality and broad application prospects in the field of surface defect detection. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] Figure 1 This is a graph showing the detection results of samples with different abnormal ranges using a multi-branch network model trained for 200 rounds using 25 defect-free steel cross-section images in an embodiment of the present invention; Figure 2 Schematic diagram of a synthesis strategy for image-level abnormal samples in an embodiment of the present invention; Figure 3 This is a diagram of a multi-branch network architecture suitable for dynamic negative sample mining in an embodiment of the present invention. DETAILED DESCRIPTION

[0018] The following is combined with Figure 1-3 , the technical solution of the present invention is specifically described.

[0019] It should be noted that the following detailed descriptions are exemplary and are intended to provide further explanation of the present application. Unless otherwise specified, all technical and scientific terms used herein have the same meanings as those commonly understood by those skilled in the art to which the present application belongs.

[0020] It should be noted that the terms used herein are only for describing specific embodiments and are not intended to limit the exemplary embodiments according to the present application. As used herein, unless the context clearly indicates otherwise, the singular form is also intended to include the plural form. In addition, it should be understood that when the terms "comprise" and / or "include" are used in this specification, it indicates the presence of features, steps, operations, devices, components and / or combinations thereof.

[0021] This paper proposes a steel section self-supervised anomaly detection method based on dynamic negative sample mining. Figure 2-3 , the method comprises the following steps: Step S1: Construct a multi-branch network model, which includes a feature extraction layer E , Linear Mapping Layer L , multi-branch feature extraction layer M , adaptive parameter generation layer P And the discriminant layer D ; Step S2: The normal sample graph of the steel section is intercepted by edge significance analysis to extract the significant area and obtain the normal sample sub-graph I P and edge saliency binary map M e ; Step S3: Sub-graphs of samples without abnormalities obtained in step S2 I P As the base map for synthesizing abnormal samples; first, generate a random Perlin noise map and combine it with the saliency binary map obtained in step S2 Me , generate a synthetic mask 1 according to the minimum intersection principle; synthesize mask 1 through abnormal area screening and smoothing to obtain abnormal mask mask; then, obtain texture data from the DTD texture database and distribute it according to the preset distribution ratio (for example, according to Distribution ratio) The texture data is compared with the sample sub-image without abnormality I P Perform proportional mixing in the abnormal mask area to obtain synthetic abnormal samples I N (Image-level abnormal samples); Step S4: Combine the non-abnormal sample sub-graphs obtained in step S2 and step S3 I P With synthetic abnormal samples I N The multi-branch network model is used as the input for model training, and the trained multi-branch network model is obtained for abnormality detection of steel section sample images; Step S5: Input the sample image of the steel section to be detected into the feature extraction layer E In the process, the feature extraction layers are sequentially E With linear mapping layer L Obtaining high-dimensional feature vectors v , the shape is ( B , C ), B is the output batch size of the feature proposal layer, and C represents the output dimension of the linear mapping layer; High-dimensional feature vector v Input multi-branch feature extraction layer M In the output branch feature vector V , the shape is ( B , C , N ), N Indicates the number of branches in the branch network; According to the branch feature vector V Get the discriminant layer D Input V o : in, Representation vector A With vector B In vector dimension d To splice, Represents a vector x Along the dimension d Seek hope, Represents the branch feature vector V Expected value along dimension 3; WillV o Input discriminative layer D In the example, get the anomaly score, the shape is ( B ,1), 1 means; reshape the shape to ( b , h , w ) to obtain the spatial anomaly mask of the image to be detected, where b , h and w They represent the input batch, the height of the anomaly mask, and the width of the anomaly mask, respectively.

[0022] In this embodiment, the multi-branch feature extraction layer M With configurable number of branches N Each branch adopts an asymmetric coding network structure that first reduces the dimension by 4 times and then increases the dimension by 2 times.

[0023] In this embodiment, the step S2 is specifically as follows: edge saliency analysis is performed on the non-abnormal sample image, and average pooling is performed to generate k × k Grid (e.g. 8×8 grid) saliency matrix; after normalizing the matrix to a discrete probability distribution, select the saliency center based on the probability distribution, crop the non-anomaly sample image according to the saliency center and the given size, and obtain the non-anomaly sample sub-image I P ; Obtain edge saliency binary map by applying morphological operation and adaptive binarization operation to the saliency probability map M e .

[0024] In this embodiment, the step S4 is specifically as follows: Step S4.1: Sub-graph without abnormal samples I P With synthetic abnormal samples I N Input feature extraction layer E In the process, the feature extraction layers are sequentially E With linear mapping layer L Obtaining high-dimensional feature vectors v p and v S ; Step S4.2: Convert the high-dimensional feature vector v p and v S Input multi-branch feature extraction layer M The output has no abnormal characteristics V P and synthetic abnormal features VS (Image-level abnormal features), the shape is ( B , C , N ); Step S4.3: Calculate the anomaly-free features of each branch output V P The standard deviation of the eigenvector , as an adaptive parameter generation layer P Input to obtain the dynamic adjustment coefficient ; Step S4.4: Extract layer based on branch features M Output synthetic anomaly features V S With no abnormal features V P The difference distribution of global negative example Gaussian samples is generated dynamically G n As Gaussian anomaly feature V G (Feature-level abnormal features), the shape is ( B , C , N ), and guide the branch network model to learn difference features through the aggregation loss; Step S4.5: Based on the absence of abnormal features V P , Synthetic abnormal features V S and Gaussian anomaly features V G Get the discriminant layer D Input V' o ; Step S4.6: V' o Input discriminative layer D In the discriminative layer D The output features are D m , the shape is (3 B ,1), of which 3 B The dimension of each of the three samples in the training phase is represented by B ;Will D m Reshape into (3, b , h , w ), the reshaped dimension 1 corresponds to Gaussian anomaly samples, synthetic anomaly samples and non-anomaly samples respectively D P The mask output D G , DS and D P ; For Gaussian anomaly samples and non-anomaly samples, binary cross entropy loss is used; for synthetic anomaly samples, focal loss is used; construct the final network mask loss Maskloss Used for model training.

[0025] In this embodiment, the adaptive parameter generation layer P It is composed of a Z-score normalization module of branch standard deviation and a single-layer fully connected layer; the dynamic adjustment coefficient is obtained Specifically: The Z-score standardization module is used to normalize the non-abnormal features. V P The standard deviation of the eigenvector Perform Z-score normalization and then input it into a single fully connected layer to obtain a dynamic adjustment coefficient .

[0026] In this embodiment, the absence of abnormal features V P , Synthetic abnormal features V S and Gaussian anomaly features V G Get the discriminant layer D Input V' o ; Specifically: No abnormal features V P , Synthetic abnormal features V S and Gaussian anomaly features V G Perform concatenation on vector dimension 1 to obtain comprehensive features V' , calculate the comprehensive features on vector dimension 3 V' The expected value of the mean is obtained ; Discriminant layer D Input V' o satisfy: in, Representation vector A、 vector B With vector C In vector dimension d Make stitching.

[0027] In this embodiment, the branch feature extraction layer M Output synthetic anomaly features V S With no abnormal features VP The feature distribution difference is constructed to construct the clustering loss, which is used to guide the feature space distribution of the multi-branch network model, and based on the no abnormal features V P Dynamically generate global negative Gaussian samples G n ; Specifically: in, and Respectively e In the multi-branch feature extraction layer during round training M The normal features (positive sample feature vector) at The generated global negative Gaussian samples, There are no abnormal features in the e-th round of training The standard deviation of the eigenvector of Generates the layer for adaptive parameters in the e-th round of training P Dynamic adjustment coefficient of output, and Respectively e The learnable adjustment parameters in the round of training and the learning rate corresponding to the learnable adjustment parameters, for , and The product of In the random noise part, Z is a standard Gaussian distribution, satisfying , is the Gaussian abnormal sample loss of the discriminant layer on the feature vector x gradient.

[0028] In this embodiment, the aggregation loss adrloss (Aggregation and Repulsion loss) in the multi-branch feature extraction layer M is generated and used to guide the branch network model to learn differential features. The clustering loss adrloss satisfy:

[0029] in, is the gradient value of directional noise; for The standard deviation of dimension 3 is updated with the network; for The mean along dimension 3, N is the number of network branches, and No abnormal features V P and synthetic abnormal featuresV S The standard deviation of the eigenvector of and They represent learnable adjustment parameters and dynamic adjustment coefficients respectively.

[0030] In this embodiment, the network mask loss Maskloss Specifically: in, and are the binary cross entropy loss and focal loss of vectors x and y, respectively. mask is the anomaly mask for synthesizing anomaly samples. 1 and 0 represent a 1-filled vector and a 0-filled vector of the same size as the input vector, respectively.

[0031] The present invention also proposes a steel section self-supervised anomaly detection system based on dynamic negative sample mining, comprising a processor, a memory, and a computer program stored in the memory. When the processor executes the computer program, it specifically executes the steps in the above-mentioned steel section self-supervised anomaly detection method based on dynamic negative sample mining.

[0032] In summary, the present invention relates to a dynamic negative sample mining strategy for unsupervised networks, which is suitable for cylindrical steel section defect detection. The strategy is based on a multi-branch network and dynamically generates feature-level global abnormal samples according to the feature deviations between non-abnormal samples and the local abnormal samples at the image level generated by them. This method is particularly suitable for complex situations with a small number of samples, many defect categories and difficult training. Compared with the static noise strategy, the dynamic noise strategy proposed in the present invention shows excellent performance in terms of training speed, detection rate and detail processing capability, and has significant practical application value in the field of surface defect detection. Figure 1 As shown in the figure (wherein the groups a, b, c, and d are the detection result diagrams of samples without abnormalities, samples with large-range abnormalities, samples with medium-range abnormalities, and samples with small-range abnormalities, respectively), under the harsh condition of only 25 pictures of defect-free steel sections, the present invention can still effectively detect steel section defects after 200 rounds of training, showing good detection effect.

[0033] The above is only a preferred embodiment of the present invention, and does not limit the present invention in other forms. Any technician familiar with the profession may use the above disclosed technical content to change or modify it into an equivalent embodiment with equivalent changes. However, any simple modification, equivalent change and modification made to the above embodiment according to the technical essence of the present invention without departing from the technical solution of the present invention still belongs to the protection scope of the technical solution of the present invention.

Claims

1. A self-supervised anomaly detection method for steel sections based on dynamic negative sample mining, characterized in that: The method comprises the following steps: Step S1: Construct a multi-branch network model, which includes a feature extraction layer E , Linear Mapping Layer L , multi-branch feature extraction layer M , adaptive parameter generation layer P And the discriminant layer D ; Step S2: The normal sample graph of the steel section is intercepted by edge significance analysis to extract the significant area and obtain the normal sample sub-graph I P and saliency binary map M e ; Step S3: Sub-graphs of samples without abnormalities obtained in step S2 I P As the base map for synthesizing abnormal samples; first, generate a random Perlin noise map and combine it with the saliency binary map obtained in step S2 M e , generate a synthetic mask 1 according to the minimum intersection principle; synthesize the mask 1 to obtain an abnormal mask mask after screening and smoothing the abnormal area; then, obtain texture data from the DTD texture database, and distribute the texture data with the non-abnormal sample sub-image according to a preset distribution ratio I P Perform proportional mixing in the abnormal mask area to obtain synthetic abnormal samples I N ; Step S4: Combine the non-abnormal sample sub-graphs obtained in step S2 and step S3 I P With synthetic abnormal samples I N The multi-branch network model is used as the input for model training, and the trained multi-branch network model is obtained for abnormality detection of steel section sample images; Step S5: Input the sample image of the steel section to be detected into the feature extraction layer E In the process, the feature extraction layers are sequentially E With linear mapping layer L Obtaining high-dimensional feature vectors v , the shape is ( B , C ), B is the output batch size of the feature proposal layer, and C represents the output dimension of the linear mapping layer; High-dimensional feature vector v Input multi-branch feature extraction layer M In the output branch feature vector V , the shape is ( B , C , N ), N Indicates the number of branches in the branch network; According to the branch feature vector V Get the discriminant layer D Input V o : in, Representation vector A With vector B In vector dimension d To splice, Represents a vector x Along the dimension d Seek hope, Represents the branch feature vector V Expected value along dimension 3; Will V o Input discriminative layer D , get the anomaly score; reshape it to ( b , h , w ) to obtain the spatial anomaly mask of the image to be detected, where b , h and w They represent the input batch, the height of the anomaly mask, and the width of the anomaly mask, respectively.

2. The method for self-supervised anomaly detection of steel sections based on dynamic negative sample mining according to claim 1 is characterized in that: The multi-branch feature extraction layer M With configurable number of branches N Each branch adopts an asymmetric coding network structure that first reduces the dimension by 4 times and then increases the dimension by 2 times.

3. The method for self-supervised anomaly detection of steel sections based on dynamic negative sample mining according to claim 1 is characterized in that: The step S2 specifically includes: performing edge saliency analysis on the non-abnormal sample image and generating k × k Grid saliency matrix; after normalizing the matrix into a discrete probability distribution, select the saliency center with the probability distribution, crop the non-anomaly sample image according to the saliency center and the given size, and obtain the non-anomaly sample sub-image I P ; Obtain edge saliency binary map by applying morphological operation and adaptive binarization operation to the saliency probability map M e .

4. The method for self-supervised anomaly detection of steel sections based on dynamic negative sample mining according to claim 2 is characterized in that: The step S4 is specifically as follows: Step S4.1: Sub-graph without abnormal samples I P With synthetic abnormal samples I N Input feature extraction layer E In the process, the feature extraction layers are sequentially E With linear mapping layer L Obtaining high-dimensional feature vectors v p and v S ; Step S4.2: Convert the high-dimensional feature vector v p and v S Input multi-branch feature extraction layer M The output has no abnormal characteristics V P and synthetic abnormal features V S , the shape is ( B , C , N ); Step S4.3: Calculate the anomaly-free features of each branch output V P The standard deviation of the eigenvector , as the adaptive parameter generation layer P Input to obtain the dynamic adjustment coefficient ; Step S4.4: Extract layer based on branch features M Output synthetic anomaly features V S With no abnormal features V P The feature distribution difference is constructed to construct the clustering loss, which is used to guide the feature space distribution of the multi-branch network model, and based on the no abnormal features V P Dynamically generate global negative Gaussian samples G n As Gaussian anomaly feature V G , the shape is ( B , C , N ); Step S4.5: Based on the absence of abnormal features V P , Synthetic abnormal features V S and Gaussian anomaly features V G Get the discriminant layer D Input V' o ; Step S4.6: V' o Input discriminative layer D In the discriminative layer D The output features are D m , the shape is (3 B ,1), of which 3 B The dimension of each of the three samples in the training phase is represented by B ;Will D m Reshape into (3, b , h , w ), the reshaped dimension 1 corresponds to the mask output of Gaussian anomaly samples, synthetic anomaly samples and non-anomaly samples respectively D G , D S and D P ; For Gaussian anomaly samples and non-anomaly samples, binary cross entropy loss is used; for synthetic anomaly samples, focal loss is used; construct the final network mask loss Maskloss Used for model training.

5. The method for self-supervised anomaly detection of steel sections based on dynamic negative sample mining according to claim 4, characterized in that: The adaptive parameter generation layer P It is composed of a Z-score normalization module of branch standard deviation and a single-layer fully connected layer; the dynamic adjustment coefficient is obtained Specifically: The Z-score standardization module is used to normalize the non-abnormal features. V P The standard deviation of the eigenvector Perform Z-score normalization and then input it into a single fully connected layer to obtain a dynamic adjustment coefficient .

6. The method for self-supervised anomaly detection of steel sections based on dynamic negative sample mining according to claim 4, characterized in that: The basis has no abnormal characteristics V P , Synthetic abnormal features V S and Gaussian anomaly features V G Get the discriminant layer D Input V' o ; Specifically: No abnormal features V P , Synthetic abnormal features V S and Gaussian anomaly features V G Perform concatenation on vector dimension 1 to obtain comprehensive features V' , calculate the comprehensive features on vector dimension 3 V' The expected value of ; Discriminant layer D Input V' o satisfy: in, Representation vector A、 vector B With vector C In vector dimension d Make stitching.

7. The method for self-supervised anomaly detection of steel sections based on dynamic negative sample mining according to claim 4, characterized in that: The branch feature extraction layer M Output synthetic anomaly features V S With no abnormal features V P The feature distribution difference is constructed to construct the clustering loss, which is used to guide the feature space distribution of the multi-branch network model, and based on the no abnormal features V P Dynamically generate global negative Gaussian samples G n ; Specifically: in, and Respectively e In the multi-branch feature extraction layer during round training M The non-abnormal characteristics and the non-abnormal characteristics The generated global negative Gaussian samples, There are no abnormal features in the e-th round of training The standard deviation of the eigenvector of Generates the layer for adaptive parameters in the e-th round of training P Dynamic adjustment coefficient of output, and Respectively e The learnable adjustment parameters in the round of training and the learning rate corresponding to the learnable adjustment parameters, for , and The product of In the random noise part, Z is a standard Gaussian distribution, satisfying , is the Gaussian abnormal sample loss of the discriminant layer on the feature vector x gradient.

8. The method for self-supervised anomaly detection of steel sections based on dynamic negative sample mining according to claim 4, characterized in that: Aggregation loss adrloss In the multi-branch feature extraction layer M is generated and used to guide the branch network model to learn differential features. The clustering loss adrloss satisfy: ; in, is the gradient value of directional noise; for The standard deviation of dimension 3 is updated with the network; for The mean along dimension 3, N is the number of network branches, and No abnormal features V P and synthetic abnormal features V S The standard deviation of the eigenvector of and They represent learnable adjustment parameters and dynamic adjustment coefficients respectively.

9. The method for self-supervised anomaly detection of steel sections based on dynamic negative sample mining according to claim 4, characterized in that: The network mask loss Maskloss Specifically: in, and Respectively, vector x and y Binary cross entropy loss and focal loss, mask is the anomaly mask for synthesizing anomaly samples. 1 and 0 represent a 1-filled vector and a 0-filled vector of the same size as the input vector, respectively.

10. A self-supervised anomaly detection system for steel sections based on dynamic negative sample mining, characterized in that: The method comprises a processor, a memory and a computer program stored in the memory. When the processor executes the computer program, the method specifically performs the steps in the method for self-supervised anomaly detection of steel sections based on dynamic negative sample mining as described in any one of claims 1 to 9.

Citation Information

Patent Citations

  • Self-supervised anomaly detection method based on comparative learning

    CN117456272A

  • Supermarket cargo outer package anomaly detection method based on multi-branch feature extraction and foreground mining

    CN119785040A

  • Trace representation learning

    US20230376743A1

  • Sample processing method and apparatus, computing device, and computer-readable storage medium

    WO2024078426A1