Data updating method and device, electronic equipment and computer storage medium
By setting up an additional network layer in the neural network model, its parameter matrix is the product of two parameter matrices to be updated, and these parameter matrices are updated, the problem of long training time of neural network model is solved and the training efficiency is improved.
Patent Information
- Application Number
- CN202411563499.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-10
- Publication Date
- 2025-03-07
AI Technical Summary
The training time of neural network models is longer and the training efficiency is low.
An additional network layer matching the function of at least one network layer is set in the model to be trained, and its parameter matrix is the product of at least two parameter matrices to be updated, and these parameter matrices are updated according to the training data to obtain the target model.
By reducing the amount of parameters that need to be updated, the amount of training data and time required for updates is reduced, and the training efficiency is improved.
Smart Images

Figure CN119578456A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a data updating method, device, electronic device and computer storage medium. Background Art
[0002] With the development of science and technology, the application of neural network models is becoming more and more extensive. Before using the neural network model, it is necessary to train the neural network model.
[0003] In order to ensure the application effect of the neural network model, it is usually necessary to use more data to train the neural network model, which leads to longer training time and lower training efficiency. Summary of the invention
[0004] The embodiments of the present application provide a data updating method, device, electronic device and computer storage medium, which can solve the technical problems of long training time and low training efficiency of neural network models.
[0005] The present application provides a data updating method, including:
[0006] Obtain a model to be trained and a data set of the model to be trained, wherein the data set includes a plurality of training data;
[0007] In the above-mentioned model to be trained, an additional network layer is set to match the function of at least one network layer of the above-mentioned model to be trained, and the parameter matrix of the above-mentioned additional network layer is the product of at least two parameter matrices to be updated;
[0008] According to the training data, the at least two parameter matrices to be updated in the model to be trained are updated to obtain a target model corresponding to the model to be trained.
[0009] Accordingly, an embodiment of the present application provides a data updating device, comprising:
[0010] An acquisition module is used to acquire a model to be trained and a data set of the model to be trained, wherein the data set includes a plurality of training data;
[0011] A setting module, used for setting, in the above-mentioned model to be trained, an additional network layer that matches the function of at least one network layer of the above-mentioned model to be trained, wherein the parameter matrix of the above-mentioned additional network layer is the product of at least two parameter matrices to be updated;
[0012] The training module is used to update the at least two parameter matrices to be updated in the model to be trained according to the training data to obtain a target model corresponding to the model to be trained.
[0013] In addition, an embodiment of the present application also provides an electronic device, including a processor and a memory, the memory stores a computer program, and the processor is used to run the computer program in the memory to implement the data updating method provided in the embodiment of the present application.
[0014] In addition, an embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and the computer program is suitable for loading by a processor to execute any data updating method provided in the embodiment of the present application.
[0015] In addition, an embodiment of the present application also provides a computer program product, including a computer program, and when the computer program is executed by a processor, any data updating method provided in the embodiment of the present application is implemented.
[0016] In an embodiment of the present application, a model to be trained and a data set of the model to be trained are obtained, the data set including multiple training data; in the model to be trained, an additional network layer is set that matches the function of at least one network layer of the model to be trained, and the parameter matrix of the additional network layer is the product of at least two parameter matrices to be updated; according to the training data, at least two parameter matrices to be updated in the model to be trained are updated to obtain a target model corresponding to the model to be trained, and since the parameter matrix of the additional network layer is the product of at least two parameter matrices to be updated, the parameter matrix of the additional network layer needs to update fewer parameters, so as to reduce the training data required for the update, reduce the time for updating the model to be trained, and improve the efficiency of updating the model to be trained. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0018] Figure 1 It is a flowchart of a data updating method provided in an embodiment of the present application;
[0019] Figure 2 is a schematic diagram of a model to be trained provided in an embodiment of the present application;
[0020] Figure 3 is a schematic diagram of another model to be trained provided in an embodiment of the present application;
[0021] Figure 4 is a schematic diagram of another model to be trained provided in an embodiment of the present application;
[0022] Figure 5is a schematic diagram of a parameter matrix to be updated provided in an embodiment of the present application;
[0023] Figure 6 is a structural diagram of a data updating device provided in an embodiment of the present application;
[0024] Figure 7 It is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0025] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of this application.
[0026] The embodiment of the present application provides a data updating method, device, electronic device and computer storage medium. The data updating device can be integrated in an electronic device, which can be a server or a terminal.
[0027] Among them, the server can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, network acceleration services (Content Delivery Network, CDN), as well as big data and artificial intelligence platforms.
[0028] The terminal may be a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart speaker, a smart watch, etc., but is not limited thereto. The terminal and the server may be directly or indirectly connected via wired or wireless communication, and this application does not limit this.
[0029] In addition, the term "plurality" in the embodiments of the present application refers to two or more than two. The terms "first" and "second" in the embodiments of the present application are used to distinguish descriptions and should not be understood as implying relative importance.
[0030] It should be noted that the description order of the following embodiments is not intended to limit the preferred order of the embodiments.
[0031] In this embodiment, the data updating method will be described from the perspective of the data updating device. To facilitate the description of the data updating method of the present application, the data updating device will be integrated in the terminal for detailed description, that is, the terminal will be used as the execution subject for detailed description.
[0032] See also Figure 1 , Figure 1 : is a flow chart of a data updating method provided by an embodiment of the present application. The data updating method may include:
[0033] S101. Obtain a model to be trained and a data set corresponding to the model to be trained, where the data set includes at least one training data.
[0034] The model to be trained refers to a network system formed by connecting various network layers. The network layer may include at least one neuron, and the neuron refers to a computing unit.
[0035] The type of model to be trained can be selected according to actual conditions. For example, the model to be trained can be a convolutional neural network model (CNN) or a recurrent neural network (RNN), which is not limited in the embodiments of the present application.
[0036] The model to be trained may be an initialized model or a model trained using a large-scale common data set. The type of the large-scale common data set may be selected according to actual conditions. For example, the large-scale common data set may be "Mozilla Common Voice" or "IBM Diversity in Faces Dataset", which is not limited in the embodiments of the present application.
[0037] The data set corresponding to the model to be trained may be a data set of a certain business, and the data set of a certain business may include data of at least one business vertical category of the business scenario. A business vertical category refers to a subdivision category of a business. For example, if the business is a video business, the business vertical category may be a food broadcasting video business.
[0038] When the model to be trained is a model trained with a large-scale common data set, after the data set corresponding to the model to be trained is used to update the model to be trained and the target model is obtained, not only can the target model maintain its universality, but also can be adapted to the business vertical category corresponding to the data set. The target model is adapted to the business vertical category corresponding to the data set, which can be understood as the target model has a better application effect in the business vertical category.
[0039] The form of the training data in the data set can be set according to actual conditions. For example, the training data can be at least one of images, text, audio or video, which is not limited in the embodiments of the present application.
[0040] Optionally, the terminal may obtain the model to be trained and the data set of the model to be trained in a local storage space, or the terminal may obtain the model to be trained and the data set of the model to be trained in other devices (the other devices may be other terminals or servers).
[0041] The manner in which the terminal obtains the model to be trained and the data set of the model to be trained can be set according to actual conditions, and the embodiments of the present application are not limited thereto.
[0042] S102: In the model to be trained, an additional network layer is set that matches the function of at least one network layer of the model to be trained, and a parameter matrix of the additional network layer is the product of at least two parameter matrices to be updated.
[0043] An additional network layer that matches the function of at least one network layer of the model to be trained can be understood as a network layer with the same function as the at least one network layer.
[0044] For example, if the function of at least one network layer is a feature extraction function, then the function of the additional network layer matching the function of the at least one network layer is also a feature extraction function.
[0045] The terminal can determine the function of at least one network layer of the model to be trained and the position of at least one network layer in the model to be trained, and then set an additional network layer matching the function at a position matching the position.
[0046] The position that matches the position may be a position that is parallel to the position or a position that is adjacent to the position and located after the position.
[0047] For example, the model to be trained can be Figure 2 As shown, the model to be trained includes an input layer, a convolutional layer and an output layer. At least one network layer is a convolutional layer. The output data of the convolutional layer can be "Y=WX", where Y represents the output data of the convolutional layer, W represents the parameter matrix of the convolutional layer, and X represents the input data of the convolutional layer.
[0048] After setting an additional network layer that matches the function of at least one network layer, if the position of the additional network layer is parallel to the position of the at least one network layer, the model to be trained can be as follows: Figure 3 As shown in , the output data corresponding to the convolution layer can be changed to "Y = (W + ΔW) X", ΔW is the parameter matrix of the additional network layer. If the position of the additional network layer is adjacent to the position of at least one network layer and is located after the position of at least one network layer, then the model to be trained can be as follows Figure 4 As shown, the output data corresponding to the convolutional layer can be changed to Y=WXΔW, where ΔW is the parameter matrix of the additional network layer.
[0049] After the terminal sets an additional network layer that matches the function of at least one network layer of the model to be trained in the model to be trained, if the parameter matrix of the additional network layer corresponds to one, the amount of updated parameters cannot be reduced when the parameter matrix of the additional network layer is updated. Therefore, in an embodiment of the present application, the parameter matrix of the additional network layer is set to the product of at least two parameter matrices to be updated so as to reduce the amount of parameters that need to be updated, thereby reducing the amount of data required for the update, reducing the update time, and improving the update efficiency, so as to achieve the training effect achieved by the model to be trained without the additional network layer under more training data with less training data.
[0050] For example, the parameter matrix of the additional network layer is ΔW, and the size of ΔW is m*n. Then, when ΔW is set to the product of two parameter matrices to be updated, the sizes of the two parameter matrices to be updated can be m*r and r*n, that is, ΔW = ΔW 1 *ΔW 2 At this time, the relationship between the parameter matrix of the additional network layer and the two parameter matrices to be updated can be as follows Figure 5 As shown, when m and n are both equal to 768 and r is equal to 64, if ΔW is not set to the product of two parameter matrices to be updated, the amount of parameters that need to be updated is "768*768=589824"; if ΔW is set to the product of two parameter matrices to be updated, the amount of parameters that need to be updated is "768*64+64*768=98304", which is 6 times less than the amount of parameters that need to be updated.
[0051] Optionally, at least one additional network layer may be set for a network layer. Additional network layers may be set for all network layers in the model to be trained, or additional network layers may be set for some of the network layers in the model to be trained.
[0052] When additional network layers are set for some of all network layers in the model to be trained, in the model to be trained, the process of setting the additional network layer matching the function of at least one network layer of the model to be trained may be:
[0053] Get the size of the parameter matrix corresponding to each network layer in the model to be trained;
[0054] Taking a network layer corresponding to a size that meets a preset size condition as at least one network layer;
[0055] An additional network layer is provided that matches the functionality of the at least one network layer.
[0056] Among them, the size that meets the preset size condition can be understood as a larger size. Since when the size of the parameter matrix is large, it indicates that the parameter matrix needs to update a large amount of parameters, and when the size of the parameter matrix is small, it indicates that the parameter matrix needs to update a small amount of parameters, therefore, in the embodiment of the present application, when the size of the parameter matrix of the network layer is small, it is not necessary to set an additional network layer for the network layer, and then update the parameter matrix of the network layer according to the training data. When the size of the parameter matrix of the network layer is large, an additional network layer matching the function of the network layer is set at a position matching the position of the network layer, and then the parameter matrix of the additional network layer of the network layer is updated according to the training data, so that while reducing the amount of updated parameters, the number of additional network layers can be reduced, thereby reducing the size of the model to be trained.
[0057] In some embodiments, in the model to be trained, setting an additional network layer that matches the function of at least one network layer of the model to be trained includes:
[0058] Determine the size of a parameter matrix corresponding to at least one network layer in the model to be trained;
[0059] According to the size, set the initial parameter matrix;
[0060] Decomposing the initial parameter matrix to obtain at least two parameter matrices to be updated;
[0061] According to the two parameter matrices to be updated, in the model to be trained, an additional network layer is set that matches the function of at least one network layer of the model to be trained.
[0062] The initial parameter matrix is the parameter matrix of the additional network layer. The terminal can use the size of the parameter matrix corresponding to at least one network layer as the size of the initial parameter matrix. The parameters in the initial parameter matrix can be preset values or randomly generated values. For example, when the parameters in the initial parameter matrix are preset values and the preset values are 0, the parameters in the initial parameter matrix can all be 0. For another example, when the parameters in the initial parameter matrix are randomly generated values, the parameters in the initial parameter matrix can be 0 and 1.
[0063] Optionally, in order to further reduce the number of updates of the parameter matrix to be updated and improve the update efficiency, the process of setting the initial parameter matrix according to the size can be:
[0064] Determine the business vertical category corresponding to the data set of the model to be trained;
[0065] Obtain a trained model associated with the business vertical class. The trained model is a network layer model with the same functions as the model to be trained.
[0066] Determine parameters in a parameter matrix of an additional network layer that matches the function of at least one network layer in the trained model to obtain candidate parameters;
[0067] Based on the size and candidate parameters, set the initial parameter matrix.
[0068] Among them, the trained model associated with the business vertical category can be understood as a model adapted to the business vertical category, or as a model trained by the data set of the model to be trained, or as a model trained by the data set of the candidate business vertical category matching the business vertical category. The candidate business vertical category can be understood as a business vertical category whose similarity with the business vertical category of the data set is greater than a preset similarity.
[0069] For example, a business vertical category may be food broadcast videos, and a candidate business vertical category matching the business vertical category may be cooking videos.
[0070] In an embodiment of the present application, a business vertical category corresponding to a data set of a model to be trained is determined; a trained model matching the business vertical category is obtained, wherein the trained model is a model of a network layer having the same function as the model to be trained; parameters in a parameter matrix of an additional network layer that matches the function of at least one network layer in the trained model are determined to obtain candidate parameters; an initial parameter matrix is set according to the size and the candidate parameters so as to reduce the number of updates of at least two parameter matrices to be updated obtained according to the initial parameter matrix, thereby further improving the update efficiency.
[0071] For example, the business vertical category is plant image, the model to be trained is used to segment plant images, and the trained model obtained by training the data set of the business vertical category is used to recognize plant images. The model to be trained and the trained model both include convolutional layers, and at least one network layer is a convolutional layer. In this case, the parameters of the parameter matrix of the additional network layer of the convolutional layer in the trained model can be used as candidate parameters, the candidate parameters can be used as parameters in the initial parameter matrix, and the size can be used as the size of the initial parameter matrix.
[0072] For another example, the business vertical category is eating broadcast videos, and the candidate business vertical category is cooking videos. The model to be trained is used to identify eating broadcast videos, and the trained model trained with the data set of the candidate business vertical category is used to identify cooking videos. The model to be trained and the trained model both include convolutional layers, and at least one network layer is a convolutional layer. In this case, the parameters of the parameter matrix of the additional network layer of the convolutional layer in the trained model can be used as candidate parameters, the candidate parameters can be used as parameters in the initial parameter matrix, and the size can be used as the size of the initial parameter matrix.
[0073] After obtaining the initial parameter matrix, the terminal decomposes the initial parameter matrix to obtain at least two parameter matrices to be updated. The terminal may obtain a preset size coefficient, and then decompose the initial parameter matrix according to the preset size coefficient to obtain at least two parameter matrices to be updated.
[0074] For example, if the preset size coefficient is r and the initial parameter matrix is m*n, the sizes of the two parameter matrices to be updated may be m*r and r*n respectively.
[0075] Alternatively, the decomposition size coefficient may be determined according to the amount of training data in the data set; and the initial parameter matrix may be decomposed according to the decomposition size coefficient to obtain at least two parameter matrices to be updated.
[0076] For example, the smaller the number of training data in the data set, the smaller the decomposition size coefficient, and the larger the number of training data in the data set, the larger the decomposition size coefficient. This allows the number of parameters of the parameter matrix to be updated obtained according to the decomposition size coefficient to be smaller when the number of training data is smaller, and the number of parameters that need to be updated is smaller. When the number of training data is larger, the number of parameters of the parameter matrix to be updated obtained according to the decomposition size coefficient can be larger, so as to refine the parameters of the parameter matrix of the additional network layer, so that the accuracy of the parameter matrix of the additional network layer can be improved while ensuring the efficiency of training.
[0077] Optionally, the terminal may also determine the number of parameter matrices to be updated according to the number of training data in the data set, and decompose the initial parameter matrix according to the number to obtain at least two parameter matrices to be updated.
[0078] For example, the fewer the number of training data in the data set, the more the number of parameter matrices to be updated can be, and the more the number of training data in the data set, the fewer the number of parameter matrices to be updated can be, so that when the number of training data is smaller, the amount of parameters of the parameter matrix to be updated obtained according to the number is smaller, and the amount of parameters that need to be updated is smaller, and when the number of training data is larger, the amount of parameters of the parameter matrix to be updated obtained according to the number can be larger, so as to refine the parameters of the parameter matrix of the additional network layer, so that the accuracy of the parameter matrix of the additional network layer can be improved while ensuring the efficiency of training.
[0079] Optionally, in the process of determining the decomposition size coefficient according to the number of training data in the data set, the number of parameter matrices to be updated can also be determined according to the number of training data in the data set, and then the decomposition size coefficient is determined according to the number.
[0080] After obtaining at least two parameter matrices to be updated, the terminal sets an additional network layer matching the function of at least one network layer at a position matching the position of at least one network layer according to the at least two parameter matrices to be updated.
[0081] S103. Update at least two parameter matrices to be updated in the model to be trained according to the training data to obtain a target model corresponding to the model to be trained.
[0082] Since model training is essentially updating the parameters in the parameter matrix of the network layer in the model, in an embodiment of the present application, at least two parameter matrices to be updated in the model to be trained are updated according to the training data, which is essentially training the model to be trained, thereby obtaining a target model after the training of the model to be trained is completed.
[0083] The function of the target model can be set according to actual conditions. For example, the target model can be used for image processing (image processing can be, for example, image recognition or image segmentation, etc.), audio recognition, and text recognition, etc. The embodiments of the present application are not limited here.
[0084] Optionally, according to the training data, at least two parameter matrices to be updated in the model to be trained are updated to obtain a target model corresponding to the model to be trained. The process may be:
[0085] Extract features from the training data to obtain sample features corresponding to the training data;
[0086] Determine the loss value of the model to be trained based on sample characteristics;
[0087] If the loss value meets the preset loss condition, the model to be trained is used as the target model;
[0088] If the loss value does not meet the preset loss condition, at least two parameter matrices to be updated are updated according to the loss value to obtain an updated model, the updated model is used as the model to be trained, and the step of performing feature extraction on the training data to obtain sample features corresponding to the training data is returned.
[0089] Optionally, when the update of at least two parameter matrices to be updated in the model to be trained is completed according to the training data, the model to be trained can be directly used as the target model, that is, at this time, the network layer in the target model and the additional network layer corresponding to the network layer exist separately.
[0090] Alternatively, when the update of at least two parameter matrices to be updated in the model to be trained is completed according to the training data, the network layer in the model to be trained and the additional network layer corresponding to the network layer can be fused to obtain the target model. At this time, according to the training data, at least two parameter matrices to be updated in the model to be trained are updated to obtain the target model corresponding to the model to be trained, including:
[0091] According to the training data, at least two parameter matrices to be updated in the model to be trained are updated to obtain a candidate model corresponding to the model to be trained;
[0092] At least one network layer in the candidate model and at least one additional network layer corresponding to the network layer are fused to obtain a target model corresponding to the model to be trained.
[0093] In an embodiment of the present application, at least two parameter matrices to be updated in the model to be trained are updated according to the training data to obtain a candidate model corresponding to the model to be trained; at least one network layer in the candidate model and at least one additional network layer corresponding to the network layer are fused to obtain a target model corresponding to the model to be trained, so that the network layer in the target model and the additional network layer corresponding to the network layer are fused into a new network layer, which is convenient for subsequent calculations when performing data processing through the target model.
[0094] From the above, it can be seen that in an embodiment of the present application, a model to be trained and a data set of the model to be trained are obtained, and the data set includes multiple training data; in the model to be trained, an additional network layer that matches the function of at least one network layer of the model to be trained is set, and the parameter matrix of the additional network layer is the product of at least two parameter matrices to be updated; according to the training data, at least two parameter matrices to be updated in the model to be trained are updated to obtain a target model corresponding to the model to be trained. Since the parameter matrix of the additional network layer is the product of at least two parameter matrices to be updated, the parameter matrix of the additional network layer needs to update fewer parameters, so as to reduce the training data required for the update, reduce the time for updating the model to be trained, and improve the efficiency of updating the model to be trained.
[0095] In order to better implement the data updating method provided in the embodiment of the present application, the embodiment of the present application also provides a device based on the above data updating method. The meanings of the terms are the same as those in the above data updating method, and the specific implementation details can refer to the description in the method embodiment.
[0096] For example, Figure 6 As shown, the data updating device may include:
[0097] The acquisition module 601 is used to acquire the model to be trained and the data set of the model to be trained, and the data set includes multiple training data.
[0098] The setting module 602 is used to set an additional network layer in the model to be trained that matches the function of at least one network layer of the model to be trained, and the parameter matrix of the additional network layer is the product of at least two parameter matrices to be updated.
[0099] The training module 603 is used to update at least two parameter matrices to be updated in the model to be trained according to the training data to obtain a target model corresponding to the model to be trained.
[0100] Optionally, the setting module 602 is specifically configured to execute:
[0101] Determine the size of a parameter matrix corresponding to at least one network layer in the model to be trained;
[0102] According to the size, set the initial parameter matrix;
[0103] Decomposing the initial parameter matrix to obtain at least two parameter matrices to be updated;
[0104] According to the two parameter matrices to be updated, in the model to be trained, an additional network layer is set that matches the function of at least one network layer of the model to be trained.
[0105] Optionally, the setting module 602 is specifically configured to execute:
[0106] Determine the decomposition size coefficient according to the amount of training data in the data set;
[0107] The initial parameter matrix is decomposed according to the decomposition size coefficient to obtain at least two parameter matrices to be updated.
[0108] Optionally, the setting module 602 is specifically configured to execute:
[0109] According to the number of training data in the data set, determine the number of parameter matrices to be updated;
[0110] According to the number, the initial parameter matrix is decomposed to obtain at least two parameter matrices to be updated.
[0111] Optionally, the setting module 602 is specifically configured to execute:
[0112] Determine the function of at least one network layer of the model to be trained and the position of at least one network layer in the model to be trained;
[0113] Set additional network layers matching the features in parallel with the positions.
[0114] Optionally, the setting module 602 is specifically configured to execute:
[0115] Get the size of the parameter matrix corresponding to each network layer in the model to be trained;
[0116] Taking a network layer corresponding to a size that meets a preset size condition as at least one network layer;
[0117] An additional network layer is provided that matches the functionality of the at least one network layer.
[0118] Optionally, the training module 603 is specifically configured to execute:
[0119] According to the training data, at least two parameter matrices to be updated in the model to be trained are updated to obtain a candidate model corresponding to the model to be trained;
[0120] At least one network layer in the candidate model and at least one additional network layer corresponding to the network layer are fused to obtain a target model corresponding to the model to be trained.
[0121] In specific implementation, the above modules can be implemented as independent entities, or can be arbitrarily combined and implemented as the same or several entities. The specific implementation methods and corresponding beneficial effects of the above modules can be found in the previous method embodiments, which will not be repeated here.
[0122] The present application also provides an electronic device, which may be a server or a terminal, etc. Figure 7 As shown, it shows a schematic diagram of the structure of the electronic device involved in the embodiment of the present application, specifically:
[0123] The electronic device may include components such as a processor 701 with one or more processing cores, a memory 702 with one or more computer-readable storage media, a power supply 703, and an input unit 704. Those skilled in the art will appreciate that Figure 7 The electronic device structure shown in the figure does not constitute a limitation on the electronic device, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.
[0124] The processor 701 is the control center of the electronic device, which uses various interfaces and lines to connect various parts of the entire electronic device, and executes various functions of the electronic device and processes data by running or executing computer programs and / or modules stored in the memory 702, and calling data stored in the memory 702. Optionally, the processor 701 may include one or more processing cores; preferably, the processor 701 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, and application programs, and the modem processor mainly processes wireless communications. It is understandable that the above-mentioned modem processor may not be integrated into the processor 701.
[0125] The memory 702 can be used to store computer programs and modules. The processor 701 executes various functional applications and data updates by running the computer programs and modules stored in the memory 702. The memory 702 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, a computer program required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area may store data created according to the use of the electronic device, etc. In addition, the memory 702 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices. Accordingly, the memory 702 may also include a memory controller to provide the processor 701 with access to the memory 702.
[0126] The electronic device also includes a power supply 703 for supplying power to each component. Preferably, the power supply 703 can be logically connected to the processor 701 through a power management system, so as to manage charging, discharging, and power consumption through the power management system. The power supply 703 can also include any components such as one or more DC or AC power supplies, recharging systems, power failure detection circuits, power converters or inverters, and power status indicators.
[0127] The electronic device may further include an input unit 704, which may be used to receive input digital or character information and generate keyboard, mouse, joystick, optical or trackball signal input related to user settings and function control.
[0128] Although not shown, the electronic device may further include a display unit, etc., which will not be described in detail herein. Specifically in this embodiment, the processor 701 in the electronic device will load the executable files corresponding to the processes of one or more computer programs into the memory 702 according to the following instructions, and the processor 701 will run the computer programs stored in the memory 702, thereby realizing various functions, such as:
[0129] Obtain a model to be trained and a data set corresponding to the model to be trained, where the data set includes at least one training data;
[0130] In the model to be trained, an additional network layer is set that matches the function of at least one network layer of the model to be trained, and a parameter matrix of the additional network layer is the product of at least two parameter matrices to be updated;
[0131] According to the training data, at least two parameter matrices to be updated in the model to be trained are updated to obtain a target model corresponding to the model to be trained.
[0132] The specific implementation methods and corresponding beneficial effects of the above operations can be found in the detailed description of the data updating method above, which will not be elaborated here.
[0133] A person of ordinary skill in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be accomplished by a computer program, or by controlling related hardware through a computer program. The computer program may be stored in a computer-readable storage medium and loaded and executed by a processor.
[0134] To this end, an embodiment of the present application provides a computer-readable storage medium, in which a computer program is stored, and the computer program can be loaded by a processor to execute the steps in any data update method provided in the embodiment of the present application. For example, the computer program can execute the following steps:
[0135] Obtain a model to be trained and a data set corresponding to the model to be trained, where the data set includes at least one training data;
[0136] In the model to be trained, an additional network layer is set that matches the function of at least one network layer of the model to be trained, and a parameter matrix of the additional network layer is the product of at least two parameter matrices to be updated;
[0137] According to the training data, at least two parameter matrices to be updated in the model to be trained are updated to obtain a target model corresponding to the model to be trained.
[0138] The specific implementation methods and corresponding beneficial effects of the above operations can be found in the previous embodiments, which will not be described in detail here.
[0139] The computer-readable storage medium may include: a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0140] Since the computer program stored in the computer-readable storage medium can execute the steps in any data updating method provided in the embodiments of the present application, the beneficial effects that can be achieved by any data updating method provided in the embodiments of the present application can be achieved. Please refer to the previous embodiments for details and will not be repeated here.
[0141] According to one aspect of the present application, a computer program product or a computer program is provided, the computer program product or the computer program includes computer instructions, the computer instructions are stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the above-mentioned data updating method.
[0142] The above is a detailed introduction to a data updating method, device, electronic device and computer storage medium provided in the embodiments of the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for technical personnel in this field, according to the ideas of the present application, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A data updating method, characterized in that: include: Acquire a model to be trained and a data set corresponding to the model to be trained, wherein the data set includes at least one training data, and the model to be trained is a trained model; In the model to be trained, an additional network layer is added that matches at least one network layer of the model to be trained, wherein a parameter matrix of the additional network layer is a product of at least two parameter matrices to be updated, and a size of the product of the at least two parameter matrices to be updated is the same as a size of the parameter matrix of the at least one network layer; According to the training data, the at least two parameter matrices to be updated in the model to be trained are updated to obtain a target model corresponding to the model to be trained.
2. The data updating method according to claim 1, characterized in that: The step of adding an additional network layer that matches and is connected to at least one network layer of the model to be trained to the model to be trained comprises: Determine the size of a parameter matrix corresponding to at least one network layer in the model to be trained; According to the size, setting an initial parameter matrix; Decomposing the initial parameter matrix to obtain at least two parameter matrices to be updated; According to the two parameter matrices to be updated, an additional network layer matching at least one network layer of the model to be trained is added to the model to be trained.
3. The data updating method according to claim 2, characterized in that: The decomposing the initial parameter matrix to obtain at least two parameter matrices to be updated includes: Determining a decomposition size coefficient according to the amount of the training data in the data set; The initial parameter matrix is decomposed according to the decomposition size coefficient to obtain at least two parameter matrices to be updated.
4. The data updating method according to claim 2, characterized in that: The decomposing the initial parameter matrix to obtain at least two parameter matrices to be updated includes: Determining the number of the parameter matrices to be updated according to the number of the training data in the data set; According to the number, the initial parameter matrix is decomposed to obtain at least two parameter matrices to be updated.
5. The method according to claim 2, characterized in that: The step of setting an initial parameter matrix according to the size includes: Determine the business vertical category corresponding to the data set; Obtain a trained model associated with the business vertical class, where the trained model is a network layer model having the same function as the model to be trained; Determine parameters in a parameter matrix of a network layer corresponding to the additional network layer in the trained model to obtain candidate parameters; The initial parameter matrix is set according to the size and the candidate parameters.
6. The method according to claim 2, characterized in that The step of determining the decomposition size coefficient according to the amount of the training data in the data set includes: Determining the number of the parameter matrices to be updated according to the number of the training data in the data set; The decomposition size coefficient is determined according to the number.
7. The data updating method according to claim 1, characterized in that: The step of adding an additional network layer matching at least one network layer of the model to be trained to the model to be trained comprises: Determine the function of at least one network layer of the model to be trained and the position of the at least one network layer in the model to be trained; An additional network layer matching the function is added at a position matching the position.
8. The data updating method according to claim 1, characterized in that: The step of adding an additional network layer matching at least one network layer of the model to be trained to the model to be trained comprises: Obtain the size of the parameter matrix corresponding to each network layer in the model to be trained; Taking a network layer corresponding to a size that meets a preset size condition as at least one network layer; An additional network layer is added that matches the at least one network layer.
9. The data updating method according to any one of claims 1 to 8, characterized in that: The updating of the at least two parameter matrices to be updated in the model to be trained according to the training data to obtain a target model corresponding to the model to be trained includes: According to the training data, the at least two parameter matrices to be updated in the model to be trained are updated to obtain a candidate model corresponding to the model to be trained; The at least one network layer in the candidate model and the additional network layer corresponding to the at least one network layer are fused to obtain a target model corresponding to the model to be trained.
10. A data updating device, characterized in that: include: An acquisition module, used to acquire a model to be trained and a data set of the model to be trained, wherein the data set includes at least one training data, and the model to be trained is a trained model; A setting module, configured to add, in the model to be trained, an additional network layer that matches at least one network layer of the model to be trained, wherein a parameter matrix of the additional network layer is a product of at least two parameter matrices to be updated, and a size of the product of the at least two parameter matrices to be updated is the same as a size of a parameter matrix of the at least one network layer; The training module is used to update the at least two parameter matrices to be updated in the model to be trained according to the training data to obtain a target model corresponding to the model to be trained.
11. An electronic device, characterized in that: It comprises a processor and a memory, wherein the memory stores a computer program, and the processor is used to run the computer program in the memory to execute the data updating method according to any one of claims 1 to 9.
12. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and the computer program is suitable for being loaded by a processor to execute the data updating method according to any one of claims 1 to 9.