Data processing method, system, storage medium and electronic device

By performing neural network calculations during the data input and output process, the problem of high resource consumption of convolutional neural networks in edge terminals is solved, achieving more efficient calculation and resource utilization.

CN114626971BActive Publication Date: 2024-10-29GREE ELECTRIC APPLIANCE INC OF ZHUHAI
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210124507.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-02-10
Publication Date
2024-10-29
Estimated Expiration
2042-02-10

AI Technical Summary

Technical Problem

The implementation of convolutional neural networks in edge terminals is limited by resource constraints and computationally intensive and mobile-intensive characteristics, which results in frequent transfer of intermediate layer data and weight data in neural network calculations, consuming a large amount of memory and computing resources.

Method used

By collecting the target image and storing it in the input image buffer area allocated by the memory, extract the data of the preset size and store it in the input buffer area of ​​the convolutional neural network acceleration memory. After performing the neural network calculation, store it in the output buffer area, and then save the result. Store the output image buffer in memory to reduce data movement and memory usage.

Benefits of technology

It improves computing efficiency, reduces memory and data movement consumption, and optimizes resource utilization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114626971B_ABST
    Figure CN114626971B_ABST
Patent Text Reader

Abstract

The present application relates to a data processing method, system, storage medium and electronic device, including: collecting target images; storing the target images in an input image buffer allocated by memory; extracting target image data of preset size from the input image buffer, storing the target image data of preset size in the input buffer of a convolutional neural network acceleration memory, and deleting the input image buffer; storing the target image data of preset size in the input buffer after performing neural network calculation in the output buffer in the output buffer of the convolutional neural network acceleration memory; storing the target image data of preset size calculated in the output buffer in the output image buffer allocated by memory; returning to the execution step to extract the target image data of preset size from the input image buffer until the target image processing is completed. By performing neural network calculation in the process of data input and output, memory usage and data movement times are reduced, and calculation efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing technology, and in particular to a data processing method, system, storage medium and electronic device. Background Art

[0002] Convolutional neural networks have achieved great success in the application of artificial intelligence, including speech recognition, computer vision, natural language processing, etc. However, these deep neural networks require huge computing and memory overhead, which seriously hinders their use under resource constraints. Generally speaking, the hardware resources of embedded devices in smart home appliances are very limited and have strict requirements on power consumption. The storage and memory space of their processors are small, making the implementation of convolutional neural networks in edge terminals difficult.

[0003] Neural network computing is a typical compute-intensive and mobile-intensive computing. Neural networks are hierarchical structures, and the intermediate calculation results of each layer will generate a large number of parameters. If memory space is allocated for the calculation of each layer, this will consume a lot of memory resources. That is, a large amount of energy consumption occurs in the process of frequent transfer of intermediate layer data and weight data between the NPU and the memory, which consumes a lot of memory resources and computing resources. Summary of the invention

[0004] In response to the above problems, the present application provides a data processing method, system, storage medium and electronic device, which solves the technical problem in the related art that the neural network calculation base is frequently transferred between the NPU and the memory, which consumes a lot of memory resources and computing resources.

[0005] In a first aspect, the present application provides a data processing method, the method comprising:

[0006] Acquire target images;

[0007] Storing the target image in an input image buffer allocated by a memory;

[0008] Extracting target image data of a preset size from the input image buffer, storing the target image data of the preset size in the input buffer of the convolutional neural network acceleration memory, and deleting the input image buffer;

[0009] After performing neural network calculation on the target image data of a preset size in the input buffer area, the data is stored in the output buffer area of ​​the convolutional neural network acceleration memory;

[0010] The calculated target image data of the preset size in the output buffer is stored in the output image buffer allocated by the memory;

[0011] Return to the step of extracting target image data of a preset size from the input image buffer until the target image is processed.

[0012] In some embodiments, the neural network calculations include:

[0013] At least one of activation operation calculation, normalization operation calculation, pooling operation calculation, compression operation calculation and decompression operation calculation.

[0014] In some embodiments, before storing the target image in the input image buffer of the memory, the method further includes:

[0015] The target image is preprocessed.

[0016] In some embodiments, the method further comprises:

[0017] In the process of storing the target image data of the preset size into the input buffer area of ​​the convolutional neural network acceleration memory, neural network calculation is performed.

[0018] In some embodiments, the method further comprises:

[0019] The neural network calculation is performed in the process of storing the target image data of the preset size calculated in the output buffer area into the output image buffer area allocated by the memory.

[0020] In some embodiments, after the target image is processed, the method further includes:

[0021] The output image buffer is converted into an input image buffer.

