A method for detecting sealing ring quality based on machine vision

By combining memory library search, transmission effect optimization and alternating constraint technology, the problem of insufficient data and model complexity in sealing ring quality detection is solved, achieving efficient identification of small defects and reducing computational overhead, improving detection accuracy and stability.

CN118296504BActive Publication Date: 2024-09-17NANCHANG POWER SUPPLY BRANCH OF STATE GRID JIANGXI ELECTRIC POWER CO LTD +1
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202410713927.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-04
Publication Date
2024-09-17
Estimated Expiration
2044-06-04

AI Technical Summary

Technical Problem

Existing sealing ring quality inspection technology has problems such as insufficient training data, limited ability to identify subtle defects, low efficiency of feature extraction and dimensionality reduction methods, gradient disappearance or gradient explosion during model training, and high computational overhead caused by model complexity.

Method used

Generative adversarial networks based on memory library search, neural networks optimized for transmission effects, autoencoders with alternating constraints and deep forest classifiers with redundancy elimination are used. Through the sparsity principle, transmission effect optimization algorithm and alternating constraint feature dimensionality reduction, combined Asynchronous update strategy and redundant elimination strategy improve the training efficiency and detection performance of the model.

Benefits of technology

Effectively expand high-quality training samples, improve the ability to identify small defects, ensure the retention of feature information, control model complexity, reduce computational overhead, and improve detection accuracy and generalization capabilities.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118296504B
    Figure CN118296504B
Patent Text Reader

Abstract

The present invention discloses a sealing ring quality detection method based on machine vision, comprising the following steps: step S1: collecting image data of the sealing ring and marking the collected sealing ring data; step S2: training a generative adversarial network model and outputting the expanded image data; step S3: training a neural network model based on transmission effect optimization, importing the expanded image data of step S2 into the neural network model based on transmission effect optimization, and outputting the extracted image features; step S4: training an autoencoder neural network based on alternating constraints, and the trained autoencoder based on alternating constraints reduces the dimension of image features and outputs the reduced-dimensional image features; step S5: training a deep forest classifier based on redundancy and redundancy elimination, and the trained deep forest classifier based on redundancy and redundancy elimination classifies the reduced-dimensional image features. The present invention provides a faster and more accurate sealing ring quality detection method.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of sealing ring quality detection, and in particular relates to a sealing ring quality detection method based on machine vision. Background Art

[0002] As an important component widely used in various machinery and equipment, the quality of sealing rings is directly related to the stability and safety of the entire system. Even if the tiny defects of sealing rings, such as impurities, bubbles or cracks, are not easy to detect in the early stage, they may evolve into serious performance failures over time, causing equipment damage or even safety accidents. Therefore, accurate quality inspection of sealing rings is not only a necessary step to ensure product quality, but also an important part of ensuring industrial safety. Traditional sealing ring quality inspection methods mostly rely on manual visual inspection or simple machine vision technology. Although these methods have played a role in early industrial production, their limitations have gradually emerged with the development of production technology and the improvement of quality requirements. First, manual inspection is inefficient and easily affected by operator fatigue, resulting in instability and inaccuracy of inspection results. Secondly, simple machine vision inspection methods have limited ability to process complex images and identify tiny or hidden defects, and it is difficult to meet the requirements of high precision and high stability.

[0003] With the rapid development of artificial intelligence technology, especially the successful application of deep learning in the field of image processing, new ideas have been provided to solve the shortcomings of traditional sealing ring quality inspection methods. Deep learning can automatically extract and learn high-level features of images, and has powerful image recognition and classification capabilities, which makes it possible to improve the accuracy and efficiency of sealing ring quality inspection. However, there are still several challenges in applying deep learning technology to sealing ring quality inspection. First, it is difficult to obtain high-quality and highly diverse training data. The training of deep learning models depends on a large amount of labeled data, and high-quality sealing ring image data is difficult to obtain, especially images containing small or special defects are scarce. The second is the optimization problems in the model training process, such as gradient disappearance, gradient explosion, and falling into local optimal solutions. These problems will seriously affect the training efficiency and detection performance of the model. The third is how to balance the complexity and computational overhead of the model to meet the strict requirements of real-time performance and resource consumption in the actual production environment.

[0004] The prior art has the following deficiencies:

[0005] 1. Existing technologies are limited by the difficulty and cost of collecting training data, making it difficult to obtain sufficiently diverse and high-quality training samples.

[0006] 2. Existing technologies may have limitations in processing complex images, especially in identifying subtle defects (such as tiny cracks or impurities).

[0007] 3. The feature extraction and dimensionality reduction methods in the existing technology may not fully utilize the intrinsic structure of the data, resulting in the loss of important information, thus affecting the final detection performance.

[0008] 4. Existing technologies may encounter problems of gradient vanishing or gradient exploding during model training, and it is difficult to avoid falling into local optimal solutions, resulting in low training efficiency and difficulty in model optimization.

[0009] 5. The deep learning models in the existing technology often require a lot of computing resources, and when enhancing the generalization ability of the model, the computing overhead may increase significantly due to the excessive complexity of the model. Summary of the invention

[0010] In view of the technical problems of insufficient sealing ring detection in the prior art, a sealing ring quality detection method based on machine vision is provided.

