Method, apparatus, and computer program product for assisting model training
By obtaining the training sample set and loss information, using the model interpreter to generate interpretation results, and adjusting the model based on the interpretation results, the problem of machine learning models lacking interpretability is solved, and the training speed and accuracy of the model is improved.
Patent Information
- Application Number
- CN202210290331.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-23
- Publication Date
- 2025-06-10
- Estimated Expiration
- 2042-03-23
AI Technical Summary
The lack of interpretability of existing machine learning models makes it impossible to understand the reasons for model decisions and to improve the model.
By obtaining the training sample set, the intermediate data and loss information of the initial model are determined, the model interpreter is used to generate interpretation results, and the model is adjusted based on the interpretation results and loss information to obtain a better target model.
The interpretability of the model training process is realized, and the training speed and accuracy of the model are improved through feedback of interpreting the results.
Smart Images

Figure CN114692866B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technologies, and particularly to artificial intelligence and deep learning technologies, and more particularly to methods, apparatuses, electronic devices, storage media, and computer program products for assisting model training. Background Art
[0002] Currently, machine learning technologies mainly based on deep learning have achieved great success in many fields such as computer vision, natural language processing, and speech recognition. Machine learning models have also been widely applied to some important real-world tasks, such as object detection, image classification, and speech recognition. However, due to the lack of interpretability of machine learning models, people cannot know the reasons for the decisions made by machine learning models, and it is also difficult to directly improve machine learning models. Summary of the Invention
[0003] The present disclosure provides a method, an apparatus, and a model adjustment method, apparatus, electronic device, storage media, and computer program products for assisting model training.
[0004] According to a first aspect, a method for assisting model training is provided, including: obtaining a training sample set, where the training samples in the training sample set include training data and label information; during the process of training an initial model with the training sample set, determining intermediate data in the forward propagation process of the initial model obtaining an output result based on the input training data, and loss information between the output result and the corresponding label information; obtaining an explanation result based on the intermediate data and the output result, where the explanation result is used to represent the logical basis for the initial model to obtain the output result based on the intermediate data; and adjusting the initial model according to the loss information and the explanation result to obtain a trained target model.
[0005] According to a second aspect, a model adjustment method is provided, including: obtaining data to be processed; processing the data to be processed by a target model, and determining intermediate data in the forward propagation process of the target model obtaining a processing result based on the data to be processed; obtaining an explanation result based on the intermediate data and the processing result, where the explanation result is used to represent the logical basis for the target model to obtain the processing result based on the intermediate data; and adjusting the target model according to the explanation result.
[0006] According to a third aspect, there is provided an apparatus for assisting model training, including: a first acquisition unit configured to acquire a training sample set, wherein the training samples in the training sample set include training data and label information; a first determination unit configured to determine, during the process of training an initial model with the training sample set, intermediate data in the forward propagation process of the initial model obtaining an output result based on the input training data, and loss information between the output result and the corresponding label information; a first interpretation unit configured to obtain an interpretation result based on the intermediate data and the output result, wherein the interpretation result is used to represent the logical basis for the initial model to obtain the output result based on the intermediate data; and a first adjustment unit configured to adjust the initial model according to the loss information and the interpretation result to obtain a trained target model.
[0007] According to a fourth aspect, there is provided an adjustment apparatus during the process of model application, including: a second acquisition unit configured to acquire data to be processed; a second determination unit configured to process the data to be processed through a target model and determine intermediate data in the forward propagation process of the target model obtaining a processing result based on the data to be processed; a second interpretation unit configured to obtain an interpretation result based on the intermediate data and the processing result, wherein the interpretation result is used to represent the logical basis for the target model to obtain the processing result based on the intermediate data; and a second adjustment unit configured to adjust the target model according to the interpretation result.
[0008] According to a fifth aspect, there is provided an electronic device, including: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the method described in any implementation manner of the first aspect or the second aspect.
[0009] According to a sixth aspect, there is provided a non-transitory computer-readable storage medium storing computer instructions for causing a computer to execute the method described in any implementation manner of the first aspect or the second aspect.
[0010] According to a seventh aspect, there is provided a computer program product, including: a computer program which, when executed by a processor, implements the method described in any implementation manner of the first aspect or the second aspect.
[0011] According to the technology of the present disclosure, there is provided a method for training a model by combining the interpretation results of a model interpreter, which not only makes the model learning stage interpretable, but also combines the interpretation results to train the model, improving the model training speed and the accuracy of the trained model.
[0012] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it used to limit the scope of the present disclosure. Other features of the present disclosure will become readily understood from the following description. Description of the Drawings
[0013] The drawings are used to better understand the present solution and do not constitute a limitation to the present disclosure. Among them:
[0014] Figure 1 is an exemplary system architecture diagram to which an embodiment of the present disclosure can be applied;
[0015] Figure 2 is a flowchart of an embodiment of a method for assisting model training according to the present disclosure;
[0016] Figure 3 is a schematic diagram of the data flow of a method for assisting model training according to the present disclosure;
[0017] Figure 4 is a schematic diagram of an application scenario of a method for assisting model training according to this embodiment;
[0018] Figure 5 is a flowchart of an embodiment of a model adjustment method according to the present disclosure;
[0019] Figure 6 is a schematic diagram of the data flow of a model adjustment method according to the present disclosure;
[0020] Figure 7 is a structural diagram of an embodiment of a device for assisting model training according to the present disclosure;
[0021] Figure 8 is a structural diagram of an embodiment of an adjustment device during the model application process according to the present disclosure;
[0022] Figure 9 is a schematic structural diagram of a computer system suitable for implementing the embodiments of the present disclosure. Detailed Embodiments
[0023] The following describes exemplary embodiments of the present disclosure with reference to the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered merely exemplary. Therefore, those of ordinary skill in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.
[0024] In the technical solution of the present disclosure, the processing of the user's personal information, such as collection, storage, use, processing, transmission, provision, and disclosure, complies with the provisions of relevant laws and regulations and does not violate public order and good customs.
[0025] Figure 1 FIG. 100 shows an exemplary architecture to which the method and apparatus for assisting model training and the method and apparatus for model adjustment according to the present disclosure can be applied.
[0026] As Figure 1 shown, the system architecture 100 may include terminal devices 101, 102, 103, a network 104, and a server 105. The terminal devices 101, 102, 103 are communicatively connected to form a topology network, and the network 104 is used as a medium to provide a communication link between the terminal devices 101, 102, 103 and the server 105. The network 104 may include various connection types, such as wired, wireless communication links, or fiber optic cables, etc.
[0027] The terminal devices 101, 102, 103 may be hardware devices or software that support network connections for data interaction and data processing. When the terminal devices 101, 102, 103 are hardware, they may be various electronic devices that support network connections, information acquisition, interaction, display, processing, and other functions, including but not limited to smart phones, tablet computers, e-book readers, laptop computers, and desktop computers, etc. When the terminal devices 101, 102, 103 are software, they may be installed in the above-listed electronic devices. It may be implemented as, for example, multiple software or software modules for providing distributed services, or may be implemented as a single software or software module. Specific limitations are not made here.
[0028] The server 105 may be a server that provides various services. For example, it is a background processing server that trains an initial model according to the operation instructions of the terminal devices 101, 102, 103 in combination with the interpretation result of the model interpreter, or, for another example, it is a background processing server that adjusts a target model according to the operation instructions of the terminal devices 101, 102, 103 in combination with the interpretation result of the model interpreter. As an example, the server 105 may be a cloud server.
[0029] It should be noted that the server may be hardware or software. When the server is hardware, it may be implemented as a distributed server cluster composed of multiple servers, or may be implemented as a single server. When the server is software, it may be implemented as multiple software or software modules (such as software or software modules for providing distributed services), or may be implemented as a single software or software module. Specific limitations are not made here.
[0030] It should also be noted that the method for assisting model training and the model adjustment method provided by the embodiments of the present disclosure can be executed by a server, or by a terminal device, or by the server and the terminal device cooperating with each other. Correspondingly, each part (such as each unit) included in the device for assisting model training and the adjustment device in the model application process can be all set in the server, or all set in the terminal device, or separately set in the server and the terminal device.
[0031] It should be understood that Figure 1 the numbers of terminal devices, networks, and servers in
[0032] Please refer to Figure 2 , Figure 2 which is a flowchart of a method for assisting model training provided by an embodiment of the present disclosure. Among them, process 200 includes the following steps:
[0033] Step 201, obtain a training sample set.
[0034] In this embodiment, the execution subject (such as Figure 1 the terminal device or server in
[0035] of the method for assisting model training) can obtain the training sample set from a remote location or locally based on a wired network connection method or a wireless network connection method. Among them, the training samples in the training sample set include training data and label information.
[0036] In this embodiment, the above execution subject can divide the training sample set into a training subset and a validation subset. The above execution subject can train the initial model through the training subset and verify the accuracy of the trained initial model through the validation subset.
[0037] Step 202, during the process of training the initial model with the training sample set, determine the intermediate data in the forward propagation process of the initial model to obtain the output result according to the input training data, and the loss information between the output result and the corresponding label information.
[0038] In this embodiment, during the process of training the initial model with the training sample set, the above-mentioned execution entity can determine the intermediate data in the forward propagation process of the initial model obtaining the output result according to the input training data, and the loss information between the output result and the corresponding label information.
[0039] The model training stage includes a forward propagation process and a backward propagation process. In the forward propagation process, the initial model performs information processing such as feature extraction and classification based on the input training data to obtain an output result; in the backward propagation process, gradient transmission is performed according to the loss information between the output result and the corresponding label information to update the parameters of the initial model.
[0040] During the forward propagation process of the initial model, the above-mentioned execution entity can obtain representative intermediate data in the information processing process based on the input training data. For example, in a classification model, the feature information extracted by the last feature extraction layer can be used as the intermediate data.
[0041] Step 203, obtain an interpretation result according to the intermediate data and the output result.
[0042] In this embodiment, the above-mentioned execution entity can obtain an interpretation result according to the intermediate data and the output result. The interpretation result is used to represent the logical basis for the initial model to obtain the output result based on the intermediate data.
[0043] The above-mentioned execution entity adds a model interpretation stage (model interpreter) after the model training stage to train the initial model. As an example, the model interpreter can be a neural network interpretation model with model interpretation capabilities. The intermediate data and the output result are input into the neural network interpretation model to obtain an interpretation result.
[0044] Specifically, the model interpreter can determine the processing method of the initial model for the input training data according to the intermediate data, so as to determine the basis for obtaining the above output result, that is, the interpretation result. Taking the initial model as an image classification model as an example, according to the intermediate data, the model interpreter can determine the area of interest of the initial model in the sample image and the feature information referred to by the output result, and then determine the data on which the output result is based to obtain the interpretation result.
[0045] In some alternative implementation manners of this embodiment, the above-mentioned execution entity can determine the intermediate data in the forward propagation process of the initial model obtaining the output result according to the input training data in the following manner: determine the intermediate data corresponding to each stage in the forward propagation process. Each stage is obtained by dividing the forward propagation process based on a preset division method.
[0046] It can be understood that the forward propagation process generally includes multiple information processing stages. Among them, the way of dividing the stages can be specifically set according to actual needs. For example, it can be divided according to the structure of the model, specifically dividing the stages according to the hierarchical structure of each feature extraction layer. Another example is that it can be divided according to the definition of the stages in the model. For example, in the residual network, it is specifically divided into five stages from the first stage to the fifth stage.
[0047] In this implementation manner, the above-mentioned execution entity can execute the above step 203 in the following way: obtain the interpretation results corresponding to each stage according to the intermediate data and output results corresponding to each stage in the forward propagation process.
[0048] Specifically, for each stage in the forward propagation process, the above-mentioned execution entity obtains the interpretation result corresponding to this stage through the model interpreter according to the intermediate data and output result corresponding to this stage. Among them, the interpretation process of the model interpreter for each stage can refer to the process of obtaining the above-mentioned interpretation results, which will not be elaborated here.
[0049] In this implementation manner, the above-mentioned execution entity obtains the intermediate data of each stage in the forward propagation process of the initial model, and further obtains the interpretation results corresponding to each stage, improving the detail and referenceability of the interpretation results.
[0050] In some optional implementation manners of this embodiment, the above-mentioned execution entity can adopt the deconvolution method to obtain the interpretation results corresponding to each stage according to the intermediate data and output results corresponding to each stage in the forward propagation process.
[0051] It can be understood that in a general neural network model, feature extraction is performed through a convolutional network to perform subsequent feature information processing to obtain an output result. In this implementation manner, the above-mentioned execution entity can specifically understand the convolutional operations in the initial model through the deconvolution method. Further, the above-mentioned execution entity can combine visualization techniques to display the interpretation results corresponding to each stage to facilitate users to view and understand the training process of the model. The visualization methods include but are not limited to heat maps, vector graphs, etc.
[0052] In this implementation manner, the deconvolution method improves the accuracy of the interpretation results.
[0053] Step 204, adjust the initial model according to the loss information and the interpretation results to obtain the trained target model.
[0054] In this embodiment, the above-mentioned execution entity can adjust the initial model according to the loss information and the interpretation results to obtain the trained target model.
[0055] Specifically, the above-mentioned execution entity may use the gradient determined based on the loss information as the main basis for adjusting the parameters of the initial model. On this basis, some adjustment parameters of the initial model are determined according to the interpretation result, and the initial model is adjusted. By repeatedly executing the parameter adjustment process and in response to reaching a preset end condition, the trained target model is obtained.
[0056] As an example, according to the interpretation result, the data on which the initial model obtains the output result is determined. Furthermore, on the premise that the data cannot support the initial model to obtain the correct output result, the parameter of the model structure that obtains the data is adjusted.
[0057] Among them, the preset end condition includes but is not limited to that the training time exceeds the preset time threshold, the number of training times exceeds the preset number threshold, and the loss information tends to converge.
[0058] Reference Figure 3 shows the data flow 300 of the method for assisting model training. Among them, the training data includes a training sample set 301 and a validation sample set 302. The training sample set 301 and the validation sample set 302 are respectively used for training and validating the initial model 303. During the training and validation process of the initial model 303, the information processing process of the initial model 303 for obtaining the output result is explained to obtain an interpretation result 304. Furthermore, the interpretation result can feed back the training and validation process of the initial model 303.
[0059] In some optional implementation manners of this embodiment, the above-mentioned execution entity may execute the above step 204 in the following manner:
[0060] First, according to the label information and the interpretation results corresponding to each stage in the forward propagation process, the analysis results corresponding to the interpretation results of each stage are obtained.
[0061] Among them, the analysis result is used to indicate the rationality of the information processing method of the stage corresponding to the interpretation result.
[0062] Specifically, for each stage in the forward propagation process, the above-mentioned execution entity obtains the analysis result corresponding to the interpretation result of this stage according to the label information and the interpretation result corresponding to this stage.
[0063] Continuing with the example of image classification, the sample image includes various object information such as animal objects and furniture objects, and its label information indicates that the sample image is a dog, which means that the initial model should focus on the area corresponding to the dog object in the sample image. However, if the interpretation result shows that there is a deviation between the area of concern of the initial model and the area corresponding to the dog object, it can be determined that the information processing method of the stage corresponding to the interpretation result is unreasonable.
[0064] Second, for each stage in the forward propagation process, adjust the parameters of the initial model corresponding to this stage according to the loss information and the analysis result corresponding to the interpretation result of this stage, so as to obtain the trained target model.
[0065] As an example, when the analysis result is used to indicate that the information processing method of this stage is unreasonable, the above-mentioned execution entity can, on the basis of adjusting the parameters of the initial model according to the gradient information obtained from the loss information, focus on adjusting the model parameters in the stage where the analysis result is unreasonable, and finally obtain the target model by repeatedly executing the above process.
[0066] In this implementation manner, a specific method for adjusting the initial model according to the interpretation result and the loss information is provided, which improves the accuracy of the finally obtained target model.
[0067] In some optional implementation manners of this embodiment, the above-mentioned execution entity can execute the above first step in the following manner:
[0068] For each stage in the forward propagation process, perform the following operations:
[0069] First, according to the interpretation result corresponding to this stage, determine the attention degree of the initial model to each part of the training data input in this stage. Among them, the attention degree is used to characterize the dependence degree of each part of the training data during the process of the initial model obtaining the output result. Then, according to the label information and the attention degree corresponding to this stage, obtain the analysis result corresponding to the interpretation result of this stage.
[0070] As an example, the intermediate data corresponding to each stage is represented in the form of a weight matrix. Through the weight matrix, the above-mentioned execution entity can perform weight analysis to determine the interpretation result representing the attention area and attention degree of the initial model in this stage. Furthermore, according to the label information and the attention degree corresponding to this stage, obtain the analysis result corresponding to the interpretation result of this stage.
[0071] In this implementation manner, by determining the attention degree of the initial model to each part of the training data input in this stage, the analysis result corresponding to the interpretation result can be further determined, which improves the correctness of the obtained analysis result.
[0072] In some optional implementation manners of this embodiment, the above-mentioned execution entity can perform the following operations to obtain the analysis result corresponding to the interpretation result of this stage according to the label information and the attention degree corresponding to this stage:
[0073] First, according to the label information, determine the target attention corresponding to the initial model at this stage. The target attention is used to characterize the degree of dependence of the initial model on each part of the training data when obtaining the target output result corresponding to the label information. Then, based on the target attention and the attention, obtain the analysis result corresponding to the explanation result at this stage.
[0074] Specifically, the above-mentioned execution entity can determine the attention of the initial model to each region of the input training data according to the label information. As an example, when the initial model is an image classification model, the attention information represented by the target attention should focus on the regions where various objects in the training data are located.
[0075] In this implementation manner, the above-mentioned execution entity can present the target attention in the form of different colors and different proportion values. Furthermore, by comparing the target attention and the attention, the above-mentioned execution entity can determine whether there is a deviation in the attention region and / or a deviation in the attention corresponding to the attention region, and obtain the analysis result corresponding to the explanation result at this stage.
[0076] In this implementation manner, based on the target attention and the attention, a more accurate analysis result is obtained.
[0077] Continue to refer to Figure 4 , Figure 4 FIG. 400 is a schematic diagram of an application scenario of a method for assisting model training according to this embodiment. In the Figure 4 application scenario, the server 401 first obtains the training sample set 403 from the database 402. The training samples in the training sample set 403 include training data and label information. Specifically, the training sample set 403 is divided into a training subset and a validation subset. Then, the initial model 404 is trained by using the machine learning method through the training sample set 403. During the process of training the initial model 404 by using the training sample set 403, determine the intermediate data 406 in the forward propagation process of the initial model to obtain the output result 405 according to the input training data, and the loss information 408 between the output result 405 and the corresponding label information 407; through the model interpreter 409, obtain the explanation result 410 according to the intermediate data 406 and the output result 405; according to the loss information 408 and the explanation result 410, adjust the initial model 404 to obtain the trained target model.
[0078] In this embodiment, a method for training a model by combining the explanation result of a model interpreter is provided, which not only makes the model learning stage interpretable, but also combines the explanation result to train the model, improving the model training speed and the accuracy of the trained model.
[0079] Continue to refer to Figure 5, a schematic flowchart 500 of an embodiment of the model adjustment method according to the present application is shown, including the following steps:
[0080] Step 501, obtain the data to be processed.
[0081] In this example, the execution subject of the model adjustment method (for example, Figure 1 the terminal device or server in
[0082] can obtain the data to be processed from a remote location or locally based on a wired network connection method or a wireless network connection method.
[0083] The data to be processed can be data in any form and representing any content. As an example, in the field of image classification, the data to be processed is the image to be classified; in the field of target object recognition, the data to be processed is the image to be recognized; in the field of speech recognition, the data to be processed is the speech to be recognized.
[0083] Step 502, process the data to be processed through the target model, and determine the intermediate data in the forward propagation process of the target model to obtain the processing result according to the data to be processed.
[0084] In this embodiment, the above execution subject can process the data to be processed through the target model, and determine the intermediate data in the forward propagation process of the target model to obtain the processing result according to the data to be processed.
[0085] As an example, the target model can be a target model trained by using a machine learning method, with the training data in the training samples as the input of the neural network model and the label information corresponding to the input training data as the expected output.
[0086] As another example, the target model can be the target model trained by using the above embodiment 200. Training the initial model in combination with the interpretation result of the model interpreter not only makes the model learning stage interpretable, but also improves the accuracy of the target model by training the model in combination with the interpretation result.
[0087] In the application process of the target model, generally, the input data to be processed is processed through the forward propagation process such as in the training stage to obtain the processing result. Taking the image classification model as an example, the target model can extract the feature information of the data to be processed through the feature extraction network, and then classify the feature information through the classification layer to obtain the classification result.
[0088] In the forward propagation process of the target model, the above execution subject can obtain the representative intermediate data in the information processing process based on the input training data. For example, in the image classification model, the feature information extracted by the last feature extraction layer can be used as the intermediate data.
[0089] Step 503, obtain the interpretation result according to the intermediate data and the processing result.
[0090] In this embodiment, the above-mentioned execution entity can obtain an interpretation result based on the intermediate data and the processing result. The interpretation result is used to represent the logical basis for the target model to obtain the processing result based on the intermediate data. For example, the interpretation result can be obtained through a model interpreter.
[0091] As an example, the model interpreter can be a neural network interpretation model with a model interpretation function. The intermediate data and the processing result are input into the neural network interpretation model to obtain the interpretation result.
[0092] Specifically, the model interpreter can determine the processing method of the target model for the input training data according to the intermediate data, so as to determine the basis for obtaining the above output result, that is, the interpretation result. Taking the target model as an image classification model as an example, according to the intermediate data, the model interpreter can determine the area of interest of the target model in the sample image and the feature information referred to by the processing result, and then determine the data on which the output result is based to obtain the interpretation result.
[0093] Reference Figure 6 , which shows the data flow 600 of the model adjustment method. First, load the target model 601 as the processing model 602 for processing the data to be processed. The processing model 602 can process the data to be processed to obtain the corresponding output result 603. Then, store the output result 603 and the intermediate data 604 in the processing process of obtaining the output result, so as to obtain the interpretation result 605 through the output result 603 and the intermediate data 604. Furthermore, the interpretation result 605 can feed back the adjustment process of the initial model 601.
[0094] In some optional implementation manners of this embodiment, the above-mentioned execution entity can determine the intermediate data in the forward propagation process in the following manner: determine the intermediate data corresponding to each stage in the forward propagation process. Each stage is obtained by dividing the forward propagation process based on a preset division method.
[0095] It can be understood that the forward propagation process generally includes multiple information processing stages. Among them, the division method of the stages can be specifically set according to actual needs. For example, it can be divided according to the structure of the model, specifically dividing the stages according to the hierarchical structure of each feature extraction layer. Another example is that it can be divided according to the definition of the stages by the model. For example, in a residual network, it is specifically divided into five stages from the first stage to the fifth stage.
[0096] In this implementation manner, the above-mentioned execution entity can execute the above step 503 in the following manner: obtain the interpretation result corresponding to each stage according to the intermediate data and the processing result corresponding to each stage in the forward propagation process.
[0097] Specifically, for each stage in the forward propagation process, the above-mentioned execution entity obtains the corresponding interpretation result for that stage through the model interpreter based on the intermediate data and output result corresponding to that stage. Among them, the interpretation process of the model interpreter for each stage can refer to the process of obtaining the above-mentioned interpretation result, which will not be elaborated here.
[0098] In this implementation manner, the above-mentioned execution entity obtains the intermediate data of each stage in the forward propagation process of the target model, and further obtains the corresponding interpretation result for each stage, improving the detail and referenceability of the interpretation result.
[0099] In some alternative implementation manners of this embodiment, the above-mentioned execution entity can adopt the deconvolution method to obtain the corresponding interpretation result for each stage according to the intermediate data and processing result corresponding to each stage in the forward propagation process.
[0100] It can be understood that in a general neural network model, feature extraction is performed through a convolutional network to perform subsequent feature information processing to obtain an output result. In this implementation manner, the above-mentioned execution entity can specifically understand the convolutional operation in the target model through the deconvolution method. Further, the above-mentioned execution entity can combine visualization techniques to display the corresponding interpretation result for each stage to facilitate users to view and connect the training process of the model. The visualization methods include but are not limited to heat maps, vector maps, etc.
[0101] In this implementation manner, the correctness of the interpretation result is improved through the deconvolution method.
[0102] Step 504, adjust the target model according to the interpretation result.
[0103] In this embodiment, the above-mentioned execution entity can adjust the target model according to the interpretation result.
[0104] Specifically, when there are deviations or errors in the processing result of the data to be processed, the reason for the deviation or error can be determined according to the interpretation result, and then the target model can be adjusted according to the determined reason.
[0105] Taking image classification as an example, through the user's review of the processing result, it is determined that the classification corresponding to the data to be processed is a dog, which indicates that the target model should focus on the area corresponding to the object of the dog in the data to be processed. However, if the interpretation result shows that there is a deviation between the focus area of the target model and the area corresponding to the object of the dog, it can be determined that the information processing method of the target model corresponding to the interpretation result is unreasonable. Thus, the above-mentioned execution entity can adjust the parameters of the target model to adjust the focus area of the target model.
[0106] In the case of obtaining the interpretation result of each stage, the above-mentioned execution entity can specifically determine the stage for which the parameter to be adjusted according to the interpretation result of each stage to adjust the target model in a targeted manner.
[0107] In this embodiment, a method for adjusting a model in combination with the interpretation result of a model interpreter is provided, which not only makes the model application stage interpretable, but also adjusts the model in combination with the interpretation result, thereby improving the accuracy of the model.
[0108] Continue to refer to Figure 7 , as an implementation of the methods shown in the above figures, the present disclosure provides an embodiment of an apparatus for assisting model training. This apparatus embodiment corresponds to Figure 2 the method embodiment shown, and this apparatus can be specifically applied to various electronic devices.
[0109] As shown in Figure 7 , the apparatus for assisting model training includes: a first acquisition unit 701 configured to acquire a training sample set, where the training samples in the training sample set include training data and label information; a first determination unit 702 configured to determine, during the process of training an initial model with the training sample set, intermediate data in the forward propagation process of the initial model obtaining an output result based on the input training data, and loss information between the output result and the corresponding label information; a first interpretation unit 703 configured to obtain an interpretation result according to the intermediate data and the output result, where the interpretation result is used to represent the logical basis for the initial model to obtain the output result based on the intermediate data; and a first adjustment unit 704 configured to adjust the initial model according to the loss information and the interpretation result to obtain a trained target model.
[0110] In some optional implementation manners of this embodiment, the first determination unit 702 is further configured to: determine intermediate data corresponding to each stage in the forward propagation process, where each stage is obtained by dividing the forward propagation process based on a preset division method; and the first interpretation unit 703 is further configured to: obtain interpretation results corresponding to each stage according to the intermediate data corresponding to each stage in the forward propagation process and the output result.
[0111] In some optional implementation manners of this embodiment, the first interpretation unit 703 is further configured to: obtain interpretation results corresponding to each stage according to the intermediate data corresponding to each stage in the forward propagation process and the output result by using the deconvolution method adopted by the model interpreter.
[0112] In some alternative implementation manners of this embodiment, the first adjustment unit 704 is further configured to: obtain an analysis result corresponding to the explanation result of each stage according to the label information and the explanation result corresponding to each stage in the forward propagation process, where the analysis result is used to indicate the rationality of the information processing manner of the stage corresponding to the explanation result; for each stage in the forward propagation process, adjust the parameter corresponding to this stage of the initial model according to the loss information and the analysis result corresponding to the explanation result of this stage, so as to obtain the trained target model.
[0113] In some alternative implementation manners of this embodiment, the first adjustment unit 704 is further configured to: for each stage in the forward propagation process, perform the following operations: determine the attention degree of the initial model to each part of the training data input in this stage according to the explanation result corresponding to this stage, where the attention degree is used to characterize the dependence degree of the initial model on each part of the training data in the process of obtaining the output result; obtain an analysis result corresponding to the explanation result of this stage according to the label information and the attention degree corresponding to this stage.
[0114] In some alternative implementation manners of this embodiment, the first adjustment unit 704 is further configured to: determine the target attention degree corresponding to this stage of the initial model according to the label information, where the target attention degree is used to characterize the dependence degree of the initial model on each part of the training data when obtaining the target output result corresponding to the label information; obtain an analysis result corresponding to the explanation result of this stage according to the target attention degree and the attention degree.
[0115] In this embodiment, a device for training a model by combining the explanation result of a model interpreter is provided, which not only makes the model learning stage interpretable, but also trains the model by combining the explanation result, improving the model training speed and the accuracy of the trained model.
[0116] Continue to refer to Figure 8 , as an implementation of the methods shown in the above figures, the present disclosure provides an embodiment of an adjustment device in the model application process. This device embodiment corresponds to Figure 5 the method embodiment shown, and this device can be specifically applied to various electronic devices.
[0117] Such as Figure 8As shown in the figure, the adjustment device in the model application process includes: a second acquisition unit 801 configured to acquire data to be processed; a second determination unit 802 configured to process the data to be processed through a target model and determine intermediate data in the forward propagation process of the target model obtaining a processing result based on the data to be processed; a second interpretation unit 803 configured to obtain an interpretation result according to the intermediate data and the processing result, where the interpretation result is used to characterize the logical basis for the target model to obtain the processing result based on the intermediate data; and a second adjustment unit 804 configured to adjust the target model according to the interpretation result.
[0118] In some alternative implementation manners of this embodiment, the second determination unit 802 is further configured to: determine intermediate data corresponding to each stage in the forward propagation process, where each stage is obtained by dividing the forward propagation process based on a preset division method; and the second interpretation unit 803 is further configured to: obtain an interpretation result corresponding to each stage according to the intermediate data corresponding to each stage in the forward propagation process and the processing result.
[0119] In some alternative implementation manners of this embodiment, the second interpretation unit 803 is further configured to: obtain an interpretation result corresponding to each stage according to the intermediate data corresponding to each stage in the forward propagation process and the processing result by using a deconvolution method.
[0120] In this embodiment, a device for adjusting a model in combination with the interpretation result of a model interpreter is provided, which not only makes the model application stage interpretable, but also adjusts the model in combination with the interpretation result, improving the accuracy of the model.
[0121] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and when the instructions are executed by the at least one processor, the at least one processor is enabled to implement the methods for assisting model training and model adjustment described in any of the above embodiments.
[0122] According to an embodiment of the present disclosure, the present disclosure also provides a readable storage medium storing computer instructions for enabling a computer to implement the methods for assisting model training and model adjustment described in any of the above embodiments when executed.
[0123] The embodiments of the present disclosure provide a computer program product that can implement the methods for assisting model training and model adjustment described in any of the above embodiments when executed by a processor.
[0124] Figure 9FIG. 0 shows a schematic block diagram of an exemplary electronic device 900 that can be used to implement embodiments of the present disclosure. The electronic device is intended to represent various forms of digital computers, such as, for example, laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as, for example, personal digital processors, cellular telephones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely exemplary and are not intended to limit the implementation of the present disclosure described and / or claimed herein.
[0125] As Figure 9 shown, the device 900 includes a computing unit 901 that can perform various appropriate actions and processes in accordance with a computer program stored in a read only memory (ROM) 902 or a computer program loaded from a storage unit 908 into a random access memory (RAM) 903. In the RAM 903, various programs and data required for operation of the device 900 can also be stored. The computing unit 901, the ROM 902, and the RAM 903 are connected to each other via a bus 904. An input / output (I / O) interface 905 is also connected to the bus 904.
[0126] A plurality of components in the device 900 are connected to the I / O interface 905, including: an input unit 906, such as, for example, a keyboard, a mouse, etc.; an output unit 907, such as, for example, various types of displays, speakers, etc.; a storage unit 908, such as, for example, a magnetic disk, an optical disk, etc.; and a communication unit 909, such as, for example, a network card, a modem, a wireless communication transceiver, etc. The communication unit 909 allows the device 900 to exchange information / data with other devices via a computer network such as the Internet and / or various telecommunication networks.
[0127] The computing unit 901 can be various general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 901 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 901 executes the various methods and processes described above, such as the method for assisting model training and the model adjustment method. For example, in some embodiments, the method for assisting model training and the model adjustment method can be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as the storage unit 908. In some embodiments, part or all of the computer program can be loaded and / or installed onto the device 900 via the ROM 902 and / or the communication unit 909. When the computer program is loaded into the RAM 903 and executed by the computing unit 901, one or more steps of the method for assisting model training and the model adjustment method described above can be executed. Alternatively, in other embodiments, the computing unit 901 can be configured to execute the method for assisting model training and the model adjustment method by any other suitable means (e.g., by means of firmware).
[0128] Various embodiments of the systems and techniques described above in this document can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include: being implemented in one or more computer programs, which can be executed and / or interpreted on a programmable system including at least one programmable processor, the programmable processor can be a dedicated or general-purpose programmable processor, can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit the data and instructions to the storage system, the at least one input device, and the at least one output device.
[0129] The program code for implementing the methods of the present disclosure can be written in any combination of one or more programming languages. These program codes can be provided to the processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing devices, such that when the program codes are executed by the processor or controller, the functions / operations specified in the flowcharts and / or block diagrams are implemented. The program codes can be executed entirely on the machine, partially on the machine, executed partially on the machine as an independent software package and partially on a remote machine, or executed entirely on a remote machine or server.
[0130] In the context of this disclosure, a machine-readable medium can be a tangible medium that can contain or store a program for use by or in connection with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0131] To provide for interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or a trackball) by which the user can provide input to the computer. Other kinds of devices can also be used to provide for interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic, speech, or tactile input).
[0132] The systems and techniques described herein can be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer having a graphical user interface or a web browser through which the user can interact with an implementation of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.
[0133] A computer system may include a client and a server. The client and the server are generally far from each other and usually interact via a communication network. The relationship between the client and the server is created by computer programs running on respective computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or a cloud host, which is a host product in the cloud computing service system to address the deficiencies of high management difficulty and weak business scalability existing in traditional physical hosts and virtual private server (VPS) services; it may also be a server of a distributed system or a server combined with a blockchain.
[0134] According to the technical solution of an embodiment of the present disclosure, a method for training a model by combining the interpretation results of a model interpreter is provided, which not only makes the model learning stage interpretable, but also combines the interpretation results to train the model, improving the model training speed and the accuracy of the trained model.
[0135] It should be understood that various forms of the processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in the present disclosure can be executed in parallel, sequentially, or in a different order, as long as the desired results of the technical solution provided by the present disclosure can be achieved, and no limitation is imposed herein.
[0136] The above specific embodiments do not constitute a limitation on the protection scope of the present disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present disclosure shall be included within the protection scope of the present disclosure.
Claims
1. A method for assisting model training, including: obtaining a training sample set, wherein the training samples in the training sample set include training data and label information; during the process of training an initial model with the training sample set, determining intermediate data in the forward propagation process of the initial model obtaining an output result according to the input training data, and loss information between the output result and the corresponding label information; obtaining an explanation result according to the intermediate data and the output result, wherein the explanation result is used to characterize the logical basis for the initial model to obtain the output result based on the intermediate data; adjusting the initial model according to the loss information and the explanation result to obtain a trained target model, including: determining some adjustment parameters from the parameters of the initial model according to the explanation result, and adjusting the some adjustment parameters according to the loss information to obtain the target model, wherein the target model is an image classification model or a target object detection model for images.
2. The method according to claim 1, wherein, the determining of the intermediate data in the forward propagation process of the initial model obtaining an output result according to the input training data includes: determining the intermediate data corresponding to each stage in the forward propagation process, wherein each stage is obtained by dividing the forward propagation process based on a preset division method; and the obtaining of the explanation result according to the intermediate data and the output result includes: obtaining the explanation result corresponding to each stage according to the intermediate data corresponding to each stage in the forward propagation process and the output result.
3. The method according to claim 1 or 2, wherein, the obtaining of the explanation result corresponding to each stage according to the intermediate data corresponding to each stage in the forward propagation process and the output result includes: obtaining the explanation result corresponding to each stage by using a deconvolution method according to the intermediate data corresponding to each stage in the forward propagation process and the output result.
4. The method according to claim 1 or 2, wherein, the adjusting of the initial model according to the loss information and the explanation result to obtain a trained target model includes: obtaining an analysis result corresponding to the explanation result of each stage according to the label information and the explanation result corresponding to each stage in the forward propagation process, wherein the analysis result is used to indicate the rationality of the information processing method of the stage corresponding to the explanation result; for each stage in the forward propagation process, adjusting the parameters corresponding to the stage of the initial model according to the loss information and the analysis result corresponding to the explanation result of the stage to obtain a trained target model.
5. The method according to claim 4, wherein, the obtaining of the analysis result corresponding to the explanation result of each stage according to the label information and the explanation result corresponding to each stage in the forward propagation process includes: for each stage in the forward propagation process, performing the following operations: According to the interpretation result corresponding to this stage, determine the attention degree of the initial model to each part of the training data in the input training data at this stage, where the attention degree is used to characterize the dependence degree of the initial model on each part of the training data in the process of obtaining the output result; Obtain the analysis result corresponding to the interpretation result of this stage according to the label information and the attention degree corresponding to this stage.
6. The method according to claim 5, wherein, The obtaining the analysis result corresponding to the interpretation result of this stage according to the label information and the attention degree corresponding to this stage includes: According to the label information, determine the target attention degree of the initial model corresponding to this stage, where the target attention degree is used to characterize the dependence degree of the initial model on each part of the training data when obtaining the target output result corresponding to the label information at this stage; Obtain the analysis result corresponding to the interpretation result of this stage according to the target attention degree and the attention degree.
7. A model adjustment method, including: Obtain the data to be processed; Process the data to be processed through the target model, and determine the intermediate data in the forward propagation process of the target model obtaining the processing result according to the data to be processed; Obtain the interpretation result according to the intermediate data and the processing result, where the interpretation result is used to characterize the logical basis for the target model to obtain the processing result based on the intermediate data; Adjust the target model according to the interpretation result, including: in response to the processing result having a deviation or error, determine the reason for the deviation or error according to the interpretation result; adjust the target model according to the reason, where the target model is an image classification model or a target object detection model for images.
8. The method according to claim 7, wherein, The determining the intermediate data in the forward propagation process of the target model obtaining the processing result according to the data to be processed includes: Determine the intermediate data corresponding to each stage in the forward propagation process, where each stage is obtained by dividing the forward propagation process based on a preset division method; and The obtaining the interpretation result according to the intermediate data and the processing result includes: Obtain the interpretation result corresponding to each stage according to the intermediate data corresponding to each stage in the forward propagation process and the processing result.
9. The method according to claim 7 or 8, wherein, The obtaining the interpretation result corresponding to each stage according to the intermediate data corresponding to each stage in the forward propagation process and the processing result includes: Obtain the interpretation result corresponding to each stage according to the intermediate data corresponding to each stage in the forward propagation process and the processing result by using the deconvolution method.
10. An apparatus for assisting model training, including: The first acquisition unit is configured to acquire a training sample set, where the training samples in the training sample set include training data and label information; A first determination unit, configured to determine intermediate data in the forward propagation process of the initial model obtaining an output result according to the input training data, and loss information between the output result and the corresponding label information during the process of training the initial model with the training sample set; A first interpretation unit, configured to obtain an interpretation result according to the intermediate data and the output result, where the interpretation result is used to characterize the logical basis for the initial model to obtain the output result based on the intermediate data; A first adjustment unit, configured to adjust the initial model according to the loss information and the interpretation result to obtain a trained target model, including: determining partial adjustment parameters from the parameters of the initial model according to the interpretation result, and adjusting the partial adjustment parameters according to the loss information to obtain the target model, where the target model is an image classification model or a target object detection model for images.
11. The apparatus according to claim 10, wherein, the first determination unit is further configured to: determine the intermediate data corresponding to each stage in the forward propagation process, where each stage is obtained by dividing the forward propagation process according to a preset division method; and the first interpretation unit is further configured to: obtain the interpretation results corresponding to each stage according to the intermediate data corresponding to each stage in the forward propagation process and the output result.
12. The apparatus according to claim 10 or 11, wherein, the first interpretation unit is further configured to: obtain the interpretation results corresponding to each stage by using a deconvolution method according to the intermediate data corresponding to each stage in the forward propagation process and the output result.
13. The apparatus according to claim 10 or 11, wherein, the first adjustment unit is further configured to: obtain an analysis result corresponding to the interpretation result of each stage according to the label information and the interpretation results corresponding to each stage in the forward propagation process, where the analysis result is used to indicate the rationality of the information processing method of the stage corresponding to the interpretation result; for each stage in the forward propagation process, adjust the parameters corresponding to the stage of the initial model according to the loss information and the analysis result corresponding to the interpretation result of the stage to obtain a trained target model.
14. The apparatus according to claim 13, wherein, the first adjustment unit is further configured to: for each stage in the forward propagation process, perform the following operations: determine the attention degree of the initial model to each part of the training data input in this stage according to the interpretation result corresponding to this stage, where the attention degree is used to characterize the dependence degree of the initial model on each part of the training data in the process of obtaining the output result; obtain the analysis result corresponding to the interpretation result of this stage according to the label information and the attention degree corresponding to this stage.
15. The apparatus according to claim 14, wherein, the first adjustment unit is further configured to: Determine the target attention corresponding to the initial model at this stage according to the label information, where the target attention is used to characterize the degree of dependence of the initial model on each part of the training data when obtaining the target output result corresponding to the label information; obtain the analysis result corresponding to the explanation result at this stage according to the target attention and the attention.
16. A model adjustment device, comprising: A second acquisition unit configured to acquire data to be processed; A second determination unit configured to process the data to be processed through a target model and determine intermediate data in the forward propagation process of the target model obtaining a processing result according to the data to be processed; A second explanation unit configured to obtain an explanation result according to the intermediate data and the processing result, where the explanation result is used to characterize the logical basis for the target model to obtain the processing result based on the intermediate data; A second adjustment unit configured to adjust the target model according to the explanation result, including: in response to the processing result having a deviation or error, determining the reason for the deviation or error according to the explanation result; adjusting the target model according to the reason, where the target model is an image classification model or a target object detection model for images.
17. The device according to claim 16, wherein, the second determination unit is further configured to: determine the intermediate data corresponding to each stage in the forward propagation process, where each stage is obtained by dividing the forward propagation process based on a preset division method; and the second explanation unit is further configured to: obtain the explanation result corresponding to each stage according to the intermediate data corresponding to each stage in the forward propagation process and the processing result.
18. The device according to claim 16 or 17, wherein, the second explanation unit is further configured to: obtain the explanation result corresponding to each stage according to the intermediate data corresponding to each stage in the forward propagation process and the processing result by using a deconvolution method.
19. An electronic device, characterized in that it includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein, the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the method according to any one of claims 1-9.
20. A non-transitory computer-readable storage medium storing computer instructions, characterized in that the computer instructions are used to cause the computer to execute the method according to any one of claims 1-9.
21. A computer program product, comprising: a computer program that, when executed by a processor, implements the method according to any one of claims 1-9.
Citation Information
Patent Citations
Training method and device of data processing model, electronic equipment and storage medium
CN113361574A
Model training method and device, intention recognition method and device, electronic equipment and storage medium
CN113673237A