Copper pipe quality detection method and system based on semi-supervised learning
By adopting a semi-supervised learning method in copper tube quality detection, a deep convolutional neural network (CNN) classification system is built, which solves the problem that defective image data samples are not easy to collect and annotate and high cost, and improves detection accuracy and efficiency.
Patent Information
- Application Number
- CN202510113953.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-24
- Publication Date
- 2025-05-27
AI Technical Summary
In copper tube quality detection, defective image data samples are not easy to collect, data annotation cost is high, and the accuracy and efficiency of the detection model are not high.
Using the copper tube quality detection method based on semi-supervised learning, the copper tube defect image data is acquired for preprocessing, including data annotation and data enhancement, a classification system based on deep convolutional neural network (CNN) is constructed. The training set consists of marked images and labeled images, and the interval-based method determines the weight of the labeled samples to detect copper tube defects.
The annotation cost of learning data is reduced, and a small amount of labeled data and a large amount of unlabeled data are used for model training, which effectively alleviates the problem of insufficient data and improves the detection accuracy and efficiency of the model in a small amount of labeled data scenario.
Smart Images

Figure CN120047404A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of copper tube quality inspection, and particularly to a copper tube quality inspection method and system based on semi-supervised learning. Background Technique
[0002] At present, with the continuous development of artificial intelligence technology, the entire process of copper tube processing is becoming more and more intelligent, such as intelligent scheduling, intelligent decision-making, and intelligent inspection. Especially intelligent inspection has greatly improved the precision level of copper tube processing production. Copper tubes are widely used in fields such as automobiles, ships, household electrical appliances, and buildings. Since the processing of copper tubes is usually manufactured by large-scale production methods and involves complex processes, the automation of copper tube defect detection is crucial. Copper tube defect detection is carried out by obtaining copper tube images through high-performance machine vision cameras and analyzing them.
[0003] However, due to environmental conditions such as the lighting device used to obtain images may cause surface reflections, the defect size is very small, or multiple types of defects need to be distinguished, the detection difficulty may increase. In addition, a large number of acquired images need to be manually annotated, which brings a heavy burden. At the same time, the yield rate of copper tube production is relatively high, and defect image data samples are not easy to collect.
[0004] The supervised learning part uses a large amount of labeled data, which brings a great cost. To reduce the annotation cost of learning data, semi-supervised learning methods have emerged. It can use a small amount of labeled data and a large amount of unlabeled data for model training, effectively alleviating the problem of insufficient data. However, with the continuous improvement of the manufacturing industry's requirements for product quality, current few-shot learning, semi-supervised learning and other technologies are difficult to achieve the accuracy and efficiency required for copper tube production.
[0005] Therefore, the present invention provides a copper tube quality inspection method based on semi-supervised learning to solve the above problems. Summary of the Invention
[0006] In view of the above situation, to overcome the deficiencies of the prior art, the present invention provides a copper tube quality inspection method based on semi-supervised learning to solve the technical problems of difficult collection of defect image data samples, high data annotation cost, and low accuracy and efficiency of the detection model in copper tube quality inspection.
[0007] To achieve the above object, the technical solution adopted by the present invention is as follows:
[0008] In the first aspect, a copper tube quality inspection method based on semi-supervised learning is provided:
[0009] S1. Obtain copper tube defect image data, and preprocess the copper tube defect image data. The preprocessing includes at least data annotation and data augmentation;
[0010] S2. Build a copper tube quality model based on semi-supervised learning, and use the training set to build a classification system based on a deep convolutional neural network (CNN). The training set consists of labeled images and unlabeled images, and its interval-based method is used to determine the weight of each unlabeled sample when training the network;
[0011] S3. Obtain real-time copper tube image data, and input the real-time copper tube image data into the copper tube quality model based on semi-supervised learning for copper tube defect detection.
[0012] The preprocessing of the copper tube defect image data includes:
[0013] S11. Randomly select a normal copper tube image from the collected data, select a random position, and geometrically generate each type of defect at this position with appropriate brightness.
[0014] S12. Generate a corresponding segmentation map for each defect;
[0015] S13. After generating the defect image, paste it onto a normal copper tube image without defects to complete the production of the final image.
[0016] Randomly selecting a normal copper tube image from the collected data, selecting a random position, and geometrically generating each type of defect at this position with appropriate brightness includes:
[0017] Black dots and white dots are created by generating black and white circular dots according to the density of the Gaussian distribution, while randomly adjusting their horizontal and vertical widths and adding noise to generate images similar to actual defects. Scratch defects are generated based on Bessel curves, and the length, angle, density, etc. of the curves are randomly generated according to the background brightness. Polluted defects are realized by simulating the morphology of irregularly shaped stains, generating multiple random Gaussian distribution shapes and mixing them. When the size and generation position of the defect are determined by the generation program, for the automatically generated defect image's label information, first remove the background of the defect area, and then only input the defect part into the generation model, input the image of the defect area instead of the entire image used for learning into the generation model.
[0018] Generating a corresponding segmentation map for each defect includes:
[0019] The given small amount of labeled data contains the bounding box information of the defective part. For the bounding box area, that is, the defective area image, create a defective segmentation map for distinguishing the defective part from the background part. Then, for each defect, train a semantic segmentation model that takes the defective area image as input and outputs the defective segmentation map. The trained model will be able to extract the defect without the background from the defective area image and generate the corresponding segmentation map. For each defective area image, after using the semantic segmentation model to generate the defect image without the background, input it into the GAN-based data generation model to learn the distribution of the defect data.
[0020] After generating the defect image, paste it onto the normal copper tube image without defects to complete the production of the final image, including: using a classification model that predicts the background color tone matching the defect. This classification model uses the actual defective area image, inputs the defect image after removing the background, and learns to predict the average density of the defect background. Input the defect image generated by the GAN into the trained classification model to obtain the appropriate background density matching the defect.
[0021] After preprocessing the copper tube defect image data, a training set is generated. The training set consists of labeled images and unlabeled images. Let D L ={x i ,y i}, i = 1,..., N L be the labeled data set. It contains N L images {x i} and their corresponding labels {y i}. Here, y i ={1,..., c}, where c is the number of classes. On the other hand, the unlabeled data set, D U ={x i}, i = 1,..., N U only contains N U images with unknown labels. Let F denote the convolutional neural network that transforms the given image x i into a set of output decisions z i ∈Rc as follows:
[0022] z i =F(x i )(1)
[0023] Let p ik =P(y = k|x i ) be the probability that x i belongs to class k. This probability can be obtained by applying the soft-max function to the output given by the CNN, that is:
[0024]
[0025] Among them, z ij is the j-th element of z i .
[0026] The predicted label of the image x i can be obtained by taking the class with the highest predicted probability, that is:
[0027]
[0028] where k = 1,..., c. In addition, assume represents the maximum probability of the image x i among all classes.
[0029]
[0030] A copper pipe quality detection method based on semi-supervised learning, further comprising:
[0031] Learning the parameters of a convolutional neural network (CNN) and minimizing the following cross-entropy-based loss function. This loss function consists of two terms, the first term is based on labeled data and the second term is based on unlabeled data.
[0032] L = L L + λL U (5)
[0033] where
[0034] and
[0035] where λ is a trade-off parameter used to balance the contributions of the labeled data and unlabeled data loss terms. In all our experiments, we set λ to 1. The indicator function 1 yi=k , if y i = k, returns 1, otherwise returns 0.
[0036] In formula (7), w i is the weight associated with the unlabeled image x i .
[0037] In the first 50 training epochs, only labeled data is used to train the network (i.e., λ = 0 in formula (7)), and then the loss function defined in formula (7) is used to optimize both the labeled data and unlabeled data, with λ = 1 at this time.
[0038] In formula (7), w i is the weight associated with the unlabeled image x i , which represents the trust people have in the label of this image
[0039] The weights should not be based solely on to determine, but should be based on their prediction confidence, i.e., where is the second-largest predicted probability of image x i We define the weights as:
[0040]
[0041] where, where β and t are free parameters that define the softness of the weights.
[0042] A copper tube quality detection method based on semi-supervised learning, characterized by further including: setting β to 30 and t to 0.5 respectively.
[0043] The weighting scheme weights each image according to its prediction confidence. Images with high prediction confidence are given higher weights, while other images are given lower weights.
[0044] In a second aspect, a copper tube quality detection system based on semi-supervised learning is provided, characterized by including:
[0045] Data acquisition module: The detection device includes: vision cameras are respectively arranged on the top, bottom, left, and right, and each camera has an independent light source. There are more than one section of conveyor belts arranged along the moving direction of the copper tube to be inspected for acquiring copper tube defect image data.
[0046] Data preprocessing module, which acquires copper tube defect image data and preprocesses the copper tube defect image data. The preprocessing at least includes data annotation and data augmentation;
[0047] Model establishment module, which uses a training set to construct a classification system based on a deep convolutional neural network (CNN). The training set consists of labeled images and unlabeled images, and its interval-based method is used to determine the weights of each unlabeled sample when training the network;
[0048] Detection module, which acquires real-time copper tube image data and inputs the real-time copper tube image data into the copper tube quality model based on semi-supervised learning for copper tube defect detection.
[0049] In a third aspect, a computer device is provided, including a memory and a processor. The memory stores a computer program, characterized in that when the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
[0050] In a fourth aspect, a computer-readable storage medium is provided, on which a computer program is stored, characterized in that when the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
[0051] The beneficial effects of the present invention are as follows:
[0052] Compared with the prior art, the beneficial effects of the present invention are:
[0053] 1. Data augmentation techniques based on programs and generative models are proposed, which solve the technical problem that the yield of copper tube production is relatively high and it is difficult to collect defective image data samples, and reduce the dependence on defective image data samples.
[0054] 2. A copper tube quality detection method based on semi-supervised learning is provided, which reduces the annotation cost of learning data. It can use a small amount of labeled data and a large amount of unlabeled data for model training, effectively alleviates the problem of insufficient data, and improves the accuracy and efficiency of the detection accuracy of the model in the scenario of a small amount of labeled data. BRIEF DESCRIPTION OF THE DRAWINGS
[0055] Figure 1 It is a schematic flow chart of a copper tube quality detection method based on semi-supervised learning according to the present invention;
[0056] Figure 2 It is a schematic flow chart of data augmentation based on programs and generative models according to the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0057] Next, each embodiment of the present invention will be described in detail with reference to the accompanying Figure 1 to the accompanying Figure 2 Those skilled in the art should understand that these embodiments are only used to explain the technical principle of the present invention and are not intended to limit the protection scope of the present invention.
[0058] To achieve the above object, the technical solutions adopted by the present invention are as follows:
[0059] In a first aspect, as Figure 1 shown: A copper tube quality detection method based on semi-supervised learning is provided:
[0060] S1. Obtain copper tube defect image data, and perform preprocessing on the copper tube defect image data. The preprocessing includes at least data annotation and data augmentation;
[0061] S2. Construct a copper tube quality model based on semi-supervised learning, and use the training set to construct a classification system based on a deep convolutional neural network (CNN). The training set consists of labeled images and unlabeled images, and its interval-based method is used to determine the weight of each unlabeled sample when training the network.
[0062] S3. Obtain real-time copper tube image data and input the real-time copper tube image data into a copper tube quality model based on semi-supervised learning for copper tube defect detection.
[0063] To ensure high detection performance with a small amount of learning data and labeled data, it is necessary to carefully select and optimize techniques that contribute to performance improvement. We use program-based augmentation techniques (generating and adding defects geometrically to normal product data) and generative model-based augmentation techniques (learning the defect distribution of labeled data). The data generated by these augmentation techniques is used to pre-train the latest deep learning object detection model.
[0064] Furthermore, as Figure 2 shown, the preprocessing of the copper tube defect image data includes:
[0065] S11. Randomly select a normal copper tube image from the collected data, choose a random position, and geometrically generate each type of defect at this position with appropriate brightness.
[0066] S12. Generate a corresponding segmentation map for each defect;
[0067] S13. After generating the defect image, paste it onto a normal copper tube image without defects to complete the production of the final image.
[0068] To enhance the copper tube defect image, it is first necessary to determine the type of defect to be enhanced. Depending on the characteristics of the copper tube and the copper tube processing environment, relatively small-sized defects appear in various forms, such as black dots, white dots, contamination, and scratches.
[0069] Randomly select a normal copper tube image from the collected data, choose a random position, and geometrically generate each type of defect at this position with appropriate brightness. First, black dots and white dots are created by generating circular dots of black and white according to the density of the Gaussian distribution, while randomly adjusting their horizontal and vertical widths and adding noise to generate images similar to actual defects. Scratch defects are generated based on Bezier curves, and the length, angle, and density of the curves are randomly generated according to the background brightness. Contamination defects are achieved by simulating the morphology of irregularly shaped stains, generating multiple random Gaussian distribution shapes and mixing them. In this augmentation method, since the size and generation position of the defects are determined by the generation program, labels for the defect types and positions can be automatically generated.
[0070] For the label information of the automatically generated defect images, it is necessary to input the images of the defect regions rather than the entire images used for learning into the generation model. However, the generation model learns the overall distribution of the input images. Therefore, it will not only learn the defects in the defect regions but also learn the distribution of the background to generate images. When pasting the images generated in this way onto normal images, the background of the defect regions cannot be naturally connected to the background of the normal images, making it difficult to use these images as learning images. To solve this problem, it is necessary to first remove the background of the defect regions and then input only the defect parts into the generation model.
[0071] The small amount of given labeled data contains the bounding box information of the defect parts. First, for the bounding box regions, that is, the defect region images, a defect segmentation map for distinguishing the defect parts from the background parts is created. Then, for each defect, a semantic segmentation model that inputs the defect region images and outputs the defect segmentation maps is trained. The trained model will be able to extract the defects without the background from the defect region images and generate the corresponding segmentation maps.
[0072] For each defect region image, after using the semantic segmentation model to generate the defect images without the background, they are input into the GAN-based data generation model to learn the distribution of the defect data.
[0073] After generating the defect images, they are pasted onto the normal copper tube images without defects to complete the production of the final images. However, since the defects generated by GAN are generated according to the distribution of the learning data, they may appear with different densities. Therefore, if the defects are pasted at arbitrary positions, when the background density at the pasting position does not match the defects, it may lead to difficult recognition or unnatural results. To solve this problem, a classification model for predicting the background hue matching the defects is used. The classification model uses the actual defect region images, inputs the defect images after removing the background, and learns to predict the average density of the defect background. Inputting the defect images generated by GAN into the trained classification model can obtain the appropriate background density matching the defects.
[0074] After preprocessing the copper tube defect image data, a training set is generated. The training set consists of labeled images and unlabeled images. Let D L ={x i ,y i}, i = 1,..., N L be the labeled data set. It contains N L images {x i} and their corresponding labels {y i}. Here, y i ={1,..., c}, where c is the number of classes. On the other hand, the unlabeled data set, D U ={x i} for i = 1, ..., N U Contains only N U images with unknown labels. Let F denote a convolutional neural network that transforms a given image x i into a set of output decisions z i ∈ Rc as follows:
[0075] z i = F(x i )(1)
[0076] Note that our method is general and does not depend on a specific CNN architecture. Let p ik = P(y = k|x i ) be the probability that x i belongs to class k. This probability can be obtained by applying the soft-max function to the output given by the CNN, i.e.:
[0077]
[0078] where z ij is the j-th element of z i .
[0079] The predicted label i of the image x can be obtained by taking the class with the highest predicted probability, i.e.:
[0080]
[0081] where k = 1, ..., c. Additionally, assume denotes the maximum probability of the image x i across all classes.
[0082]
[0083] A method for detecting the quality of copper pipes based on semi-supervised learning, further comprising:[[]]
[0084] The system of the present invention is based on labeled and unlabeled images. To learn the parameters of the convolutional neural network (CNN), the following cross-entropy based loss function is minimized. This loss function consists of two terms, one based on labeled data and the other based on unlabeled data.[[]]
[0086] L = L L + λL U (5)
[0087] where
[0088] And
[0089] where λ is a trade-off parameter that trades off the contributions of the labeled data and unlabeled data loss terms. In all our experiments, we set λ to 1. The indicator function 1 yi=k , if y i = k, returns 1, otherwise returns 0,
[0090] In Equation (7), w i is the weight associated with the unlabeled image x i .
[0091] In the first 50 training epochs, only the labeled data is used to train the network (i.e., λ = 0 in Equation (7)), and then the loss function defined in Equation (7) is used to optimize the labeled data and unlabeled data together, with λ = 1 at this time.
[0092] In Equation (7), w i is the weight associated with the unlabeled image x i , which represents the trust people have in the label of this image
[0093] The weights should not be determined only based on , but should be based on their prediction confidence, that is where is the second largest predicted probability of the image x i . We define the weights as:
[0094]
[0095] where, where β and t are free parameters that define the softness of the weights.
[0096] The method for detecting the quality of copper pipes based on semi-supervised learning further includes: setting β to 30 and t to 0.5 respectively; the weighting scheme weights each image according to its prediction confidence. Images with high prediction confidence are given higher weights, while other images are given lower weights.
[0097] Even when the threshold is low, our proposed margin-based method can select more correctly labeled images, which shows its effectiveness in selecting correctly labeled samples.
[0098] Since accuracy is widely used to compare different methods on this dataset, we use accuracy as the evaluation metric.
[0099] A simple and effective semi - supervised deep learning method for surface defect classification is proposed. Our method is not limited to a specific CNN architecture, and any CNN architecture can be easily incorporated into it. We propose a margin - based method for determining the weight of each unlabeled sample when training the network. Our experiments show that the proposed method can achieve state - of - the - art performance using only 10% of the labeled training data. In addition, compared with fully supervised methods, the proposed semi - supervised method is also quite competitive. Future work will focus on applying the proposed technique to other defect classification datasets and extending it to the field of defect segmentation.
[0100] Acquire real - time copper tube image data and input the real - time copper tube image data into a copper tube quality model based on semi - supervised learning for copper tube defect detection.
[0101] A copper tube quality detection system based on semi - supervised learning is provided, which is characterized by including:
[0102] A data acquisition module. The detection device includes: visual cameras are arranged on the top, bottom, left, and right, and each camera has an independent light source. There are more than one section of conveyor belts arranged along the moving direction of the copper tube to be inspected for acquiring copper tube defect image data;
[0103] A data pre - processing module. Acquire the copper tube defect image data and pre - process the copper tube defect image data. The pre - processing at least includes data annotation and data augmentation;
[0104] A model establishment module. Use the training set to construct a classification system based on a deep convolutional neural network (CNN). The training set consists of labeled images and unlabeled images. Its margin - based method is used to determine the weight of each unlabeled sample when training the network;
[0105] A detection module. Acquire real - time copper tube image data and input the real - time copper tube image data into a copper tube quality model based on semi - supervised learning for copper tube defect detection.
[0106] The above - mentioned unit modules can be embedded in the processor of a computer device in hardware form or be independent of it, or can be stored in the memory of the computer device in software form so that the processor can call and execute the operations corresponding to each of the above modules.
[0107] This embodiment also provides a computer device, which may be a terminal. The computer device includes a processor, a memory, a communication interface, a display screen, and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner. The wireless manner can be implemented through WIFI, a carrier network, NFC (Near Field Communication), or other technologies. When the computer program is executed by the processor, it implements a method for detecting copper tube defects based on semi-supervised learning. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen. The input device of the computer device can be a touch layer covering the display screen, or a button, a trackball, or a touchpad provided on the housing of the computer device, or an external keyboard, touchpad, or mouse, etc.
[0108] This embodiment also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the following steps are implemented:
[0109] A copper tube quality detection system based on semi-supervised learning is provided, which is characterized by including:
[0110] A data acquisition and preprocessing module, which acquires copper tube defect image data and preprocesses the copper tube defect image data. The preprocessing at least includes data annotation and data augmentation;
[0111] A model establishment module, which uses a training set to construct a classification system based on a deep convolutional neural network (CNN). The training set consists of labeled images and unlabeled images, and its interval-based method is used to determine the weight of each unlabeled sample when training the network;
[0112] A detection module, which acquires real-time copper tube image data and inputs the real-time copper tube image data into a copper tube quality model based on semi-supervised learning to perform copper tube defect detection.
[0113] In summary, the copper tube quality model based on semi-supervised learning provided by this embodiment can not only improve the accuracy and efficiency of copper tube defect detection, but also reduce the dependence on labeled data, providing a strong guarantee for copper tube quality control.
[0114] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit them. Although the present invention has been described in detail with reference to the preferred embodiments, those of ordinary skill in the art should understand that the technical solutions of the present invention can be modified or equivalently replaced without departing from the spirit and scope of the technical solutions of the present invention, and they should all be covered by the scope of the claims of the present invention.
[0115] Those skilled in the art should understand that the embodiments of the present application can be provided as a method, a system, or a computer program product. Therefore, the present application can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present application can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code. The solutions in the embodiments of the present application can be implemented in various computer languages. For example, object-oriented programming languages such as Java and interpreted scripting languages such as JavaScript.
[0116] The present application is described with reference to the flowcharts and / or block diagrams of methods, apparatuses (systems), and computer program products according to the embodiments of the present application. It should be understood that each flow and / or block in the flowchart and / or block diagram, as well as the combination of flows and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing devices to generate a machine, such that the instructions executed by the processor of the computer or other programmable data processing devices generate means for implementing the specified functions in Figure 1 one flow or multiple flows and / or blocks Figure 1 one block or multiple blocks.
[0117] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, such that the instructions stored in the computer-readable memory generate a manufactured article including instruction means that implement the specified functions in Figure 1 one flow or multiple flows and / or blocks Figure 1 one block or multiple blocks.
[0118] These computer program instructions can also be loaded onto a computer or other programmable data processing device, such that a series of operation steps are executed on the computer or other programmable device to generate a computer-implemented process, so that the instructions executed on the computer or other programmable device provide means for implementing the specified functions in Figure 1 one flow or multiple flows and / or blocks Figure 1Steps of functions specified in one or more boxes.
[0119] Although the preferred embodiments of the present application have been described, those skilled in the art can make additional changes and modifications to these embodiments once they learn the basic creative concepts. Therefore, the appended claims are intended to be construed to include the preferred embodiments as well as all changes and modifications that fall within the scope of the present application.
[0120] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalent technologies, the present application is also intended to include these modifications and variations.
Claims
1. A copper tube quality detection method based on semi-supervised learning, characterized in that: include: S1. Acquire copper tube defect image data, and preprocess the copper tube defect image data, wherein the preprocessing includes at least data labeling and data enhancement; S2. Build a copper tube quality model based on semi-supervised learning. Use the training set to build a classification system based on a deep convolutional neural network (CNN). The training set consists of labeled images and unlabeled images. The interval-based method is used to determine the weight of each unlabeled sample when training the network. S3. Acquire real-time copper tube image data, and input the real-time copper tube image data into a copper tube quality model based on semi-supervised learning to perform copper tube defect detection.
2. The copper tube quality detection method based on semi-supervised learning according to claim 1, characterized in that: The preprocessing of the copper tube defect image data includes: S11. randomly select a normal copper tube image from the collected data, select a random position, and geometrically generate each type of defect at the position with appropriate brightness; S12, generating a corresponding segmentation map for each defect; S13, after the defect image is generated, it is pasted onto the normal copper tube image without defects to complete the production of the final image.
3. The copper tube quality detection method based on semi-supervised learning as claimed in claim 2, characterized in that: The method randomly selects a normal copper tube image from the collected data, selects a random position, and geometrically generates each type of defect at the position with appropriate brightness, including: Black dots and white dots are created by respectively placing black and white circular dots according to the density of Gaussian distribution, while randomly adjusting their horizontal and vertical widths and adding noise to generate images similar to actual defects; scratch defects are generated based on Bezier curves, and the length, angle and density of the curves are randomly generated according to the background brightness; contamination defects are achieved by simulating irregular stains, generating multiple random Gaussian distribution shapes and mixing them; when the size and generation position of the defect are determined by the generation program, the label information of the defect image is automatically generated, the background of the defect area is first removed, and then only the defect part is input into the generation model, and the image of the defect area instead of the entire image used for learning is input into the generation model. The corresponding segmentation map generated for each defect includes: A small amount of annotated data is given that contains the bounding box information of the defect part. For the bounding box area, that is, the defect area image, a defect segmentation map is created to distinguish the defect part from the background part. Then, for each defect, a semantic segmentation model is trained that inputs the defect area image and outputs the defect segmentation map. The trained model will be able to extract defects without background from the defect area image and generate the corresponding segmentation map; for each defect area image, after using the semantic segmentation model to generate a defect image without background, it is input into the GAN-based data generation model to learn the distribution of defect data.
4. The copper tube quality detection method based on semi-supervised learning as claimed in claim 3 is characterized in that: After the defect image is generated, it is pasted onto a normal copper tube image without defects to complete the production of the final image, including: using a classification model that predicts a background tone that matches the defect, the classification model uses an actual defect area image, inputs the defect image after removing the background, learns to predict the average density of the defect background, and inputs the defect image generated by GAN into the trained classification model to obtain a suitable background density that matches the defect.
5. The copper tube quality detection method based on semi-supervised learning according to any one of claims 1 to 4, further comprising: The training set consists of labeled images and unlabeled images. Let D L ={x i ,y i },i=1,...,N L is a labeled dataset. It contains N L The image {x i } and their corresponding labels {y i }, here, y i ={1,...,c}, c is the number of categories. On the other hand, for unlabeled datasets, D U ={x i },i=1,...,N U Contains only N U images whose labels are unknown, let F represent a convolutional neural network, which will be a given image x i Transformed into a set of output decisions z i ∈Rc, as shown below: z i =F(x i )(1) Let p ik =P(y=k|x i ) is x i The probability of belonging to category k. This probability can be obtained by applying the soft-max function to the output given by CNN, that is: Among them, z ij Yes i The j-th element of . Imagex i The predicted label It can be obtained by taking the category with the largest predicted probability, that is: Among them, k = 1,...,c, in addition, assume Represents image x i Maximum probability among all categories; 6. The copper tube quality detection method based on semi-supervised learning as described in claims 4-5 is characterized in that Also includes: Learn the parameters of a convolutional neural network (CNN) to minimize the following cross-entropy based loss function, which consists of two terms, the first one based on labeled data and the other one based on unlabeled data. L=L L +λL U (5) in, and, Where λ is a trade-off parameter that weighs the contribution of the labeled and unlabeled data loss terms. In all our experiments, we set λ to 1. Indicator function 1 yi=k , if y i = k, then it returns 1, otherwise it returns 0. In formula (7), w i is the same as the unlabeled image x i The associated weights; In the first 50 training cycles, only labeled data is used to train the network (i.e., λ = 0 in formula (7)). Then, the loss function defined in formula (7) is used to optimize the labeled data and unlabeled data together, at which time λ = 1. In formula (7), w i is the same as the unlabeled image x i The associated weight, which represents people's confidence in the image tag; Weights should not be based solely on is determined based on their prediction confidence, i.e. in is the image x i The second largest predicted probability. We define the weight as: in, Among them, β and t are free parameters that define the softness of the weight; preferably, β is set to 30 and t is set to 0.5 respectively.
7. The copper tube quality detection method based on semi-supervised learning as claimed in claim 6 is characterized in that Also included is a weighting scheme that weights each image according to its prediction confidence, where images with high prediction confidence are given higher weights, while other images are given lower weights.
8. A copper tube quality detection system based on semi-supervised learning, characterized in that: include: Data acquisition module: The detection device includes: visual cameras are arranged on the top, bottom, left and right sides, and each camera has an independent light source. More than one conveyor belt is arranged along the moving direction of the copper tube to be inspected, which is used to obtain the defect image data of the copper tube; A data preprocessing module, which obtains copper tube defect image data and preprocesses the copper tube defect image data, wherein the preprocessing at least includes data labeling and data enhancement; The model building module builds a classification system based on a deep convolutional neural network (CNN) using a training set consisting of labeled and unlabeled images, and an interval-based method to determine the weight of each unlabeled sample when training the network; The detection module acquires real-time copper tube image data and inputs the real-time copper tube image data into a copper tube quality model based on semi-supervised learning to perform copper tube defect detection.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
Citation Information
Cited By
Method and system for predicting on-machine wear state of diamond milling cutter based on machine learning
CN121073934A