[0011] A sealing ring quality detection method based on machine vision comprises the following steps:

[0012] Step S1: collecting image data of the sealing ring, and marking the defect type of the collected image data of the sealing ring;

[0013] Step S2: training a generative adversarial network model based on memory library search, wherein the trained generative adversarial network model based on memory library search expands the image data of the sealing ring in step S1 and outputs the expanded image data;

[0014] Step S3: training a neural network model optimized based on transmission effect, wherein the trained neural network model optimized based on transmission effect extracts the original feature representation of the expanded image data in step S2, and outputs the original feature representation;

[0015] Step S4: training an alternating constraint-based autoencoder, wherein the trained alternating constraint-based autoencoder performs dimensionality reduction reconstruction on the original feature representation in step S3, and outputs the dimensionality reduction feature representation;

[0016] Step S5: According to the defect type marked in step S1, a deep forest classifier based on redundancy and redundancy elimination is trained. The trained deep forest classifier based on redundancy and redundancy elimination classifies the reduced dimension feature representation in step S4, and determines the defect type of the sealing ring through classification.

[0017] In the process of training the deep forest classifier based on redundancy and redundancy elimination, the deep forest classifier based on redundancy and redundancy elimination is updated by calculating the contribution of each tree and eliminating trees whose contribution is less than a preset standard.

[0018] Furthermore, step S1 is specifically as follows:

[0019] Step S11: Collect image data of the sealing ring and construct a data set, specifically:

[0020] (1);

[0021] in, A dataset of images representing seals, represents the image data of the sealing ring, and N represents the total number of the image data of the sealing ring;

[0022] Step S12: marking the defect types of the image data of the sealing ring in step S11, where the defect types include no defect, presence of impurities, presence of bubbles and presence of cracks.

[0023] Furthermore, the training in step S2 is based on the generative adversarial network model of memory library search, specifically:

[0024] Step S21: Initialize the generator G and discriminator D of the generative adversarial network model based on memory library search. Generate image data of several sealing rings, expressed as:

[0025] (2);

[0026] in, is from a Gaussian distribution The noise vector sampled from represents the image data of the generated seal ring, Indicates the number of image data of the generated seal ring, represents a generator function;

[0027] The discriminator D determines the authenticity of the image data of the sealing ring generated by the generator G, and then extracts the image data of several generated sealing rings and the corresponding noise vectors to initialize the memory bank, which is expressed as:

[0028] (3);

[0029] in, Represents the memory bank, Represents the memory bank seal image data, represents the memory bank noise vector, corresponding to the memory bank seal ring image data;

[0030] Step S22: Determine the query image, search in the memory, calculate the similarity between the query image and the seal ring image data in the memory, find the seal ring image data in the memory that best matches the query image, and select the noise vector corresponding to the seal ring image data in the memory with the highest similarity as the optimal noise vector for the next step of generation, which is expressed as:

[0031] (4);

[0032] in, Indicates similarity, Represents the cosine similarity calculation function, represents the query image, represents the maximization function;

[0033] Obtain the seal ring image data with the highest similarity from formula (4) and the optimal noise vector ;

[0034] Step S23: Generator The optimal noise vector obtained by step S22 Generate new seal ring image data, expressed as:

[0035] (5);

[0036] in, Indicates the generated new sealing ring image;

[0037] Step S24: Generate adversarial network using loss function based on sparse optimization To calculate the loss in the generation process, the loss function Loss due to generation and sparse loss The composition is expressed as:

[0038] (6);

[0039] L gen (G)= E b noise ∼ D [log(1 - D(G( b noise )))] (7);

[0040] (8);

[0041] in, , and Represent different weight coefficients to balance the loss function different parts of; is the discriminator function, is the target image, represents the sparse evaluation, that is, the number of non-zero elements evaluated, express expectations;

[0042] in, and Adopt adaptive adjustment mode to set and The adjustment method is expressed as:

[0043] (9);

[0044] (10);

[0045] in, A measure of performance improvement, specifically the increment in quality inspection model accuracy between two consecutive iterations, and is the adjustment step size, Indicates the number of iterations;

[0046] Sparse Items Calculated by approximation, it is expressed as:

[0047] (11);

[0048] in, Represents the generated image pixel values, is a preset positive parameter used to ensure numerical stability;

[0049] Step S25: After generating a new sealing ring image, The quality of the data determines whether to update the memory bank;

[0050] An asynchronous update strategy is used to update the generative adversarial network model based on memory library search. Model training and memory library update can be performed independently on different timelines. Update the build generators separately and memory The way is expressed as:

[0051] (12);

[0052] in, is the asynchronous update strategy function, and are the time intervals for generator and memory updates, respectively, allowing model training and memory updates to be performed independently on different timelines;

[0053] For asynchronous update strategies , the update process of the generator G is done by updating the function The implementation is expressed as:

[0054] (13);

[0055] in, and Represent the parameters of the generator before and after the update, It's about generators Total loss The gradient of is the learning rate;

[0056] Memory Bank The update process is done through the update function The implementation is expressed as:

[0057] (14);

[0058] in, and Respectively represent the memory status before and after the update, represents the strategy parameters for memory update;

[0059] minimize to update the parameters of the model.

