Training and Selection Methods and Devices for Models Used in Product Defect Location
By combining product records into multiple data sets according to their attributes and training the model based on these data sets, the problem of poor model prediction effect in intelligent IoT scenarios is solved, and the prediction accuracy of the model is improved.
Patent Information
- Application Number
- CN201911320222.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-12-19
- Publication Date
- 2025-06-10
- Estimated Expiration
- 2039-12-19
AI Technical Summary
In the intelligent Internet of Things scenario, it is difficult for a model to extract common features that are suitable for each device, resulting in poor prediction results of the trained model.
By acquiring multiple product records, combining them into at least two data sets based on at least one attribute, a data set whose number of product records in the data set is greater than or equal to the first threshold, and the model is trained based on the data set. This model is used to reason about other product records and determine whether the product has defects.
Improve product records of various target attributes to train a model together, avoiding the problem of poor model prediction effect, and improving the prediction accuracy of the training model.
Smart Images

Figure CN113011690B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of artificial intelligence technology, and particularly to a method and device for training and selecting a model for product defect location. Background Art
[0002] Machine learning is a way to achieve artificial intelligence, and machine learning algorithms are the core of machine learning. A machine learning algorithm is an algorithm that automatically analyzes rules from data (i.e., trains a model based on sample data) and uses the trained model to predict unknown data. Thus, machine learning is inseparable from data.
[0003] Currently, in the intelligent Internet of Things scenario, when training a model based on the data collected by sensors installed on each device, it mainly includes: training a model on all the data collected by sensors installed on multiple devices and outputting a model. Then, the model is sent to each of the multiple devices for predicting the output of the device (for example, a model trained using the printing characteristics of a printing press is used to predict whether the printing quality is qualified). Due to the different working environments, device models, manufacturers, etc. of each device, in actual application, a single model often fails to extract general features suitable for each device, resulting in poor prediction performance of the trained model. Summary of the Invention
[0004] Embodiments of this application provide a method and device for training and selecting a model for product defect location, which helps to improve the prediction accuracy of the model.
[0005] To achieve the above object, embodiments of this application adopt the following technical solutions:
[0006] First aspect, a training method for a model for product defect location is provided. The method includes: obtaining multiple product records, where each product record includes data of one or more attributes of a product. Based on at least one attribute, merging the multiple product records into at least two data sets. Determining a first data set in which the number of product records in at least two data sets is greater than or equal to a first threshold. Training a model according to the product records in the first data set. The model is used to infer other product records to determine whether the products corresponding to the other product records are defective. Among them, the other product records are product records composed of data with the same attributes as the product records participating in the training, and the other product records do not include data indicating whether the products corresponding to the product records are defective. The data of one or more attributes in the product records participating in the training can indicate whether the products corresponding to the product records are defective. In this way, by merging product records based on at least one attribute to obtain data sets and training the product records in the data set where the number of product records is greater than or equal to the first threshold to obtain a model, on the one hand, it improves the problem of poor prediction effect of the model caused by training a model with product records of various target attributes together. On the other hand, it makes the number of models participating in the training greater than or equal to the first threshold, thereby improving the prediction accuracy of the trained model.
[0007] According to the first aspect, in the first possible implementation manner of the first aspect, the data of the attributes used to merge the multiple product records in each product record included in at least two data sets is the same.
[0008] According to the first aspect, in the second possible implementation manner of the first aspect, the data of the attributes used to merge the multiple product records in one or more data sets included in at least two data sets is different and the similarity is greater than or equal to a second threshold.
[0009] According to the first aspect, the first possible implementation manner of the first aspect, or the second possible implementation manner of the first aspect, in the third possible implementation manner of the first aspect, the method further includes: determining a second data set in at least two data sets where the number of product records is less than a first threshold. Obtaining a target data set from the data sets other than the second data set among the at least two data sets. The similarity between the first data in the target data set and the second data in the second data set is greater than or equal to a second threshold. Wherein, the first data is the data of the attribute used to merge multiple product records in the product records of the target data set. The second data is the data of the attribute used to merge multiple product records in the product records of the second data set. Merging the product records in the second data set with the product records in the target data set into a first data set. In this way, when the number of product records in the second data set is less than the first threshold, the target data set and the second data set can be merged to obtain the first data set. Wherein, the number of product records in the first data set is greater than or equal to the first threshold. In this way, it helps to improve the prediction accuracy of the trained model.
[0010] According to the third possible implementation manner of the first aspect, in the fourth possible implementation manner of the first aspect, the similarity between the data of the attribute used to merge multiple product records in the product records of the target data set and the data of the attribute used to merge multiple product records in the product records of the second data set includes: at least one of the edit distance, Euclidean distance, or custom distance between the data of the attribute used to merge multiple product records in the product records of the target data set and the data of the attribute used to merge multiple product records in the product records of the second data set. In this way, the selected attributes for merging product records make the product records participating in training have similar attributes, which helps to improve the prediction accuracy of the trained model.
[0011] According to the first aspect, the first possible implementation manner of the first aspect, the second possible implementation manner of the first aspect, the third possible implementation manner of the first aspect, or the fourth possible implementation manner of the first aspect, in the fifth possible implementation manner of the first aspect, the method further includes: using a feature selection algorithm to select the attributes for merging product records from one or more attributes included in multiple product records. Or, receiving indication information, where the indication information includes the attributes for merging product records. The selected attributes for merging product records in this way make the product records participating in training have similar attributes, which helps to improve the prediction accuracy of the trained model.
[0012] According to the fifth possible implementation manner of the first aspect, in the sixth possible implementation manner of the first aspect, the feature selection algorithm includes a greedy search algorithm, a decision tree algorithm, a filtering algorithm, a random forest algorithm, or an exhaustive algorithm.
[0013] According to any one of the first aspect or the first to sixth possible implementation manners of the first aspect, in the seventh possible implementation manner of the first aspect, training a model based on product records in a first dataset includes: training the product records in the first dataset using a machine learning algorithm to obtain a model. Wherein, the first threshold is greater than or equal to the minimum value of the number of product records participating in training preset in the machine learning algorithm. In this way, the number of product records participating in training can be guaranteed, thereby improving the prediction accuracy of the trained model.
[0014] In a second aspect, a method for training a model for product defect location is provided. The method includes: obtaining a plurality of product records, each product record including data of one or more attributes of a product. Based on at least one of the one or more attributes, merging the plurality of product records into at least two datasets. Determining a first dataset in which the number of product records in the at least two datasets is greater than or equal to a first threshold. Training a model based on the product records in the first dataset. The model is used to reason about other product records. Wherein, the other product records are product records composed of data with the same attributes as the product records participating in training, and the other product records do not include data representing prediction results. The data of one or more attributes in the product records participating in training can represent prediction results. In this way, datasets are obtained by merging product records based on at least one attribute, and the product records in the dataset where the number of product records participating in training is greater than or equal to the first threshold are trained to obtain a model. On the one hand, the problem of poor prediction effect of the model caused by training a model with product records of various target attributes together is improved. On the other hand, the number of product records participating in training the model is greater than or equal to the first threshold, thereby improving the prediction accuracy of the trained model.
[0015] For various possible implementation manners of the second aspect, specifically refer to the first aspect and various possible implementation manners of the first aspect, which will not be elaborated here.
[0016] In a third aspect, a method for selecting a model for product defect location is provided. The method includes: obtaining a first product record. The first product record includes data of one or more attributes of a product. Obtaining data of a target attribute in the first product record. Selecting a first model from a plurality of models. Each model in the plurality of models is used to reason about a product record to determine whether the product corresponding to the product record has a defect, and the data of the target attribute of different models is different. The similarity between the data of the target attribute in the first product record and the data of the target attribute of the first model is greater than or equal to the similarity between the data of the target attribute in the first product record and other data. The other data is the data of the target attribute of the plurality of models except the data of the target attribute of the first model. The first model selected in this way has a higher prediction accuracy when predicting the first product record.
[0017] Fourthly, a method for selecting a model for product defect location is provided. The method includes: obtaining a first product record. The first product record includes data of one or more attributes of a product. Obtaining the data of the target attribute in the first product record. Selecting a first model from multiple models. Each of the multiple models is used to reason about the product record to obtain a prediction result of the product record, and the data of the target attribute of different models is different. The similarity between the data of the target attribute in the first product record and the data of the target attribute of the first model is greater than or equal to the similarity between the data of the target attribute in the first product record and other data. The other data is the data of the target attribute of the multiple models except the data of the target attribute of the first model. The first model selected in this way has a higher prediction accuracy when predicting the first product record.
[0018] Fifthly, a model training device for product defect location is provided. The model training device can be used to execute any method provided in any of the above-mentioned first aspects or any possible implementation manner of the first aspect, any method provided in any of the second aspects or any possible implementation manner of the second aspect. Exemplarily, the model training device can be a computer device (such as a terminal device or a server) or a chip, etc.
[0019] According to the fifth aspect, in the first possible implementation manner of the fifth aspect, the device can be divided into functional modules according to any method provided in the above-mentioned first aspect. For example, each functional module can be corresponding to each function, or two or more functions can be integrated into one processing module. Another example is that on the basis that the device includes a processing module, a transceiver module can also be included for sending and receiving data between the device and other devices (or equipment), and the transceiver module can include a sending module and / or a receiving module.
[0020] According to the fifth aspect and the first possible implementation manner of the fifth aspect, in the second possible implementation manner of the fifth aspect, the device can include a processor and a transceiver. The processor is used to execute any method provided in the above-mentioned first aspect, and the transceiver is used for the device to communicate with other devices (or equipment).
[0021] Sixthly, a computer-readable storage medium is provided, such as a non-transitory computer-readable storage medium. A computer program (or instruction) is stored thereon. When the computer program (or instruction) runs on a computer, the computer is enabled to execute any method provided in the above-mentioned first aspect or any possible implementation manner of the first aspect, the second aspect or any possible implementation manner of the second aspect.
[0022] In a seventh aspect, a selection device for a model for product defect location is provided. The device can be used to execute any of the methods provided in the above-mentioned third aspect or any possible implementation manner of the third aspect, the fourth aspect or any possible implementation manner of the fourth aspect. Exemplarily, the device can be a computer device (such as a terminal device or a server), a chip, or the like.
[0023] According to the seventh aspect, in a first possible implementation manner of the seventh aspect, the device can be divided into functional modules according to any of the methods provided in the above-mentioned third aspect or any possible implementation manner of the third aspect, the fourth aspect or any possible implementation manner of the fourth aspect. For example, each functional module can be corresponding to each function, or two or more functions can be integrated into one processing module. Also, on the basis that the device includes a processing module, a transceiver module can be further included for sending and receiving data between the device and other devices (or equipment). The transceiver module can include a sending module and / or a receiving module.
[0024] According to the seventh aspect and the first possible implementation manner of the seventh aspect, in a second possible implementation manner of the sixth aspect, the device can include a processor and a transceiver. The processor is used to execute any of the methods provided in the above-mentioned third aspect or any possible implementation manner of the third aspect, the fourth aspect or any possible implementation manner of the fourth aspect, and the transceiver is used for the device to communicate with other devices (or equipment).
[0025] In an eighth aspect, a computer-readable storage medium is provided, such as a non-transitory computer-readable storage medium. A computer program (or instruction) is stored thereon. When the computer program (or instruction) runs on a computer, the computer is enabled to execute any of the methods provided in the above-mentioned third aspect or any possible implementation manner of the third aspect, the fourth aspect or any possible implementation manner of the fourth aspect.
[0026] In a ninth aspect, a computer program product is provided. When it runs on a computer, any of the methods provided in the first aspect or any possible implementation manner of the first aspect, the second aspect or any possible implementation manner of the second aspect is enabled to be executed.
[0027] In a tenth aspect, a computer program product is provided. When it runs on a computer, any of the methods provided in the third aspect or any possible implementation manner of the third aspect, the fourth aspect or any possible implementation manner of the fourth aspect is enabled to be executed.
[0028] In an eleventh aspect, a chip is provided, including: a processor and an interface for calling and running a computer program stored in a memory from the memory and executing any of the methods provided in the first aspect to the fourth aspect.
[0029] It is understandable that any of the training device for the model for product defect location, the selection device for the model for product defect location, the computer-readable storage medium, the computer program product, or the chip provided above can be applied to the corresponding method provided above. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding method, and will not be elaborated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] Figure 1 FIG. is a schematic structural diagram of a computer device provided by an embodiment of the present application;
[0031] Figure 2 FIG. is a schematic structural diagram of a computer system applicable to an embodiment of the present application;
[0032] Figure 3 FIG. is a schematic flowchart of a method for training a model for product defect location provided by an embodiment of the present application;
[0033] Figure 4 FIG. is a schematic diagram of the process of a computer device training multiple models according to multiple product records in an embodiment of the present application;
[0034] Figure 5 FIG. is a schematic flowchart of a method for selecting a model for product defect location provided by an embodiment of the present application;
[0035] Figure 6 FIG. is a schematic diagram of the process of a method for selecting a model applied to a model test scenario provided by an embodiment of the present application;
[0036] Figure 7 FIG. is a schematic structural diagram of a training device for a model for product defect location provided by an embodiment of the present application;
[0037] Figure 8 FIG. is a schematic structural diagram of a selection device for a model for product defect location provided by an embodiment of the present application. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0038] As Figure 1 shown, FIG. is a schematic structural diagram of a computer device applicable to an embodiment of the present application. The computer device 100 includes at least one processor 101, a communication line 102, a memory 103, and at least one communication interface 104.
[0039] The processor 101 may be a general-purpose central processing unit (CPU), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits for controlling the execution of the program of the solution of the present application.
[0040] The communication line 102 may include a path for transmitting information between the above components.
[0041] The communication interface 104 uses any device such as a transceiver to communicate with other devices or communication networks, such as Ethernet, RAN, wireless local area networks (WLAN), etc.
[0042] The memory 103 may be a read-only memory (ROM) or other type of static storage device that can store static information and instructions, a random access memory (RAM) or other type of dynamic storage device that can store information and instructions, or may also be an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compact discs, laser discs, optical discs, digital versatile discs, Blu-ray discs, etc.), magnetic disk storage media or other magnetic storage devices, or any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto. The memory may exist independently and be connected to the processor through the communication line 102. The memory may also be integrated with the processor. The memory provided in the embodiments of the present application generally may have non-volatility. Among them, the memory 103 is used to store the computer execution instructions for executing the solution of the present application, and is controlled by the processor 101 to execute. The processor 101 is used to execute the computer execution instructions stored in the memory 103, so as to implement the method provided in the following embodiments of the present application.
[0043] Optionally, the computer execution instructions in the embodiments of the present application may also be referred to as application code, and the embodiments of the present application do not make specific limitations thereto.
[0044] In a specific implementation, as an embodiment, the processor 101 may include one or more CPUs, such as Figure 1 CPU0 and CPU1 in
[0045] In a specific implementation, as an example, the computer device 100 may include multiple processors, such as Figure 1 the processor 101 and the processor 107 in []. Each of these processors can be a single-CPU processor or a multi-CPU processor. The processor here can refer to one or more devices, circuits, and / or processing cores for processing data (such as computer program instructions).
[0046] In a specific implementation, as an example, the computer device 100 may further include an output device 105 and an input device 106. The output device 105 communicates with the processor 101 and can display information in various ways. For example, the output device 105 can be a liquid crystal display (LCD), a light emitting diode (LED) display device, a cathode ray tube (CRT) display device, or a projector, etc. The input device 106 communicates with the processor 101 and can receive user input in various ways. For example, the input device 106 can be a mouse, a keyboard, a touch screen device, or a sensing device, etc.
[0047] The above-mentioned computer device 100 can be a general-purpose device or a special-purpose device. In a specific implementation, the computer device 100 can be a desktop computer, a laptop computer, a network server, a personal digital assistant (PDA), a mobile phone, a tablet computer, a wireless terminal device, an embedded device, or a device with a similar structure in []. The embodiments of the present application do not limit the type of the computer device 100. Figure 1 In [].
[0048] As Figure 2 shown, it is a schematic structural diagram of a computer system applicable to the embodiments of the present application. Among them, the computer system may include a computer device 201 and multiple external devices 202 directly or indirectly connected to the computer device 201. Figure 2 In [], the external devices 202-1, 202-2, and 202-3 belong to the devices on the first production line. The external devices 202-4 and 202-5 belong to the devices on the second production line.
[0049] The computer device 201 is used to train a model. And use the trained model to predict the results of the data sent by the external device 202 to the computer device 201. And send instructions to the control device in the external device 202 according to the prediction results, so that the device makes response actions according to different prediction results.
[0050] External device 202 includes sensors, terminal devices, control devices, etc. Among them, the sensors and terminal devices are used to collect data on the production line (such as the model information of the equipment for producing products and the attribute information of the products produced). The control device is used to receive instructions from the computer device 201 and make response actions according to the instructions. Exemplarily, the control device can label the produced products with different labels or place them in different areas according to different prediction results.
[0051] The following explains some of the terms involved in this application:
[0052] 1), Product records, attributes, data of target attributes, other product records
[0053] A product record includes data of one or more attributes of the product.
[0054] In one example, multiple product records used to train the model can be as shown in Table 1 below:
[0055] Table 1
[0056]
[0057]
[0058] The data in the first row of Table 1 are the attributes of the data. For example: the attribute of the data in the first column of Table 1 is the equipment model, the attribute of the data in the second column is the length, and the other columns are similar.
[0059] Each row of data other than the first row in Table 1 is a product record. For example, the second row of data in Table 1, "CR57LPUF480B-C-T, 0.56, 0.56, 0.0005, 0.0017, 35.1068, -0.0739, unqualified", is a product record. Among them, the attribute of "CR57LPUF480B-C-T" is the equipment model, and the attribute of "unqualified" is the quality inspection result.
[0060] The data of the target attribute is the data in the column of the product record whose attribute is the target attribute. Exemplarily, if the target attribute selected from the product records in Table 1 is the equipment model, then the data of the target attribute of the product record in the second row is "CR57LPUF480B-C-T".
[0061] Multiple product records in Table 1 can be used to train a model for predicting the quality inspection results of solder paste printing products based on the attribute information of the solder paste printing products and the equipment model.
[0062] Other product records are product records composed of data having the same attributes as the product records participating in the training, and the product records do not include data characterizing whether the product corresponding to the product record has defects. The data with the attribute of quality inspection result in Table 1 is used to characterize whether the product corresponding to the product record has defects. Among them, "qualified" is used to characterize that the product corresponding to the product record does not have defects, and "unqualified" is used to characterize that the product corresponding to the product record has defects. The data having the same attributes as the product records participating in the training means that the number of attributes included is the same as that of the product records participating in the training, and the meanings of the included attributes are the same. Based on the examples of multiple product records in Table 1. Suppose multiple product records in Table 1 participate in training a model, then "CR57LPUF480B-C-T, 0.57, 0.57, 0.0006, 0.0017, 35.1068, -0.0739" is an other product record, where the attribute of "CR57LPUF480B-C-T" is device model, the attribute of "0.57" is length, the attribute of "0.57" is width, the attribute of "0.0006" is volume, the attribute of "0.0017" is area, the attribute of "35.1068" is height, and the attribute of "-0.0739" is offset. The other product record does not include data with the attribute of quality inspection result.
[0063] 2), The first dataset, the second dataset
[0064] In the embodiments of the present application, the first dataset refers to a dataset in which the number of product records in the dataset is greater than or equal to the first threshold. The second dataset refers to a dataset in which the number of product records in the dataset is less than the first threshold.
[0065] 3), Other terms
[0066] In the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or explanations. Any embodiment or design solution described as "exemplary" or "for example" in the embodiments of the present application should not be construed as being more preferred or more advantageous than other embodiments or design solutions. Rather, the use of words such as "exemplary" or "for example" is intended to present relevant concepts in a specific manner.
[0067] In the embodiments of the present application, "at least one" means one or more. "Multiple" means two or more.
[0068] In the embodiments of the present application, "and / or" is merely a description of the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B may represent: A exists alone, A and B exist simultaneously, and B exists alone. In addition, the character " / " in this article generally represents an "or" relationship between the front and back associated objects.
[0069] The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present application without creative efforts shall fall within the protection scope of the present application.
[0070] Embodiment 1
[0071] As Figure 3 shown, it is a schematic flowchart of a method for training a model for product defect location provided by an embodiment of the present application. Exemplarily, this embodiment can be applied to Figure 2 the system architecture shown. Figure 3 The method shown can include the following steps:
[0072] S101: The computer device obtains M product records. M is an integer greater than or equal to 1. Each product record includes data of one or more attributes of a product. Each of the M product records has the same number of columns, and the data in the same columns has the same attributes. Among them, the data includes data for characterizing the prediction result and data for judging the prediction result.
[0073] Exemplarily, taking the training of a model for predicting the quality inspection results of solder paste printing products as an example, the product records required for training the model may include data for characterizing the prediction result (such as the data in the last column of Table 1) and data for judging the prediction result. Among them, the data for judging the prediction result includes at least one of the equipment information (such as equipment model) of the equipment for producing the target product (such as solder paste product), the application information of the target product (such as the circuit board model where the solder paste is located, the component information of the solder paste such as type, shape, size, position, etc.), and the attribute information of the solder paste product (such as length, width, volume, area, height, offset, etc.).
[0074] S102: The computer device obtains the target attribute. The target attribute is the attribute used to merge multiple product records to obtain a data set.
[0075] In one implementation, the computer device can use the random forest algorithm to obtain the target attribute. Specifically, from the M product records, one or more types of data are selected as the classification basis, and multiple classification and regression trees are constructed therefrom. Each time, the product records not drawn form K out-of-bag (OOB) data. 0 ≤ K ≤ M, and K is an integer. The ratio of K to M is the out-of-bag error rate. After randomly and with replacement drawing data multiple times, the attributes of the data with an out-of-bag error rate less than the third threshold are selected as the target attribute. The third threshold can be determined according to the minimum data volume of the machine learning algorithm used for training the model.
[0076] In another implementation, the computer device can use the decision tree method (DTM) algorithm to obtain the target attribute. Specifically, a decision tree is generated using the multiple product records, and the attribute corresponding to the data of the root node of the decision tree can be selected as the target attribute.
[0077] Of course, the specific implementation method for obtaining the target attribute can also be a feature selection method, which is not limited here. For example, it can also be: a complete search algorithm (such as: breadth-first search, branch and bound search, directional search, best-first search, etc.) or a heuristic search algorithm (such as: sequential forward selection, sequential backward selection, bidirectional search, incremental L and remove R selection algorithm, sequential floating selection, etc.). Alternatively, the target attribute can also be predefined or set by the user.
[0078] The target attribute can be one or more attributes in a product record. Combining the above Table 1, the target attribute can be the device information (such as device model) of the device for producing the target product (such as solder paste product).
[0079] S103: The computer device combines the M product records into at least two data sets according to the target attribute. The data of the target attribute of the product records in the same data set among the at least two data sets is the same, and the data of the target attribute of the product records in different data sets is different.
[0080] Based on the example in Table 1, if the selected target attribute is the device model, then the computer device can divide the data in Table 1 into four data sets. Among them, the data of the target attribute of the product records in one data set is "CR57LPUF480B-C-T", the data of the target attribute of the product records in another data set is "CR57LPU2TC-C-T", the data of the target attribute of the product records in another data set is "CR57LPUF240A", and the data of the target attribute of the product records in yet another data set is "CR57LPUF230A".
[0081] S104: The computer device determines whether the number of product records in Dataset 1 is greater than or equal to the first threshold. Dataset 1 is any one of the at least two datasets. If so, Dataset 1 is used as the first dataset and S106 is executed. If not, S105 is executed.
[0082] The first threshold can be predefined. The embodiments of the present application do not limit the value range of the first threshold and the method for obtaining the value range. As an example, the first threshold is greater than or equal to the minimum value of the number of product records participating in training preset in the machine learning algorithm used to train the model in S106.
[0083] Based on the example in Table 1, the first threshold is 3, and the dataset with the data of the target attribute of the product record being "CR57LPUF480B-C-T" can be used as the first dataset. The dataset with the data of the target attribute of the product record being "CR57LPUF240A" includes 2 product records as the second dataset.
[0084] S105: The computer device obtains one or more candidate datasets from the datasets other than Dataset 1 among the at least two datasets. And the set composed of the product records in the one or more candidate datasets and the product records in Dataset 1 is used as the first dataset.
[0085] Specifically, S105 may include the following steps:
[0086] Step 1: The computer device obtains the data of the target attribute of the product records in each of the at least two datasets.
[0087] Step 2: The computer device obtains the similarity between the first data and other data.
[0088] Among them, the first data is the data of the target attribute of the product records in Dataset 1. The other data is the data of the target attribute of the product records in the datasets other than Dataset 1 among the at least two datasets. The similarity between the first data and the other data can be at least one of the edit distance, Euclidean distance, or custom distance between the first data and the other data. Among them, the edit distance, Euclidean distance, or custom distance is collectively referred to as the similarity metric function.
[0089] Step 3: The computer device obtains one dataset from the datasets other than Dataset 1 among the at least two datasets as the candidate dataset according to the similarity between the first data and the other data.
[0090] In one implementation, the computer device uses the data other than the first data among the other data that has the greatest similarity to the first data as the candidate data; then, the candidate dataset is obtained according to the candidate data, and the data of the target attribute in the candidate dataset is the candidate data.
[0091] In another implementation, the computer device uses the data in other data whose similarity to the first data is greater than or equal to a second threshold as candidate data. The computer device obtains a candidate data set based on the candidate data. The data of the target attribute in the candidate data set is the candidate data. The second threshold can be set according to the definition of the similarity metric function and the meaning of the first data. Exemplarily, the first data represents the lifespan of a production device (in months), the metric function is the Euclidean distance, that is, the difference from the first data is negated. If the data with a difference of 10 from the first data is taken as the candidate data, then the second threshold can be set to 0.1.
[0092] Step 4: If the sum of the number of product records in the candidate data set and the number of product records in Data Set 1 is greater than or equal to a first threshold, then the set composed of the product records in the candidate data set and the product records in Data Set 1 is used as the first data set. If the sum of the number of product records in the candidate data set and the number of product records in Data Set 1 is less than the first threshold, then according to the similarity between the first data and other data, another candidate data set is obtained from the data sets other than Data Set 1 and the candidate data set among the at least two data sets. If the sum of the number of product records in the two obtained candidate data sets and the number of product records in Data Set 1 is greater than or equal to the first threshold, then the set composed of the product records in the two candidate data sets and the product records in Data Set 1 is used as the first data set. Otherwise, continue to obtain candidate data sets until the sum of the number of product records in the obtained candidate data sets and the number of product records in Data Set 1 is greater than or equal to the first threshold, and then the set composed of the product records in all the obtained candidate data sets and the product records in Data Set 1 is used as the first data set.
[0093] Optionally, the computer device obtains partial product records in one or more candidate data sets until the sum of the number of obtained product records and the number of product records in Data Set 1 is greater than or equal to the first threshold, and the set composed of the partial product records in the one or more obtained candidate data sets and the product records in Data Set 1 is used as the first data set.
[0094] Based on the example in S104, the number of product records in the dataset with the data of the target attribute of the product record being "CR57LPUF240A" is less than the first threshold. The computer device obtains the data of the target attribute of the product records in each of the four datasets. "CR57LPUF230A" has the highest similarity with "CR57LPUF240A". The number of product records in the dataset with the data of the target attribute of the product record being "CR57LPUF230A" is 1, and the number of product records in the dataset with the data of the target attribute of the product record being "CR57LPUF240A" is 2. The sum of the number of product records in these two datasets is 3, which is equal to the first threshold. The set composed of the product records in the dataset with the data of the target attribute of the product record being "CR57LPUF230A" and the product records in the dataset with the data of the target attribute of the product record being "CR57LPUF240A" is used as the first dataset.
[0095] The above S103 - S105 can be used as a specific implementation manner of "merging the multiple product records into at least two datasets based on the target attribute".
[0096] S106: The computer device trains a first model according to the product records in the first dataset. The first model is used to perform inference on other product records to determine whether the products corresponding to the other product records are defective.
[0097] Specifically, the computer device trains the product records in the first dataset to obtain the first model. Optionally, the computer device uses a machine learning algorithm to train the product records in the first dataset to obtain the first model.
[0098] It should be noted that the computer device can execute S104 - S106 for each of the at least two datasets in S103, so as to train multiple models. The computer device can also execute S104 - S106 for some of the at least two datasets in S103 until all the product records in the datasets participate in training the models, so as to train multiple models.
[0099] The model training method provided by the embodiments of the present application merges the product records participating in training according to the target attributes of the product records participating in training. On the one hand, it improves the poor prediction effect of the model caused by training all product records with various target attributes together to obtain one model. On the other hand, it makes the number of product records participating in training the model greater than or equal to the first threshold, thereby improving the prediction accuracy of the trained model.
[0100] Such as Figure 4As shown in FIG. 1 , a schematic diagram of a process in which a computer device trains multiple models based on multiple product records in an embodiment of the present application. First, multiple product records in the computer device are merged into multiple data sets according to target attributes. Figure 4 Then, the computer device merges the product records in the multiple data sets into multiple first data sets, for example, the product records in data set 1 and the product records in data set 2 are merged into one first data set, the product records in data set 3 are merged into one data set, and the product records in data set 4 and the product records in data set 5 are merged into one data set. Finally, the computer device trains the product records in the multiple first data sets to obtain model 1, model 2, and model 3 respectively.
[0101] Embodiment 2
[0102] like Figure 5 FIG. 1 is a flow chart of a method for selecting a model for product defect location provided in an embodiment of the present application. For example, this embodiment can be applied to Figure 2 The system architecture is shown. Figure 5 The method shown may include the following steps:
[0103] S201: An external device (such as a sensor) of the computer device acquires data on the first production line, wherein the external device is any device on the first production line connected to the computer device.
[0104] Exemplarily, the sensor on the first production line acquires attribute information of the target product such as length, width, volume, area, height, lateral offset, longitudinal offset, etc. The target product is any product produced on the first production line.
[0105] S202: The external device sends the data on the first production line to the computer device.
[0106] Based on the example in S201 , the sensor sends the attribute information of the target product to the computer device.
[0107] S203: The computer device pre-processes the data on the first production line to generate a first product record. Optionally, the computer device removes abnormal data from the data on the first production line and generates the first product record from the remaining data.
[0108] It should be noted that S201-S203 are optional steps, and this application does not limit the source of the first product record.
[0109] In one implementation, the computer device receives the attribute information of the target product sent by the sensor in S201, as well as the information sent by other external devices connected to the computer device on this production line, such as the device model for producing the target product. The computer device eliminates the abnormal data in this information and generates a first product record from the remaining information.
[0110] In another implementation, the first product record can be any one of multiple product records stored in the computer device.
[0111] S204: The computer device obtains the data of the target attribute of the first product record.
[0112] This application does not limit the manner in which the computer device obtains the target attribute. The target attribute can be pre-stored in the computer device, or the computer device can request to obtain the target attribute from a server or a cloud server.
[0113] The target attribute can include one or more attributes in a product record. Exemplarily, the obtained target attribute is the device model of the production device for producing the target product.
[0114] S205: The computer device obtains a first model from multiple models. Each of the multiple models is used to reason about the product record to determine whether the product corresponding to the product record has a defect. The similarity between the data of the target attribute of the first model and the data of the target attribute of the first product record is greater than or equal to the similarity between the data of the target attribute of the first product record and the data of the target attribute of other models. Other models are models other than the first model among the multiple models of the computer device. The multiple models are multiple models obtained by merging multiple product records into multiple data sets according to the target attribute in the first embodiment and training the product records in each data. All of these multiple models can be used to predict whether the product corresponding to the first product record has a defect.
[0115] Among them, the data of the target attribute of a model can be any one of the data of the target attributes of all product records used when training the model.
[0116] The computer device obtains the first model from multiple models, which may specifically include:
[0117] First, the computer device obtains the data of the target attribute of each model among the multiple models.
[0118] Secondly, the computer device calculates the similarity between the data of the target attribute of the first product record and the data of the target attributes of multiple models. The similarity between the data of the target attribute in the first product record and the data of the target attribute of a model can be at least one of the edit distance, Euclidean distance, or custom distance between the data of the target attribute in the first product record and the data of the target attribute of the model.
[0119] Next, the computer device obtains a first model from the multiple models according to the similarity between the data of the target attribute of the first product record and the data of the target attributes of the multiple models. The first model is any one of the models in which the similarity between the data of the target attribute of the model and the data of the target attribute of the first product record is the largest among the multiple models. Alternatively, the first model is a model in which the similarity between the data of the target attribute of the model and the data of the target attribute of the first product record is greater than or equal to a second threshold. The second threshold can be set according to the definition of the similarity metric function and the meaning of the data of the target attribute.
[0120] Subsequently, the computer device inputs the first product record into the first model to obtain a prediction result on whether the product corresponding to the first product record has defects.
[0121] When the first product record is generated by the embodiments S201 - S203 of the present application, the computer device can send an instruction to a control device in an external device according to the prediction result, so that the control device makes a response action according to the instruction. The present application does not limit the response action. For example, it can be to distinguish the target product or adjust the parameters of the production equipment, etc.
[0122] When the first product record is any one of multiple product records stored in the computer device, after the computer device inputs each product record into the model corresponding to the product record, multiple prediction results are obtained. The computer device classifies and outputs the multiple prediction results according to the data of the target attribute of each product record.
[0123] In this embodiment, for each product record, the computer device can select a corresponding model according to the data of the target attribute of the product record, and the similarity between the data of the target attribute of the model and the data of the target attribute of the product record is greater than or equal to the similarity between the data of the target attribute of the model and the data of the target attribute of other models. This improves the accuracy of the model in predicting the results of product records.
[0124] It can be understood that the model selection method in the second embodiment can be applied to the testing of models. As Figure 6 shown. Figure 6 The computer device in it includes three models: the first model, the second model, and the third model.
[0125] First, the computer device obtains the data of the target attribute of each test product record among multiple test product records, and classifies the multiple test product records according to the data of the target attribute of the product record into: test product records with the data of the target attribute being the first data, test product records with the data of the target attribute being the second data, and test product records with the data of the target attribute being the third data.
[0126] Secondly, the computer device determines the model corresponding to each test product record according to the data of the target attribute of the test product record and the data of the target attribute of each model. The model corresponding to the test product record is one of one or more models with the highest similarity between the data of the target attribute and the data of the target attribute of the test product record. Figure 6 Among them, for the multiple test product records determined by the computer device, the model corresponding to the test product record with the data of the target attribute being the first data is the first model; the model corresponding to the test product record with the data of the target attribute being the second data is the second model; the model corresponding to the test product record with the data of the target attribute being the third data is the third model.
[0127] The above mainly introduces the solution provided by the embodiment of the present application from the perspective of the method. To implement the above functions, it includes the corresponding hardware structure and / or software module for executing each function. Those skilled in the art should easily realize that, combining the method steps of each example described in the embodiments disclosed herein, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a certain function is executed in the way of hardware or computer software driving the hardware depends on the specific application and design constraints of the technical solution. Professional technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present application.
[0128] The embodiment of the present application can divide the computer device into function modules according to the above method examples. For example, each function module can be divided corresponding to each function, or two or more functions can be integrated into one processing module. The above integrated module can be implemented in the form of hardware or in the form of a software function module. It should be noted that the division of modules in the embodiment of the present application is illustrative, only a logical function division, and there can be other division methods in actual implementation.
[0129] As Figure 7 shown, it is a schematic structural diagram of a training device for a model for product defect location provided by the embodiment of the present application. The training device 70 for the model for product defect location can be used to execute any one of the above embodiments (such as Figure 3The functions performed by the computer device in the illustrated embodiments). The training device 70 for the product defect location model may include: an acquisition module 701, a processing module 702, and a training module 703. The acquisition module 701 is used to acquire multiple product records. Each of the product records includes data of one or more attributes of a product. The processing module 702 is used to merge the multiple product records into at least two data sets based on at least one of the one or more attributes. Determine a first data set in which the number of product records in at least two data sets is greater than or equal to a first threshold. The training module 703 is used to train a model according to the product records in the first data set. The trained model is used to infer other product records to determine whether the products corresponding to the other product records are defective. For example, in combination with Figure 3 , the acquisition module 701 can be used to execute S101 and S102. The processing module 702 can be used to execute S103 - S105. The training module 703 can be used to execute S106.
[0130] Among them, the data of the attributes used to merge the multiple product records in each product record included in at least two data sets is the same. Or, the data of the attributes used to merge the multiple product records in one or more of the at least two data sets is different and the similarity is greater than or equal to a second threshold.
[0131] Optionally, the processing module 702 is further used to: determine a second data set in which the number of product records in at least two data sets is less than the first threshold. The acquisition module 701 is further used to: obtain a target data set from the data sets other than the second data set in the at least two data sets. The similarity between the first data in the target data set and the second data in the second data set is greater than or equal to the second threshold. Wherein, the first data is the data of the attributes used to merge the multiple product records in the product records in the target data set. The second data is the data of the attributes used to merge the multiple product records in the product records in the second data set. The processing module 702 is further used to: merge the product records in the second data set with the product records in the target data set into a first data set.
[0132] In one example, referring to Figure 1 , the above acquisition module 701 can be implemented by the communication interface 104 in Figure 1 ; the processing module 702 can be implemented by the processor 101 in Figure 1 calling the computer program stored in the memory 103.
[0133] For the specific description of the above optional manner, refer to the foregoing method embodiments, which will not be elaborated here. In addition, the explanations and beneficial effects descriptions of any of the above provided training devices 70 for the product defect location model can refer to the corresponding method embodiments above, and will not be elaborated.
[0134] It should be noted that the actions corresponding to the above-mentioned respective modules are only specific examples, and the actual actions performed by each module refer to the actions or steps mentioned in the description of the above-mentioned Figure 3 embodiments described.
[0135] As Figure 8 shown in the structural schematic diagram of a selection device for a model for product defect location provided by an embodiment of the present application. The selection device 80 for the model for product defect location can be used to execute the functions performed by the computer device in any one of the above embodiments (such as Figure 5 the embodiment shown). The selection device 80 for the model for product defect location can include: an acquisition module 801 and a selection module 802. The acquisition module 801 is used to acquire a first product record. The first product record includes data of one or more attributes. The first product record is the product record of any one product. The product record includes data of one or more attributes of a product. Acquire the data of the target attribute in the first product record. The selection module 802 is used to select a first model from multiple models. Each model in the multiple models is used to reason about the product record to determine whether the product corresponding to the product record has a defect. The similarity between the data of the target attribute in the first product record and the data of the target attribute of the first model is greater than or equal to the similarity between the data of the target attribute in the first product record and other data. The other data is the data other than the data of the target attribute of the first model among the data of the target attributes of the multiple models. For example, in combination with Figure 5 , the acquisition module 801 can be used to execute the receiving step in S202, S203, and S204. The selection module 802 can be used to execute S205.
[0136] In one example, referring to Figure 1 , the above-mentioned acquisition module 801 can be implemented by Figure 1 the communication interface 104 in; the selection module 802 can be implemented by the processor 101 in Figure 1 calling a computer program stored in the memory 103.
[0137] For the specific description of the above optional methods, refer to the foregoing method embodiments, which will not be elaborated here. In addition, the explanations and descriptions of the beneficial effects of any of the above-mentioned selection devices 80 for the model for product defect location can refer to the corresponding method embodiments above, and will not be elaborated.
[0138] It should be noted that the actions corresponding to the above-mentioned respective modules are only specific examples, and the actual actions performed by each module refer to the actions or steps mentioned in the description of the above-mentioned Figure 5 embodiments described.
[0139] An embodiment of the present application further provides a device (such as a computer device or a chip), including: a memory and a processor; the memory is used to store a computer program, and the processor is used to call the computer program to perform the actions or steps mentioned in any of the above embodiments.
[0140] An embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored. When the computer program runs on a computer, the computer is enabled to perform the actions or steps mentioned in any of the above embodiments.
[0141] An embodiment of the present application further provides a chip. Circuits for implementing the functions of the above data acquisition and recognition model testing device and one or more interfaces are integrated in the chip. Optionally, the functions supported by the chip may include based on Figures 3 - 6 the processing actions in the above-mentioned embodiments, which will not be elaborated here. Those of ordinary skill in the art can understand that all or part of the steps for implementing the above embodiments can be completed by a program instructing relevant hardware. The program can be stored in a computer-readable storage medium. The above-mentioned storage medium can be a read-only memory, a random access memory, etc. The above-mentioned processing module or processor can be a central processing unit, a general-purpose processor, an application-specific integrated circuit (ASIC), a digital signal processor (DSP), a field programmable gate array (FPGA) or other programmable logic devices, transistor logic devices, hardware components or any combination thereof.
[0142] The embodiments of the present application also provide a computer program product containing instructions. When the instructions run on a computer, the computer is caused to execute any one of the methods in the above embodiments. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the processes or functions described in the embodiments of the present application are generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions may be transmitted from a website, a computer, a server, or a data center to another website, computer, server, or data center by wire (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wirelessly (such as infrared, wireless, microwave, etc.). The computer-readable storage medium may be any available medium that can be accessed by a computer or a data storage device such as a server or a data center that includes one or more media integrated therein. The available medium may be a magnetic medium (such as a floppy disk, a hard disk, a magnetic tape), an optical medium (such as a DVD), or a semiconductor medium (such as a solid-state disk (SSD)), etc.
[0143] It should be noted that the devices for storing computer instructions or computer programs provided in the embodiments of the present application, such as but not limited to, the above-mentioned memory, computer-readable storage medium, and communication chip, etc., are all non-transitory.
[0144] In the process of implementing the claimed present application, those skilled in the art can understand and implement other variations of the disclosed embodiments by viewing the drawings, the disclosure, and the appended claims. In the claims, the word "comprising" does not exclude other components or steps, and "a" or "one" does not exclude a plurality. A single processor or other unit may implement several functions recited in the claims. Certain measures are recited in mutually different dependent claims, but this does not mean that these measures cannot be combined to produce good results.
[0145] Although the present application has been described in conjunction with specific features and their embodiments, various modifications and combinations can be made without departing from the spirit and scope of the present application. Accordingly, the present specification and the drawings are merely exemplary illustrations of the present application defined by the appended claims, and are considered to have covered any and all modifications, variations, combinations, or equivalents within the scope of the present application.
[0146] The above has introduced the embodiments of the present application in detail. Specific examples are used herein to elaborate on the principle and implementation manner of the present application. The description of the above embodiments is only used to help understand the method and its core idea of the present application; at the same time, for those of ordinary skill in the art, according to the idea of the present application, there will be changes in the specific implementation manner and application scope. In summary, the content of this specification should not be construed as a limitation to the present application.
Claims
1. A training method for a model for product defect localization, characterized in that, the method comprises: Obtaining multiple product records, each product record including data of one or more attributes of a product; Based on at least one attribute, merging the multiple product records into at least two data sets; each data set in the at least two data sets includes product records with the same data of the attribute used to merge the multiple product records; Determining a first data set in which the number of product records in the at least two data sets is greater than or equal to a first threshold; Training the model according to the product records in the first data set; the model is used to perform inference on other product records to determine whether the product corresponding to the other product records has defects.
2. The method according to claim 1, characterized in that, In one or more data sets of the at least two data sets, the data of the attributes used to merge the multiple product records included in the product records are different and the similarity is greater than or equal to a second threshold.
3. The method according to claim 1 or 2, characterized in that, the method further comprises: Determining a second data set in which the number of product records in the at least two data sets is less than the first threshold; Obtaining a target data set from the data sets other than the second data set in the at least two data sets; the similarity between the first data in the target data set and the second data in the second data set is greater than or equal to the second threshold; wherein, the first data is the data of the attribute used to merge the multiple product records in the product records in the target data set; the second data is the data of the attribute used to merge the multiple product records in the product records in the second data set; Merging the product records in the second data set with the product records in the target data set into the first data set.
4. A method for selecting a model for product defect localization, characterized in that, the method comprises: Obtaining a first product record; the first product record includes data of one or more attributes of a product; Obtaining the data of the target attribute in the first product record; Selecting a first model from multiple models; each model in the multiple models is used to perform inference on a product record to determine whether the product corresponding to the product record has defects, and the data of the target attribute of different models are different; the similarity between the data of the target attribute in the first product record and the data of the target attribute of the first model is greater than or equal to the similarity between the data of the target attribute in the first product record and other data; the other data is the data of the target attribute of the multiple models except the data of the target attribute of the first model.
5. A training device for a model for product defect localization, characterized in that, the device comprises: An obtaining module, configured to obtain multiple product records, each product record including data of one or more attributes of a product; A processing module, configured to merge the multiple product records into at least two data sets based on at least one attribute; determine a first data set among the at least two data sets, where the number of product records included in each data set in the at least two data sets is greater than or equal to a first threshold, and the data of the attribute used to merge the multiple product records in the product records included in each data set is the same. A training module, configured to train the model according to the product records in the first data set; the model is used to perform inference on other product records to determine whether the product corresponding to the other product records has defects.
6. The training device according to claim 5, wherein, in one or more data sets among the at least two data sets, the data of the attribute used to merge the multiple product records in the product records included is different and the similarity is greater than or equal to a second threshold.
7. The training device according to claim 5 or 6, wherein, the processing module is further configured to: determine a second data set where the number of product records in the at least two data sets is less than the first threshold; the obtaining module is further configured to: obtain a target data set from the data sets other than the second data set among the at least two data sets; the similarity between the first data in the target data set and the second data in the second data set is greater than or equal to the second threshold; wherein, the first data is the data of the attribute used to merge the multiple product records in the product records in the target data set, and the second data is the data of the attribute used to merge the multiple product records in the product records in the second data set; the processing module is further configured to: merge the product records in the second data set with the product records in the target data set into the first data set.
8. A selection device for a model for product defect location, wherein, the device includes: an obtaining module, configured to obtain a first product record; the first product record includes data of one or more attributes of a product; obtain the data of a target attribute in the first product record; a selection module, configured to select a first model from multiple models; each model in the multiple models is used to perform inference on a product record to determine whether the product corresponding to the product record has defects, and the data of the target attribute of different models is different; the similarity between the data of the target attribute in the first product record and the data of the target attribute of the first model is greater than or equal to the similarity between the data of the target attribute in the first product record and other data; the other data is the data of the target attribute of the multiple models except the data of the target attribute of the first model.
9. A training device for a model for product defect location, wherein, it includes: a memory and a processor, the memory is used to store a computer program, and the processor is used to call the computer program to execute the method according to any one of claims 1-3.
10. A computer-readable storage medium, wherein, A computer program is stored on the computer-readable storage medium, and when the computer program runs on a computer, the computer is caused to execute the method according to any one of claims 1-3.
11. A selection device for a model for product defect location, characterized in that it comprises: a memory and a processor, the memory is used for storing a computer program, and the processor is used for calling the computer program to execute the method according to claim 4.
12. A computer-readable storage medium, characterized in that a computer program is stored on the computer-readable storage medium, and when the computer program runs on a computer, the computer is caused to execute the method according to claim 4.
Citation Information
Patent Citations
Decision-making tree based prediction method and device
CN104111920A
Method, device, storage medium and terminal device for product defect detections and locations
CN108154508A