Refrigeration valve outer surface defect detection method and system based on machine vision

Through machine vision technology and data enhancement strategies, an effective training data set is established, which solves the problem of low accuracy in detection of defects on the outer surface of the refrigeration valve and achieves higher detection accuracy.

CN119151867APending Publication Date: 2024-12-17JIANGXI AUDY BRASSWORK
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411122090.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-15
Publication Date
2024-12-17

AI Technical Summary

Technical Problem

In the prior art, the accuracy of the defect detection of the external surface of the refrigeration valve is not high, mainly because the base of defect samples is too small, resulting in low model training accuracy.

Method used

Using machine vision-based detection method, the training data set is established by collecting preset numbers of defects and normal images, and the data set is expanded through data augmentation strategy, divided into labeled and unlabeled data sets, and the initial learning is obtained by using unlabeled data. The model is then adjusted using the labeled data to improve the detection accuracy.

Benefits of technology

Through data augmentation and self-supervised pre-training, the problem of traditional methods relying on large amounts of labeled data is overcome, and the accuracy of detection of external surface defects of the refrigeration valve is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119151867A_ABST
    Figure CN119151867A_ABST
Patent Text Reader

Abstract

The invention discloses a refrigeration valve outer surface defect detection method and system based on machine vision, and the method comprises the steps: collecting a preset number of defect images of refrigeration valves with defects on the outer surfaces and normal images of refrigeration valves without defects on the outer surfaces, establishing a training data set according to the refrigeration valve defect image and the refrigeration valve normal image; expanding the training data set according to a preset data enhancement strategy, and dividing the training data set into a labeled training data set and an unlabeled training data set; and inputting the unlabeled training data set into a preset neural network for deep learning to obtain an initial defect detection model, and then inputting the labeled training data set into the trained initial defect detection model to adjust hyper-parameters of the model to obtain a defect detection model. The problem that in the prior art, detection of the outer surface defects of the refrigeration valve is not accurate enough is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of defect detection, and in particular to a method and system for detecting defects on the outer surface of a refrigeration valve based on machine vision. Background Art

[0002] Refrigeration valves are key components in refrigeration systems and are widely used in air conditioning, cold storage, industrial refrigeration and other fields. They are responsible for controlling the flow of refrigerant and regulating the pressure and temperature of the system to ensure efficient and safe operation of the system. The quality of refrigeration valves directly affects the performance and reliability of the refrigeration system, so the quality control of refrigeration valves is particularly important.

[0003] Refrigeration valves are prone to external surface defects during manufacturing or use, such as cracks, scratches, rust, etc. These defects may affect the sealing performance of the valve, reduce the structural strength of the valve, increase the risk of corrosion, and cause a series of problems.

[0004] Traditional methods for detecting defects on the outer surface of refrigeration valves mainly include manual visual inspection and model detection based on model training. Due to the low efficiency of manual inspection, most of them use trained models for detection. However, due to the rarity of defects or abnormal phenomena on the outer surface of refrigeration valves, it is difficult to collect enough defect samples, which makes the base number of defect samples too small and makes it difficult for model training to capture enough features, which easily leads to low accuracy of the trained model, and then leads to the problem of inaccurate recognition of defects on the outer surface of refrigeration valves. Summary of the invention

[0005] In view of this, the purpose of the present invention is to provide a method and system for detecting defects on the outer surface of refrigeration valves based on machine vision, aiming to solve the problem of inaccurate identification of defects on the outer surface of refrigeration valves in the prior art.

[0006] The embodiment of the present invention is implemented as follows: On the one hand, a method for detecting defects on the outer surface of a refrigeration valve based on machine vision is proposed, and the method comprises: Collecting a preset number of defective images of refrigeration valves with defects on the outer surface and normal images of refrigeration valves without defects on the outer surface, and establishing a training data set based on the defective images of refrigeration valves and the normal images of refrigeration valves; Expanding the training data set according to a preset data enhancement strategy, and dividing the training data set into a labeled training data set and an unlabeled training data set; Inputting the unlabeled training data set into a preset neural network for deep learning to obtain an initial defect detection model, and then inputting the labeled training data set into the trained initial defect detection model to adjust the model's hyperparameters to obtain the defect detection model; An outer surface image of a refrigeration valve to be inspected is obtained, and the outer surface image of the refrigeration valve is input into the defect detection model to detect whether there are defects on the outer surface of the refrigeration valve.