[0022] In some embodiments, if a branch cache area exists, the method further includes:

[0023] The target image data of the preset size calculated in the output buffer area is stored in the branch buffer area allocated by the memory according to the configuration of the configuration file.

[0024] In a second aspect, a data processing system is provided, the system comprising:

[0025] An acquisition unit, used for acquiring a target image;

[0026] A first storage unit, used for storing the target image in an input image buffer area allocated by a memory;

[0027] A second storage unit is used to extract target image data of a preset size from the input image buffer area, store the target image data of the preset size into the input buffer area of ​​the convolutional neural network acceleration memory, and delete the input image buffer area;

[0028] A third storage unit is used to store the target image data of a preset size in the input buffer area into the output buffer area of ​​the convolutional neural network acceleration memory after performing neural network calculation;

[0029] A fourth storage unit, used for storing the calculated target image data of the preset size in the output buffer area into the output image buffer area allocated by the memory;

[0030] The return execution unit is used to return to the execution step to extract the target image data of a preset size from the input image buffer until the target image is processed.

[0031] In a third aspect, a storage medium stores a computer program that can be executed by one or more processors and can be used to implement the data processing method described in the first aspect.

[0032] In a fourth aspect, an electronic device comprises a memory and a processor, wherein the memory stores a computer program, the memory and the processor are communicatively connected to each other, and when the computer program is executed by the processor, the data processing method as described in the first aspect is performed.

[0033] The present application provides a data processing method, system, storage medium and electronic device, including: collecting a target image; storing the target image in an input image buffer allocated by memory; extracting target image data of a preset size from the input image buffer, storing the target image data of the preset size in the input buffer of a convolutional neural network acceleration memory, and deleting the input image buffer; performing neural network calculation on the target image data of the preset size in the input buffer, and storing it in the output buffer of the convolutional neural network acceleration memory; storing the target image data of the preset size calculated in the output buffer in the output image buffer allocated by memory; returning to the execution step to extract the target image data of the preset size from the input image buffer until the target image is processed. The present application reduces memory usage and data movement times and improves computing efficiency by performing neural network calculation in the process of data input and output. BRIEF DESCRIPTION OF THE DRAWINGS

[0034] 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.

[0035] Figure 1A flowchart of a data processing method provided in an embodiment of the present application;

[0036] Figure 2 A flow chart of a data processing method provided in an embodiment of the present application;

[0037] Figure 3 A schematic diagram of a merged layer structure provided in an embodiment of the present application;

[0038] Figure 4 A schematic diagram of the structure of a data processing system provided in an embodiment of the present application;

[0039] Figure 5 A connection block diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0040] The following will describe the implementation methods of the present application in detail with reference to the accompanying drawings and embodiments, so that the implementation process of how the present application applies technical means to solve technical problems and achieve corresponding technical effects can be fully understood and implemented accordingly. The embodiments of the present application and the various features in the embodiments can be combined with each other without conflict, and the technical solutions formed are all within the scope of protection of the present application.

[0041] As can be seen from the background technology, neural network computing is a typical compute-intensive and mobile-intensive computing. The neural network is a hierarchical structure, and the intermediate calculation results of each layer will generate a large number of parameters. If memory space is allocated for the calculation of each layer, this will consume a lot of memory resources, that is, a large amount of energy consumption occurs in the process of frequent transfer of intermediate layer data and weight data between the NPU and the memory, which consumes a lot of memory resources and computing resources.

[0042] In view of this, the present application provides a data processing method, system, storage medium and electronic device, which solves the technical problem in the related art that the neural network calculation base is frequently transferred between the NPU and the memory, which consumes a lot of memory resources and computing resources.

[0043] Embodiment 1

[0044] Figure 1 A flowchart of a data processing method provided in an embodiment of the present application is shown in FIG. Figure 1 As shown, the method includes:

[0045] S101, collecting target images;

[0046] S102, storing the target image into an input image buffer area allocated by a memory;

[0047] S103, extracting target image data of a preset size from the input image buffer area, storing the target image data of the preset size into the input buffer area of ​​the convolutional neural network acceleration memory, and deleting the input image buffer area;

[0048] S104, performing neural network calculation on the target image data of a preset size in the input buffer area, and storing the data in the output buffer area of ​​the convolutional neural network acceleration memory;

[0049] S105, storing the calculated target image data of the preset size in the output buffer into the output image buffer allocated by the memory;

[0050] S106, returning to the execution step to extract target image data of a preset size from the input image buffer until the target image is processed.

[0051] It should be noted that before the Convolution Neural Network Processor (CNP) starts computing, it needs to be configured first.