[0060] Furthermore, the training in step S3 is based on a neural network optimized by projection effect, specifically:

[0061] Step S31: Initialize the neural network based on the projection effect optimization, set the network weights and biases and perform random initialization, initialize a decay chain and the corresponding half-life for each weight and bias, and define the global radioactive decay factor rd;

[0062] Step S32: Each weight There are corresponding decay chains , decay chain It represents the process of weight decaying from the initial state to the steady state, which can be expressed as:

[0063] (15);

[0064] in, ( ) represents all states of weights;

[0065] The weight update method is expressed as:

[0066] (16);

[0067] in, Indicates the weight value of the weight in the previous state, It represents the weight update amount calculated based on the current loss;

[0068] Weight update amount Based on the loss function and the weight value of the weight in the previous state The gradient is calculated and expressed as:

[0069] (17);

[0070] in, represents the learning rate, represents the gradient;

[0071] Loss contribution of weights Calculated using the back propagation algorithm, expressed as:

[0072] (18);

[0073] in, is the predicted output of the neural network, is the actual label value;

[0074] Step S33: According to the loss contribution of each weight, the half-life is adaptively adjusted to make the key weight decay to a steady state faster. The half-life of the weight Determines the number of iterations for the weight to decay to half. The half-life of the weight is adjusted in the following way:

[0075] (19);

[0076] in, is the initial half-life of the weight, Represents a preset constant, represents the loss contribution of the weight, represents the exponential function;

[0077] Step S34: According to the currently updated weight position, simulate the transmission effect and randomly select the weights of other layers of the neural network for small updates. The selected layers and update amplitude are affected by the half-life and decay state of the current weight. After the update, there will be a certain probability Affects the weights of other layers, probability The calculation method is expressed as:

[0078] (20);

[0079] in, and is a constant, Representation weight With weight Distance in neural networks;

[0080] Weight and Distance in Neural Networks It is defined as the distance in the topology of the neural network and is expressed as:

[0081] (twenty one);

[0082] in, and The weights are and The layer number of the neural network;

[0083] Combined with radioactive influences, define the affected weight set To determine the possible The weight of the updated influence is expressed as:

[0084] (twenty two);

[0085] in, is the weight Influence The probability of Represents the threshold value. Greater than threshold When the weight Recognized as The impact of

[0086] The affected weights are updated as follows:

[0087] (twenty three);

[0088] Step S35: Calculate the loss of the neural network optimized based on the projection effect according to the current weights and biases, and use the cross entropy loss function to calculate the loss value;

[0089] Step S36: adaptively adjust the global radioactive decay factor rd; when the global radioactive decay factor rd reaches a threshold, globally update the half-life and decay chain of all weights. The radioactive decay factor rd is updated as follows:

[0090] (twenty four);

[0091] in, is the initial attenuation factor, Indicates the current iteration number. Indicates a preset constant;

[0092] The initial radioactive decay factor is defined based on the complexity of the neural network and other hyperparameters, expressed as:

[0093] (25);

[0094] in, represents the total number of weights in the neural network, Indicates a preset constant.

[0095] Furthermore, the training in step S4 is based on the alternating constrained autoencoder, specifically:

[0096] Step S41: Initialize the autoencoder. and decoder Composition, of which represents the input feature vector, Represents the reconstructed output feature vector, and the initialization process of the encoder and decoder is expressed as:

[0097] (26);

[0098] (27);

[0099] in, represents the low-dimensional feature representation, and Represent the parameters of the encoder and decoder respectively;

[0100] Encoder and decoder parameters and The random initialization method is used to set and sample using Gaussian distribution;

[0101] Step S42: Encoder The input features are converted into low-dimensional feature representations, and the encoder is trained by minimizing the reconstruction error and satisfying the objective function of the spatial optimization constraint. The objective function of the spatial optimization constraint It is expressed as:

[0102] (28);

[0103] in, represents the spatial optimization constraint, represents the weight coefficient of the spatial optimization constraint, is the number of training samples, represents the magnitude of a vector, Representation decoder Output:

[0104] Step S43: Decoder Reconstruct the low-dimensional feature representation back to the original high-dimensional space to minimize the reconstruction error. The spatial optimization constraint used in the decoder training process is expressed as:

[0105] (29);

[0106] in, represents the determinant, express Partial derivatives with respect to the j-th low-dimensional feature representation;

[0107] Decoder The reconstruction error is calculated by comparing the difference between the original high-dimensional feature vector and the reconstructed vector, expressed as:

[0108] (30);

[0109] in, represents the original high-dimensional feature vector, is the high-dimensional vector reconstructed by the decoder, is the sample size, represents the mean square error, which is the decoder The reconstruction error of

[0110] Step S44: Use alternating constraints to optimize the parameters of the autoencoder. In each iteration, first fix Optimize decoder parameters Then fix Optimize in reverse ;

[0111] Step S45: Adjust the weight coefficients of the spatial optimization constraint items by cross-validation method.

[0112] Furthermore, the training in step S5 is based on the redundancy and redundancy elimination of the deep forest classifier, specifically:

[0113] Step S51: Initialize a deep forest classifier based on redundancy and redundancy elimination, set the depth of the forest and the number of trees in each layer, and initialize a deep network structure for each tree in each layer;

