Model training method, device, equipment and storage medium for deep learning model
By performing conversion and testing from floating point to integer during the training phase of the deep learning model, ensuring that the model meets the convergence state conditions before deployment, the problem of accuracy loss when converting from floating point to integer is solved, and the reliability of the embedded system is improved. Data Processing Accuracy.
Patent Information
- Application Number
- CN202210107268.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-28
- Publication Date
- 2024-10-29
- Estimated Expiration
- 2042-01-28
AI Technical Summary
In the existing technology, there is a precision loss when the deep learning model is converted from floating point to integer, which leads to deviations in the recognition or decision-making output results of the embedded system when using the model, and even the output results are reversed, affecting the accuracy of the system's data processing. sex.
In the model training phase, the training data is used to pre-train the floating-point deep learning model and converted to integer type; in the model testing phase, the test data is used to determine whether the integer model meets the convergence state conditions, and if it does not, return In the training phase, the next round of pre-training is performed until an integer model that meets the conditions is obtained.
By incorporating the model conversion process into the training process, it reduces the accuracy loss when the deep learning model is converted from floating point to integer, improves the accuracy of model training, avoids the accuracy loss when the embedded system deploys the model, and ensures Accuracy of data processing.
Smart Images

Figure CN114492649B_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of artificial intelligence equipment technology, and in particular, relates to a model training method, device, equipment and storage medium for a deep learning model. Background Art
[0002] With the development of artificial intelligence technology, deep learning models are widely used in systems that require intelligent recognition and intelligent decision-making, such as image recognition, audio recognition, etc. In the prior art, the deep learning solution for general embedded systems is usually to pre-train the deep learning model to a convergence state based on the floating-point data storage format on the PC (full name Personal Computer) side, and then convert the trained deep learning model from floating point to integer, and then deploy the integer deep learning model to the embedded system for use. However, due to the large precision loss in the process of converting the deep learning model from floating point to integer, there is a large deviation in the recognition or decision output results before and after the deep learning model conversion, and even the output result is reversed, which will cause the embedded system to seriously affect the accuracy of system data processing when using the deep learning model. Summary of the invention
[0003] In view of this, the embodiments of the present application provide a model training method, apparatus, device and storage medium for a deep learning model, which can improve the accuracy of deep learning model training and avoid accuracy loss due to model conversion when an embedded system deploys a deep learning model.
[0004] A first aspect of an embodiment of the present application provides a model training method for a deep learning model, the model training method for a deep learning model comprising:
[0005] In the model training stage, the first floating-point deep learning model is pre-trained using the training data to obtain a pre-trained second floating-point deep learning model, and the second floating-point deep learning model is converted into an integer deep learning model;
[0006] In the model testing phase, the integer deep learning model is tested using test data, and whether the integer deep learning model meets the model convergence state condition is determined according to the test results;
[0007] If the model convergence state condition is met, the integer deep learning model is deployed to the embedded system for use; otherwise, the model training phase is returned to and the second floating-point deep learning model is pre-trained with the training data for the next round until an integer deep learning model that meets the model convergence state condition is obtained.
[0008] In combination with the first aspect, in a first possible implementation manner of the first aspect, in the model testing phase, the step of using test data to perform a model test on the integer deep learning model, and judging whether the integer deep learning model satisfies a model convergence state condition according to the test result includes:
[0009] Inputting the target test data into the integer deep learning model for model testing, so that the integer deep learning model performs data processing based on the target test data and outputs corresponding actual processing results;
[0010] Compare the actual processing result with the expected processing result preset based on the target test data for similarity, calculate the similarity value between the actual processing result and the expected processing result, and use the similarity value as the test result of the model test;
[0011] According to the test result, the similarity value is compared with a preset similarity threshold. If the similarity value is greater than the preset similarity threshold, it is determined that the integer deep learning model meets the model convergence state condition.
[0012] In combination with the first aspect, in a second possible implementation manner of the first aspect, before the step of inputting the test data into the integer deep learning model for model testing so that the integer deep learning model performs data processing based on the test data and outputs a corresponding actual processing result, the step includes:
[0013] Construct a test sample for model testing the integer deep learning model, wherein the test sample includes test data and expected processing results preset based on the test data, and a corresponding mapping association relationship is established between the test data and the expected processing results preset based on the test data.
[0014] In combination with the first aspect, in a third possible implementation manner of the first aspect, the step of converting the second floating-point deep learning model into an integer deep learning model includes:
[0015] The data storage format of the memory mechanism in the second floating-point deep learning model is changed from floating-point to integer.
[0016] A second aspect of an embodiment of the present application provides a model training device for a deep learning model, the model training device for a deep learning model comprising:
[0017] A model training module is used to pre-train the first floating-point deep learning model using training data during the model training phase to obtain a pre-trained second floating-point deep learning model, and convert the second floating-point deep learning model into an integer deep learning model;
[0018] A model testing module is used to perform a model test on the integer deep learning model using test data during the model testing phase, and determine whether the integer deep learning model meets a model convergence state condition according to the test result;
[0019] The model deployment module is used to deploy the integer deep learning model to the embedded system for use if the model convergence state condition is met; otherwise, return to the model training stage and use the training data to perform the next round of pre-training on the second floating-point deep learning model until an integer deep learning model that meets the model convergence state condition is obtained.
[0020] In conjunction with the second aspect, in a first possible implementation manner of the second aspect, the model training device of the deep learning model includes:
[0021] A testing submodule, used for inputting the test data into the integer deep learning model for model testing, so that the integer deep learning model performs data processing based on the test data and outputs corresponding actual processing results;
[0022] A calculation submodule, used for comparing the actual processing result with the expected processing result preset based on the test data, calculating the similarity value between the actual processing result and the expected processing result, and using the similarity value as the test result of the model test;
[0023] A judgment submodule is used to compare the similarity value with a preset similarity threshold according to the test result, and if the similarity value is greater than the preset similarity threshold, it is judged that the integer deep learning model meets the model convergence state condition.
[0024] In combination with the second aspect, in a second possible implementation manner of the second aspect, the model training device of the deep learning model further includes:
[0025] A construction submodule is used to construct a test sample for model testing the integer deep learning model, wherein the test sample includes test data and expected processing results preset based on the test data, and a corresponding mapping association relationship is established between the test data and the expected processing results preset based on the test data.
[0026] In combination with the second aspect, in a third possible implementation manner of the second aspect, the model training device of the deep learning model further includes:
[0027] A conversion submodule is used to change the data storage format of the memory mechanism in the second floating-point deep learning model from floating-point type to integer type.
[0028] A third aspect of an embodiment of the present application provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the steps of the model training method for the deep learning model as described in any one of the first aspects are implemented.
[0029] The fourth aspect of an embodiment of the present application provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, it implements the steps of the model training method of the deep learning model as described in any one of the first aspects.
[0030] Compared with the prior art, the embodiments of the present invention have the following beneficial effects:
[0031] In the present application, in the model training stage, the first floating-point deep learning model is pre-trained using training data to obtain a second floating-point deep learning model after pre-training, and the second floating-point deep learning model is converted into an integer deep learning model; in the model testing stage, the integer deep learning model is tested using test data, and whether the integer deep learning model meets the model convergence state condition is determined according to the test results; if it meets the condition, the integer deep learning model is deployed to the embedded system for use, otherwise, the model training stage is returned to, and the second floating-point deep learning model is pre-trained for the next round using training data until an integer deep learning model that meets the model convergence state condition is obtained. Through this method, the model conversion process from floating-point to integer is incorporated into the training process, and the accuracy loss generated in the process of converting the deep learning model from floating-point to integer is reduced through the iteration of the training process, thereby improving the accuracy of deep learning model training, reducing the accuracy loss caused by model conversion when the embedded system deploys the deep learning model, and avoiding affecting the accuracy of data processing by the embedded system. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0033] Figure 1 A schematic diagram of a basic method flow of a model training method for a deep learning model provided in an embodiment of the present application;
[0034] Figure 2 A flow chart of a method for performing model testing in a model training method for a deep learning model provided in an embodiment of the present application;
[0035] Figure 3 A schematic diagram of the structure of a model training device for a deep learning model provided in an embodiment of the present application;
[0036] Figure 4 A detailed structural diagram of a model training device for a deep learning model provided in an embodiment of the present application;
[0037] Figure 5 A schematic diagram of an electronic device for implementing a model training method for a deep learning model provided in an embodiment of the present application. DETAILED DESCRIPTION
[0038] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.
[0039] In order to illustrate the technical solution described in this application, a specific embodiment is provided below for illustration.
[0040] In some embodiments of this application, please refer to Figure 1 , Figure 1 A basic method flow chart of a model training method for a deep learning model provided in an embodiment of the present application. Details are as follows:
[0041] Step S11: In the model training stage, the first floating-point deep learning model is pre-trained using the training data to obtain a pre-trained second floating-point deep learning model, and the second floating-point deep learning model is converted into an integer deep learning model.
[0042] In this embodiment, when training a deep learning model applied to an embedded system, a learning network framework of a deep learning model is pre-built on a PC (full name Personal Computer, personal computer) side, and the data storage format of the deep learning model training process is set to floating point type on the PC side, thereby obtaining a first floating point deep learning model to be trained. Then a large amount of training data is used to train the first floating point deep learning model obtained to a convergence state, and a deep learning model that can be applied to an embedded system is obtained. In this embodiment, data whose data storage format is a floating point type refers to data in which the decimal point position can float, that is, a floating point number, which is expressed by using scientific notation to express real numbers, that is, using a mantissa, a base, an exponent, and a sign bit to express real numbers. Floating point numbers achieve the effect of floating decimal points by using exponents, thereby flexibly expressing a larger range of real numbers. On the PC side, after the data storage format of the deep learning model training process is set to floating point type, the input and output of the deep learning model during the training process are both floating point numbers.
[0043] In this embodiment, when the PC-side training is applied to the deep learning model in the embedded system, the configuration includes but is not limited to the following two stages: the model training stage and the model testing stage. A large amount of training data as training samples is pre-constructed, and each training data is uniformly stored in a floating-point format. In the model training stage, each training data stored in a floating-point format is input into the first floating-point deep learning model as a training sample one by one for pre-training, so as to adjust the various learning parameters built into the learning network framework of the deep learning model based on the training samples, such as network layer parameters, network layer weight parameters, etc. The deep learning model obtained after the parameter adjustment based on the training sample is the second floating-point deep learning model after pre-training. The pre-training process of the deep learning model is the process of iteratively optimizing the learning network framework of the deep learning model by continuously using training data, and the iterative optimization of the learning network framework is reflected in the adjustment of various learning parameters built into the learning network framework. A new second floating-point deep learning model is obtained for each round of pre-training of the deep learning model. When the deep learning model is applied to an embedded system, the use of an integer data storage format can effectively increase the speed at which the embedded system processes data. In this embodiment, after obtaining the second floating-point deep learning model, the second floating-point deep learning model is further converted to an integer type, so that the second floating-point deep learning model is converted from a floating-point type to an integer type, thereby obtaining an integer type deep learning model in the model training stage. In this embodiment, when the second floating-point deep learning model is converted to an integer type, the data storage format of the memory mechanism in the second floating-point deep learning model is specifically changed from a floating-point type to an integer type.
[0044] Step S12: In the model testing stage, the integer deep learning model is tested using test data, and whether the integer deep learning model meets the model convergence state condition is determined according to the test results.
[0045] In this embodiment, at the PC end, each round of pre-training and model conversion of the first floating-point deep learning model to be trained in the model training phase can correspond to an iteratively optimized integer deep learning model. In this embodiment, after each round of pre-training, the model testing phase is entered, and the iteratively optimized integer deep learning model corresponding to the round of pre-training is tested, and the integer deep learning model corresponding to the round of pre-training is judged according to the test results to determine whether the model convergence state condition is met. In the model testing phase, the test data is specifically input into the integer deep learning model for data processing to obtain the actual result of the data processing output by the integer deep learning model. Then, by comparing the actual result with the expected result corresponding to the test data, a numerical value representing the difference between the actual result and the expected result is obtained as the test result of the model test, and then, according to the test results, it is determined whether the integer deep learning model meets the model convergence state condition. Among them, the smaller the numerical value representing the difference between the actual result and the expected result, the more convergent the integer deep learning model is. The model convergence condition is a pre-set critical value indicating the difference between the actual result and the expected result output by the deep learning model when the deep learning model has been trained to a convergence state. By comparing the difference between the actual result and the expected result recorded in the test result with the critical value, it is determined whether the integer deep learning model meets the model convergence condition.
[0046] In some embodiments of this application, please refer to Figure 2 , Figure 2 A flow chart of a method for model testing in a model training method of a deep learning model provided in an embodiment of the present application. Details are as follows:
[0047] S21: Inputting the target test data into the integer deep learning model for model testing, so that the integer deep learning model performs data processing based on the target test data and outputs a corresponding actual processing result;
[0048] S22: performing a similarity comparison between the actual processing result and the expected processing result preset based on the target test data, calculating a similarity value between the actual processing result and the expected processing result, and using the similarity value as a test result of the model test;
[0049] S23: According to the test result, the similarity value is compared with a preset similarity threshold. If the similarity value is greater than the preset similarity threshold, it is determined that the integer deep learning model meets the model convergence state condition.
[0050] Exemplarily, several test samples for model testing of integer deep learning models are pre-constructed, wherein the test samples contain test data and expected processing results preset based on the test data, and a corresponding mapping association relationship is established between the test data and the expected processing results preset based on the test data. For each test sample, the test data is the model input, that is, the data to be processed; the expected processing result is the expectation of the model output. In this embodiment, after obtaining the integer deep learning model, several test samples of the component are used as test instances one by one, and the test data in the test sample is input as the target test data into the integer deep learning model for model testing, and the integer deep learning model performs data processing operations based on the target test data and outputs the corresponding actual processing results. After obtaining the actual processing result, based on the mapping relationship between the test data in the test sample and the expected processing result, the expected processing result corresponding to the preset based on the target test data is found, and then the actual processing result is compared with the preset expected processing result for similarity, and the similarity value between the actual processing result and the expected processing result is calculated, and then the similarity value is used as the test result of this model test. Since the test results of the model test are represented by the similarity value between the actual result and the expected result, the model convergence state condition can be preset as a similarity threshold. In this embodiment, by comparing the calculated similarity value with the preset similarity threshold, it is determined whether the integer deep learning model meets the model convergence state condition. Among them, when the calculated similarity score is greater than the preset similarity threshold, it is determined that the integer deep learning model meets the model convergence state condition, otherwise, it is determined that the integer deep learning model does not meet the model convergence state condition.
[0051] Step S13: If the model convergence state condition is met, the integer deep learning model is deployed to the embedded system for use; otherwise, return to the model training stage and use the training data to perform the next round of pre-training on the second floating-point deep learning model until an integer deep learning model that meets the model convergence state condition is obtained.
[0052] In this embodiment, when the obtained integer deep learning model meets the model convergence state condition, it means that the learning network framework of the deep learning model has been trained to a convergence state. At this time, the integer deep learning model is deployed to the embedded system to run in the real machine where the embedded system is located. Specifically, in the real machine where the embedded system is located, the real machine collects the data to be processed on site, and then inputs the collected data to be processed into the running integer deep learning model for corresponding data processing, and then the running integer deep learning model outputs the corresponding data processing result. When the obtained integer deep learning model does not meet the model convergence state conditions, it means that the learning network framework of the deep learning model has not been trained well and further training is needed. At this time, in the model training stage, the second floating-point deep learning model before the model conversion corresponding to the integer deep learning model is used as the first floating-point deep learning model to be trained in the next round for the next round of pre-training, and the integer deep learning model iteratively optimized in the next round of pre-training is obtained for model testing until an integer deep learning model that meets the model convergence state conditions is obtained, and the integer deep learning model that meets the model convergence state conditions is deployed to the embedded system. At this point, the model training of the deep learning model is completed.
[0053] The model training method of the deep learning model provided in the above embodiment is as follows: in the model training stage, after pre-training the first floating-point deep learning model with training data, the second floating-point deep learning model obtained after pre-training is converted into an integer deep learning model; in the model testing stage, the integer deep learning model is tested with test data until an integer deep learning model that meets the model convergence state condition is obtained; the accuracy loss caused by model conversion in deep learning engineering practice is also included in the training; the accuracy loss caused by the conversion of the deep learning model from floating-point to integer is reduced through the iteration of the training process, thereby improving the accuracy of deep learning model training, avoiding the accuracy loss caused by model conversion when the embedded system deploys the deep learning model, and avoiding affecting the accuracy of data processing by the embedded system.
[0054] It is understandable that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0055] In some embodiments of this application, please refer to Figure 3 , Figure 3 A schematic diagram of the structure of a model training device for a deep learning model provided in an embodiment of the present application. Figure 3As shown, the model training device of the deep learning model includes: a model training module 31, a model testing module 32 and a model deployment module 33. Among them, the model training module 31 is used to use the training data to pre-train the first floating-point deep learning model in the model training stage, obtain the pre-trained second floating-point deep learning model, and convert the second floating-point deep learning model into an integer deep learning model. The model testing module 32 is used to use the test data to perform model testing on the integer deep learning model in the model testing stage, and judge whether the integer deep learning model meets the model convergence state condition according to the test result. The model deployment module 33 is used to deploy the integer deep learning model to the embedded system for use if the model convergence state condition is met, otherwise, return to the model training stage, and use the training data to perform the next round of pre-training on the second floating-point deep learning model until an integer deep learning model that meets the model convergence state condition is obtained.
[0056] In some embodiments of this application, please refer to Figure 4 , Figure 4 A detailed structural diagram of a model training device for a deep learning model provided in an embodiment of the present application. Figure 4 As shown, the model training device of the deep learning model also includes: a test submodule 41, a calculation submodule 42 and a judgment submodule 43. Among them, the test submodule 41 is used to input the test data into the integer deep learning model for model testing, so that the integer deep learning model performs data processing based on the test data and outputs the corresponding actual processing result. The calculation submodule 42 is used to compare the actual processing result with the expected processing result preset based on the test data, calculate the similarity value between the actual processing result and the expected processing result, and use the similarity value as the test result of the model test. The judgment submodule 43 is used to compare the similarity value with the preset similarity threshold according to the test result. If the similarity value is greater than the preset similarity threshold, it is judged that the integer deep learning model meets the model convergence state condition.
[0057] In some embodiments of the present application, the model training device of the deep learning model also includes: a construction submodule, which is used to construct a test sample for model testing the integer deep learning model, wherein the test sample includes test data and expected processing results preset based on the test data, and a corresponding mapping association relationship is established between the test data and the expected processing results preset based on the test data.
[0058] In some embodiments of the present application, the model training device of the deep learning model also includes: a conversion submodule, which is used to change the data storage format of the memory mechanism in the second floating-point deep learning model from floating-point type to integer type.
[0059] In some embodiments of this application, please refer to Figure 5 , Figure 5 A schematic diagram of an electronic device for implementing a model training method for a deep learning model provided in an embodiment of the present application. Figure 5 As shown, the electronic device 5 of this embodiment includes: a processor 51, a memory 52, and a computer program 53 stored in the memory 52 and executable on the processor 51, such as a model training program for a deep learning model. When the processor 51 executes the computer program 52, the steps in the above-mentioned model training method embodiments of each deep learning model are implemented. Alternatively, when the processor 51 executes the computer program 53, the functions of each module / unit in the above-mentioned device embodiments are implemented.
[0060] Exemplarily, the computer program 53 may be divided into one or more modules / units, which are stored in the memory 52 and executed by the processor 51 to complete the present application. The one or more modules / units may be a series of computer program instruction segments capable of completing specific functions, which are used to describe the execution process of the computer program 53 in the electronic device 5. For example, the computer program 53 may be divided into:
[0061] A model training module is used to pre-train the first floating-point deep learning model using training data during the model training phase to obtain a pre-trained second floating-point deep learning model, and convert the second floating-point deep learning model into an integer deep learning model;
[0062] A model testing module is used to perform a model test on the integer deep learning model using test data during the model testing phase, and determine whether the integer deep learning model meets a model convergence state condition according to the test result;
[0063] The model deployment module is used to deploy the integer deep learning model to the embedded system for use if the model convergence state condition is met; otherwise, return to the model training stage and use the training data to perform the next round of pre-training on the second floating-point deep learning model until an integer deep learning model that meets the model convergence state condition is obtained.
[0064] The electronic device may include, but is not limited to, a processor 51 and a memory 52. Those skilled in the art will appreciate that Figure 5It is only an example of the electronic device 5 and does not constitute a limitation of the electronic device 5. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, the electronic device may also include input and output devices, network access devices, buses, etc.
[0065] The processor 51 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.
[0066] The memory 52 may be an internal storage unit of the electronic device 5, such as a hard disk or memory of the electronic device 5. The memory 52 may also be an external storage device of the electronic device 5, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the electronic device 5. Further, the memory 52 may also include both an internal storage unit and an external storage device of the electronic device 5. The memory 52 is used to store the computer program and other programs and data required by the electronic device. The memory 52 may also be used to temporarily store data that has been output or is to be output.
[0067] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.
[0068] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0069] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0070] In the embodiments provided in the present application, it should be understood that the disclosed devices / terminal equipment and methods can be implemented in other ways. For example, the device / terminal equipment embodiments described above are only schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0071] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0072] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0073] If the integrated module / unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. . Wherein, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electric carrier signal, telecommunication signal and software distribution medium. It should be noted that the content contained in the computer-readable medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media do not include electric carrier signals and telecommunication signals.
[0074] The embodiments described above are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.
Claims
1. A deep learning model training method for an embedded system, characterized in that: include: In the model training stage, the first floating-point deep learning model is pre-trained using the training data to obtain a pre-trained second floating-point deep learning model, and the second floating-point deep learning model is converted into an integer deep learning model; In the model testing phase, the integer deep learning model is tested using test data, and whether the integer deep learning model meets the model convergence state condition is determined according to the test results; If the model convergence state condition is met, the integer deep learning model is deployed to the embedded system for use; otherwise, the model training phase is returned to and the second floating-point deep learning model is pre-trained with the training data for the next round until an integer deep learning model that meets the model convergence state condition is obtained.
2. The deep learning model training method for embedded systems according to claim 1, characterized in that: In the model testing phase, the step of using test data to perform a model test on the integer deep learning model, and judging whether the integer deep learning model meets the model convergence state condition according to the test result, includes: Inputting the target test data into the integer deep learning model for model testing, so that the integer deep learning model performs data processing based on the target test data and outputs corresponding actual processing results; Compare the actual processing result with the expected processing result preset based on the target test data for similarity, calculate the similarity value between the actual processing result and the expected processing result, and use the similarity value as the test result of the model test; According to the test result, the similarity value is compared with a preset similarity threshold. If the similarity value is greater than the preset similarity threshold, it is determined that the integer deep learning model meets the model convergence state condition.
3. The deep learning model training method for embedded systems according to claim 1, characterized in that: Before the step of inputting the test data into the integer deep learning model for model testing so that the integer deep learning model performs data processing based on the test data and outputs the corresponding actual processing results, the method includes: Construct a test sample for model testing the integer deep learning model, wherein the test sample includes test data and expected processing results preset based on the test data, and a corresponding mapping association relationship is established between the test data and the expected processing results preset based on the test data.
4. The deep learning model training method for embedded systems according to claim 3, characterized in that: The step of converting the second floating-point deep learning model into an integer deep learning model includes: The data storage format of the memory mechanism in the second floating-point deep learning model is changed from floating-point to integer.
5. A deep learning model training device for an embedded system, characterized in that: The model training device of the deep learning model includes: A model training module is used to pre-train the first floating-point deep learning model using training data during the model training phase to obtain a pre-trained second floating-point deep learning model, and convert the second floating-point deep learning model into an integer deep learning model; A model testing module is used to perform a model test on the integer deep learning model using test data during the model testing phase, and determine whether the integer deep learning model meets a model convergence state condition according to the test result; The model deployment module is used to deploy the integer deep learning model to the embedded system for use if the model convergence state condition is met; otherwise, return to the model training stage and use the training data to perform the next round of pre-training on the second floating-point deep learning model until an integer deep learning model that meets the model convergence state condition is obtained.
6. The deep learning model training device for embedded systems according to claim 5, characterized in that: The model training device of the deep learning model includes: A testing submodule, used for inputting the test data into the integer deep learning model for model testing, so that the integer deep learning model performs data processing based on the test data and outputs corresponding actual processing results; A calculation submodule, used for comparing the actual processing result with the expected processing result preset based on the test data, calculating the similarity value between the actual processing result and the expected processing result, and using the similarity value as the test result of the model test; A judgment submodule is used to compare the similarity value with a preset similarity threshold according to the test result, and if the similarity value is greater than the preset similarity threshold, it is judged that the integer deep learning model meets the model convergence state condition.
7. The deep learning model training device for embedded systems according to claim 5, characterized in that: The model training device of the deep learning model also includes: A construction submodule is used to construct a test sample for model testing the integer deep learning model, wherein the test sample includes test data and expected processing results preset based on the test data, and a corresponding mapping association relationship is established between the test data and the expected processing results preset based on the test data.
8. The deep learning model training device for embedded systems according to claim 5, characterized in that: The model training device of the deep learning model also includes: A conversion submodule is used to change the data storage format of the memory mechanism in the second floating-point deep learning model from floating-point type to integer type.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the deep learning model training method for the embedded system as described in any one of claims 1 to 4 are implemented.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the deep learning model training method for an embedded system as described in any one of claims 1 to 4 are implemented.
Citation Information
Patent Citations
Neural network compression method and device
CN113570037A
Image processing model training method, image processing method and related equipment
CN113705317A