[0052] like Figure 2 As shown, it is a flow chart of the data processing method, wherein input_image_buffer is the input image buffer, output_image_buffer is the output image buffer, the command line CMD in the configuration file OPS will be loaded into the position after the input buffer (bankA and bankB) and the output buffer (bankC and bankD) in the convolutional neural network acceleration memory CNPSRAM, and the weight data WT (weight) is loaded into the communication data transmission module STR_FIFO by the direct memory access DMA module for neural network calculation.

[0053] Among them, the OPS file contains a file header, an operator sequence, a hardware instruction set, and a weight set.

[0054] It should be further explained that, since the memory sizes required by the input image buffer and the output image buffer of the memory SDRAM are different, it is necessary to set the buffer size that occupies the largest area to the input image buffer and the output image buffer. Similarly, the maximum buffer size required to calculate the number of branches is set to the buffer size of each branch buffer, which can be calculated in advance through the network structure.

[0055] The convolutional neural network acceleration memory CNP SRAM also has an input / output buffer area, which is used for the space required for CNP calculations. The size is 256k and the size is fixed, so no further allocation is required. However, since the CNP SRAM is small, the input buffer data needs to be preprocessed, such as cutting images or channels.

[0056] In some embodiments, the neural network calculations include:

[0057] At least one of activation operation calculation, normalization operation calculation, pooling operation calculation, compression operation calculation and decompression operation calculation.

[0058] It should be noted that neural network calculations include conventional computing operations other than convolution. These operations are determined by the structure of the neural network. The convolutional neural network has a clear hierarchical structure. In order to improve the efficiency of operation, the compiler or scheduler needs to disassemble the operation process by layer, row, column or channel, and use multiple heterogeneous processor cores to complete the operation process together. Therefore, we introduce the concept of "operator" (divided into hardware operators and software operators) to describe the disassembled operation units. Operator sequences can be executed sequentially, in parallel, or in a pipeline for concurrent execution, so they are called "operator streams." Moreover, this patent mainly explains memory allocation, so this part is another feature of the entire CNP architecture.

[0059] However, CNP supports limited operators, and software is often required to complete operators that are not supported by hardware. In order to reduce SDRAM bandwidth pressure,

[0060] We complete the desired operator operation on some of the intermediate layer data, and then proceed to the next layer of convolution operation.

[0061] That is, when data is imported and exported from the Bank buffer, we can perform simple operator operations to implement the design idea of ​​moving and computing: merging layers with the convolution layer as the center. The starting layer of the merging layer is the route layer or the convolution layer, the ending layer is the shortcut synthesis layer and the activation layer after the synthesis (activation layer after shortcut), and the middle layer is the normalization layer, activation layer and pooling layer. When the data is input or output, the neural network operation of the fixed merging layer format is performed.

[0062] like Figure 3 As shown, it is a schematic diagram of the merged layer structure.

[0063] In some embodiments, before storing the target image in the input image buffer of the memory, the method further includes:

[0064] The target image is preprocessed.

[0065] It should be noted that the collected image is preprocessed by calling the image processing module IMP, such as cropping, scaling, and RGB channel separation of the image.

[0066] In some embodiments, the method further comprises:

[0067] In the process of storing the target image data of the preset size into the input buffer area of ​​the convolutional neural network acceleration memory, neural network calculation is performed.

[0068] In some embodiments, the method further comprises:

[0069] The neural network calculation is performed in the process of storing the target image data of the preset size calculated in the output buffer area into the output image buffer area allocated by the memory.

[0070] It should be noted that performing neural network calculations during the data input and output process improves computing efficiency.

[0071] In some embodiments, after the target image is processed, the method further includes:

[0072] The output image buffer is converted into an input image buffer.

[0073] It should be noted that if the image that has completed a round of calculation needs to be calculated again, the output image buffer can be converted into an input image buffer, and then the step of extracting the target image data of a preset size from the input image buffer is performed, and the target image data of the preset size is stored in the input buffer of the convolutional neural network acceleration memory. Such memory allocation can improve the utilization rate of memory resources.

[0074] In some embodiments, if a branch cache area exists, the method further includes:

[0075] The target image data of the preset size calculated in the output buffer area is stored in the branch buffer area allocated by the memory according to the configuration of the configuration file.

[0076] It should be noted that, sometimes a branch cache area is allocated according to needs, and the branch cache area is recycled after use to wait for re-allocation.