[0114] Step S52: For each layer of the forest, use different network structures to extract features of different scales, and merge these features into the next layer. Let the original data feature be eX=[e x 1 ,e x 2 ,...,e x n ] ,in is the number of features, and for each feature , at different scales Extract features on , expressed as:

[0115] (31);

[0116] in, is in scale Feature extraction function on ;

[0117] All scale features are fused into a vector, expressed as:

[0118] (32);

[0119] in, Express Find the union of the scales;

[0120] Step S53: Use the features of the current layer to train the deep network of each tree, and generate some redundant trees. , and its corresponding deep network is expressed as:

[0121] (33);

[0122] in, is the forward propagation function of the deep network, represents a deep network, represents the parameters of the deep network, Represents the input features of the deep network;

[0123] Step S54: For each tree, calculate the contribution of each tree to the model performance, dynamically remove redundant trees according to the set standard, and define the contribution of each tree as ,in represents a hyperparameter;

[0124] For each tree, if its contribution is below a certain threshold , then remove it, expressed as:

[0125] (34);

[0126] Step S55: Fuse the output features of the current layer and pass them to the next layer, fuse the outputs of all trees to obtain the total output of the layer:

[0127] (35);

[0128] in, represents the total output of this layer, represents the fusion function, Express Find the union of the outputs of the number;

[0129] Step S56: repeating steps S52 to S54 until the set forest depth is reached or the model performance meets the preset threshold standard;

[0130] Step S57: Perform sealing ring quality inspection and classification through a classifier, and set the classifier to , then the sealing ring quality inspection classification process is expressed as:

[0131] (36);

[0132] in, represents the parameters of the deep forest classifier based on redundancy and redundancy elimination, Indicates the defect type of the sealing ring.

[0133] The positive and progressive effects of the present invention are:

[0134] 1) Through memory library search and sparsity principle, high-quality and diverse training samples are effectively expanded, making up for the problem of insufficient training data.

[0135] 2) By using the sparsity principle and the transmission effect optimization algorithm, the model can more accurately identify and reproduce the tiny defects of the sealing ring, such as cracks, impurities, etc.

[0136] 3) Through alternating constrained feature dimensionality reduction and radioactive principle-based weight update, the performance of feature extraction and dimensionality reduction is improved, ensuring the retention of key information.

[0137] 4) Through redundancy and redundancy elimination strategies, the model complexity is effectively controlled, the computational overhead is reduced, and the high accuracy and generalization ability of the model are guaranteed. BRIEF DESCRIPTION OF THE DRAWINGS

[0138] Figure 1 The figure is a flow chart of the steps of the sealing ring quality detection method based on machine vision of the present invention. DETAILED DESCRIPTION

[0139] The following describes the embodiments of the present invention through specific examples, and those skilled in the art can easily understand other advantages and effects of the present invention from the contents disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present invention.

[0140] A sealing ring quality detection method based on machine vision, in one example, includes the following steps:

[0141] Step S1: collecting image data of the sealing ring, and marking the defect type of the collected image data of the sealing ring;

[0142] Step S2: training a generative adversarial network model based on memory library search, wherein the trained generative adversarial network model based on memory library search expands the image data of the sealing ring in step S1 and outputs the expanded image data;

[0143] Step S3: training a neural network model optimized based on transmission effect, wherein the trained neural network model optimized based on transmission effect extracts the original feature representation of the expanded image data in step S2, and outputs the original feature representation;

[0144] Step S4: training an alternating constraint-based autoencoder, wherein the trained alternating constraint-based autoencoder performs dimensionality reduction reconstruction on the original feature representation in step S3, and outputs the dimensionality reduction feature representation;

[0145] Step S5: According to the defect type marked in step S1, a deep forest classifier based on redundancy and redundancy elimination is trained. The trained deep forest classifier based on redundancy and redundancy elimination classifies the reduced dimension feature representation in step S4, and determines the defect type of the sealing ring through classification.

[0146] In the process of training the deep forest classifier based on redundancy and redundancy elimination, the deep forest classifier based on redundancy and redundancy elimination is updated by calculating the contribution of each tree and eliminating trees whose contribution is less than a preset standard.

[0147] Furthermore, in one example, step S1 is specifically as follows:

[0148] Step S11: Collect image data of the sealing ring and construct a data set, specifically:

[0149] (1);

[0150] in, A dataset of images representing seals, represents the image data of the sealing ring, and N represents the total number of the image data of the sealing ring;

[0151] Step S12: marking the defect types of the image data of the sealing ring in step S11, where the defect types include no defect, presence of impurities, presence of bubbles and presence of cracks.

[0152] Further, in one example, the training in step S2 is based on the generative adversarial network model of memory library search, specifically:

[0153] Step S21: Initialize the generator G and discriminator D of the generative adversarial network model based on memory library search. Generate image data of several sealing rings, expressed as:

[0154] (2);

[0155] in, is from a Gaussian distribution The noise vector sampled from represents the image data of the generated seal ring, Indicates the number of image data of the generated seal ring, represents a generator function;

[0156] The discriminator D determines the authenticity of the image data of the sealing ring generated by the generator G, and then extracts the image data of several generated sealing rings and the corresponding noise vectors to initialize the memory bank, which is expressed as:

[0157] (3);

[0158] in, Represents the memory bank, Represents the memory bank seal image data, represents the memory bank noise vector, corresponding to the memory bank seal ring image data;

[0159] Step S22: Determine the query image, search in the memory, calculate the similarity between the query image and the seal ring image data in the memory, find the seal ring image data in the memory that best matches the query image, and select the noise vector corresponding to the seal ring image data in the memory with the highest similarity as the optimal noise vector for the next step of generation, which is expressed as:

[0160] (4);

[0161] in, Indicates similarity, Represents the cosine similarity calculation function, represents the query image, represents the maximization function;

[0162] Obtain the seal ring image data with the highest similarity from formula (4) and the optimal noise vector ;

[0163] Step S23: Generator The optimal noise vector obtained by step S22 Generate new seal ring image data, expressed as:

[0164] (5);

[0165] in, Indicates the generated new sealing ring image;

[0166] Step S24: Generate adversarial network using loss function based on sparse optimization To calculate the loss in the generation process, the loss function Loss generated by and sparse loss The composition is expressed as:

[0167] (6);

[0168] L gen (G)= E b noise ∼ D [log(1 - D(G( b noise )))] (7);

[0169] (8);

[0170] in, , and Represent different weight coefficients to balance the loss function different parts of; is the discriminator function, is the target image, represents the sparse evaluation, that is, the number of non-zero elements evaluated, express expectations;

[0171] in, and Adopt adaptive adjustment mode to set and The adjustment method is expressed as:

[0172] (9);

[0173] (10);

[0174] in, A measure of performance improvement, specifically the increment in quality inspection model accuracy between two consecutive iterations, and is the adjustment step size, Indicates the number of iterations;

[0175] Sparse Items Calculated by approximation, it is expressed as:

[0176] (11);

[0177] in, Represents the generated image pixel values, is a preset positive parameter used to ensure numerical stability;

[0178] Step S25: After generating a new sealing ring image, The quality of the data determines whether to update the memory bank;

[0179] An asynchronous update strategy is used to update the generative adversarial network model based on memory library search. Model training and memory library update can be performed independently on different timelines. Update the build generators separately and memory The way is expressed as:

[0180] (12);

[0181] in, is the asynchronous update strategy function, and are the time intervals for generator and memory updates, respectively, allowing model training and memory updates to be performed independently on different timelines;

[0182] For asynchronous update strategies , the update process of the generator G is done by updating the function The implementation is expressed as:

[0183] (13);

[0184] in, and Represent the parameters of the generator before and after the update, It's about generators Total loss The gradient of is the learning rate;

[0185] Memory Bank The update process is done through the update function The implementation is expressed as:

[0186] (14);

[0187] in, and Respectively represent the memory status before and after the update, represents the strategy parameters for memory update;

[0188] minimize to update the parameters of the model.

[0189] Further, in one example, the training in step S3 is based on a neural network optimized based on projection effect, specifically:

[0190] Step S31: Initialize the neural network based on the projection effect optimization, set the network weights and biases and perform random initialization, initialize a decay chain and the corresponding half-life for each weight and bias, and define the global radioactive decay factor rd;

[0191] Step S32: Each weight There are corresponding decay chains , decay chain It represents the process of weight decaying from the initial state to the steady state, which can be expressed as:

[0192] (15);

[0193] in, ( ) represents all states of weights;

[0194] The weight update method is expressed as:

[0195] (16);

[0196] in, Indicates the weight value of the weight in the previous state, It represents the weight update amount calculated based on the current loss;

[0197] Weight update amount Based on the loss function and the weight value of the weight in the previous state The gradient is calculated and expressed as:

[0198] (17);

[0199] in, represents the learning rate, represents the gradient;

[0200] Loss contribution of weights Calculated using the back propagation algorithm, expressed as:

[0201] (18);

[0202] in, is the predicted output of the neural network, is the actual label value;

[0203] Step S33: According to the loss contribution of each weight, the half-life is adaptively adjusted to make the key weight decay to a steady state faster. The half-life of the weight Determines the number of iterations for the weight to decay to half. The half-life of the weight is adjusted in the following way:

[0204] (19);

[0205] in, is the initial half-life of the weight, Represents a preset constant, represents the loss contribution of the weight, represents the exponential function;

[0206] Step S34: According to the currently updated weight position, simulate the transmission effect and randomly select the weights of other layers of the neural network for small updates. The selected layers and update amplitude are affected by the half-life and decay state of the current weight. After the update, there will be a certain probability Affects the weights of other layers, probability The calculation method is expressed as:

[0207] (20);

[0208] in, and is a constant, Representation weight With weight Distance in neural networks;

[0209] Weight and Distance in Neural Networks It is defined as the distance in the topology of the neural network and is expressed as:

[0210] (twenty one);

[0211] in, and The weights are and The layer number of the neural network;

[0212] Combined with radioactive influences, define the affected weight set To determine the possible The weight of the updated influence is expressed as:

[0213] (twenty two);

[0214] in, is the weight Influence The probability of Represents the threshold value. Greater than threshold When the weight Recognized as The impact of

[0215] The affected weights are updated as follows:

[0216] (twenty three);