[0007] Furthermore, in the above-mentioned method for detecting defects on the outer surface of refrigeration valves based on machine vision, the step of expanding the training data set according to a preset data enhancement strategy includes: Add salt and pepper noise and Gaussian noise to the images in the training data set with random probability Blurring; or randomly flipping the image in the training data set horizontally or randomly flipping the image at an angle; or contrast enhancing the image in the training data set to obtain another image data.

[0008] Furthermore, in the above-mentioned method for detecting defects on the outer surface of refrigeration valves based on machine vision, the step of expanding the training data set according to a preset data enhancement strategy further includes: A defective region of the refrigeration valve in the refrigeration valve defect image is obtained, and the defect of the refrigeration valve is transformed by adjusting the defective region to obtain a target refrigeration valve defect image, so as to expand the training data set.

[0009] Furthermore, in the above-mentioned method for detecting defects on the outer surface of a refrigeration valve based on machine vision, the step of transforming the defect of the refrigeration valve by adjusting the defect area to obtain a target refrigeration valve defect image comprises: The defect area is randomly flipped horizontally and randomly flipped at an angle on the refrigeration valve defect image to obtain a target refrigeration valve defect image.

[0010] Furthermore, in the above-mentioned method for detecting defects on the outer surface of a refrigeration valve based on machine vision, the step of transforming the defect of the refrigeration valve by adjusting the defect area to obtain a target refrigeration valve defect image further includes: Determining whether the defective area is single; If yes, then obtaining the defect trend in the defect area, and extending the defect according to the defect trend to obtain the target refrigeration valve defect image; If not, the defects in the defect area are fused according to the defect type to obtain the target refrigeration valve defect image.

[0011] Furthermore, in the above-mentioned method for detecting defects on the outer surface of refrigeration valves based on machine vision, the step of inputting the unlabeled training data set into a preset neural network for deep learning to obtain an initial defect detection model comprises: The loss between the model prediction value and the actual value during the training process is obtained, and back propagation is performed according to the loss to obtain the initial defect detection model.

[0012] Furthermore, in the above-mentioned method for detecting defects on the outer surface of refrigeration valves based on machine vision, before the step of inputting the labeled training data set into the trained initial defect detection model to adjust the hyperparameters of the model to obtain the defect detection model, the step further includes: Obtaining the number of samples of the labeled training data set, and dividing the labeled training data set into equal parts equal to the number of samples according to the number of samples; Set up a loop, loop the same number of samples for the same number of times, each time select a different equal portion as the validation set, and the rest as the training set; In each cycle, the currently selected training set is used to train the initial defect detection model, and the current validation set is used to evaluate the performance of the initial defect detection model.

[0013] Another object of the present invention is to provide a refrigeration valve outer surface defect detection system based on machine vision, the system comprising: An acquisition module, used for collecting a preset number of defective images of refrigeration valves with defects on the outer surface and normal images of refrigeration valves without defects on the outer surface, and establishing a training data set based on the defective images of refrigeration valves and the normal images of refrigeration valves; An enhancement module, used to expand the training data set according to a preset data enhancement strategy, and divide the training data set into a labeled training data set and an unlabeled training data set; A training module, used for inputting the unlabeled training data set into a preset neural network for deep learning to obtain an initial defect detection model, and then inputting the labeled training data set into the trained initial defect detection model to adjust the model's hyperparameters to obtain the defect detection model; The detection module is used to obtain an outer surface image of the refrigeration valve to be detected, and input the outer surface image of the refrigeration valve into the defect detection model to detect whether there are defects on the outer surface of the refrigeration valve.

[0014] In yet another aspect, the present invention provides a readable storage medium having a computer program stored thereon, wherein the program implements the steps of the above method when executed by a processor.

[0015] In yet another aspect, the present invention provides a computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above method when executing the program.

