Article quality detection method, device, equipment, storage medium and program product
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-08
- Publication Date
- 2026-08-07
AI Technical Summary
[0004]然而,传统的分类方式通常是具有明确的分类界限,即图像是缺陷图像、或图像不是缺陷图像,但由于工业产品的质量检测结果不是简单的二分类,比如包括较多缺陷图像的程度较为轻微,或者某些图像由于缺陷程度十分轻微,本质上可以划分为无缺陷图像的情况等,无法通过简单的二值标签进行全面表述
[0026]In the aforementioned methods, apparatus, computer equipment, storage media, and computer program products for inspecting the quality of goods, a first detection model is trained based on a pre-labeled standard dataset containing noise-free data. Then, using the weight data and output probabilities of each convolutional layer of the trained first detection model, a second detection model is trained under supervision to obtain a trained quality inspection model. Further, by acquiring image data of the goods to be inspected and using the trained quality inspection model, quality inspection is performed on the image data, quickly and accurately obtaining the quality inspection result corresponding to the image data. Since the convolutional layers of the first and second detection models correspond one-to-one, the weight data of each convolutional layer of the first detection model is used to supervise the training of the weight data of the convolutional layers in the second detection model that correspond one-to-one with the convolutional layers in the first detection model. This allows the convolutional layer weights and output probabilities of the first detection model, trained using a standard dataset without noise, to be used for supervised training of the second detection model. This overcomes the performance impact of traditional training methods using noisy data for the second detection model, enabling the trained quality detection model to output stable and reliable quality detection results, further improving the accuracy of quality detection results for products or items.
Smart Images

