Convolution calculation method and device, electronic equipment and storage medium

By dividing data into sub-data and processing them through registers and computing units, the method addresses the inefficiency of traditional convolutional neural networks, improving both efficiency and accuracy of convolution operations.

CN119067176APending Publication Date: 2024-12-03SHENZHEN INTELLIFUSION TECHNOLOGIES CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411100109.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-09
Publication Date
2024-12-03

AI Technical Summary

Technical Problem

Traditional convolutional neural networks suffer from low efficiency due to the involvement of multiple parameters and elements in the convolution operation, leading to inefficient processing.

Method used

The method involves dividing data into sub-data based on a preset convolution kernel, storing each sub-data in registers, and processing elements through computing units to determine convolution operation results, thereby screening out non-participating parameters and elements.

Benefits of technology

This approach improves the efficiency and accuracy of convolution operations by ensuring only relevant data and parameters are processed, enhancing the overall performance of electronic devices.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119067176A_ABST
    Figure CN119067176A_ABST
Patent Text Reader

Abstract

The invention provides a convolution calculation method and device, electronic equipment and a storage medium. The convolution calculation method comprises the steps that to-be-processed data is divided into multiple sub-data according to a convolution kernel; inputting the plurality of pieces of sub-data to a plurality of preset registers, wherein each piece of sub-data corresponds to one register; a plurality of elements included in each piece of sub-data are input into a plurality of calculation units from the register, and each calculation unit corresponds to one element; determining a to-be-operated calculation unit from the plurality of calculation units according to the convolution kernel; calculating an element corresponding to the to-be-calculated calculation unit and the convolution kernel by adopting the to-be-calculated calculation unit, and determining a convolution operation result of each piece of sub-data; and determining a convolution operation result of the to-be-processed data based on the convolution operation result corresponding to each piece of sub-data in the plurality of pieces of sub-data. The invention relates to the technical field of artificial intelligence, and can improve the efficiency of convolution operation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of artificial intelligence, and in particular to a convolution calculation method, device, electronic device and storage medium. Background Art

[0002] At present, with the development of data science, deep learning technology has received more and more attention. Among them, convolutional neural networks have attracted widespread attention in the field of processing image data and signal data. Convolutional neural networks have a relatively ideal performance for large-scale image processing. Compared with traditional image analysis algorithms, convolutional neural network models avoid complex pre-processing of images and can directly receive and process original images, so they are more widely used.

[0003] However, in the process of convolution operation, traditional convolutional neural networks usually use multiple parameters in the convolution kernel and multiple elements in the data to be processed to perform convolution operation, and then obtain the corresponding convolution operation results. In the process of convolution operation, each parameter in the convolution kernel and each corresponding element need to participate in the convolution operation, so this convolution operation method may have the problem of low efficiency. Summary of the invention

[0004] In view of the above, it is necessary to propose a convolution calculation method, device, electronic device and storage medium to solve the technical problem of low efficiency of convolution calculation.

[0005] The present application provides a convolution calculation method, which is applied to an electronic device, and the method includes: dividing the data to be processed into multiple sub-data according to a preset convolution kernel; inputting multiple corresponding sub-data into multiple preset registers, each of the sub-data corresponds to one register; inputting multiple elements included in each of the sub-data from the registers to multiple computing units, wherein each of the computing units corresponds to one element; determining the computing unit to be operated from the multiple computing units according to the convolution kernel; using the computing unit to be operated, calculating the elements corresponding to the computing unit to be operated and the convolution kernel, and determining the convolution operation result of each of the sub-data; determining the convolution operation result of the data to be processed based on the convolution operation result corresponding to each of the multiple sub-data.

[0006] An embodiment of the present application also provides a convolution computing device, which includes: a division module, which is used to divide the data to be processed into multiple sub-data according to a preset convolution kernel; a cache module, which is used to input multiple sub-data into multiple preset registers, each sub-data corresponds to a register; the cache module is also used to input multiple elements included in each sub-data from the register to multiple computing units, wherein each computing unit corresponds to one element; an operation module, which is used to determine the computing unit to be operated from the multiple computing units according to the convolution kernel; the operation module is also used to use the computing unit to be operated to calculate the elements corresponding to the computing unit to be operated and the convolution kernel to determine the convolution operation result of each sub-data; the operation module is also used to determine the convolution operation result of the data to be processed based on the convolution operation result corresponding to each of the multiple sub-data.

[0007] An embodiment of the present application also provides an electronic device, which includes: a memory storing at least one instruction; and a processor executing the instruction stored in the memory to implement the convolution calculation method.

[0008] An embodiment of the present application also provides a computer storage medium, on which a computer program is stored. When the computer program is executed by a processor, the convolution calculation method is implemented.

[0009] It can be seen from the above technical scheme that the embodiment of the present application divides the data to be processed into multiple sub-data, and stores each sub-data in the corresponding preset register respectively, so that different parts of the data to be processed can be stored in slices, thereby improving the efficiency of the electronic device to read or modify the data to be processed, and each time a convolution operation can be performed on a certain part of the data to be processed, thereby improving the efficiency of the convolution operation. Then, the multiple elements included in each of the sub-data are input from the register to multiple computing units, and the computing unit to be calculated is determined from the multiple computing units according to the convolution kernel, and the computing unit to be calculated is used to calculate its corresponding elements and convolution kernel to obtain the convolution operation result of each sub-data. In this way, the elements that do not participate in the convolution operation in the data to be processed and the parameters that do not participate in the convolution operation in the convolution kernel can be screened out during the convolution operation, so as to avoid all parameters and elements from participating in the convolution operation, thereby ensuring the accuracy of the convolution operation while improving the efficiency of the convolution operation. BRIEF DESCRIPTION OF THE DRAWINGS

[0010] Figure 1 This is an application scenario diagram of a convolution calculation method provided in one embodiment of the present application.

[0011] Figure 2It is a flowchart of a convolution calculation method provided in one embodiment of the present application.

[0012] Figure 3 It is a schematic diagram of determining sub-data provided by an embodiment of the present application.

[0013] Figure 4 is a schematic diagram of a convolution operation provided in an embodiment of the present application.

[0014] Figure 5 It is a flowchart of a method for storing sub-data in a register provided by an embodiment of the present application.

[0015] Figure 6 is a schematic diagram of a preset register provided in an embodiment of the present application.

[0016] Figure 7 It is a flowchart of a method for inputting sub-data to multiple computing units provided by an embodiment of the present application.