[0016] The embodiment of the present invention collects a preset number of defective images of refrigeration valves with defects on the outer surface and normal images of refrigeration valves without defects on the outer surface, and establishes a training data set based on the defective images of refrigeration valves and the normal images of refrigeration valves; expands the training data set according to a preset data enhancement strategy, and divides the training data set into a labeled training data set and an unlabeled training data set; inputs the unlabeled training data set into a preset neural network for deep learning to obtain an initial defect detection model, and then inputs the labeled training data set into the trained initial defect detection model to adjust the hyperparameters of the model to obtain a defect detection model; obtains an image of the outer surface of the refrigeration valve to be detected, and inputs the image of the outer surface of the refrigeration valve into the defect detection model to detect whether there is a defect on the outer surface of the refrigeration valve. The training data set is expanded by a data enhancement strategy to increase the number of samples. When training, unlabeled data is used for self-supervised pre-training to obtain general feature information, and then the labeled data is used to fine-tune the model, thereby overcoming the defect that traditional supervised learning training relies on a large amount of labeled data but the base number of defective samples is too small, and solving the problem of inaccurate recognition of defects on the outer surface of refrigeration valves in the prior art. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] Figure 1 It is a flow chart of the method for detecting defects on the outer surface of a refrigeration valve based on machine vision proposed in the first embodiment of the present invention; Figure 2 It is a schematic diagram of the structure of a refrigeration valve outer surface defect detection system based on machine vision in the third embodiment of the present invention.

[0018] The following specific implementation manner will further illustrate the present invention in conjunction with the above-mentioned drawings. DETAILED DESCRIPTION

[0019] In order to facilitate the understanding of the present invention, the present invention will be described more fully below with reference to the relevant drawings. Several embodiments of the present invention are given in the drawings. However, the present invention can be implemented in many different forms and is not limited to the embodiments described herein. On the contrary, the purpose of providing these embodiments is to make the disclosure of the present invention more thorough and comprehensive.

[0020] It should be noted that when an element is referred to as being "fixed to" another element, it may be directly on the other element or there may be a central element. When an element is considered to be "connected to" another element, it may be directly connected to the other element or there may be a central element at the same time. The terms "vertical", "horizontal", "left", "right" and similar expressions used herein are for illustrative purposes only.

[0021] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which the present invention belongs. The terms used herein in the specification of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention. The term "and / or" used herein includes any and all combinations of one or more of the related listed items.

[0022] How to improve the accuracy of detecting defects on the outer surface of a refrigeration valve will be described in detail below in conjunction with specific embodiments and drawings.

[0023] Embodiment 1 See also Figure 1 , shown is a method for detecting defects on the outer surface of a refrigeration valve based on machine vision proposed in the first embodiment of the present invention, the method comprising steps S10 to S13.

[0024] Step S10, collecting a preset number of defective images of refrigeration valves with defects on the outer surface and normal images of refrigeration valves without defects on the outer surface, and establishing a training data set based on the defective images of refrigeration valves and the normal images of refrigeration valves.

[0025] Among them, it is recommended to collect normal samples and abnormal samples to train a data set for subsequent model training. Specifically, defective images of refrigeration valves with defects on the outer surface and normal images of refrigeration valves without defects on the outer surface are collected. In specific implementation, the number of defective images of refrigeration valves with defects on the outer surface and normal images of refrigeration valves without defects on the outer surface can be set according to actual conditions and is not limited here. Specifically, the outer surface of the valve refers to the sealing surface of the valve, which is a regular surface.

[0026] Step S11, expanding the training data set according to a preset data enhancement strategy, and dividing the training data set into a labeled training data set and an unlabeled training data set.

[0027] Among them, due to the rarity of defects or abnormal phenomena in practice, it is difficult to collect enough defect samples. In order to improve the balance of data and the accuracy of model training, a data enhancement strategy is used to expand the training data set to obtain more defect samples. Specifically, only the refrigeration valve defect images in the training data set can be expanded.

[0028] Specifically, as one implementation of the data enhancement strategy of the present invention, the data set can be expanded in the following manner: Add salt and pepper noise and Gaussian blur to the images in the training data set with random probability; or randomly flip the images in the training data set horizontally or at random angles; or perform contrast enhancement on the images in the training data set to obtain another image data. For example, randomly add salt and pepper noise and Gaussian blur with a probability of 0.8, and adjust the contrast of the image by contrast enhancement to change the brightness difference of the image. Expand the data set and increase the amount of training samples.

[0029] Furthermore, after the training data set is expanded, the training data set is divided into unlabeled data and labeled data, wherein the unlabeled data is used for pre-training and the labeled data is used for fine-tuning the parameters of the model.

