Edge computing task processing method, device, equipment and storage medium
By partitioning and storing the code and parameter data of the neural network model in the MCU and optimizing the inference process, the problem of low MCU processing efficiency is solved, and efficient inference and system performance improvement for edge computing tasks are achieved.
Patent Information
- Application Number
- CN202411154884.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-22
- Publication Date
- 2024-10-22
- Estimated Expiration
- 2044-08-22
AI Technical Summary
MCU has low processing efficiency in edge computing tasks and cannot meet real-time requirements. Moreover, due to low computing power and memory capacity, it is difficult to effectively process complex neural network models.
The model code and parameter data of the neural network model are stored in different storage areas of the flash memory of the micro control unit and the on-chip high-speed storage unit. By dividing the storage area and using DMA channels for data transmission, the inference operation process is optimized.
It improves the reasoning efficiency of edge computing tasks, rationally utilizes storage resources, realizes efficient deployment and reasoning operations of neural network models, and improves system performance.
Smart Images

Figure CN118656227B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of edge computing, and in particular to an edge computing task processing method, device, equipment and storage medium. Background Art
[0002] More and more data needs to be processed close to where it is generated to reduce latency and improve efficiency. By placing computing resources close to the data source, edge computing can greatly reduce the latency of data transmission, making the processing of real-time data faster and more efficient. For some sensitive data, it may sometimes be inappropriate to transmit it to the cloud for processing, but edge computing can process it locally, thereby improving data privacy and security. At the same time, edge computing can make better use of network resources and reduce the load on cloud servers, thereby improving overall system performance. Based on power consumption and cost considerations, edge computing tasks are usually performed using MCU (Microcontroller Unit). Unlike computing units such as GPU (Graphics Processing Unit) that are specifically used for high-performance computing tasks, MCU usually has lower computing power and memory capacity, and usually uses single-core or multi-core low-power processors, so the main frequency is lower. However, in general, the real-time requirements of edge computing tasks are relatively high, and the processing efficiency of MCU cannot meet existing needs.
[0003] It can be seen that how to improve the reasoning efficiency of edge computing tasks in MCU is a problem to be solved in this field. Summary of the invention
[0004] In view of this, the purpose of the present invention is to provide an edge computing task processing method, device, equipment and storage medium, which can store the model code, parameter data and other information of the neural network model in different storage spaces, and improve the reasoning efficiency by taking advantage of flash memory and high-speed storage units. The specific scheme is as follows:
[0005] In a first aspect, the present application provides an edge computing task processing method, which is applied to a micro control unit, comprising:
[0006] The model code and parameter data of the preset neural network model are stored in the flash memory of the microcontroller unit, and the on-chip high-speed storage unit is divided into a first storage area and a second storage area, and then the first storage area and the second storage area are connected to the flash memory; each network layer in the preset neural network model corresponds to the model code and parameter data;
[0007] The model codes of different network layers in the preset neural network model are stored in the first storage area, and the parameter data of different network layers in the preset neural network model, as well as the input data or output data of the network layer, are stored in the second storage area, so that the preset neural network model uses the storage contents in the first storage area and the second storage area to perform reasoning operations on the edge computing task to be processed; the input data is the original data corresponding to the edge computing task to be processed or the output data of the previous network layer;
[0008] When the inference operation is completed, the final output data in the second storage area is obtained to complete the processing process for the edge computing task to be processed.
[0009] Optionally, storing the model codes of different network layers in the preset neural network model in the first storage area includes:
[0010] Opening a first code area and a second code area in the first storage area;
[0011] The model code of the current network layer of the preset neural network model is stored in the first code area to perform an inference operation of the current network layer;
[0012] If the inference operation of the current network layer is completed and the model code corresponding to the next network layer is stored in the second code area, the inference operation of the corresponding next network layer is performed.
[0013] Optionally, storing parameter data of different network layers in the preset neural network model, and input data or output data of the network layer in the second storage area includes:
[0014] Opening up a first data area, a second data area and a third data area in the second storage area;
[0015] Storing parameter data of the current network layer of the preset neural network model through the first data area to perform an inference operation of the current network layer;
[0016] If the inference operation of the current network layer is completed and the parameter data corresponding to the next network layer is stored in the second data area, the output data corresponding to the current network layer is stored in the third data area, and the output data of the current network layer in the third data area is determined as the input data of the next network layer to perform the inference operation of the next network layer.
[0017] Optionally, if the current network layer of the preset neural network model is the first network layer, the performing of the inference operation of the current network layer includes:
[0018] The model code corresponding to the current network layer is stored in the first code area, the parameter data corresponding to the current network layer is stored in the first data area, and the raw data for reasoning operation corresponding to the edge computing task to be processed is stored in the third data area, so as to determine the raw data stored in the third data area as the input data of the current network layer;
[0019] An inference operation of the current network layer is performed based on the model code, parameter data and input data stored in the first code area, the first data area and the third data area.
[0020] Optionally, if the current network layer of the preset neural network model is not the first network layer, the performing of the inference operation of the current network layer includes:
[0021] Determine the output data obtained by the inference operation corresponding to the previous network layer stored in the third data area as the input data corresponding to the current network layer;
[0022] An inference operation of the current network layer is performed based on the input data corresponding to the current network layer in the third data area, and the model code and parameter data in the code area and data area corresponding to the current network layer.
[0023] Optionally, storing the output data corresponding to the current network layer in a third data area includes:
[0024] The output data corresponding to the current network layer is stored in the third data area, and the life cycle of the reasoning operation corresponding to the current network layer is determined to be over, and then the memory space of the code area and the data area corresponding to the current network layer is released, so that the code area and the data area after the memory space is released can be used to store the model code and parameter data of the next network layer.
[0025] Optionally, storing the output data corresponding to the current network layer in a third data area includes:
[0026] The output data corresponding to the current network layer is stored in the third data area, and the memory space corresponding to the output data of the previous network layer in the third data area is released so as to use the output data of the current network layer stored in the third data area to perform inference operations on the next network layer.
[0027] In a second aspect, the present application provides an edge computing task processing device, which is applied to a micro control unit, including:
[0028] A storage area division module, used for storing the model code and parameter data of the preset neural network model in the flash memory of the micro control unit, and dividing the on-chip high-speed storage unit into a first storage area and a second storage area, and then connecting the first storage area and the second storage area to the flash memory; each network layer in the preset neural network model corresponds to the model code and parameter data;
[0029] An inference operation module, used to store the model codes of different network layers in the preset neural network model through the first storage area, and store the parameter data of different network layers in the preset neural network model through the second storage area, as well as the input data or output data of the network layer, so that the preset neural network model uses the storage contents in the first storage area and the second storage area to perform inference operation on the edge computing task to be processed; the input data is the original data corresponding to the edge computing task to be processed or the output data of the previous network layer;
[0030] A data acquisition module is used to obtain the final output data in the second storage area after the inference operation is completed, so as to complete the processing process for the edge computing task to be processed.
[0031] In a third aspect, the present application provides an electronic device, including:
[0032] Memory, used to store computer programs;
[0033] A processor is used to execute the computer program to implement the edge computing task processing method as described above.
[0034] In a fourth aspect, the present application provides a computer-readable storage medium for storing a computer program, which, when executed by a processor, implements the edge computing task processing method as described above.
[0035] It can be seen that the microcontroller unit in the present application can store the model code and parameter data of the preset neural network model in the flash memory of the microcontroller unit, and divide the on-chip high-speed storage unit into a first storage area and a second storage area, and then connect the first storage area and the second storage area to the flash memory; each network layer in the preset neural network model corresponds to a model code and parameter data; then the model code of different network layers in the preset neural network model is stored in the first storage area, and the parameter data of different network layers in the preset neural network model, as well as the input data or output data of the network layer, are stored in the second storage area, so that the preset neural network model uses the storage contents in the first storage area and the second storage area to perform reasoning operations on the edge computing task to be processed; the input data is the original data corresponding to the edge computing task to be processed or the output data of the previous network layer; when the reasoning operation is completed, the final output data in the second storage area is obtained to complete the processing process for the edge computing task to be processed. In this way, the present application can utilize the storage resources in the microcontroller unit to realize the process of the neural network model processing edge computing tasks. By storing the model code, parameter data and other information of the neural network model in different storage spaces respectively, the advantages of flash memory and high-speed storage units can be reasonably utilized, and the reasonable deployment of the neural network model and efficient reasoning operations for edge computing tasks can be realized, thereby improving the overall system performance. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, 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 embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.
[0037] Figure 1 This is a flow chart of an edge computing task processing method disclosed in this application;
[0038] Figure 2 A flow chart of a specific edge computing task processing method disclosed in this application;
[0039] Figure 3 A schematic diagram of the structure of a flash memory and an on-chip high-speed storage unit disclosed in the present application;
[0040] Figure 4 This is a schematic diagram of the structure of an edge computing task processing device disclosed in this application;
[0041] Figure 5 This is a structural diagram of an electronic device disclosed in this application. DETAILED DESCRIPTION
[0042] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0043] See also Figure 1 As shown, an embodiment of the present invention discloses an edge computing task processing method, which is applied to a micro control unit, including:
[0044] Step S11, store the model code and parameter data of the preset neural network model in the flash memory of the microcontroller unit, divide the on-chip high-speed storage unit into a first storage area and a second storage area, and then connect the first storage area and the second storage area to the flash memory; each network layer in the preset neural network model corresponds to the model code and parameter data.
[0045] It should be pointed out that the neural network model is a complex data processing system. For example, for the banking business processing process, in order to avoid the security risks of data transmission in the cloud, the neural network model can process the relevant business computing tasks at a location close to the data source, and directly perform edge computing locally, which can improve data security. It is understandable that the code, model parameter data, etc. of the neural network model usually occupy a large storage space; due to the low cost of flash memory (FLASH storage space), the flash memory can accommodate all the model data of the preset neural network model, including the model code and parameter data of each network layer; while the cost of the on-chip high-speed storage unit is high, and it is generally not possible to store the completed model data. The present application can divide it into a first storage area and a second storage area, and connect the first storage area and the second storage area to the flash memory storing the preset neural network model; in this way, the complete model data is stored in the flash memory, and then the on-chip high-speed storage unit is divided into regions, so as to realize the reasoning operation of the model through the divided storage areas.
[0046] Step S12: storing the model codes of different network layers in the preset neural network model through the first storage area, and storing the parameter data of different network layers in the preset neural network model and the input data or output data of the network layer through the second storage area, so that the preset neural network model uses the storage contents in the first storage area and the second storage area to perform inference operations on the edge computing task to be processed; the input data is the original data corresponding to the edge computing task to be processed or the output data of the previous network layer.
[0047] In an embodiment of the present application, in the process of performing inference operations on the edge computing task to be processed by a preset neural network model, the model code of the network layer in the preset neural network model is first stored in the first storage area, and the parameter data of the corresponding network layer in the preset neural network model and the input data of the network layer or the output data of the network layer are stored in the second storage area; the preset neural network model can use the storage content for a certain network layer in the first storage area and the second storage area to perform inference operations on the edge computing task to be processed.
[0048] In a specific embodiment, the storing of the model codes of different network layers in the preset neural network model through the first storage area may include: opening up a first code area and a second code area in the first storage area; storing the model code of the current network layer of the preset neural network model through the first code area to perform reasoning operations on the current network layer; if the reasoning operation of the current network layer is completed and the model code corresponding to the next network layer is stored in the second code area, the reasoning operation of the corresponding next network layer is performed. Specifically, for the model codes of different network layers of the preset neural network model, the present application opens up two code areas in the first storage area, the first code area and the second code area, which can alternately store the model codes of two adjacent network layers; by storing the model code of the current network layer in the preset neural network through the first code area, it can be understood that during the reasoning operation of the current network layer, the second code area can store the model code of the next network layer corresponding to the current network layer, so that the reasoning operation of the corresponding next network layer can continue after the reasoning operation of the current network layer is completed.
[0049] In another specific embodiment, storing the parameter data of different network layers in the preset neural network model, as well as the input data or output data of the network layer through the second storage area may include: opening up a first data area, a second data area and a third data area in the second storage area; storing the parameter data of the current network layer of the preset neural network model through the first data area to perform reasoning operations on the current network layer; if the reasoning operation of the current network layer is completed and the parameter data corresponding to the next network layer is stored in the second data area, the output data corresponding to the current network layer is stored in the third data area, and the output data of the current network layer in the third data area is determined as the input data of the next network layer to perform reasoning operations on the next network layer. Specifically, for the parameter data, input data or output data of different network layers of the preset neural network model, the present application opens up a first data area, a second data area and a third data area in the second storage area, wherein the first data area and the second data area respectively store the parameter data of the network layer, and the third data area is used to store the input data and output data of the current network layer; it should be pointed out that since the relationship between the input data and output data between the network layers is that the output of the previous layer is used as the input of the next layer, the output data of the current network layer stored in the third data area is the input data of the next network layer. For a single network layer, the first data area or the second data area stores the parameter data of the network layer, and the third data area stores the input data of the network layer. Based on the contents stored in these areas, the reasoning operation of the corresponding network layer can be performed.
[0050] In a specific embodiment, if the current network layer of the preset neural network model is the first network layer, the reasoning operation of the current network layer may include: storing the model code corresponding to the current network layer in the first code area, storing the parameter data corresponding to the current network layer in the first data area, and storing the raw data for reasoning operation corresponding to the edge computing task to be processed in the third data area, so as to determine the raw data stored in the third data area as the input data of the current network layer; performing the reasoning operation of the current network layer based on the model code, parameter data and input data stored in the first code area, the first data area and the third data area. Specifically, in the process of reasoning operation of the edge computing task to be processed using the preset neural network model, the model code and parameter data of the first network layer of the preset neural network model are stored in the first code area and the first data area respectively; and the raw data for reasoning operation corresponding to the edge computing task to be processed needs to be stored in the third data area as the input data of the first network layer; the first code area, the first data area and the third data area respectively store the relevant information for reasoning operation of the current network layer, and then the reasoning operation of the current network layer is performed for the edge computing task to be processed.
[0051] In another specific embodiment, if the current network layer of the preset neural network model is not the first network layer, the inference operation of the current network layer may include: determining the output data obtained by the inference operation corresponding to the previous network layer stored in the third data area as the input data corresponding to the current network layer; performing the inference operation of the current network layer based on the input data corresponding to the current network layer in the third data area, and the model code and parameter data in the code area and data area corresponding to the current network layer. Specifically, if the current network layer is not the first network layer of the preset neural network model, the third data area has stored the output data of the previous network layer, and the output data is used as the input data of the current network layer; and it can be understood that during the inference operation of the previous network layer (corresponding to the first code area and the first data area), the second code area and the second data area will simultaneously store the model code and parameter data corresponding to the current network layer. After the inference operation of the previous network layer is completed, the inference operation of the current network layer can be performed based on the contents stored in the second code area, the second data area and the third data area at this time.
[0052] In another specific embodiment, storing the output data corresponding to the current network layer in the third data area may include: storing the output data corresponding to the current network layer in the third data area, determining that the life cycle of the reasoning operation corresponding to the current network layer has ended, and then releasing the memory space of the code area and data area corresponding to the current network layer, so as to use the code area and data area after the memory space is released to store the model code and parameter data of the next network layer. Specifically, at the end of the life cycle of the reasoning operation corresponding to a network layer, that is, after the output result corresponding to the network layer is stored in the third data area, the memory space of the (first or second) code area and the (first or second) data area corresponding to the network layer can be released, and then the code area and the data area after the memory space is released can be used to store the model code and parameter data corresponding to the next network layer; for example, when the previous network layer uses the content stored in the first code area and the first data area to perform reasoning operations, the model code and parameter data corresponding to the current network layer will be stored in the second code area and the second data area respectively; then when the reasoning operation process of the previous network layer ends, the memory space of the first code area and the first data area will be released, so that during the reasoning operation of the current network layer, the model code and parameter data of the next network layer can be stored through the first code area and the first data area.
[0053] Step S13: When the inference operation is completed, the final output data in the second storage area is obtained to complete the processing process for the edge computing task to be processed.
[0054] In an embodiment of the present application, after the inference operation of the last network layer corresponding to the preset neural network model is completed, that is, the second storage area stores the inference operation result corresponding to the edge computing task to be processed output by the preset neural network model (the output data corresponding to the last network layer), the output data for the edge computing task to be processed finally stored in the second storage area can be obtained to complete the processing process for the edge computing task to be processed.
[0055] In a specific embodiment, the storing of the output data corresponding to the current network layer in the third data area may include: storing the output data corresponding to the current network layer in the third data area, and releasing the memory space of the output data corresponding to the previous network layer in the third data area, so as to use the output data of the current network layer stored in the third data area to perform the reasoning operation of the next network layer. Specifically, in the process of using the preset neural network model to perform reasoning operation on the edge computing task to be processed, after storing the output data corresponding to the current network layer in the third data area, the memory space of the output data corresponding to the previous network layer in the third data area may be released, so as to use the memory space to store the output data of the next network layer. In other words, the third data area may be divided into a first part and a second part, wherein the first part stores the output data of the previous network layer, that is, the input data of the current network layer; when the second part stores the output data of the current network layer, the storage space of the first part may be released, so as to use the first part to store the output data of the next network layer.
[0056] It can be seen that the present application can utilize the storage resources in the microcontroller unit to realize the process of processing edge computing tasks by the neural network model, by storing the model code, parameter data and other information of the neural network model in different storage spaces respectively, and by the neural network model in the process of reasoning operations on the edge computing tasks to be processed, two code areas and two data areas can be used to perform reasoning operations on a single network layer, so as to store the model code and parameter data of the next network layer, so that the parallel processing of the relevant data of the network layer can improve the reasoning efficiency of the overall edge computing tasks. The present application can reasonably utilize the advantages of flash memory and high-speed storage units, can realize the reasonable deployment of neural network models and efficient reasoning operations for edge computing tasks, and thus can improve the overall system performance.
[0057] like Figure 2 As shown, the embodiment of the present application discloses an edge computing task processing method, which is applied to a micro control unit, including:
[0058] The embodiment of the present application takes the on-chip high-speed storage unit TCM (Tightly-Coupled Memory) as an example to describe the deployment and reasoning operation process of the neural network model. Specifically, TCM is divided into ITCM (Instruction TCM) and DTCM (Data TCM). When deploying the neural network model, the model code of all network layers and parameter data such as weights and biases are stored in FLASH, and DMA (Direct Memory Access) channels are configured to connect FLASH with ITCM and DTCM for the transmission of model code and parameter data.
[0059] It can be understood that the neural network model is composed of different "layers", and the output of the previous layer is used as the input of the next layer. In a specific embodiment, the reasoning of the entire model can be divided into different reasoning stages (IP, Inference Phase) based on the size of TCM, with the layer as the smallest unit. The principle of division is that ITCM is sufficient to accommodate twice the code of each reasoning stage, and DTCM is sufficient to accommodate twice the parameters, input, output data and possible intermediate data of each reasoning stage. For the convenience of description, each reasoning stage is represented as IP1, IP2, ..., IPn (corresponding to different network layers respectively).
[0060] It should be pointed out that before the neural network model starts reasoning for the edge computing task to be processed, two memory spaces IM1 and IM2 are opened in ITCM to store the model code of each reasoning stage respectively; three memory spaces DM1, DM2, and DM3 are opened in DTCM, of which DM1 and DM2 are used to store parameter data of each reasoning stage, such as weights and biases, and DM3 is used to store input and output data and possible intermediate data. Figure 3The figure shows the structure diagram of the flash memory and the on-chip high-speed storage unit. In the reasoning process of the neural network model, the model code and parameter data of IP1 are first transferred to IM1 and DM1 respectively through DMA, and the input data of IP1 is stored in DM3. After the input data, model code and parameter data are all transferred, the program jumps to the first address of IM1, takes the input data stored in DM3 as input, and takes the parameter data stored in DM1 as parameter, and starts the reasoning process of IP1. In the reasoning process of IP1, the model code and parameter data of IP2 are transferred to IM2 and DM2 respectively through DMA. Correspondingly, after obtaining the calculation result of IP1, its output data is stored in DM3, and the life cycle of the input data of IP1 is judged whether it ends according to the model structure. Note that the sign of the end of the life cycle of the data here can be that the data will not be called by any subsequent reasoning process of the model. If the life cycle of the data has ended, the memory space occupied by the data is released, otherwise, the data is retained in DM3 for use in the subsequent corresponding reasoning process. For the convenience of description, this process is called post-processing of the reasoning stage. Note that only after these post-processing tasks are completed, the reasoning of IP1 is truly completed.
[0061] Furthermore, after the inference of IP1 is completed and the model code and parameter data of IP2 are transferred, the program jumps to the first address of IM2, and uses the output data of IP1 stored in DM3 as input and the parameter data in DM2 as parameters to start the inference process of IP2. During the inference process of IP2, the instructions and parameter data of IP3 are transferred to IM1 and DM1 respectively through DMA, so that each inference stage alternately uses the storage space of IM1, DM1 and IM2, DM2 until the current inference task is completed.
[0062] In another specific embodiment, taking a neural network model including an input layer, an output layer, and three hidden layers as an example, the specific reasoning operation process is as follows.
[0063] S1, store the inference model code of the neural network model and the parameters such as weights and biases of each layer into FLASH;
[0064] S2, taking each layer of reasoning calculation of the network model as a reasoning stage, thus dividing the reasoning of the entire network model into 5 reasoning stages: IP1 (input layer), IP2~IP4 (three hidden layers) and IP5 (output layer);
[0065] S3, allocate two memory spaces IM1 and IM2 in ITCM, and allocate three memory spaces DM1, DM2, and DM3 in DTCM;
[0066] S4. Configure two DMA channels, where the source address of the first DMA channel is the address of the program of IP1 in FLASH, and the destination address is the first address of the memory space IM1 in ITCM; the source address of the second DMA channel is the address of the parameters such as weight and bias of IP1 in FLASH, and the destination address is the address of the memory space DM1 in DTCM;
[0067] S5, start DMA transmission, transfer the instruction and parameter data of IP1 to IM1 and DM1 respectively through DMA, and store the input data of IP1 in DM3;
[0068] S6, wait for the DMA transfer to be completed and the input data transfer of IP1 to be completed;
[0069] S7, start the inference process of IP1, and transfer the instruction and parameter data of IP2 to IM2 and DM2 respectively through DMA;
[0070] S8, after obtaining the calculation result of IP1, store its output data into DM3, and judge that the life cycle of IP1 input data has ended according to the model structure, and release its memory space;
[0071] S9, after the inference of IP1 is completed and the instruction and parameter data of IP2 are transmitted, the program jumps to the first address of IM2, takes the output data of IP1 stored in DM3 as input, takes the parameter data in DM2 as parameter, starts the inference process of IP2, and at the same time, transmits the instruction and parameter data of IP3 to IM1 and DM1 respectively through DMA;
[0072] S10, after obtaining the calculation result of IP2, the output data is stored in DM3, and according to the model structure, it is determined that the life cycle of the input data of IP2 has ended, and its memory space is released;
[0073] S11, after the inference of IP2 is completed and the instruction and parameter data of IP3 are transmitted, the program jumps to the first address of IM1, takes the output data of IP2 stored in DM3 as input, takes the parameter data in DM1 as parameter, starts the inference process of IP3, and at the same time, transfers the instruction and parameter data of IP4 to IM2 and DM2 respectively through DMA;
[0074] S12, after obtaining the calculation result of IP3, the output data is stored in DM3, and according to the model structure, it is determined that the life cycle of the input data of IP3 has ended, and the memory space is released;
[0075] S13, after the inference of IP3 is completed and the instruction and parameter data of IP4 are transmitted, the program jumps to the first address of IM2, takes the output data of IP3 stored in DM3 as input, takes the parameter data in DM2 as parameter, starts the inference process of IP4, and at the same time, transfers the instruction and parameter data of IP5 to IM1 and DM1 respectively through DMA;
[0076] S14, after obtaining the calculation result of IP4, the output data is stored in DM3, and according to the model structure, it is determined that the life cycle of the input data of IP4 has ended, and its memory space is released;
[0077] S15, after the inference of IP4 is completed and the instruction and parameter data of IP5 are transmitted, the program jumps to the first address of IM1, takes the output data of IP4 stored in DM3 as input, takes the parameter data in DM1 as parameter, and starts the inference process of IP5;
[0078] S16. After obtaining the calculation result of IP5, the result is stored in DM3, and the memory space of IP5 input data is released, and the whole reasoning process is completed.
[0079] It can be seen that the present application utilizes the storage resources in the microcontroller unit to store the model code, parameter data and other information of the neural network model in different storage spaces respectively, which can reasonably utilize the advantages of flash memory and high-speed storage units, and can realize the reasonable deployment of the neural network model and efficient reasoning operations for edge computing tasks. Reasoning operations of a single network layer can be performed through two code areas and two data areas to store the model code and parameter data of the next network layer. In this way, parallel processing of relevant data of the network layer can improve the reasoning efficiency of the overall edge computing task, and thus improve the overall system performance.
[0080] like Figure 4 As shown, the embodiment of the present application discloses an edge computing task processing device, which is applied to a micro control unit, including:
[0081] A storage area division module 11 is used to store the model code and parameter data of the preset neural network model in the flash memory of the micro control unit, and divide the on-chip high-speed storage unit into a first storage area and a second storage area, and then connect the first storage area and the second storage area to the flash memory; each network layer in the preset neural network model corresponds to the model code and parameter data;
[0082] The inference operation module 12 is used to store the model codes of different network layers in the preset neural network model through the first storage area, and store the parameter data of different network layers in the preset neural network model through the second storage area, as well as the input data or output data of the network layer, so that the preset neural network model uses the storage contents in the first storage area and the second storage area to perform inference operation on the edge computing task to be processed; the input data is the original data corresponding to the edge computing task to be processed or the output data of the previous network layer;
[0083] The data acquisition module 13 is used to obtain the final output data in the second storage area after the reasoning operation is completed, so as to complete the processing process for the edge computing task to be processed.
[0084] It can be seen that the present application can utilize the storage resources in the microcontroller unit to realize the process of processing edge computing tasks by the neural network model. By storing the model code, parameter data and other information of the neural network model in different storage spaces respectively, the advantages of flash memory and high-speed storage units can be reasonably utilized, and the reasonable deployment of the neural network model and efficient reasoning operations for edge computing tasks can be realized, thereby improving the overall system performance.
[0085] In a specific embodiment, the reasoning operation module 12 may include:
[0086] A code area development unit, configured to develop a first code area and a second code area in the first storage area;
[0087] A first code storage unit, used for storing the model code of the current network layer of the preset neural network model through the first code area, so as to perform the inference operation of the current network layer;
[0088] The second code storage unit is used to perform the inference operation of the corresponding next network layer after the inference operation of the current network layer is completed and the model code corresponding to the next network layer is stored in the second code area.
[0089] In another specific embodiment, the reasoning operation module 12 may include:
[0090] A storage area development unit, configured to develop a first data area, a second data area, and a third data area in the second storage area;
[0091] A first data storage unit, used for storing parameter data of the current network layer of the preset neural network model through the first data area, so as to perform an inference operation of the current network layer;
[0092] The data storage submodule is used to store the output data corresponding to the current network layer in a third data area when the reasoning operation of the current network layer is completed and the parameter data corresponding to the next network layer is stored in the second data area, and determine the output data of the current network layer in the third data area as the input data of the next network layer to perform the reasoning operation of the next network layer.
[0093] In a specific embodiment, the reasoning operation module 12 may include:
[0094] A first storage unit is used to store the model code corresponding to the current network layer in the first code area, store the parameter data corresponding to the current network layer in the first data area, and store the original data for reasoning operation corresponding to the edge computing task to be processed in the third data area, so as to determine the original data stored in the third data area as the input data of the current network layer;
[0095] The first inference operation unit is used to perform inference operation of the current network layer based on the model code, parameter data and input data stored in the first code area, the first data area and the third data area.
[0096] In a specific embodiment, the reasoning operation module 12 may include:
[0097] An input data determination unit, used to determine the output data obtained by the inference operation corresponding to the previous network layer stored in the third data area as the input data corresponding to the current network layer;
[0098] The second inference operation unit is used to perform inference operation of the current network layer based on the input data corresponding to the current network layer in the third data area, and the model code and parameter data in the code area and data area corresponding to the current network layer.
[0099] In another specific embodiment, the data storage submodule may include:
[0100] The second data storage unit is used to store the output data corresponding to the current network layer to the third data area, and determine the end of the life cycle of the reasoning operation corresponding to the current network layer, and then release the memory space of the code area and the data area corresponding to the current network layer, so as to use the code area and the data area after the memory space is released to store the model code and parameter data of the next network layer.
[0101] In yet another specific embodiment, the data storage submodule may include:
[0102] The third data storage unit is used to store the output data corresponding to the current network layer in the third data area, and release the memory space corresponding to the output data of the previous network layer in the third data area, so as to use the output data of the current network layer stored in the third data area to perform inference operations on the next network layer.
[0103] Furthermore, the present application also discloses an electronic device. Figure 5 This is a structural diagram of an electronic device 20 according to an exemplary embodiment. The content in the diagram cannot be regarded as any limitation on the scope of use of the present application.
[0104] Figure 5 A schematic diagram of the structure of an electronic device 20 provided in an embodiment of the present application. The electronic device 20 may specifically include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 is used to store a computer program, which is loaded and executed by the processor 21 to implement the relevant steps in the edge computing task processing method disclosed in any of the aforementioned embodiments. In addition, the electronic device 20 in this embodiment may specifically be an electronic computer.
[0105] In this embodiment, the power supply 23 is used to provide working voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and the external device, and the communication protocol it follows is any communication protocol that can be applied to the technical solution of the present application, and is not specifically limited here; the input and output interface 25 is used to obtain external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs and is not specifically limited here.
[0106] In addition, the memory 22, as a carrier for storing resources, can be a read-only memory, a random access memory, a disk or an optical disk, etc. The resources stored thereon can include an operating system 221, a computer program 222, etc., and the storage method can be temporary storage or permanent storage.
[0107] The operating system 221 is used to manage and control the hardware devices and computer programs 222 on the electronic device 20, which can be Windows Server, Netware, Unix, Linux, etc. In addition to including a computer program that can be used to complete the edge computing task processing method performed by the electronic device 20 disclosed in any of the aforementioned embodiments, the computer program 222 can further include a computer program that can be used to complete other specific tasks.
[0108] Furthermore, the present application also discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, the edge computing task processing method disclosed above is implemented. For the specific steps of the method, reference can be made to the corresponding contents disclosed in the aforementioned embodiments, and no further description will be given here.
[0109] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.
[0110] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may 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.
[0111] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
[0112] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0113] The technical solution provided by the present application is introduced in detail above. 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 general technicians in this field, according to the idea 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 method for processing edge computing tasks, characterized in that: Applicable to microcontroller units, including: The model code and parameter data of the preset neural network model are stored in the flash memory of the microcontroller unit, and the on-chip high-speed storage unit is divided into a first storage area and a second storage area, and then the first storage area and the second storage area are connected to the flash memory; each network layer in the preset neural network model corresponds to the model code and parameter data; The model codes of different network layers in the preset neural network model are stored in the first storage area, and the parameter data of different network layers in the preset neural network model, as well as the input data and output data of the network layer, are stored in the second storage area, so that the preset neural network model uses the storage contents in the first storage area and the second storage area to perform reasoning operations on the edge computing task to be processed; the input data is the original data corresponding to the edge computing task to be processed or the output data of the previous network layer; When the reasoning operation is completed, obtaining the final output data in the second storage area to complete the processing process for the edge computing task to be processed; The storing of the model codes of different network layers in the preset neural network model in the first storage area includes: Opening a first code area and a second code area in the first storage area; The model code of the current network layer of the preset neural network model is stored in the first code area to perform an inference operation of the current network layer; If the inference operation of the current network layer is completed and the model code corresponding to the next network layer is stored in the second code area, the inference operation of the corresponding next network layer is performed; The storing of parameter data of different network layers in the preset neural network model and input data or output data of the network layer in the second storage area includes: Opening up a first data area, a second data area and a third data area in the second storage area; Storing parameter data of the current network layer of the preset neural network model through the first data area to perform an inference operation of the current network layer; If the inference operation of the current network layer is completed and the parameter data corresponding to the next network layer is stored in the second data area, the output data corresponding to the current network layer is stored in the third data area, and the output data of the current network layer in the third data area is determined as the input data of the next network layer to perform the inference operation of the next network layer.
2. The edge computing task processing method according to claim 1, characterized in that: If the current network layer of the preset neural network model is the first network layer, the inference operation of the current network layer includes: The model code corresponding to the current network layer is stored in the first code area, the parameter data corresponding to the current network layer is stored in the first data area, and the raw data for reasoning operation corresponding to the edge computing task to be processed is stored in the third data area, so as to determine the raw data stored in the third data area as the input data of the current network layer; An inference operation of the current network layer is performed based on the model code, parameter data and input data stored in the first code area, the first data area and the third data area.
3. The edge computing task processing method according to claim 1, characterized in that: If the current network layer of the preset neural network model is not the first network layer, the inference operation of the current network layer includes: Determine the output data obtained by the inference operation corresponding to the previous network layer stored in the third data area as the input data corresponding to the current network layer; An inference operation of the current network layer is performed based on the input data corresponding to the current network layer in the third data area, and the model code and parameter data in the code area and data area corresponding to the current network layer.
4. The edge computing task processing method according to claim 2 or 3, characterized in that: The storing the output data corresponding to the current network layer into the third data area includes: The output data corresponding to the current network layer is stored in the third data area, and the life cycle of the reasoning operation corresponding to the current network layer is determined to be over, and then the memory space of the code area and the data area corresponding to the current network layer is released, so that the code area and the data area after the memory space is released can be used to store the model code and parameter data of the next network layer.
5. The edge computing task processing method according to claim 4, characterized in that: The storing the output data corresponding to the current network layer into the third data area includes: The output data corresponding to the current network layer is stored in the third data area, and the memory space corresponding to the output data of the previous network layer in the third data area is released so as to use the output data of the current network layer stored in the third data area to perform inference operations on the next network layer.
6. An edge computing task processing device, characterized in that: Applicable to microcontroller units, including: A storage area division module, used for storing the model code and parameter data of the preset neural network model in the flash memory of the micro control unit, and dividing the on-chip high-speed storage unit into a first storage area and a second storage area, and then connecting the first storage area and the second storage area to the flash memory; each network layer in the preset neural network model corresponds to the model code and parameter data; An inference operation module, used to store the model codes of different network layers in the preset neural network model through the first storage area, and store the parameter data of different network layers in the preset neural network model through the second storage area, as well as the input data or output data of the network layer, so that the preset neural network model uses the storage contents in the first storage area and the second storage area to perform inference operation on the edge computing task to be processed; the input data is the original data corresponding to the edge computing task to be processed or the output data of the previous network layer; A data acquisition module, used for acquiring the final output data in the second storage area after the inference operation is completed, so as to complete the processing process for the edge computing task to be processed; Wherein, the reasoning operation module includes: A code area development unit, configured to develop a first code area and a second code area in the first storage area; A first code storage unit, used for storing the model code of the current network layer of the preset neural network model through the first code area, so as to perform the inference operation of the current network layer; A second code storage unit is used to perform the inference operation of the corresponding next network layer after the inference operation of the current network layer is completed and the model code corresponding to the next network layer is stored in the second code area; Wherein, the reasoning operation module includes: A storage area development unit, configured to develop a first data area, a second data area, and a third data area in the second storage area; A first data storage unit, used for storing parameter data of the current network layer of the preset neural network model through the first data area, so as to perform an inference operation of the current network layer; The data storage submodule is used to store the output data corresponding to the current network layer in a third data area when the reasoning operation of the current network layer is completed and the parameter data corresponding to the next network layer is stored in the second data area, and determine the output data of the current network layer in the third data area as the input data of the next network layer to perform the reasoning operation of the next network layer.
7. An electronic device, characterized in that: include: Memory, used to store computer programs; A processor, configured to execute the computer program to implement the edge computing task processing method as described in any one of claims 1 to 5.
8. A computer-readable storage medium, characterized in that: Used to store a computer program, which, when executed by a processor, implements the edge computing task processing method as described in any one of claims 1 to 5.