[0217] Step S35: Calculate the loss of the neural network optimized based on the projection effect according to the current weights and biases, and use the cross entropy loss function to calculate the loss value;

[0218] Step S36: adaptively adjust the global radioactive decay factor rd; when the global radioactive decay factor rd reaches a threshold, globally update the half-life and decay chain of all weights. The radioactive decay factor rd is updated as follows:

[0219] (twenty four);

[0220] in, is the initial attenuation factor, Indicates the current iteration number. Indicates a preset constant;

[0221] The initial radioactive decay factor is defined based on the complexity of the neural network and other hyperparameters, expressed as:

[0222] (25);

[0223] in, represents the total number of weights in the neural network, Indicates a preset constant.

[0224] Further, in one example, the training in step S4 is based on an alternating constrained autoencoder, specifically:

[0225] Step S41: Initialize the autoencoder. and decoder Composition, of which represents the input feature vector, Represents the reconstructed output feature vector, and the initialization process of the encoder and decoder is expressed as:

[0226] (26);

[0227] (27);

[0228] in, represents the low-dimensional feature representation, and Represent the parameters of the encoder and decoder respectively;

[0229] Encoder and decoder parameters and The random initialization method is used to set and sample using Gaussian distribution;

[0230] Step S42: Encoder The input features are converted into low-dimensional feature representations, and the encoder is trained by minimizing the reconstruction error and satisfying the objective function of the spatial optimization constraint. The objective function of the spatial optimization constraint It is expressed as:

[0231] (28);

[0232] in, represents the spatial optimization constraint, represents the weight coefficient of the spatial optimization constraint, is the number of training samples, represents the magnitude of a vector, Representation decoder Output:

[0233] Step S43: Decoder Reconstruct the low-dimensional feature representation back to the original high-dimensional space to minimize the reconstruction error. The spatial optimization constraint used in the decoder training process is expressed as:

[0234] (29);

[0235] in, represents the determinant, express Partial derivatives with respect to the j-th low-dimensional feature representation;

[0236] Decoder The reconstruction error is calculated by comparing the difference between the original high-dimensional feature vector and the reconstructed vector, expressed as:

[0237] (30);

[0238] in, represents the original high-dimensional feature vector, is the high-dimensional vector reconstructed by the decoder, is the sample size, represents the mean square error, which is the decoder The reconstruction error of

[0239] Step S44: Use alternating constraints to optimize the parameters of the autoencoder. In each iteration, first fix Optimize decoder parameters Then fix Optimize in reverse ;

[0240] Step S45: Adjust the weight coefficients of the spatial optimization constraint items by cross-validation method.

[0241] Further, in one example, the training in step S5 is based on a deep forest classifier with redundancy and redundancy elimination, specifically:

[0242] Step S51: Initialize a deep forest classifier based on redundancy and redundancy elimination, set the depth of the forest and the number of trees in each layer, and initialize a deep network structure for each tree in each layer;

[0243] Step S52: For each layer of the forest, use different network structures to extract features of different scales, and merge these features into the next layer. Let the original data feature be eX=[e x 1 ,e x 2 ,...,e x n ] ,in is the number of features, and for each feature , at different scales Extract features on , expressed as:

[0244] (31);

[0245] in, is in scale Feature extraction function on ;

[0246] All scale features are fused into a vector, expressed as:

[0247] (32);

[0248] in, Express Find the union of the scales;

[0249] Step S53: Use the features of the current layer to train the deep network of each tree, and generate some redundant trees. , and its corresponding deep network is expressed as:

[0250] (33);

[0251] in, is the forward propagation function of the deep network, represents a deep network, represents the parameters of the deep network, Represents the input features of the deep network;

[0252] Step S54: For each tree, calculate the contribution of each tree to the model performance, dynamically remove redundant trees according to the set standard, and define the contribution of each tree as ,in represents a hyperparameter;

[0253] For each tree, if its contribution is below a certain threshold , then remove it, expressed as:

[0254] (34);

[0255] Step S55: Fuse the output features of the current layer and pass them to the next layer, fuse the outputs of all trees to obtain the total output of the layer:

[0256] (35);

[0257] in, represents the total output of this layer, represents the fusion function, Express Find the union of the outputs of the number;

[0258] Step S56: repeating steps S52 to S54 until the set forest depth is reached or the model performance meets the preset threshold standard;

[0259] Step S57: Perform sealing ring quality inspection and classification through a classifier, and set the classifier to , then the sealing ring quality inspection classification process is expressed as:

[0260] (36);

[0261] in, represents the parameters of the deep forest classifier based on redundancy and redundancy elimination, Indicates the defect type of the sealing ring.

[0262] The present invention is described in detail above in conjunction with the embodiments of the drawings, and those skilled in the art can make various variations of the present invention according to the above description. Therefore, certain details in the embodiments should not constitute limitations on the present invention, and the present invention shall be protected within the scope defined by the attached claims.

Claims