[0030] Step S12, inputting the unlabeled training data set into a preset neural network for deep learning to obtain an initial defect detection model, and then inputting the labeled training data set into the trained initial defect detection model to adjust the model's hyperparameters to obtain the defect detection model.

[0031] Among them, a large amount of unlabeled data is used to learn a general representation, and sufficient information is captured from limited labeled data for accurate classification. The embodiment of the present invention uses a large amount of unlabeled data for pre-training, so that the network can fully explore the potential information of samples on the outer surface of the refrigeration valve. Fine-tuning the initial defect detection model after pre-training can enable the network to better learn and capture the characteristics of defects on the outer surface of the refrigeration valve, thereby improving the accuracy of classification. When there are fewer samples of defects on the outer surface of the refrigeration valve, accurate surface defect detection can still be achieved. Specifically, the neural network can adopt a convolutional neural network, a deep neural network, etc., wherein the selection of the neural network is understandable to those skilled in the art and will not be elaborated here.

[0032] In addition, in some optional embodiments of the present invention, when performing model training, the loss between the model prediction value and the actual value during the training process is obtained, and back propagation is performed based on the loss to obtain the initial defect detection model. Specifically, back propagation is used to improve the accuracy of model training, wherein the loss value can be calculated using mean square error loss, etc.

[0033] In addition, in some optional embodiments of the present invention, when using labeled data for training, it is necessary to divide the training data set, select a training set and a validation set from the training data set, specifically, obtain the number of samples in the labeled training data set, divide the training data set into equal parts with the number of samples, select a different part as the validation set each time, and the rest as the test set. For example, assuming that there are m samples in the training data set D, we use these m samples as validation sets and perform m trainings. In each iteration, select a sample in the data set D as the validation set, and the remaining m-1 samples as the training set. Use the current validation set to evaluate the performance of the model. At this time, you can summarize the performance results of all the evaluation models and calculate the average performance index to evaluate the overall performance of the model.

[0034] Step S13, obtaining an outer surface image of the refrigeration valve to be inspected, and inputting the outer surface image of the refrigeration valve into the defect detection model to detect whether there are defects on the outer surface of the refrigeration valve.

[0035] Among them, the trained defect detection model has mastered the logic of defect detection on the outer surface of refrigeration valves. Therefore, by inputting the outer surface image of the refrigeration valve to be detected into the defect detection model, the defects on the outer surface of the refrigeration valve can be detected. Since the accuracy of the defect detection model is improved, the accuracy of defect detection on the outer surface of the refrigeration valve is improved.

[0036] In summary, the method for detecting defects on the outer surface of a refrigeration valve based on machine vision in the above-mentioned embodiment of the present invention collects a preset number of defective images of refrigeration valves with defects on the outer surface and normal images of refrigeration valves without defects on the outer surface, and establishes a training data set based on the defective images of refrigeration valves and the normal images of refrigeration valves; expands the training data set according to the preset data enhancement strategy, and divides the training data set into a labeled training data set and an unlabeled training data set; inputs the unlabeled training data set into a preset neural network for deep learning to obtain an initial defect detection model, and then inputs the labeled training data set into the trained initial defect detection model to adjust the hyperparameters of the model to obtain a defect detection model; obtains the outer surface image of the refrigeration valve to be detected, and inputs the outer surface image of the refrigeration valve into the defect detection model to detect whether there are defects on the outer surface of the refrigeration valve. The training data set is expanded by the data enhancement strategy, the number of samples is increased, and when training, unlabeled data is used for self-supervised pre-training to obtain general feature information, and then the labeled data is used to fine-tune the model, thereby overcoming the defect that traditional supervised learning training relies on a large amount of labeled data and the number of defective samples is too small, and solving the problem of inaccurate recognition of defects on the outer surface of refrigeration valves in the prior art.

[0037] Embodiment 2 This embodiment also proposes a refrigeration valve outer surface defect detection method based on machine vision. The difference between the refrigeration valve outer surface defect detection method based on machine vision proposed in this embodiment and the refrigeration valve outer surface defect detection method based on machine vision proposed in the first embodiment is that: The step of expanding the training data set according to a preset data enhancement strategy also includes: A defective region of the refrigeration valve in the refrigeration valve defect image is obtained, and the defect of the refrigeration valve is transformed by adjusting the defective region to obtain a target refrigeration valve defect image, so as to expand the training data set.

