Image processing method, device, computer equipment and storage medium
By combining multiple image data to be processed into a target image and processing it using a multiplier-accumulator array, the problem of low utilization of the multiplier-accumulator array in the convolutional neural network is solved and the efficiency of image processing is improved.
Patent Information
- Application Number
- CN202110132579.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-01-31
- Publication Date
- 2024-09-13
- Estimated Expiration
- 2041-01-31
AI Technical Summary
The utilization rate of the multiplier-accumulator array in the existing convolutional neural network is low, resulting in a waste of computing resources and low processing efficiency of the image data to be processed.
By combining pixels of multiple image data to be processed, a target image is generated, and a multiplier-accumulator array is used to process the target image, thereby improving the utilization of the multiplier-accumulator array, reducing waste of computing resources, and improving processing efficiency.
The utilization rate of the multiplier-accumulator array is improved, the waste of computing resources is reduced, the processing efficiency of the image data to be processed is improved, and more efficient image processing is achieved.
Smart Images

Figure CN112967211B
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and in particular to an image processing method, apparatus, computer equipment and storage medium. Background Art
[0002] At present, convolutional neural networks mainly rely on multiplier arrays to perform convolution processing. The multiplier array stores the data to be processed in the data matrix in the corresponding register array. The data to be processed moves in the register array in different data processing cycles. However, the current data processing method has the problems of low utilization of the multiplier array and waste of computing resources. Summary of the invention
[0003] The embodiments of the present disclosure at least provide an image processing method, apparatus, computer equipment, and storage medium.
[0004] In a first aspect, an embodiment of the present disclosure provides an image processing method, including:
[0005] Perform pixel combination processing on multiple image data to be processed to obtain a target image; use a multiplier-adder array to process the target image; and determine the processing result of each image data to be processed based on the processing results obtained by the multipliers and adders corresponding to the multiple image data in the multiplier-adder array.
[0006] In this way, based on combining multiple image data to be processed into a target image, the size of the obtained target image is larger than the size of each image data to be processed in the multiple image data to be processed. In the process of using the multiplier array to process the target image, the multiplier array actually processes multiple image data to be processed at the same time, and more multipliers in the multiplier array can be used, thereby improving the utilization rate of the multiplier array, reducing the waste of computing resources, and improving the processing efficiency of the image data to be processed.
[0007] In a possible implementation, in the same row of the target image, the number of pixels between two adjacent pixels of the same image data to be processed is the same and not zero, and in the same column of the target image, the number of pixels between two adjacent pixels of the same image data to be processed is the same and not zero.
[0008] In this way, the arrangement rules of the pixels of multiple image data to be processed in the target image can ensure that the multiplier array obtains the correct processing result corresponding to each image data to be processed when processing the target image, thereby improving the processing efficiency of the image data to be processed.
[0009] In a possible implementation, the method further includes: determining the amount of the image data to be processed based on the size information of the multiplier-adder array and the size information of the image data to be processed.
[0010] In this way, based on the size information of the multiplier-adder array and the size information of each image data to be processed, the number of image data to be processed that the multiplier-adder array can simultaneously process can be determined, thereby improving the utilization efficiency of the multiplier-adder array while ensuring the accuracy of the processing results of the multiplier-adder array on the image data to be processed.
[0011] In a possible implementation, the size information includes the number of rows and the number of columns; determining the amount of the image data to be processed based on the size information of the multiplier array and the size information of the image data to be processed includes: determining a first value based on the number of rows of the multiplier array and the number of rows of the image data to be processed, and determining a second value based on the number of columns of the multiplier array and the number of columns of the image data to be processed; determining the amount of the image data to be processed based on the first value and the second value.
[0012] In a possible implementation, the pixel combination processing of multiple image data to be processed to obtain a target image includes: taking each of the multiple image data to be processed as a current image in turn, and determining the target position of the first pixel point of the current image in the target image; based on the target position of the first pixel point in the target image, determining the target positions of other pixel points in the current image except the first pixel point in the target image to obtain the target image.
[0013] In this way, after the target position of the first pixel point of each image data to be processed in the target image is determined, the target positions of other pixel points in each image data to be processed except the first pixel point in the target image can be determined based on the target position of the first pixel point of each image data to be processed in the target image, thereby improving the efficiency of obtaining the target image.
[0014] In a possible implementation, the determining the target positions of other pixels in the current image except the first pixel in the target image based on the target position of the first pixel in the target image includes: determining a first positional relationship between each pixel in each row of the current image except the first pixel in the row and an adjacent previous pixel of the pixel in the target image based on the target position of the first pixel in the current image, the number of columns of the multiplier array, and the number of columns of the current image; determining a second positional relationship between each pixel in each column of the current image except the first pixel in the column and an adjacent previous pixel of the pixel in the target image based on the target position of the first pixel in the current image, the number of rows of the multiplier array, and the number of rows of the current image; and determining the target positions of other pixels in the current image except the first pixel in the target image based on the first positional relationship and / or the second positional relationship.
[0015] In a possible implementation, determining the target position of the first pixel point of the current image in the target image includes: determining the target pixel matrix based on the number of rows and columns of the multiplier array and the number of rows and columns of the image data to be processed; determining the target position of the first pixel point of each image data to be processed in the target image according to the matrix element values of the target pixel matrix; wherein the target position of the first pixel point of the current image in the target image is any target position among the determined target positions.
[0016] In a possible implementation, the processing of the target image using a multiplier-adder array includes: storing the target image in the register array based on the correspondence between the multiplier-adder array and the register array; wherein the adjacent relationship of each pixel point of the target image stored in the register array remains unchanged; in each data processing cycle of multiple data processing cycles, reading pixel information corresponding to each data processing cycle from the register array using the multiplier-adder array, and processing the read pixel information to obtain a data processing result corresponding to each processing cycle.
[0017] In this way, the multiplier-adder array ensures the validity of the processing result of each image data to be processed by reading the corresponding pixel information in different data processing cycles.
[0018] In a possible implementation, in each data processing cycle of the plurality of data processing cycles, the multiplier array is used to read pixel information corresponding to the data processing cycle from the register array, and the read pixel information is processed to obtain a data processing result corresponding to each processing cycle, including: in the first data processing cycle of processing the target image, controlling each multiplier in the multiplier array whose corresponding register stores the pixel information of the target image, reading the pixel value of the pixel point corresponding to each multiplier in the first data processing cycle from the register connected to each multiplier as the first operand; and determining the weight value corresponding to each multiplier in the first data processing cycle as the second operand. two operands; respectively determine the product of the first operand and the second operand of each multiplier-adder in the first data processing cycle; for each non-first data processing cycle for processing the target image, control each pixel of the target image to move a preset step length in the register array according to a preset data movement method corresponding to the data processing cycle; and control each multiplier-adder to read the pixel value of the pixel point corresponding to each multiplier-adder in the data processing cycle from the register connected to each multiplier-adder as the first operand; and determine the weight value corresponding to each multiplier-adder in the data processing cycle as the second operand; respectively determine the product of the first operand and the second operand of each multiplier-adder in the data processing cycle.
[0019] In this way, based on the preset step size and the preset data movement method, the pixel information of the target feature map is orderly shifted in the register array as the data processing cycle changes, ensuring that the corresponding multipliers in the multiplier array can obtain valid data, thereby ensuring the effectiveness of the processing results of the target image.
[0020] In a possible implementation, the processing result of each image data to be processed is determined based on the processing results obtained by the multipliers and adders respectively corresponding to the multiple image data to be processed in the multiplier and adder array, including: for each effective multiplier and adder in each multiplier and adder, adding the products obtained by the effective multiplier and adder in each data processing cycle to obtain a sum; determining the effective multiplier and adder corresponding to each image data to be processed from each effective multiplier and adder; and determining the processing result of each image data to be processed based on the sum values respectively obtained by the effective multipliers and adders corresponding to each image data to be processed.
[0021] In this way, the processing result of each image data to be processed can be obtained based on the sum values obtained by the effective multipliers and adders corresponding to each image data to be processed, thereby improving the processing efficiency of the image data to be processed.
[0022] In a possible implementation manner, the effective multiplier-adder corresponding to each piece of image data to be processed includes: a multiplier-adder whose register connected to each data processing cycle has an effective pixel value input of the image data to be processed.
[0023] In a possible implementation, the image processing method further includes: determining the preset step size based on a distance between two adjacent pixel points in the target image that belong to the same image data to be processed.
[0024] In this way, when the target image contains different amounts of image data to be processed, the validity of the processing result of the multiplier-adder array on each image data to be processed contained in the target image can be guaranteed based on the setting of the preset step size, thereby improving the flexibility of the multiplier-adder array in processing the target image.
[0025] In a possible implementation, the acquiring of multiple image data to be processed includes: acquiring multiple original images; using a first original image among the multiple original images as the image data to be processed; and / or performing data filling processing on a second original image among the multiple original images to obtain image data to be processed corresponding to the second original image.
[0026] In this way, the image data to be processed of a suitable size is obtained by performing data padding on the second original image, which is more flexible.
[0027] In a second aspect, an embodiment of the present disclosure further provides an image processing device, including: a controller; the controller is used to:
[0028] Acquire multiple images to be processed; perform fusion processing on the multiple images to be processed to obtain a target image; and process the target image using a multiplier-adder array to obtain a processing result of each of the multiple images to be processed.
[0029] In a possible implementation, in the same row of the target image, the number of pixels between two adjacent pixels of the same image data to be processed is the same and not zero, and in the same column of the target image, the number of pixels between two adjacent pixels of the same image data to be processed is the same and not zero.
[0030] In a possible implementation manner, the controller is further configured to: determine the amount of the image data to be processed based on size information of the multiplier-adder array and size information of the image data to be processed.
[0031] In one possible implementation, the size information includes the number of rows and the number of columns; when determining the amount of the image data to be processed based on the size information of the multiplier array and the size information of the image data to be processed, the controller is specifically used to determine a first value based on the number of rows of the multiplier array and the number of rows of the image data to be processed, and to determine a second value based on the number of columns of the multiplier array and the number of columns of the image data to be processed; and determine the amount of the image data to be processed based on the first value and the second value.
[0032] In a possible implementation, when performing pixel combination processing on multiple image data to be processed to obtain a target image, the controller is specifically used to take each of the multiple image data to be processed as the current image in turn, and determine the target position of the first pixel point of the current image in the target image; based on the target position of the first pixel point in the target image, determine the target positions of other pixel points in the current image except the first pixel point in the target image to obtain the target image.
[0033] In a possible implementation, when determining the target positions of other pixel points in the current image except the first pixel point in the target image based on the target position of the first pixel point in the target image, the controller is specifically used to determine a first position relationship between each pixel point in each row of the current image except the first pixel point in the row and an adjacent previous pixel point of the pixel point in the target image based on the target position of the first pixel point in the current image in the target image, the number of columns of the multiplier array, and the number of columns of the current image; determine a second position relationship between each pixel point in each column of the current image except the first pixel point in the column and an adjacent previous pixel point of the pixel point in the target image based on the target position of the first pixel point in the current image in the target image, the number of rows of the multiplier array, and the number of rows of the current image; and determine the target positions of other pixel points in the current image except the first pixel point in the target image based on the first position relationship and / or the second position relationship.
[0034] In a possible implementation, when determining the target position of the first pixel point of the current image in the target image, the controller is specifically used to determine the target pixel matrix based on the number of rows and columns of the multiplier array and the number of rows and columns of the image data to be processed; and determine the target position of the first pixel point of each image data to be processed in the target image according to the matrix element values of the target pixel matrix; wherein the target position of the first pixel point of the current image in the target image is any target position among the determined target positions.
[0035] In a possible implementation, when the target image is processed using a multiplier array, the controller is specifically used to store the target image in the register array based on the correspondence between the multiplier array and the register array; wherein the adjacent relationship between each pixel point of the target image stored in the register array remains unchanged; in each data processing cycle of multiple data processing cycles, the multiplier array is used to read pixel information corresponding to each data processing cycle from the register array, and the read pixel information is processed to obtain a data processing result corresponding to each processing cycle.
[0036] In a possible implementation, in each data processing cycle of a plurality of data processing cycles, the multiplier-adder array is used to read pixel information corresponding to the data processing cycle from the register array, and the read pixel information is processed to obtain a data processing result corresponding to each processing cycle. The controller is specifically used to control each multiplier-adder in the multiplier-adder array whose corresponding register stores pixel information of the target image in the first data processing cycle of processing the target image, read the pixel value of the pixel point corresponding to each multiplier-adder in the first data processing cycle from the register connected to each multiplier-adder as the first operand; and determine the weight value corresponding to each multiplier-adder in the first data processing cycle. as the second operand; respectively determine the product of the first operand and the second operand of each multiplier-adder in the first data processing cycle; for each non-first data processing cycle for processing the target image, control each pixel of the target image to move a preset step length in the register array according to a preset data movement method corresponding to the data processing cycle; and control each multiplier-adder to read the pixel value of the pixel point corresponding to each multiplier-adder in the data processing cycle from the register connected to each multiplier-adder as the first operand; and determine the weight value corresponding to each multiplier-adder in the data processing cycle as the second operand; respectively determine the product of the first operand and the second operand of each multiplier-adder in the data processing cycle.
[0037] In a possible implementation, when determining the processing result of each image data to be processed based on the processing results obtained by the multipliers and adders respectively corresponding to the multiple image data to be processed in the multiplier and adder array, the controller is specifically used to, for each effective multiplier and adder in the multipliers and adders, add the products obtained by the effective multiplier and adder in each data processing cycle to obtain a sum; determine the effective multiplier and adder corresponding to each image data to be processed from each effective multiplier and adder; and determine the processing result of each image data to be processed based on the sum value obtained by the effective multiplier and adder corresponding to each image data to be processed.
[0038] In a possible implementation manner, the effective multiplier-adder corresponding to each piece of image data to be processed includes: a multiplier-adder whose register connected to each data processing cycle has an effective pixel value input of the image data to be processed.
[0039] In a possible implementation, the controller is further configured to determine the preset step size based on a distance between two adjacent pixel points in the target image that belong to the same image data to be processed.
[0040] In a possible implementation, when acquiring multiple image data to be processed, the controller is specifically used to acquire multiple original images; use a first original image among the multiple original images as the image data to be processed; and / or perform data filling processing on a second original image among the multiple original images to obtain image data to be processed corresponding to the second original image.
[0041] In a third aspect, an optional implementation of the present disclosure further provides a computer device, a controller, and a memory, wherein the memory stores machine-readable instructions executable by the controller, and the controller is used to execute the machine-readable instructions stored in the memory, and when the machine-readable instructions are executed by the controller, the machine-readable instructions perform the steps of the above-mentioned first aspect, or any possible implementation of the first aspect.
[0042] In a fourth aspect, an optional implementation of the present disclosure further provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed, the steps of the above-mentioned first aspect, or any possible implementation of the first aspect are executed.
[0043] For a description of the effects of the above-mentioned image processing apparatus, computer device, and computer-readable storage medium, please refer to the description of the above-mentioned image processing method, which will not be repeated here.
[0044] In order to make the above-mentioned objectives, features and advantages of the present disclosure more obvious and easy to understand, preferred embodiments are specifically cited below and described in detail with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the following is a brief introduction to the drawings required for use in the embodiments. The drawings herein are incorporated into the specification and constitute a part of the specification. These drawings illustrate embodiments consistent with the present disclosure and are used together with the specification to illustrate the technical solutions of the present disclosure. It should be understood that the following drawings only illustrate certain embodiments of the present disclosure and should not be regarded as limiting the scope. For ordinary technicians in this field, other relevant drawings can also be obtained based on these drawings without creative work.
[0046] Figure 1 A flowchart of an image processing method provided by an embodiment of the present disclosure is shown;
[0047] Figure 2 An example diagram of image data to be processed provided by an embodiment of the present disclosure is shown;
[0048] Figure 3 An example diagram of a multiplier-adder array provided by an embodiment of the present disclosure is shown;
[0049] Figure 4 An example diagram of a target image provided by an embodiment of the present disclosure is shown;
[0050] Figure 5 An example matrix diagram for determining the target position of the first pixel point in each image data to be processed in the target image provided by an embodiment of the present disclosure is shown;
[0051] Figure 6 An example diagram of a target image provided by an embodiment of the present disclosure is shown;
[0052] Figure 7 An exemplary diagram of a register array provided by an embodiment of the present disclosure is shown;
[0053] Figure 8 An example diagram of a register array after pixel values are moved by a preset step length provided by an embodiment of the present disclosure is shown;
[0054] Fig. 9 A schematic diagram of an image processing device provided by an embodiment of the present disclosure is shown;
[0055] Fig.10 A schematic diagram of a computer device provided by an embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0056] In order to make the purpose, technical scheme and advantages of the embodiments of the present disclosure clearer, the technical scheme in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are only part of the embodiments of the present disclosure, rather than all of the embodiments. The components of the embodiments of the present disclosure generally described and shown here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present disclosure is not intended to limit the scope of the present disclosure claimed for protection, but merely represents the selected embodiments of the present disclosure. Based on the embodiments of the present disclosure, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present disclosure.
[0057] Research has found that convolutional neural networks mainly rely on multiplier arrays for convolution processing. When performing convolution processing, the data to be processed will be stored in a register array connected to the multiplier array; the data to be processed stored in the register array will be moved in the register array in different data processing cycles; in each data processing cycle of the multiplier array, the operands of the data processing cycle are read from the registers connected to the multiplier (belonging to the register array) and multiplication and / or addition operations are performed. After processing for multiple data processing cycles, the effective multipliers in the multiplier array output partial results of the convolution processing of the data to be processed. The results of the outputs of multiple effective multipliers are combined to obtain the final result of the convolution processing of the data to be processed. The size of the multiplier array is usually fixed. When the size of the data matrix corresponding to the data to be processed is smaller than the size of the multiplier array, the multiplier array only needs to use part of the multipliers in the multiplier array when performing convolution calculation on the data matrix, that is, only part of the multipliers in the multiplier array are valid multipliers. Therefore, the current data processing method has the problems of low utilization of the multiplier array and waste of computing resources.
[0058] Based on the above research, the present disclosure provides an image processing method, apparatus, computer equipment and storage medium, which obtains a target image by pixel combination of multiple image data to be processed, and processes the target image using a multiplier array, so that when the size of the image data to be processed is smaller than the size of the multiplier array, the multiple image data to be processed can be processed simultaneously by the same multiplier array, and the processing results of each image data to be processed can be determined based on the processing results obtained by the multipliers corresponding to the multiple image data in the multiplier array, thereby improving the utilization rate of the multiplier array, reducing the waste of computing resources, and improving the efficiency of data processing.
[0059] The defects existing in the above solutions are the results obtained by the inventor after practice and careful research. Therefore, the discovery process of the above problems and the solutions proposed by the present disclosure for the above problems below should be the contributions made by the inventor to the present disclosure during the disclosure process.
[0060] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, further definition and explanation thereof is not required in subsequent drawings.
[0061] To facilitate understanding of the present embodiment, an image processing method disclosed in the present embodiment is first introduced in detail. The execution subject of the image processing method provided in the present embodiment is generally a computer device with certain computing capabilities, and the computer device includes, for example: a terminal device or a server or other processing device, and the terminal device can be a user equipment (User Equipment, UE), a mobile device, a user terminal, a terminal, a cellular phone, a cordless phone, a personal digital assistant (Personal Digital Assistant, PDA), a handheld device, a computing device, a vehicle-mounted device, a wearable device, etc. In some possible implementations, the image processing method can be implemented by a processor calling a computer-readable instruction stored in a memory.
[0062] The image processing method provided by the embodiment of the present disclosure is described below.
[0063] See also Figure 1 FIG. 1 is a flowchart of an image processing method provided by an embodiment of the present disclosure, wherein the method comprises steps S101 to S103, wherein:
[0064] S101: performing pixel combination processing on a plurality of image data to be processed to obtain a target image;
[0065] S102: Processing the target image using a multiplier-adder array;
[0066] S103: Determine a processing result of each piece of image data to be processed based on processing results obtained by the multipliers and adders respectively corresponding to the plurality of pieces of image data to be processed in the multiplier and adder array.
[0067] The present invention obtains a target image by combining pixels of a plurality of image data to be processed, and processes the target image using a multiplier-adder array, so that when the size of the image data to be processed is smaller than the size of the multiplier-adder array, the multiplier-adder array can process the target image formed by combining a plurality of image data to be processed, thereby realizing simultaneous processing of a plurality of image data to be processed; based on the processing results obtained by the multipliers corresponding to the plurality of image data to be processed in the multiplier-adder array, the processing result of each image data to be processed is determined; the utilization rate of the multiplier-adder array is improved, the waste of computing resources is reduced, and the processing efficiency of the image data to be processed is improved.
[0068] The above S101 to S103 are described in detail below.
[0069] With respect to the above S101, the image data to be processed includes, for example, at least one of the following:
[0070] The original image to be processed;
[0071] The sub-image corresponding to any color channel in the original image to be processed;
[0072] The feature map obtained after feature extraction of the original image;
[0073] A feature subgraph corresponding to at least one channel in a feature graph obtained by performing feature extraction on the original image;
[0074] The sub-image corresponding to at least one color channel in the original image is obtained by performing data filling processing;
[0075] The feature sub-graph corresponding to at least one channel of the feature graph is obtained by performing data filling processing.
[0076] Exemplarily, when the second original image is subjected to data padding processing to obtain the image data to be processed, if the size information of the second original image in the original image is 7 rows and 7 columns, and the desired size of the image data to be processed is 7 rows and 8 columns, then the second original feature map is padded with 0s to obtain an image with 7 rows and 8 columns, in which the pixel values of the 8th column are all 0, and this image is used as the image data to be processed.
[0077] Before performing pixel combination processing on a plurality of image data to be processed, the number of image data to be processed that are to be subjected to pixel combination processing may be determined first.
[0078] For example, the amount of image data to be processed may be determined in the following manner: the amount of image data to be processed is determined based on the size information of the multiplier-adder array and the size information of the image data to be processed.
[0079] Here, the size information of the image data to be processed includes the number of rows and columns of pixels contained in each image data to be processed; the size information of the multiple image data to be processed is consistent, that is, the number of rows and columns of pixels contained in each image data to be processed is the same; for example, Figure 2 The figure shows an example of image data to be processed provided by the present disclosure, which includes four images of image data to be processed with the same size information, i.e., 7 rows and 7 columns. The size information of the multiplier-adder array includes the number of rows and columns of the multipliers included in the multiplier-adder array; for example, Figure 3 The figure shows an example diagram of a multiplier-adder array provided by the present disclosure, which includes 14 rows and 14 columns of multiplier-adders.
[0080] In specific implementation, for example, the amount of image data to be processed can be determined based on the following method:
[0081] Based on the number of rows of the multiplier-adder array and the number of rows of the image data to be processed, a first value is determined, and based on the number of columns of the multiplier-adder array and the number of columns of the image data to be processed, a second value is determined; the amount of image data to be processed is determined based on the first value and the second value.
[0082] For example, the number of columns of the multiplier-accumulator array is A. x is 14, row number A y is 14, the number of columns of image data to be processed is F x is 7, the number of rows is F y is 7, and the first value is determined based on the number of rows of the multiplier-adder array and the number of rows of the image data to be processed, that is, rounding down. The second value is determined by using the number of columns of the multiplier array and the number of columns of the image data to be processed. The amount of image data to be processed is determined based on the first value and the second value: Therefore, the number of image data to be processed is 4. That is, the product of the number of columns of the multiplier-adder array and the number of columns of the image data to be processed rounded down and the number of rows of the multiplier-adder array and the number of rows of the image data to be processed rounded down determines the number of image data to be processed that can be processed at any one time.
[0083] After the amount of image data to be processed is determined, the image data to be processed can be acquired.
[0084] After the image data to be processed is acquired, pixel combination processing is performed on the acquired image data to be processed to obtain a target image.
[0085] The embodiment of the present disclosure provides a specific method for pixel combination processing of a plurality of image data to be processed, including:
[0086] Taking each of the plurality of to-be-processed image data in turn as a current image, and determining a target position of a first pixel point of the current image in the target image;
[0087] Based on the target position of the first pixel point in the target image, the target positions of other pixel points in the current image except the first pixel point in the target image are determined to obtain the target image.
[0088] In a specific implementation, for any current image, the pixel located in the first row and first column is the first pixel in the current image. Figure 2 In the example shown, the first pixel is Figure 2 a, b, c and d in FIG. 1 are the first pixel points in the four image data to be processed.
[0089] First, any image data to be processed is used as the current image, and the target position of the first pixel point of the current image in the target image is determined.
[0090] In specific implementation, for example, the target position of the first pixel of the current feature map in the target image can be determined based on the following method:
[0091] Based on the number of rows and columns of the multiplier array and the number of rows and columns of the image data to be processed, the target pixel matrix is determined; according to the matrix element values of the target pixel matrix, the target position of the first pixel point of each image data to be processed in the target image is determined; wherein the target position of the first pixel point of the current image in the target image is any target position among the determined target positions.
[0092] For example, the number of columns of the multiplier-accumulator array is A. x is 14, row number A y is 14, the number of columns of image data to be processed is F x is 7, the number of rows is F y is 7, and the final number of image data to be processed is like Figure 4 As shown, corresponding to the calculation formula for the number of image data to be processed 2*2=4, the target pixel matrix is a matrix with two rows and two columns, and the position of the first pixel point of the target pixel matrix is the target position of the first pixel point in the first image data to be processed in the target image; based on the position of the first pixel point of the target pixel matrix, the positions of the other three pixels in the target pixel matrix can be determined, that is, the target positions of the first pixel points in the other three image data to be processed. For example, the position arrangement number of the target image is The first pixel of the image data to be processed is at position 0, and the corresponding position arrangement number of the target pixel matrix of two rows and two columns determined based on the pixel of the image data to be processed at position 0 in the target image is Here, the pixel numbered 14 is located in the second row and first column, and the pixel numbered 15 is located in the second row and second column.
[0093] For example, it is also possible to follow Figure 5 The formula corresponding to the matrix target position shown is used to determine the target position of the first pixel of each image data to be processed in the target image, that is, Figure 5 Each matrix element of the matrix shown in represents the target position of the first pixel of an image to be processed in the target image. x is the number of columns in the multiplier-accumulator array, A y is the number of rows in the multiplier-accumulator array, F x is the number of columns of image data to be processed, F y is the number of rows of image data to be processed, and floor() is the rounding down operation.
[0094] It should be noted that the target position of the first pixel point in the other three to-be-processed image data only needs to ensure that it forms a two-row and two-column target pixel matrix with the target position of the first pixel point in the first to-be-processed image data. Figure 4 As shown in the style arrangement, for example, the pixel of the image data to be processed one in the target pixel matrix may be next to the pixel of the image data to be processed three, the pixel of the image data to be processed three may be below the pixel of the image data to be processed two, and the pixel of the image data to be processed one may be below the pixel of the image data to be processed four; other arrangement methods are similar to those described above and examples will not be repeated here.
[0095] After determining the target position of the first pixel point of each image data to be processed in the target image, for example, the positions of other pixel points in the same image data to be processed except the first pixel point in the target image can be determined based on the method described in the following steps 1 to 3:
[0096] Step 1: Based on the target position of the first pixel of the current image in the target image, the number of columns of the multiplier-adder array, and the number of columns of the current image, determine the first position relationship between each pixel in each row of the current image except the first pixel in the row and the adjacent previous pixel of the pixel in the target image;
[0097] The first position relationship between each pixel point in each row of the current image except the first pixel point in the row and the adjacent previous pixel point of the pixel point in the target image is, for example: Among them, A x is the number of columns in the multiplier-accumulator array, F x is the number of columns of the image data to be processed, and floor() is the rounding down operation.
[0098] For example, the number of columns of the multiplier-accumulator array is A. x is 14, row number A y is 14, the number of columns of image data to be processed is F x is 7, the number of rows is F y is 7, and the final number of image data to be processed is like Figure 6 As shown, for example, the position arrangement number of the target image is For example, if the image data to be processed 1 is the current image, the first pixel of the image data to be processed 1 is at position 0, then the position of the pixel A in the image data to be processed 1 that is located in the same row as the first pixel and adjacent to the first pixel in the target image is: Similarly, features to be processed Figure 1The position of the next pixel point B adjacent to the pixel point A in the target image is: 2+floor(14 / 7)=4, and so on, the pixels belonging to the same row in the same image data to be processed also belong to the same row in the target image.
[0099] Step 2: Based on the target position of the first pixel of the current image in the target image, the number of rows of the multiplier-adder array, and the number of rows of the current image, determine a second position relationship between each pixel in each column of the current image except the first pixel in the column and the adjacent previous pixel of the pixel in the target image;
[0100] The second position relationship between each pixel point in each column of the current image except the first pixel point in the column and the adjacent previous pixel point of the pixel point in the target image is determined as follows, for example: Among them, A y is the number of rows in the multiplier-accumulator array, F y is the number of rows of image data to be processed, When the multiplier-adder array processes the target image, in some cases the utilization rate of the multiplier-adder array is not 100%. The number of columns of the multiplier-adder array actually used is: The number of rows of the multiplier-accumulator array actually used is:
[0101] For example, the number of columns of the multiplier-accumulator array is A. x is 14, row number A y is 14, the number of columns of image data to be processed is F x is 7, the number of rows is F y is 7, and the final number of image data to be processed is like Figure 6 As shown, for example, the position arrangement number of the target image is For example, if the image data to be processed 1 is the current image, the first pixel of the image data to be processed 1 is at position 0, then the position of the pixel C in the image data to be processed 1 that is located in the same column as the first pixel and adjacent to the first pixel in the target image is: Similarly, features to be processed Figure 1 The position of the next pixel point D adjacent to the pixel point C in the target image is: 28+floor(14 / 7)*7*2=56. Similarly, the pixels in the same column in the same image data to be processed also belong to the same column in the target image.
[0102] Step three: Based on the first positional relationship and / or the second positional relationship, determine the target positions of the other pixel points in the current image except the first pixel point in the target image.
[0103] For example, Figure 6 As shown, the number of columns of the multiplier-accumulator array is A x is 14, row number A y is 14, the number of columns of image data to be processed is F x is 7, the number of rows is F y is 7, and the final number of image data to be processed is like Figure 6 Shown by Figure 2 The four pieces of image data to be processed shown in the figure: image data to be processed 1, image data to be processed 2, image data to be processed 3, image data to be processed 4, constitute an example of a target image. For example, the position arrangement number of the target image is The first pixel of the image data to be processed is at position 0. After calculating the position of the first pixel of each row or column of each image data to be processed in the target image, the target positions of the other pixels in the current image except the first pixel can be calculated by referring to the above formula for calculating the first pixel or the second pixel. For example, the position of the second pixel A in the first row of the target image belonging to the image data to be processed is 2, then the position of the next pixel E in the target image that belongs to the same column as the pixel at position 2 and belongs to the image data to be processed is: Or for example, the position of the second pixel point C in the first column of the target image belonging to the image data to be processed one is 28, then the position of the next pixel point E in the target image that belongs to the same row as the pixel point at position 28 and belongs to the image data to be processed one is:
[0104] For example, Figure 4 As shown, the embodiment of the present disclosure provides a specific example of obtaining a target feature map by pixel fusion of four feature maps. In this example, the target image is composed of Figure 2 The four image data to be processed are shown as follows: in the same row of the target image, the number of pixels between two adjacent pixels of the same image data to be processed is the same and not zero, and in the same column of the target image, the number of pixels between two adjacent pixels of the same image data to be processed is the same and not zero.
[0105] With respect to the above S102, when the target image is processed by using the multiplier-adder array, the target image is stored in the register array based on the correspondence between the multiplier-adder array and the register array; wherein the adjacent relationship of each pixel point of the target image stored in the register array remains unchanged; in each data processing cycle in multiple data processing cycles, the pixel information corresponding to each data processing cycle is read from the register array by using the multiplier-adder array, and the read pixel information is processed to obtain the data processing result corresponding to each processing cycle.
[0106] For example, in the first data processing cycle of processing the target image, each multiplier-adder in the corresponding register in the multiplier-adder array storing pixel information of the target image is controlled, and the pixel value of the pixel point corresponding to each multiplier-adder in the first data processing cycle is read from the register connected to each multiplier-adder as the first operand; and the weight value corresponding to each multiplier-adder in the first data processing cycle is determined as the second operand; and the product of the first operand and the second operand of each multiplier-adder in the first data processing cycle is determined;
[0107] For example, Figure 2 The pixel values of the corresponding pixels of the image data to be processed one are shown as A0 to A48; the pixel values of the corresponding pixels of the image data to be processed two are shown as B0 to B48; the pixel values of the corresponding pixels of the image data to be processed three are shown as C0 to C48; the pixel values of the corresponding pixels of the image data to be processed four are shown as D0 to D48; and the arrangement of the corresponding pixels in the register array of the target image is shown as Figure 7 As shown, in the first data processing cycle, Figure 3 PE0 in the multiplier-adder array shown reads pixel value A0, PE1 reads pixel value B0, PE2 reads pixel value A1... and so on. The multipliers PE3 to PE195 in the multiplier-adder array read the pixel values of the pixels in the corresponding registers.
[0108] For each non-first data processing cycle for processing a target image, each pixel of the target image is controlled to move a preset step length in a register array according to a preset data movement method corresponding to the data processing cycle; and each multiplier and adder is controlled to read the pixel value of the pixel point corresponding to each multiplier and adder in the data processing cycle from the register connected to each multiplier and adder as the first operand; and the weight value corresponding to each multiplier and adder in the data processing cycle is determined as the second operand; and the product of the first operand and the second operand of each multiplier and adder in the data processing cycle is determined.
[0109] The preset step size is determined based on the distance between two adjacent pixels in the target image belonging to the same image data to be processed; for example, Figure 7 In the target image corresponding to the register array shown, the distance between two adjacent pixel points belonging to the same image data to be processed is 2, so the preset step size is 2.
[0110] For example, Figure 8 The pixel values in the register array shown are Figure 7 The result after the pixel values in the register array shown are shifted to the left by two steps, the target register array is Figure 7 The register array shown in Figure 3 The multiplier-accumulator array shown is Figure 8The corresponding position in the target register array shown reads the corresponding pixel value.
[0111] In addition, the weight value corresponding to each cycle is the data corresponding to the convolution kernel corresponding to the image data to be processed in each data processing cycle; taking one of the image data to be processed as an example, its convolution kernel is, for example, Then the weight data of the first data processing cycle, that is, the second operand, is W0, such as Figure 7 In the data processing cycle corresponding to the register array shown, Figure 3 The calculation performed by the multiplier PE0 in the multiplier array shown in the data processing cycle is: W0*A0; the weight data of the second data processing cycle, that is, the second operand is W1, and the calculation performed by the multiplier PE0 in the second data processing cycle is: W1*A1. If a convolution operation is performed on the image data to be processed, the convolution kernel contains four weight data, and a total of four data processing cycles are performed. In the third data processing cycle, the pixel value is in the register array. Figure 8 The pixel value is moved two steps upward based on the position shown. At this time, the first operation data of the multiplier PE0 in the third data processing cycle is A8, the second operation data is W2, and the calculation performed by the multiplier PE0 in the third data processing cycle is W2*A8. In the fourth data processing cycle, the pixel value is moved two steps to the right in the register array as a whole based on the movement completed in each data processing cycle. At this time, the first operation data of the multiplier PE0 in the fourth data processing cycle is A7, the second operation data is W3, and the calculation performed by the multiplier PE0 in the fourth data processing cycle is W3*A7; the calculation process of other multipliers is similar to that of the multiplier PE0, which will not be repeated. All data processing cycles are completed until all data in the convolution kernel are allocated as weight data.
[0112] It can be seen that in each data processing cycle, the PEs storing the pixel values of different images to be processed complete the calculations of the corresponding data processing cycle. That is to say, different images to be processed complete the calculations of the corresponding data processing cycle in parallel in each data processing cycle. After all data processing cycles, different images to be processed complete the final calculations at the same time, saving system resources.
[0113] Here, for different image data to be processed, the corresponding convolution kernels can be different or the same. For example, if two image data to be processed are different feature sub-graphs of the same feature graph, the convolution kernels corresponding to the two image data to be processed are different. If the two image data to be processed are image data at different positions of the same feature sub-graph, the convolution kernels corresponding to the two images to be processed are the same.
[0114] With respect to the above S103, after determining the product of the first operand and the second operand of each multiplier-adder in all data processing cycles, for each valid multiplier-adder in each multiplier-adder, the products obtained by the valid multiplier-adder in each data processing cycle are added to obtain a sum; from each valid multiplier-adder, the valid multiplier-adder corresponding to each image data to be processed is determined; based on the sum value obtained by the valid multiplier-adder corresponding to each image data to be processed, the processing result of each image data to be processed is determined.
[0115] The effective multiplier-adder corresponding to each image data to be processed includes: a multiplier-adder having a valid pixel value input of the image data to be processed in each data processing cycle connected to the register; for example Figure 7 The register array shown corresponds to Figure 3 The multipliers PE0 to PE195 in the multiplier-adder array shown are all valid multipliers.
[0116] For example, Figure 3 The multiplier-accumulator array shown in FIG. Figure 7 The pixel values in the register array shown are processed. After all the data processing cycles are calculated, each multiplier adds the calculation results calculated in all the data processing cycles. For example, the multiplier PE0 performs calculations in four data processing cycles, and the calculation results are A, B, C, and D respectively. Then PE0 performs the following calculation: A+B+C+D.
[0117] Here, if the feature map to be convolved includes 16 channels, the feature sub-maps corresponding to 4 channels are processed each time, that is, the feature sub-maps corresponding to the 16 channels need to be divided into 4 groups, and one group of feature sub-maps is processed each time. If the four groups of feature sub-graphs are group a, group b, group c and group d, after processing the four feature sub-graphs included in group a, the four results corresponding to group a output by the multiplier are first accumulated; after processing the four feature sub-graphs included in group b, the four results corresponding to group b are accumulated, and the accumulated results corresponding to group a and the accumulated results corresponding to group b are accumulated; after processing the four feature sub-graphs included in group c, the four results corresponding to group c are accumulated, and the accumulated results of group a and group b and the accumulated results corresponding to group c are accumulated; after processing the four feature sub-graphs included in group d, the four results corresponding to group d are accumulated, and the accumulated results of group a, group b, group c and the accumulated results corresponding to group d are accumulated, and finally, the accumulated sum of the convolution results corresponding to the 16 channels is obtained.
[0118] After processing the 4 feature subgraphs included in group a, the 4 output results corresponding to group a are: a1, a2, a3, and a4. After processing the 4 feature subgraphs included in group b, the 4 output results corresponding to group b are: b1, b2, b3, and b4. At this time, a1+b1=O1, a2+b2=O2, a3+b3=O3, and a4+b4=O4 are executed. After processing the four feature sub-graphs included in group c, the four output results corresponding to group c are: c1, c2, c3 and c4, and then execute: O1+c1, O2+c2, O3+c3, O4+c4; and so on, finally get a1+b1+c1+d1, a2+b2+c2+d2, a3+b3+c3+d3, a4+b4+c4+d4, and then add the four results together to get the cumulative sum of the convolution results corresponding to the 16 channels.
[0119] Figure 7 The registers of the same color correspond to Figure 3 The result in the multiplier-accumulator is Figure 2 The processing result of the image data to be processed of the color in the image, for example, multiplier PE0, multiplier PE2, multiplier PE4, multiplier PE6, multiplier PE8, multiplier PE10, multiplier PE12, multiplier PE28, multiplier PE30, multiplier PE32, multiplier PE34, multiplier PE36, multiplier PE38, multiplier PE40, multiplier PE56, multiplier PE58, multiplier PE60, multiplier PE62, multiplier PE64, multiplier PE66, multiplier PE68, multiplier PE84, multiplier PE86, multiplier PE88, multiplier PE90, multiplier PE9 2. The calculation results of multiplier adder PE94, multiplier adder PE96, multiplier adder PE112, multiplier adder PE114, multiplier adder PE116, multiplier adder PE118, multiplier adder PE120, multiplier adder PE122, multiplier adder PE124, multiplier adder PE140, multiplier adder PE142, multiplier adder PE144, multiplier adder PE146, multiplier adder PE148, multiplier adder PE150, multiplier adder PE152, multiplier adder PE168, multiplier adder PE170, multiplier adder PE172, multiplier adder PE174, multiplier adder PE176, multiplier adder PE178 and multiplier adder PE180 are the processing results of the image data to be processed one.
[0120] Those skilled in the art will appreciate that, in the above method of specific implementation, the order in which the steps are written does not imply a strict execution order and does not constitute any limitation on the implementation process. The specific execution order of the steps should be determined by their functions and possible internal logic.
[0121] Based on the same inventive concept, an image processing device corresponding to the image processing method is also provided in the embodiment of the present disclosure. Since the principle of solving the problem by the device in the embodiment of the present disclosure is similar to the above-mentioned image processing method in the embodiment of the present disclosure, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be repeated.
[0122] Reference Fig. 9 FIG. 9 is a schematic diagram of an image processing device provided by an embodiment of the present disclosure, wherein the device comprises: a controller 901; the controller 901 is used to:
[0123] Acquire multiple image data to be processed;
[0124] Performing fusion processing on the plurality of image data to be processed to obtain a target image;
[0125] The target image is processed by using a multiplier-adder array to obtain a processing result of each of the plurality of image data to be processed.
[0126] In a possible implementation, in the same row of the target image, the number of pixels between two adjacent pixels of the same image data to be processed is the same and not zero, and in the same column of the target image, the number of pixels between two adjacent pixels of the same image data to be processed is the same and not zero.
[0127] In a possible implementation manner, the controller 901 is further configured to: determine the amount of the image data to be processed based on size information of the multiplier-adder array and size information of the image data to be processed.
[0128] In one possible implementation, the size information includes the number of rows and the number of columns; when determining the amount of the image data to be processed based on the size information of the multiplier array and the size information of the image data to be processed, the controller 901 is specifically used to determine a first value based on the number of rows of the multiplier array and the number of rows of the image data to be processed, and to determine a second value based on the number of columns of the multiplier array and the number of columns of the image data to be processed; and determine the amount of the image data to be processed based on the first value and the second value.
[0129] In a possible implementation, when performing pixel combination processing on multiple images to be processed to obtain a target image, the controller 901 is specifically used to take each of the multiple images to be processed as the current image in turn, and determine the target position of the first pixel point of the current image in the target image; based on the target position of the first pixel point in the target image, determine the target positions of other pixels in the current image except the first pixel point in the target image to obtain the target image.
[0130] In a possible implementation, when determining the target positions of other pixels in the current image except the first pixel in the target image based on the target position of the first pixel in the target image, the controller 901 is specifically used to determine a first position relationship between each pixel in each row of the current image except the first pixel in the row and an adjacent previous pixel of the pixel in the target image based on the target position of the first pixel in the current image in the target image, the number of columns of the multiplier array, and the number of columns of the current image; determine a second position relationship between each pixel in each column of the current image except the first pixel in the column and an adjacent previous pixel of the pixel in the target image based on the target position of the first pixel in the current image in the target image, the number of rows of the multiplier array, and the number of rows of the current image; and determine the target positions of other pixels in the current image except the first pixel in the target image based on the first position relationship and / or the second position relationship.
[0131] In a possible implementation, when determining the target position of the first pixel point of the current image in the target image, the controller 901 is specifically used to determine the target pixel matrix based on the number of rows and columns of the multiplier array and the number of rows and columns of the image data to be processed; and determine the target position of the first pixel point of each image data to be processed in the target image according to the matrix element values of the target pixel matrix; wherein the target position of the first pixel point of the current image in the target image is any target position among the determined target positions.
[0132] In a possible implementation, when the target image is processed using a multiplier array, the controller 901 is specifically used to store the target image in the register array based on the correspondence between the multiplier array and the register array; wherein the adjacent relationship between each pixel point of the target image stored in the register array remains unchanged; in each data processing cycle of multiple data processing cycles, the multiplier array is used to read pixel information corresponding to each data processing cycle from the register array, and the read pixel information is processed to obtain a data processing result corresponding to each processing cycle.
[0133] In a possible implementation, in each data processing cycle of a plurality of data processing cycles, the multiplier array is used to read pixel information corresponding to the data processing cycle from the register array, and the read pixel information is processed to obtain the data processing result corresponding to each processing cycle, the controller 901 is specifically used to control each multiplier in the multiplier array whose corresponding register stores the pixel information of the target image in the first data processing cycle of processing the target image, read the pixel value of the pixel point corresponding to each multiplier in the first data processing cycle from the register connected to each multiplier as the first operand; and determine the weight corresponding to each multiplier in the first data processing cycle value as the second operand; respectively determine the product of the first operand and the second operand of each multiplier-adder in the first data processing cycle; for each non-first data processing cycle for processing the target image, control each pixel of the target image to move a preset step length in the register array according to a preset data movement method corresponding to the data processing cycle; and control each multiplier-adder to read the pixel value of the pixel point corresponding to each multiplier-adder in the data processing cycle from the register connected to each multiplier-adder as the first operand; and determine the weight value corresponding to each multiplier-adder in the data processing cycle as the second operand; respectively determine the product of the first operand and the second operand of each multiplier-adder in the data processing cycle.
[0134] In a possible implementation, when determining the processing result of each image data to be processed based on the processing results obtained by the multipliers and adders respectively corresponding to the multiple image data to be processed in the multiplier and adder array, the controller 901 is specifically used to, for each effective multiplier and adder in the multipliers and adders, add the products obtained by the effective multiplier and adder in each data processing cycle to obtain a sum; determine the effective multiplier and adder corresponding to each image data to be processed from each effective multiplier and adder; and determine the processing result of each image data to be processed based on the sum values respectively obtained by the effective multipliers and adders corresponding to each image data to be processed.
[0135] In a possible implementation manner, the effective multiplier-adder corresponding to each piece of image data to be processed includes: a multiplier-adder whose register connected to each data processing cycle has an effective pixel value input of the image data to be processed.
[0136] In a possible implementation, the controller 901 is further configured to determine the preset step size based on a distance between two adjacent pixel points in the target image that belong to the same image data to be processed.
[0137] In a possible implementation, when acquiring multiple image data to be processed, the controller 901 is specifically used to acquire multiple original images; use a first original image among the multiple original images as the image data to be processed; and / or perform data filling processing on a second original image among the multiple original images to obtain image data to be processed corresponding to the second original image.
[0138] The image processing device provided in the embodiments of the present disclosure may include a chip, an AI chip, etc.
[0139] For descriptions of the processing flow of each module in the device and the interaction flow between each module, reference may be made to the relevant descriptions in the above method embodiment, which will not be described in detail here.
[0140] The present disclosure also provides a computer device, such as Fig.10 FIG. 1 is a schematic diagram of a computer device structure provided in an embodiment of the present disclosure, including:
[0141] A controller 101 and a memory 102; the memory 102 stores machine-readable instructions executable by the controller 101, and the controller 101 is used to execute the machine-readable instructions stored in the memory 102. When the machine-readable instructions are executed by the controller 101, the controller 101 performs the following steps:
[0142] Performing pixel combination processing on the plurality of image data to be processed to obtain a target image;
[0143] Processing the target image using a multiplier-adder array;
[0144] Based on the processing results obtained by the multipliers and adders respectively corresponding to the plurality of image data to be processed in the multiplier and adder array, a processing result of each image data to be processed is determined.
[0145] The above-mentioned memory 102 includes internal memory 1021 and external memory 1022; the memory 1021 here is also called internal memory, which is used to temporarily store the calculation data in the controller 101, as well as the data exchanged with the external memory 1022 such as the hard disk. The controller 101 exchanges data with the external memory 1022 through the internal memory 1021.
[0146] The computer device provided in the embodiments of the present disclosure may include a smart terminal such as a mobile phone, or may also be other devices, servers, etc. that have a camera and can perform image processing, which is not limited here.
[0147] The specific execution process of the above instructions can refer to the steps of the image processing method described in the embodiment of the present disclosure, which will not be repeated here.
[0148] The present disclosure also provides a computer-readable storage medium, which stores a computer program, and when the computer program is executed by a processor, the steps of the image processing method described in the above method embodiment are executed. The storage medium can be a volatile or non-volatile computer-readable storage medium.
[0149] The embodiments of the present disclosure also provide a computer program product, which carries a program code. The instructions included in the program code can be used to execute the steps of the image processing method described in the above method embodiment. For details, please refer to the above method embodiment, which will not be repeated here.
[0150] The computer program product may be implemented in hardware, software or a combination thereof. In one optional embodiment, the computer program product is implemented as a computer storage medium. In another optional embodiment, the computer program product is implemented as a software product, such as a software development kit (SDK).
[0151] Those skilled in the art can clearly understand that, for the convenience and simplicity of description, the specific working process of the system and device described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here. In the several embodiments provided in the present disclosure, it should be understood that the disclosed system, device and method can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, and the indirect coupling or communication connection of the device or unit can be electrical, mechanical or other forms.
[0152] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0153] In addition, each functional unit in each embodiment of the present disclosure may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0154] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a non-volatile computer-readable storage medium that is executable by a processor. Based on this understanding, the technical solution of the present disclosure, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present disclosure. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0155] Finally, it should be noted that the above-described embodiments are only specific implementation methods of the present disclosure, which are used to illustrate the technical solutions of the present disclosure, rather than to limit them. The protection scope of the present disclosure is not limited thereto. Although the present disclosure is described in detail with reference to the above-described embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above-described embodiments within the technical scope disclosed in the present disclosure, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present disclosure, and should be included in the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure should be based on the protection scope of the claims.
Claims
1. An image processing method, characterized in that: include: Acquire multiple image data to be processed; Taking each of the plurality of images to be processed as a current image in turn, and determining a target position of a first pixel point of the current image in a target image; Based on the target position of the first pixel point in the target image, determine the target positions of other pixel points in the current image except the first pixel point in the target image to obtain the target image; Processing the target image using a multiplier-adder array; Based on the processing results obtained by the multipliers and adders respectively corresponding to the plurality of image data to be processed in the multiplier and adder array, a processing result of each image data to be processed is determined.
2. The image processing method according to claim 1, characterized in that: In the same row of the target image, the number of pixels between two adjacent pixels of the same image data to be processed is the same and not zero, and in the same column of the target image, the number of pixels between two adjacent pixels of the same image data to be processed is the same and not zero.
3. The image processing method according to claim 1 or 2, characterized in that: Also includes: The amount of the image data to be processed is determined based on the size information of the multiplier-adder array and the size information of the image data to be processed.
4. The image processing method according to claim 3, characterized in that: The size information includes the number of rows and columns; The determining the amount of the image data to be processed based on the size information of the multiplier-adder array and the size information of the image data to be processed comprises: Determine a first value based on the number of rows of the multiplier-adder array and the number of rows of the image data to be processed, and determine a second value based on the number of columns of the multiplier-adder array and the number of columns of the image data to be processed; The amount of the image data to be processed is determined based on the first value and the second value.
5. The image processing method according to claim 1, characterized in that: The determining, based on the target position of the first pixel in the target image, the target positions of other pixel points in the current image except the first pixel in the target image includes: Determine a first position relationship between each pixel point in each row of the current image except the first pixel point in the row and an adjacent previous pixel point of the pixel point in the target image based on the target position of the first pixel point of the current image in the target image, the number of columns of the multiplier-adder array, and the number of columns of the current image; Determine, based on the target position of the first pixel of the current image in the target image, the number of rows of the multiplier-adder array, and the number of rows of the current image, a second position relationship between each pixel in each column of the current image except the first pixel in the column and an adjacent previous pixel of the pixel in the target image; Based on the first positional relationship and / or the second positional relationship, target positions of other pixel points in the current image except the first pixel point in the target image are determined.
6. The image processing method according to claim 1 or 5, characterized in that: The determining a target position of a first pixel point of the current image in the target image includes: Determine a target pixel matrix based on the number of rows and columns of the multiplier-adder array and the number of rows and columns of the image data to be processed; Determining the target position of the first pixel point of each to-be-processed image data in the target image according to the matrix element value of the target pixel matrix; The target position of the first pixel point of the current image in the target image is any target position among the determined target positions.
7. The image processing method according to claim 1, characterized in that: The process of processing the target image by using a multiplier-adder array includes: Based on the correspondence between the multiplier array and the register array, the target image is stored in the register array; wherein the adjacent relationship of each pixel point of the target image stored in the register array remains unchanged; In each data processing cycle among multiple data processing cycles, the multiplier array is used to read pixel information corresponding to each data processing cycle from the register array, and the read pixel information is processed to obtain the data processing result corresponding to each processing cycle.
8. The image processing method according to claim 7, characterized in that: In each data processing cycle of the plurality of data processing cycles, the multiplier-adder array is used to read pixel information corresponding to the data processing cycle from the register array, and the read pixel information is processed to obtain a data processing result corresponding to each processing cycle, including: In the first data processing cycle for processing the target image, control each multiplier-adder in the corresponding register of the multiplier-adder array storing pixel information of the target image, read the pixel value of the pixel point corresponding to each multiplier-adder in the first data processing cycle as the first operand from the register connected to each multiplier-adder; and determine the weight value corresponding to each multiplier-adder in the first data processing cycle as the second operand; respectively determine the product of the first operand and the second operand of each multiplier-adder in the first data processing cycle; For each non-first data processing cycle for processing the target image, each pixel of the target image is controlled to move a preset step length in the register array according to a preset data movement method corresponding to the data processing cycle; and each multiplier and adder is controlled to read the pixel value of the pixel point corresponding to each multiplier and adder in the data processing cycle from the register connected to each multiplier and adder as the first operand; and the weight value corresponding to each multiplier and adder in the data processing cycle is determined as the second operand; and the product of the first operand and the second operand of each multiplier and adder in the data processing cycle is determined respectively.
9. The image processing method according to claim 7, characterized in that: The determining the processing result of each image data to be processed based on the processing results obtained by the multipliers and adders respectively corresponding to the plurality of image data to be processed in the multiplier and adder array comprises: For each effective multiplier-adder among the multipliers-adders, adding the products obtained by the effective multiplier-adder in each data processing cycle to obtain a sum; Determine, from each valid multiplier-adder, a valid multiplier-adder corresponding to each image data to be processed; Based on the sum values respectively obtained by the effective multipliers and adders corresponding to each piece of the image data to be processed, the processing result of each piece of the image data to be processed is determined.
10. The image processing method according to claim 9, characterized in that: The effective multiplier-adder corresponding to each piece of image data to be processed includes: a multiplier-adder whose register connected to each data processing cycle has an effective pixel value input of the image data to be processed.
11. The image processing method according to claim 8, characterized in that: The image processing method further includes: determining the preset step length based on the distance between two adjacent pixel points in the target image that belong to the same image data to be processed.
12. The image processing method according to claim 1, characterized in that: The step of obtaining a plurality of image data to be processed includes: Get multiple original images; Using the first original image among the plurality of original images as the image data to be processed; and / or, Data filling processing is performed on a second original image among the plurality of original images to obtain image data to be processed corresponding to the second original image.
13. An image processing device, characterized in that: include: Controller; The controller is used to: Acquire multiple image data to be processed; Taking each of the plurality of images to be processed as a current image in turn, and determining a target position of a first pixel point of the current image in a target image; Based on the target position of the first pixel point in the target image, determine the target positions of other pixel points in the current image except the first pixel point in the target image to obtain the target image; The target image is processed by using a multiplier-adder array to obtain a processing result of each of the plurality of image data to be processed.
14. A computer device, characterized in that: include: A controller and a memory, wherein the memory stores machine-readable instructions executable by the controller, and the controller is used to execute the machine-readable instructions stored in the memory. When the machine-readable instructions are executed by the controller, the controller executes the steps of the image processing method according to any one of claims 1 to 12.
15. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program. When the computer program is executed by a computer device, the computer device executes the steps of the image processing method according to any one of claims 1 to 12.
Citation Information
Patent Citations
Image batch-processing method, device thereof and electronic equipment
CN108288252A
Data processing method and device, electronic equipment and storage medium
CN111597029A
Data processing method and device, chip and computer readable storage medium
CN111814983A
Image data processing method and device, computer equipment and storage medium
CN111897579A
Convolutional Neural Network On Programmable Two Dimensional Image Processor
US20180005074A1
