WO2021179175A1 - 数据处理的方法、装置及计算机存储介质 - Google Patents

数据处理的方法、装置及计算机存储介质 Download PDF

Info

Publication number
WO2021179175A1
WO2021179175A1 PCT/CN2020/078651 CN2020078651W WO2021179175A1 WO 2021179175 A1 WO2021179175 A1 WO 2021179175A1 CN 2020078651 W CN2020078651 W CN 2020078651W WO 2021179175 A1 WO2021179175 A1 WO 2021179175A1
Authority
WO
WIPO (PCT)
Prior art keywords
value
data
matrix
column
array
Prior art date
Application number
PCT/CN2020/078651
Other languages
English (en)
French (fr)
Inventor
王志伟
Original Assignee
深圳市大疆创新科技有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 深圳市大疆创新科技有限公司 filed Critical 深圳市大疆创新科技有限公司
Priority to PCT/CN2020/078651 priority Critical patent/WO2021179175A1/zh
Priority to CN202080006517.5A priority patent/CN113168432A/zh
Publication of WO2021179175A1 publication Critical patent/WO2021179175A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F17/00Digital computing or data processing equipment or methods, specially adapted for specific functions
    • G06F17/10Complex mathematical operations
    • G06F17/16Matrix or vector computation, e.g. matrix-matrix or matrix-vector multiplication, matrix factorization
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/60Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using transform coding