[0038] Among them, the defect sample data can be expanded more accurately, and the defect area of ​​the refrigeration valve can be determined after the defect image of the refrigeration valve is obtained. The defect area is adjusted and transformed on the image to obtain a new image as the expanded refrigeration valve defect image.

[0039] Specifically, the defect image of the target refrigeration valve may be obtained by randomly flipping the defect area horizontally and randomly flipping the defect area at an angle on the refrigeration valve defect image.

[0040] In addition, in some optional embodiments of the present invention, in order to further improve the training effect, it is determined whether the defect area is single; If yes, then obtaining the defect trend in the defect area, and extending the defect according to the defect trend to obtain the target refrigeration valve defect image; If not, the defects in the defect area are fused according to the defect type to obtain the target refrigeration valve defect image.

[0041] Among them, the defect area on an image is analyzed. In practice, there may be one or more defects on the acquired image. For example, there are multiple defects on an image. When there are multiple defects, the multiple defects can be fused to obtain a new defect area, thereby obtaining a new image containing defects. The defect area can be a rectangular area that can cover the defect. In specific implementation, the outer boundary points of the defect can be obtained, and the rectangular area containing the defect can be obtained by selecting the outer boundary points. When performing defect fusion, the defect area with the largest area is determined, and then the remaining defect area is filled into the blank area of ​​the defect area. If necessary, the remaining defect area can be scaled to ensure that it can be filled into the blank area of ​​the defect area with the largest area.

[0042] When the defect area is single, the defect trend of the defect can be obtained, and the defect can be extended according to the area to obtain a new defect. Specifically, when the defect is a linear defect, such as a crack or a scratch, the trend of the defect is obtained, and the defect is extended on the image according to the trend. When the defect is a surface defect such as a rust spot, the defect can be proportionally enlarged on the image to obtain the target refrigeration valve defect image.

[0043] In summary, the method for detecting defects on the outer surface of a refrigeration valve based on machine vision proposed in the above embodiment of the present invention collects a preset number of defective images of refrigeration valves with defects on the outer surface and normal images of refrigeration valves without defects on the outer surface, and establishes a training data set based on the defective images of refrigeration valves and the normal images of refrigeration valves; expands the training data set according to the preset data enhancement strategy, and divides the training data set into a labeled training data set and an unlabeled training data set; inputs the unlabeled training data set into a preset neural network for deep learning to obtain an initial defect detection model, and then inputs the labeled training data set into the trained initial defect detection model to adjust the hyperparameters of the model to obtain a defect detection model; obtains the outer surface image of the refrigeration valve to be detected, and inputs the outer surface image of the refrigeration valve into the defect detection model to detect whether there are defects on the outer surface of the refrigeration valve. The training data set is expanded by the data enhancement strategy to increase the number of samples. When training, unlabeled data is used for self-supervised pre-training to obtain general feature information, and then the labeled data is used to fine-tune the model, thereby overcoming the defect that traditional supervised learning training relies on a large amount of labeled data but the number of defective samples is too small, and solving the problem of inaccurate recognition of defects on the outer surface of refrigeration valves in the prior art.

[0044] Embodiment 3 See also Figure 2 , shown is a refrigeration valve outer surface defect detection system based on machine vision proposed in the third embodiment of the present invention, the system comprises: The acquisition module 100 is used to collect a preset number of defective images of refrigeration valves with defects on the outer surface and normal images of refrigeration valves without defects on the outer surface, and establish a training data set based on the defective images of refrigeration valves and the normal images of refrigeration valves; An enhancement module 200, configured to expand the training data set according to a preset data enhancement strategy, and divide the training data set into a labeled training data set and an unlabeled training data set; The training module 300 is used to input the unlabeled training data set into a preset neural network for deep learning to obtain an initial defect detection model, and then input the labeled training data set into the trained initial defect detection model to adjust the hyperparameters of the model to obtain the defect detection model; The detection module 400 is used to obtain an image of the outer surface of the refrigeration valve to be detected, and input the image of the outer surface of the refrigeration valve into the defect detection model to detect whether there are defects on the outer surface of the refrigeration valve.