[0017] Figure 8 2 is a schematic diagram of a dilated convolution operation provided in accordance with an embodiment of the present application.

[0018] Fig. 9 It is a schematic diagram of multiple computing units provided in one embodiment of the present application.

[0019] Fig.10 It is a functional module diagram of a convolution computing device provided in one embodiment of the present application.

[0020] Fig.11 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0021] In order to more clearly understand the purpose, features and advantages of the present application, the present application is described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be noted that, in the absence of conflict, the embodiments of the present application and the features in the embodiments can be combined with each other. In the following description, many specific details are set forth to facilitate a full understanding of the present application, and the embodiments described are only a part of the embodiments of the present application, rather than all of the embodiments.

[0022] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. In the description of this application, the meaning of "plurality" is two or more, unless otherwise clearly and specifically defined.

[0023] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those generally understood by those skilled in the art to which the present application belongs. The terms used herein in the specification of the present application are only for the purpose of describing specific embodiments and are not intended to limit the present application. The term "and / or" used herein includes any and all combinations of one or more of the related listed items.

[0024] The embodiment of the present application provides a convolution calculation method, which can be applied to one or more electronic devices. The electronic device is a device that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes but is not limited to a microprocessor, an application specific integrated circuit (Application Specific Integrated Circuit, ASIC), a programmable gate array (Field-Programmable Gate Array, FPGA), a digital processor (Digital Signal Processor, DSP), an embedded device, etc.

[0025] An electronic device can be any electronic product that can interact with a customer, such as a personal computer, a tablet computer, a smart phone, a personal digital assistant (PDA), a game console, an interactive network television (IPTV), a smart wearable device, etc.

[0026] The electronic device may also include a network device and / or a client device, wherein the network device includes, but is not limited to, a single network server, a server group consisting of multiple network servers, or a cloud consisting of a large number of hosts or network servers based on cloud computing.

[0027] The network where the electronic device is located includes but is not limited to the Internet, wide area network, metropolitan area network, local area network, virtual private network (VPN), etc.

[0028] Convolution is a linear operation. It is also shift-invariant, that is, if the input signal is shifted, the result of the convolution will also be shifted accordingly. Convolution can be applied to multiple data analysis fields, including image processing, signal processing, and machine learning. Specifically, in the field of image processing, convolution can be applied to image filtering, edge detection, feature extraction, etc.; in the field of signal processing, convolution can be used to analyze the spectral characteristics of signals and implement signal filtering; in the field of machine learning, convolution can be applied to convolutional neural networks (CNNs). The convolution layer in the convolutional neural network extracts image features through convolution.

[0029] For example, when convolution operation is used for feature extraction, convolution operation can extract features such as edges and textures in the image. By designing different convolution kernels, different features of the image can be extracted. For example, the Sobel operator can be used as a convolution kernel to extract edge information of the image. In a convolutional neural network, the convolution layer performs convolution operation with the input image through multiple convolution kernels to generate multiple feature maps, each of which contains a specific feature of the input image. Convolution operation can also be used for image filtering, such as smoothing filtering and sharpening filtering. By selecting a suitable convolution kernel, the image can be smoothed, denoised, sharpened, and other effects can be achieved. Convolution operation can also be used for image recognition and classification. In image recognition and classification tasks, convolutional neural networks extract high-level features of the image layer by layer by stacking multiple convolution layers and pooling layers, and finally achieve classification through the fully connected layer. Convolution operation plays a vital role in this process. Convolution operation can also be applied to image segmentation tasks, in which convolution operation also plays an important role. The image features extracted by convolutional neural networks can be used to segment and identify different areas in the image.