Figure CN117011219B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of artificial intelligence technology, and in particular to a method, apparatus, computer equipment, storage medium, and computer program product for inspecting the quality of goods. Background Technology
[0002] With the rapid development of artificial intelligence technology and the manufacturing industry, the quality requirements for industrial products in the manufacturing process are also increasing. This necessitates quality inspection of industrial products during the manufacturing process to determine whether there are any defects, so as to detect defective products in a timely manner and prevent them from entering the market.
[0003] Traditionally, for industrial products in the manufacturing process, it is necessary to photograph the surface of the products, extract features from these images, and classify them based on these features to determine whether defects exist, thereby obtaining the quality inspection results. Specifically, this can be achieved by training an SVM classifier or a tree-based classifier, and then using the trained classifier to perform binary classification on the current image to determine whether it is a defective image, thus obtaining the quality inspection result.
[0004] However, traditional classification methods typically have clear classification boundaries, i.e., images are either defective or not. But the quality inspection results of industrial products are not simple binary classifications. For example, there may be many images with minor defects, or some images with very minor defects that can essentially be classified as defect-free. These situations cannot be fully represented by simple binary labels. Furthermore, simple binary labels require manual pre-annotation, which often carries a lot of subjectivity, leading to noisy and erroneous data in the pre-annotated labels.
[0005] Therefore, if noisy labels are used to train a model, the resulting model (or classifier) will usually also carry noise, which will lead to a decrease in the model's recognition and classification performance, and consequently, the accuracy of the quality detection results obtained by the model will also be low. Summary of the Invention
[0006] Therefore, it is necessary to provide a method, apparatus, computer equipment, computer-readable storage medium, and computer program product for quality inspection of products or articles that can improve the accuracy of quality inspection results for the aforementioned technical problems.
[0007] Firstly, this application provides a method for inspecting the quality of an article. The method includes:
[0008] Acquire image data of the item to be detected;
[0009] The trained quality detection model is used to perform quality detection on the item image data to obtain the quality detection result corresponding to the item image data;
[0010] The trained quality detection model is obtained by supervising the training of the second detection model based on the weight data and output probabilities of each convolutional layer of the pre-trained first detection model. The convolutional layers of the first detection model and the second detection model correspond one-to-one. The first detection model is trained on a standard dataset of pre-labeled noise-free data.
[0011] Secondly, this application also provides an article quality testing device. The device includes:
[0012] The item image data acquisition module is used to acquire the image data of the item to be detected;
[0013] The quality detection result generation module is used to perform quality detection on the object image data using a trained quality detection model to obtain a quality detection result corresponding to the object image data; wherein, the trained quality detection model is obtained by supervised training of a second detection model based on the weight data and output probabilities of each convolutional layer of a pre-trained first detection model, and the convolutional layers of the first detection model and the second detection model correspond one-to-one; the first detection model is trained on a pre-labeled standard dataset without noise data.
[0014] Thirdly, this application also provides a computer device. The computer device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to perform the following steps:
[0015] Acquire image data of the item to be detected;
[0016] The trained quality detection model is used to perform quality detection on the item image data to obtain the quality detection result corresponding to the item image data;
[0017] The trained quality detection model is obtained by supervising the training of the second detection model based on the weight data and output probabilities of each convolutional layer of the pre-trained first detection model. The convolutional layers of the first detection model and the second detection model correspond one-to-one. The first detection model is trained on a standard dataset of pre-labeled noise-free data.
[0018] Fourthly, this application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program thereon, which, when executed by a processor, performs the following steps:
[0019] Acquire image data of the item to be detected;
[0020] The trained quality detection model is used to perform quality detection on the item image data to obtain the quality detection result corresponding to the item image data;
[0021] The trained quality detection model is obtained by supervising the training of the second detection model based on the weight data and output probabilities of each convolutional layer of the pre-trained first detection model. The convolutional layers of the first detection model and the second detection model correspond one-to-one. The first detection model is trained on a standard dataset of pre-labeled noise-free data.
[0022] Fifthly, this application also provides a computer program product. The computer program product includes a computer program that, when executed by a processor, performs the following steps:
[0023] Acquire image data of the item to be detected;
[0024] The trained quality detection model is used to perform quality detection on the item image data to obtain the quality detection result corresponding to the item image data;
[0025] The trained quality detection model is obtained by supervising the training of the second detection model based on the weight data and output probabilities of each convolutional layer of the pre-trained first detection model. The convolutional layers of the first detection model and the second detection model correspond one-to-one. The first detection model is trained on a standard dataset of pre-labeled noise-free data.
[0026] In the aforementioned methods, apparatus, computer equipment, storage media, and computer program products for inspecting the quality of goods, a first detection model is trained based on a pre-labeled standard dataset containing noise-free data. Then, using the weight data and output probabilities of each convolutional layer of the trained first detection model, a second detection model is trained under supervision to obtain a trained quality inspection model. Further, by acquiring image data of the goods to be inspected and using the trained quality inspection model, quality inspection is performed on the image data, quickly and accurately obtaining the quality inspection result corresponding to the image data. Since the convolutional layers of the first and second detection models correspond one-to-one, the weight data of each convolutional layer of the first detection model is used to supervise the training of the weight data of the convolutional layers in the second detection model that correspond one-to-one with the convolutional layers in the first detection model. This allows the convolutional layer weights and output probabilities of the first detection model, trained using a standard dataset without noise, to be used for supervised training of the second detection model. This overcomes the performance impact of traditional training methods using noisy data for the second detection model, enabling the trained quality detection model to output stable and reliable quality detection results, further improving the accuracy of quality detection results for products or items. Attached Figure Description
[0027] Figure 1 This is a diagram illustrating the application environment of an article quality inspection method in one embodiment.
[0028] Figure 2 This is a flowchart illustrating a method for inspecting the quality of an item in one embodiment;
[0029] Figure 3 This is a schematic diagram of defects of different severity in one embodiment;
[0030] Figure 4 This is a schematic diagram illustrating the acquisition of quality inspection results corresponding to item image data in one embodiment;
[0031] Figure 5 This is a schematic diagram comparing an OK image and a defective image in one embodiment;
[0032] Figure 6 This is a flowchart illustrating the process of training a quality detection model in one embodiment;
[0033] Figure 7 This is a schematic diagram of the pre-training process of the first detection model in one embodiment;
[0034] Figure 8 This is a schematic diagram illustrating the process of training the quality detection model in another embodiment;
[0035] Figure 9This is a schematic diagram illustrating the process of obtaining a quality inspection model in one embodiment.
[0036] Figure 10 This is a flowchart illustrating the process of training the quality detection model in another embodiment;
[0037] Figure 11 This is a flowchart illustrating the article quality inspection method in another embodiment;
[0038] Figure 12 This is a structural block diagram of an article quality detection device in one embodiment;
[0039] Figure 13 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation
[0040] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0041] The product quality inspection method provided in this application involves artificial intelligence (AI) technology and can be applied to various scenarios such as cloud technology, AI, smart transportation, and assisted driving. AI is the theory, method, technology, and application system that uses digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use that knowledge to obtain optimal results. In other words, AI is a comprehensive technology within computer science that attempts to understand the essence of intelligence and produce a new type of intelligent machine that can react in a way similar to human intelligence. AI studies the design principles and implementation methods of various intelligent machines, enabling them to have perception, reasoning, and decision-making functions. As a comprehensive discipline, AI technology involves a wide range of fields, including both hardware and software technologies. Basic AI technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing technology, operating / interactive systems, and mechatronics. AI software technologies mainly include computer vision technology, speech processing technology, natural language processing technology, and machine learning / deep learning.
[0042] Computer vision (CV) is a science that studies how to enable machines to "see." More specifically, it refers to using cameras and computers to replace human eyes in recognizing, detecting, and measuring targets, and then performing image processing to create images more suitable for human observation or transmission to instruments. As a scientific discipline, computer vision studies related theories and technologies, attempting to build artificial intelligence systems capable of extracting information from images or multidimensional data. Computer vision technologies typically include image processing, image recognition, image semantic understanding, image retrieval, OCR, video processing, video semantic understanding, video content / behavior recognition, 3D object reconstruction, 3D technology, virtual reality, augmented reality, simultaneous localization and mapping (SLAM), and common biometric recognition technologies such as facial recognition and fingerprint recognition. Machine learning (ML), on the other hand, is a multidisciplinary field involving probability theory, statistics, approximation theory, convex analysis, and algorithm complexity theory. It specifically studies how computers can simulate or implement human learning behavior to acquire new knowledge or skills and reorganize existing knowledge structures to continuously improve their performance. Machine learning is the core of artificial intelligence and the fundamental way to endow computers with intelligence. Its applications span all areas of artificial intelligence. Machine learning and deep learning typically include techniques such as artificial neural networks, belief networks, reinforcement learning, transfer learning, inductive learning, and instructional learning.
[0043] With the research and advancement of artificial intelligence (AI) technology, AI is being studied and applied in various fields, such as smart homes, smart wearable devices, virtual assistants, smart speakers, smart marketing, autonomous driving, drones, robots, smart healthcare, and smart customer service. It is believed that with the development of technology, AI will be applied in more fields and play an increasingly important role.
[0044] The article quality inspection method provided in this application specifically involves technologies such as computer vision and machine learning in artificial intelligence, and can be applied to, for example... Figure 1In the application environment shown, terminal 102 communicates with server 104 via a network. A data storage system can store the data that server 104 needs to process. The data storage system can be integrated onto server 104 or located in the cloud or on other network servers. Terminal 102 can be, but is not limited to, various personal computers, laptops, smartphones, tablets, IoT devices, and portable wearable devices. IoT devices can include smart speakers, smart TVs, smart air conditioners, smart vehicle devices, aircraft, etc. Portable wearable devices can include smartwatches, smart bracelets, head-mounted devices, etc. Server 104 can be implemented using a standalone server or a server cluster consisting of multiple servers.
[0045] Furthermore, both terminal 102 and server 104 can be used independently to execute the article quality detection method provided in this embodiment, or they can work together to execute the article quality detection method provided in this embodiment. For example, taking the collaborative execution of the article quality detection method provided in this embodiment by terminal 102 and server 104 as an example, server 104 acquires the article image data to be detected. The article image data can be stored in the local storage of terminal 102, or in a data storage system or the cloud storage of server 104. When article quality detection is required, it can be retrieved from the local storage of terminal 102, the data storage system, or the cloud storage of server 104. Further, server 104 uses a trained quality detection model to perform quality detection on the article image data, obtaining a quality detection result corresponding to the article image data. After obtaining the quality inspection results, the results are further fed back to the terminal 102 for display or stored in the cloud storage or data storage system of the server 104, so as to conduct further analysis and processing based on the quality inspection results, obtain corresponding analysis or processing results, and then carry out quality rectification and defect elimination based on the analysis or processing results.
[0046] The trained quality detection model is obtained by supervising the training of the second detection model using the weight data and output probabilities of each convolutional layer of the pre-trained first detection model. The convolutional layers of the first and second detection models correspond one-to-one. The first detection model is trained on a pre-labeled standard dataset containing noisy data. Similarly, the standard dataset containing noisy data can be stored in the local storage of terminal 102, or in the cloud storage of a data storage system or server 104.
[0047] In one embodiment, such as Figure 2As shown, a method for inspecting the quality of goods is provided. This is illustrated using an example where the method is executed by a computer device. It can be understood that the computer device can be... Figure 1 The terminal 102 shown can also be a server 104, or a system composed of terminal 102 and server 104, and is implemented through interaction between terminal 102 and server 104. In this embodiment, the item quality detection method specifically includes the following steps:
[0048] Step S202: Obtain image data of the item to be detected.
[0049] Specifically, industrial products or articles in the manufacturing process typically require quality testing before being put into market application or sale. Only when the product or article meets the corresponding quality requirements are they allowed to be put into market application or sale. Furthermore, the image data of the industrial product or article to be tested obtained during the manufacturing process can be understood as surface image data of the industrial product or article, specifically surface image data of each product or article taken from different angles or under different lighting conditions.
[0050] Furthermore, since the manufacturing process usually involves a variety of different factors, such as environmental factors, raw material factors, and the factors of the manufacturing machinery itself, it cannot be guaranteed that all products or items produced will meet quality requirements under the influence of these various factors.
[0051] Specifically, for different products or items, there can be various defect situations of different severity, such as... Figure 3 As shown, a schematic diagram of defects of different severity is provided, with reference to... Figure 3 It can be seen that, Figure 3 Figure (a) is an OK image (i.e., an image without defects). Figure 3 Image (b) in the image shows a minor defect, while Figure 3 Figure (c) in the figure shows a severe defect image, and the quality inspection results for different products or items can be obtained according to the different degrees of defect severity.
[0052] Step S204: Using the trained quality detection model, perform quality detection on the object image data to obtain the quality detection result corresponding to the object image data. The trained quality detection model is obtained by supervised training of the second detection model based on the weight data and output probabilities of each convolutional layer of a pre-trained first detection model. The convolutional layers of the first and second detection models correspond one-to-one. The first detection model is trained on a pre-labeled standard dataset free of noise.
[0053] Specifically, by utilizing a trained quality inspection model, quality inspection is performed on the object image data to obtain defect confidence data corresponding to the object image data. The defect confidence data can be understood as the probability that the object image data to be inspected is a defective image. For example, a defect confidence data of 0.2 can be interpreted as a 20% probability that the object image data to be inspected is a defective image, and a defect confidence data of 0.8 can be interpreted as an 80% probability that the object image data to be inspected is a defective image.
[0054] Furthermore, after obtaining the defect confidence data corresponding to the item image data, a preset confidence threshold is obtained, and the defect confidence data and the preset confidence threshold are compared to generate a corresponding comparison result. If, according to the comparison result, the defect confidence data is greater than the preset confidence threshold, the quality inspection result corresponding to the item image data is determined to be a defective item. Conversely, if, according to the comparison result, the defect confidence data is not greater than the preset confidence threshold, the quality inspection result corresponding to the item image data is determined to be a normal item.
[0055] The preset reliability threshold can be set and adjusted according to the actual application scenario or actual needs. It is not limited to one or some specific values. It can be different values from 0 to 1, such as 0.4, 0.5, 0.6 and 0.7. Different values can be set according to the accuracy requirements of the actual application scenario.
[0056] For example, if the preset confidence threshold is 0.5, then if the defect confidence data is greater than the preset threshold of 0.5 (e.g., a defect confidence data of 0.6), the quality inspection result corresponding to the item image data is determined to be a defective item. Conversely, if the preset confidence threshold is also 0.5, then if the defect confidence data is not greater than the preset threshold of 0.5 (e.g., a defect confidence data of 0.3), the quality inspection result corresponding to the item image data is determined to be a normal item.
[0057] In one embodiment, such as Figure 4 As shown, this diagram illustrates how to obtain quality inspection results corresponding to item image data. Figure 4 It can be seen that by inputting the image data of the object to be detected into the trained quality detection model, the fully connected layer of the trained quality detection model outputs the defect confidence data corresponding to the image data of the object, and the quality detection result corresponding to the image data of the object is determined based on the comparison result of the defect confidence data and the preset confidence threshold.
[0058] Specifically, refer to Figure 4It can be seen that the preset confidence threshold can be set to 0.5. When the defect confidence data is greater than the preset confidence threshold of 0.5, the quality inspection result corresponding to the image data of the item is determined to be a defective item. If the defect confidence data is not greater than the preset confidence threshold of 0.5, the quality inspection result corresponding to the image data of the item is determined to be a normal item.
[0059] Furthermore, such as Figure 5 As shown, a comparison diagram of an OK image and a defective image is provided, for reference... Figure 5 It can be seen that after the image data of the item to be detected is input into the trained quality detection model, the fully connected layer of the trained quality detection model outputs the defect confidence data corresponding to the item image data. Then, based on the comparison result of the defect confidence data and the preset confidence threshold, the quality detection result corresponding to the item image data is determined.
[0060] Specifically, refer to Figure 5 It can be seen that, for example, if the preset confidence threshold is specifically set to 0.5, then the image data of a certain item to be detected ( Figure 5 The defect confidence score corresponding to Figure (a) is 0.05, and the image data of another item to be inspected ( Figure 5 In Figure (b), the defect confidence score is 0.95. Since 0.05 is less than the preset confidence threshold of 0.5, the image data of the item to be inspected with a defect confidence score of 0.05 is an OK image (i.e., its quality inspection result is a normal item). Similarly, since 0.95 is greater than the preset confidence threshold of 0.5, the image data of the item to be inspected with a defect confidence score of 0.95 is a defective image (i.e., its quality inspection result is a defective item).
[0061] In one embodiment, before performing quality detection on the image data of the object to be detected based on the trained quality detection model, the method further includes:
[0062] The first detection model is trained using a standard dataset containing pre-labeled, noise-free data. The second detection model is then trained under supervision using the weights and output probabilities of each convolutional layer of the first detection model, resulting in a well-trained quality detection model.
[0063] Since the convolutional layers of the first and second detection models correspond one-to-one, the weight data of each convolutional layer of the first detection model is used to supervise the training of the weight data of the convolutional layers in the second detection model that correspond one-to-one with the convolutional layers in the first detection model. This makes the weight data of each convolutional layer in the second detection model closer to the weight data of each convolutional layer in the first detection model. This allows the guiding information carried by the standard dataset without noise to be transmitted to the second detection model, thereby overcoming the performance impact caused by the traditional method of training the second detection model with noisy data.
[0064] In the aforementioned product quality inspection method, a first detection model is trained using a pre-labeled, noise-free standard dataset. The weights and output probabilities of each convolutional layer of the trained first detection model are then used to supervise the training of a second detection model, resulting in a trained quality inspection model. Further, by acquiring image data of the product to be inspected and utilizing the trained quality inspection model, quality inspection is performed on the product image data, quickly and accurately obtaining the corresponding quality inspection results. Since the convolutional layers of the first and second detection models correspond one-to-one, specifically, the weights of each convolutional layer of the trained first detection model are used to supervise the training of the weights of the corresponding convolutional layers in the second detection model. This allows the use of the convolutional layer weights and output probabilities of the first detection model, trained using a noise-free standard dataset, to supervise the training of the second detection model. This overcomes the performance limitations of traditional training methods using noisy data for the second detection model, enabling the trained quality inspection model to output stable and reliable quality inspection results, further improving the accuracy of product or product quality inspection results.
[0065] In one embodiment, such as Figure 6 As shown, the method for training the quality detection model specifically includes the following steps:
[0066] Step S602: Obtain the pre-labeled standard dataset and the training sample set with noise.
[0067] Specifically, the pre-labeled standard dataset can be understood as noise-free sample data that has been verified through multiple labeling processes, while the training sample set can be understood as randomly collected sample data containing noise. The number of samples in the noisy training sample set is... The number of samples in the standard dataset that does not contain noise is ,and Since the training samples in the standard dataset require multiple annotation and verification processes, they are more difficult to obtain than randomly acquired noisy sample data. Consequently, the number of samples in the noise-free standard dataset should be much smaller than the number of samples in the noisy training sample set.
[0068] The standard dataset without noise data is used to train each of the first convolutional layers and the first fully connected layers of the first detection model, so that each of the first convolutional layers and the first fully connected layers of the first detection model has reliable weight data without noise factors. The training sample set with noise is used to perform secondary weight updates on the first fully connected layer of the first detection model after training with the standard dataset. That is, when training the first detection model using the training sample set with noise, the weight data of each convolutional layer other than the first fully connected layer is fixed and not updated.
[0069] Furthermore, the training sample set carrying noise is also used to train the second detection model, specifically by updating the weight data of each second convolutional layer and the weight data of the second fully connected layer of the second detection model.
[0070] Step S604: Train the first detection model based on the standard dataset and training sample set to obtain the trained first detection model.
[0071] Specifically, based on the standard dataset, the weight data of each first convolutional layer and the first fully connected layer of the first detection model are updated, and the weights of the first fully connected layer of the first detection model are updated a second time using the training sample set to obtain the trained first detection model.
[0072] The first detection model consists of multiple convolutional layers and one fully connected layer. A standard dataset without noise data is used to train each of the first convolutional and first fully connected layers of the first detection model, updating the weight data of each first convolutional layer and the first fully connected layer. The training sample set is used to retrain the first fully connected layer of the first detection model, updating the weight data of the first fully connected layer again. After training the first fully connected layer and each of the first convolutional layers, the trained first detection model is obtained.
[0073] Furthermore, when training the first detection model using a standard dataset free of noise, a deep model iterative training approach is employed. This involves calculating the loss function (typically using cross-entropy for gradient inversion) on the first detection model using the standard dataset, and updating the model's weights via gradient inversion. Specifically, the model weights at the end of training the first detection model using the standard dataset free of noise are... It can be expressed by the following formula (1):
[0074] (1)
[0075] in, This represents sample data from a standard dataset. This indicates that the first detection model has undergone the previous... The model features after convolution processing in the first convolutional layer. This indicates that the first detection model has undergone the previous... The model parameters obtained after performing convolution processing on the first convolutional layer are... This indicates the number of the first convolutional layers that need to be trained (excluding the final first fully connected layer).
[0076] Furthermore, when the training of the first detection model is completed using a standard dataset without noise data, the weight data of all convolutional layers (except the first fully connected layer) of the first detection model are fixed, and the weights of the first fully connected layer of the first detection model are updated twice using the training sample set.
[0077] Similarly, when updating the weights of the first fully connected layer of the first detection model using the training sample set, the second detection model is trained simultaneously using the training sample set, thereby achieving collaborative training of the first and second detection models. This achieves the goal of information encoding and supervised training of the second detection model by utilizing the weight data of each first convolutional layer and the output probability of the first fully connected layer during the training process of the second detection model using the training sample set.
[0078] In one embodiment, such as Figure 7 As shown, a schematic diagram of the pre-training process of a first detection model is provided. Figure 7 It can be seen that by inputting a standard dataset without noise data into the first detection model, the first detection model can be pre-trained using the standard dataset without noise data. This means that the first convolutional layer and the first fully connected layer of the first detection model can be trained, and the output probability of the first fully connected layer and the loss function during the training process can be obtained.
[0079] Step S606: Obtain the weight data of each first convolutional layer and the output probability of the first fully connected layer of the trained first detection model.
[0080] Specifically, the weight data of each first convolutional layer of the trained first detection model is obtained, as well as the output probability of the first fully connected layer after the second weight update. The weight data of each first convolutional layer and the output probability of the first fully connected layer are used for information encoding and supervised training of the second detection model.
[0081] Step S608: Based on the training sample set, the weight data of each first convolutional layer, and the output probability of the first fully connected layer, perform information encoding and supervised training on the second detection model to obtain a well-trained quality detection model.
[0082] Specifically, the second detection model is trained based on the training sample set. During the training process, the weight data of each first convolutional layer and the output probability of the first fully connected layer are used to encode information and supervise training of the second detection model to obtain a well-trained quality detection model.
[0083] Furthermore, during the training process of the second detection model based on the training sample set, the weight data of each first convolutional layer of the first detection model are used simultaneously to encode information and supervise training each second convolutional layer of the second detection model. In addition, the output probability of the first fully connected layer of the first detection model is used to encode information and supervise training the output probability of the second connected layer of the second detection model. Thus, when the training termination condition is met, the second detection model at the end of training is determined to be the well-trained quality detection model.
[0084] Specifically, the training termination condition can be understood as the number of iterations of model training reaching a preset threshold, or the model loss function during model training reaching a preset loss function threshold. In other words, when the number of iterations of model training reaches the preset threshold, or the model loss function during model training reaches the preset loss function threshold, the model training is determined to be terminated, and the second detection model at the end of training is determined as the trained quality detection model.
[0085] In this embodiment, a pre-labeled standard dataset and a training sample set containing noise are obtained. The first detection model is trained using the standard dataset and the training sample set to obtain a trained first detection model. Then, by acquiring the weight data of each first convolutional layer and the output probability of the first fully connected layer of the trained first detection model, the second detection model is subjected to information encoding and supervised training based on the training sample set, the weight data of each first convolutional layer, and the output probability of the first fully connected layer, thereby obtaining a trained quality detection model. This achieves supervised training of the second detection model using the weight data of each first convolutional layer and the output probability of the first fully connected layer of the first detection model, as well as the training sample set. This overcomes the performance impact of traditional training methods using noisy data for the second detection model, allowing the trained quality detection model to output stable and reliable quality detection results.
[0086] In one embodiment, such as Figure 8 As shown, the steps for training the quality detection model, namely training the second detection model based on the training sample set, and during the training process of the second detection model based on the training sample set, using the weight data of each first convolutional layer and the output probability of the first fully connected layer to perform information encoding and supervised training on the second detection model to obtain the trained quality detection model, specifically include:
[0087] Step S802: Train the second detection model based on the training sample set, and update the weight data of each second convolutional layer and the weight data of the second fully connected layer of the second detection model.
[0088] Specifically, the second detection model is trained using a training sample set carrying noise, thereby updating the model weights of the second detection model. Specifically, the weight data of each second convolutional layer and the weight data of the second fully connected layer of the second detection model are updated.
[0089] Step S804: During the training process of the second detection model based on the training sample set, the weight data of each first convolutional layer of the trained first detection model is used to perform first-layer supervised training on the weight data of the second convolutional layer in the second detection model that corresponds one-to-one with the first convolutional layer.
[0090] Specifically, since each convolutional layer of the first detection model and the second detection model corresponds one-to-one, that is, each first convolutional layer is set with its corresponding second convolutional layer, during the training process of the second detection model based on the training sample set, the weight data of each first convolutional layer of the trained first detection model is further used to perform first-layer supervised training on the weight data of the second convolutional layer in the second detection model that corresponds one-to-one with the first convolutional layer.
[0091] Furthermore, during the first layer of supervised training, the first loss data is determined between the weight data of each first convolutional layer of the first detection model and the weight data of each second convolutional layer of the second detection model. The first loss data... Specifically, it is expressed by the following formula (2):
[0092] (2)
[0093] in, Represents the first in the training sample set One sample data, This represents the model features output by the first detection model. This represents the model features output by the second detection model. This represents the total number of features required for comparison within convolutional layers (i.e., the total number of convolutional layers, excluding the last fully connected layer, that can be used for comparison). The larger the value, the closer it is to the final fully connected layer, and thus the greater its supervisory role, allowing for more precise adjustments to the model parameters or weights of the second detection model.
[0094] Similarly, This indicates the number of convolutional layers used for the specific comparison, and can take different values. For example, it could be... If the value is 5, then it specifically compares the features of the outputs of the first 5 convolutional layers of the two models. If the value is 10, then it specifically compares the features output by the first 10 convolutional layers of the two models.
[0095] Step S806: Based on the output probability of the first fully connected layer, perform second-layer supervised training on the output probability of the second fully connected layer.
[0096] Specifically, the output probability of the first fully connected layer of the first detection model after secondary weight update is obtained, and the output probability of the second fully connected layer of the second detection model after training with the training sample set is obtained. Based on the output probability of the first fully connected layer, the output probability of the second fully connected layer is trained with a second layer of supervision.
[0097] Among them, the output probability of the first fully connected layer Output probability of the second fully connected layer Specifically, this is expressed by the following formulas (3) and (4):
[0098] (3)
[0099] (4)
[0100] in, Represents the first in the training sample set One sample data, This represents all sample data in the training sample set. This represents the model parameters of the first trained detection model. This represents the model parameters of the trained second detection model.
[0101] Furthermore, during the second layer of supervised training, the output probability of the first fully connected layer is determined. and the output probability of the second fully connected layer The second loss data between, the second loss data Specifically, it is expressed by the following formula (5):
[0102] (5)
[0103] in, Represents the first in the training sample set One sample data, This represents all sample data in the training sample set. Indicates the output probability of the first fully connected layer. This represents the output probability of the second fully connected layer. This represents the absolute difference between the output probability of the first fully connected layer and the output probability of the second fully connected layer.
[0104] In one embodiment, during the second layer of supervised training, the output probability of the first fully connected layer is determined. and the output probability of the second fully connected layer The second loss data can be obtained from other classification loss functions, not limited to the absolute value loss shown in formula (5), such as the L2 loss function (i.e., the average squared loss function).
[0105] Step S808: If it is determined that the model training termination condition has been met, the second detection model at the end of training is identified as the trained quality detection model.
[0106] Specifically, the total loss data is determined by acquiring the first loss data during the first layer of supervised training and the second loss data during the second layer of supervised training, based on the first loss data and the second loss data.
[0107] Furthermore, based on the first loss data and second loss data Determined total loss data Specifically, it is expressed by the following formula (6):
[0108] (6)
[0109] in, This refers to pre-determined balance parameters, which can be set and adjusted according to different application scenarios or actual needs, and are not limited to specific values. Represents the first in the training sample set One sample data, This represents all sample data in the training sample set, and the total loss data. Specifically, this involves analyzing multiple first-loss data. and multiplied by the balance parameter The second loss data The summation is then performed to obtain the total loss data. This is used to perform gradient backpropagation on the second detection model to update the model parameters of the second detection model, and finally obtain the trained quality detection model.
[0110] In one embodiment, after obtaining the total loss data, it is further determined whether the total loss data meets the model training termination condition. If it is determined that the total loss data meets the model training termination condition, the second detection model at the end of training is identified as the trained quality detection model.
[0111] Specifically, by obtaining a preset loss function threshold and comparing the preset loss function threshold with the total loss data, when the total loss data during model training reaches the preset loss function threshold, it is determined that the model training termination condition has been met, and the model training ends. Then, the second detection model at the end of training is determined as the trained quality detection model.
[0112] In one embodiment, such as Figure 9 As shown, a schematic diagram of the process for obtaining a quality inspection model is provided. Figure 9 It is known that the pre-labeled standard dataset, free of noise, is used to pre-train the first detection model, specifically to train each of the first convolutional and fully connected layers of the first detection model. This ensures that each of the first convolutional and fully connected layers of the first detection model has reliable weight data free of noise. The training sample set containing noise, on the other hand, is used to perform a secondary weight update on the first fully connected layer of the first detection model trained on the standard dataset. That is, when training the first detection model using the noisy training sample set, the weight data of all convolutional layers except the first fully connected layer remains fixed and is not updated.
[0113] Furthermore, referring to Figure 9 It can be seen that when the first fully connected layer of the first detection model is updated twice using the training sample set, the second detection model is trained simultaneously based on the training sample set. Specifically, the weight data of each second convolutional layer and the weight data of the second fully connected layer of the second detection model are updated to achieve collaborative training of the first and second detection models. This achieves the purpose of information encoding and supervised training of the second detection model by using the weight data of each first convolutional layer and the output probability of the first fully connected layer during the training process of the second detection model based on the training sample set.
[0114] Similarly, refer to Figure 9It can be seen that during the training process of the second detection model based on the training sample set, the weight data of each first convolutional layer of the first detection model is used simultaneously to perform first-layer supervised training on each second convolutional layer of the second detection model, and the output probability of the first fully connected layer of the first detection model is used to perform second-layer supervised training on the output probability of the second connected layer of the second detection model. Thus, when the training termination condition is determined, the second detection model at the end of training is determined as the well-trained quality detection model.
[0115] In the first layer of supervised training, the first loss data between the weight data of each first convolutional layer of the first detection model and the weight data of each second convolutional layer of the second detection model is determined. In the second layer of supervised training, the second loss data between the output probabilities of the first fully connected layer and the output probabilities of the second fully connected layer is determined. Based on the first and second loss data, the total loss data is then determined. This total loss data is used to update the model parameters of the second detection model until the model training termination condition is met. At this point, the second detection model at the end of training is considered a well-trained quality detection model.
[0116] In this embodiment, the second detection model is trained based on the training sample set. The weight data of each second convolutional layer and the weight data of the second fully connected layer in the second detection model are updated. During the training process, the weight data of each first convolutional layer of the trained first detection model is used to perform first-layer supervised training on the weight data of the second convolutional layers corresponding to the first convolutional layers in the second detection model. Furthermore, the output probabilities of the second fully connected layers are used to perform second-layer supervised training on the output probabilities of the first fully connected layers. Further, if the model training termination condition is met, the second detection model at the end of training is identified as the trained quality detection model. This achieves supervised training of the second detection model using the weight data of each first convolutional layer and the output probabilities of the first fully connected layer of the first detection model, as well as the training sample set. This overcomes the performance impact of traditional training methods using noisy data when using the convolutional layer weights and output probabilities of the first detection model trained on a standard dataset free of noise for supervised training of the second detection model. This allows the trained quality detection model to output stable and reliable quality detection results.
[0117] In one embodiment, such as Figure 10 As shown, the method for training the quality detection model specifically includes the following steps:
[0118] Step S1001: Obtain the pre-labeled standard dataset and the training sample set with noise.
[0119] Step S1002: Based on the standard dataset, update the weight data of each first convolutional layer and first fully connected layer of the first detection model, and use the training sample set to perform a secondary weight update on the first fully connected layer of the first detection model to obtain the trained first detection model.
[0120] Step S1003: Obtain the weight data of each first convolutional layer and the output probability of the first fully connected layer of the trained first detection model.
[0121] Step S1004: Train the second detection model based on the training sample set, and update the weight data of each second convolutional layer and the weight data of the second fully connected layer of the second detection model.
[0122] Step S1005: During the training process of the second detection model based on the training sample set, the weight data of each first convolutional layer of the trained first detection model is used to perform first-layer supervised training on the weight data of the second convolutional layer in the second detection model that corresponds one-to-one with the first convolutional layer.
[0123] Step S1006: Based on the output probability of the first fully connected layer, perform second-layer supervised training on the output probability of the second fully connected layer.
[0124] Step S1007: Obtain the first loss data during the first layer of supervised training and the second loss data during the second layer of supervised training.
[0125] Step S1008: Determine the total loss data based on the first loss data and the second loss data.
[0126] Step S1009: If it is determined that the total loss data has reached the end condition of model training, the second detection model at the end of training is determined as the trained quality detection model.
[0127] In this embodiment, supervised training of the second detection model is achieved using the weight data of each first convolutional layer and the output probability of the first fully connected layer of the first detection model, as well as the training sample set. This enables the supervised training of the second detection model using the convolutional layer weights and output probabilities of the first detection model trained with a standard dataset free of noise. This overcomes the performance impact of traditional training methods that use noisy data for the second detection model, allowing the trained quality detection model to output stable and reliable quality detection results.
[0128] In one embodiment, such as Figure 11 As shown, a method for inspecting the quality of an item is provided, which specifically includes the following steps:
[0129] Step S1101: Obtain the pre-labeled standard dataset and the training sample set with noise.
[0130] Step S1102: Based on the standard dataset, update the weight data of each first convolutional layer and first fully connected layer of the first detection model, and use the training sample set to perform a second weight update on the first fully connected layer of the first detection model to obtain the trained first detection model.
[0131] Step S1103: Train the second detection model based on the training sample set, and update the weight data of each second convolutional layer and the weight data of the second fully connected layer of the second detection model.
[0132] Step S1104: During the training process of the second detection model based on the training sample set, the weight data of each first convolutional layer of the trained first detection model is used to perform first-layer supervised training on the weight data of the second convolutional layer in the second detection model that corresponds one-to-one with the first convolutional layer.
[0133] Step S1105: During the training of the second detection model based on the training sample set, the output probability of the second fully connected layer is subjected to second-layer supervised training based on the output probability of the first fully connected layer.
[0134] Step S1106: Obtain the first loss data during the first layer of supervised training and the second loss data during the second layer of supervised training, and determine the total loss data based on the first loss data and the second loss data.
[0135] Step S1107: If the total loss data is determined to meet the model training termination condition, the second detection model at the end of training is determined as the trained quality detection model.
[0136] Step S1108: Obtain image data of the item to be detected.
[0137] Step S1109: Use the trained quality inspection model to perform quality inspection on the item image data to obtain defect confidence data corresponding to the item image data.
[0138] Step S1110: Obtain the preset confidence threshold, compare the defect confidence data with the preset confidence threshold, and generate the corresponding comparison result.
[0139] Step S1111: If, based on the comparison results, the defect confidence data is determined to be greater than the preset confidence threshold, the quality inspection result corresponding to the item image data is determined to be a defective item.
[0140] Step S1112: If, based on the comparison results, it is determined that the defect confidence data is not greater than the preset confidence threshold, the quality inspection result corresponding to the item image data is determined to be a normal item.
[0141] In the aforementioned product quality inspection method, a first detection model is trained using a pre-labeled, noise-free standard dataset. The weights and output probabilities of each convolutional layer of the trained first detection model are then used to supervise the training of a second detection model, resulting in a trained quality inspection model. Further, by acquiring image data of the product to be inspected and utilizing the trained quality inspection model, quality inspection is performed on the product image data, quickly and accurately obtaining the corresponding quality inspection results. Since the convolutional layers of the first and second detection models correspond one-to-one, specifically, the weights of each convolutional layer of the trained first detection model are used to supervise the training of the weights of the corresponding convolutional layers in the second detection model. This allows the use of the convolutional layer weights and output probabilities of the first detection model, trained using a noise-free standard dataset, to supervise the training of the second detection model. This overcomes the performance limitations of traditional training methods using noisy data for the second detection model, enabling the trained quality inspection model to output stable and reliable quality inspection results, further improving the accuracy of product or product quality inspection results.
[0142] It should be understood that although the steps in the flowcharts of the above embodiments are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the above embodiments may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.
[0143] Based on the same inventive concept, this application also provides an article quality inspection device for implementing the article quality inspection method described above. The solution provided by this device is similar to the solution described in the above method; therefore, the specific limitations in one or more articles quality inspection device embodiments provided below can be found in the limitations of the article quality inspection method described above, and will not be repeated here.
[0144] In one embodiment, such as Figure 12As shown, a product quality inspection device is provided, including: a product image data acquisition module 1202 and a quality inspection result generation module 1204, wherein:
[0145] The item image data acquisition module 1202 is used to acquire the item image data to be detected.
[0146] The quality detection result generation module 1204 is used to perform quality detection on the object image data using a trained quality detection model, and obtain the quality detection result corresponding to the object image data. The trained quality detection model is obtained by supervised training of a second detection model based on the weight data and output probabilities of each convolutional layer of a pre-trained first detection model. The convolutional layers of the first and second detection models correspond one-to-one. The first detection model is trained on a pre-labeled standard dataset free of noise.
[0147] In the aforementioned product quality inspection device, a first detection model is trained using a pre-labeled, noise-free standard dataset. The weights and output probabilities of each convolutional layer of the trained first detection model are then used to supervise the training of a second detection model, resulting in a trained quality inspection model. Further, by acquiring image data of the product to be inspected and utilizing the trained quality inspection model, quality inspection is performed on the product image data, quickly and accurately obtaining the corresponding quality inspection results. Since the convolutional layers of the first and second detection models correspond one-to-one, specifically, the weights of each convolutional layer of the trained first detection model are used to supervise the training of the weights of the corresponding convolutional layers in the second detection model. This overcomes the performance limitations of traditional training methods using noisy data for the second detection model, allowing the trained quality inspection model to output stable and reliable quality inspection results, further improving the accuracy of product or product quality inspection results.
[0148] In one embodiment, a quality detection model training module is provided, including:
[0149] The first acquisition module is used to acquire a pre-labeled standard dataset and a training sample set with noise.
[0150] The first detection model training module is used to train the first detection model based on the standard dataset and the training sample set to obtain the trained first detection model.
[0151] The second acquisition module is used to acquire the weight data of each first convolutional layer and the output probability of the first fully connected layer of the trained first detection model;
[0152] The supervised training module is used to encode information and supervise training of the second detection model based on the training sample set, the weight data of each first convolutional layer, and the output probability of the first fully connected layer, so as to obtain a well-trained quality detection model.
[0153] In one embodiment, the first detection model training module is further configured to: update the weight data of each first convolutional layer and first fully connected layer of the first detection model according to a standard dataset, and perform a secondary weight update on the first fully connected layer of the first detection model using a training sample set to obtain a trained first detection model.
[0154] In one embodiment, the supervised training module is further configured to: train the second detection model according to the training sample set, and during the training process of the second detection model according to the training sample set, use the weight data of each first convolutional layer and the output probability of the first fully connected layer to perform information encoding and supervised training on the second detection model to obtain a trained quality detection model.
[0155] In one embodiment, the supervised training module is further configured to: train the second detection model according to the training sample set, and update the weight data of each second convolutional layer and the weight data of the second fully connected layer of the second detection model; during the training of the second detection model according to the training sample set, use the weight data of each first convolutional layer of the trained first detection model to perform first-layer supervised training on the weight data of the second convolutional layers in the second detection model that correspond one-to-one with the first convolutional layers; perform second-layer supervised training on the output probability of the second fully connected layer according to the output probability of the first fully connected layer; and if it is determined that the model training termination condition has been met, determine the second detection model at the end of training as the trained quality detection model.
[0156] In one embodiment, the supervised training module is further configured to: acquire first loss data during the first layer of supervised training and second loss data during the second layer of supervised training; determine total loss data based on the first loss data and the second loss data; and if the total loss data is determined to meet the model training termination condition, determine the second detection model at the end of training as the trained quality detection model.
[0157] In one embodiment, the quality inspection result generation module is further configured to: perform quality inspection on the item image data using a trained quality inspection model to obtain defect confidence data corresponding to the item image data; obtain a preset confidence threshold and compare the defect confidence data with the preset confidence threshold to generate a corresponding comparison result; if, based on the comparison result, it is determined that the defect confidence data is greater than the preset confidence threshold, the quality inspection result corresponding to the item image data is determined to be a defective item; if, based on the comparison result, it is determined that the defect confidence data is not greater than the preset confidence threshold, the quality inspection result corresponding to the item image data is determined to be a normal item.
[0158] Each module in the aforementioned product quality inspection device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as software, so that the processor can call and execute the corresponding operations of each module.
[0159] In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 13 As shown, the computer device includes a processor, memory, input / output (I / O) interfaces, and a communication interface. The processor, memory, and I / O interfaces are connected via a system bus, and the communication interface is also connected to the system bus via the I / O interfaces. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides the environment for the operating system and computer programs stored in the non-volatile storage media. The database stores image data of the object to be detected, a trained quality detection model, quality detection results, a first detection model, weight data and output probabilities of each convolutional layer of the first detection model, a second detection model, and a standard dataset. The I / O interfaces are used for exchanging information between the processor and external devices. The communication interface is used for communication with external terminals via a network connection. When the computer program is executed by the processor, it implements an object quality detection method.
[0160] Those skilled in the art will understand that Figure 13 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0161] In one embodiment, a computer device is also provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above method embodiments.
[0162] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon that, when executed by a processor, implements the steps in the above method embodiments.
[0163] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in the above method embodiments.
[0164] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of related data must comply with the relevant laws, regulations and standards of the relevant countries and regions.
[0165] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments described above. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.
[0166] The technical features of the above embodiments can be combined in any way. For the sake of brevity, 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.
[0167] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.
Claims
1. A method for inspecting the quality of goods, characterized in that, The method includes: Acquire image data of the item to be detected; Using a trained quality detection model, the object image data is subjected to quality detection to obtain defect confidence data corresponding to the object image data. Based on the comparison result between the defect confidence data and a preset confidence threshold, the quality detection result corresponding to the object image data is determined. The defect confidence data represents the probability that the object image data to be detected belongs to a defective image. The methods for training the quality detection model include: Obtain a pre-labeled standard dataset without noise and a training sample set with noise; based on the standard dataset, update the weight data of each first convolutional layer and first fully connected layer of the first detection model, and use the training sample set to perform a secondary weight update on the first fully connected layer of the first detection model to obtain a trained first detection model; obtain the weight data of each first convolutional layer and the output probability of the first fully connected layer of the trained first detection model; train a second detection model based on the training sample set, and during the training process of the second detection model based on the training sample set, use the weight data of each first convolutional layer and the output probability of the first fully connected layer to perform information encoding and supervised training on the second detection model, and transmit the guiding information carried by the standard dataset without noise to the second detection model to obtain a trained quality detection model; the convolutional layers of the first detection model and the second detection model correspond one-to-one.
2. The method according to claim 1, characterized in that, The step of training the second detection model based on the training sample set, and during the training process, using the weight data of each first convolutional layer and the output probability of the first fully connected layer to perform information encoding and supervised training on the second detection model to obtain a trained quality detection model, includes: The second detection model is trained based on the training sample set, and the weight data of each second convolutional layer and the weight data of the second fully connected layer of the second detection model are updated. During the training process of the second detection model based on the training sample set, the weight data of each first convolutional layer of the trained first detection model are used to perform first-layer supervised training on the weight data of the second convolutional layer in the second detection model that corresponds one-to-one with the first convolutional layer. Based on the output probability of the first fully connected layer, the output probability of the second fully connected layer is trained using a second layer of supervised training. If the model training termination condition is met, the second detection model at the end of training will be identified as the well-trained quality detection model.
3. The method according to claim 2, characterized in that, If the model training termination condition is determined to be met, the second detection model at the end of training will be identified as the trained quality detection model, including: Obtain the first loss data during the first layer of supervised training and the second loss data during the second layer of supervised training; Based on the first loss data and the second loss data, the total loss data is determined; If the total loss data is determined to meet the model training termination condition, the second detection model at the end of training is determined as the trained quality detection model.
4. The method according to claim 1 or 2, characterized in that, The step of determining the quality inspection result corresponding to the item image data based on the comparison result between the defect confidence data and the preset confidence threshold includes: Obtain a preset confidence threshold, and compare the defect confidence data with the preset confidence threshold to generate a corresponding comparison result; If, based on the comparison results, it is determined that the defect confidence data is greater than the preset confidence threshold, the quality inspection result corresponding to the item image data is determined to be a defective item. If, based on the comparison results, it is determined that the defect confidence data is not greater than the preset confidence threshold, the quality inspection result corresponding to the item image data is determined to be a normal item.
5. A product quality inspection device, characterized in that, The device includes: The item image data acquisition module is used to acquire image data of the item to be detected; The quality inspection result generation module is used to perform quality inspection on the item image data using a trained quality inspection model, obtain defect confidence data corresponding to the item image data, and determine the quality inspection result corresponding to the item image data based on the comparison result of the defect confidence data and a preset confidence threshold; the defect confidence data represents the probability that the item image data to be inspected belongs to a defective image. The quality detection model training module includes: a first acquisition module, used to acquire a pre-labeled standard dataset without noise data and a training sample set with noise; a first detection model training module, used to update the weight data of each first convolutional layer and first fully connected layer of the first detection model according to the standard dataset, and to perform a secondary weight update on the first fully connected layer of the first detection model using the training sample set to obtain a trained first detection model; a second acquisition module, used to acquire the weight data of each first convolutional layer and the output probability of the first fully connected layer of the trained first detection model; and a supervised training module, used to train a second detection model according to the training sample set, and during the training process of the second detection model according to the training sample set, to perform information encoding and supervised training on the second detection model using the weight data of each first convolutional layer and the output probability of the first fully connected layer, and to transmit the guiding information carried by the standard dataset without noise data to the second detection model to obtain a trained quality detection model; the convolutional layers of the first detection model and the second detection model correspond one-to-one.
6. The apparatus according to claim 5, characterized in that, The supervised training module is also used for: Based on the training sample set, the second detection model is trained, and the weight data of each second convolutional layer and the weight data of the second fully connected layer of the second detection model are updated. During the training of the second detection model based on the training sample set, the weight data of each first convolutional layer of the first detection model is used to perform first-layer supervised training on the weight data of the second convolutional layers in the second detection model that correspond one-to-one with the first convolutional layers. Based on the output probability of the first fully connected layer, the output probability of the second fully connected layer is used to perform second-layer supervised training. If it is determined that the model training termination condition has been met, the second detection model at the end of training is determined as the trained quality detection model.
7. The apparatus according to claim 5, characterized in that, The supervised training module is also used for: Obtain the first loss data during the first layer of supervised training and the second loss data during the second layer of supervised training; determine the total loss data based on the first loss data and the second loss data; If the total loss data is determined to meet the model training termination condition, the second detection model at the end of training is determined as the trained quality detection model.
8. The apparatus according to claim 5 or 6, characterized in that, The quality inspection result generation module is also used for: A preset confidence threshold is obtained, and the defect confidence data is compared with the preset confidence threshold to generate a corresponding comparison result; if the comparison result determines that the defect confidence data is greater than the preset confidence threshold, the quality detection result corresponding to the item image data is determined to be a defective item. If, based on the comparison results, it is determined that the defect confidence data is not greater than the preset confidence threshold, the quality inspection result corresponding to the item image data is determined to be a normal item.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 4.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 4.
11. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 4.
Citation Information
Patent Citations
Industrial defect detection method, device and equipment and readable storage medium
CN115239638A