[0045] Furthermore, in some optional embodiments of the present invention, the step of expanding the training data set according to a preset data enhancement strategy includes: Add salt and pepper noise and Gaussian noise to the images in the training data set with random probability Blurring; or randomly flipping the image in the training data set horizontally or randomly flipping the image at an angle; or contrast enhancing the image in the training data set to obtain another image data.

[0046] Furthermore, in some optional embodiments of the present invention, the step of expanding the training data set according to a preset data enhancement strategy further includes: A defective region of the refrigeration valve in the refrigeration valve defect image is obtained, and the defect of the refrigeration valve is transformed by adjusting the defective region to obtain a target refrigeration valve defect image, so as to expand the training data set.

[0047] Further, in some optional embodiments of the present invention, the step of transforming the defect of the refrigeration valve by adjusting the defect area to obtain a target refrigeration valve defect image includes: The defect area is randomly flipped horizontally and randomly flipped at an angle on the refrigeration valve defect image to obtain a target refrigeration valve defect image.

[0048] Further, in some optional embodiments of the present invention, the step of transforming the defect of the refrigeration valve by adjusting the defect area to obtain a target refrigeration valve defect image further includes: Determining whether the defective area is single; If yes, then obtaining the defect trend in the defect area, and extending the defect according to the defect trend to obtain the target refrigeration valve defect image; If not, the defects in the defect area are fused according to the defect type to obtain the target refrigeration valve defect image.

[0049] Furthermore, in some optional embodiments of the present invention, the step of inputting the unlabeled training data set into a preset neural network for deep learning to obtain an initial defect detection model includes: The loss between the model prediction value and the actual value during the training process is obtained, and back propagation is performed according to the loss to obtain the initial defect detection model.

[0050] Furthermore, in some optional embodiments of the present invention, before the step of inputting the labeled training data set into the trained initial defect detection model to adjust the hyperparameters of the model to obtain the defect detection model, the step further includes: Obtaining the number of samples of the labeled training data set, and dividing the labeled training data set into equal parts equal to the number of samples according to the number of samples; Set up a loop, loop the same number of samples for the same number of times, each time select a different equal portion as the validation set, and the rest as the training set; In each cycle, the currently selected training set is used to train the initial defect detection model, and the current validation set is used to evaluate the performance of the initial defect detection model.

[0051] The functions or operation steps implemented when the above modules are executed are substantially the same as those in the above method embodiments, and will not be repeated here.

[0052] Embodiment 4 Another aspect of the present invention further provides a readable storage medium having a computer program stored thereon, and when the program is executed by a processor, the steps of the method described in any one of the above embodiments 1 to 2 are implemented.

[0053] Embodiment 5 Another aspect of the present invention provides a computer device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the method described in any one of the above-mentioned embodiments 1 to 2 when executing the program.

[0054] The technical features of the above embodiments can be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0055] Those skilled in the art will appreciate that the logic and / or steps represented in the flowchart or otherwise described herein, for example, may be considered as an ordered list of executable instructions for implementing logical functions, and may be specifically implemented in any computer-readable storage medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processor, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute instructions), or in conjunction with such instruction execution systems, devices or apparatuses. For purposes of this specification, a "computer-readable storage medium" may be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or apparatus, or in conjunction with such instruction execution systems, devices or apparatuses.