[0030] like Figure 1 As shown, a convolution calculation method provided by the present application can be applied to an electronic device 100, and the electronic device 100 is connected to a server 200 for communication. The electronic device 100 is used to obtain the data to be processed from the server 200, and perform a convolution operation on the data to be processed to obtain a corresponding convolution operation result. The electronic device 100 includes at least one register (e.g. Figure 1 The first register 111, the second register 112 and the third register 113 shown in the figure, the selector 120, the cache queue 130 and at least one computing unit (for example Figure 1 Specifically, at least one register divides the data to be processed into a plurality of sub-data according to a preset convolution kernel; stores the plurality of sub-data in a register (e.g. Figure 1The first register 111, the second register 112 and the third register 113 are shown in the figure, wherein each sub-data corresponds to a register; the selector 120 periodically determines the corresponding sub-data from at least one register; and inputs the corresponding sub-data to the cache queue 130. The electronic device 100 also inputs multiple elements of the sub-data from the cache queue 130 to at least one computing unit (e.g. Figure 1 The first computing unit 140, the second computing unit 150 and the third computing unit 160 shown in the figure), wherein each computing unit corresponds to an element; the electronic device 100 also obtains the convolution kernel parameters from multiple computing units (for example Figure 1 The first computing unit 140, the second computing unit 150 and the third computing unit 160 shown in the figure determine the computing unit to be operated; and the convolution operation result is determined according to the elements corresponding to the computing unit to be operated and the parameters of the convolution kernel. Among them, the electronic device can be a DMA device (Direct Memory Access, direct memory access) device, which is a hardware device for directly exchanging data with the system memory through the CPU, which can reduce the burden of the CPU and improve the overall performance of the system.

[0031] like Figure 2 , which is a flow chart of a convolution calculation method provided by an embodiment of the present application. According to different requirements, the order of the steps in the flow chart can be changed, and some steps can be omitted. A convolution calculation method provided by an embodiment of the present application includes the following steps.

[0032] S20, dividing the data to be processed into a plurality of sub-data according to a preset convolution kernel.

[0033] In one embodiment of the present application, the data to be processed can be any data that needs to be subjected to a convolution operation. Exemplarily, the data to be processed can be a grayscale image, each pixel in the grayscale image includes a brightness value (an integer between 0 and 255), and the convolution operation can be used to perform edge detection, blur processing or sharpening processing on the grayscale image; the data to be processed can also be a digital image with color (such as an RGB image), in which each pixel includes three pixel values, representing the values ​​of the three color channels of red, green and blue respectively. Specifically, the convolution can be applied to each color channel separately, and the data of each color channel can be subjected to a convolution operation separately; the data to be processed can also be audio data, which can be one-dimensional time series data, and the convolution operation can be used to achieve audio filtering (such as low-pass filtering, high-pass filtering, band-pass filtering, etc.), echo cancellation, noise reduction and other effects; the data to be processed can also be video data, in which the video data can be a sequence of digital images. Specifically, the convolution operation can be applied to each frame of digital image in the video data. The convolution operation can also process multiple digital images in the video data in the time dimension, so as to realize functions such as video filtering, motion detection, and video stabilization. The data to be processed can also be one-dimensional or multi-dimensional time series data collected by various sensors (such as accelerometers, gyroscopes, temperature sensors, etc.). The convolution operation can be used to perform feature extraction, pattern recognition or filtering processing on the one-dimensional or multi-dimensional time series data. The data to be processed can also be medical image data (such as MRI images or CT scan images, etc.). Medical image data is usually two-dimensional or three-dimensional. Convolution is very critical in medical image processing and is used for image enhancement, lesion detection, tissue segmentation, etc. The data to be processed can also be text data. The convolution operation can be used to perform natural language processing (NLP) on text data, such as text classification, sentiment analysis, etc. Specifically, the text data is converted into a word embedding matrix or other forms of vector representation, and then the convolution operation is applied to extract features.

[0034] In one embodiment of the present application, in order to ensure greater flexibility in processing the data to be processed and thereby improve the efficiency of the convolution operation on the data to be processed, the data to be processed may be divided into a plurality of sub-data according to a preset convolution kernel, wherein each sub-data corresponds to a clock cycle. Subsequently, one of the sub-data may be selected in each clock cycle for convolution operation, thereby ensuring the flexibility of the convolution operation. Among them, the preset convolution kernel may be a convolution kernel for performing convolution operation, which is a matrix with a smaller dimension than the data to be processed, and its size is usually an odd number × an odd number (e.g., 3×3, 5×5, etc.), and is used to divide the data to be processed into sub-data of the same size as the convolution kernel, and then implement the convolution operation according to the parameters in the convolution kernel and the elements in the sub-data. Among them, the clock cycle is the reciprocal of the operating frequency of the electronic device, and is used to characterize the time required for the electronic device to perform a convolution operation. For example, when the operating frequency of the electronic device is 2.4 GHz, it indicates that the electronic device performs 2.4*10 operations per second. 9 convolution operation, the clock cycle is 4.167*10 -10 seconds, indicating that the time required for an electronic device to perform a convolution operation is 4.167*10 -10 Second.

[0035] In one embodiment of the present application, in order to predetermine the data to be processed on which the electronic device is to perform a convolution operation in each clock cycle, and thereby perform real-time adjustments to the data involved in the convolution operation to improve the efficiency of the convolution operation, the data to be processed may be divided into a plurality of sub-data. Specifically, dividing the data to be processed into a plurality of sub-data according to a preset convolution kernel includes: determining the size of the convolution kernel; dividing the data to be processed based on the size and a preset sliding direction to obtain a plurality of sub-data; wherein the size of each sub-data is the same as the size of the convolution kernel, and any two sub-data include different data to be processed.

[0036] In one embodiment of the present application, the data to be processed is divided based on the size and the preset sliding direction to obtain a plurality of sub-data, including: determining the position corresponding to the convolution kernel in the data to be processed according to the preset sliding direction and the size; and determining the data at the position of the data to be processed as sub-data. Exemplarily, when the data to be processed is two-dimensional data and the preset sliding direction is sliding from the leftmost side of the data to be processed to the right, the sliding method is to start from the first dimension of the data to be processed, and determine the data to be processed with the same dimension as the convolution kernel as the first sub-data; determine the data to be processed adjacent to the first sub-data on the right side of the first sub-data and with the same dimension as the convolution kernel as the second sub-data, and so on to determine the remaining sub-data.

[0037] like Figure 3Exemplarily, when the size of the convolution kernel 310 is 3*3, when the data to be processed is a two-dimensional matrix 320, and the size of the data to be processed is 9*9, the first sub-data is determined to be 330, and the second sub-data is determined to be 340.

[0038] In one embodiment of the present application, when the data to be processed is two-dimensional image data, the process of the convolution operation includes: starting from the upper left corner of the image, aligning the convolution kernel with the corresponding area of ​​the same size on the image; multiplying each parameter in the convolution kernel with the element of the corresponding area of ​​the image, and adding all the products, the result obtained is the new pixel value of the central pixel of the area; after completing a convolution operation, the area corresponding to the convolution kernel in the image during the next convolution operation is determined according to the preset step size and sliding direction. The preset step size can be the number of columns of the convolution kernel, or it can be other values. For example, when the preset step size is 1 and the sliding direction is to slide to the right, the area of ​​the image that participates in the previous convolution operation and the same size as the convolution kernel can be moved to the right by one column to determine the area in the image that participates in this convolution operation, and repeat the above calculation process until all areas of the image are traversed; after the above operation, a new image matrix is ​​obtained, which is the result of the convolution operation. Specifically, the parameters of the convolution kernel will affect the result of the convolution operation, and different convolution kernels can be used to achieve different image processing effects. For example, when performing convolution operations, it is necessary to deal with the boundary problem of the image. Common boundary processing methods include padding (such as zero padding, edge padding, etc.) and ignoring the boundary area. Step size setting, the step size is the distance the convolution kernel moves on the image. The larger the step size, the smaller the dimension of the data obtained by the convolution operation, and the smaller the step size, the larger the dimension of the data obtained by the convolution operation.

[0039] like Figure 4 The figure shows a schematic diagram of a convolution operation, wherein 410 is a convolution kernel, wherein K11 to K33 are parameters of the convolution kernel; 420 is data to be processed, wherein A11 to A33 are data that participate in the convolution operation for the first time in the data to be processed; 430 is feature data, wherein B11 is feature data 430 obtained after performing a convolution operation on the data to be processed 420 based on the convolution kernel 410.

[0040] S21, inputting a plurality of the sub-data into a plurality of preset registers, each of the sub-data corresponds to a register.

[0041] In one embodiment of the present application, since the electronic device needs to frequently access the data to be processed during the convolution operation, in order to improve the efficiency of the electronic device in accessing the data to be processed, after the data to be processed is divided into multiple sub-data according to the preset convolution kernel, the multiple sub-data can be stored in the register. Among them, the register (Register) is a high-speed storage unit inside the electronic device, which is used to temporarily store information such as data, instructions or addresses. In the process of the central computing unit executing instructions, it is necessary to frequently access and modify data, and the register can be used to quickly access these data, and the response speed of the central computing unit to access the register is faster than the response speed of accessing the memory (RAM), thereby improving the efficiency of the electronic device in data processing or instruction processing.

[0042] In one embodiment of the present application, each register corresponds to a number, which can be used to characterize the order in which the register is accessed by the central processing unit. The smaller the number, the earlier the access time. In order to ensure that the order in which the register is accessed to obtain sub-data is consistent with the order in which the sub-data is determined in the data to be processed according to the convolution kernel, the registers are arranged in order from the smallest number to the smallest, and the sub-data in the data to be processed are extracted from left to right, and the extracted sub-data are input into the register. For specific methods of storing sub-data in registers, please refer to Figure 5 The corresponding flow chart.

[0043] like Figure 6 The figure is a schematic diagram of the preset register. When the sub-data in the data to be processed are sub-data 1, sub-data 2 and sub-data 3 in order according to their positions in the data to be processed, the register 610 is numbered Reg_Group0, and the corresponding sub-data is sub-data 1; the register 620 is numbered Reg_Group1, and the corresponding sub-data is sub-data 2; the register 630 is numbered Reg_Group2, and the corresponding sub-data is sub-data 3.

[0044] In one embodiment of the present application, when convolution operations are performed continuously on multiple sub-data, in order to ensure that all elements in each sub-data can be processed by multiple computing units at the same time when a convolution operation is performed on each sub-data subsequently, the elements in the next sub-data can be input into the computing unit after the convolution operation result corresponding to one sub-data is obtained. In this way, it can be ensured that only elements in one sub-data are calculated at the same time, which can improve the accuracy of the convolution operation.

[0045] S22, inputting the multiple elements included in each of the sub-data from the register to multiple computing units, wherein each of the computing units corresponds to one of the elements.

[0046] In one possible implementation, before the multiple elements included in each sub-data are input into the multiple computing units, the sub-data in the register are stored in the cache queue through a selector according to the time order in which the sub-data are stored in the register and the principle of time from front to back until the sub-data in all the registers are stored in the cache queue, and based on the first-in-first-out rule, the sub-data are extracted from the cache queue and input into the multiple computing units, and after all the elements in the sub-data currently being calculated are processed, the multiple elements in the next sub-data are input into the multiple computing units, so that it can be ensured that only elements in one sub-data are calculated at the same time, which can improve the accuracy of the convolution operation.

[0047] Exemplarily, when determining the sub-data in the data to be processed, when the first determined sub-data is data 1, the second determined sub-data is data 2, and the third determined sub-data is data 3, data 1 is stored in the first register, data 2 is stored in the second register, and data 3 is stored in the third register. In the process of performing the convolution operation, in order to ensure that only one element in the sub-data is operated at the same time, the sub-data in the register can also be input into the cache queue in sequence. For example, it can be determined that the sub-data input into the cache queue are: data 1, data 2, data 3. And because the cache queue is a first-in-first-out queue, the order of outputting the sub-data from the cache queue is: data 1, data 2, data 3.

[0048] In one embodiment of the present application, during the process of performing convolution operation on the processed data, in order to determine whether each sub-data participates in the convolution operation to improve the efficiency of the convolution operation, multiple elements corresponding to the sub-data in the cache queue can be input to multiple computing units according to a preset extraction order. The preset extraction order can be from left to right or clockwise, which is not limited here. For a specific method of inputting multiple elements in the sub-data to multiple computing units, please refer to Figure 7 The corresponding detailed description.

[0049] S23, determining a computing unit to be calculated from the multiple computing units according to the convolution kernel.

[0050] In one embodiment of the present application, when the convolution operation is a dilated convolution, the computing unit to be operated can be determined from the multiple computing units according to the clock cycle and the parameters of the convolution kernel, so as to avoid the waste of computing power caused by the parameters with a value of 0 in the convolution kernel of the dilated convolution participating in the convolution operation. Among them, the dilated convolution is used to increase the receptive field (Receptive Field) in the convolutional neural network, by injecting "holes" (i.e., zero values) into the standard convolution kernel, thereby increasing its actual convolution effect area (i.e., receptive field) while keeping the size of the convolution kernel unchanged. This feature enables the dilated convolution to effectively capture a wider range of image information without increasing the amount of calculation and the number of parameters. Specifically, the implementation process of the dilated convolution includes: the calculation process, setting the dilation rate: the dilation rate is a key parameter in the dilated convolution, which determines how many zero values ​​are inserted between the convolution kernel elements. For example, for a 3x3 convolution kernel, if the dilation rate is 2, zero values ​​can be inserted between the elements of the convolution kernel involved in the convolution operation to form a convolution effect of a larger convolution kernel. When performing a convolution operation, the dilated convolution determines the corresponding area of ​​the same size as the convolution kernel on the input feature map according to the preset step size and sliding direction, and multiplies the convolution kernel with the input feature map elements of the corresponding area and then sums them. However, due to the existence of the dilation rate, only part of the input feature map elements are actually involved in the calculation. Dilated convolution can increase the size of the receptive field, which enables the network to capture a wider range of contextual information. Among them, the calculation of the receptive field of the convolution kernel is related to multiple parameters such as the size of the convolution kernel, stride, padding, and dilation rate.

[0051] like Figure 8 FIG. 8 is a schematic diagram of a dilated convolution operation, where 810 is a dilated convolution kernel for performing a dilated convolution operation, and K11 to K55 are parameters of the dilated convolution kernel. Since the operation strategy of the dilated convolution is to insert a 0 value into every other element in the dilated convolution kernel to increase the size of the receptive field of the convolution kernel, the values ​​of multiple parameters in K11 to K55 are 0. Specifically, Figure 8The elements with values ​​of 0 in the dilated convolution kernel shown include K12, K14, K21 to K25, K32, K34, K41 to K45, K52, and K54; 820 is the data to be processed, among which A11 to A56 are the data participating in the dilated convolution operation for the first and second time in the data to be processed; 830 is the feature data, among which B11 is the feature data obtained after performing the dilated convolution operation on the data to be processed 820 based on the dilated convolution kernel 810. Specifically, when the step size of the convolution operation is the number of columns of the convolution kernel, that is, the step size is 5, the first dilated convolution operation uses the dilated convolution kernel 810 to process elements A11 to A55 in the data to be processed 820 to obtain element B11 in the feature data 830, and then the dilated convolution kernel 810 is horizontally translated along the data to be processed 820 by a distance of 5 pixels, and the dilated convolution kernel 810 is used to process elements A16 to A60 (not shown in the figure) in the data to be processed 820 to obtain feature data 830. Alternatively, when the step size is 1, the first dilated convolution operation uses the dilated convolution kernel 810 to process the elements A11 to A55 in the data to be processed 820 to obtain the element B11 in the feature data 830, determines the distance of the dilated convolution kernel 810 to be horizontally translated by 1 pixel along the data to be processed 820, and uses the dilated convolution kernel 810 to process the elements A12 to A56 in the data to be processed 820 to obtain the element B12 in the feature data 830. In this way, the effect of the dilated convolution kernel 810 performing a sliding window operation on the data to be processed 820 can be achieved.

[0052] Specifically, each time a dilated convolution operation is performed, a 0 value is inserted into every other element in the dilated convolution kernel. Therefore, when the dilated convolution kernel is used to process the data to be processed, the data in the data to be processed that is opposite to the 0 value position in the dilated convolution kernel does not participate in the convolution calculation. Figure 8 As shown, when the first dilated convolution operation is performed, since the elements with values ​​of 0 in the dilated convolution kernel 810 include K12, K14, K21 to K25, K32, K34, K41 to K45, K52, and K54, when the first dilated convolution operation is performed, the elements that do not participate in the convolution operation in the processed data 820 include A12, A14, A21 to A25, A32, A34, A41 to A45, A52, and A54.

[0053] In one embodiment of the present application, in order to determine the correspondence between the elements in the sub-data and the computing units in the subsequent process, and thus determine the order in which the elements in the sub-data participate in the convolution operation in the process of performing the convolution operation on the processed data, the arrangement order of the multiple computing units may be determined first. Fig. 9It is a schematic diagram of a plurality of computing units, wherein a first computing unit 901, a second computing unit 902, a third computing unit (not shown), a fourth computing unit (not shown), a fifth computing unit 905 and a sixth computing unit 906 are connected in series.

[0054] In one embodiment of the present application, the convolution kernel includes at least one parameter, each of the calculation units corresponds to a parameter of the convolution kernel, and the determination of the calculation unit to be calculated from the multiple calculation units according to the convolution kernel includes: traversing the parameters in the convolution kernel according to a preset traversal direction, and traversing the multiple calculation units according to the preset extraction order, the position of each calculation unit in the multiple calculation units is the same as the position of the element corresponding to each calculation unit in each sub-data; during the traversal process, if the current traversed parameter is not the first value, the currently traversed calculation unit is determined as the calculation unit to be calculated; if the current traversed parameter is the first value, it is determined that the currently traversed calculation unit does not participate in the convolution operation. Among them, the preset traversal direction and the preset extraction order direction are the same, which can be from left to right or from top to bottom, and are not limited here. Therefore, the corresponding position of the parameter traversed each time in the convolution kernel is the same as the position of the element corresponding to the calculation unit traversed each time in the sub-data. For example, when the size of the convolution kernel and the size of the sub-data are both 3*3, when the position of the traversed parameter in the convolution kernel is the 2nd row and 1st column, the position of the operation corresponding to the traversed computing unit in the sub-data is also the 2nd row and 1st column.

[0055] The arrangement order of the calculation units is the same as the extraction order of the multiple elements in the extracted sub-data. For example, when the multiple elements extracted from a sub-data according to the preset extraction order are 1, 2, 3, 4, 5, 6 from front to back, if Fig. 9 When the corresponding calculation unit processes the sub-data, the arrangement order of the multiple calculation units is, from front to back, the first calculation unit 901 corresponding to the element 1, the second calculation unit 902 corresponding to the element 2, the third calculation unit (not shown) corresponding to the element 3, the fourth calculation unit (not shown) corresponding to the element 4, the fifth calculation unit 905 corresponding to the element 5, and the sixth calculation unit 906 corresponding to the element 6; for another example, when the multiple elements extracted from a certain sub-data according to the preset extraction order are, from front to back, 6, 5, 4, 3, 2, 1, if the method is adopted Fig. 9When the corresponding calculation unit processes the sub-data, the arrangement order of the multiple calculation units from front to back is the sixth calculation unit 906 whose corresponding element is 6, the fifth calculation unit 905 whose corresponding element is 5, the fourth calculation unit whose corresponding element is 4 (not shown in the figure), the third calculation unit whose corresponding element is 3 (not shown in the figure), the second calculation unit 902 whose corresponding element is 2, and the first calculation unit 901 whose corresponding element is 1.

[0056] For example, the first value may be 0. When there are 25 computing units, each computing unit corresponds to Figure 8 If an element in the hole convolution kernel 810 is found, the convolution kernel parameter corresponding to one of the calculation units may be 0. When the parameter of the convolution kernel corresponding to a certain calculation unit traversed is not 0, it indicates that the sub-data corresponding to the calculation unit participates in the convolution operation, and the calculation unit can be determined to be the calculation unit to be budgeted. Among them, when it is determined that the arrangement order of the parameters in the hole convolution kernel 810 is clockwise, that is, the arrangement order of the parameters is: K11, K12, K13, K14, K15, K25...K55, K54...K51...K33, then the arrangement order of the calculation unit corresponding to each parameter is the same as the arrangement order of the parameters.

[0057] In one embodiment of the present application, when the current parameter corresponding to the traversed computing unit is the first value, it is determined that the sub-data corresponding to the computing unit and the parameters of the convolution kernel do not participate in the convolution operation. Exemplarily, when the parameter corresponding to a traversed computing unit is 0, indicating that the element corresponding to the computing unit does not participate in the convolution operation, the computing unit can be skipped during the convolution operation of the processed data, so that the accuracy of the hole convolution operation on the processed data can be ensured. At the same time, since some computing units are skipped, some elements do not participate in the convolution operation, which can improve the efficiency of the convolution operation.

[0058] S24, using the calculation unit to be calculated, calculating the elements corresponding to the calculation unit to be calculated and the convolution kernel, and determining the convolution operation result of each of the sub-data.

[0059] In one embodiment of the present application, the computing unit to be operated is used to calculate the elements corresponding to the computing unit to be operated and the parameters corresponding to the elements in the convolution kernel, so that the product between the convolution kernel parameters corresponding to each computing unit and the elements can be determined, and the mean of all products is determined to be the feature data obtained after a convolution operation is performed on a sub-data of the data to be processed using the convolution kernel in the current clock cycle (for example, Figure 8 in B11).

[0060] S25, determining the convolution operation result of the data to be processed based on the convolution operation result corresponding to each of the multiple sub-data.

[0061] In one embodiment of the present application, after determining the convolution operation result corresponding to each sub-data, the operation result corresponding to each sub-data is arranged according to the position of the sub-data in the data to be processed, and the operation result corresponding to the data to be processed is obtained. For example, Figure 4 As shown, the convolution operation result corresponding to the data to be processed 420 is feature data 430; Figure 8 As shown, the convolution operation result corresponding to the data to be processed 820 is feature data 830.

[0062] It can be seen from the above technical scheme that the embodiment of the present application divides the data to be processed into multiple sub-data, and stores each sub-data in the corresponding preset register respectively, so that different parts of the data to be processed can be stored in slices, thereby improving the efficiency of the electronic device to read or modify the data to be processed, and each time a convolution operation can be performed on a certain part of the data to be processed, thereby improving the efficiency of the convolution operation. Then, the multiple elements included in each of the sub-data are input from the register to multiple computing units, and the computing unit to be calculated is determined from the multiple computing units according to the convolution kernel, and the computing unit to be calculated is used to calculate its corresponding elements and convolution kernel to obtain the convolution operation result of each sub-data. In this way, the elements that do not participate in the convolution operation in the data to be processed and the parameters that do not participate in the convolution operation in the convolution kernel can be screened out during the convolution operation, so as to avoid all parameters and elements from participating in the convolution operation, thereby ensuring the accuracy of the convolution operation while improving the efficiency of the convolution operation.

[0063] like Figure 5 , is a flow chart of a method for storing sub-data to a register provided in an embodiment of the present application. According to different requirements, the order of the steps in the flow chart can be changed, and some steps can be omitted. The method for storing sub-data to a register provided in an embodiment of the present application includes the following steps.

[0064] S50, traverse a plurality of preset registers, and determine the serial numbers of the traversed registers.

[0065] In an embodiment of the present application, each register corresponds to a number, which is used to represent the identity of the corresponding register, and the number can also be used to represent the degree to which the data in the register is preferentially calculated during the convolution operation. Figure 6As shown, the registers may be numbered Reg_Group0, Reg_Group1, and Reg_Group2, wherein the data to be processed stored in the register numbered Reg_Group0 is calculated first, followed by the data to be processed stored in the register numbered Reg_Group1, and then the data to be processed stored in the register numbered Reg_Group2.

[0066] S51, determining the serial number corresponding to each sub-data according to the position of the sub-data in the data to be processed.

[0067] In one embodiment of the present application, the position of the sub-data in the data to be processed is used to represent the order in which the sub-data are generated. Figure 3 As shown in FIG. 1 , the time when the first sub-data 330 is generated is earlier than the time when the second sub-data 340 is generated, which indicates that the first sub-data 330 is located earlier than the second sub-data 340. The position of the sub-data in the data to be processed is also used to characterize the degree to which the sub-data is preferentially processed when participating in the convolution operation. Therefore, the corresponding number can be determined according to the position of the sub-data in the data to be processed. Among them, the number can also be used to characterize the priority of the sub-data being processed.

[0068] Exemplarily, when the position of the sub-data in the data to be processed is closer to the starting position of the convolution operation on the data to be processed, it indicates that the sub-data is given a higher degree of priority when participating in the convolution operation; when the position of the sub-data in the data to be processed is farther from the starting position of the convolution operation on the data to be processed, it indicates that the sub-data is given a lower degree of priority when participating in the convolution operation.

[0069] like Figure 3 As shown, since the first sub-data 330 is generated earlier than the second sub-data 340, the first sub-data 330 is prioritized when participating in the convolution operation than the second sub-data 340.

[0070] S52, storing the sub-data into a register corresponding to the number.

[0071] In one embodiment of the present application, after determining the correspondence between the sub-data and the register number, the sub-data can be stored in the register corresponding to the associated number. This can ensure that the data to be processed is stored in the register, which can improve the efficiency of the electronic device in reading or modifying the data to be processed, thereby improving the efficiency of the convolution operation on the data to be processed.

[0072] like Figure 7, is a flow chart of a method for inputting sub-data to a computing unit provided in an embodiment of the present application. According to different requirements, the order of the steps in the flow chart can be changed, and some steps can be omitted. The method for inputting sub-data to a computing unit provided in an embodiment of the present application includes the following steps.

[0073] S70, extracting elements from each of the sub-data according to a preset extraction order.

[0074] In an embodiment of the present application, after determining the elements contained in each sub-data, each element in the sub-data can be traversed according to a preset extraction order, and the traversed elements can be extracted. The preset extraction order can be any order. For example, when the preset extraction order is clockwise, from Figure 4 The order of extracting elements from the sub-data shown is A11, A12, A13, A23, A33, A32, A31, A21 and A22; when the preset extraction order is from left to right for each row, Figure 4 The order of extracting elements in the sub-data shown is A11, A12, A13, A21, A22, A23, A31, A32, A33.

[0075] For example, Figure 4 As shown, the element corresponding to the parameter K11 of the convolution kernel 410 is A11 in the data to be processed 420, the element corresponding to the parameter K12 of the convolution kernel 410 is A12 in the data to be processed 420, the element corresponding to the parameter K13 of the convolution kernel 410 is A13 in the data to be processed 420, the element corresponding to the parameter K21 of the convolution kernel 410 is A21 in the data to be processed 420, the element corresponding to the parameter K22 of the convolution kernel 410 is A22 in the data to be processed 420, the element corresponding to the parameter K23 of the convolution kernel 410 is A23 in the data to be processed 420, the element corresponding to the parameter K31 of the convolution kernel 410 is A31 in the data to be processed 420, the element corresponding to the parameter K32 of the convolution kernel 410 is A32 in the data to be processed 420, and the element corresponding to the parameter K33 of the convolution kernel 410 is A33 in the data to be processed 420.

[0076] S71, inputting the extracted elements into the calculation unit until all elements in the sub-data are input into the calculation unit.

[0077] In one embodiment of the present application, after a plurality of elements are input into the computing unit according to the arrangement order of the computing unit, the computing units can be arranged according to the positions of the elements corresponding to the computing units in the sub-data. Since each computing unit corresponds to one element, and each computing unit corresponds to one parameter of the convolution kernel. In this way, it can be ensured that the corresponding position of the parameter corresponding to the computing unit in the convolution kernel is the same as the position of the element corresponding to the computing unit in the sub-data, so that it can be determined whether the elements in the computing unit participate in the convolution operation according to the parameters of the convolution kernel, thereby improving the efficiency of the convolution operation.

[0078] See also Fig.10 , Fig.10 1 is a functional module diagram of a convolution computing device provided in one embodiment of the present application. The convolution computing device 101 includes a partitioning module 1010, a cache module 1011 and an operation module 1012. The module / unit referred to in the present application refers to a series of computer-readable instruction segments that can be executed by the processor 13 and can complete fixed functions, which are stored in the memory 12. In this embodiment, the functions of each module / unit will be described in detail in subsequent embodiments.

[0079] The division module 1010 is used to divide the data to be processed into a plurality of sub-data according to a preset convolution kernel;

[0080] The cache module 1011 is used to input the plurality of sub-data into a plurality of preset registers, each of the sub-data corresponds to a register;

[0081] The cache module 1011 is further used to input the multiple elements included in each of the sub-data from the register to multiple computing units, wherein each of the computing units corresponds to one of the elements;

[0082] A computing module 1012, configured to determine a computing unit to be computed from the plurality of computing units according to the convolution kernel;

[0083] The operation module 1012 is further used to use the calculation unit to be calculated to calculate the elements corresponding to the calculation unit to be calculated and the convolution kernel to determine the convolution operation result of each sub-data;

[0084] The operation module 1012 is further used to determine the convolution operation result of the data to be processed based on the convolution operation result corresponding to each of the sub-data in the multiple sub-data.

[0085] The division module 1010 divides the data to be processed into multiple sub-data according to a preset convolution kernel, including: determining the size of the convolution kernel; dividing the data to be processed based on the size and a preset sliding direction to obtain multiple sub-data; wherein the size of each sub-data is the same as the size of the convolution kernel, and any two sub-data include different data to be processed.

[0086] The cache module 1011 inputs the multiple elements included in each of the sub-data from the cache to multiple computing units, including: extracting elements from each of the sub-data according to a preset extraction order, and inputting the extracted elements into the computing unit until all the elements in each of the sub-data are input into the computing unit.

[0087] See also Fig.11 , is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. The electronic device 100 includes a memory 12 and a processor 13. The memory 12 is used to store computer-readable instructions, and the processor 13 is used to execute the computer-readable instructions stored in the memory to implement a convolution calculation method described in any of the above embodiments.

[0088] In an embodiment of the present application, the electronic device 100 further includes a bus, and a computer program stored in the memory 12 and executable on the processor 13, such as a convolution calculation program.

[0089] Fig.11 Only the electronic device 100 having the memory 12 and the processor 13 is shown, and those skilled in the art can understand that Fig.11 The structure shown does not constitute a limitation on the electronic device 100 , and the electronic device 100 may include fewer or more components than shown in the figure, or combine some components, or arrange the components differently.

[0090] Combination Figure 2 , the memory 12 in the electronic device 100 stores multiple computer-readable instructions to implement a convolution calculation method, and the processor 13 can execute the multiple instructions to achieve: dividing the data to be processed into multiple sub-data according to a preset convolution kernel; inputting multiple sub-data into multiple preset registers, each sub-data corresponds to a register; inputting multiple elements included in each sub-data from the register to multiple computing units, wherein each computing unit corresponds to an element; determining the computing unit to be operated from the multiple computing units according to the convolution kernel; using the computing unit to be operated, calculating the elements corresponding to the computing unit to be operated and the convolution kernel, and determining the convolution operation result of each sub-data; determining the convolution operation result of the data to be processed based on the convolution operation result corresponding to each sub-data in the multiple sub-data.

[0091] Specifically, the specific implementation method of the processor 13 for the above instructions can refer to Figure 2 The description of the relevant steps in the corresponding embodiments will not be repeated here.

[0092] Those skilled in the art will appreciate that the schematic diagram is merely an example of the electronic device 100 and does not constitute a limitation on the electronic device 100. The electronic device 100 may be a bus-type structure or a star-type structure. The electronic device 100 may also include more or less other hardware or software than shown in the diagram, or a different arrangement of components. For example, the electronic device 100 may also include input and output devices, network access devices, etc.

[0093] It should be noted that the electronic device 100 is only an example, and other existing or future electronic products that are suitable for the present application should also be included in the protection scope of the present application and included here by reference.

[0094] Among them, the memory 12 includes at least one type of readable storage medium, and the readable storage medium can be non-volatile or volatile. The readable storage medium includes flash memory, mobile hard disk, multimedia card, card-type memory (for example: SD or DX memory, etc.), magnetic memory, disk, optical disk, etc. In some embodiments, the memory 12 can be an internal storage unit of the electronic device 100, such as a mobile hard disk of the electronic device 100. In other embodiments, the memory 12 can also be an external storage device of the electronic device 100, such as a plug-in mobile hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the electronic device 100. The memory 12 can not only be used to store application software and various types of data installed in the electronic device 100, such as a code of a convolution calculation program, etc., but also can be used to temporarily store data that has been output or is to be output.

[0095] In some embodiments, the processor 13 may be composed of an integrated circuit, for example, a single packaged integrated circuit, or a plurality of packaged integrated circuits with the same or different functions, including one or more central processing units (CPUs), microprocessors, digital processing chips, graphics processors, and combinations of various control chips. The processor 13 is the control core (Control Unit) of the electronic device 100, and uses various interfaces and lines to connect various components of the entire electronic device 100, and executes or executes programs or modules stored in the memory 12 (for example, executes a convolution calculation program, etc.), and calls data stored in the memory 12 to execute various functions of the electronic device 100 and process data.

[0096] The processor 13 executes the operating system of the electronic device 100 and various installed applications. The processor 13 executes the application to implement the steps in each of the above-mentioned convolution calculation method embodiments, for example Figure 2 Steps shown.

[0097] Exemplarily, the computer program may be divided into one or more modules / units, which are stored in the memory 12 and executed by the processor 13 to complete the present application. The one or more modules / units may be a series of computer-readable instruction segments capable of completing specific functions, which are used to describe the execution process of the computer program in the electronic device 100. For example, the computer program may be divided into a partitioning module 1010, a cache module 1011, and a computing module 1012.

[0098] The above-mentioned integrated unit implemented in the form of a software function module can be stored in a computer-readable storage medium. The above-mentioned software function module is stored in a storage medium, including a number of instructions for enabling a computer device (which can be a personal computer, a computer device, or a network device, etc.) or a processor to execute a part of a convolution calculation method described in each embodiment of the present application.

[0099] If the module / unit integrated in the electronic device 100 is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, and can also instruct the relevant hardware devices to complete through a computer program. The computer program can be stored in a computer-readable storage medium, and when the computer program is executed by the processor, the steps of each of the above-mentioned method embodiments can be implemented.

[0100] The computer program includes computer program code, which may be in source code form, object code form, executable file or some intermediate form, etc. The computer readable medium may include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory and other memory, etc.

[0101] Furthermore, the computer-readable storage medium may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function, etc.; the data storage area may store data created according to the use of the blockchain node, etc.

[0102] The bus can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. The bus can be divided into an address bus, a data bus, a control bus, etc. Fig.11 Only one arrow is used in the figure, but it does not mean that there is only one bus or one type of bus. The bus is configured to realize the connection and communication between the memory 12 and at least one processor 13, etc.

[0103] An embodiment of the present application also provides a computer-readable storage medium (not shown), in which computer-readable storage medium is stored computer-readable instructions, and the computer-readable instructions are executed by a processor in an electronic device to implement a convolution calculation method described in any of the above embodiments.

[0104] In the several embodiments provided in this application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only illustrative, for example, the division of the modules is only a logical function division, and there may be other division methods in actual implementation.

[0105] The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0106] In addition, each functional module in each embodiment of the present application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The above integrated unit can be implemented in the form of hardware or in the form of hardware plus software functional modules.

[0107] In addition, it is obvious that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. Multiple units or devices stated in the specification can also be implemented by one unit or device through software or hardware. The words first, second, etc. are used to indicate names, and do not indicate any specific order.

[0108] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present application and are not intended to limit it. Although the present application has been described in detail with reference to the preferred embodiments, a person of ordinary skill in the art should understand that the technical solution of the present application may be modified or replaced by equivalents without departing from the spirit and scope of the technical solution of the present application.

Claims

1. A convolution calculation method, applied to electronic equipment, characterized in that: The method comprises: Divide the data to be processed into multiple sub-data according to the preset convolution kernel; Inputting a plurality of the sub-data into a plurality of preset registers, each of the sub-data corresponds to a register; Inputting a plurality of elements included in each of the sub-data from the register to a plurality of computing units, wherein each of the computing units corresponds to one of the elements; Determining a computing unit to be operated from the multiple computing units according to the convolution kernel; Using the calculation unit to be calculated, calculating the elements corresponding to the calculation unit to be calculated and the convolution kernel, and determining the convolution operation result of each of the sub-data; Based on the convolution operation result corresponding to each of the multiple sub-data, the convolution operation result of the data to be processed is determined.

2. The convolution calculation method according to claim 1, characterized in that: The method of dividing the data to be processed into a plurality of sub-data according to a preset convolution kernel includes: Determining the size of the convolution kernel; The data to be processed is divided based on the size and the preset sliding direction to obtain a plurality of sub-data; wherein the size of each sub-data is the same as the size of the convolution kernel.

3. The convolution calculation method according to claim 1, characterized in that: The step of inputting the plurality of elements included in each of the sub-data from the register to the plurality of computing units comprises: Elements are extracted from each of the sub-data according to a preset extraction order, and the extracted elements are input into the calculation unit until all elements in each of the sub-data are input into the calculation unit.

4. The convolution calculation method according to any one of claims 1 to 3, characterized in that: The convolution kernel includes at least one parameter; and determining the computing unit to be operated from the plurality of computing units according to the convolution kernel includes: Traversing the parameters in the convolution kernel according to a preset traversal direction, and traversing the plurality of computing units according to the preset extraction order, wherein the position of each computing unit in the plurality of computing units is the same as the position of the element corresponding to each computing unit in each of the sub-data; During the traversal process, when the current parameter traversed is not the first value, the currently traversed computing unit is determined as the computing unit to be calculated; When the currently traversed parameter is the first value, it is determined that the currently traversed computing unit does not participate in the convolution operation.

5. The convolution calculation method according to any one of claims 1 to 3, characterized in that: The method further comprises: After dividing the data to be processed into a plurality of sub-data according to a preset convolution kernel, traverse a plurality of preset registers to determine the numbers of the traversed registers; Determine the serial number corresponding to each sub-data according to the position of the sub-data in the data to be processed; The sub-data is stored in the register corresponding to the number.

6. A convolution computing device, characterized in that: The device comprises a module for implementing the convolution calculation method according to any one of claims 1 to 5, and the device comprises: A division module, used for dividing the data to be processed into a plurality of sub-data according to a preset convolution kernel; A cache module, used for inputting a plurality of the sub-data into a plurality of preset registers, each of the sub-data corresponds to a register; The cache module is further used to input the multiple elements included in each of the sub-data from the register to the multiple computing units, wherein each of the computing units corresponds to one of the elements; A computing module, used for determining a computing unit to be computed from the plurality of computing units according to the convolution kernel; The operation module is further used to use the calculation unit to be calculated to calculate the elements corresponding to the calculation unit to be calculated and the convolution kernel to determine the convolution operation result of each sub-data; The operation module is further used to determine the convolution operation result of the data to be processed based on the convolution operation result corresponding to each of the sub-data in the multiple sub-data.

7. The convolution computing device according to claim 6, wherein: The division module divides the data to be processed into multiple sub-data according to a preset convolution kernel, including: determining the size of the convolution kernel; dividing the data to be processed based on the size and a preset sliding direction to obtain multiple sub-data; wherein the size of each sub-data is the same as the size of the convolution kernel.

8. The convolution computing device according to claim 6, wherein: The cache module inputs multiple elements included in each of the sub-data from the register to multiple computing units, including: extracting elements from each of the sub-data according to a preset extraction order, and inputting the extracted elements into the computing units until all elements in each of the sub-data are input into the computing units.

9. An electronic device, characterized in that: The electronic device includes a processor and a memory, and the processor is used to implement the convolution calculation method as described in any one of claims 1 to 5 when executing a computer program stored in the memory.

10. A computer storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the convolution calculation method according to any one of claims 1 to 5 is implemented.

Citation Information

Cited By

  • Computing system for operating convolutional neural network, input data acquisition method of convolutional neural network and medium

    CN119990193A