1. A sealing ring quality detection method based on machine vision, characterized in that: The following steps are involved: Step S1: collecting image data of the sealing ring, and marking the defect type of the collected image data of the sealing ring; Step S2: training a generative adversarial network model based on memory library search, wherein the trained generative adversarial network model based on memory library search expands the image data of the sealing ring in step S1 and outputs the expanded image data; Step S3: training a neural network model optimized based on transmission effect, wherein the trained neural network model optimized based on transmission effect extracts the original feature representation of the expanded image data in step S2, and outputs the original feature representation; Step S4: training an alternating constraint-based autoencoder neural network model, wherein the trained alternating constraint-based autoencoder neural network model performs dimensionality reduction reconstruction on the original feature representation in step S3, and outputs the dimensionality reduction feature representation; Step S5: According to the defect type marked in step S1, a deep forest classifier based on redundancy and redundancy elimination is trained. The trained deep forest classifier based on redundancy and redundancy elimination classifies the reduced dimension feature representation in step S4, and determines the defect type of the sealing ring through classification. In the process of training the deep forest classifier based on redundancy and redundancy elimination, the deep forest classifier based on redundancy and redundancy elimination is updated by calculating the contribution of each tree and eliminating trees whose contribution is less than a preset standard; Step S1 is specifically as follows: Step S11: Collect image data of the sealing ring and construct a data set, specifically: (1); in, A dataset of images representing seals, represents the image data of the sealing ring, and N represents the total number of the image data of the sealing ring; Step S12: marking the defect types of the image data of the sealing ring in step S11, where the defect types include no defect, presence of impurities, presence of bubbles and presence of cracks; The training in step S2 is based on the generative adversarial network model of memoization search, specifically: Step S21: Initialize the generator G and discriminator D of the generative adversarial network model based on memoization search, the generator Generate image data of several sealing rings, expressed as: (2); in, Represents a Gaussian distribution The noise vector sampled from represents the image data of the generated seal ring, Indicates the number of image data of the generated seal ring, represents a generator function; The discriminator D determines the authenticity of the image data of the sealing ring generated by the generator G, and then extracts the image data of several generated sealing rings and the corresponding noise vectors to initialize the memory bank, which is expressed as: (3); in, Represents the memory bank, Represents the memory bank seal image data, represents the memory bank noise vector, corresponding to the memory bank seal ring image data; Step S22: Determine the query image, search in the memory, calculate the similarity between the query image and the seal ring image data in the memory, find the seal ring image data in the memory that best matches the query image, and select the noise vector corresponding to the seal ring image data in the memory with the highest similarity as the optimal noise vector for the next step of generation, which is expressed as: (4); in, Indicates similarity, Represents the cosine similarity calculation function, represents the query image, represents the maximization function; Obtain the seal ring image data with the highest similarity from formula (4) and the optimal noise vector ; Step S23: Generator The optimal noise vector obtained by step S22 Generate new seal ring image data, expressed as: (5); in, Indicates the generated new sealing ring image; Step S24: Generate adversarial network using loss function based on sparse optimization To calculate the loss in the generation process, the loss function Loss due to generation and sparse loss The composition is expressed as: (6); (7); (8); in, , and Represent different weight coefficients to balance the loss function different parts of; is the discriminator function, is the target image, represents the sparse evaluation, that is, the number of non-zero elements evaluated, express expectations; in, and Adopt adaptive adjustment mode to set and The adjustment method is expressed as: (9); (10); in, A measure of performance improvement, specifically the increment in quality inspection model accuracy between two consecutive iterations, and is the adjustment step size, Indicates the number of iterations; Sparse Items Calculated by approximation, it is expressed as: (11); in, Represents the generated image pixel values, is a preset positive parameter used to ensure numerical stability; Step S25: After generating a new sealing ring image, The quality of the data determines whether to update the memory bank; An asynchronous update strategy is used to update the generative adversarial network model based on memoization search. Model training and memory library update can be performed independently on different timelines. Update the build generators separately and memory The way is expressed as: (12); in, is the asynchronous update strategy function, and are the time intervals for generator and memory updates, respectively, allowing model training and memory updates to be performed independently on different timelines; For asynchronous update strategies , the update process of the generator G is done by updating the function The implementation is expressed as: (13); in, and Represent the parameters of the generator before and after the update, It's about generators Total loss The gradient of is the learning rate; Memory Bank The update process is done through the update function The implementation is expressed as: (14); in, and Respectively represent the memory status before and after the update, represents the strategy parameters for memory update; minimize To update the parameters of the model; The training in step S3 is based on a neural network optimized by projection effect, specifically: Step S31: Initialize the neural network based on the projection effect optimization, set the network weights and biases and perform random initialization, initialize a decay chain and the corresponding half-life for each weight and bias, and define the global radioactive decay factor rd; Step S32: Each weight There are corresponding decay chains , decay chain It represents the process of weight decaying from the initial state to the steady state, which can be expressed as: (15); in, represents all states of weights, ; The weight update method is expressed as: (16); in, Indicates the weight value of the weight in the previous state, It represents the weight update amount calculated based on the current loss; Weight update amount Based on the loss function and the weight value of the weight in the previous state The gradient is calculated and expressed as: (17); in, represents the learning rate, represents the gradient; Loss contribution of weights Calculated using the back propagation algorithm, expressed as: (18); in, is the predicted output of the neural network, is the actual label value; Step S33: According to the loss contribution of each weight, the half-life is adaptively adjusted to make the key weight decay to a steady state faster. The half-life of the weight Determines the number of iterations for the weight to decay to half. The half-life of the weight is adjusted in the following way: (19); in, is the initial half-life of the weight, Represents a preset constant, represents the loss contribution of the weight, represents the exponential function; Step S34: According to the currently updated weight position, simulate the transmission effect and randomly select the weights of other layers of the neural network for small updates. The selected layers and update amplitude are affected by the half-life and decay state of the current weight. After the update, there will be a certain probability Affects the weights of other layers, probability The calculation method is expressed as: (20); in, and is a constant, Representation weight With weight Distance in neural networks; Weight and Distance in Neural Networks It is defined as the distance in the topology of the neural network and is expressed as: (21); in, and The weights are and The layer number of the neural network; Combined with radioactive influences, define the affected weight set To determine the possible The weight of the updated influence is expressed as: (22); in, is the weight Influence The probability of Represents the threshold value. Greater than threshold When the weight Recognized as The impact of The affected weights are updated as follows: (23); Step S35: Calculate the loss of the neural network optimized based on the projection effect according to the current weights and biases, and use the cross entropy loss function to calculate the loss value; Step S36: adaptively adjust the global radioactive decay factor rd; when the global radioactive decay factor rd reaches a threshold, globally update the half-life and decay chain of all weights. The radioactive decay factor rd is updated as follows: (24); in, is the initial attenuation factor, Indicates the current iteration number. Indicates a preset constant; The initial radioactive decay factor is defined based on the complexity of the neural network and other hyperparameters, expressed as: (25); in, represents the total number of weights in the neural network, Indicates a preset constant.