[0056] More specific examples (a non-exhaustive list) of computer-readable storage media include the following: an electrical connection with one or more wires (electronic device), a portable computer disk case (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable storage medium may even be a paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, deciphering or, if necessary, processing in another suitable manner, and then stored in a computer memory.

[0057] It should be understood that the various parts of the present invention can be implemented by hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or a combination thereof: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.

[0058] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "examples", "specific examples", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.

[0059] The above-mentioned embodiments only express several implementation methods of the present invention, and the description thereof is relatively specific and detailed, but it cannot be understood as limiting the scope of the patent of the present invention. It should be pointed out that, for ordinary technicians in this field, several variations and improvements can be made without departing from the concept of the present invention, which all belong to the protection scope of the present invention. Therefore, the protection scope of the patent of the present invention shall be subject to the attached claims.

Claims

1. A method for detecting defects on the outer surface of a refrigeration valve based on machine vision, characterized in that: The method comprises: Collecting a preset number of defective images of refrigeration valves with defects on the outer surface and normal images of refrigeration valves without defects on the outer surface, and establishing a training data set based on the defective images of refrigeration valves and the normal images of refrigeration valves; Expanding the training data set according to a preset data enhancement strategy, and dividing the training data set into a labeled training data set and an unlabeled training data set; Inputting the unlabeled training data set into a preset neural network for deep learning to obtain an initial defect detection model, and then inputting the labeled training data set into the trained initial defect detection model to adjust the model's hyperparameters to obtain the defect detection model; An outer surface image of a refrigeration valve to be inspected is obtained, and the outer surface image of the refrigeration valve is input into the defect detection model to detect whether there are defects on the outer surface of the refrigeration valve.

2. The method for detecting defects on the outer surface of refrigeration valves based on machine vision according to claim 1, characterized in that: The step of expanding the training data set according to a preset data enhancement strategy includes: Add salt and pepper noise and Gaussian noise to the images in the training data set with random probability Blurring; or randomly flipping the image in the training data set horizontally or randomly flipping the image at an angle; or contrast enhancing the image in the training data set to obtain another image data.

3. The method for detecting defects on the outer surface of a refrigeration valve based on machine vision according to claim 1, characterized in that: The step of expanding the training data set according to a preset data enhancement strategy also includes: A defective region of the refrigeration valve in the refrigeration valve defect image is obtained, and the defect of the refrigeration valve is transformed by adjusting the defective region to obtain a target refrigeration valve defect image, so as to expand the training data set.

4. The method for detecting defects on the outer surface of a refrigeration valve based on machine vision according to claim 3 is characterized in that: The step of transforming the defect of the refrigeration valve by adjusting the defect area to obtain a target refrigeration valve defect image comprises: The defect area is randomly flipped horizontally and randomly flipped at an angle on the refrigeration valve defect image to obtain a target refrigeration valve defect image.

5. The method for detecting defects on the outer surface of a refrigeration valve based on machine vision according to claim 3, characterized in that: The step of transforming the defect of the refrigeration valve by adjusting the defect area to obtain a target refrigeration valve defect image also includes: Determining whether the defective area is single; If yes, then obtaining the defect trend in the defect area, and extending the defect according to the defect trend to obtain the target refrigeration valve defect image; If not, the defects in the defect area are fused according to the defect type to obtain the target refrigeration valve defect image.

6. The method for detecting defects on the outer surface of a refrigeration valve based on machine vision according to claim 1, characterized in that: The step of inputting the unlabeled training data set into a preset neural network for deep learning to obtain an initial defect detection model comprises: The loss between the model prediction value and the actual value during the training process is obtained, and back propagation is performed according to the loss to obtain the initial defect detection model.

7. The method for detecting defects on the outer surface of refrigeration valves based on machine vision according to claim 1, characterized in that: Before the step of inputting the labeled training data set into the trained initial defect detection model to adjust the hyper parameters of the model to obtain the defect detection model, the step further includes: Obtaining the number of samples of the labeled training data set, and dividing the labeled training data set into equal parts equal to the number of samples according to the number of samples; Set up a loop, loop the same number of samples for the same number of times, each time select a different equal portion as the validation set, and the rest as the training set; In each cycle, the currently selected training set is used to train the initial defect detection model, and the current validation set is used to evaluate the performance of the initial defect detection model.

8. A refrigeration valve outer surface defect detection system based on machine vision, characterized in that: The system comprises: An acquisition module, used for collecting a preset number of defective images of refrigeration valves with defects on the outer surface and normal images of refrigeration valves without defects on the outer surface, and establishing a training data set based on the defective images of refrigeration valves and the normal images of refrigeration valves; An enhancement module, used to expand the training data set according to a preset data enhancement strategy, and divide the training data set into a labeled training data set and an unlabeled training data set; A training module, used for inputting the unlabeled training data set into a preset neural network for deep learning to obtain an initial defect detection model, and then inputting the labeled training data set into the trained initial defect detection model to adjust the model's hyperparameters to obtain the defect detection model; The detection module is used to obtain an outer surface image of the refrigeration valve to be detected, and input the outer surface image of the refrigeration valve into the defect detection model to detect whether there are defects on the outer surface of the refrigeration valve.

9. A readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.

10. A computer device, characterized in that: The method comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the steps of the method according to any one of claims 1 to 7 are implemented.