[0077] In summary, the embodiment of the present application provides a data processing method, including: acquiring a target image; storing the target image in an input image buffer allocated by memory; extracting target image data of a preset size from the input image buffer, storing the target image data of the preset size in the input buffer of a convolutional neural network acceleration memory, and deleting the input image buffer; performing neural network calculation on the target image data of the preset size in the input buffer, and storing it in the output buffer of the convolutional neural network acceleration memory; storing the target image data of the preset size calculated in the output buffer in the output image buffer allocated by memory; returning to the execution step to extract the target image data of the preset size from the input image buffer until the target image is processed. The present application reduces memory usage and data movement times and improves computing efficiency by performing neural network calculations in the process of data input and output.

[0078] Embodiment 2

[0079] Based on the data processing method disclosed in the above embodiment of the present invention, Figure 4 The invention specifically discloses a data processing system applying the data processing method.

[0080] like Figure 4 As shown, an embodiment of the present invention discloses a data processing system, the system comprising:

[0081] The acquisition unit 401 is used to acquire a target image;

[0082] A first storage unit 402, used for storing the target image in an input image buffer area allocated by a memory;

[0083] A second storage unit 403 is used to extract target image data of a preset size from the input image buffer area, store the target image data of the preset size into the input buffer area of ​​the convolutional neural network acceleration memory, and delete the input image buffer area;

[0084] A third storage unit 404 is used to store the target image data of a preset size in the input buffer area into the output buffer area of ​​the convolutional neural network acceleration memory after performing neural network calculation;

[0085] A fourth storage unit 405 is used to store the calculated target image data of the preset size in the output buffer area into the output image buffer area allocated by the memory;

[0086] The return execution unit 406 is used to return to the execution step of extracting target image data of a preset size from the input image buffer until the target image is processed.

[0087] For the specific working process of each unit in the data processing system disclosed in the above embodiment of the present invention, reference can be made to the corresponding content in the data processing method disclosed in the above embodiment of the present invention, which will not be described in detail here.

[0088] In summary, the embodiment of the present application provides a data processing system, including: acquiring a target image; storing the target image in an input image buffer allocated by memory; extracting target image data of a preset size from the input image buffer, storing the target image data of the preset size in the input buffer of a convolutional neural network acceleration memory, and deleting the input image buffer; performing neural network calculation on the target image data of the preset size in the input buffer, and storing it in the output buffer of the convolutional neural network acceleration memory; storing the target image data of the preset size calculated in the output buffer in the output image buffer allocated by memory; returning to the execution step to extract the target image data of the preset size from the input image buffer until the target image is processed. The present application reduces memory usage and data movement times and improves computing efficiency by performing neural network calculations in the process of data input and output.

[0089] Embodiment 3

[0090] This embodiment also provides a computer-readable storage medium, such as a flash memory, a hard disk, a multimedia card, a card-type memory (for example, an SD or DX memory, etc.), a random access memory (RAM), a static random access memory (SRAM), a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), a programmable read-only memory (PROM), a magnetic memory, a disk, an optical disk, a server, an App application store, etc., on which a computer program is stored. When the computer program is executed by a processor, the method steps of the first embodiment can be implemented, and this embodiment will not be repeated here.

[0091] Embodiment 4

[0092] Figure 5 A connection block diagram of an electronic device 500 provided in an embodiment of the present application, such as Figure 5 As shown, the electronic device 500 may include: a processor 501 , a memory 502 , a multimedia component 503 , an input / output (I / O) interface 504 , and a communication component 505 .

[0093] The processor 501 is used to execute all or part of the steps in the data processing method in Embodiment 1. The memory 502 is used to store various types of data, which may include instructions of any application or method in the electronic device, and data related to the application.

[0094] The processor 501 can be an application specific integrated circuit (ASIC), a digital signal processor (DSP), a digital signal processing device (DSPD), a programmable logic device (PLD), a field programmable gate array (FPGA), a controller, a microcontroller, a microprocessor or other electronic components, and is used to execute the data processing method in the above-mentioned embodiment 1.

[0095] The memory 502 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk or optical disk.

[0096] The multimedia component 503 may include a screen and an audio component, the screen may be a touch screen, and the audio component is used to output and / or input audio signals. For example, the audio component may include a microphone, and the microphone is used to receive external audio signals. The received audio signal may be further stored in a memory or sent via a communication component. The audio component also includes at least one speaker for outputting audio signals.

[0097] The I / O interface 504 provides an interface between the processor 501 and other interface modules, which may be a keyboard, a mouse, buttons, etc. These buttons may be virtual buttons or physical buttons.

[0098] The communication component 505 is used for wired or wireless communication between the electronic device 500 and other devices. Wireless communication, such as Wi-Fi, Bluetooth, Near Field Communication (NFC), 2G, 3G or 4G, or a combination of one or more of them, so the corresponding communication component 505 can include: Wi-Fi module, Bluetooth module, NFC module.

