Information processing method and device based on neural network, equipment and storage medium
By dividing the input matrix into sub-input matrix and multiplexing the weight values in the weight value table, the neural network is weighted, which solves the problem of insufficient MCU memory and computing resources, and reduces the problems of frequent memory access and wear of storage media. Improves the processing efficiency of neural networks.
Patent Information
- Application Number
- CN202411554477.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-31
- Publication Date
- 2025-02-18
- Estimated Expiration
- 2044-10-31
AI Technical Summary
The limited memory and computing resources of the MCU are in contrast to the high memory requirements and computational complexity of neural networks, resulting in frequent memory access, time-consuming and wear on the storage medium.
By dividing the input matrix into multiple sub-input matrices, and weighting the sub-input matrix is weighted based on the weight value table to obtain the sub-output value, and the target output value is obtained through splicing operations, using the complexity of the weight value Reduce memory access and storage media use.
It reduces the frequency of access operation to external memory, saves the processing time of the pending information in the neural network, and improves the efficiency of the neural network processing information.
Smart Images

Figure CN119476351A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the technical field of neural network data processing, and relates to a neural network-based information processing method, device, equipment and storage medium. Background Art
[0002] Neural network models have shown remarkable performance in many fields such as natural language processing and computer vision, and have therefore been widely used. Microcontroller Unit (MCU) has become a potential platform for the deployment of neural network models due to its advantages such as low cost, low power consumption, near data source processing, and user privacy protection. However, the limited memory and computing resources of MCU are in sharp contrast to the high memory requirements and computational complexity of neural networks. In response to this challenge, researchers have proposed a variety of optimization strategies to reduce the memory usage and computational load of neural networks. In this context, patch-based neural network inference methods have emerged, which can significantly reduce memory requirements while maintaining the accuracy of the model. However, the limitation of this method is the frequent memory access to the weight matrix in the external memory, which is not only time-consuming but also causes great wear on the storage medium. Therefore, how to optimize the memory access pattern and reduce the frequency of access operations to the external memory has become an urgent problem to be solved. Summary of the invention
[0003] The main purpose of this application is to provide a neural network-based information processing method, device, equipment and storage medium, aiming to optimize the memory access mode and reduce the frequency of access operations to external memory during the neural network-based information processing process, thereby improving the efficiency of the neural network in processing information.
[0004] In a first aspect, the present application provides an information processing method based on a neural network, the method comprising the following steps: obtaining information to be processed, and inputting the information to be processed into an input layer of the neural network in the form of an input matrix; dividing the input matrix into multiple sub-input matrices, each of which includes part of the information in the input matrix; based on a weight value table, performing weighted processing on the sub-input matrices in the inter-layer connections of the neural network to obtain sub-output values corresponding to each sub-input matrix, wherein the weight values in the weight value table can be reused for weighted processing of multiple sub-input matrices; performing a splicing operation on all the sub-output values to obtain a target output value corresponding to the sub-output value, and outputting the target output value at the output layer of the neural network.
[0005] In the second aspect, the present application also provides an information processing device based on a neural network, the device comprising: an information acquisition module for obtaining information to be processed, which is used to obtain information to be processed and input the information to be processed into the input layer of the neural network in the form of an input matrix; a sub-input matrix determination module, which is used to divide the input matrix into multiple sub-input matrices, each of which includes part of the information in the input matrix; a sub-output value determination module, which is used to perform weighted processing on the sub-input matrices in the inter-layer connections of the neural network based on a weight value table, to obtain sub-output values corresponding to each sub-input matrix, wherein the weight values in the weight value table can be reused for weighted processing of multiple sub-input matrices; a target output value determination module, which is used to perform a splicing operation on all the sub-output values, to obtain a target output value corresponding to the sub-output value, and output the target output value at the output layer of the neural network.
[0006] In a third aspect, the present application also provides a computer device, comprising a processor, a memory, and a computer program stored in the memory and executable by the processor, wherein when the computer program is executed by the processor, the neural network-based information processing method as described in any one of the first aspects is implemented.
[0007] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the neural network-based information processing method as described in any one of the first aspects is implemented.
[0008] The present application provides a neural network-based information processing method, device, equipment and computer storage medium, the neural network-based information processing method comprising: obtaining information to be processed, and inputting the information to be processed into the input layer of the neural network in the form of an input matrix; dividing the input matrix into a plurality of sub-input matrices, each of which includes part of the information in the input matrix; based on a weight value table, performing weighted processing on the sub-input matrices in the inter-layer connection of the neural network to obtain sub-output values corresponding to each of the sub-input matrices, wherein the weight values in the weight value table can be reused for weighted processing of a plurality of the sub-input matrices; A concatenation operation is performed on all the sub-output values to obtain the target output values corresponding to the sub-output values, and the target output values are output at the output layer of the neural network. In the above-mentioned information processing method based on the neural network, the input matrix is divided into multiple sub-input matrices, and based on the weight value table, the sub-input matrices are weighted in the inter-layer connection of the neural network to obtain the sub-output values corresponding to each sub-input matrix, so that the weight values in the weight value table are reasonably reused, which greatly reduces the number of times the weight values are called in and / or released, saves the processing time of the information to be processed in the neural network, and improves the efficiency of the neural network in processing information. BRIEF DESCRIPTION OF THE DRAWINGS
[0009] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0010] Figure 1 Shown is a flowchart of a neural network-based information processing method provided by an embodiment of the present application.
[0011] Figure 2 A flowchart of determining sub-output values corresponding to each of the sub-input matrices provided by an embodiment of the present application is shown.
[0012] Figure 3 A flowchart of determining the sub-output values corresponding to the remaining sub-input matrices provided by an embodiment of the present application is shown.
[0013] Figure 4 Shown is a flowchart of another neural network-based information processing method provided by an embodiment of the present application.
[0014] Figure 5 Shown is a calculation diagram of a layer in the weight value reuse algorithm.
[0015] Figure 6Shown is an application scenario diagram of the neural network-based information processing method in this application.
[0016] Figure 7 Shown is a schematic diagram of a neural network-based information processing device provided by an embodiment of the present application.
[0017] Figure 8 Shown is a schematic block diagram of the structure of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0018] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0019] The flowcharts shown in the accompanying drawings are only examples and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps may also be decomposed, combined or partially merged, so the actual execution order may change according to actual conditions.
[0020] The embodiments of the present application provide a neural network-based information processing method, apparatus, computer equipment, and computer-readable storage medium.
[0021] The information processing method based on neural network can be used in a terminal or server to optimize the memory access mode, reduce the access operation frequency to the external memory, and improve the efficiency of the neural network in processing information. The terminal can be an electronic device such as a mobile phone, a tablet computer, a laptop computer, a desktop computer, a personal digital assistant, and a wearable device; the server can be an independent server, a server cluster, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDN), and big data and artificial intelligence platforms.
[0022] In conjunction with the accompanying drawings, some embodiments of the present application are described in detail below. In the absence of conflict, the following embodiments and features in the embodiments can be combined with each other.
[0023] See also Figure 1 , Figure 1 The flowchart of the information processing method based on neural network provided by one embodiment of the present application is shown. Figure 1As shown, the neural network-based information processing method includes steps S101 to S104.
[0024] S101, obtaining information to be processed, and inputting the information to be processed into an input layer of the neural network in the form of an input matrix.
[0025] The information to be processed may be any one of text information and data information.
[0026] Exemplarily, the information to be processed may be obtained based on data acquisition technology, wherein the data acquisition technology includes: text processing, image processing and / or sensor data acquisition system.
[0027] For example, if the information to be processed is text information, the information to be processed can be converted into an input matrix based on techniques such as a bag-of-words model, word embedding, and a sequence model.
[0028] Exemplarily, if the information to be processed is data information, the information to be processed can be converted into an input matrix based on methods or techniques such as feature extraction, data enhancement, and direct use of pixel values.
[0029] After obtaining the input matrix, a series of preprocessing operations can be performed on the input matrix so that the input matrix after the preprocessing operation meets the input requirements of the neural network input layer. The preprocessing operation can be data normalization, data cleaning, data transcoding, etc.
[0030] It should be noted that the above preprocessing operations performed on the input matrix are only for illustrative purposes. In actual application scenarios, any appropriate preprocessing operations may be selected according to specific circumstances, and this application does not impose any other restrictions.
[0031] S102: Divide the input matrix into a plurality of sub-input matrices, each of the sub-input matrices including part of the information in the input matrix.
[0032] Exemplarily, the input matrix may be divided into a plurality of sub-input matrices based on distributed processing methods, matrix decomposition algorithms, and other technologies. The distributed processing methods may specifically be data sharding, MapReduce, and the like. The matrix decomposition algorithms may be singular value decomposition, QR decomposition, and the like.
[0033] In addition, the input matrix can be divided into multiple sub-input matrices by using the matrix slicing method in Python.
[0034] It should be noted that the above-mentioned method or technology of dividing the input matrix into multiple sub-input matrices is only for illustrative purposes. In actual applications, any other suitable technology can be selected according to actual application requirements to divide the input matrix into multiple sub-input matrices, and this application does not impose any restrictions on this.
[0035] S103, based on the weight value table, weighted processing is performed on the sub-input matrices in the inter-layer connections of the neural network to obtain sub-output values corresponding to each of the sub-input matrices, wherein the weight values in the weight value table can be reused for weighted processing of multiple sub-input matrices.
[0036] Among them, before the sub-output value corresponding to the first sub-input matrix is determined, the weight value table is an empty set.
[0037] S104, performing a concatenation operation on all the sub-output values to obtain a target output value corresponding to the sub-output value, and outputting the target output value at the output layer of the neural network.
[0038] Specifically,
[0039] Exemplarily, all the sub-output values may be concatenated based on the concat function in Python to obtain the target output value after concatenating all the sub-output values.
[0040] In addition, array concatenation technology may be used to concatenate all the sub-output values to obtain a target output value.
[0041] It should be noted that the above-mentioned technology of splicing all the sub-output values is only for illustrative purposes. In actual applications, any other suitable method or technology can be used to perform the splicing operation on all the sub-output values, and this application does not impose any other restrictions.
[0042] The embodiment of the present application provides an information processing method based on a neural network, the method comprising: obtaining information to be processed, and inputting the information to be processed into the input layer of the neural network in the form of an input matrix; dividing the input matrix into multiple sub-input matrices, each of which includes part of the information in the input matrix; based on the weight value table, weighting the sub-input matrix in the inter-layer connection of the neural network to obtain the sub-output values corresponding to each sub-input matrix, wherein the weight value in the weight value table can be reused for the weighted processing of multiple sub-input matrices; performing a splicing operation on all the sub-output values to obtain the target output value corresponding to the sub-output value, and outputting the target output value in the output layer of the neural network. In this method, by dividing the input matrix into multiple sub-input matrices and reusing the existing corresponding weight values in the weight value table, weighting the sub-input matrix to obtain the sub-output value corresponding to each sub-input matrix, the access operation frequency to the external memory is reduced, and there is no need to repeatedly call the weight value from the external memory to the internal memory or release the called weight value from the internal memory to the external memory, which saves the time of calling or releasing the weight value and improves the efficiency of the neural network in processing information.
[0043] See also Figure 2 , Figure 2 The flowchart of determining the sub-output values corresponding to each sub-input matrix provided by an embodiment of the present application is shown. Figure 2 As shown, the flow chart for determining the sub-output values corresponding to each of the sub-input matrices includes steps S201 to S204.
[0044] S201, when determining the sub-output value corresponding to the first sub-input matrix, call the first weight value corresponding to the first sub-input matrix from the external memory, add the first weight value to the weight value table, and determine the intermediate activation value corresponding to the first sub-input matrix based on the first weight value and the first sub-input matrix.
[0045] Before determining the sub-output value corresponding to the first sub-input matrix, the weight value table is an empty set.
[0046] Specifically, a matrix multiplication operation is performed on the first weight value and the first sub-input matrix, and the result of the matrix multiplication operation is the intermediate activation value corresponding to the first sub-input matrix. For example, Y=WX, where Y represents the intermediate activation value, X is the first sub-input matrix, and W represents the first weight value.
[0047] Exemplarily, if the first weight value corresponding to the first sub-input matrix is 40KB, when determining the sub-output value corresponding to the first sub-input matrix, the first weight value 40KB corresponding to the first sub-input matrix is called from the external memory, and the first weight value 40KB is added to the weight value table, and the first weight value is put into the weight value table at this time. Perform a matrix multiplication operation on the first weight value 40KB and the first sub-input matrix to obtain the sub-output value corresponding to the first sub-input matrix.
[0048] S202: Determine a second weight value corresponding to the intermediate activation value.
[0049] Specifically, the second weight value corresponding to the intermediate activation value is loaded from an external memory or obtained from a weight value table.
[0050] In some embodiments, determining the second weight value corresponding to the intermediate activation value includes: if the second weight value matches the weight value in the weight value table, calling the weight value in the weight value table, and the weight value in the weight value table is the second weight value; if the second weight value does not match the weight value, calling the second weight value from the external memory, and adding the second weight value called from the external memory to the weight value table.
[0051] Among them, the second weight value matches the weight value in the weight value table, which means that the second weight value is equal to the weight value in the weight value table.
[0052] Among them, the second weight value does not match the weight value in the weight value table, which means that the second weight value is not equal to the weight value in the weight value table.
[0053] Exemplarily, when determining the sub-output value corresponding to the first sub-input matrix, there is only one weight value in the weight value table, and the weight value is 40KB. If the second weight value corresponding to the intermediate activation value is 40KB, when determining the second weight value corresponding to the intermediate activation value, the size of the second weight value is also 40KB, and the second weight value matches the weight value in the weight value table, then the weight value 40KB in the weight value table is called, and the weight value in the weight value table is the second weight value. If the second weight value corresponding to the intermediate activation value is 30KB or 50KB, then the second weight value does not match the weight value in the weight value table. When determining the second weight value corresponding to the intermediate activation value, the second weight value 30KB or 50KB needs to be called from the external memory, and the 30KB or 50KB called from the external memory is added to the weight value table.
[0054] It should be noted that the above-mentioned weight values of 30KB, 40KB, and 50KB are only used for exemplary purposes, and this application does not limit the specific numerical values of the weight values.
[0055] S203: Determine the sub-output value corresponding to the intermediate activation value based on the intermediate activation value and the second weight value.
[0056] Specifically, a product operation is performed on the intermediate activation value and the second weight value, and a result of the product operation on the intermediate activation value and the second weight value is the sub-output value.
[0057] S204: Determine the sub-output values corresponding to the remaining sub-input matrices based on the weight value table.
[0058] When determining the sub-output values corresponding to the remaining sub-input matrices, the above steps are performed on the remaining second sub-input matrix, third sub-input matrix...nth sub-input matrix respectively to obtain the sub-output values corresponding to the second sub-input matrix, third sub-input matrix...nth sub-input matrix respectively.
[0059] An embodiment of the present application provides a method for determining the sub-output values corresponding to each of the sub-input matrices, the method comprising: when determining the sub-output value corresponding to the first sub-input matrix, calling the first weight value corresponding to the first sub-input matrix from the external memory, and adding the first weight value to the weight value table, determining the intermediate activation value corresponding to the first sub-input matrix based on the first weight value and the first sub-input matrix; determining the second weight value corresponding to the intermediate activation value; determining the sub-output value corresponding to the intermediate activation value based on the intermediate activation value and the second weight value; and determining the sub-output values corresponding to the remaining sub-input matrices based on the weight value table. In this method, when determining the sub-output value corresponding to the first sub-input matrix, the first weight value is added from the external memory,
[0060] The required weight values are loaded on demand, which reduces the load on the memory. The computing device only needs to perform a product operation on the current sub-input matrix and the first weight value, which improves the efficiency of the operation. When determining the sub-output value corresponding to the intermediate activation value, since there is a weight value in the weight value table at this time, first determine whether the weight value in the weight value table matches the second weight value corresponding to the intermediate activation value. According to the matching relationship between the weight value in the weight value table and the second weight value corresponding to the intermediate activation value, further determine whether the second weight value corresponding to the intermediate activation value is called from the external memory or directly uses the weight value in the weight value table. If the weight value in the weight value table matches the second weight value corresponding to the intermediate activation value, it does not need to spend a long time to call the weight from the external memory, which greatly reduces the time of calling or releasing the weight value and improves the efficiency of the neural network in processing information.
[0061] See also Figure 3 , Figure 3The flowchart of determining the sub-output values corresponding to the remaining sub-input matrices provided by an embodiment of the present application is shown. Figure 3 As shown, the neural network-based information processing method includes steps S301 to S303.
[0062] S301, obtaining first weight values corresponding to the remaining sub-input matrices.
[0063] S302: If the first weight values corresponding to the remaining sub-input matrices match the weight values in the weight value table, the corresponding weight values in the weight value table are called, and the intermediate activation value is determined based on the weight values and the sub-input matrices.
[0064] S303: If the first weight value corresponding to the remaining sub-input matrices does not match the weight value in the weight value table, the first weight value is called from the external memory, the first weight value called from the external memory is added to the weight value table, and based on the first weight value called from the external memory and the sub-input matrix, the intermediate activation values corresponding to the remaining sub-input matrices are determined.
[0065] S304: Determine the sub-output values corresponding to the remaining intermediate activation values based on the remaining intermediate activation values and the second weight value.
[0066] Among them, the above-mentioned steps of determining the sub-output values corresponding to the remaining sub-input matrices based on the weight value table are similar to the above-mentioned steps of determining the sub-output values corresponding to the first sub-input matrix, except that when determining the sub-output values corresponding to the first sub-input matrix, the first weight value step corresponding to the first sub-input matrix is called from the external memory, and this application will not repeat them.
[0067] See also Figure 4 , Figure 4 Shown is a flowchart of another neural network-based information processing method provided by an embodiment of the present application. Figure 4 As shown, the neural network-based information processing method includes steps S401 to S403.
[0068] S401, determining a preset memory of the weight value table.
[0069] Among them, the preset memory of the weight value table can be determined according to the specific application scenario. The preset memory of the weight value table can be 200KB, 180KB, etc., and this application does not impose any restrictions on this.
[0070] S402: If, when the first weight value or the second weight value is added to the weight value table, the total memory of the weight value table will be greater than the preset memory, remove the weight value at the preset position in the weight value table, and add the first weight value or the second weight value to the weight value table.
[0071] Among them, the preset position can be the header position of the weight value table, the tail position of the weight value table, etc.
[0072] In some embodiments, the weight values in the weight value table are arranged in a preset sorting rule according to the order of addition.
[0073] The preset rule may be an ascending order or a descending order.
[0074] In some embodiments, the number of the weight values removed from the preset positions in the weight value table is at least one.
[0075] For example, Figure 5 As shown, the preset memory of the weight value table is assumed to be 256KB. The 5th layer is currently being calculated. The weight values of the first 4 layers have been stored in the memory and are arranged in ascending order. The total memory usage of the weight value table is 65+55+40+30=190KB, and the output activation value of the previous layer is 40KB. At this time, 20KB of the 5th layer weight value is transferred from the external memory and stored in the weight value table, at the end of the table. According to the calculation and comparison, the memory usage of the activation value to be generated by this layer (i.e., the weight value) is assumed to be 20KB. Then the total memory usage is 190+40+20+20=270KB, which exceeds the memory limit (i.e., 256KB). At this time, the header of the weight value table (i.e., 65KB) should be removed before calculating this layer.
[0076] S403: If, when adding the first weight value or the second weight value to the weight value table, the total memory of the weight value table is less than or equal to the preset memory, the first weight value or the second weight value is added to the weight value table.
[0077] The embodiment of the present application provides another information processing method based on a neural network. The method includes: determining the preset memory of the weight value table; if the total memory of the weight value table will be greater than the preset memory when the first weight value or the second weight value is added to the weight value table, then the weight value at the preset position in the weight value table is removed, and the first weight value or the second weight value is added to the weight value table; if the total memory of the weight value table is less than or equal to the preset memory when the first weight value or the second weight value is added to the weight value table. The method can ensure that as many weight values as possible are retained in the memory without exceeding the memory limit. These weight values in the weight value table can be used directly without accessing the external memory when calculating another sub-input matrix, which greatly reduces the execution delay, reduces the number of accesses to the external memory, and saves the life of the external memory.
[0078] Figure 6 Shown is an application scenario diagram of the neural network-based information processing method in this application.
[0079] Depend on Figure 6 As shown, the input matrix is divided into two sub-input matrices, namely the first sub-input matrix and the second sub-input matrix. Based on the weight value table, the sub-output values corresponding to the first sub-input matrix and the sub-output values corresponding to the second sub-input matrix are determined respectively, and the sub-output values corresponding to the first sub-input matrix and the sub-output values corresponding to the second sub-input matrix are concatenated to obtain the target output value. Among them, the specific implementation process of the sub-output values corresponding to the first sub-input matrix and the sub-output values corresponding to the second sub-input matrix is described in the above Figures 1 to 5 The steps have been introduced in the present application and will not be described in detail.
[0080] See also Figure 7 , Figure 7 Shown is a schematic diagram of a neural network-based information processing device provided in one embodiment of the present application. The neural network-based information processing device can be configured in a server or a terminal to execute the aforementioned neural network-based information processing method.
[0081] like Figure 7 As shown, the neural network-based information processing device 700 includes: a to-be-processed information acquisition module 701, a sub-input matrix determination module 702, a sub-output value determination module 703, and a target output value determination module 704.
[0082] The information to be processed acquisition module 701 is used to acquire the information to be processed and input the information to be processed into the input layer of the neural network in the form of an input matrix.
[0083] The sub-input matrix determination module 702 is used to divide the input matrix into a plurality of sub-input matrices, each of which includes part of the information in the input matrix.
[0084] The sub-output value determination module 703 is used to perform weighted processing on the sub-input matrices in the inter-layer connections of the neural network based on the weight value table to obtain the sub-output values corresponding to each of the sub-input matrices, wherein the weight values in the weight value table can be reused for the weighted processing of multiple sub-input matrices.
[0085] The target output value determination module 704 is used to perform a splicing operation on all the sub-output values to obtain the target output value corresponding to the sub-output value, and output the target output value at the output layer of the neural network.
[0086] In some embodiments, the information to be processed acquisition module 701 is specifically used to: acquire the information to be processed, and input the information to be processed into the input layer of the neural network in the form of an input matrix.
[0087] In some embodiments, the sub-input matrix determination module 702 is specifically configured to: divide the input matrix into a plurality of sub-input matrices, each of which includes part of the information in the input matrix.
[0088] In some embodiments, the sub-output value determination module 703 is specifically used to: based on the weight value table, perform weighted processing on the sub-input matrices in the inter-layer connections of the neural network to obtain sub-output values corresponding to each sub-input matrix, wherein the weight values in the weight value table can be reused for weighted processing of multiple sub-input matrices.
[0089] In some embodiments, the target output value determination module 704 is specifically used to: perform a concatenation operation on all of the sub-output values to obtain a target output value corresponding to the sub-output value, and output the target output value at the output layer of the neural network.
[0090] In some embodiments, the sub-output value determination module 703 is specifically used to: when determining the sub-output value corresponding to the first sub-input matrix, call the first weight value corresponding to the first sub-input matrix from the external memory, and add the first weight value to the weight value table, and determine the intermediate activation value corresponding to the first sub-input matrix based on the first weight value and the first sub-input matrix; determine the second weight value corresponding to the intermediate activation value; determine the sub-output value corresponding to the intermediate activation value based on the intermediate activation value and the second weight value; and determine the sub-output values corresponding to the remaining sub-input matrices based on the weight value table.
[0091] In some embodiments, the sub-output value determination module 703 is further specifically used to: if the second weight value matches the weight value in the weight value table, then call the weight value in the weight value table, and the weight value in the weight value table is the second weight value; if the second weight value does not match the weight value, then call the second weight value from the external memory, and add the second weight value called from the external memory to the weight value table.
[0092] In some embodiments, the sub-output value determination module 703 is further specifically used to: obtain the first weight values corresponding to the remaining sub-input matrices; if the first weight values corresponding to the remaining sub-input matrices match the weight values in the weight value table, call the corresponding weight values in the weight value table, and determine the intermediate activation value based on the weight value and the sub-input matrix; if the first weight values corresponding to the remaining sub-input matrices do not match the weight values in the weight value table, call the first weight value from the external memory, add the first weight value called from the external memory to the weight value table, and determine the intermediate activation values corresponding to the remaining sub-input matrices based on the first weight value called from the external memory and the sub-input matrix; determine the sub-output values corresponding to the remaining intermediate activation values based on the remaining intermediate activation values and the second weight value.
[0093] In some embodiments, the sub-output value determination module 703 is further specifically used to determine the preset memory of the weight value table; if the total memory of the weight value table will be greater than the preset memory when the first weight value or the second weight value is added to the weight value table, the weight value at the preset position in the weight value table is removed, and the first weight value or the second weight value is added to the weight value table; if the total memory of the weight value table is less than or equal to the preset memory when the first weight value or the second weight value is added to the weight value table.
[0094] It should be noted that those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described devices and modules and units can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0095] The method and apparatus of the present application can be used in many general or special computing system environments or configurations. For example: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronic devices, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, etc. The present application can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The present application can also be practiced in distributed computing environments, in which tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media including storage devices.
[0096] Exemplarily, the above method and apparatus may be implemented in the form of a computer program. The computer program may be implemented in Figure 8 Runs on the computer device shown.
[0097] See also Figure 8 , Figure 8 The figure shows a schematic block diagram of the structure of a computer device provided in an embodiment of the present application. The computer device may be a server or a terminal.
[0098] like Figure 8 As shown, the computer device includes a processor, a memory, and a network interface connected via a system bus, wherein the memory may include a storage medium and an internal memory.
[0099] The storage medium can store an operating system and a computer program. The computer program includes program instructions, and when the program instructions are executed, the processor can execute any information processing method based on a neural network.
[0100] The processor is used to provide computing and control capabilities and support the operation of the entire computer equipment.
[0101] The internal memory provides an environment for the operation of the computer program in the storage medium. When the computer program is executed by the processor, the processor can execute any information processing method based on a neural network.
[0102] The network interface is used for network communication, such as sending assigned tasks, etc. Those skilled in the art will understand that Figure 8The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0103] It should be understood that the processor may be a central processing unit (CPU), and the processor may also be 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. Among them, the general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.
[0104] In one embodiment, the processor is used to run a computer program stored in the memory to implement the following steps:
[0105] Acquire information to be processed, and input the information to be processed into the input layer of the neural network in the form of an input matrix; divide the input matrix into multiple sub-input matrices, each of which includes part of the information in the input matrix; based on a weight value table, perform weighted processing on the sub-input matrices in the inter-layer connection of the neural network to obtain sub-output values corresponding to each sub-input matrix, wherein the weight values in the weight value table can be reused for weighted processing of multiple sub-input matrices; perform a splicing operation on all the sub-output values to obtain target output values corresponding to the sub-output values, and output the target output values in the output layer of the neural network.
[0106] In one embodiment, the processor, when implementing weighted processing of the sub-input matrices in the inter-layer connection of the neural network based on the weight value table to obtain the sub-output values corresponding to each of the sub-input matrices, is used to implement:
[0107] When determining the sub-output value corresponding to the first sub-input matrix, call the first weight value corresponding to the first sub-input matrix from the external memory, add the first weight value to the weight value table, and determine the intermediate activation value corresponding to the first sub-input matrix based on the first weight value and the first sub-input matrix; determine the second weight value corresponding to the intermediate activation value; determine the sub-output value corresponding to the intermediate activation value based on the intermediate activation value and the second weight value; and determine the sub-output values corresponding to the remaining sub-input matrices based on the weight value table.
[0108] In one embodiment, when determining the second weight value corresponding to the intermediate activation value, the processor is configured to implement:
[0109] If the second weight value matches the weight value in the weight value table, the weight value in the weight value table is called, and the weight value in the weight value table is the second weight value;
[0110] If the second weight value does not match the weight value, the second weight value is called from the external memory, and the second weight value called from the external memory is added to the weight value table.
[0111] In one embodiment, when the processor determines the sub-output values corresponding to the remaining sub-input matrices based on the weight value table, it is configured to implement:
[0112] Obtain the first weight values corresponding to the remaining sub-input matrices; if the first weight values corresponding to the remaining sub-input matrices match the weight values in the weight value table, call the corresponding weight values in the weight value table, and determine the intermediate activation values based on the weight values and the sub-input matrix; if the first weight values corresponding to the remaining sub-input matrices do not match the weight values in the weight value table, call the first weight value from the external memory, add the first weight value called from the external memory to the weight value table, and determine the intermediate activation values corresponding to the remaining sub-input matrices based on the first weight value called from the external memory and the sub-input matrix; determine the sub-output values corresponding to the remaining intermediate activation values based on the remaining intermediate activation values and the second weight value.
[0113] In one embodiment, the processor is further configured to implement:
[0114] Determine the preset memory of the weight value table; if the total memory of the weight value table will be greater than the preset memory when the first weight value or the second weight value is added to the weight value table, remove the weight value at the preset position in the weight value table, and add the first weight value or the second weight value to the weight value table; if the total memory of the weight value table is less than or equal to the preset memory when the first weight value or the second weight value is added to the weight value table.
[0115] In one embodiment, the processor is further configured to implement:
[0116] The number of the weight values removed from the preset positions in the weight value table is at least one.
[0117] In one embodiment, the processor is further configured to implement:
[0118] The weight values in the weight value table are arranged in the order of addition according to a preset sorting rule.
[0119] It should be noted that those skilled in the art can clearly understand that, for the sake of convenience and brevity of description, the specific working process of the above-described information processing device based on a neural network can refer to the corresponding process in the aforementioned embodiment of the information processing method based on a neural network, and will not be repeated here.
[0120] An embodiment of the present application also provides a computer-readable storage medium, on which a computer program is stored. The computer program includes program instructions. The method implemented when the program instructions are executed can refer to the various embodiments of the information processing method based on a neural network in the present application.
[0121] The computer-readable storage medium may be an internal storage unit of the computer device described in the foregoing embodiment, such as a hard disk or memory of the computer device. The computer-readable storage medium may also be an external storage device of the computer device, such as a plug-in hard disk, a smart memory card (SmartMedia Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc., equipped on the computer device.
[0122] It should be understood that the terms used in this application specification are only for the purpose of describing specific embodiments and are not intended to limit the application. As used in this application specification and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an" and "the" are intended to include plural forms.
[0123] It should also be understood that the term "and / or" used in the specification of this application and the appended claims refers to any combination of one or more of the associated listed items and all possible combinations, including these combinations. It should be noted that, in this article, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or system 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 system. In the absence of further restrictions, an element defined by the sentence "including a..." does not exclude the presence of other identical elements in the process, method, article or system including the element.
[0124] The serial numbers of the embodiments of the present application are for description only and do not represent the advantages and disadvantages of the embodiments. The above description is only a specific implementation mode of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in the present application, and these modifications or replacements should be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be based on the protection scope of the claims.
Claims
1. A neural network-based information processing method, characterized in that: include: Acquire information to be processed, and input the information to be processed into an input layer of the neural network in the form of an input matrix; Dividing the input matrix into a plurality of sub-input matrices, each of the sub-input matrices including part of the information in the input matrix; Based on the weight value table, weighted processing is performed on the sub-input matrices in the inter-layer connection of the neural network to obtain sub-output values corresponding to each of the sub-input matrices, wherein the weight values in the weight value table can be reused for weighted processing of multiple sub-input matrices; A concatenation operation is performed on all of the sub-output values to obtain a target output value corresponding to the sub-output value, and the target output value is output at the output layer of the neural network.
2. The information processing method based on neural network according to claim 1, characterized in that: The step of performing weighted processing on the sub-input matrices in the inter-layer connections of the neural network based on the weight value table to obtain sub-output values corresponding to each of the sub-input matrices includes: When determining the sub-output value corresponding to the first sub-input matrix, calling the first weight value corresponding to the first sub-input matrix from the external memory, adding the first weight value to the weight value table, and determining the intermediate activation value corresponding to the first sub-input matrix based on the first weight value and the first sub-input matrix; Determining a second weight value corresponding to the intermediate activation value; Determining the sub-output value corresponding to the intermediate activation value based on the intermediate activation value and the second weight value; Based on the weight value table, the sub-output values corresponding to the remaining sub-input matrices are determined.
3. The information processing method based on neural network according to claim 2, characterized in that: The first weight value and the second weight value added to the weight value table are both the weight values, and determining the second weight value corresponding to the intermediate activation value includes: If the second weight value matches the weight value in the weight value table, the weight value in the weight value table is called, and the weight value in the weight value table is the second weight value; If the second weight value does not match the weight value, the second weight value is called from the external memory, and the second weight value called from the external memory is added to the weight value table.
4. The neural network-based information processing method according to claim 2, characterized in that: The determining, based on the weight value table, the sub-output values corresponding to the remaining sub-input matrices comprises: Obtaining first weight values corresponding to the remaining sub-input matrices; If the first weight values corresponding to the remaining sub-input matrices match the weight values in the weight value table, calling the corresponding weight values in the weight value table, and determining the intermediate activation value based on the weight values and the sub-input matrices; If the first weight values corresponding to the remaining sub-input matrices do not match the weight values in the weight value table, calling the first weight value from the external memory, adding the first weight value called from the external memory to the weight value table, and determining the intermediate activation values corresponding to the remaining sub-input matrices based on the first weight value called from the external memory and the sub-input matrix; Based on the remaining intermediate activation values and the second weight value, the sub-output values corresponding to the remaining intermediate activation values are determined.
5. The neural network-based information processing method according to claim 4, characterized in that: The method further comprises: Determining a preset memory of the weight value table; If the total memory of the weight value table will be greater than the preset memory when the first weight value or the second weight value is added to the weight value table, remove the weight value at the preset position in the weight value table, and add the first weight value or the second weight value to the weight value table; If the total memory of the weight value table is less than or equal to the preset memory when the first weight value or the second weight value is added to the weight value table, the first weight value or the second weight value is added to the weight value table.
6. The information processing method based on neural network according to claim 5, characterized in that: The number of the weight values removed from the preset positions in the weight value table is at least one.
7. The neural network-based information processing method according to claim 5, characterized in that: The weight values in the weight value table are arranged in the order of addition according to a preset sorting rule.
8. An information processing device based on a neural network, characterized in that: include: A module for acquiring information to be processed, used for acquiring information to be processed, and inputting the information to be processed into an input layer of the neural network in the form of an input matrix; A sub-input matrix determination module, used for dividing the input matrix into a plurality of sub-input matrices, each of which includes part of the information in the input matrix; A sub-output value determination module, configured to perform weighted processing on the sub-input matrices in the inter-layer connection of the neural network based on a weight value table to obtain sub-output values corresponding to each of the sub-input matrices, wherein the weight values in the weight value table can be reused for weighted processing of multiple sub-input matrices; The target output value determination module is used to perform a splicing operation on all the sub-output values to obtain the target output value corresponding to the sub-output value, and output the target output value at the output layer of the neural network.
9. A computer device, characterized in that: The computer device includes a memory and a processor; The memory is used to store computer programs; The processor is used to execute the computer program and implement the neural network-based information processing method according to any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the processor implements the neural network-based information processing method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Full connection layer implementation method and device, electronic equipment and computer readable storage medium
CN111199268A
Text classification method and system based on model automatic quantization and storage medium
CN116992032A
Neural network convolution operation device and method
WO2018108126A1