Air valve defect detection method, system, equipment and medium
Through the combination of conditional generation adversarial network and convolutional neural network, the problems of low efficiency and poor accuracy of traditional air valve defect detection are solved, and efficient and accurate air valve defect detection and detailed report generation are achieved.
Patent Information
- Application Number
- CN202510185023.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-19
- Publication Date
- 2025-07-18
AI Technical Summary
Traditional manual air valve defect detection methods are inefficient and prone to missed detection, making it difficult to accurately detect defects such as cracks, pits, etc. on the surface of the air valve.
The conditional generation adversarial network (cGAN) is used to enhance image quality, combined with convolutional neural network (CNN) for feature extraction and classification, and a gas valve defect detection system is built, including data preprocessing, image enhancement model training and convolutional neural network training, and a detailed defect report is generated.
It significantly improves the accuracy and efficiency of air valve defect detection, reduces false alarms and missed reports, provides detailed defect data support, and has broad application prospects and commercial value.
Smart Images

Figure CN120339161A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of book and file management, and particularly to a method, system, device, and medium for detecting air valve defects. Background Art
[0002] As an important mechanical component, the quality of an air valve directly affects the normal operation and service life of the equipment. During the production process of air valves, various defects such as cracks, pits, and scratches often occur due to factors such as material problems and processing errors. These defects are usually difficult to accurately detect by manual means. Especially in mass production, traditional manual detection methods are not only inefficient but also prone to missed detections and false detections.
[0003] Therefore, a new method for detecting air valve defects is needed. Summary of the Invention
[0004] The purpose of this application is to provide a method, system, device, and medium for detecting air valve defects to solve the problems of low efficiency of manual detection methods and easy occurrence of missed detections and false detections in related technologies.
[0005] To achieve the above purpose, this application provides the following technical solutions:
[0006] In a first aspect, a method for detecting air valve defects provided by this application includes:
[0007] Obtain the first image data of a defective air valve, and perform preprocessing operations on the image data of the air valve defects to obtain the second image data of the defective air valve; according to the second image data of the defective air valve, train a preset image enhancement model and a preset convolutional neural network to obtain the trained image enhancement model and the trained convolutional neural network; obtain the first image data of the air valve to be detected, and preprocess the image data of the air valve to be detected to obtain the second image data of the air valve to be detected; input the second image data of the air valve to be detected into the trained image enhancement model to obtain the third image data of the air valve to be detected; input the third image data of the air valve to be detected into the trained convolutional neural network for defect detection to obtain the defect detection result.
[0008] Further, the step of training a preset image enhancement model and a preset convolutional neural network according to the second image data of the defective air valve to obtain the trained image enhancement model and the trained convolutional neural network includes:
[0009] Input the second image data of the defective air valve into a preset image enhancement model for training to obtain the trained image enhancement model; input the second image data of the defective air valve into the trained image enhancement model to obtain the third image data of the defective air valve; input the third image data of the defective air valve into a preset convolutional neural network for training to obtain the trained convolutional neural network.
[0010] Further, the preprocessing operation includes: denoising, grayscaling, and contrast enhancement processing on the image data.
[0011] Further, the training of the preset image enhancement model to obtain the trained image enhancement model specifically includes:
[0012] Set conditional labels for the second image data of the defective air valve to obtain the image data of the defective air valve with conditional labels;
[0013] Construct a generator and a discriminator according to the image data of the defective air valve with conditional labels;
[0014] Construct the loss function of the generator and the loss function of the discriminator;
[0015] Train the generator and the discriminator to obtain the trained image enhancement model.
[0016] Further, the generator uses the following calculation formula:
[0017]
[0018] where \(z\in R\) m is a noise vector sampled from a random distribution, \(c\) is conditional information, is the image output by the generator.
[0019] Further, the method further includes: generating a defect detection report according to the result of the defect detection.
[0020] Further, the discriminator uses the following calculation formula:
[0021] \(D(x,c)=P(\text{real}|x,c)\)
[0022] where \(x\) is the input image, \(c\) is conditional information, and \(D(x,c)\) is the authenticity probability output by the discriminator, indicating whether the image \(x\) is a real image.
[0023] The loss function of the generator uses the following calculation formula:
[0024] \(L\) G \(=-\mathbb{E}\)z,c [logD(G(z,c),c)]
[0025] The loss function of the discriminator adopts the following calculation formula:
[0026] L D =-Ε x,c [logD(x,c)]-Ε z,c [log(1-D(G(z,c),c))]
[0027] Where x is the real image; c is the conditional input; z is the noise vector sampled from the random distribution; G(z,c) is the image generated by the generator; D(x,c) is the judgment of the discriminator on the real image x and the condition c, indicating whether the image x is a real image; D(G(z,c),c) is the judgment of the discriminator on the generated image G(z,c) and the condition c, indicating the probability that the generated image is judged to be real; L G is the loss function of the generator; L D is the loss function of the discriminator.
[0028] Furthermore, the loss function of the convolutional neural network model has the following specific calculation formula:
[0029] Loss = λ cls ·Loss cls +λ reg ·Loss reg
[0030] Where λ cls and λ reg are the weights of the classification loss and the regression loss respectively, and Loss cls and Loss reg represent the classification loss function and the regression loss function respectively.
[0031] In a second aspect, the present application also provides a detection system for air valve defects, including:
[0032] A first data acquisition module, configured to acquire first image data of a defective air valve, and perform a preprocessing operation on the image data of the air valve defect to obtain second image data of the defective air valve;
[0033] A training module, configured to train a preset image enhancement model and a preset convolutional neural network according to the second image data of the defective air valve to obtain a trained image enhancement model and a trained convolutional neural network;
[0034] A second data acquisition module, configured to acquire first image data of the air valve to be detected, and preprocess the image data of the air valve to be detected to obtain second image data of the air valve to be detected;
[0035] An image enhancement module, configured to input the second image data of the valve to be detected into the trained image enhancement model to obtain the third image data of the valve to be detected;
[0036] A defect detection module, configured to input the third image data of the valve to be detected into the trained convolutional neural network for defect detection to obtain the result of defect detection.
[0037] In a third aspect, the present application further provides a computer electronic device, including a memory and a processor, where the memory stores a computer program, and when the processor executes the computer program, the steps of the method for detecting valve defects described in any one of the above are implemented.
[0038] In a fourth aspect, the present application further provides a computer-readable storage medium, where the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the method for detecting valve defects described in any one of the above are implemented.
[0039] For a method, a system, a device, and a medium for detecting valve defects provided by the present application, the beneficial effects are as follows:
[0040] First, the present application uses a conditional generative adversarial network (cGAN) to enhance the image quality, improve the diversity of the data set, and overcome the common data insufficiency and image noise problems in traditional defect detection methods; then, the present application combines the powerful feature extraction and classification capabilities of a convolutional neural network (CNN) to accurately locate and classify various defects on the surface of the valve. The method in the present application not only significantly improves the accuracy and detection efficiency of defect detection, reduces false alarms and missed detections, but also can automatically generate detailed defect reports, providing detailed data support for quality control, and has broad application prospects and high commercial value. Description of the Drawings
[0041] Figure 1 is a schematic flowchart of a method for detecting valve defects in an embodiment of the present application;
[0042] Figure 2 is a schematic structural diagram of a system for detecting valve defects in an embodiment of the present application;
[0043] Figure 3 is a schematic structural diagram of a computer electronic device in an embodiment of the present application. Detailed Embodiments
[0044] Next, the technical solutions in the embodiments of the present application will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments in the present application without making creative efforts shall fall within the protection scope of the present application.
[0045] It should be noted that when an element is referred to as being "fixed to" another element, it can be directly on the other element or there can also be an intermediate element. When an element is considered to be "connected to" another element, it can be directly connected to the other element or there may be an intermediate element at the same time. On the contrary, when an element is referred to as being "directly on" another element, there is no intermediate element. The terms "vertical", "horizontal", "left", "right" and similar expressions used herein are only for the purpose of illustration.
[0046] In the present application, unless otherwise clearly defined and limited, the terms "installed", "connected", "connected", "fixed" and other terms should be understood in a broad sense. For example, it can be a fixed connection, a detachable connection, or integrated; it can be a mechanical connection or an electrical connection; it can be directly connected or indirectly connected through an intermediate medium, and it can be the internal communication of two elements or the interaction relationship between two elements. For those of ordinary skill in the art, the specific meanings of the above terms in the present application can be understood according to specific circumstances.
[0047] In addition, the terms "first" and "second" are only used for descriptive purposes and cannot be understood as indicating or implying relative importance or implicitly indicating the quantity of the indicated technical features. Thus, the features defined with "first" and "second" may explicitly or implicitly include one or more of such features. In the description of the present application, the meaning of "a plurality" is two or more, unless otherwise clearly specifically defined.
[0048] The terms used in one or more embodiments of the present application are only for the purpose of describing specific embodiments and are not intended to limit one or more embodiments of the present application. The singular forms "a", "the" and "said" used in one or more embodiments of the present application are also intended to include the plural forms, unless the context clearly indicates otherwise.
[0049] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the technical field to which this application belongs. The terms used in the specification of this template herein are only for the purpose of describing specific embodiments and are not intended to limit this application. The term "and / or" used herein includes any and all combinations of one or more of the related listed items.
[0050] It should be understood that although the terms first, second, etc. may be used in one or more embodiments of the present application to describe various information, such information should not be limited to these terms. These terms are only used to distinguish information of the same type from each other. For example, without departing from the scope of one or more embodiments of the present application, the first may also be referred to as the second, and similarly, the second may also be referred to as the first. Depending on the context, the word "if" as used herein may be interpreted as "when" or "while".
[0051] Currently, many industrial defect detection methods rely on traditional image processing techniques or deep learning algorithms. However, many image data are affected by factors such as noise and illumination changes, resulting in unsatisfactory effects of traditional methods, and a large amount of labeled data is required when training a deep learning model.
[0052] The technical solutions of the present application and how the technical solutions of the present application solve the above technical problems will be described in detail below with specific embodiments. These several specific embodiments below can be combined with each other, and the same or similar concepts or processes will not be repeated in some embodiments. The embodiments of the present application will be described below with reference to the drawings.
[0053] Please refer to Figure 1 , a method for detecting air valve defects provided by an embodiment of the present application includes at least the following steps:
[0054] S10. Obtain first image data of a defective air valve, and perform a preprocessing operation on the image data of the air valve defect to obtain second image data of the defective air valve.
[0055] Specifically, a combination of a high-resolution industrial camera and a directional LED light source can be used to obtain several pictures of defective air valves. Among them, the defect types include: air holes, cracks, scratches, etc. In this embodiment, 100 defective pictures are taken as an example, with 40, 30, and 30 pictures of air holes, cracks, and scratches respectively.
[0056] It can be understood that after obtaining the image data of the air valve, it is necessary to preprocess the image data to facilitate the use of the image data. In this embodiment, the preprocessing includes: denoising, grayscale conversion, and contrast enhancement processing of the image data.
[0057] S20. Train a preset image enhancement model and a preset convolutional neural network according to the second image data of the defective air valve to obtain a trained image enhancement model and a trained convolutional neural network.
[0058] Specifically, in an embodiment of the present application, the step S20 includes:
[0059] S201. Input the second image data of the defective air valve into a preset image enhancement model for training to obtain the trained image enhancement model.
[0060] It should be noted that the image enhancement model in this application uses a conditional generative adversarial network (GAN) to effectively expand the original data. Without increasing the actual acquisition cost, it can generate diverse data samples, thereby significantly improving the richness of the data set and the effect of model training.
[0061] Specifically, in a specific embodiment of this application, step S201 includes:
[0062] S2011. Process the second image data of the defective air valve by setting conditional labels to obtain the image data of the defective air valve with conditional labels.
[0063] Specifically, set conditional labels. According to the image data of the defective air valve and the defect categories, set a conditional label for each image (such as crack, air hole, scratch, etc.), and use vectors to represent different types of defects.
[0064] S2012. Construct a generator and a discriminator according to the image data of the defective air valve with conditional labels.
[0065] Specifically, the process of constructing the generator is as follows: Input conditional information (defect type) and random noise (usually a low-dimensional random vector) to generate an image that matches the conditional label, with the required defect type and structure. The calculation formula of the generator is as follows:
[0066]
[0067] Among them, is the noise vector sampled from the random distribution, c is the conditional information, and is the image output by the generator.
[0068] Specifically, the process of constructing the discriminator is as follows: Accept the image generated by the generator and its conditional variables, judge whether the image is real, and evaluate whether it meets the generated conditions. The calculation formula of the discriminator is as follows:
[0069] D(x,c) = P(real|x,c)
[0070] Among them, x is the input image, c is the conditional information, and D(x,c) is the probability of authenticity output by the discriminator, indicating whether the image x is a real image.
[0071] S2013. Construct the loss function of the generator and the loss function of the discriminator.
[0072] Specifically, the loss function of the generator is to maximize the discriminator's judgment D(G(z, c), c) of the generated image G(z, c) to be 1. The objective of the discriminator is to maximize the probability D(x, c) that it classifies the real image x as real, and minimize the probability 1 - D(G(z, c), c) that it classifies the generated image G(z, c) as fake.
[0073] Among them, the loss function of the generator adopts the following calculation formula:
[0074] L G = -Ε z,c [logD(G(z, c), c)]
[0075] The loss function of the discriminator adopts the following calculation formula:
[0076] L D = -Ε x,c [logD(x, c)] - Ε z,c [log(1 - D(G(z, c), c))]
[0077] Among them, x is the real image; c is the conditional input; z is the noise vector sampled from the random distribution; G(z, c) is the image generated by the generator; D(x, c) is the discriminator's judgment of the real image x and the condition c, indicating whether the image x is a real image; D(G(z, c), c) is the discriminator's judgment of the generated image G(z, c) and the condition c, indicating the probability that the generated image is judged to be real; L G is the loss function of the generator; L D is the loss function of the discriminator.
[0078] S2014. Train the generator and the discriminator to obtain the trained image enhancement model.
[0079] It should be noted that in this embodiment, after training the image enhancement model, it also includes evaluating the output image of the image enhancement model. In this embodiment, the Frechet Inception Distance (FID) is used to quantitatively evaluate the output enhanced data image. The lower the FID value, the higher the quality of the generated enhanced data. Remove the images with larger FID values and output the enhanced images with higher credibility. Among them, the calculation formula of FID is as follows:
[0080] FID = ||μ r - μ g || 2 + Tr(Σ r + Σ g - 2(Σ r Σ g ) 1 / 2)
[0081] Among them, μ r , Σ r and μ g , Σ g are the mean and covariance matrices of the real image and the generated image respectively. Tr(Σ r + Σ g - 2(Σ r Σ g ) 1 / 2 ) is the Frobenius norm of the covariance matrix, representing the covariance difference between the generated image and the real image.
[0082] S202. Input the second image data of the defective air valve into the trained image enhancement model to obtain the third image data of the defective air valve.
[0083] S203. Input the third image data of the defective air valve into a preset convolutional neural network for training to obtain the trained convolutional neural network.
[0084] Specifically, the convolutional neural network in this example is a convolutional neural network with Non-local Attention. The network structure mainly consists of an input layer, a convolutional layer, a pooling layer, a Non-local Attention module, and a fully connected layer. And the training set, validation set, and test set are divided into 70%, 15%, and 15% respectively. The specific training process is as follows:
[0085] S2031. Initialize the network weights. Initialize the weights of the convolutional layer, fully connected layer, and Non-local Attention module using the Xavier method.
[0086] S2032. Forward propagation and loss calculation. Input the enhanced image into the network, and after processing through layers such as the convolutional layer, pooling layer, and Non-local Attention module, obtain the output. And calculate the loss value according to the network output and the real label. The calculation formula of the loss function is as follows.
[0087] Loss = λ cls ·Loss cls + λ reg ·Loss reg
[0088] Among them, λ cls and λ reg are the weights of the classification loss and the regression loss respectively, and Loss cls and Loss reg represent the classification loss function and the regression loss function respectively.
[0089] S2033. Backpropagation. Use the chain rule to backpropagate the error to each layer.
[0090] S2034. Update the weight parameters. Use an optimizer to update the weights by gradient descent as follows.
[0091]
[0092] where θ t is the current parameter, η is the learning rate, and is the gradient.
[0093] S2035. Iteration stop. If the validation set loss does not improve in 5 - 10 consecutive iterations, stop training.
[0094] S2036. Model evaluation. Use IoU (Intersection over Union) and mAP (mean Average Precision) to evaluate the prediction accuracy of the defect location. Among them, IoU is used to evaluate the accuracy of a single detection box and is measured by calculating the overlap degree between the predicted box and the ground truth box. mAP is a comprehensive evaluation index that considers the performance under multiple categories and different thresholds and is the core evaluation index in the object detection task. The calculation formulas of IoU and mAP are as follows.
[0095]
[0096] where A is the ground truth bounding box and B is the predicted bounding box.
[0097]
[0098] where, for each category i, the calculation formula of APi is (N is the number of sample points on the PR curve); C is the total number of categories.
[0099] S30. Obtain the first image data of the gas valve to be detected, and preprocess the image data of the gas valve to be detected to obtain the second image data of the gas valve to be detected.
[0100] S40. Input the second image data of the gas valve to be detected into the trained image enhancement model to obtain the third image data of the gas valve to be detected.
[0101] S50. Input the third image data of the gas valve to be detected into the trained convolutional neural network for defect detection to obtain the result of defect detection.
[0102] It should be noted that the first image data of the gas valve to be detected in this embodiment may include the image data of at least one gas valve to be detected.
[0103] Specifically, the image data of the gas valve to be detected is input into the trained image enhancement model and convolutional neural network, and the most accurate defect box is selected from the detection results. The redundant detection boxes are removed by using the non-maximum suppression (NMS) algorithm, and the effective defect boxes are selected according to the set confidence threshold. Finally, the class with the highest probability in each box is selected as the prediction result.
[0104] In an embodiment of the present application, the method for detecting gas valve defects further includes: S60. Generating a defect detection report according to the result of the defect detection.
[0105] Specifically, according to the detected number and type of defects, the system will count all gas valves and generate a detailed defect statistics report, including information such as the number, location, type, and size of the defects. If the defects exceed the set quality standard, the system can automatically mark the unqualified products and prompt the operator for subsequent processing. The system finally generates a detection report, recording the defect conditions of each gas valve, including information such as the type, number, and location of the defects, and providing a basis for quality control.
[0106] It should be noted that when detecting a gas valve in service, the defects of the gas valve in the service state are detected. During the service process, new defect types may be added to the gas valve on the basis of the original defects, such as corrosion and wear. In the face of the increase in the types of defects, the present application can also merge the data of the gas valves that have not been in service before and the data of the gas valves in the current service, and then through the gas valve defect detection solution of the present application, and then by training a high-precision deep learning model, successfully detect the newly added corrosion and wear defects, and the detection result has a high accuracy.
[0107] The method for detecting gas valve defects provided by the present application has the following beneficial effects: First, the present application uses a conditional generative adversarial network (cGAN) to enhance the image quality, improve the diversity of the data set, and overcome the common problems of data deficiency and image noise in traditional defect detection methods; then, the present application combines the powerful feature extraction and classification capabilities of the convolutional neural network (CNN) to accurately locate and classify various defects on the surface of the gas valve. This method in the present application not only significantly improves the accuracy and detection efficiency of defect detection, reduces false alarms and missed detections, but also can automatically generate a detailed defect report, providing detailed data support for quality control, and has broad application prospects and high commercial value.
[0108] Please refer to Figure 2 , the present application also provides a gas valve defect detection system 200, including:
[0109] The first data acquisition module 201 is configured to acquire first image data of a defective air valve, and perform a preprocessing operation on the image data of the air valve defect to obtain second image data of the defective air valve;
[0110] The training module 202 is configured to train a preset image enhancement model and a preset convolutional neural network according to the second image data of the defective air valve to obtain a trained image enhancement model and a trained convolutional neural network;
[0111] The second data acquisition module 203 is configured to acquire first image data of the air valve to be detected, and preprocess the image data of the air valve to be detected to obtain second image data of the air valve to be detected;
[0112] The image enhancement module 204 is configured to input the first image data of the air valve to be detected into the trained image enhancement model to obtain third image data of the air valve to be detected;
[0113] The defect detection module 205 is configured to input the third image data of the air valve to be detected into the trained convolutional neural network for defect detection to obtain a defect detection result.
[0114] Please refer to Figure 3 , an embodiment of the present application further provides a computer electronic device 300, including a memory 303 and a processor 302. The memory 303 stores a computer program, and when the processor executes the computer program, the steps of the method for detecting the air valve defect described in any one of the above are implemented.
[0115] Specifically, the electronic device 300 includes: a transceiver 301, a bus interface, and a processor 302. The processor 302 is configured to acquire first image data of a defective air valve, and perform a preprocessing operation on the image data of the air valve defect to obtain second image data of the defective air valve; train a preset image enhancement model and a preset convolutional neural network according to the second image data of the defective air valve to obtain a trained image enhancement model and a trained convolutional neural network; acquire first image data of the air valve to be detected, and preprocess the image data of the air valve to be detected to obtain second image data of the air valve to be detected; input the second image data of the air valve to be detected into the trained image enhancement model to obtain third image data of the air valve to be detected; input the third image data of the air valve to be detected into the trained convolutional neural network for defect detection to obtain a defect detection result.
[0116] In an embodiment of the present application, the electronic device 300 further includes: a memory 303. In Figure 3Among them, the bus architecture may include any number of interconnected buses and bridges, specifically, various circuits represented by one or more processors represented by processor 302 and a memory represented by memory 303 are linked together. The bus architecture may also link together various other circuits such as peripheral devices, voltage regulators, and power management circuits, which are well known in the art, and thus will not be further described herein. The bus interface provides an interface. The transceiver 301 may be a plurality of components, that is, including a transmitter and a receiver, and provides a unit for communicating with various other devices on a transmission medium. The processor 302 is responsible for managing the bus architecture and general processing, and the memory 303 may store data used by the processor 302 when performing operations.
[0117] An embodiment of the present application also provides a computer-readable storage medium, where the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the method for detecting a gas valve defect described in any one of the above are implemented.
[0118] In this embodiment, the computer-readable storage medium may be a non-volatile storage medium or a volatile storage medium. For example, the computer storage medium may include, but is not limited to: various media such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disc that can store program codes.
[0119] In all the examples shown and described here, any specific value should be construed as merely exemplary and not as a limitation. Therefore, other examples of the exemplary embodiments may have different values.
[0120] It should be noted that: similar reference numerals and letters denote similar items in the following drawings. Therefore, once an item is defined in one drawing, it does not need to be further defined and explained in subsequent drawings.
[0121] In several embodiments provided in this application, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are merely illustrative. For example, the flowcharts and structural diagrams in the drawings show the possible architectures, functions, and operations of devices, methods, and computer program products according to multiple embodiments of this application. In this regard, each block in the flowchart or block diagram can represent a module, a program segment, or a part of code, and the module, program segment, or part of code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in an alternative implementation, the functions marked in the blocks can occur in a different order than that marked in the drawings. For example, two consecutive blocks can actually be executed substantially in parallel, and they can sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in the structural diagram and / or flowchart, as well as the combination of blocks in the structural diagram and / or flowchart, can be implemented by a dedicated hardware-based system that executes the specified functions or actions, or can be implemented by a combination of dedicated hardware and computer instructions.
[0122] In addition, each functional module or unit in various embodiments of this application can be integrated together to form an independent part, or each module can exist alone, or two or more modules can be integrated to form an independent part.
[0123] If the above functions are implemented in the form of software function modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a terminal device (which can be a smart phone, a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in various embodiments of this application.
[0124] The above is only the specific implementation manner of this application, but the protection scope of this application is not limited thereto. Any person skilled in the art within the technical scope disclosed in this application can easily think of changes or substitutions, which should all be covered by the protection scope of this application.
Claims
1. A method for detecting air valve defects, characterized in that, Including: Obtain the first image data of the defective air valve, and perform a preprocessing operation on the image data of the air valve defect to obtain the second image data of the defective air valve; According to the second image data of the defective air valve, train a preset image enhancement model and a preset convolutional neural network to obtain the trained image enhancement model and the trained convolutional neural network; Obtain the first image data of the air valve to be detected, and preprocess the image data of the air valve to be detected to obtain the second image data of the air valve to be detected; Input the second image data of the air valve to be detected into the trained image enhancement model to obtain the third image data of the air valve to be detected; Input the third image data of the air valve to be detected into the trained convolutional neural network for defect detection to obtain the result of defect detection.
2. The detection method for the air valve defect according to claim 1, characterized in that The step of training a preset image enhancement model and a preset convolutional neural network according to the second image data of the defective air valve to obtain the trained image enhancement model and the trained convolutional neural network includes: Input the second image data of the defective air valve into the preset image enhancement model for training to obtain the trained image enhancement model; Input the second image data of the defective air valve into the trained image enhancement model to obtain the third image data of the defective air valve; Input the third image data of the defective air valve into the preset convolutional neural network for training to obtain the trained convolutional neural network.
3. The detection method of the air valve defect according to claim 1, characterized in that, The method further includes: Generate a defect detection report according to the result of the defect detection.
4. The detection method of the gas valve defect according to claim 2, characterized in that, The step of inputting the second image data of the defective air valve into the preset image enhancement model for training to obtain the trained image enhancement model includes: Set conditional label processing on the second image data of the defective air valve to obtain the image data of the defective air valve with conditional labels; Construct a generator and a discriminator according to the image data of the defective air valve with conditional labels; Construct the loss function of the generator and the loss function of the discriminator; Perform training processing on the generator and the discriminator to obtain the trained image enhancement model.
5. The detection method of the air valve defect according to claim 4, characterized in that, The generator uses the following calculation formula: where \(z\in\mathbb{R}\) m is a noise vector sampled from a random distribution, \(c\) is conditional information, is the image output by the generator; The discriminator uses the following calculation formula: D(x,c) = P(real|x,c) Where x is the input image, c is the conditional information, and D(x,c) is the authenticity probability output by the discriminator, indicating whether the image x is a real image.
6. The detection method for air valve defects according to claim 5, wherein, The loss function of the generator uses the following calculation formula: L G = -Ε z,c [logD(G(z,c),c)] The loss function of the discriminator uses the following calculation formula: L D = -Ε x,c [logD(x,c)] - Ε z,c [log(1 - D(G(z,c),c))] where x is the real image; c is the conditional input; z is the noise vector sampled from a random distribution; G(z, c) is the image generated by the generator; D(x, c) is the discriminator's judgment on the real image x and the condition c, indicating whether the image x is a real image; D(G(z, c), c) is the discriminator's judgment on the generated image G(z, c) and the condition c, representing the probability that the generated image is judged to be real; L G is the loss function of the generator; L D is the loss function of the discriminator.
7. The detection method for the air valve defect according to claim 1, characterized in that, The loss function of the convolutional neural network model is specifically calculated as follows: Loss = λ cls ·Loss cls + λ reg ·Loss reg Among them, λ cls and λ reg are the weights of the classification loss and the regression loss respectively, Loss cls and Loss reg represent the classification loss function and the regression loss function respectively.
8. A detection system for valve defects, characterized in that, Including: A first data acquisition module for obtaining the first image data of the defective air valve and performing a preprocessing operation on the image data of the air valve defect to obtain the second image data of the defective air valve; A training module for training a preset image enhancement model and a preset convolutional neural network according to the second image data of the defective air valve to obtain the trained image enhancement model and the trained convolutional neural network; The second data acquisition module is used to acquire the first image data of the gas valve to be detected, and preprocess the image data of the gas valve to be detected to obtain the second image data of the gas valve to be detected; The image enhancement module is used to input the second image data of the gas valve to be detected into the trained image enhancement model to obtain the third image data of the gas valve to be detected; The defect detection module is used to input the third image data of the gas valve to be detected into the trained convolutional neural network for defect detection to obtain the result of defect detection.
9. A computer electronic device, characterized in that, It includes a memory and a processor. The memory stores a computer program, and when the processor executes the computer program, the steps of the gas valve defect detection method described in any one of claims 1-7 are implemented.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, and when the computer program is executed by the processor, the steps of the gas valve defect detection method described in any one of claims 1-7 are implemented.
Citation Information
Patent Citations
CGAN-based inspection image data small sample expansion method
CN112446429A
Method for detecting surface defects of large components by indoor unmanned aerial vehicle
CN112505065A
Unmanned aerial vehicle electric power inspection defect automatic identification method
CN117392565A
Pavement defect detection method and system based on infrared thermal imaging
CN118967573A