[0099] In summary, the present application provides a data processing method, system, storage medium and electronic device, the method comprising: acquiring a target image; storing the target image in an input image buffer allocated by memory; extracting target image data of a preset size from the input image buffer, storing the target image data of the preset size in the input buffer of a convolutional neural network acceleration memory, and deleting the input image buffer; performing neural network calculation on the target image data of the preset size in the input buffer, and storing it in the output buffer of the convolutional neural network acceleration memory; storing the target image data of the preset size calculated in the output buffer in the output image buffer allocated by memory; returning to the execution step to extract the target image data of the preset size from the input image buffer until the target image is processed. The present application reduces memory usage and data movement times and improves computing efficiency by performing neural network calculations in the process of data input and output.

[0100] In the several embodiments provided in the present application, it should be understood that the disclosed method can also be implemented in other ways. The method embodiments described above are merely illustrative.

[0101] It should be noted that, in this article, the terms "include", "comprises" or any other variations 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 includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the presence of other identical elements in the process, method, article or device including the element.

[0102] Although the implementation methods disclosed in this application are as above, the above contents are only the implementation methods adopted for facilitating the understanding of this application, and are not intended to limit this application. Any technician in the technical field to which this application belongs can make any modifications and changes in the form and details of the implementation without departing from the spirit and scope disclosed in this application, but the scope of patent protection of this application shall still be based on the scope defined in the attached claims.

Claims

1. A data processing method, characterized in that: The method comprises: Acquire target images; Storing the target image in an input image buffer allocated by a memory; Extracting target image data of a preset size from the input image buffer, storing the target image data of the preset size in the input buffer of the convolutional neural network acceleration memory, and deleting the input image buffer; After performing neural network calculation on the target image data of a preset size in the input buffer area, the data is stored in the output buffer area of ​​the convolutional neural network acceleration memory; The calculated target image data of the preset size in the output buffer is stored in the output image buffer allocated by the memory; Returning to the step of extracting target image data of a preset size from the input image buffer until the target image is processed; The method further comprises: Performing neural network calculations during the process of storing the target image data of the preset size into the input buffer area of ​​the convolutional neural network acceleration memory; The method further comprises: The neural network calculation is performed in the process of storing the target image data of the preset size calculated in the output buffer area into the output image buffer area allocated by the memory.

2. The method according to claim 1, characterized in that The neural network calculation includes: At least one of activation operation calculation, normalization operation calculation, pooling operation calculation, compression operation calculation and decompression operation calculation.

3. The method according to claim 1, characterized in that Before storing the target image in the input image buffer area of ​​the memory, the method further includes: The target image is preprocessed.

4. The method according to claim 1, characterized in that: After the target image is processed, the method further includes: The output image buffer is converted into an input image buffer.

5. The method according to claim 1, characterized in that If a branch cache area exists, the method further includes: The target image data of the preset size calculated in the output buffer area is stored in the branch buffer area allocated by the memory according to the configuration of the configuration file.

6. A data processing system, characterized in that: The system comprises: An acquisition unit, used for acquiring a target image; A first storage unit, used for storing the target image in an input image buffer area allocated by a memory; A second storage unit is used to extract target image data of a preset size from the input image buffer, store the target image data of the preset size in the input buffer of the convolutional neural network acceleration memory, and delete the input image buffer; perform neural network calculation in the process of storing the target image data of the preset size in the input buffer of the convolutional neural network acceleration memory; perform neural network calculation in the process of storing the target image data of the preset size calculated in the output buffer in the output image buffer allocated by the memory; A third storage unit is used to store the target image data of a preset size in the input buffer area into the output buffer area of ​​the convolutional neural network acceleration memory after performing neural network calculation; A fourth storage unit, used for storing the calculated target image data of the preset size in the output buffer area into the output image buffer area allocated by the memory; The return execution unit is used to return to the execution step to extract the target image data of a preset size from the input image buffer until the target image is processed.

7. A storage medium, characterized in that: The computer program stored in the storage medium can be executed by one or more processors and can be used to implement the data processing method as described in any one of claims 1 to 5.

8. An electronic device, characterized in that: It comprises a memory and a processor, wherein a computer program is stored in the memory, and the memory and the processor are communicatively connected with each other, and when the computer program is executed by the processor, the data processing method according to any one of claims 1 to 5 is executed.

Citation Information

Patent Citations

  • Convolution neural network computing acceleration method, device, apparatus, and storage medium

    CN109460813A