A data processing method, controller and readable storage medium
By using a row buffer to cache the target row data of the data matrix in the controller of the data processing system, and processing the data corresponding to the predesign calculation window in the calculation module, the problem of repeated data reading in POOL operations is solved, and the operation efficiency is improved.
Patent Information
- Application Number
- CN202111185865.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-10-11
- Publication Date
- 2025-04-15
- Estimated Expiration
- 2041-10-11
AI Technical Summary
During POOL operations, duplicate data needs to be read from memory repeatedly, resulting in inefficient operation.
By using a row buffer in the controller of the data processing system to cache the target row data of the data matrix, and processing the data corresponding to the predesign calculation window in the calculation module, the reading of duplicate data is reduced.
The effect of reading data at one time is achieved, reducing operation time and improving the efficiency of POOL operation.
Smart Images

Figure CN114090231B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing technology, and in particular to a data processing method, a controller and a readable storage medium. Background Art
[0002] The POOL algorithm is a commonly used algorithm in neural network calculations, which reduces the number of output feature vectors by downsampling.
[0003] In the related art, the common operation of the POOL algorithm in the neural network is to move the calculation window and continuously read data from the calculation window to perform MAX POOL (the maximum value of the data in the calculation window) or Average POOL (the average value of the data in the calculation window). However, the calculation windows at different positions will use a large amount of repeated data, and these repeated data will be repeatedly read from the memory, consuming a lot of operation time, thus reducing the efficiency of the POOL operation.
[0004] The above contents are only used to assist in understanding the technical solution of the present invention and do not constitute an admission that the above contents are prior art. Summary of the invention
[0005] The main purpose of the present invention is to provide a data processing method, a controller and a readable storage medium, aiming to solve the technical problem that POOL operation needs to repeatedly read repeated data from the memory, and to improve the efficiency of POOL operation.
[0006] To achieve the above object, the present invention provides a data processing method, which is applied to a controller of a data processing system, wherein the controller is used to control a row buffer of the data processing system to cache data, and to control the row buffer to output data to a first computing module of the data processing system, wherein the data processing method comprises:
[0007] Acquire row data corresponding to a target row of a data matrix, and save the acquired row data into the row buffer, wherein each row buffer stores row data corresponding to a target row, and the target row is a data row associated with a preset calculation window;
[0008] Controlling the row buffer to output the first sub-data corresponding to the preset calculation window to the calculation module;
[0009] Acquire second sub-data corresponding to the preset calculation window from the data matrix, and input the second sub-data into the calculation module, wherein the data corresponding to the preset calculation window includes the first sub-data and the second sub-data;
[0010] The calculation result corresponding to the data in the preset calculation window is determined by the calculation module.
[0011] Optionally, the data processing method further includes:
[0012] When the preset calculation window moves, a first step length of the horizontal movement of the preset calculation window and a second step length of the vertical movement of the preset calculation window are obtained.
[0013] Determine the calculation range of the calculation module according to the first step length and the second step length;
[0014] The data row to be updated is determined according to the calculation range update, and the data stored in the row buffer is updated according to the data corresponding to the data row to be updated.
[0015] Optionally, the data processing method further includes:
[0016] The first sub-data is row data except the last row in the row data corresponding to the preset calculation window, and the second sub-data is row data of the last row in the row data corresponding to the preset calculation window.
[0017] Optionally, the data processing method further includes:
[0018] Controlling the first row buffer to store the first target row data of the data matrix;
[0019] It is determined whether the second target row data is the row data of the last row in the row where the preset calculation window is located, wherein the second target row data is the row data corresponding to the next row of the row corresponding to the first target row data.
[0020] Optionally, the data processing method further includes:
[0021] If the second target row data is not the row data of the last row, the first row buffer is controlled to store the second target row data, and the first row buffer outputs the first target row data to the second row buffer, and the second row buffer is controlled to store the first target row data output by the first row buffer;
[0022] If the second target row data is the row data of the last row, the step of controlling the row buffer to output the first sub-data corresponding to the preset calculation window to the calculation module is performed.
[0023] Optionally, the data processing method further includes:
[0024] The calculation module includes a first calculation module and a second calculation module, and the step of determining the calculation result corresponding to the data in the preset calculation window by the calculation module includes:
[0025] The calculation module includes a first calculation module and a second calculation module, and the step of determining the calculation result corresponding to the data in the preset calculation window by the calculation module includes:
[0026] Controlling the first calculation module to receive the first sub-data and the second sub-data, and process them according to a first preset calculation mode to obtain a first calculation result;
[0027] The first calculation result is output to the second calculation module and processed according to a second preset calculation mode to obtain a second calculation result.
[0028] Optionally, the data processing method further includes:
[0029] The calculation module calculates the maximum value or average value of the data in the preset window.
[0030] In addition, to achieve the above-mentioned purpose, the present invention also provides a controller of a data processing system, the controller comprising: a memory, a processor, and a data processing program stored in the memory and executable on the processor, and the data processing program implements the steps of the data processing method as described above when executed by the processor.
[0031] In addition, to achieve the above-mentioned purpose, the present invention also provides a computer-readable storage medium, on which a data processing program is stored, and when the data processing program is executed by a processor, the steps of the data processing method as described above are implemented.
[0032] A data processing method, a controller and a readable storage medium proposed in an embodiment of the present invention, wherein the data processing method is applied to the controller of a data processing system, firstly obtaining row data corresponding to a target row of a data matrix, and saving the obtained row data to the row buffer, wherein each row buffer saves row data corresponding to a target row, and the target row is any row except the last row in the row where the preset calculation window is located; controlling the row buffer to output the saved row data to the calculation module; obtaining the row data corresponding to the last row in the row where the preset calculation window is located from the data matrix and inputting it into the calculation module. Since the row buffer of the data processing system is controlled to cache data, and is used to control the row buffer to output data to the calculation module of the data processing system, the technical effect of one-time data reading is achieved. Compared with the traditional POOL operation, the data processing method proposed in the embodiment of the present invention does not need to repeatedly read repeated data, thereby reducing a large amount of operation time and improving the efficiency of POOL operation. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] Figure 1It is a schematic diagram of the terminal structure of the hardware operating environment involved in the embodiment of the present invention;
[0034] Figure 2 A schematic diagram of a flow chart of an embodiment of a data processing method of the present invention;
[0035] Figure 3 This is a first schematic diagram of an application scenario of an embodiment of a data processing method of the present invention;
[0036] Figure 4 This is a second schematic diagram of an application scenario of an embodiment of a data processing method of the present invention;
[0037] Figure 5 FIG. 4 is a flow chart of another embodiment of the data processing method of the present invention.
[0038] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0039] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.
[0040] like Figure 1 As shown, Figure 1 It is a schematic diagram of the controller structure of the hardware operating environment involved in the embodiment of the present invention.
[0041] like Figure 1 As shown, the controller may include: a processor 1001, such as a CPU, a memory 1005, and a communication bus 1002. The communication bus 1002 is used to realize the connection and communication between these components. The memory 1005 may be a high-speed RAM memory or a stable memory (non-volatile memory), such as a disk memory. The memory 1005 may also be a storage device independent of the aforementioned processor 1001.
[0042] Those skilled in the art will understand that Figure 1 The controller structure shown in the figure does not constitute a limitation of the controller, and may include more or less components than shown in the figure, or combine certain components, or arrange the components differently.
[0043] exist Figure 1 In the terminal shown, the processor 1001 can be used to call the data processing program stored in the memory 1005 and perform the following operations:
[0044] Acquire row data corresponding to a target row of a data matrix, and save the acquired row data into the row buffer, wherein each row buffer stores row data corresponding to a target row, and the target row is a data row associated with a preset calculation window;
[0045] Controlling the row buffer to output the first sub-data corresponding to the preset calculation window to the calculation module;
[0046] Acquire second sub-data corresponding to the preset calculation window from the data matrix, and input the second sub-data into the calculation module, wherein the data corresponding to the preset calculation window includes the first sub-data and the second sub-data;
[0047] The calculation result corresponding to the data in the preset calculation window is determined by the calculation module.
[0048] Further, the processor 1001 may call the data processing program stored in the memory 1005, and further perform the following operations:
[0049] When the preset calculation window moves, a first step length of the horizontal movement of the preset calculation window and a second step length of the vertical movement of the preset calculation window are obtained.
[0050] Determine the calculation range of the calculation module according to the first step length and the second step length;
[0051] The data row to be updated is determined according to the calculation range update, and the data stored in the row buffer is updated according to the data corresponding to the data row to be updated.
[0052] Further, the processor 1001 may call the data processing program stored in the memory 1005, and further perform the following operations:
[0053] The first sub-data is row data except the last row in the row data corresponding to the preset calculation window, and the second sub-data is row data of the last row in the row data corresponding to the preset calculation window.
[0054] Further, the processor 1001 may call the data processing program stored in the memory 1005, and further perform the following operations:
[0055] Controlling the first row buffer to store the first target row data of the data matrix;
[0056] It is determined whether the second target row data is the row data of the last row in the row where the preset calculation window is located, wherein the second target row data is the row data corresponding to the next row of the row corresponding to the first target row data.
[0057] Further, the processor 1001 may call the data processing program stored in the memory 1005, and further perform the following operations:
[0058] If the second target row data is not the row data of the last row, the first row buffer is controlled to store the second target row data, and the first row buffer outputs the first target row data to the second row buffer, and the second row buffer is controlled to store the first target row data output by the first row buffer;
[0059] If the second target row data is the row data of the last row, the step of controlling the row buffer to output the first sub-data corresponding to the preset calculation window to the calculation module is performed.
[0060] Further, the processor 1001 may call the data processing program stored in the memory 1005, and further perform the following operations:
[0061] The calculation module includes a first calculation module and a second calculation module, and the step of determining the calculation result corresponding to the data in the preset calculation window by the calculation module includes:
[0062] Controlling the first calculation module to receive the first sub-data and the second sub-data, and process them according to a first preset calculation mode to obtain a first calculation result;
[0063] The first calculation result is output to the second calculation module and processed according to a second preset calculation mode to obtain a second calculation result.
[0064] Further, the processor 1001 may call the data processing program stored in the memory 1005, and further perform the following operations:
[0065] The calculation module calculates the maximum value or average value of the data in the preset window.
[0066] The POOL algorithm is a commonly used algorithm in neural network calculations, which reduces the number of output feature vectors by downsampling.
[0067] In the related art, the common operation of the POOL algorithm in a neural network is to move the calculation window and continuously read data from the calculation window for calculation. However, calculation windows at different positions will use a large amount of repeated data, and these repeated data will be repeatedly read from the memory, consuming a lot of operation time, thus reducing the efficiency of the POOL operation.
[0068] In order to reduce the operation time and improve the efficiency of POOL operation, the embodiment of the present invention provides a data processing method, a controller and a readable storage medium, wherein the main steps of the method include:
[0069] Acquire row data corresponding to a target row of a data matrix, and save the acquired row data into the row buffer, wherein each row buffer stores row data corresponding to a target row, and the target row is a data row associated with a preset calculation window;
[0070] Controlling the row buffer to output the first sub-data corresponding to the preset calculation window to the calculation module;
[0071] Acquire second sub-data corresponding to the preset calculation window from the data matrix, and input the second sub-data into the calculation module, wherein the data corresponding to the preset calculation window includes the first sub-data and the second sub-data;
[0072] The calculation result corresponding to the data in the preset calculation window is determined by the calculation module.
[0073] In this way, by saving the row data of the data matrix into the row buffer and then outputting it to the calculation module through the row buffer, the effect of reading the data at one time is achieved. Therefore, based on the solution given in the above embodiment, the time for reading data can be reduced and the efficiency of the POOL operation can be improved.
[0074] The following is an explanation of the content claimed in the claims of the present invention through specific exemplary schemes, so that those skilled in the art can better understand the scope of protection of the claims of the present invention. It is understood that the following exemplary schemes do not limit the scope of protection of the present invention, but are only used to explain the present invention.
[0075] For example, refer to Figure 2 In one embodiment of the data processing method of the present invention, the data processing method comprises the following steps:
[0076] Step S10, obtaining row data corresponding to a target row of the data matrix, and saving the obtained row data to the row buffer, wherein each row buffer stores row data corresponding to one target row, and the target row is a data row associated with a preset calculation window;
[0077] In this embodiment, the data matrix is an M*N matrix composed of several elements, which may be numbers or feature vectors from image recognition. The number of data in each row of the matrix is equal, and the number of data in each column is equal.
[0078] Optionally, the row buffer corresponds to a target row, so there is at least one row buffer. When saving row data of the corresponding row, the row data can be saved from left to right, or from right to left, or the row data can be saved correspondingly in column sorting.
[0079] Specifically, the line buffer can be a number of pre-instantiated line buffers for data storage, or it can be directly instantiated according to the preset calculation window. The number of line buffers is related to the number of rows (KH) of the preset calculation window, and the depth of the line buffer is related to the width (W) of the data matrix. The line buffer is implemented using FIFO, which is a first-in-first-out memory, that is, the first data in comes out first. There is data in the FIFO that can be read, and the FIFO can be written if it is not full. In this way, it can be ensured that the data in the calculation window that needs to be processed first can be saved and output first, so that it can be processed first.
[0080] Optionally, the preset calculation window may be a default width and height of the system, or may be a preset calculation window set by the user through a user interface according to needs before performing a data processing operation.
[0081] Step S20, controlling the line buffer to output the first sub-data corresponding to the preset calculation window to the calculation module;
[0082] In this embodiment, the controller of the data processing system controls all row buffers to output the saved first sub-data to the computing module, and each row buffer outputs data simultaneously to facilitate the computing module to process the data of the preset computing window simultaneously, thereby improving the efficiency of the computing module in receiving data.
[0083] Optionally, the order of data output by each row buffer should be consistent with the order of data stored during storage, so as to ensure that the data processed first by the calculation module is consistent with the preset processing order.
[0084] Step S30, acquiring second sub-data corresponding to the preset calculation window from the data matrix, and inputting the second sub-data into the calculation module, wherein the data corresponding to the preset calculation window includes the first sub-data and the second sub-data;
[0085] In this embodiment, the data corresponding to the preset calculation window includes first sub-data and second sub-data, wherein the second sub-data may be the data corresponding to the preset calculation window, may be multiple rows of data corresponding to the preset calculation window, may be row data corresponding to one preset calculation window, or may not contain the data corresponding to the preset calculation window. If it does not contain the data corresponding to the preset calculation window, it is not necessary to obtain the second sub-data corresponding to the preset calculation window from the data matrix.
[0086] Optionally, the first sub-data is the row data except the last row in the row where the preset calculation window is located, and the second sub-data is the row data of the last row in the row where the preset calculation window is located. In this way, the number of row buffers required is KH-1, and the depth of the row buffer is W. On the one hand, the smoothness of the channel during data transmission is ensured, and on the other hand, the use of row buffers is reduced to save resources.
[0087] Specifically, controlling the first row buffer to store the first target row data of the data matrix;
[0088] Determine whether the second target row data is the row data of the last row in the row where the preset calculation window is located, wherein the second target row data is the row data corresponding to the next row of the row corresponding to the first target row data. If the second target row data is not the row data of the last row, control the first row buffer to save the second target row data, and at the same time, the first row buffer outputs the first target row data to the second row buffer, and control the second row buffer to save the first target row data output by the first row buffer; if the second target row data is the row data of the last row, execute the step of controlling the row buffer to output the first sub-data calculation module corresponding to the preset calculation window. In this way, the data received by the calculation module in this embodiment comes from the row buffer and the data matrix, which can reduce the time for row data to enter the row buffer and save resources.
[0089] Step S40: determining the calculation result corresponding to the data in the preset calculation window through the calculation module.
[0090] In this embodiment, the calculation module receives the first sub-data output by the row buffer and the second data obtained from the data matrix, and performs data processing on the data to obtain a calculation result. The calculation module calculates the maximum value or the average value of the data in the preset window. The calculation module may include a first calculation module and a second calculation module. The first calculation module is controlled to receive the first sub-data and the second sub-data, and process them according to a preset calculation mode, which may be a maximum value calculation or an accumulated value calculation of the first sub-data to obtain a first calculation result; the first calculation result is output to the second calculation module, and processed according to a preset calculation mode, which may be a maximum value calculation or an average value calculation of the first calculation result to obtain a second calculation result.
[0091] It can be understood that the first sub-data and the second sub-data are input into the calculation module at the same time, which is equivalent to inputting the corresponding column data in the preset window into the calculation module and calculating the column data. The number of calculation results obtained is determined by the width of the preset calculation window.
[0092] It can be understood that the second calculation module processes the calculation results of the first calculation module by grouping the calculations according to the preset calculation windows at different positions, and the number of the second calculation results is related to the number of times the preset calculation windows are moved.
[0093] Reference Figure 3 In the application scenario of the first embodiment, there is a data matrix with a width of 8 and a height of 8, the preset calculation window width is 3, the height is 3, the first moving step in the horizontal direction is 1, and the second moving step in the vertical direction is 1. Figure 3 , the specific operation steps are: obtain the row data corresponding to the target row of the data matrix, that is, the first row and the second row; save the obtained row data to the row buffer, control the row data corresponding to the first row to be stored in Line Buffer0, until the first row data storage is completed, control the first row data to be stored in Line Buffer0, until the first row data storage is completed, and control the row data corresponding to the second row to be stored in Line Buffer0; control Line Buffer0, Line Buffer1 outputs data to the first calculation module at the same time, and inputs row data corresponding to the third row at the same time. After inputting three times, the three columns of data of the preset calculation window at the initial position (data in the solid line frame) are output, and the maximum value calculation processing is performed on them to obtain the maximum value 16 of the first column data, the maximum value 17 of the second column data and the maximum value 18 of the third column data. These three maximum values are the first calculation results corresponding to the preset calculation window at the initial position. The first calculation result is input into the second calculation module, and the maximum value operation is performed on the first calculation result to obtain the second calculation result 18, that is, the maximum value of the data corresponding to the preset calculation window at the initial position. The fourth output obtains the maximum value 19 of the fourth column data. The maximum value 17 of the second column data, the maximum value 18 of the third column data and the maximum value 19 of the fourth column data are the first calculation results corresponding to the preset calculation window after moving. They are input into the second calculation module, and the maximum value operation is performed on the first calculation result to obtain the second calculation result 19, that is, the maximum value of the data corresponding to the preset calculation window after moving (data in the dotted line frame). Compared with the related art, there is no repeated reading of the second column data and the third column data, and the POOL operation efficiency is significantly improved.
[0094] In this embodiment, by acquiring row data corresponding to a target row of a data matrix, and saving the acquired row data to a row buffer, wherein each row buffer saves row data corresponding to a target row, and the target row is a data row associated with a preset calculation window; then controlling the row buffer to output the first sub-data corresponding to the preset calculation window to the first calculation module, acquiring the second sub-data corresponding to the preset calculation window from the data matrix, and inputting the second sub-data into the first calculation module, wherein the data corresponding to the preset calculation window includes the first sub-data and the second sub-data, and the first calculation module processes the data of the preset calculation window and outputs the calculation result, so that when processing the data in the preset calculation window, the row buffer directly outputs and the data matrix directly inputs into the calculation module, and the new data is directly processed, and repeated data does not need to be read repeatedly, and the output calculation result can be directly processed, so that a large amount of operation time is reduced. It is realized that the POOL operation does not need to repeatedly read repeated data corresponding to the preset calculation window, a large amount of operation time is reduced, and the efficiency of the POOL operation is improved.
[0095] Optionally, refer to Figure 5 Based on any of the above embodiments, in another embodiment of the data processing method of the present invention, the data processing method includes:
[0096] Step S50, when the preset calculation window moves, obtaining a first step length of the horizontal movement of the preset calculation window and a second step length of the vertical movement of the preset calculation window;
[0097] In this implementation, the preset calculation window will move horizontally or vertically on the data matrix, and the step size of the movement will not change. The horizontal movement of the preset calculation window is consistent with the direction of the target row, and the vertical movement occurs after the horizontal movement, and then the horizontal movement continues; the horizontal movement direction of the preset window determines the order in which the data is saved in the row buffer to ensure that the output calculation result can correspond to the calculation window.
[0098] Optionally, the first step length and the second step length may be system defaults, or may be settings for moving the preset calculation window by the user through a user interface according to needs before performing the data processing operation.
[0099] Step S60: determining a calculation range of the calculation module according to the first step length and the second step length.
[0100] In this embodiment, the preset calculation window moves horizontally or vertically on the data matrix, referring to Figure 3The preset calculation window (in the dotted box) first moves horizontally from position A to position B, and then moves to position C. Compared with position B, position C moves vertically. When moving horizontally, new column data that needs to be calculated will be generated, and when moving vertically, new row data that needs to be calculated will be generated. The first step length determines the data output from the row buffer to the calculation module and the data matrix input to the calculation module.
[0101] It can be understood that the vertical movement mentioned in this embodiment is the vertical movement of the preset calculation window relative to the previous position, rather than the actual movement route of the preset calculation window, and the second step length is the distance the preset calculation window moves in the vertical direction relative to the previous position.
[0102] When the calculation range is determined by the first step length, it is also necessary to obtain the width of the preset calculation window, and then compare the step length with the width of the preset calculation window; if the step length is greater than the width of the preset calculation window, the calculation range is the data received by the calculation module corresponding to the coverage area when the preset calculation window moves. Each time the preset calculation window moves, it will skip some data. The calculation module does not calculate the data that is not covered by the preset calculation window, which can reduce the time for the calculation module to process data. If the step length is less than or equal to the width of the preset calculation window, the calculation range is the data received by the calculation module corresponding to the coverage area when the preset calculation window moves. When the preset calculation window moves, all the corresponding data are selected and need to be calculated. The calculation module needs to calculate and process all the data.
[0103] In this implementation scheme, the calculation module will calculate the corresponding row data in the preset calculation window. When the preset calculation window is at the initial position, the calculation module will generate the corresponding calculation result at the initial position. Each time the preset calculation window moves, the preset calculation window will correspond to new data. The calculation module only needs to calculate the new data and obtain a new calculation result. The new calculation result can be combined with the calculation result of the previous position of the preset calculation window to obtain the calculation result corresponding to the preset calculation window after moving.
[0104] Step S70: determining the data row to be updated according to the calculation range update, and updating the data stored in the row buffer according to the data corresponding to the data row to be updated.
[0105] In this implementation, the preset calculation window moves horizontally or vertically on the data matrix. When moving horizontally, new column data that needs to be calculated will be generated, and when moving vertically, new row data that needs to be calculated will be generated. The second step size determines the calculation range of the row data input into the calculation module.
[0106] When the preset calculation window moves in the vertical direction, a new calculation range is generated, and a corresponding new data row is generated. The corresponding row of the calculation range is compared with the data row in the row buffer. The data row to be updated is the corresponding row of the calculation range that is not stored in the row buffer. The row data corresponding to the updated data row is obtained from the data matrix, and the row data corresponding to the updated data row is saved in the row buffer. If there is row data that is not stored in the row buffer in the row data corresponding to the preset calculation window after the movement, it is necessary to update the data in the row buffer. The row data required for obtaining the calculation range is determined to determine whether the row data is not stored in the row buffer. If it is not stored in the row buffer, the row data is obtained from the data matrix and stored in the buffer, wherein each row buffer stores one row data.
[0107] Optionally, because each row buffer stores a row of data, each time a new row of data is stored in the row buffer, a row of data stored in the row buffer will flow out. The row of data that flows out is the row of data that was first stored in the row buffer. Synchronously, the next row of data of the row of data that was first stored will be input into the row buffer corresponding to the row of data that was first stored. The whole process is a process of data flow. As long as new row of data is stored in the row buffer, it will cause the flow of data in the row buffer.
[0108] Reference Figure 3 In the application scenario of the first embodiment, there is a data matrix with a width of 8 and a height of 8, the preset calculation window width is 3, the height is 3, the first moving step in the horizontal direction is 1, and the second moving step in the vertical direction is 1. Figure 4 , the specific operation steps are: the preset window moves on the data matrix, and the moving direction is. Due to the horizontal movement of the preset window on the data matrix, a new calculation range is generated, that is, the fourth column of data that needs to be calculated, and the first step length of the horizontal movement of the calculation window is obtained. The calculation range is determined to be the second column of data, the third column of data and the fourth column of data. Since the second column of data and the third column of data have been input into the calculation module and the results are obtained, the row buffer only needs to output the data to the first calculation module once more at the same time to obtain the maximum value 19 of the fourth column of data, and the first calculation results of the second column of data, the third column and the fourth column are input into the second calculation module. The maximum value operation is performed on the first calculation result to obtain the second calculation result 19, that is, the maximum value of the corresponding data of the preset calculation window (in the dotted box) after the movement.
[0109] After the horizontal movement is completed, the preset calculation window moves vertically. Figure 3, the preset calculation window moves from position B to position C, and a new calculation range is generated accordingly, that is, the fourth line of data to be calculated. The data currently stored in line buffer Line Buffer0 is the second line of data, and the data stored in line buffer Line Buffer1 is the first line of data. The third line of data is input into Line Buffer0. Synchronously, the second line of data of Line Buffer0 is input into Line Buffer1, and the original first line of data in Line Buffer1 flows out. The data flows in the line buffer until the third line of data is input and the first line of data flows out. The preset calculation window moves horizontally again, and the moving direction is the same as the previous horizontal movement direction. Line Buffer0 and Line Buffer1 are controlled to output data to the first calculation module at the same time, and the line data corresponding to the fourth line is input into and out of the calculation module at the same time, and a new round of calculation is performed.
[0110] In this embodiment, the preset calculation window moves horizontally or vertically on the data matrix according to a preset step size. When the preset calculation window moves, the first step size of the horizontal movement and the second step size of the vertical movement of the preset calculation window are obtained; the calculation range of the calculation module is determined according to the first step size and the second step size; the data row to be updated is updated according to the calculation range, and the data stored in the row buffer is updated according to the data corresponding to the data row to be updated. The calculation range is determined by obtaining the first step size and the second step size, and the data in the row buffer is updated, thereby reducing unnecessary data reading processes, reducing data processing time, and improving data processing efficiency.
[0111] In addition, an embodiment of the present invention also proposes a controller of a data processing system, the controller comprising: a memory, a processor, and a data processing program stored in the memory and executable on the processor, wherein the data processing program implements the steps of the above-mentioned data processing method when executed by the processor.
[0112] In addition, an embodiment of the present invention further provides a computer-readable storage medium, on which a data processing program is stored. When the data processing program is executed by a processor, the steps of the above-mentioned data processing method are implemented.
[0113] 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 system including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or system. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or system including the element.
[0114] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.
[0115] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) as described above, and includes a number of instructions for a terminal device (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in each embodiment of the present invention.
[0116] The above are only preferred embodiments of the present invention, and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.
Claims
1. A data processing method, characterized in that: A controller applied to a data processing system, the controller is used to control a row buffer of the data processing system to cache data, and is used to control the row buffer to output data to a computing module of the data processing system, the data processing method comprising: Acquire row data corresponding to a target row of a data matrix, and save the acquired row data into the row buffer, wherein each row buffer stores row data corresponding to one target row, the row buffer is implemented based on a FIFO memory, and the target row is a data row associated with a preset calculation window; Control each row buffer to simultaneously output corresponding row data to form first sub-data corresponding to the preset calculation window to the calculation module, wherein the first sub-data is row data except the last row in the row data corresponding to the preset calculation window; Acquire second sub-data corresponding to the preset calculation window from the data matrix, and input the second sub-data into the calculation module, wherein the second sub-data is row data of the last row in the row data corresponding to the preset calculation window, and the data corresponding to the preset calculation window includes the first sub-data and the second sub-data; The calculation result corresponding to the data in the preset calculation window is determined by the calculation module.
2. The data processing method according to claim 1, characterized in that: After the step of determining the calculation result corresponding to the data in the preset calculation window by the calculation module, the method further includes: When the preset calculation window moves, obtaining a first step length of the horizontal movement of the preset calculation window and a second step length of the vertical movement of the preset calculation window; Determine the calculation range of the calculation module according to the first step length and the second step length; The data row to be updated is determined according to the calculation range update, and the data stored in the row buffer is updated according to the data corresponding to the data row to be updated.
3. The data processing method according to claim 1, characterized in that: The step of acquiring row data corresponding to a target row of a data matrix and saving the acquired row data into the row buffer comprises: Controlling the first row buffer to store the first target row data of the data matrix; It is determined whether the second target row data is the row data of the last row in the row where the preset calculation window is located, wherein the second target row data is the row data corresponding to the next row of the row corresponding to the first target row data.
4. The data processing method according to claim 3, characterized in that: The step of determining whether the second target row data is the last row of row data in the row where the preset calculation window is located comprises: If the second target row data is not the row data of the last row, the first row buffer is controlled to store the second target row data, and the first row buffer outputs the first target row data to the second row buffer, and the second row buffer is controlled to store the first target row data output by the first row buffer; If the second target row data is the row data of the last row, the step of controlling each row buffer to simultaneously output the corresponding row data to form the first sub-data corresponding to the preset calculation window to the calculation module is performed.
5. The data processing method according to claim 1, characterized in that: The calculation module includes a first calculation module and a second calculation module, and the step of determining the calculation result corresponding to the data in the preset calculation window by the calculation module includes: Controlling the first calculation module to receive the first sub-data and the second sub-data, and process them according to a first preset calculation mode to obtain a first calculation result; The first calculation result is output to the second calculation module and processed according to a second preset calculation mode to obtain a second calculation result.
6. The data processing method according to claim 1, characterized in that: The calculation module calculates the maximum value or average value of the data in a preset window.
7. A controller of a data processing system, characterized in that: The controller includes: a memory, a processor, and a data processing program stored in the memory and executable on the processor, wherein the data processing program implements the steps of the data processing method according to any one of claims 1 to 6 when executed by the processor.
8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a data processing program, and when the data processing program is executed by a processor, the steps of the data processing method according to any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Pooling method, device, and system, computer-readable storage medium
US20190304057A1