Definitions

  • the embodiments of the present invention relate to the field of data processing, and more specifically, to a data processing method, device, and computer storage medium.
  • Data processing is involved in various fields such as signal processing and image processing. For example, in the process of image segmentation and recognition, data processing is performed based on the pixel values of the image.
  • the Givens Rotation algorithm is one of the commonly used algorithms for data processing on a matrix formed by data, and it is mainly executed on a digital signal processor (DPS).
  • DPS digital signal processor
  • the current Givens selection algorithm requires a lot of running time when it is running, resulting in poor performance.
  • the embodiment of the present invention provides a data processing method and device, which reduces the complexity of mode selection and improves the processing efficiency.
  • a data processing method including:
  • the data matrix being a matrix of M rows and N columns, and both M and N are positive integers;
  • Givens transformation matrix to perform the Givens transformation on the data matrix, so that at least two values located on the same column of the data matrix are eliminated at the same time;
  • a data processing device which includes a receiving module, a building module, and a processing module.
  • the receiving module is used to receive the measurement data obtained by the sensor
  • the building module is used to construct a data matrix according to the measurement data, the data matrix is a matrix of M rows and N columns, and both M and N are positive integers;
  • the processing module is used to determine the Givens transformation matrix of the data matrix
  • the processing module is also used to perform the Givens transformation on the data matrix by using the Givens transformation matrix, so that at least two values located on the same column of the data matrix are eliminated at the same time;
  • the processing module is also used to process the measurement data according to the Givens transformation matrix.
  • a computer storage medium on which a computer program is stored, and when the computer program is executed by a processor, the steps of the method described in the first aspect are implemented.
  • the data processing method of the embodiment of the present invention when performing data processing on the measurement data collected by the sensor, some elements in the data matrix can be zero-eliminated by Givens rotation. Among them, there is at least one iteration to make at least two elements at the same time.
  • Zero suppression compared to the prior art of performing zero suppression processing element by element, the data processing method of the embodiment of the present invention can greatly reduce the processing amount and improve the processing speed. And in this process, the space occupation of the vector memory is reduced, and the storage of sensor measurement data is ensured.
  • Figure 1 is a schematic diagram of the sequence of "eliminating 0" in Givens algorithm
  • Figure 2 is a schematic diagram of using the Givens rotation matrix to eliminate an element in the input matrix by 0;
  • Fig. 3 is a schematic block diagram of a digital signal processor according to an embodiment of the present invention.
  • Figure 4 (a) and (b) are schematic diagrams showing that the number of rows of the matrix is not greater than the number of columns and the number of rows is greater than the number of columns, respectively;
  • FIG. 5 is a schematic flowchart of data processing according to an embodiment of the present invention.
  • Figure 6 is a schematic diagram of sequential addressing
  • Figure 7 is a schematic diagram of interval addressing
  • Figure 8 is the storage location of the 9 ⁇ 7 data matrix in array 0;
  • FIG. 9 is the stored data in the array 1 after step 2 when the first iterative zero suppression is performed on the first column in FIG. 8;
  • FIG. 10 shows the stored data in the array 2 after step 3 when performing the first iterative zero suppression on the first column in FIG. 8;
  • FIG. 11 is the stored data in the array 3 after step 4 when the first iteration zero suppression is performed on the first column in FIG. 8;
  • FIG. 12 is the stored data in the array 4 after step 5 when the first iteration zero suppression is performed on the first column in FIG. 8;
  • FIG. 13 is the stored data in the array 5 after step 6 when the first iteration zero suppression is performed on the first column in FIG. 8;
  • FIG. 14 is a schematic diagram of the ratio of the clock period occupied by the method of the embodiment of the present invention to the clock period occupied by the conventional technology.
  • the object of processing is digital information.
  • Digital information can be the pixel value of the image, the frequency of the audio and video signal, etc., which can all be expressed in the form of data. Therefore, the processing of images or signals involves the process of data processing.
  • a large amount of data can be expressed in the form of a matrix, that is, a data matrix is constructed.
  • the algorithm performed on the data matrix may include the Givens rotation algorithm. Givens rotation algorithm can simplify the data matrix and convert some of its elements into zeros, referred to as "eliminate 0". When the elements in the data matrix are "eliminated by zeros", it is generally done from bottom to top and from left to right, as shown in Figure 1, so that non-zero values will not be introduced again.
  • the matrix in the middle represents the input matrix, which can be represented as X.
  • the matrix on the left represents the Givens rotation matrix, and the matrix on the right represents the output matrix, which can be expressed as Y.
  • the Givens rotation algorithm is implemented on a digital signal processor (Digital Signal Processor, DSP).
  • DSP Digital Signal Processor
  • the scalar parameters c and s are usually calculated on the Lightweight Reduced Instruction Set Computing (RISC) Central Processing Unit (CPU) in the Digital Signal Processor (DSP) .
  • the rows i and j in the output matrix in Fig. 2 are usually calculated on the Vector Process Unit (VPU).
  • VPU Vector Process Unit
  • FIG. 3 shows a schematic block diagram of a DSP according to an embodiment of the present invention.
  • the digital signal processor includes a reduced instruction set computer central processing unit, a vector processing unit, and a vector memory.
  • the digital signal processor shown in FIG. 3 also includes an accelerator and peripheral devices, and various components in the digital signal processor can be connected via a bus.
  • the vector memory shown in FIG. 3 includes 6 arrays, but the present invention is not limited to this, and specifically may be more or less arrays, such as 2 or 10 arrays. Exemplarily, each array may include 16 single-port random access memories (Random Access Memory, RAM), and the data bit width of the RAM may be 32 bits (bit).
  • RAM Random Access Memory
  • the reduced instruction set computer supports multiplication, addition and In the case of calculation, the arithmetic instructions for calculating c and s need at least 7 clock cycles.
  • the reduced instruction set computer must at least distribute to the vector processing unit 3(M-1+max(MN,1))*min(M-1,N) instructions.
  • the total number of clock cycles occupied on the reduced instruction set computer is at least In the case of considering data movement instructions and program control instructions, the number of clock cycles occupied on a reduced instruction set computer will be much greater than this.
  • FIG. 5 A schematic flowchart of the method is shown in FIG. 5, and the method shown in FIG. 5 may include:
  • S120 Construct a data matrix according to the measurement data, the data matrix is a matrix of M rows and N columns, and both M and N are positive integers;
  • the senor in the embodiment of the present invention may be a camera.
  • the measurement data may be pixels of an image captured by the camera, and correspondingly, the data processing may be data processing on the pixels.
  • the camera may be a digital camera, or the camera may be mounted on other devices, including but not limited to: pan-tilt, mobile phone, handheld computer, wearable device, and so on.
  • S150 may include: decomposing the measurement data into multiple sub-data units; and performing data processing on the multiple sub-data units. In this way, data processing can be performed based on multiple sub-data units, which reduces the amount of data in a single processing and can increase the processing speed.
  • the process of data processing shown in FIG. 5 may include: storing the Givens transformation matrix.
  • the storage space occupied by the Givens transformation matrix is less than the storage space required by the data matrix.
  • the Givens transformation matrix also called the Givens rotation matrix
  • the Givens transformation matrix can be used to "eliminate 0" processing on the data matrix.
  • the data matrix is eliminated column by column in the order from left to right.
  • the order from left to right can be understood as: first zero suppression for the first column, then zero suppression for the second column, ..., and finally for the Nth column. zero.
  • the i-th column of the data matrix zero elimination is completed through P iterations in the order from bottom to top, where the value of i ranges from 1 to N.
  • P is not greater than the number of all elements to be nullified in the i-th column.
  • the sum of all iteration times of all columns is less than the number of all elements to be eliminated in the data matrix.
  • the number of iterations P for the i-th column is less than or equal to im.
  • the value of i can be from 1 to N, but there is at least one i1 that satisfies: the number of iterations P for the i1th column is less than the number im1 of elements that need to be eliminated in the i1th column. That is to say, when zero suppression is performed for the i1th column, at least one iteration in P iterations satisfies: zero suppression for two or more elements at the same time.
  • the number of zero suppression in the p-th iterative process in the P-th iterative process is half of the number of zero suppression in the p-1th iterative process, where the value of p ranges from 1 to P.
  • the first iteration eliminates 4 elements from zero
  • the second iteration eliminates 2 elements from zero.
  • the current iterative process in P iterations for the i-th column of the data matrix includes: determining a first set and a second set, where the first set includes the current iterative process in the i-th column that simultaneously suppresses zero At least two values, the second set includes the values in the i-th column that are not zero-eliminated in the current iteration process; the first value is selected from the first set, and the second value is selected from the second set, using the first value and the first value
  • the two values obtain the Givens parameter about performing the zero suppression operation on the first value, so as to perform the zero suppression processing on the first value.
  • the first value and the second value are only used for the zero suppression operation of one of the at least two values.
  • the first set and the second set are constructed based on all the elements to be eliminated in the i-th column that need to be eliminated but have not yet been eliminated.
  • the first set includes the elements that need to be eliminated in the current iterative process
  • the second set Includes elements that do not require zero suppression in the current iterative process. It can be seen that there is no intersection between the first set and the second set, that is, the position of the element in the first set in the matrix is different from the position of any element in the second set in the matrix.
  • the full set of the first set and the second set constitutes all the elements to be nullified, or, as another example, the full set of the first set and the second set constitutes a subset of all the elements to be nullified.
  • the number of elements in the second set is equal to or greater than the number of elements in the first set.
  • the first set can include the four elements that need to be zero-eliminated simultaneously in the current iterative process, and the second set can include four or four of the remaining five elements. all.
  • the second value can be selected from the second set, and the Givens parameter required for the zero-suppression operation on the first value can be obtained according to the first value and the second value .
  • the second values corresponding to different first values are different, and the difference here means that the number of rows in the matrix is different.
  • all the elements in the first set and the corresponding number of elements in the second set can be used to construct a value pair. For example, if there are 4 elements in the first set, then 4 value pairs can be constructed. Subsequently, in order to perform zero suppression on the first value in the first set, the Givens parameter required for performing the zero suppression operation on the first value may be determined based on the value pair in which the first value is located. Wherein, no matter whether it is an element in the first set or an element in the second set, any element can only exist in at most one value pair.
  • the Givens parameter for performing the zero suppression operation on the first value can satisfy:
  • the first iteration of the processing can simultaneously eliminate half of all elements below the diagonal of the i-th column.
  • the first iterative process in the P-th iteration process is used to add the last The values of the rows are suppressed at the same time.
  • M represents the number of rows of the data matrix.
  • the first value is the The value of the row
  • the second value can be the value of the j-th row, where the value range of j is to And the Givens parameter for zero suppression operation on the first value satisfies:
  • x ji represents the value of the j-th row and the i-th column in the data matrix, Represents the first in the data matrix The value in the i-th column of the row.
  • the Givens algorithm can be implemented on a DSP.
  • the reduced instruction set computer can configure the vector processing unit and send instructions to the vector processing unit; the vector processing unit reads values from the vector memory according to the configuration and pairs The read value is calculated and the result is written into the vector memory.
  • the configuration vector processing unit includes the following information of the configuration vector processing unit: the vector length of the instruction operation, the number of repeated executions of the instruction, and whether the result of the instruction execution is inverted.
  • the configuration may also include: the array where the data processed by the instruction of the vector processing unit is located, the addressing mode for reading/writing the array, the starting address, etc.
  • the length of the vector operated by the instruction can be expressed as vector_length.
  • the number of repeated executions of the instruction can be expressed as iteration.
  • the vector memory may include 6 different storage arrays. And the first of the 6 different storage arrays is used to store the data matrix. The second array to the sixth array among the 6 different storage arrays are used to store intermediate parameters for the Givens transformation.
  • the first array can be used to store the original data matrix, that is, the input matrix; it can also be used to store the final data matrix after the Givens rotation transformation, that is, the output matrix.
  • the first array is also used to store the intermediate form of the data matrix in the process of transforming the input matrix into the output matrix. For example, after one or more iterations of zero-elimination processing, some elements in the input matrix are processed with zero-elimination processing, but they have not been transformed into the output matrix.
  • each array contains 16 single-port RAMs, and the data bit width of the RAM is 32bit. And it supports both linear and stride addressing modes.
  • sequential addressing means reading or writing data sequentially, as shown in Figure 6.
  • RAM0 to RAM15 represent 16 single-port RAMs included in the array.
  • 0x0000 to 0x017c indicate the storage location.
  • interval addressing means discontinuous reading or writing, as shown in Figure 7.
  • RAM0 to RAM15 represent 16 single-port RAMs included in the array.
  • 0x0000 to 0x017c indicate the storage location.
  • the addressing interval (stride_size) is 5*4Byte (byte). Then suppose it is a read operation, the first read position is 0x0000, then the second read position is 0x0014 according to the interval of 5*4Byte, specifically the storage position with gray background color in Figure 7.
  • the instructions may include instructions for performing at least one of the following operations: square operation, sum operation, difference operation, reciprocal operation, and product operation.
  • the instruction can be any of the following:
  • vadd_fff used to calculate the sum of 2 floating-point vectors and output floating-point vectors
  • vmuls_fff used to calculate the product of a floating-point vector and a floating-point scalar, and output a floating-point vector
  • vsub_fff used to calculate the difference between two floating-point vectors, and output a floating-point vector.
  • the input for each instruction is one value or two values.
  • vsqr_ff and vsqrti_ff are for a floating-point vector.
  • vadd_fff, vmul_fff and vsub_fff are for 2 floating-point vectors.
  • vmuls_fff is for 1 floating-point vector and 1 floating-point scalar.
  • the output of these instructions are all floating-point vectors.
  • the names of the above-mentioned instructions all contain an underscore. The ff after the underscore represents one input and one output, and fff represents two inputs and one output.
  • the vector processing unit in FIG. 3 may have three master ports, so that it can be connected to three arrays in the vector memory at most at the same time.
  • the three arrays one or two arrays are used as input, that is, the vector processing unit is used as the main body (Master) to read data from the vector memory; one array is used as output, that is, the vector processing unit is used as the main body (Master) to write to the vector memory.
  • the vector processing unit is used as the main body (Master) to read data from the vector memory
  • one array is used as output, that is, the vector processing unit is used as the main body (Master) to write to the vector memory.
  • the element in the data matrix is x ij , where i is the row number and its value is 1 to 9; j is the column number and its value is 1 to 7.
  • all the elements in the data matrix are sequentially stored in the first array (array 0), as shown in FIG. 8 is the storage position of each element in the data matrix in the array 0.
  • the process of the first iterative processing for the first column of the data matrix will be described below in conjunction with FIGS. 9 to 13, and the process can suppress zeros for the four elements x 61 , x 71 , x 81 and x 91 at the same time.
  • the first iteration process is divided into the following 8 steps.
  • Step 1 Store the 9 ⁇ 7 data matrix in array 0, as shown in Figure 8.
  • step 2 the data stored in the array 1 can be seen in FIG. 9.
  • step 3 the data stored in the array 2 can be seen in FIG. 10. It should be noted that, in order to simplify the illustration, only the first few storage spaces that are not empty are shown in FIG. 10, and the remaining positions are empty and not shown.
  • Step 4 the simplified instruction set computer configures the vector processing unit.
  • the addressing mode of array 1 and array 2 is configured as linear addressing, and the starting address is 0x0000.
  • the addressing mode of configuration array 3 is Linear, and the starting address is 0x0000.
  • the reduced instruction set computer sends the vadd_fff instruction to the vector processing unit.
  • step 4 the data stored in the array 3 can be seen in FIG. 11. It should be noted that, in order to simplify the illustration, only the first few storage spaces that are not empty are shown in FIG. 11, and the remaining positions are empty and not shown.
  • Step 5 the simplified instruction set computer configures the vector processing unit.
  • the addressing mode of the array 3 is configured as linear addressing, and the starting address is 0x0000.
  • the addressing mode of the configuration array 4 is Linear, and the starting address is 0x0000.
  • the reduced instruction set computer sends the vsqrti_ff instruction to the vector processing unit.
  • step 5 the data stored in the array 4 can be seen in FIG. 12. It should be noted that, in order to simplify the illustration, only the first few storage spaces that are not empty are shown in FIG. 12, and the remaining positions are empty and not shown.
  • the reduced instruction set computer configures the vector processing unit. Specifically, the addressing mode of the array 0 is configured to be stride, the starting address is 0x001c, and the stride_size of the addressing is 7*4Byte.
  • the addressing mode of the configuration array 4 is Linear, and the starting address is 0x0000.
  • the addressing mode of the configuration array 5 is Linear, and the starting address is 0x0000.
  • the reduced instruction set computer sends the vmul_fff instruction to the vector processing unit.
  • the reduced instruction set computer configures the vector processing unit. Specifically, the addressing mode of array 0 is configured as stride addressing, the starting address is 0x008c, and the addressing interval (stride_size) is 7*4Byte.
  • the addressing mode of the configuration array 4 is Linear, and the starting address is 0x0000.
  • the addressing mode of the configuration array 5 is Linear, and the starting address is 0x0010.
  • the reduced instruction set computer sends the vmul_fff instruction to the vector processing unit.
  • step 6 the data stored in the array 5 can be seen in FIG. 13. It should be noted that, in order to simplify the illustration, only the first few storage spaces that are not empty are shown in FIG. 13, and the remaining positions are empty and not shown.
  • step 7 can be understood as a vector iterative process.
  • the number of vector iterations is 4, but the reduced instruction set computer only needs to be configured to start the vector processing unit once, and does not need to be configured to start the vector processing unit 4 times.
  • step 7 the data stored in the array 1 to the array 4 have been changed, and for the purpose of simplification, they will not be shown one by one in the drawings.
  • the zero suppression process can be performed for any size M ⁇ N data matrix.
  • the zero suppression can be performed in the order from left to right and bottom to top. From left to right means that the zero suppression process is performed for the first column first, and then the zero suppression process is performed for the second column. . . . . . Finally, zero suppression is performed on the Nth column.
  • the zero-elimination process can be completed more optimally and faster.
  • the number of clock cycles (clock cycles) occupied by instructions distributed on the reduced instruction set computer is:
  • FIG. 14 shows the ratio of the clock period occupied by the method of the embodiment of the present invention to the clock period occupied by the conventional technology for data matrices of different sizes.
  • the ordinate of the figure represents the ratio
  • the abscissa represents the number N of columns of the matrix
  • the data processing method of the embodiment of the present invention can greatly reduce the processing amount and improve the processing speed. And in this process, the space occupation of the vector memory is reduced, and the storage of sensor measurement data is ensured.
  • an embodiment of the present invention also provides a data processing device, which may include: a receiving module, a building module, and a processing module. in,
  • the receiving module is used to receive the measurement data obtained by the sensor
  • the construction module is used to construct a data matrix according to the measurement data, the data matrix is a matrix of M rows and N columns, and both M and N are positive integers;
  • the processing module is used to determine the Givens transformation matrix of the data matrix
  • the processing module is also used to perform the Givens transformation on the data matrix by using the Givens transformation matrix, so that at least two values located on the same column of the data matrix are eliminated at the same time;
  • the processing module is also used to process the measurement data according to the Givens transformation matrix.
  • the receiving module, the building module, and the processing module may be independent modules, or may be integrated in a whole.
  • the processing module may be a digital signal processor as shown in FIG. 2.
  • the receiving module, the building module, and the processing module are jointly constructed as a digital signal processor as shown in FIG. 2.
  • the senor is a camera; the measurement data is the pixels of an image taken by the camera; and the data processing is data processing on the pixels.
  • the sensor may be an external component of the device, or the device may include a sensor.
  • the processing module may be configured to: decompose the measurement data into multiple sub-data units; and perform data processing on the multiple sub-data units.
  • the storage module further includes a storage module that can be used to store the Givens transformation matrix, where the storage space occupied by the Givens transformation matrix is less than the storage space required by the data matrix.
  • the storage module may be a vector memory as shown in FIG. 3.
  • the processing module may be used to: through Givens transformation, eliminate zeros column by column in the data matrix in the order from left to right.
  • zero elimination is completed through P iterations in the order from bottom to top, where the value of i ranges from 1 to N.
  • the number of zero suppression in the p-th iterative process in the P iteration process is half of the number of zero suppression in the p-1th iterative process, where the value of p ranges from 1 to P.
  • the processing module is configured to: the current iterative process in P iterations for the i-th column of the data matrix includes: determining a first set and a second set, wherein the first set includes the first set At least two values of the current iterative process in the i-th column that are zero-suppressed simultaneously, the second set includes the values in the i-th column that are not zero-suppressed in the current iterative process; selected from the first set A first numerical value, and a second numerical value selected from the second set, and using the first numerical value and the second numerical value to obtain the Givens parameter related to the zero suppression operation on the first numerical value, so as to compare the Perform zero-suppression processing on the first value; wherein, in a calculation of simultaneously zero-suppressing the at least two values on the i-th column, the first value and the second value are only used for all Describes the zero suppression operation of one of at least two values.
  • the Givens parameter for performing the zero suppression operation on the first value satisfies:
  • the first iterative process in the P-th iterative process is used to use the last The values of the rows are suppressed at the same time.
  • the second value is the value of the jth row of the i-th column
  • the first value is the value of the i-th column The value of the row, where the value range of j is to
  • the processing module may include a reduced instruction set computer, a vector processing unit, and a vector memory.
  • the reduced instruction set computer configures the vector processing unit and sends instructions to the vector processing unit; the vector processing unit reads from the vector memory according to the configuration. Take the value, calculate the value read according to the instruction, and write the result into the vector memory.
  • the reduced instruction set computer configuration vector processing unit includes the following information of the configuration vector processing unit: the vector length of the instruction operation, the number of times the instruction is repeatedly executed, and whether the result of the instruction execution is inverted.
  • the vector memory includes 6 different storage arrays.
  • the first array of the 6 different storage arrays is used to store the data matrix and is also used to store the Givens transformation matrix.
  • the second to sixth arrays are used to store intermediate parameters for the Givens transform.
  • the instructions include instructions for performing at least one of the following operations: square operation, sum operation, difference operation, reciprocal operation, and product operation.
  • the device may be a pan-tilt, mobile phone, handheld computer, wearable device, etc.
  • the camera may be mounted on the device in a detachable manner or a fixed manner, etc.
  • the device can implement the aforementioned data processing method, and for details, refer to the aforementioned data processing method described in conjunction with the digital signal processor in FIG. 3.
  • the embodiment of the present invention also provides a computer storage medium on which a computer program is stored.
  • the computer program is executed by the processor, the steps of the data processing method shown in FIG. 5 can be realized.
  • the computer storage medium is a computer-readable storage medium.
  • the computer or processor executes the following steps: receiving measurement data obtained by a sensor; constructing a data matrix according to the measurement data, the data matrix being A matrix with M rows and N columns, where M and N are both positive integers; determine the Givens transformation matrix about the data matrix; use the Givens transformation matrix to perform the Givens transformation on the data matrix so that the data is located At least two numerical values on the same column of the matrix are eliminated at the same time; data processing is performed on the measurement data according to the Givens transformation matrix.
  • the computer storage medium may include, for example, a memory card of a smart phone, a storage component of a tablet computer, a hard disk of a personal computer, a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a portable compact disk read-only memory ( CD-ROM), USB memory, or any combination of the above storage media.
  • the computer-readable storage medium may be any combination of one or more computer-readable storage media.
  • an embodiment of the present invention also provides a computer program product, which contains instructions, which when executed by a computer, cause the computer to execute the steps of the data processing method shown in FIG. 5 and the like.
  • the computer when the instruction is executed by the computer, the computer is caused to execute: receiving measurement data obtained by the sensor; constructing a data matrix according to the measurement data, the data matrix being a matrix of M rows and N columns, M and N Are all positive integers; determine the Givens transformation matrix about the data matrix; use the Givens transformation matrix to perform the Givens transformation on the data matrix so that at least two of them located on the same column of the data matrix Numerical values are eliminated at the same time; data processing is performed on the measurement data according to the Givens transformation matrix.
  • the data processing method of the embodiment of the present invention when performing data processing on the measurement data collected by the sensor, some elements in the data matrix can be zero-eliminated by Givens rotation. Among them, there is at least one iteration to make at least two elements at the same time.
  • Zero suppression compared to the prior art of performing zero suppression processing element by element, the data processing method of the embodiment of the present invention can greatly reduce the processing amount and improve the processing speed. And in this process, the space occupation of the vector memory is reduced, and the storage of sensor measurement data is ensured.
  • the computer program product includes one or more computer instructions.
  • the computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices.
  • the computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from a website, computer, server, or data center.
  • the computer-readable storage medium may be any available medium that can be accessed by a computer or a data storage device such as a server or a data center integrated with one or more available media.
  • the usable medium may be a magnetic medium (for example, a floppy disk, a hard disk, a tape), an optical medium (for example, a digital video disc (DVD)), or a semiconductor medium (for example, a solid state disk (SSD)), etc. .
  • the disclosed system, device, and method can be implemented in other ways.
  • the device embodiments described above are only illustrative.
  • the division of the units is only a logical function division, and there may be other divisions in actual implementation, for example, multiple units or components may be combined or It can be integrated into another system, or some features can be ignored or not implemented.
  • the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or units, and may be in electrical, mechanical or other forms.
  • the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the objectives of the solutions of the embodiments.
  • the functional units in the various embodiments of the present application may be integrated into one processor, or each unit may exist alone physically, or two or more units may be integrated into one unit.

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Mathematical Physics (AREA)
  • Pure & Applied Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Mathematical Optimization (AREA)
  • Mathematical Analysis (AREA)
  • Computational Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Algebra (AREA)
  • Databases & Information Systems (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Computing Systems (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Complex Calculations (AREA)

Abstract

一种数据处理的方法、装置及计算机存储介质。该方法包括:接收由传感器获取的测量数据(S110);根据所述测量数据构建数据矩阵,数据矩阵为M行N列矩阵,M和N均为正整数(S120);确定关于数据矩阵的吉文斯变换矩阵(S130);利用吉文斯变换矩阵,对数据矩阵进行吉文斯变换,以使得位于数据矩阵的同一列上的至少两个数值同时消零(S140);根据吉文斯变换矩阵对测量数据进行数据处理(S150)。该方法在对由传感器采集的测量数据进行数据处理时,可以通过吉文斯旋转将数据矩阵中的部分元素进行消零处理,其中,至少存在一个迭代将至少两个元素同时消零,能够极大地减小处理量,提升处理速度。

Description

数据处理的方法、装置及计算机存储介质 技术领域
本发明实施例涉及数据处理领域,并且更具体地,涉及一种数据处理的方法、装置及计算机存储介质。
背景技术
在信号处理、图像处理等各个领域都会涉及数据处理,例如在对图像进行分割、识别等过程中,基于图像的像素值进行数据处理。
吉文斯旋转(Givens Rotation)算法是对数据所构成的矩阵进行数据处理的常用的算法之一,其主要在数字信号处理器(DPS)上执行。然而目前的吉文斯选择算法在运行时,需要大量的运行时间,导致性能较差。
发明内容
本发明实施例提供了一种数据处理的方法及装置,降低了模式选择的复杂度,提高了处理的效率。
第一方面,提供了一种数据处理的方法,所述方法包括:
接收由传感器获取的测量数据;
根据所述测量数据构建数据矩阵,所述数据矩阵为M行N列矩阵,M和N均为正整数;
确定关于所述数据矩阵的吉文斯变换矩阵;
利用所述吉文斯变换矩阵,对所述数据矩阵进行吉文斯变换,以使得位于所述数据矩阵的同一列上的至少两个数值同时消零;
根据所述吉文斯变换矩阵对所述测量数据进行数据处理。
第二方面,提供了一种数据处理的装置,包括接收模块、构建模块和处 理模块。其中,
接收模块,用于接收由传感器获取的测量数据;
构建模块,用于根据测量数据构建数据矩阵,数据矩阵为M行N列矩阵,M和N均为正整数;
处理模块,用于确定关于数据矩阵的吉文斯变换矩阵;
处理模块,还用于利用吉文斯变换矩阵,对数据矩阵进行吉文斯变换,以使得位于数据矩阵的同一列上的至少两个数值同时消零;
处理模块,还用于根据吉文斯变换矩阵对测量数据进行数据处理。
第三方面,提供了一种计算机存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时实现上述第一方面所述方法的步骤。
由此可见,本发明实施例在对由传感器采集的测量数据进行数据处理时,可以通过吉文斯旋转将数据矩阵中的部分元素进行消零处理,其中,至少存在一个迭代将至少两个元素同时消零,相对于逐个元素进行消零处理的已有技术,本发明实施例的数据处理的方法能够极大地减小处理量,提升处理速度。并且在该过程中,减小了对向量存储器的空间占用,保证了传感器测量数据的存储。
附图说明
为了更清楚地说明本发明实施例的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。
图1是吉文斯算法“消0”的顺序的一个示意图;
图2是使用吉文斯旋转矩阵对输入矩阵中的一个元素进行消0的示意图;
图3是本发明实施例的数字信号处理器的一个示意性框图;
图4(a)和(b)分别是矩阵的行数不大于列数和行数大于列数的示意图;
图5是本发明实施例的数据处理的一个示意性流程图;
图6是顺序寻址的一个示意图;
图7是间隔寻址的一个示意图;
图8是9×7的数据矩阵在阵列0中的存储位置;
图9是对图8中的第1列进行第1次迭代消零时步骤2后阵列1中的存储数据;
图10是对图8中的第1列进行第1次迭代消零时步骤3后阵列2中的存储数据;
图11是对图8中的第1列进行第1次迭代消零时步骤4后阵列3中的存储数据;
图12是对图8中的第1列进行第1次迭代消零时步骤5后阵列4中的存储数据;
图13是对图8中的第1列进行第1次迭代消零时步骤6后阵列5中的存储数据;
图14是本发明实施例的方法占用的时钟周期与传统技术占用的时钟周期的比值的示意图。
具体实施方式
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有作出创 造性劳动的前提下所获得的所有其他实施例,都属于本发明保护的范围。
计算机、或计算机的处理器在对图像或信号(如音视频信号)进行处理时,针对的处理对象是数字信息。数字信息可以是图像的像素值,音视频信号的频率等等,这些都可以表示为数据的形式。因此,对图像或信号的处理均涉及数据处理的过程。
在数据处理的过程中,可以将大量的数据表示为矩阵的形式,即构建数据矩阵。对数据矩阵执行的算法可以包括吉文斯旋转算法。吉文斯旋转算法可以将数据矩阵进行简化,将其中的部分元素转化为零,简称“消0”。在对数据矩阵中的元素进行“消0”时,一般采用从下到上、从左到右的方式进行,如图1所示,这样不会再次引入非零值。
例如,在图2中,中间的矩阵表示输入矩阵,可以表示为X。左侧的矩阵表示吉文斯旋转矩阵,右侧的矩阵表示输出矩阵,可以表示为Y。在对图2中所示的输入矩阵中的x ji消0时,需要先计算标量
Figure PCTCN2020078651-appb-000001
Figure PCTCN2020078651-appb-000002
Figure PCTCN2020078651-appb-000003
再计算矢量[y i1 … y iN]=c[x i1 … x iN]-s[x j1 … x jN]和[y j1 … y jN]=s[x i1 … x iN]+c[x j1 … x jN]。
通常,在数字信号处理器(Digital Signal Processor,DSP)上实现吉文斯旋转算法。其中,标量参数c和s通常在数字信号处理器(Digital Signal Processor,DSP)中轻量级的精简指令集计算机(Reduced Instruction Set Computing,RISC)中央处理单元(Central Processing Unit,CPU)上进行计算。图2中的输出矩阵中i和j行通常会在向量处理单元(Vector Process Unit,VPU)上进行计算。因为输入矩阵和输出矩阵通常保存在向量存储器(Vector Memory,VMEM)相同的内存空间,所以输出矩阵中的其他行无需更新,只需保持和输入矩阵一致即可。
如图3示出的是本发明实施例DSP的一个示意性框图。其中,数字信号处理器包括精简指令集计算机中央处理单元、向量处理单元以及向量存储器。另外,图3示出的数字信号处理器还包括加速器和外围设备,并且数字信号处理器中的各个组件可以通过总线进行连接。应当注意的是,图3中示出的向量存储器包括6个阵列(Array),但是本发明对此不限定,具体地可以为更多或更少的阵列,例如2个或者10个。示例性地,每个阵列中可以包含16个单口随机存取存储器(Random Access Memory,RAM),并且RAM的数据位宽可以为32比特(bit)。
对于MxN的矩阵,如图4(a)和(b)所示的,主对角线以下的元素个数为:
Figure PCTCN2020078651-appb-000004
在精简指令集计算机支持乘法、加法和
Figure PCTCN2020078651-appb-000005
运算的情况下,计算c和s的算数指令至少需要占用7个时钟周期(clock cycle)。在向量处理单元支持B=A*const(其中A和B是矢量,const标量)、C=A+B(A和B是矢量)运算的情况下,精简指令集计算机至少需要向向量处理单元分发3(M-1+max(M-N,1))*min(M-1,N)次指令。精简指令集计算机上占用的总的时钟周期数至少为
Figure PCTCN2020078651-appb-000006
在考虑数据搬移指令和程序控制指令的情况下,精简指令集计算机上占用的时钟周期数会远大于此。
假设向量处理单元的并行度为P,那么矢量计算总的时钟周期数为
Figure PCTCN2020078651-appb-000007
Figure PCTCN2020078651-appb-000008
(ceil表示向上取整)。显然,在矩阵列数N较小时,精简指令集计算机上的计算会成为算法的瓶颈,限制算法的性能。
为了至少部分地解决上述问题,本发明提出了一种数据处理的方法,该方法的一个示意性流程图如图5所示,图5所示的方法可以包括:
S110,接收由传感器获取的测量数据;
S120,根据测量数据构建数据矩阵,数据矩阵为M行N列矩阵,M和N均为正整数;
S130,确定关于数据矩阵的吉文斯变换矩阵;
S140,利用吉文斯变换矩阵,对数据矩阵进行吉文斯变换,以使得位于数据矩阵的同一列上的至少两个数值同时消零;
S150,根据吉文斯变换矩阵对测量数据进行数据处理。
示例性地,本发明实施例中的传感器可以是相机,相应地,测量数据可以是相机拍摄得到的图像的像素,并且相应地数据处理可以为关于像素的数据处理。可理解,该相机可以是数码相机,或者该相机可以搭载于其他设备上,包括但不限于:云台、移动电话、手持计算机、可穿戴设备等等。
示例性地,S150可以包括:将测量数据分解为多个子数据单元;对多个子数据单元进行数据处理。这样,能够基于多个子数据单元进行数据处理,减小了单次处理时的数据量,能够提升处理速度。
示例性地,在图5所示的数据处理的过程中,可以包括:存储吉文斯变换矩阵。其中,吉文斯变换矩阵所占用的存储空间小于数据矩阵所需的存储空间。这样,吉文斯变换矩阵(也称为吉文斯旋转矩阵)占用更小的存储空间,可以确保数据矩阵的存储空间不会被过多地占用。
本发明实施例中,可以使用吉文斯变换矩阵对数据矩阵进行“消0”处理。示例性地,通过吉文斯变换,将数据矩阵按照从左到右的顺序进行逐列地消零。
其中,如果数据矩阵的列数为N,那么从左到右的顺序可以理解为:先针对第1列进行消零,再针对第2列进行消零,……,最后针对第N列进行消零。
其中,针对数据矩阵的第i列,按照从下往上的顺序,通过P次迭代处 理完成消零,其中i的取值范围为1至N。示例性地,P不大于第i列中所有待消零元素的数量。相应地,可以理解,针对数据矩阵,所有列的所有迭代次数之和小于该数据矩阵中的所有待消零元素的数量。
可选地,假设第i列需要消0的元素的数量为im个,那么针对第i列进行的迭代次数P小于或等于im。i的取值可以是从1至N,但是至少存在一个i1满足:针对第i1列的迭代次数P小于第i1列需要消0的元素的数量im1。也就是说,针对第i1列进行消零时,P次迭代中至少存在一次迭代满足:同时对两个或两个以上的元素消零。
作为一种实现方式,P次迭代处理中的第p次迭代处理消零的个数是第p-1次迭代处理消零的个数的一半,其中p的取值范围为1至P。举例来说,针对数据矩阵的第i列:第1次迭代将4个元素消零,第2次迭代将2个元素消零。
示例性地,针对数据矩阵的第i列进行的P次迭代处理中的当前迭代处理包括:确定第一集合和第二集合,其中第一集合包括第i列中的当前迭代处理同时消零的至少两个数值,第二集合包括第i列中的当前迭代处理不进行消零的数值;从第一集合选择第一数值,以及从第二集合中选择第二数值,利用第一数值和第二数值得到关于对第一数值进行消零操作的吉文斯参数,以对第一数值进行消零处理。其中,在对第i列上的至少两个数值进行同时消零的一次计算中,第一数值和第二数值仅被用于至少两个数值中的一个数值的消零操作。
具体地,基于第i列中需要消零而还未被消零的所有待消零元素,构建第一集合和第二集合,第一集合中包括当前迭代处理需要消零的元素,第二集合中包括当前迭代处理中不需要消零的元素。可见,第一集合与第二集合不存在交集,即第一集合中的元素在矩阵中的位置不同于第二集合中任一元素在矩阵中的位置。作为一例,第一集合和第二集合的全集构成所有待消零 元素,或者,作为另一例,第一集合和第二集合的全集构成所有待消零元素的子集。其中,第二集合中的元素的数量等于或者大于第一集合中的元素的数量。
举例来说,假设所有待消零元素的数量为9个,那么第一集合中可以包括当前迭代处理需要同时消零的4个元素,第二集合中可以包括剩余5个元素中的4个或全部。
为了将第一集合中的第一数值进行消零,可以从第二集合中选择第二数值,并根据第一数值和第二数值来得到对第一数值进行消零操作所需的吉文斯参数。应当注意的是,不同的第一数值所对应的第二数值是不同的,这里的不同是指在矩阵中的行数不同。
换句话说,可以利用第一集合中的所有元素与第二集合中的相应数量的元素构建数值对。例如,假设第一集合中有4个元素,那么可以构建4个数值对。随后,为了将第一集合中的第一数值进行消零,可以基于第一数值所在的数值对来确定对第一数值进行消零操作所需的吉文斯参数。其中,不管是第一集合中的元素还是第二集合中的元素,任一元素最多仅存在于一个数值对中。
示例性地,假设第一数值表示为x1,第二数值表示为x2,那么对第一数值进行消零操作的吉文斯参数可以满足:
Figure PCTCN2020078651-appb-000009
举例来说,针对第i列进行消零处理时,第1次迭代处理可以将该第i列的对角线以下的所有元素的一半同时消零。具体地,P次迭代处理中的第1次迭代处理用于将第i列的最后
Figure PCTCN2020078651-appb-000010
行的数值同时消零。其中,M表示数据矩阵的行数。
作为一例,在对最后
Figure PCTCN2020078651-appb-000011
行的数值同时消零时,第一数值为第
Figure PCTCN2020078651-appb-000012
行的数值,第二数值可以为第j行的数值,其中,j的取值范围 为
Figure PCTCN2020078651-appb-000013
Figure PCTCN2020078651-appb-000014
且对第一数值进行消零操作的吉文斯参数满足:
Figure PCTCN2020078651-appb-000015
其中,x ji表示数据矩阵中第j行第i列的数值,
Figure PCTCN2020078651-appb-000016
表示数据矩阵中第
Figure PCTCN2020078651-appb-000017
行第i列的数值。
这样,本发明实施例中,在对数据矩阵进行处理时,尤其是通过吉文斯变换进行消零处理时,在同一个迭代处理中同时对多个元素进行消零处理,这样能够减少消零处理的迭代次数,减小计算量,提升处理效率。
另外,本发明实施例中,吉文斯算法可以在DSP上实现。具体地,结合图3,在图5所示的方法中,可以由精简指令集计算机配置向量处理单元,并向向量处理单元发送指令;向量处理单元根据配置从向量存储器读取数值,根据指令对所读取的数值进行计算并将结果写入向量存储器。
其中,配置向量处理单元包括:配置向量处理单元的如下信息:指令操作的矢量长度、指令重复执行的次数、指令执行的结果是否取反。
其中,该配置还可以包括:向量处理单元的指令所处理的数据所在的阵列,读取/写入阵列的寻址方式、起始地址等。
举例来说,可以将指令操作的矢量长度表示为vector_length。可以将指令重复执行的次数表示为iteration。可以将指令执行的结果是否取反利用取反标志invert_sign。当取反标志invert_sign=0时,表示不进行取反操作,当取反标志invert_sign=0时,表示进行取反操作。
示例性地,向量存储器可以包括6个不同的存储阵列。并且6个不同的存储阵列中的第一阵列用于存储数据矩阵。6个不同的存储阵列中的第二阵列至第六阵列用于存储进行吉文斯变换的中间参数。
可理解,第一阵列可以用于存储原始数据矩阵,即输入矩阵;还用于存 储进行吉文斯旋转变换后的最终数据矩阵,即输出矩阵。并且,该第一阵列还用于存储从输入矩阵被变换为输出矩阵的过程中,该数据矩阵的中间形式。例如,经过一次或多次迭代的消零处理后,输入矩阵中的部分元素被进行消零处理,但是还没有被变换为输出矩阵。
结合图3,向量存储器所包括的6个不同的阵列依次为:阵列0、阵列1、…、阵列5。并且,如图3所示,每个阵列中包含16个单口RAM,RAM的数据位宽为32bit。并且同时支持顺序(Linear)和间隔(Stride)两种寻址模式。
其中,顺序寻址表示依次读或写数据,如图6所示。其中,RAM0至RAM15表示阵列中包含的16个单口RAM。其中,0x0000至0x017c表示存储位置。
其中,间隔寻址表示非连续地进行读或写,如图7所示。其中,RAM0至RAM15表示阵列中包含的16个单口RAM。其中,0x0000至0x017c表示存储位置。并且,在图7的示例中,假设寻址的间隔(stride_size)为5*4Byte(字节)。那么假设为读操作,第一个读取位置为0x0000,那么第二个读取位置按照5*4Byte的间隔到0x0014,具体地如图7中具有灰色底色的存储位置。
可以理解的是,关于顺序寻址或者间隔寻址可以参见现有技术中的相关描述,这里不再赘述。
可选地,指令可以包括用于执行以下至少一个运算的指令:平方运算、求和运算、求差运算、倒数运算、乘积运算。
举例来说,指令可以为如下任一个:
(1)vsqr_ff,用于计算1个浮点向量平方,输出浮点向量;
(2)vadd_fff,用于计算2个浮点向量之和,输出浮点向量;
(3)vsqrti_ff,用于计算1个浮点向量
Figure PCTCN2020078651-appb-000018
的值,输出浮点向量;
(4)vmul_fff,用于计算2个浮点向量之积,输出浮点向量;
(5)vmuls_fff,用于计算浮点向量和浮点标量之积,输出浮点向量;
(6)vsub_fff,用于计算2个浮点向量之差,输出浮点向量。
这些指令中,每一个指令针对的输入是一个值或者两个值。如vsqr_ff和vsqrti_ff针对一个浮点向量。如vadd_fff、vmul_fff和vsub_fff针对2个浮点向量。如vmuls_fff针对1个浮点向量和1个浮点标量。并且这些指令的输出都是浮点向量。具体地,上述各个指令的名称中都包含下划线,下划线后面的ff表示一个输入和一个输出,fff表示两个输入和一个输出。
可见,指令最多针对两个输入,因此相应地,图3中的向量处理单元可以具有3个主端口(Master Port),从而能够最多同时与向量存储器中的3个阵列相连接。这3个阵列中,1个或2个阵列作为输入,即向量处理单元作为主体(Master)从向量存储器读取数据;1个阵列作为输出,即向量处理单元作为主体(Master)往向量存储器写入数据。
为了更清楚地理解图5所示的数据处理的方法在图3所示的数据信号处理器上的执行过程,以下结合具体的实例进行较为详细的阐述。
假设S120中所构建的数据矩阵为9×7的数据矩阵,即M=9,N=7。假设该数据矩阵中的元素为x ij,其中,i为行号,其取值为1至9;j为列号,其取值为1至7。并且可以假设该数据矩阵中的所有元素依次被依次存储在第一个阵列(阵列0)中,如图8示出的是数据矩阵中的各个元素在阵列0中的存储位置。
以下将结合图9至图13描述针对该数据矩阵的第1列的第1次迭代处理的过程,该过程可以对x 61,x 71,x 81和x 91这4个元素同时消零。为了描述的方便,将该第1次迭代处理分为以下的8个步骤。
步骤1,将9×7的数据矩阵存储在阵列0中,如图8所示。
步骤2,精简指令集计算机对向量处理单元进行配置。具体地配置阵列0的寻址模式为间隔寻址(Stride),起始地址为0x001c,寻址的间隔(stride_size)为7*4Byte。配置阵列1的寻址模式为顺序寻址(Linear),起始地址为0x0000。配置向量处理单元对即将接收到的指令进行操作的矢量长度vector_length=4,该指令重复执行的次数iteration=1,以及该指令执行的结果是否取反的取反标志invert_sign=0。在配置之后,精简指令集计算机向向量处理单元发送vsqr_ff指令。
向量处理单元接收到vsqr_ff指令之后,从阵列0中的0x001c位置读取x 21,对其执行vsqr_ff,得到x 21 2,由于取反标志invert_sign=0因此不取反而将x 21 2存储在阵列1的0x0000处。随后按照对阵列0的间隔寻址模式,间隔7*4Byte后读取x 31,对其执行vsqr_ff,得到x 31 2,由于取反标志invert_sign=0因此不取反而将其存储在阵列1的0x0004处。随后按照对阵列0的间隔寻址模式,间隔7*4Byte后读取x 41,对其执行vsqr_ff,得到x 41 2,由于取反标志invert_sign=0因此不取反而将其存储在阵列1的0x0008处。随后按照对阵列0的间隔寻址模式,间隔7*4Byte后读取x 51,对其执行vsqr_ff,得到x 51 2,由于取反标志invert_sign=0因此不取反而将其存储在阵列1的0x000c处。
在步骤2之后,阵列1中所存储的数据可以参见图9。
步骤3,精简指令集计算机对向量处理单元进行配置。具体地配置阵列0的寻址模式为间隔寻址(Stride),起始地址为0x008c,寻址的间隔(stride_size)为7*4Byte。配置阵列2的寻址模式为顺序寻址(Linear),起始地址为0x0000。配置向量处理单元对即将接收到的指令进行操作的矢量长度vector_length=4,该指令重复执行的次数iteration=1,以及该指令执行的结果是否取反的取反标志invert_sign=0。在配置之后,精简指令集计算机向向量处理单元发送vsqr_ff指令。
向量处理单元接收到vsqr_ff指令之后,从阵列0中的0x008c位置读取x 61,对其执行vsqr_ff,得到x 61 2,由于取反标志invert_sign=0因此不取反而将x 61 2存储在阵列2的0x0000处。随后按照对阵列0的间隔寻址模式,间隔7*4Byte后读取x 71,对其执行vsqr_ff,得到x 71 2,由于取反标志invert_sign=0因此不取反而将其存储在阵列2的0x0004处。随后按照对阵列0的间隔寻址模式,间隔7*4Byte后读取x 81,对其执行vsqr_ff,得到x 81 2,由于取反标志invert_sign=0因此不取反而将其存储在阵列2的0x0008处。随后按照对阵列0的间隔寻址模式,间隔7*4Byte后读取x 91,对其执行vsqr_ff,得到x 91 2,由于取反标志invert_sign=0因此不取反而将其存储在阵列2的0x000c处。
在步骤3之后,阵列2中所存储的数据可以参见图10。应当注意的是,为了简化图示,在图10中仅示出了非空的前几个存储空间,其余位置为空,未示出。
步骤4,精简指令集计算机对向量处理单元进行配置。具体地配置阵列1和阵列2的寻址模式为顺序寻址(Linear),起始地址为0x0000。配置阵列3的寻址模式为顺序寻址(Linear),起始地址为0x0000。配置向量处理单元对即将接收到的指令进行操作的矢量长度vector_length=4,该指令重复执行的次数iteration=1,以及该指令执行的结果是否取反的取反标志invert_sign=0。在配置之后,精简指令集计算机向向量处理单元发送vadd_fff指令。
向量处理单元接收到vadd_fff指令之后,从阵列1中的0x0000位置读取x 21 2,从阵列2中的0x0000位置读x 61 2,对读取到的两个值执行vadd_fff指令,得到x 21 2+x 61 2,由于取反标志invert_sign=0因此不取反,而将x 21 2+x 61 2存储在阵列3的0x0000处。随后按照对阵列1和阵列2的顺序寻址模式,从阵列1中的0x0004位置读取x 31 2,从阵列2中的0x0004位置读x 71 2, 对读取到的两个值执行vadd_fff指令,得到x 31 2+x 71 2,由于取反标志invert_sign=0因此不取反,而将x 31 2+x 71 2存储在阵列3的0x0004处。随后按照对阵列1和阵列2的顺序寻址模式,从阵列1中的0x0008位置读取x 41 2,从阵列2中的0x0008位置读x 81 2,对读取到的两个值执行vadd_fff指令,得到x 41 2+x 81 2,由于invert_sign=0因此不取反,而将x 41 2+x 81 2存储在阵列3的0x0008处。随后按照对阵列1和阵列2的顺序寻址模式,从阵列1中的0x000c位置读取x 51 2,从阵列2中的0x000c位置读x 91 2,对读取到的两个值执行vadd_fff指令,得到x 51 2+x 91 2,由于取反标志invert_sign=0因此不取反,而将x 51 2+x 91 2存储在阵列3的0x000c处。
在步骤4之后,阵列3中所存储的数据可以参见图11。应当注意的是,为了简化图示,在图11中仅示出了非空的前几个存储空间,其余位置为空,未示出。
步骤5,精简指令集计算机对向量处理单元进行配置。具体地配置阵列3的寻址模式为顺序寻址(Linear),起始地址为0x0000。配置阵列4的寻址模式为顺序寻址(Linear),起始地址为0x0000。配置向量处理单元对即将接收到的指令进行操作的矢量长度vector_length=4,该指令重复执行的次数iteration=1,以及该指令执行的结果是否取反的取反标志invert_sign=0。在配置之后,精简指令集计算机向向量处理单元发送vsqrti_ff指令。
向量处理单元接收到vsqrti_ff指令之后,从阵列3中的0x0000位置读取x 21 2+x 61 2,对读取到的值执行vsqrti_ff指令,得到
Figure PCTCN2020078651-appb-000019
由于invert_sign=0因此不取反,而将
Figure PCTCN2020078651-appb-000020
存储在阵列4的0x0000处。随后按照对阵列3的顺序寻址模式,从阵列3中的0x0004位置读取x 31 2+x 71 2,对读取到的值执行vsqrti_ff指令,得到
Figure PCTCN2020078651-appb-000021
由于invert_sign=0因此不取反,而将
Figure PCTCN2020078651-appb-000022
存储在阵列4的0x0004处。随后按照对阵列3的顺序寻址模式,从阵列3中的0x0008位置读取x 41 2+ x 81 2,对读取到的值执行vsqrti_ff指令,得到
Figure PCTCN2020078651-appb-000023
由于invert_sign=0因此不取反,而将
Figure PCTCN2020078651-appb-000024
存储在阵列4的0x0008处。随后按照对阵列3的顺序寻址模式,从阵列3中的0x000c位置读取x 51 2+x 91 2,对读取到的值执行vsqrti_ff指令,得到
Figure PCTCN2020078651-appb-000025
由于invert_sign=0因此不取反,而将
Figure PCTCN2020078651-appb-000026
存储在阵列4的0x000c处。
在步骤5之后,阵列4中所存储的数据可以参见图12。应当注意,应当注意的是,为了简化图示,在图12中仅示出了非空的前几个存储空间,其余位置为空,未示出。
步骤6
(1)精简指令集计算机对向量处理单元进行配置。具体地配置阵列0的寻址模式为间隔寻址(Stride),起始地址为0x001c,寻址的间隔(stride_size)为7*4Byte。配置阵列4的寻址模式为顺序寻址(Linear),起始地址为0x0000。配置阵列5的寻址模式为顺序寻址(Linear),起始地址为0x0000。配置向量处理单元对即将接收到的指令进行操作的矢量长度vector_length=4,该指令重复执行的次数iteration=1,以及该指令执行的结果是否取反的取反标志invert_sign=0。在配置之后,精简指令集计算机向向量处理单元发送vmul_fff指令。
向量处理单元接收到vmul_fff指令之后,从阵列0中的0x001c位置读取x 21,从阵列4的0x0000位置读取
Figure PCTCN2020078651-appb-000027
对读取到的值执行vmul_fff指令,得到
Figure PCTCN2020078651-appb-000028
定义为
Figure PCTCN2020078651-appb-000029
由于取反标志invert_sign=0因此不取反,而将c 26存储在阵列5的0x0000处。随后按照对阵列0的间隔寻址模式,从阵列0中0x0038位置读取x 31,按照对阵列4的顺序寻址模式,从阵列4的0x0004位置读取
Figure PCTCN2020078651-appb-000030
对读取到的值执行vmul_fff指令,得到
Figure PCTCN2020078651-appb-000031
定义为
Figure PCTCN2020078651-appb-000032
Figure PCTCN2020078651-appb-000033
由于取反标志invert_sign=0因此不取反,而将c 37存储在阵列5的0x0004处。随后按照对阵列0的间隔寻址模式,再间隔7*4Byte后读取x 41,按照对阵列4的顺序寻址模式,从阵列4的0x0008位置读取
Figure PCTCN2020078651-appb-000034
对读取到的值执行vmul_fff指令,得到
Figure PCTCN2020078651-appb-000035
定义为
Figure PCTCN2020078651-appb-000036
由于取反标志invert_sign=0因此不取反,而将c 48存储在阵列5的0x0008处。随后按照对阵列0的间隔寻址模式,再间隔7*4Byte后读取x 51,按照对阵列4的顺序寻址模式,从阵列4的0x000c位置读取
Figure PCTCN2020078651-appb-000037
对读取到的值执行vmul_fff指令,得到
Figure PCTCN2020078651-appb-000038
定义为
Figure PCTCN2020078651-appb-000039
由于取反标志invert_sign=0因此不取反,而将c 59存储在阵列5的0x000c处。
(2)精简指令集计算机对向量处理单元进行配置。具体地配置阵列0的寻址模式为间隔寻址(Stride),起始地址为0x008c,寻址的间隔(stride_size)为7*4Byte。配置阵列4的寻址模式为顺序寻址(Linear),起始地址为0x0000。配置阵列5的寻址模式为顺序寻址(Linear),起始地址为0x0010。配置向量处理单元对即将接收到的指令进行操作的矢量长度vector_length=4,该指令重复执行的次数iteration=1,以及该指令执行的结果是否取反的取反标志invert_sign=1。即,需要进行取反操作。在配置之后,精简指令集计算机向向量处理单元发送vmul_fff指令。
向量处理单元接收到vmul_fff指令之后,从阵列0中的0x008c位置读取x 61,从阵列4的0x0000位置读取
Figure PCTCN2020078651-appb-000040
对读取到的值执行vmul_fff指令,得到
Figure PCTCN2020078651-appb-000041
由于取反标志invert_sign=1因此取反,并定义
Figure PCTCN2020078651-appb-000042
并将s 26存储在阵列5的0x0010处。随后按照对阵列0的间隔寻址模式,间隔7*4Byte后读取x 71,按照对阵列4的顺序寻址模式,从阵列4的0x0004位置读取
Figure PCTCN2020078651-appb-000043
对读取到的值执行vmul_fff指令,得到
Figure PCTCN2020078651-appb-000044
由于取反标志invert_sign=1 因此取反,并定义
Figure PCTCN2020078651-appb-000045
并将s 37存储在阵列5的0x0014处。随后按照对阵列0的间隔寻址模式,再间隔7*4Byte后读取x 81,按照对阵列4的顺序寻址模式,从阵列4的0x0008位置读取
Figure PCTCN2020078651-appb-000046
对读取到的值执行vmul_fff指令,得到
Figure PCTCN2020078651-appb-000047
由于取反标志invert_sign=1因此取反,并定义
Figure PCTCN2020078651-appb-000048
并将s 48存储在阵列5的0x0018处。随后按照对阵列0的间隔寻址模式,再间隔7*4Byte后读取x 91,按照对阵列4的顺序寻址模式,从阵列4的0x000c位置读取
Figure PCTCN2020078651-appb-000049
对读取到的值执行vmul_fff指令,得到
Figure PCTCN2020078651-appb-000050
由于取反标志invert_sign=1因此取反,并定义
Figure PCTCN2020078651-appb-000051
并将s 59存储在阵列5的0x001c处。
在步骤6之后,阵列5中所存储的数据可以参见图13。应当注意,应当注意的是,为了简化图示,在图13中仅示出了非空的前几个存储空间,其余位置为空,未示出。
步骤7,
(1)精简指令集计算机对向量处理单元进行配置。具体地配置阵列0的寻址模式为顺序寻址(Linear),起始地址为0x001c。配置阵列5的寻址模式为顺序寻址(Linear),起始地址为0x0000。配置阵列1的寻址模式为顺序寻址(Linear),起始地址为0x0000。配置向量处理单元对即将接收到的指令进行操作的矢量长度vector_length=7,该指令重复执行的次数iteration=4,以及该指令执行的结果是否取反invert_sign=0。在配置之后,精简指令集计算机向向量处理单元发送vmuls_fff指令。
向量处理单元接收到vmuls_fff指令之后,从阵列0的0x001c位置开始读取向量,从阵列5的0x0000位置读取标量,对读取到的值执行vmuls_fff指令,结果不取反并存储在阵列1中。并且按照iteration=4将指令重复执行4次。
通过该过程能够计算得到c 26[x 21 … x 27],c 37[x 31 … x 37],c 48[x 41 … x 47],c 59[x 51 … x 57]。
(2)精简指令集计算机对向量处理单元进行配置。具体地配置阵列0的寻址模式为顺序寻址(Linear),起始地址为0x001c。配置阵列5的寻址模式为顺序寻址(Linear),起始地址为0x0010。配置阵列3的寻址模式为顺序寻址(Linear),起始地址为0x0000。配置向量处理单元对即将接收到的指令进行操作的矢量长度vector_length=7,该指令重复执行的次数iteration=4,以及该指令执行的结果是否取反的取反操作invert_sign=0。在配置之后,精简指令集计算机向向量处理单元发送vmuls_fff指令。
向量处理单元接收到vmuls_fff指令之后,从阵列0的0x001c位置开始读取向量,从阵列5的0x0010位置读取标量,对读取到的值执行vmuls_fff指令,结果不取反并存储在阵列3中。并且按照iteration=4将指令重复执行4次。
通过该过程能够计算得到s 26[x 21 … x 27],s 37[x 31 … x 37],s 48[x 41 … x 47],s 59[x 51 … x 57]。
(3)精简指令集计算机对向量处理单元进行配置。具体地配置阵列0的寻址模式为顺序寻址(Linear),起始地址为0x008c。配置阵列5的寻址模式为顺序寻址(Linear),起始地址为0x0010。配置阵列2的寻址模式为顺序寻址(Linear),起始地址为0x0000。配置向量处理单元对即将接收到的指令进行操作的矢量长度vector_length=7,该指令重复执行的次数iteration=4,以及该指令执行的结果是否取反的取反操作invert_sign=1。在配置之后,精简指令集计算机向向量处理单元发送vmuls_fff指令。
向量处理单元接收到vmuls_fff指令之后,从阵列0的0x008c位置开始读取向量,从阵列5的0x0010位置读取标量,对读取到的值执行vmuls_fff指令,结果取反并存储在阵列2中。并且按照iteration=4将指令重复执行 4次。
通过该过程能够计算得到-s 26[x 61 … x 67],-s 37[x 71 … x 77],-s 48[x 81 … x 87],-s 59[x 91 … x 97]。
(4)精简指令集计算机对向量处理单元进行配置。具体地配置阵列0的寻址模式为顺序寻址(Linear),起始地址为0x008c。配置阵列5的寻址模式为顺序寻址(Linear),起始地址为0x0000。配置阵列4的寻址模式为顺序寻址(Linear),起始地址为0x0000。配置向量处理单元对即将接收到的指令进行操作的矢量长度vector_length=7,该指令重复执行的次数iteration=4,以及该指令执行的结果是否取反的取反操作invert_sign=0。在配置之后,精简指令集计算机向向量处理单元发送vmuls_fff指令。
向量处理单元接收到vmuls_fff指令之后,从阵列0的0x008c位置开始读取向量,从阵列5的0x0000位置读取标量,对读取到的值执行vmuls_fff指令,结果不取反并存储在阵列4中。并且按照iteration=4将指令重复执行4次。
通过该过程能够计算得到c 26[x 61 … x 67],c 37[x 71 … x 77],c 48[x 81 … x 87],c 59[x 91 … x 97]。
本发明实施例中,步骤7可以被理解为是矢量迭代化的过程。在该步骤中矢量迭代的次数为4,但是该精简指令集计算机只需配置启动1次向量处理单元,而不需要配置启动4次向量处理单元。
在步骤7中,阵列1至阵列4中所存储的数据都已经发生改变,出于简化的目的,不再在附图中逐一示出。
步骤8,
(1)精简指令集计算机对向量处理单元进行配置。具体地配置阵列1的寻址模式为顺序寻址(Linear),起始地址为0x0000。配置阵列2的寻址模式为顺序寻址(Linear),起始地址为0x0000。配置阵列0的寻址模式为顺序寻 址(Linear),起始地址为0x0010。配置向量处理单元对即将接收到的指令进行操作的矢量长度vector_length=7,该指令重复执行的次数iteration=4,以及该指令执行的结果是否取反的的取反操作invert_sign=0。在配置之后,精简指令集计算机向向量处理单元发送vadd_fff指令。
向量处理单元接收到vadd_fff指令之后,从阵列1的0x0000位置开始数据,从阵列2的0x0000位置读取数据,对读取到的值执行vadd_fff指令,结果不取反并存储在阵列0中。通过该步骤,实现了[y 21 … y 27]=c 26[x 21 … x 27]-s 26[x 61 … x 67],即阵列0中的[x 21 … x 27]被替换替换为[y 21 … y 27]。
并且按照iteration=4将指令重复执行4次。从而能够实现将阵列0中的[x 31 … x 37]被替换为:
[y 31 … y 37]=c 37[x 31 … x 37]-s 37[x 71 … x 77],
[x 41 … x 47]被替换为:
[y 41 … y 47]=c 48[x 41 … x 47]-s 48[x 81 … x 87],
[x 51 … x 57]被替换为:
[y 51 … y 57]=c 59[x 51 … x 57]-s 59[x 91 … x 97]。
(2)精简指令集计算机对向量处理单元进行配置。具体地配置阵列3的寻址模式为顺序寻址(Linear),起始地址为0x0000。配置阵列4的寻址模式为顺序寻址(Linear),起始地址为0x0000。配置阵列0的寻址模式为顺序寻址(Linear),起始地址为0x008c。配置向量处理单元对即将接收到的指令进行操作的矢量长度vector_length=7,该指令重复执行的次数iteration=4,以及该指令执行的结果是否取反的取反标志invert_sign=0。在配置之后,精简指令集计算机向向量处理单元发送vadd_fff指令。
向量处理单元接收到vadd_fff指令之后,从阵列3的0x0000位置开始数 据,从阵列4的0x0000位置读取数据,对读取到的值执行vadd_fff指令,结果不取反并存储在阵列0中。通过该步骤,实现了[y 61 … y 67]=s 26[x 21 … x 27]+c 26[x 61 … x 67],即阵列0中的[x 21 … x 27]被替换替换为[y 21 … y 27]。
并且按照iteration=4将指令重复执行4次。从而能够实现将阵列0中的[x 71 … x 77]被替换为:
[y 71 … y 77]=s 37[x 31 … x 37]+c 37[x 71 … x 77],
[x 81 … x 87]被替换为:
[y 81 … y 87]=s 48[x 41 … x 47]+c 48[x 81 … x 87],
[x 91 … x 97]被替换为:
[y 91 … y 97]=s 59[x 51 … x 57]+c 59[x 91 … x 97]。
这样,通过上述的步骤1至步骤8,完成了针对第1列的第1次迭代,将x 61,x 71,x 81和x 91这4个元素同时消零。
在完成针对第1列的第1次迭代之后,第1列中待消零的元素只剩下4个,即第1列第2行至第5行的元素。在针对第1列的第2次迭代中,可以同时将2个元素消零,例如可以同时将第4行和第5行的元素消零,该过程类似于上述第1次迭代中的上述步骤1至步骤8,这里不再赘述。
以上结合图8至图13描述了对9×7的数据矩阵进行消零的过程在数字信号处理器上的实现方式。但是可理解的是,可以针对任何大小M×N的数据矩阵进行消零的过程。可以按照从左到右,从下往上的顺序进行消零。从左往右是指先针对第1列进行消零处理,再针对第2列进行消零处理,。。。。。。最后针对第N列进行消零处理。而在针对某一列进行消零处理时,可以先将多个待消零元素的行数较大的那一半消零,再将剩余的待消零元素中行数较 大的一半消零,直至该列的所有待消零元素均被进行消零处理。可理解的是,不同的列中待消零的元素的数量是不同的,至少针对第1列的消零处理的迭代的次数小于第1列中待消零的元素的数量。
作为一种实现方式,通过如结合图8至图13所示的消零处理的过程,可以较优地更快地完成消零处理。针对如S120中的M×N的数据矩阵,精简指令集计算机上分发指令占用的时钟周期(clock cycle)的个数为:
Figure PCTCN2020078651-appb-000052
而在向量处理单元上占用的时钟周期(clock cycle)的个数为:
Figure PCTCN2020078651-appb-000053
如图14示出的是针对不同大小的数据矩阵,本发明实施例的方法占用的时钟周期与传统技术占用的时钟周期的比值。该图的纵坐标表示该比值,横坐标表示矩阵的列数N,且图中示出了针对5个不同的M(即M=100,200,300,400,500)的比值。从图14中可以看出在矩阵列数N较小时,本发明实施例的方法相比于传统方法有显著优势,在矩阵列数N较大时,本发明实施例的方法仍优于传统方法。考虑到在因为精简指令集计算机上的时钟周期(clock cycle)数是低估的,因此在实际应用中,采用本发明实施例的方法对于吉文斯旋转算法性能的提升会远远优于上图。
可见,相对于逐个元素进行消零处理的已有技术,本发明实施例的数据处理的方法能够极大地减小处理量,提升处理速度。并且在该过程中,减小了对向量存储器的空间占用,保证了传感器测量数据的存储。
另外,本发明实施例还提供了一种数据处理的装置,该装置可以包括:接收模块、构建模块和处理模块。其中,
接收模块,用于接收由传感器获取的测量数据;
构建模块,用于根据测量数据构建数据矩阵,数据矩阵为M行N列矩 阵,M和N均为正整数;
处理模块,用于确定关于数据矩阵的吉文斯变换矩阵;
处理模块,还用于利用吉文斯变换矩阵,对数据矩阵进行吉文斯变换,以使得位于数据矩阵的同一列上的至少两个数值同时消零;
处理模块,还用于根据吉文斯变换矩阵对测量数据进行数据处理。
应当注意的是,接收模块、构建模块和处理模块可以是各自独立的模块,或者可以被集成在一个整体中。举例来说,处理模块可以为如图2所示的数字信号处理器。举例来说,接收模块、构建模块和处理模块共同构建为如图2所示的数字信号处理器。
在一个实施例中,传感器为相机;测量数据为相机拍摄的图像的像素;数据处理为关于像素的数据处理。其中,传感器可以为该装置的外部部件,或者,该装置可以包括传感器。
在一个实施例中,处理模块可以被配置用于:将测量数据分解为多个子数据单元;对多个子数据单元进行数据处理。
在一个实施例中,还包括存储模块可以用于:存储吉文斯变换矩阵,其中,吉文斯变换矩阵所占用的存储空间小于数据矩阵所需的存储空间。作为一例,该存储模块可以如图3中所示的向量存储器。
在一个实施例中,处理模块可以用于:通过吉文斯变换,将数据矩阵按照从左到右的顺序进行逐列地消零。
在一个实施例中,针对数据矩阵的第i列,按照从下往上的顺序,通过P次迭代处理完成消零,其中i的取值范围为1至N。
在一个实施例中,P次迭代处理中的第p次迭代处理消零的个数是第p-1次迭代处理消零的个数的一半,其中p的取值范围为1至P。
在一个实施例中,处理模块用于:针对数据矩阵的第i列进行的P次迭代处理中的当前迭代处理包括:确定第一集合和第二集合,其中所述第一集 合包括所述第i列中的所述当前迭代处理同时消零的至少两个数值,所述第二集合包括所述第i列中的所述当前迭代处理不进行消零的数值;从所述第一集合选择第一数值,以及从所述第二集合中选择第二数值,利用所述第一数值和所述第二数值得到关于对所述第一数值进行消零操作的吉文斯参数,以对所述第一数值进行消零处理;其中,在对所述第i列上的所述至少两个数值进行同时消零的一次计算中,所述第一数值和所述第二数值仅被用于所述至少两个数值中的一个数值的消零操作。
在一个实施例中,假设第一数值为x1,第二数值为x2,那么对第一数值进行消零操作的吉文斯参数满足:
Figure PCTCN2020078651-appb-000054
在一个实施例中,针对数据矩阵的第i列,P次迭代处理中的第1次迭代处理用于将第i列的最后
Figure PCTCN2020078651-appb-000055
行的数值同时消零。
在一个实施例中,第二数值为第i列的第j行的数值,第一数值为第i列的第
Figure PCTCN2020078651-appb-000056
行的数值,其中,j的取值范围为
Figure PCTCN2020078651-appb-000057
Figure PCTCN2020078651-appb-000058
在一个实施例中,处理模块可以包括精简指令集计算机、向量处理单元和向量存储器,其中:精简指令集计算机配置向量处理单元,并向向量处理单元发送指令;向量处理单元根据配置从向量存储器读取数值,根据指令对所读取的数值进行计算,并将结果写入向量存储器。
在一个实施例中,精简指令集计算机配置向量处理单元包括配置向量处理单元的如下信息:指令操作的矢量长度、指令重复执行的次数、指令执行的结果是否取反。
在一个实施例中,向量存储器包括6个不同的存储阵列,6个不同的存储阵列中的第一阵列用于存储数据矩阵,还用于存储吉文斯变换矩阵,6个不同的存储阵列中的第二阵列至第六阵列用于存储进行吉文斯变换的中间参数。
在一个实施例中,指令包括用于执行以下至少一个运算的指令:平方运算、求和运算、求差运算、倒数运算、乘积运算。
在一个实施例中,该装置可以为云台、移动电话、手持计算机、可穿戴设备等,相机可以装载在该装置上,以可拆卸的方式或者固接的方式等等。
可理解的是,该装置可以实现前述的数据处理的方法,具体地可以参见前面结合图3的数字信号处理器所描述的数据处理的方法。
本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本发明的范围。
另外,本发明实施例还提供了一种计算机存储介质,其上存储有计算机程序。当所述计算机程序由处理器执行时,可以实现前述图5所示的数据处理的方法的步骤。例如,该计算机存储介质为计算机可读存储介质。
在一个实施例中,所述计算机程序指令在被计算机或处理器运行时使计算机或处理器执行以下步骤:接收由传感器获取的测量数据;根据所述测量数据构建数据矩阵,所述数据矩阵为M行N列矩阵,M和N均为正整数;确定关于所述数据矩阵的吉文斯变换矩阵;利用所述吉文斯变换矩阵,对所述数据矩阵进行吉文斯变换,以使得位于所述数据矩阵的同一列上的至少两个数值同时消零;根据所述吉文斯变换矩阵对所述测量数据进行数据处理。
计算机存储介质例如可以包括智能电话的存储卡、平板电脑的存储部件、个人计算机的硬盘、只读存储器(ROM)、可擦除可编程只读存储器(EPROM)、便携式紧致盘只读存储器(CD-ROM)、USB存储器、或者上述存储介质的任意组合。计算机可读存储介质可以是一个或多个计算机可读存储介质的任意组合。
另外,本发明实施例还提供了一种计算机程序产品,其包含指令,当该指令被计算机所执行时,使得计算机执行上述图5等所示的数据处理的方法的步骤。
在一个实施例中,当该指令被计算机所执行时,使得计算机执行:接收由传感器获取的测量数据;根据所述测量数据构建数据矩阵,所述数据矩阵为M行N列矩阵,M和N均为正整数;确定关于所述数据矩阵的吉文斯变换矩阵;利用所述吉文斯变换矩阵,对所述数据矩阵进行吉文斯变换,以使得位于所述数据矩阵的同一列上的至少两个数值同时消零;根据所述吉文斯变换矩阵对所述测量数据进行数据处理。
由此可见,本发明实施例在对由传感器采集的测量数据进行数据处理时,可以通过吉文斯旋转将数据矩阵中的部分元素进行消零处理,其中,至少存在一个迭代将至少两个元素同时消零,相对于逐个元素进行消零处理的已有技术,本发明实施例的数据处理的方法能够极大地减小处理量,提升处理速度。并且在该过程中,减小了对向量存储器的空间占用,保证了传感器测量数据的存储。
在上述实施例中,可以全部或部分地通过软件、硬件、固件或者其他任意组合来实现。当使用软件实现时,可以全部或部分地以计算机程序产品的形式实现。所述计算机程序产品包括一个或多个计算机指令。在计算机上加载和执行所述计算机程序指令时,全部或部分地产生按照本发明实施例所述的流程或功能。所述计算机可以是通用计算机、专用计算机、计算机网络、或者其他可编程装置。所述计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一个计算机可读存储介质传输,例如,所述计算机指令可以从一个网站站点、计算机、服务器或数据中心通过有线(例如同轴电缆、光纤、数字用户线(digital subscriber line,DSL))或无线(例如红外、无线、微波等)方式向另一个网站站点、计算机、服务器或数据中心进 行传输。所述计算机可读存储介质可以是计算机能够存取的任何可用介质或者是包含一个或多个可用介质集成的服务器、数据中心等数据存储设备。所述可用介质可以是磁性介质(例如,软盘、硬盘、磁带)、光介质(例如数字视频光盘(digital video disc,DVD))、或者半导体介质(例如固态硬盘(solid state disk,SSD))等。
本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。
在本申请所提供的几个实施例中,应该理解到,所揭露的系统、装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。
另外,在本申请各个实施例中的各功能单元可以集成在一个处理器中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。
以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限 于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以所述权利要求的保护范围为准。

Claims (31)

  1. 一种数据处理的方法,其特征在于,所述方法包括:
    接收由传感器获取的测量数据;
    根据所述测量数据构建数据矩阵,所述数据矩阵为M行N列矩阵,M和N均为正整数;
    确定关于所述数据矩阵的吉文斯变换矩阵;
    利用所述吉文斯变换矩阵,对所述数据矩阵进行吉文斯变换,以使得位于所述数据矩阵的同一列上的至少两个数值同时消零;
    根据所述吉文斯变换矩阵对所述测量数据进行数据处理。
  2. 根据权利要求1所述的方法,其特征在于,所述根据所述吉文斯变换矩阵对所述测量数据进行数据处理,包括:
    将所述测量数据分解为多个子数据单元;
    对所述多个子数据单元进行数据处理。
  3. 根据权利要求1或2所述的方法,其特征在于,还包括:
    存储所述吉文斯变换矩阵,其中,所述吉文斯变换矩阵所占用的存储空间小于所述数据矩阵所需的存储空间。
  4. 根据权利要求1至3中任一项所述的方法,其特征在于,进一步包括:
    通过所述吉文斯变换,将所述数据矩阵按照从左到右的顺序进行逐列地消零。
  5. 根据权利要求4所述的方法,其特征在于,针对所述数据矩阵的第i列,按照从下往上的顺序,通过P次迭代处理完成消零,其中i的取值范围为1至N。
  6. 根据权利要求5所述的方法,其特征在于,
    所述P次迭代处理中的第p次迭代处理消零的个数是第p-1次迭代处理消零的个数的一半,其中p的取值范围为1至P。
  7. 根据权利要求5所述的方法,其特征在于,针对所述数据矩阵的第i列进行的所述P次迭代处理中的当前迭代处理包括:
    确定第一集合和第二集合,其中所述第一集合包括所述第i列中的所述当前迭代处理同时消零的至少两个数值,所述第二集合包括所述第i列中的所述当前迭代处理不进行消零的数值;
    从所述第一集合选择第一数值,以及从所述第二集合中选择第二数值,利用所述第一数值和所述第二数值得到关于对所述第一数值进行消零操作的吉文斯参数,以对所述第一数值进行消零处理;
    其中,在对所述第i列上的所述至少两个数值进行同时消零的一次计算中,所述第一数值和所述第二数值仅被用于所述至少两个数值中的一个数值的消零操作。
  8. 根据权利要求7所述的方法,其特征在于,假设所述第一数值为x1,所述第二数值为x2,那么对所述第一数值进行消零操作的吉文斯参数满足:
    Figure PCTCN2020078651-appb-100001
  9. 根据权利要求7或8所述的方法,其特征在于,针对所述第i列,所述P次迭代处理中的第1次迭代处理用于将所述第i列的最后
    Figure PCTCN2020078651-appb-100002
    行的数值同时消零。
  10. 根据权利要求9所述的方法,其特征在于,
    所述第二数值为所述第i列的第j行的数值,所述第一数值为所述第i列的第
    Figure PCTCN2020078651-appb-100003
    行的数值,其中,j的取值范围为
    Figure PCTCN2020078651-appb-100004
    Figure PCTCN2020078651-appb-100005
  11. 根据权利要求1至10中任一项所述的方法,其特征在于,对所述数据矩阵进行吉文斯变换,得到所述数据矩阵的吉文斯变换矩阵,包括:
    精简指令集计算机配置向量处理单元,并向所述向量处理单元发送指令;
    所述向量处理单元根据所述配置从向量存储器读取数值,根据所述指令对所读取的数值进行计算,并将结果写入所述向量存储器。
  12. 根据权利要求11所述的方法,其特征在于,所述配置向量处理单元包括配置所述向量处理单元的如下信息:
    所述指令操作的矢量长度、所述指令重复执行的次数、所述指令执行的结果是否取反。
  13. 根据权利要求11或12所述的方法,其特征在于,所述向量存储器包括6个不同的存储阵列,
    所述6个不同的存储阵列中的第一阵列用于存储所述数据矩阵,
    所述6个不同的存储阵列中的第二阵列至第六阵列用于存储进行吉文斯变换的中间参数。
  14. 根据权利要求11至13中任一项所述的方法,其特征在于,所述指令包括用于执行以下至少一个运算的指令:平方运算、求和运算、求差运算、倒数运算、乘积运算。
  15. 根据权利要求1至14中任一项所述的方法,其特征在于,
    所述传感器为相机;
    所述测量数据为所述相机拍摄的图像的像素;
    所述数据处理为关于像素的数据处理。
  16. 一种数据处理的装置,其特征在于,所述装置包括:
    接收模块,用于接收由传感器获取的测量数据;
    构建模块,用于根据所述测量数据构建数据矩阵,所述数据矩阵为M行N列矩阵,M和N均为正整数;
    处理模块,用于确定关于所述数据矩阵的吉文斯变换矩阵;
    所述处理模块,还用于利用所述吉文斯变换矩阵,对所述数据矩阵进行吉文斯变换,以使得位于所述数据矩阵的同一列上的至少两个数值同时消零;
    所述处理模块,还用于根据所述吉文斯变换矩阵对所述测量数据进行数据处理。
  17. 根据权利要求16所述的装置,其特征在于,所述处理模块,还用于:
    将所述测量数据分解为多个子数据单元;
    对所述多个子数据单元进行数据处理。
  18. 根据权利要求16或17所述的装置,其特征在于,还包括存储模块,用于:
    存储所述吉文斯变换矩阵,其中,所述吉文斯变换矩阵所占用的存储空间小于所述数据矩阵所需的存储空间。
  19. 根据权利要求16至18中任一项所述的装置,其特征在于,所述处理模块,用于:
    通过所述吉文斯变换,将所述数据矩阵按照从左到右的顺序进行逐列地消零。
  20. 根据权利要求19所述的装置,其特征在于,针对所述数据矩阵的第i列,按照从下往上的顺序,通过P次迭代处理完成消零,其中i的取值范围为1至N。
  21. 根据权利要求20所述的装置,其特征在于,
    所述P次迭代处理中的第p次迭代处理消零的个数是第p-1次迭代处理消零的个数的一半,其中p的取值范围为1至P。
  22. 根据权利要求20所述的装置,其特征在于,所述处理模块,用于:
    针对所述数据矩阵的第i列进行的所述P次迭代处理中的当前迭代处理包括:
    确定第一集合和第二集合,其中所述第一集合包括所述第i列中的所述当前迭代处理同时消零的至少两个数值,所述第二集合包括所述第i列中的所述当前迭代处理不进行消零的数值;
    从所述第一集合选择第一数值,以及从所述第二集合中选择第二数值,利用所述第一数值和所述第二数值得到关于对所述第一数值进行消零操作的吉文斯参数,以对所述第一数值进行消零处理;
    其中,在对所述第i列上的所述至少两个数值进行同时消零的一次计算 中,所述第一数值和所述第二数值仅被用于所述至少两个数值中的一个数值的消零操作。
  23. 根据权利要求22所述的装置,其特征在于,假设所述第一数值为x1,所述第二数值为x2,那么对所述第一数值进行消零操作的吉文斯参数满足:
    Figure PCTCN2020078651-appb-100006
  24. 根据权利要求22或23所述的装置,其特征在于,针对所述第i列,所述P次迭代处理中的第1次迭代处理用于将所述第i列的最后
    Figure PCTCN2020078651-appb-100007
    行的数值同时消零。
  25. 根据权利要求24所述的装置,其特征在于,
    所述第二数值为所述第i列的第j行的数值,所述第一数值为所述第i列的第
    Figure PCTCN2020078651-appb-100008
    行的数值,其中,j的取值范围为
    Figure PCTCN2020078651-appb-100009
    Figure PCTCN2020078651-appb-100010
  26. 根据权利要求16至25中任一项所述的装置,其特征在于,所述处理模块包括精简指令集计算机、向量处理单元和向量存储器,其中:
    所述精简指令集计算机配置所述向量处理单元,并向所述向量处理单元发送指令;
    所述向量处理单元根据所述配置从所述向量存储器读取数值,根据所述指令对所读取的数值进行计算,并将结果写入所述向量存储器。
  27. 根据权利要求26所述的装置,其特征在于,所述精简指令集计算机配置向量处理单元包括配置所述向量处理单元的如下信息:
    所述指令操作的矢量长度、所述指令重复执行的次数、所述指令执行的结果是否取反。
  28. 根据权利要求26或27所述的装置,其特征在于,所述向量存储器包括6个不同的存储阵列,
    所述6个不同的存储阵列中的第一阵列用于存储所述数据矩阵,还用于 存储所述吉文斯变换矩阵,
    所述6个不同的存储阵列中的第二阵列至第六阵列用于存储进行吉文斯变换的中间参数。
  29. 根据权利要求16至28中任一项所述的装置,其特征在于,所述指令包括用于执行以下至少一个运算的指令:平方运算、求和运算、求差运算、倒数运算、乘积运算。
  30. 根据权利要求16至29中任一项所述的装置,其特征在于,
    所述传感器为相机;
    所述测量数据为所述相机拍摄的图像的像素;
    所述数据处理为关于像素的数据处理。
  31. 一种计算机存储介质,其上存储有计算机程序,其特征在于,所述计算机程序被处理器执行时实现权利要求1至15中任一项所述方法的步骤。
PCT/CN2020/078651 2020-03-10 2020-03-10 数据处理的方法、装置及计算机存储介质 WO2021179175A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
PCT/CN2020/078651 WO2021179175A1 (zh) 2020-03-10 2020-03-10 数据处理的方法、装置及计算机存储介质
CN202080006517.5A CN113168432A (zh) 2020-03-10 2020-03-10 数据处理的方法、装置及计算机存储介质

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2020/078651 WO2021179175A1 (zh) 2020-03-10 2020-03-10 数据处理的方法、装置及计算机存储介质

Publications (1)

Publication Number Publication Date
WO2021179175A1 true WO2021179175A1 (zh) 2021-09-16

Family

ID=76879288

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/078651 WO2021179175A1 (zh) 2020-03-10 2020-03-10 数据处理的方法、装置及计算机存储介质

Country Status (2)

Country Link
CN (1) CN113168432A (zh)
WO (1) WO2021179175A1 (zh)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6636561B1 (en) * 1999-06-29 2003-10-21 Nortel Networks Limited Channel equalisers
CN103501212A (zh) * 2013-09-30 2014-01-08 上海交通大学 一种mimo预编码技术的奇异值分解方法及装置
CN104298649A (zh) * 2014-09-24 2015-01-21 江苏中兴微通信息科技有限公司 一种低复杂度的快速并行矩阵求逆方法
US20170238014A1 (en) * 2016-02-15 2017-08-17 Qualcomm Incorporated Efficient parameter storage for compact multi-pass tranforms
CN108605142A (zh) * 2016-02-15 2018-09-28 高通股份有限公司 用于视频译码的多遍不可分开的变换
CN108809389A (zh) * 2018-04-20 2018-11-13 东南大学 基于Givens旋转矩阵复用的QR分解块对角化预编码实现方法

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108809289A (zh) * 2017-05-04 2018-11-13 上海信索传感器有限公司 一种智能手势开关

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6636561B1 (en) * 1999-06-29 2003-10-21 Nortel Networks Limited Channel equalisers
CN103501212A (zh) * 2013-09-30 2014-01-08 上海交通大学 一种mimo预编码技术的奇异值分解方法及装置
CN104298649A (zh) * 2014-09-24 2015-01-21 江苏中兴微通信息科技有限公司 一种低复杂度的快速并行矩阵求逆方法
US20170238014A1 (en) * 2016-02-15 2017-08-17 Qualcomm Incorporated Efficient parameter storage for compact multi-pass tranforms
CN108605142A (zh) * 2016-02-15 2018-09-28 高通股份有限公司 用于视频译码的多遍不可分开的变换
CN108809389A (zh) * 2018-04-20 2018-11-13 东南大学 基于Givens旋转矩阵复用的QR分解块对角化预编码实现方法

Also Published As

Publication number Publication date
CN113168432A (zh) 2021-07-23

Similar Documents

Publication Publication Date Title
US11449576B2 (en) Convolution operation processing method and related product
CN107832843B (zh) 一种信息处理方法及相关产品
US9411726B2 (en) Low power computation architecture
WO2022037257A1 (zh) 卷积计算引擎、人工智能芯片以及数据处理方法
WO2017185391A1 (zh) 一种用于执行卷积神经网络训练的装置和方法
WO2019127838A1 (zh) 卷积神经网络实现方法及装置、终端、存储介质
CN111338695B (zh) 基于流水线技术的数据处理方法及相关产品
CN108388527B (zh) 直接存储器存取引擎及其方法
WO2019215907A1 (ja) 演算処理装置
US12050985B2 (en) Arithmetic processing device
CN112799599B (zh) 一种数据存储方法、计算核、芯片和电子设备
CN111353591A (zh) 一种计算装置及相关产品
CN115880132A (zh) 图形处理器、矩阵乘法任务处理方法、装置及存储介质
CN111028136B (zh) 一种人工智能处理器处理二维复数矩阵的方法和设备
CN114764615A (zh) 卷积运算的实现方法、数据处理方法及装置
CN109711540B (zh) 一种计算装置及板卡
CN112765540A (zh) 数据处理方法、装置及相关产品
WO2021168644A1 (zh) 数据处理装置、电子设备和数据处理方法
WO2021179175A1 (zh) 数据处理的方法、装置及计算机存储介质
KR20220134035A (ko) 컨볼루션 연산을 위한 프로세싱 인 메모리 방법
WO2023131252A1 (zh) 基于数据流架构的图像尺寸调整结构、调整方法及图像缩放方法和装置
CN109740730B (zh) 运算方法、装置及相关产品
CN111914988A (zh) 神经网络设备、计算系统和处理特征图的方法
CN111931937B (zh) 图像处理模型的梯度更新方法、装置及系统
CN114330669B (zh) 一种面向向量处理器的半精度向量化conv1×1卷积方法及系统

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20924655

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20924655

Country of ref document: EP

Kind code of ref document: A1