2. A sealing ring quality detection method based on machine vision as claimed in claim 1, characterized in that: The training in step S4 is based on the alternating constrained autoencoder, specifically: Step S41: Initialize the autoencoder. and decoder Composition, of which represents the input feature vector, Represents the reconstructed output feature vector, and the initialization process of the encoder and decoder is expressed as: (26); (27); in, represents the low-dimensional feature representation, and Represent the parameters of the encoder and decoder respectively; Encoder and decoder parameters and The random initialization method is used to set and sample using Gaussian distribution; Step S42: Encoder The input features are converted into low-dimensional feature representations, and the encoder is trained by minimizing the reconstruction error and satisfying the objective function of the spatial optimization constraint. The objective function of the spatial optimization constraint It is expressed as: (28); in, represents the spatial optimization constraint, represents the weight coefficient of the spatial optimization constraint, is the number of training samples, represents the magnitude of a vector, Representation decoder Output: Step S43: Decoder Reconstruct the low-dimensional feature representation back to the original high-dimensional space to minimize the reconstruction error. The spatial optimization constraint used in the decoder training process is expressed as: (29); in, represents the determinant, express Partial derivatives with respect to the j-th low-dimensional feature representation; Decoder The reconstruction error is calculated by comparing the difference between the original high-dimensional feature vector and the reconstructed vector, expressed as: (30); in, represents the original high-dimensional feature vector, is the high-dimensional vector reconstructed by the decoder, is the sample size, represents the mean square error, which is the decoder The reconstruction error of Step S44: Use alternating constraints to optimize the parameters of the autoencoder. In each iteration, first fix Optimize decoder parameters Then fix Optimize in reverse ; Step S45: Adjust the weight coefficients of the spatial optimization constraint items by cross-validation method.

3. A sealing ring quality detection method based on machine vision as claimed in claim 2, characterized in that: The training in step S5 is based on the deep forest classifier with redundancy and redundancy elimination, specifically: Step S51: Initialize a deep forest classifier based on redundancy and redundancy elimination, set the depth of the forest and the number of trees in each layer, and initialize a deep network structure for each tree in each layer; Step S52: For each layer of the forest, use different network structures to extract features of different scales, and merge these features into the next layer. Let the original data feature be ,in is the number of features, and for each feature , at different scales Extract features on , expressed as: (31); in, Indicated in scale Feature extraction function on ; All scale features are fused into a vector, expressed as: (32); in, Express Find the union of the scales; Step S53: Use the features of the current layer to train the deep network of each tree, and generate some redundant trees. , and its corresponding deep network is expressed as: (33); in, is the forward propagation function of the deep network, represents a deep network, represents the parameters of the deep network, Represents the input features of the deep network; Step S54: For each tree, calculate the contribution of each tree to the model performance, dynamically remove redundant trees according to the set standard, and define the contribution of each tree as ,in represents a hyperparameter; For each tree, if its contribution is below a certain threshold , then remove it, expressed as: (34); Step S55: Fuse the output features of the current layer and pass them to the next layer, fuse the outputs of all trees to obtain the total output of the layer: (35); in, represents the total output of this layer, represents the fusion function, Express Find the union of the outputs of the number; Step S56: repeating steps S52 to S54 until the set forest depth is reached or the model performance meets the preset threshold standard; Step S57: Perform sealing ring quality inspection and classification through a classifier, and set the classifier to , then the sealing ring quality inspection classification process is expressed as: (36); in, represents the parameters of the deep forest classifier based on redundancy and redundancy elimination, Indicates the defect type of the sealing ring.

Citation Information

Cited By

  • Waterproof performance monitoring method based on computer vision and manufactured fire fighting equipment

    CN122730357A