WO2021077427A1 - Image processing method and device, and movable platform - Google Patents

Image processing method and device, and movable platform Download PDF

Info

Publication number
WO2021077427A1
WO2021077427A1 PCT/CN2019/113433 CN2019113433W WO2021077427A1 WO 2021077427 A1 WO2021077427 A1 WO 2021077427A1 CN 2019113433 W CN2019113433 W CN 2019113433W WO 2021077427 A1 WO2021077427 A1 WO 2021077427A1
Authority
WO
WIPO (PCT)
Prior art keywords
pixel values
pixel
pooling
pixel value
image
Prior art date
Application number
PCT/CN2019/113433
Other languages
French (fr)
Chinese (zh)
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 CN201980034354.9A priority Critical patent/CN112204606A/en
Priority to PCT/CN2019/113433 priority patent/WO2021077427A1/en
Publication of WO2021077427A1 publication Critical patent/WO2021077427A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T1/00General purpose image data processing
    • G06T1/60Memory management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2200/00Indexing scheme for image data processing or generation, in general
    • G06T2200/28Indexing scheme for image data processing or generation, in general involving image processing hardware

Definitions

  • the embodiments of the present application relate to the field of image processing technology, and in particular, to an image processing method, device, and movable platform.
  • processors based on convolutional neural networks have been widely used. Taking drones as an example, drones collect images during the flight, and processors based on convolutional neural networks can The image is recognized and processed to identify the target in the image to ensure the flight safety of the UAV.
  • convolutional neural networks generally include: Convolution Layer, Activation Layer, Normalization Layer, Downsampling Layer, Fully Connected Layer, among them
  • the pooling operation is located in the down-sampling layer of the convolutional neural network.
  • the down-sampling layer can reduce the feature map. According to different functions, the pooling operation can be divided into maximum pooling and average pooling.
  • Maximum pooling is to find the maximum value in the pooling window
  • average pooling is to find the average value in the pooling window.
  • some pixels are usually filled around the image.
  • the pixel value of the image and the filled pixel value need to be input into the same register in turn, and the pixel values in the current row are all input Only after this register can you start to input the pixel value of the next line, resulting in low pooling efficiency.
  • the embodiments of the present application provide an image processing method, equipment, and a movable platform to save processing time and improve processing efficiency.
  • an embodiment of the present application provides an image processing method, where the edges of the image to be processed are provided with padding pixels, and the method includes:
  • n is any integer greater than or equal to 1
  • the pixel values include image pixel values and padding pixel values
  • the first image pixel value in the n+1th row in the image is input into the second register group.
  • an embodiment of the present application provides an image processing device, where the edges of the image to be processed are provided with padding pixels, and the image processing device includes: a first register group, a second register group, and a processor;
  • the processor is configured to sequentially input the pixel values of the pixels in the nth row in the image to be processed into the first register group, where n is any integer greater than or equal to 1, and the pixel values include image pixels Value and padding pixel value; when the adjacent padding pixel value of the last image pixel value in the nth row is input into the first register group, the first image in the n+1th row in the image The pixel value is input to the second register group.
  • an embodiment of the present application provides a movable platform, including: a movable platform body and the image processing device according to the embodiment of the present application in the second aspect, wherein the image processing device is installed on the movable platform. On the platform body.
  • an embodiment of the present application provides a readable storage medium with a computer program stored on the readable storage medium; when the computer program is executed, it realizes the image described in the embodiment of the present application in the first aspect. Approach.
  • an embodiment of the present application provides a program product, the program product includes a computer program, the computer program is stored in a readable storage medium, and at least one processor of a removable platform can download from the readable storage medium The computer program is read, and the at least one processor executes the computer program to enable the mobile platform to implement the image processing method described in the embodiment of the present application in the first aspect.
  • the image processing method, device, and movable platform input the pixel values of the pixels in the nth row of the image to be processed into the first register group in sequence, and when the last image in the nth row is input
  • the first image pixel value of the n+1th row in the image is input into the second register group. Since the first register group and the second register group are provided in this embodiment, the pixel values of pixels in adjacent rows can be input into different register groups respectively, and the pixel values of pixels in the nth row are not completely input to the first register.
  • Fig. 1 is a schematic architecture diagram of an unmanned aerial system according to an embodiment of the present application
  • FIG. 2 is a flowchart of an image processing method provided by an embodiment of the application
  • FIG. 3 is a schematic diagram of each pixel in an image to be processed according to an embodiment of the application.
  • FIG. 4 is a schematic diagram of the first register set or the second register set provided by an embodiment of the application.
  • FIG. 5 is a schematic diagram of a cache provided by an embodiment of this application.
  • Fig. 6 is a schematic structural diagram of an image processing device provided by an embodiment of the application.
  • FIG. 7 is a schematic structural diagram of a movable platform provided by an embodiment of this application.
  • FIG. 8 is a schematic structural diagram of a movable platform provided by another embodiment of the application.
  • the embodiments of the present application provide an image processing method, equipment, and a movable platform, where the movable platform may be a handheld phone, a handheld PTZ, a drone, an unmanned vehicle, an unmanned boat, a robot, or an autonomous vehicle, etc.
  • the following description of the mobile platform of this application uses drones as an example. It will be obvious to those skilled in the art that other types of drones can be used without restriction, and the embodiments of the present application can be applied to various types of drones.
  • the drone can be a small or large drone.
  • the drone may be a rotorcraft, for example, a multi-rotor drone that is propelled by multiple propulsion devices through the air.
  • the embodiments of the present application are not limited to this, and the drone It can also be other types of drones.
  • Fig. 1 is a schematic architecture diagram of an unmanned aerial system according to an embodiment of the present application.
  • a rotary wing drone is taken as an example for description.
  • the unmanned aerial system 100 may include a drone 110, a display device 130, and a remote control device 140.
  • the UAV 110 may include a power system 150, a flight control system 160, a frame, and a pan/tilt 120 carried on the frame.
  • the drone 110 can wirelessly communicate with the remote control device 140 and the display device 130.
  • the frame may include a fuselage and a tripod (also called a landing gear).
  • the fuselage may include a center frame and one or more arms connected to the center frame, and the one or more arms extend radially from the center frame.
  • the tripod is connected with the fuselage, and is used for supporting the UAV 110 when it is landed.
  • the power system 150 may include one or more electronic governors (referred to as ESCs) 151, one or more propellers 153, and one or more motors 152 corresponding to the one or more propellers 153, wherein the motors 152 are connected to Between the electronic governor 151 and the propeller 153, the motor 152 and the propeller 153 are arranged on the arm of the UAV 110; the electronic governor 151 is used to receive the driving signal generated by the flight control system 160 and provide driving according to the driving signal Current is supplied to the motor 152 to control the speed of the motor 152.
  • the motor 152 is used to drive the propeller to rotate, thereby providing power for the flight of the drone 110, and the power enables the drone 110 to achieve one or more degrees of freedom of movement.
  • the drone 110 may rotate about one or more rotation axes.
  • the aforementioned rotation axis may include a roll axis (Roll), a yaw axis (Yaw), and a pitch axis (pitch).
  • the motor 152 may be a DC motor or an AC motor.
  • the motor 152 may be a brushless motor or a brushed motor.
  • the flight control system 160 may include a flight controller 161 and a sensing system 162.
  • the sensing system 162 is used to measure the attitude information of the drone, that is, the position information and state information of the drone 110 in space, such as three-dimensional position, three-dimensional angle, three-dimensional velocity, three-dimensional acceleration, and three-dimensional angular velocity.
  • the sensing system 162 may include, for example, at least one of sensors such as a gyroscope, an ultrasonic sensor, an electronic compass, an inertial measurement unit (IMU), a vision sensor, a global navigation satellite system, and a barometer.
  • the global navigation satellite system may be the Global Positioning System (GPS).
  • the flight controller 161 is used to control the flight of the drone 110, for example, it can control the flight of the drone 110 according to the attitude information measured by the sensor system 162. It should be understood that the flight controller 161 can control the drone 110 according to pre-programmed program instructions, and can also control the drone 110 by responding to one or more remote control signals from the remote control device 140.
  • the pan/tilt head 120 may include a motor 122.
  • the pan/tilt is used to carry the camera 123.
  • the flight controller 161 can control the movement of the pan-tilt 120 through the motor 122.
  • the pan/tilt head 120 may further include a controller for controlling the movement of the pan/tilt head 120 by controlling the motor 122.
  • the pan-tilt 120 may be independent of the drone 110 or a part of the drone 110.
  • the motor 122 may be a DC motor or an AC motor.
  • the motor 122 may be a brushless motor or a brushed motor.
  • the pan-tilt can be located on the top of the drone, or on the bottom of the drone.
  • the photographing device 123 may be, for example, a device for capturing images, such as a camera or a video camera, and the photographing device 123 may communicate with the flight controller and take pictures under the control of the flight controller.
  • the imaging device 123 of this embodiment at least includes a photosensitive element, and the photosensitive element is, for example, a Complementary Metal Oxide Semiconductor (CMOS) sensor or a Charge-coupled Device (CCD) sensor. It can be understood that the camera 123 can also be directly fixed to the drone 110, so the pan/tilt 120 can be omitted.
  • CMOS Complementary Metal Oxide Semiconductor
  • CCD Charge-coupled Device
  • the display device 130 is located on the ground end of the unmanned aerial system 100, can communicate with the drone 110 in a wireless manner, and can be used to display the attitude information of the drone 110.
  • the image photographed by the photographing device 123 may also be displayed on the display device 130. It should be understood that the display device 130 may be an independent device or integrated in the remote control device 140.
  • the remote control device 140 is located on the ground end of the unmanned aerial system 100, and can communicate with the drone 110 in a wireless manner for remote control of the drone 110.
  • the image captured by the above-mentioned photographing device 123 may be processed using the solutions of the embodiments of the present application.
  • FIG. 2 is a flowchart of an image processing method provided by an embodiment of this application. As shown in FIG. 2, the method of this embodiment may include:
  • the edge of the image to be processed is provided with filled pixels.
  • the pixels of the image to be processed include image pixels and filled pixels.
  • the pixels represented by numbers in Figure 3 are image pixels, and the filled pixels are located in image pixels.
  • the pixels indicated by the blanks in Figure 3 are filled pixels.
  • the pixel value of the image pixel is called the image pixel value
  • the pixel value of the filled pixel is called the filled pixel value.
  • the filling pixels are respectively filled in the first row and the last row of the image to be processed, as well as the 1-2 columns and the last 1-2 columns of the image to be processed.
  • the filling pixels are filled in the row direction of the image to be processed
  • the number of rows and the number of columns of filled pixels filled in the column direction are not limited to this, and can be determined according to specific actual application scenarios.
  • the pixels represented by numbers 1 to 8 in the first row of the image to be processed are image pixels.
  • the number 1 represents image pixel 1
  • the number 2 represents image pixel 2
  • other rows are similar.
  • the pixel values of the pixels in the nth row of the image to be processed are sequentially input into the first register group, where n is any integer greater than or equal to 1, when the last image pixel value in the nth row is When the adjacent padding pixel value of is input into the first register group, the pixel value of the first image in the n+1th row in the image is input into the second register group. Then the pixel values of the pixels in the n+1th row of the image to be processed are sequentially input into the second register group.
  • the first register group may be the second register group
  • the second register group may be the first register group.
  • the first register group serves as the second register group.
  • the first register group serves as the second register group.
  • the n+1th pixel in the image is input into the second register group.
  • all the pixel values of the pixels in the nth row are input to the register group before all the pixel values of the pixels in the n+1th row are input to the register group.
  • there are two sets of register sets (the first register set and the second register set), and the pixel values of the pixels in two adjacent rows are input to different register sets. Therefore, in this embodiment, the When the pixel value of the pixel is not all input to the first register group, the pixel value of the pixel in the n+1th row is input to the second register group. Therefore, the time when the pixel value in the n+1th row is input to the second register group Part of the time when the pixel value of the nth row is input to the first register group is multiplexed, which improves the image processing efficiency.
  • the pixel value of image pixel 1 is input to the first register group, and then the pixel value of image pixel 2 is input to the first register group,..., and then the pixel value of the image pixel is input to the first register group.
  • the pixel value is input to the first register group, the pixel value of the penultimate filling pixel is input to the first register group, and the pixel value of the last filling pixel is input to the first register group.
  • the pixel value of the penultimate filling pixel is input to the first register group
  • the pixel value of the image pixel 9 in the third row is input into the second register group
  • the pixel value of the penultimate filling pixel is input to the second register group.
  • the pixel value of the image pixel 10 in the third row is input into the second register group, which saves the time of inputting two pixel values for two adjacent rows, or when the last one is the last Input the pixel value of one filling pixel into the first register group, and input the pixel value of the image pixel 9 in the third row into the second register group. For two adjacent rows, it saves inputting 1 pixel into the first register group. Value of time.
  • the pixel values of pixels in the nth row of the image to be processed into the first register group when the adjacent filling pixel value of the last image pixel value in the nth row is input into the When in the first register set, input the pixel value of the first image in the n+1th row in the image into the second register set. Since the first register group and the second register group are provided in this embodiment, the pixel values of pixels in adjacent rows can be input into different register groups respectively, and the pixel values of pixels in the nth row are not completely input to the first register. When grouping, you can start to input the first image pixel value of the n+1th row into the second register group. Therefore, the time when the pixel value of the n+1th row is input into the second register group is multiplexed with the nth row Part of the time for the pixel value to be input to the first register set improves the image processing efficiency.
  • the width of the pooling window is w pixels
  • the height of the pooling window is h pixels
  • the pooling window slides in the row direction according to the preset row step length and according to the preset column step length Sliding along the column direction
  • the pooling window may include pixels in consecutive h rows of w consecutive columns in the image to be processed, and the total pixels are w*h pixels.
  • the pooling window will include the pixels at the corresponding position after the sliding.
  • this embodiment When w pixel values belonging to the same pooling window in the nth row are input into the first register group, that is, when w pixel values have been registered in the first register group, and these w pixel values belong to the to-be-processed In the same row in the image, and also belong to the same pooling window, this embodiment also obtains the calculated pixel values of the w pixel values, for example, obtains the w pixel values registered in the first register group, and performs operations on the w pixel values. Corresponding operations, the operation result is obtained, and the operation result is called the operation pixel value of the w pixel values. Therefore, the calculated pixel values of w pixel values belonging to different pooling windows in the nth row can be obtained.
  • this embodiment When w pixel values belonging to the same pooling window in the n+1th row are input into the second register group, that is, when w pixel values have been registered in the second register group, and these w pixel values belong to the In the processed image for the same row and also belong to the same pooling window, this embodiment also obtains the calculated pixel values of the w pixel values, for example, obtains the w pixel values registered in the second register group, and compares the w pixels Perform corresponding operations on the values to obtain the result of the operation. The result of the operation is called the calculated pixel value of the w pixel values. Therefore, the calculated pixel values of w pixel values belonging to the same pooling window in the n+1th row can be obtained.
  • the calculation of w*h pixel values in the pooling window is determined according to the calculated pixel values of the w pixel values of each row Pixel values.
  • the calculated pixel value of the w pixel values of the nth row in the same pooling window For example, when obtaining the calculated pixel value of the w pixel values of the nth row in the same pooling window, the calculated pixel value of the w pixel values of the n+1th row,..., the w pixel values of the n+h-1th row
  • the calculated pixel value of the w pixel values of the nth row, the calculated pixel value of the w pixel values of the n+1th row,..., the n+h-1th row of the same pooling window The calculated pixel values of w pixel values are subjected to corresponding calculations to obtain the calculation result, which is called the calculated pixel value of w*h pixel values in the pooling window.
  • the pooling result is the calculated pixel value of the w*h pixel values obtained by the corresponding operation.
  • the first register group or the second register group includes at least w registers, and each register is used to register a single pixel value.
  • the first register group includes at least w registers, and the number of pixel values registered in the first register group is the same as the number of registers included in the first register group. Therefore, the pixels that can be registered in the first register group The value is at least w.
  • the second register group includes at least w registers, and the number of pixel values registered in the second register group is the same as the number of registers included in the second register group. Therefore, the second register group can register at least w pixel values .
  • the w is 3, for example, as shown in Fig. 4, the directions from left to right are register 1, register 2, and register 3 respectively.
  • the pixel values of the pixels of the processed image are input into the first register group or the second register group, the pixel values of the pixels of the image are input into the register group in consecutive clock cycles.
  • register 1 has registered the pixel value of image pixel 3
  • register 2 has registered the pixel value of image pixel 2
  • register 3 has registered the pixel value of image pixel 1
  • the pixel value of image pixel 4 is input to register 1
  • the pixel value of image pixel 3 registered in register 1 is input to register 2, and register 2 is registered
  • the pixel value of image pixel 2 is input to register 3, that is, the value of register 1 is updated to the pixel value of image pixel 4
  • the value of register 2 is updated to the pixel value of image pixel 3
  • the value of register 3 is updated to image pixel 2.
  • the pixel value In this way, it is ensured that the pixel values of 3 pixels are registered in the first register group, and the pixel values of the most recently input 3 pixels are registered.
  • the calculated pixel values of the w pixel values are stored in a buffer, so that the calculation of the w pixel values of each row in the same pooling window is obtained.
  • the calculated pixel value of the w pixel values of each row in the same pooling window obtained by the previous operation is obtained from the cache in time.
  • the buffer includes at least h sub-buffers to ensure that the calculated pixel values of w pixel values of different rows in the same pooling window can be stored in the buffer at the same time.
  • the calculated pixel values of w pixel values of different rows in the same pooling window are stored in different sub-buffers, so that the calculated pixel values of w pixel values of each row in the same pooling window are obtained from different sub-buffers.
  • h is equal to 3
  • the buffer includes 3 sub-buffers as an example.
  • the calculated pixel values of the w pixel values of the nth row in the same pooling window are stored in sub-buffer 1, and the n+1th row
  • the calculated pixel values of w pixel values are stored in the sub-buffer 2
  • the calculated pixel values of the w pixel values in the n+2th row are stored in the sub-buffer 3.
  • the calculated pixel values of w pixel values belonging to the same row and belonging to different pooling windows may be stored in the same sub-buffer.
  • multiple pooling windows are formed.
  • the calculated pixel values of w pixel values belonging to the first pooling window in the nth row are stored in the address 0 of the sub-buffer
  • the calculated pixel values of w pixel values belonging to the second pooling window are stored in sub-buffer address 2
  • the calculated pixel values of w pixel values belonging to the third pooling window are stored in sub-buffer address 3, and so on .
  • each sub-buffer there are a total of width addresses in each sub-buffer, where width corresponds to the number of image pixels in the row direction of the image to be processed. Taking FIG. 3 as an example, the width is 8. In this way, each sub-buffer can support the storage operation when the width of the pooling window is 1 pixel at most.
  • the storage space corresponding to each address can be divided into two parts, where the first part is the calculated pixel value of the above w pixel values, that is, the maximum pixel value, and the second part is the The address information corresponding to the maximum pixel value.
  • the address information corresponding to the maximum pixel value of the first pooling window is the address information of the image pixel 9.
  • the image pixel at the upper left corner of the image can be used as the origin to determine the address information of each image pixel.
  • the calculated pixel values of w pixel values of different rows in the same pooling window are stored in the same position in the corresponding sub-buffer. For example: as shown in Figure 5, if the calculated pixel values of the w pixel values in the first row in the same pooling window are stored in the corresponding position of address 0 of the sub-buffer 1, then the w in the second row in the same pooling window The calculated pixel value of each pixel value is stored in the address 0 corresponding position of the sub-buffer 2, and the calculated pixel value of the w pixel values in the third row of the same pooling window is stored in the address 0 corresponding position of the sub-buffer 3.
  • the calculated pixel values of the w pixel values of the first row in the same pooling window are stored in the corresponding location of address 2 of the sub-buffer 1
  • the calculated pixel values of the w pixel values of the second row in the same pooling window exist In the location corresponding to the address 2 of the sub-buffer 2
  • the calculated pixel values of the w pixel values in the third row in the same pooling window are stored in the location corresponding to the address 2 of the sub-buffer 3.
  • a possible implementation of determining the calculated pixel values of the w*h pixel values in the pooling window according to the calculated pixel values of the w pixel values in each row is: when the When the calculated pixel values of the w pixel values of the last row in the pooling window are stored, while storing the calculated pixel values of the w pixel values of the last row in the buffer, store the w pixels of the last row
  • the calculated pixel value of the value is input into the third register group;
  • the calculated pixel value of the w pixel values of each of the other h-1 rows in the pooling window is read from the buffer, and is input into the third register In the group; perform operations on the h arithmetic pixel values registered in the third register group, and determine the arithmetic pixel values of w*h pixel values in the pooling window.
  • the third register group includes at least h registers, and each register is used to register a single pixel value. Therefore, the third register can simultaneously register the arithmetic pixel values of w pixel values of each row in the same pooling window, that is, h The pixel value of the operation.
  • this embodiment Since this embodiment obtains the calculated pixel values of the w pixel values of the last row in the pooling window, it does not first input the calculated pixel values of the w pixel values of the last row into the buffer and then take it out of the buffer and input the third Register group, instead of inputting the calculated pixel values of w pixel values in the last row into the buffer, it also inputs the third register group, which multiplexes the time of inputting an arithmetic pixel value into the buffer, saving processing time and improving processing effectiveness.
  • the calculated pixel value of the w pixel values in the n+h row is obtained, the calculated pixel value of the w pixel values in the corresponding column direction in the nth row stored in the buffer is replaced with The calculated pixel value of the w pixel values in the n+hth row.
  • the sub-buffer 1 has stored the calculated pixel values of w pixel values in the nth row
  • the sub-buffer 2 has stored the calculated pixel values of w pixel values in the n+1th row
  • the sub-buffer 3 has stored the calculated pixel value of the w pixel value in the n+2th row, and the calculated pixel value of the w pixel value in the n+3th row is currently obtained, then the nth row stored in the buffer Replace the calculated pixel values of w pixel values in the n+3th row with the calculated pixel values of the w pixel values in the n+3th row.
  • a possible implementation manner for obtaining the arithmetic pixel values of the w pixel values is: performing operations on the w pixel values according to the pooling mode to obtain the arithmetic pixel values of the w pixel values.
  • the w pixel values in the first register group are operated according to the pooling mode to obtain the The calculated pixel values of w pixel values belonging to the same pooling window in the n rows.
  • the w pixel values in the second register group are operated according to the pooling mode to obtain the n+1th The calculated pixel values of w pixel values in the same pooling window in the row.
  • the third register group When the arithmetic pixel values of w pixel values belonging to each row in the same pooling window are input to the third register group, that is, the third register group simultaneously stores w belonging to each row in h rows in the same pooling window
  • the calculated pixel value of the pixel value is calculated on the h operation pixel values in the third register group according to the pooling mode to obtain the operation pixel values belonging to the w*h pixel values in the n+1th row in the same pooling window.
  • the calculated pixel value is the maximum pixel value, that is, the pixel values registered in the first register group or the second register group or the third register group are compared in size, and from these pixels The maximum pixel value is determined in the value, and the maximum pixel value is called the calculated pixel value of these pixel values.
  • the calculated pixel value is an accumulated pixel value. That is, the pixel values registered in the first register group or the second register group or the third register group are accumulated to obtain the accumulated pixel value of these pixel values, and the accumulated pixel value is called the calculated pixel value of these pixel values.
  • the calculated pixel value is an average pixel value. That is, the pixel values registered in the first register group or the second register group are accumulated to obtain the accumulated pixel value of these pixel values, and the accumulated pixel value is divided by w to obtain the average pixel value.
  • the average pixel value is called The calculated pixel value of w pixel values. Accumulate the pixel values registered in the third register group to obtain the accumulated pixel value of these pixel values, and divide the accumulated pixel value by h to obtain the average pixel value.
  • the average pixel value is called the w*h pixel value Calculate the pixel value.
  • a possible implementation manner of performing operations on the w pixel values according to the pooling mode to obtain the calculated pixel values is: combining the first register set or the second register set
  • the pixel value registered in is output to the arithmetic unit, so that the arithmetic unit outputs the arithmetic pixel value; and the arithmetic pixel value output by the arithmetic unit is acquired.
  • the w pixel values registered in the first register group or the second register group are output to the arithmetic unit to
  • the arithmetic unit is made to perform operations on the w pixel values according to the pooling mode to obtain the arithmetic pixel values of the w pixel values, and then obtain the arithmetic pixel values output by the arithmetic unit.
  • the h operation pixel values registered in the third register group are output to the operation unit, so that The arithmetic unit performs operations on h arithmetic pixel values according to the pooling mode to obtain the arithmetic pixel values of h arithmetic pixel values, and then obtains the arithmetic pixel values of the w*h row pixel values output by the arithmetic unit.
  • the arithmetic unit if the pooling mode is maximum pooling, the arithmetic unit is configured as a comparator; if the pooling mode is average pooling, the arithmetic unit is configured as an adder.
  • the operation unit includes an adder, and when the operation mode is average pooling, the adder outputs the accumulated pixel value.
  • the arithmetic unit may further include a multiplier. The multiplier multiplies the accumulated pixel value output by the adder by 1/w or 1/h to obtain the average pixel value.
  • the arithmetic unit is configured as a comparator to multiplex the adder.
  • the adder adds A and -B to get the sum value, which is AB, if AB is greater than 0, then A is greater than B, if AB is less than 0, then A is less than B, if AB is equal to 0, then A Equal to B.
  • B because the multiplier occupies more resources, when B is a signed number, B can be inverted and then added by 1 to obtain -B.
  • the arithmetic unit of this embodiment can reuse the adder to realize the function of the comparator, saving hardware cost.
  • the input of the arithmetic unit can also be configured according to the size of the pooling window. For example: if the width or height of the pooling window is 3 pixels, when the pooling mode is maximum pooling, the input of the first adder of the two adders in the arithmetic unit is configured as two of the to-be-calculated adders Pixel value, the input of the second adder of the two adders is the output of the first adder and the remaining pixel values. It should be noted that if the pooling mode is the maximum pooling, the inputs of the adders other than the above two adders in the arithmetic unit are configured to the minimum value. If the pooling mode is the average pooling, the The outputs of the adders other than the above two adders in the arithmetic unit are all configured as 0.
  • the arithmetic units that output the arithmetic pixel values of w pixel values in adjacent rows are a first arithmetic unit and a second arithmetic unit, respectively, and output the arithmetic pixels of w*h pixel values in the pooling window.
  • the operation unit of the value is the third operation unit.
  • the arithmetic pixel value used to obtain the w pixel values stored in the first register group is the first arithmetic unit
  • the arithmetic pixel value used to obtain the w pixel values stored in the second register group is the second arithmetic unit
  • the arithmetic pixel value used to obtain the h arithmetic pixel values stored in the third register group is the third arithmetic unit, and the third arithmetic unit is not the same arithmetic unit as the first arithmetic unit and the second arithmetic unit, so that the calculation can be guaranteed
  • the process is continuous and will not be interrupted, which improves the efficiency of pooling.
  • the filled pixel value is the minimum pixel value, which can ensure that the filled pixel value does not affect the actual maximum pixel value calculation result. If the pooling mode is average pooling, the filled pixel value is 0, which can ensure that the filled pixel value does not affect the actual average pixel value or the calculation result of the accumulated pixel value.
  • the pixel value of each pixel in each layer of the sub-image is the pixel value of the same bit of each pixel in the original image;
  • the image to be processed is any sub-image in the multi-layer sub-image. Then, the solutions of the foregoing embodiments are executed for each layer of sub-images.
  • the original image can be layered, for example, divided into two layers to obtain two layers of sub-images, which are the first layer of sub-images and the second layer of sub-images.
  • the pixel value of each pixel in the first layer sub-image can be the first to eighth bits in the pixel value of the corresponding pixel in the original image
  • the pixel value of each pixel in the second layer sub-image can be the original image The 9th to 16th bits in the pixel value of the corresponding pixel in.
  • the pooling result of the original image can also be obtained according to the pooling result of the first layer sub-images and the pooling result of the second layer sub-images. For example, the pooling results of the pooling windows corresponding to the sub-images of the first layer and the sub-images of the second layer are added.
  • the hardware required for processing the first-layer sub-image and the hardware required for processing the second-layer sub-image may not be the same hardware, so that the parallel processing of the first-layer sub-image and the second-layer sub-image is realized, and the pooling efficiency is improved.
  • the original image may also be divided into blocks, for example, the original image is divided into multiple blocks along the row direction and/or column direction, and then the solutions of the foregoing embodiments are executed for each image block. .
  • the data volume of the original image is relatively large, multiple image blocks can be processed separately, reducing the storage space required for image processing.
  • the foregoing embodiments can be used to process multiple original images at the same time, so as to further increase the degree of parallelism and improve the efficiency of the pooling operation. For example, if 32 original images are processed in parallel, and each image pixel in each image is 16 bits, then 512 bits of data can be input in one clock cycle. Optionally, each image pixel can also be divided into high 8 bits and low 8 bits to be processed separately.
  • the initial value in each register group is 0; if the pooling mode is maximized pooling, the initial value is the minimum pixel value, such as the pixel value 8 bits, the smallest pixel value represents -128.
  • the pixel value of image pixel 2 is input to register 1 of the first register group, and the pixel value of image pixel 1 registered by register 1 is input to register 2.
  • the pixel value of image pixel 3 is input to register 1 of the first register group, while the pixel value of image pixel 2 registered in register 1 is input to register 2 and the pixel value of image pixel 1 registered in register 2 is input to register 3. It also obtains the accumulated pixel value (or average pixel value or maximum pixel value) of the pixel values of image pixel 1, image pixel 2, image pixel 3 registered in the first register group, and inputs it to the address of sub-buffer 1 in the buffer. 1 in.
  • the pixel value of the image pixel 4 is input to the register 1 of the first register group, the pixel value of the image pixel 3 registered in the register 1 is input to the register 2 and the pixel value of the image pixel 2 registered in the register 2 is input to the register 3.
  • the pixel value of the image pixel 5 is input into the first register group, and the process of inputting the image pixel 5 will not be repeated here. It also obtains the accumulated pixel value (or average pixel value or maximum pixel value) of the pixel values of image pixel 3, image pixel 4, and image pixel 5 registered in the first register group, and inputs it to the address of sub-buffer 1 in the buffer. 2 in.
  • the pixel value of the image pixel 6 is input into the first register group, and the process of inputting the image pixel 6 is not repeated here.
  • the pixel value of the image pixel 7 is input into the first register group, and the process of inputting the image pixel 7 will not be repeated here. It also obtains the accumulated pixel value (or average pixel value or maximum pixel value) of the pixel values of image pixels 5, image pixels 6, and image pixels 7 registered in the first register group, and inputs them to the address of sub-buffer 1 in the buffer. 3 in.
  • the pixel value of the image pixel 8 is input into the first register group, and the process of inputting the image pixel 8 will not be repeated here.
  • the pixel value of the filling pixel adjacent to the image pixel 8 is input into the first register group, and the process of inputting the image pixel 8 will not be repeated here. It also obtains the accumulated pixel value (or average pixel value or maximum pixel value) of the pixel values of the image pixels 7, image pixels 8, and filling pixels registered in the first register group, and inputs them to the address 4 of the sub-buffer 1 in the buffer. in.
  • the pixel value of the image pixel 9 in the third row is input into the register 1 of the second register group, because at this time the pixel value of the image pixel 9
  • the value represents the accumulated pixel value (or average pixel value or maximum pixel value) of the third row in the first pooling window, and the pixel value of the image pixel 9 is also input into the address 0 of the sub-buffer 2 in the buffer.
  • the pixel value is input to the third register group. It also obtains the accumulated pixel value (or average pixel value or maximum pixel value) of the third row in the first pooling window from the location of address 0 of the sub-buffer 2 and enters it into the third register group, or, in the image pixel 9
  • the pixel value of is input into the position of address 0 of sub-buffer 2 in the buffer, and the pixel value of image pixel 9 is input into the third register group.
  • the pixel value of the image pixel 10 is input into the second register group, and the process of inputting the image pixel 10 will not be repeated here.
  • the pixel value of the image pixel 11 is input into the second register group, and the process of inputting the image pixel 11 will not be repeated here. It also obtains the accumulated pixel value (or average pixel value or maximum pixel value) of the pixel values of image pixel 9, image pixel 10, and image pixel 11 registered in the second register group, and inputs it to the address of sub-buffer 2 in the buffer. 1 in.
  • the accumulated pixel value (or average pixel value or maximum pixel value) of the third row in the second pooling window is input into the position of address 1 of the sub-buffer 2 in the buffer and into the third register group at the same time.
  • the pixel value of the image shown in Figure 3 is 8bit.
  • the image pixel value of the original image is 16bit. Therefore, the original image is disassembled into two images to be processed with a single pixel value of 8bit.
  • the parallelism of the char type is twice that of the short. Therefore, the 16bit type requires two similar hardware structures as described above. For example, when processing an image to be processed with a pixel value of 8bit, three register sets and three adders/comparators are required. For a 16-bit pixel value, a total of 6 register sets and 6 adders/comparators are required.
  • the bit width of the register is 16 bits, 3 register groups and 6 adders/comparators can be used. It can be understood that the amount of hardware required is compatible with the bit width of the hardware, and those skilled in the art can determine the amount of hardware according to actual application scenarios.
  • the data written into the sub-buffer comes from the maximum pixel value output by the comparator or the accumulated pixel value output by the adder. Since the sub-buffer is separated, each sub-buffer is independently controlled, and each sub-buffer is assigned an address here. Each comparator/adder will output the address write enable to output the calculated pixel value to the corresponding sub-buffer.
  • FIG. 6 is a schematic structural diagram of an image processing device provided by an embodiment of the application.
  • the image processing device 600 of this embodiment includes: a first register group 601, a second register group 602, and a processor 603 through a bus connection.
  • the image processing device 600 of this embodiment may further include a cache 604, and the cache 604 is connected to the foregoing components through a bus.
  • the image processing device 600 of this embodiment may further include a third register group 605, and the third register group 605 is connected to the foregoing components through a bus.
  • the image processing device 600 of this embodiment may further include an arithmetic unit 606, which is connected to the foregoing components through a bus. In this embodiment, three arithmetic units are shown, and the three arithmetic units are connected to the foregoing three registers. Group correspondence.
  • the edge of the image to be processed is provided with filled pixels.
  • the processor 603 is configured to sequentially input the pixel values of the pixels in the nth row in the image to be processed into the first register group 601, where n is any integer greater than or equal to 1, and the pixel values include Image pixel value and padding pixel value; when the adjacent padding pixel value of the last image pixel value in the nth row is input into the first register group 601, the n+1th row in the image An image pixel value is input to the second register group 602.
  • the processor 603 is further configured to:
  • the calculated pixel values of the w pixel values are obtained, and the width of the pooling window is w Pixels, the height of the pooling window is h pixels, and the pooling window slides in a row direction according to a preset row step length and slides in a column direction according to a preset column step length;
  • the calculated pixel values of w pixel values in each row in the same pooling window are obtained, the calculated pixel values of w*h pixel values in the pooling window are determined according to the calculated pixel values of w pixel values in each row .
  • the first register group 601 or the second register group 602 includes at least w registers, and each register is used to register a single pixel value.
  • the processor 603 is further configured to store the calculated pixel values of the w pixel values in the buffer 604 after obtaining the calculated pixel values of the w pixel values.
  • the buffer 604 includes at least h sub-buffers, and the calculated pixel values of w pixel values of different rows in the same pooling window are stored in different sub-buffers.
  • the calculated pixel values of w pixel values of different rows in the same pooling window are stored in the same location in the corresponding sub-buffer 604.
  • the processor 603 when the processor 603 determines the calculated pixel values of w*h pixel values in the pooling window according to the calculated pixel values of w pixel values in each row, it is specifically configured to:
  • the processor 603 is further configured to:
  • the processor 603 when the processor 603 obtains the calculated pixel values of the w pixel values, it is specifically configured to: perform operations on the w pixel values according to a pooling mode to obtain the calculated pixel values.
  • the calculated pixel value is the maximum pixel value; if the pooling mode is average pooling, the calculated pixel value is the average pixel value or Accumulate pixel values.
  • the processor 603, when performing operations on the w pixel values according to the pooling mode to obtain the calculated pixel values, is specifically configured to: use the first register set 601 or the The pixel value registered in the second register group 602 is output to the arithmetic unit 606 so that the arithmetic unit 606 outputs the arithmetic pixel value; and the arithmetic pixel value output by the arithmetic unit 606 is obtained.
  • the processor 603 is further configured to:
  • the arithmetic unit 606 configures the arithmetic unit 606 as a comparator
  • the computing unit 606 is configured as an adder.
  • the processor 603 is further configured to configure the input of the computing unit 606 according to the size of the pooling window.
  • the arithmetic unit 606 that outputs the arithmetic pixel values of w pixel values in adjacent rows is a first arithmetic unit and a second arithmetic unit, and outputs the arithmetic of w*h pixel values in the pooling window.
  • the pixel value calculation unit 606 is the third calculation unit.
  • the filled pixel value is the smallest pixel value
  • the filled pixel value is 0.
  • the processor 603 is further configured to perform layered processing on the original image to obtain multiple sub-images;
  • the pixel value of each pixel in the sub-image of each layer is the pixel value of the same bit of each pixel in the original image
  • the image to be processed is any sub-image in the multi-layer sub-image.
  • the image processing device 600 of this embodiment may further include: a memory (not shown in the figure) for storing program codes.
  • the memory is used for storing program codes.
  • the image processing device 600 can implement the above-mentioned technical solutions.
  • the image processing device of this embodiment can be used to implement the technical solutions of FIG. 2 and the corresponding method embodiment, and its implementation principles and technical effects are similar, and will not be repeated here.
  • Another embodiment of the present application further provides an image processing device including a memory and a processor; the memory is used for storing program instructions, and the processor is used for calling the program instructions in the memory to execute the solutions of the foregoing embodiments.
  • FIG. 7 is a schematic structural diagram of a movable platform provided by an embodiment of the application.
  • the movable platform 700 of this embodiment may include: a first register set 701, a second register set 702, and a processor 703 Bus connection.
  • the movable platform 700 of this embodiment may further include a cache 704, and the cache 704 is connected to the foregoing components through a bus.
  • the movable platform 700 of this embodiment may further include a third register set 705, and the third register set 705 is connected to the foregoing components through a bus.
  • the movable platform 700 of this embodiment may further include an arithmetic unit 706, which is connected to the above-mentioned components through a bus. In this embodiment, three arithmetic units are shown, and the three arithmetic units are connected to the above-mentioned three registers. Group correspondence.
  • the edge of the image to be processed is provided with filled pixels.
  • the processor 703 is configured to sequentially input the pixel values of the pixels in the nth row in the image to be processed into the first register group 701, where n is any integer greater than or equal to 1, and the pixel values include Image pixel value and padding pixel value; when the adjacent padding pixel value of the last image pixel value in the nth row is input into the first register group 701, the n+1th row in the image An image pixel value is input to the second register group 702.
  • the processor 703 is further configured to:
  • the calculated pixel values of the w pixel values are obtained, and the width of the pooling window is w Pixels, the height of the pooling window is h pixels, and the pooling window slides in a row direction according to a preset row step length and slides in a column direction according to a preset column step length;
  • the calculated pixel values of w pixel values in each row in the same pooling window are obtained, the calculated pixel values of w*h pixel values in the pooling window are determined according to the calculated pixel values of w pixel values in each row .
  • the first register group 701 or the second register group 702 includes at least w registers, and each register is used to register a single pixel value.
  • the processor 703 is further configured to store the calculated pixel values of the w pixel values in the buffer 704 after obtaining the calculated pixel values of the w pixel values.
  • the buffer 704 includes at least h sub-buffers, and the calculated pixel values of w pixel values of different rows in the same pooling window are stored in different sub-buffers.
  • the calculated pixel values of w pixel values of different rows in the same pooling window are stored in the same position in the corresponding sub-buffer 704.
  • the processor 703 determines the calculated pixel values of w*h pixel values in the pooling window according to the calculated pixel values of w pixel values in each row, it is specifically configured to:
  • the processor 703 is further configured to:
  • the processor 703 when the processor 703 obtains the calculated pixel values of the w pixel values, it is specifically configured to: perform operations on the w pixel values according to a pooling mode to obtain the calculated pixel values.
  • the calculated pixel value is the maximum pixel value; if the pooling mode is average pooling, the calculated pixel value is the average pixel value or Accumulate pixel values.
  • the processor 703, when performing operations on the w pixel values according to the pooling mode to obtain the calculated pixel values, is specifically configured to: use the first register set 701 or the The pixel value registered in the second register group 702 is output to the arithmetic unit 706 so that the arithmetic unit 706 outputs the arithmetic pixel value; and the arithmetic pixel value output by the arithmetic unit 706 is obtained.
  • the processor 703 is further configured to:
  • the arithmetic unit 706 configures the arithmetic unit 706 as a comparator
  • the computing unit 706 is configured as an adder.
  • the processor 703 is further configured to configure the input of the computing unit 706 according to the size of the pooling window.
  • the arithmetic unit 706 that outputs the arithmetic pixel values of w pixel values in adjacent rows is a first arithmetic unit and a second arithmetic unit, and outputs the arithmetic of w*h pixel values in the pooling window.
  • the pixel value calculation unit 706 is the third calculation unit.
  • the filled pixel value is the smallest pixel value
  • the filled pixel value is 0.
  • the processor 703 is further configured to perform layered processing on the original image to obtain multiple layers of sub-images;
  • the pixel value of each pixel in the sub-image of each layer is the pixel value of the same bit of each pixel in the original image
  • the image to be processed is any sub-image in the multi-layer sub-image.
  • the movable platform 700 of this embodiment may further include: a memory (not shown in the figure) for storing program codes, the memory is used for storing program codes, and when the program codes are executed, the movable platform 700 can implement the above-mentioned technical solutions.
  • the movable platform of this embodiment can be used to implement the technical solutions of FIG. 2 and the corresponding method embodiments, and its implementation principles and technical effects are similar, and will not be repeated here.
  • FIG. 8 is a schematic structural diagram of a movable platform provided by another embodiment of this application.
  • the movable platform 800 of this embodiment may include: a movable platform body 801 and an image processing device 802.
  • the image processing device 802 is installed on the movable platform body 801.
  • the image processing device 802 may be a device independent of the movable platform body 801.
  • the image processing device 802 may adopt the structure of the apparatus embodiment shown in FIG. 6, and correspondingly, may execute the technical solutions of FIG. 2 and its corresponding method embodiments. The implementation principles and technical effects are similar, and will not be repeated here.
  • a person of ordinary skill in the art can understand that all or part of the steps in the above method embodiments can be implemented by a program instructing relevant hardware.
  • the foregoing program can be stored in a computer readable storage medium. When the program is executed, it is executed. Including the steps of the foregoing method embodiment; and the foregoing storage medium includes: read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), magnetic disks or optical disks, etc., which can store program codes Medium.

Abstract

An image processing method and device, and a movable platform. A filling pixel is provided on the edge of an image to be processed. The method comprises: sequentially inputting pixel values of pixels in an n-th row in said image into a first register group, n being any integer greater than or equal to 1; the pixel value comprising an image pixel value and a filling pixel value (S201); and when an adjacent filling pixel value of a pixel value of the last image in the n-th row is input into the first register group, inputting a pixel value of a first image in an (n+1)-th row in said image into a second register group (S202). Therefore, the time when the pixel values in the (n+1)-th row are input into the second register group overlaps with some of the time when the pixel values in the n-th row are input into the first register group, which improves the image processing efficiency.

Description

图像处理方法、设备和可移动平台Image processing method, equipment and movable platform 技术领域Technical field
本申请实施例涉及图像处理技术领域,尤其涉及一种图像处理方法、设备和可移动平台。The embodiments of the present application relate to the field of image processing technology, and in particular, to an image processing method, device, and movable platform.
背景技术Background technique
随着人工智能行业的快速发展,基于卷积神经网络的处理器得到广泛的应用,以无人机为例,无人机在飞行的过程中采集图像,基于卷积神经网络的处理器可以对图像进行识别处理,识别图像中的目标物,以确保无人机的飞行安全。其中,卷积神经网络一般包括:卷积层(Convolution Layer),激活函数层(Activation Layer)、标准化层(Normalization Layer)、降采样层(Pooling Layer)、全连接层(Fully Connected Layer),其中,池化操作位于卷积神经网络的降采样层,降采样层可以对特征图进行缩小,根据功能不同,池化操作可以分为最大池化和平均池化。最大池化在于求取池化窗中的最大值,平均池化在于求取池化窗中的平均值。为了尽量保留图像边缘的信息,通常会在图像的周围填充一些像素,然而目前执行池化操作时需要将图像的像素值以及填充的像素值依次输入同一寄存器中,在当前行的像素值均输入该寄存器后,才能开始输入下一行的像素值,导致池化效率较低。With the rapid development of the artificial intelligence industry, processors based on convolutional neural networks have been widely used. Taking drones as an example, drones collect images during the flight, and processors based on convolutional neural networks can The image is recognized and processed to identify the target in the image to ensure the flight safety of the UAV. Among them, convolutional neural networks generally include: Convolution Layer, Activation Layer, Normalization Layer, Downsampling Layer, Fully Connected Layer, among them The pooling operation is located in the down-sampling layer of the convolutional neural network. The down-sampling layer can reduce the feature map. According to different functions, the pooling operation can be divided into maximum pooling and average pooling. Maximum pooling is to find the maximum value in the pooling window, and average pooling is to find the average value in the pooling window. In order to preserve the information of the edge of the image as much as possible, some pixels are usually filled around the image. However, when the current pooling operation is performed, the pixel value of the image and the filled pixel value need to be input into the same register in turn, and the pixel values in the current row are all input Only after this register can you start to input the pixel value of the next line, resulting in low pooling efficiency.
发明内容Summary of the invention
本申请实施例提供一种图像处理方法、设备和可移动平台,以节省处理时间,提高处理效率。The embodiments of the present application provide an image processing method, equipment, and a movable platform to save processing time and improve processing efficiency.
第一方面,本申请实施例提供一种图像处理方法,待处理的图像边缘设有填充像素,所述方法包括:In a first aspect, an embodiment of the present application provides an image processing method, where the edges of the image to be processed are provided with padding pixels, and the method includes:
将所述待处理的图像中第n行的像素的像素值依次输入第一寄存器组中,所述n为大于等于1的任一整数,所述像素值包括图像像素值和填充像素值;Sequentially input the pixel values of the pixels in the nth row in the image to be processed into the first register group, where n is any integer greater than or equal to 1, and the pixel values include image pixel values and padding pixel values;
当将所述第n行中最后一个图像像素值的相邻填充像素值输入所述第一寄存器组中时,将所述图像中第n+1行的第一个图像像素值输入第二寄存器 组。When the adjacent filling pixel value of the last image pixel value in the nth row is input into the first register group, the first image pixel value in the n+1th row in the image is input into the second register group.
第二方面,本申请实施例提供一种图像处理设备,待处理的图像边缘设有填充像素,所述图像处理设备包括:第一寄存器组、第二寄存器组和处理器;In a second aspect, an embodiment of the present application provides an image processing device, where the edges of the image to be processed are provided with padding pixels, and the image processing device includes: a first register group, a second register group, and a processor;
所述处理器,用于将所述待处理的图像中第n行的像素的像素值依次输入第一寄存器组中,所述n为大于等于1的任一整数,所述像素值包括图像像素值和填充像素值;当将所述第n行中最后一个图像像素值的相邻填充像素值输入所述第一寄存器组中时,将所述图像中第n+1行的第一个图像像素值输入第二寄存器组。The processor is configured to sequentially input the pixel values of the pixels in the nth row in the image to be processed into the first register group, where n is any integer greater than or equal to 1, and the pixel values include image pixels Value and padding pixel value; when the adjacent padding pixel value of the last image pixel value in the nth row is input into the first register group, the first image in the n+1th row in the image The pixel value is input to the second register group.
第三方面,本申请实施例提供一种可移动平台,包括:可移动平台本体以及如第二方面本申请实施例所述的图像处理设备,其中,所述图像处理设备安装于所述可移动平台本体上。In a third aspect, an embodiment of the present application provides a movable platform, including: a movable platform body and the image processing device according to the embodiment of the present application in the second aspect, wherein the image processing device is installed on the movable platform. On the platform body.
第四方面,本申请实施例提供一种可读存储介质,所述可读存储介质上存储有计算机程序;所述计算机程序在被执行时,实现如第一方面本申请实施例所述的图像处理方法。In a fourth aspect, an embodiment of the present application provides a readable storage medium with a computer program stored on the readable storage medium; when the computer program is executed, it realizes the image described in the embodiment of the present application in the first aspect. Approach.
第五方面,本申请实施例提供一种程序产品,所述程序产品包括计算机程序,所述计算机程序存储在可读存储介质中,可移动平台的至少一个处理器可以从所述可读存储介质读取所述计算机程序,所述至少一个处理器执行所述计算机程序使得可移动平台实施如第一方面本申请实施例所述的图像处理方法。In a fifth aspect, an embodiment of the present application provides a program product, the program product includes a computer program, the computer program is stored in a readable storage medium, and at least one processor of a removable platform can download from the readable storage medium The computer program is read, and the at least one processor executes the computer program to enable the mobile platform to implement the image processing method described in the embodiment of the present application in the first aspect.
本申请实施例提供的图像处理方法、设备和可移动平台,通过将待处理的图像中第n行的像素的像素值依次输入第一寄存器组中,当将所述第n行中最后一个图像像素值的相邻填充像素值输入所述第一寄存器组中时,将所述图像中第n+1行的第一个图像像素值输入第二寄存器组。由于本实施例中设有第一寄存器组和第二寄存器组,相邻行的像素的像素值可分别输入不同的寄存器组,在将第n行的像素的像素值未完全输入至第一寄存器组时,可开始将第n+1行的第一个图像像素值输入至第二寄存器组中,因此,第n+1行的像素值输入第二寄存器组的时间复用了第n行的像素值输入第一寄存器组的部分时间,提高了图像处理效率。The image processing method, device, and movable platform provided by the embodiments of the present application input the pixel values of the pixels in the nth row of the image to be processed into the first register group in sequence, and when the last image in the nth row is input When the adjacent filled pixel value of the pixel value is input into the first register group, the first image pixel value of the n+1th row in the image is input into the second register group. Since the first register group and the second register group are provided in this embodiment, the pixel values of pixels in adjacent rows can be input into different register groups respectively, and the pixel values of pixels in the nth row are not completely input to the first register. When grouping, you can start to input the first image pixel value of the n+1th row into the second register group. Therefore, the time when the pixel value of the n+1th row is input into the second register group is multiplexed with the nth row Part of the time for the pixel value to be input to the first register set improves the image processing efficiency.
附图说明Description of the drawings
为了更清楚地说明本申请实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作一简单地介绍,显而易见地,下面描述中的附图是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly describe the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings that need to be used in the description of the embodiments or the prior art. Obviously, the drawings in the following description These are some embodiments of the present application. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative work.
图1是根据本申请的实施例的无人飞行系统的示意性架构图;Fig. 1 is a schematic architecture diagram of an unmanned aerial system according to an embodiment of the present application;
图2为本申请一实施例提供的图像处理方法的流程图;FIG. 2 is a flowchart of an image processing method provided by an embodiment of the application;
图3为本申请一实施例提供的待处理的图像中各像素的一种示意图;FIG. 3 is a schematic diagram of each pixel in an image to be processed according to an embodiment of the application;
图4为本申请一实施例提供的第一寄存器组或第二寄存器组的一种示意图;FIG. 4 is a schematic diagram of the first register set or the second register set provided by an embodiment of the application;
图5为本申请一实施例提供的缓存的一种示意图;FIG. 5 is a schematic diagram of a cache provided by an embodiment of this application;
图6为本申请一实施例提供的图像处理设备的结构示意图;Fig. 6 is a schematic structural diagram of an image processing device provided by an embodiment of the application;
图7为本申请一实施例提供的可移动平台的结构示意图;FIG. 7 is a schematic structural diagram of a movable platform provided by an embodiment of this application;
图8为本申请另一实施例提供的可移动平台的结构示意图。FIG. 8 is a schematic structural diagram of a movable platform provided by another embodiment of the application.
具体实施方式Detailed ways
为使本申请实施例的目的、技术方案和优点更加清楚,下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。In order to make the purpose, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be described clearly and completely in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments It is a part of the embodiments of the present application, but not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by a person of ordinary skill in the art without creative work shall fall within the protection scope of this application.
本申请的实施例提供了图像处理方法、设备和可移动平台,其中,可移动平台可以是手持电话、手持云台、无人机、无人车、无人船、机器人或自动驾驶汽车等。以下对本申请可移动平台的描述使用无人机作为示例。对于本领域技术人员将会显而易见的是,可以不受限制地使用其他类型的无人机,本申请的实施例可以应用于各种类型的无人机。例如,无人机可以是小型或大型的无人机。在某些实施例中,无人机可以是旋翼无人机(rotorcraft),例如,由多个推动装置通过空气推动的多旋翼无人机,本申请的实施例并不限于此,无人机也可以是其它类型的无人机。The embodiments of the present application provide an image processing method, equipment, and a movable platform, where the movable platform may be a handheld phone, a handheld PTZ, a drone, an unmanned vehicle, an unmanned boat, a robot, or an autonomous vehicle, etc. The following description of the mobile platform of this application uses drones as an example. It will be obvious to those skilled in the art that other types of drones can be used without restriction, and the embodiments of the present application can be applied to various types of drones. For example, the drone can be a small or large drone. In some embodiments, the drone may be a rotorcraft, for example, a multi-rotor drone that is propelled by multiple propulsion devices through the air. The embodiments of the present application are not limited to this, and the drone It can also be other types of drones.
图1是根据本申请的实施例的无人飞行系统的示意性架构图。本实施例 以旋翼无人机为例进行说明。Fig. 1 is a schematic architecture diagram of an unmanned aerial system according to an embodiment of the present application. In this embodiment, a rotary wing drone is taken as an example for description.
无人飞行系统100可以包括无人机110、显示设备130和遥控设备140。其中,无人机110可以包括动力系统150、飞行控制系统160、机架和承载在机架上的云台120。无人机110可以与遥控设备140和显示设备130进行无线通信。The unmanned aerial system 100 may include a drone 110, a display device 130, and a remote control device 140. Among them, the UAV 110 may include a power system 150, a flight control system 160, a frame, and a pan/tilt 120 carried on the frame. The drone 110 can wirelessly communicate with the remote control device 140 and the display device 130.
机架可以包括机身和脚架(也称为起落架)。机身可以包括中心架以及与中心架连接的一个或多个机臂,一个或多个机臂呈辐射状从中心架延伸出。脚架与机身连接,用于在无人机110着陆时起支撑作用。The frame may include a fuselage and a tripod (also called a landing gear). The fuselage may include a center frame and one or more arms connected to the center frame, and the one or more arms extend radially from the center frame. The tripod is connected with the fuselage, and is used for supporting the UAV 110 when it is landed.
动力系统150可以包括一个或多个电子调速器(简称为电调)151、一个或多个螺旋桨153以及与一个或多个螺旋桨153相对应的一个或多个电机152,其中电机152连接在电子调速器151与螺旋桨153之间,电机152和螺旋桨153设置在无人机110的机臂上;电子调速器151用于接收飞行控制系统160产生的驱动信号,并根据驱动信号提供驱动电流给电机152,以控制电机152的转速。电机152用于驱动螺旋桨旋转,从而为无人机110的飞行提供动力,该动力使得无人机110能够实现一个或多个自由度的运动。在某些实施例中,无人机110可以围绕一个或多个旋转轴旋转。例如,上述旋转轴可以包括横滚轴(Roll)、偏航轴(Yaw)和俯仰轴(pitch)。应理解,电机152可以是直流电机,也可以交流电机。另外,电机152可以是无刷电机,也可以是有刷电机。The power system 150 may include one or more electronic governors (referred to as ESCs) 151, one or more propellers 153, and one or more motors 152 corresponding to the one or more propellers 153, wherein the motors 152 are connected to Between the electronic governor 151 and the propeller 153, the motor 152 and the propeller 153 are arranged on the arm of the UAV 110; the electronic governor 151 is used to receive the driving signal generated by the flight control system 160 and provide driving according to the driving signal Current is supplied to the motor 152 to control the speed of the motor 152. The motor 152 is used to drive the propeller to rotate, thereby providing power for the flight of the drone 110, and the power enables the drone 110 to achieve one or more degrees of freedom of movement. In some embodiments, the drone 110 may rotate about one or more rotation axes. For example, the aforementioned rotation axis may include a roll axis (Roll), a yaw axis (Yaw), and a pitch axis (pitch). It should be understood that the motor 152 may be a DC motor or an AC motor. In addition, the motor 152 may be a brushless motor or a brushed motor.
飞行控制系统160可以包括飞行控制器161和传感系统162。传感系统162用于测量无人机的姿态信息,即无人机110在空间的位置信息和状态信息,例如,三维位置、三维角度、三维速度、三维加速度和三维角速度等。传感系统162例如可以包括陀螺仪、超声传感器、电子罗盘、惯性测量单元(Inertial Measurement Unit,IMU)、视觉传感器、全球导航卫星系统和气压计等传感器中的至少一种。例如,全球导航卫星系统可以是全球定位系统(Global Positioning System,GPS)。飞行控制器161用于控制无人机110的飞行,例如,可以根据传感系统162测量的姿态信息控制无人机110的飞行。应理解,飞行控制器161可以按照预先编好的程序指令对无人机110进行控制,也可以通过响应来自遥控设备140的一个或多个遥控信号对无人机110进行控制。The flight control system 160 may include a flight controller 161 and a sensing system 162. The sensing system 162 is used to measure the attitude information of the drone, that is, the position information and state information of the drone 110 in space, such as three-dimensional position, three-dimensional angle, three-dimensional velocity, three-dimensional acceleration, and three-dimensional angular velocity. The sensing system 162 may include, for example, at least one of sensors such as a gyroscope, an ultrasonic sensor, an electronic compass, an inertial measurement unit (IMU), a vision sensor, a global navigation satellite system, and a barometer. For example, the global navigation satellite system may be the Global Positioning System (GPS). The flight controller 161 is used to control the flight of the drone 110, for example, it can control the flight of the drone 110 according to the attitude information measured by the sensor system 162. It should be understood that the flight controller 161 can control the drone 110 according to pre-programmed program instructions, and can also control the drone 110 by responding to one or more remote control signals from the remote control device 140.
云台120可以包括电机122。云台用于携带拍摄装置123。飞行控制器161可以通过电机122控制云台120的运动。可选地,作为另一实施例,云台120还可以包括控制器,用于通过控制电机122来控制云台120的运动。应理解,云台120可以独立于无人机110,也可以为无人机110的一部分。应理解,电机122可以是直流电机,也可以是交流电机。另外,电机122可以是无刷电机,也可以是有刷电机。还应理解,云台可以位于无人机的顶部,也可以位于无人机的底部。The pan/tilt head 120 may include a motor 122. The pan/tilt is used to carry the camera 123. The flight controller 161 can control the movement of the pan-tilt 120 through the motor 122. Optionally, as another embodiment, the pan/tilt head 120 may further include a controller for controlling the movement of the pan/tilt head 120 by controlling the motor 122. It should be understood that the pan-tilt 120 may be independent of the drone 110 or a part of the drone 110. It should be understood that the motor 122 may be a DC motor or an AC motor. In addition, the motor 122 may be a brushless motor or a brushed motor. It should also be understood that the pan-tilt can be located on the top of the drone, or on the bottom of the drone.
拍摄装置123例如可以是照相机或摄像机等用于捕获图像的设备,拍摄装置123可以与飞行控制器通信,并在飞行控制器的控制下进行拍摄。本实施例的拍摄装置123至少包括感光元件,该感光元件例如为互补金属氧化物半导体(Complementary Metal Oxide Semiconductor,CMOS)传感器或电荷耦合元件(Charge-coupled Device,CCD)传感器。可以理解,拍摄装置123也可直接固定于无人机110上,从而云台120可以省略。The photographing device 123 may be, for example, a device for capturing images, such as a camera or a video camera, and the photographing device 123 may communicate with the flight controller and take pictures under the control of the flight controller. The imaging device 123 of this embodiment at least includes a photosensitive element, and the photosensitive element is, for example, a Complementary Metal Oxide Semiconductor (CMOS) sensor or a Charge-coupled Device (CCD) sensor. It can be understood that the camera 123 can also be directly fixed to the drone 110, so the pan/tilt 120 can be omitted.
显示设备130位于无人飞行系统100的地面端,可以通过无线方式与无人机110进行通信,并且可以用于显示无人机110的姿态信息。另外,还可以在显示设备130上显示拍摄装置123拍摄的图像。应理解,显示设备130可以是独立的设备,也可以集成在遥控设备140中。The display device 130 is located on the ground end of the unmanned aerial system 100, can communicate with the drone 110 in a wireless manner, and can be used to display the attitude information of the drone 110. In addition, the image photographed by the photographing device 123 may also be displayed on the display device 130. It should be understood that the display device 130 may be an independent device or integrated in the remote control device 140.
遥控设备140位于无人飞行系统100的地面端,可以通过无线方式与无人机110进行通信,用于对无人机110进行远程操纵。The remote control device 140 is located on the ground end of the unmanned aerial system 100, and can communicate with the drone 110 in a wireless manner for remote control of the drone 110.
应理解,上述对于无人飞行系统各组成部分的命名仅是出于标识的目的,并不应理解为对本申请的实施例的限制。It should be understood that the aforementioned naming of the components of the unmanned aerial system is only for identification purposes, and should not be understood as a limitation to the embodiments of the present application.
其中,对上述拍摄装置123拍摄获得的图像可采用本申请各实施例的方案进行处理。Among them, the image captured by the above-mentioned photographing device 123 may be processed using the solutions of the embodiments of the present application.
图2为本申请一实施例提供的图像处理方法的流程图,如图2所示,本实施例的方法可以包括:FIG. 2 is a flowchart of an image processing method provided by an embodiment of this application. As shown in FIG. 2, the method of this embodiment may include:
S201、将待处理的图像中第n行的像素的像素值依次输入第一寄存器组中,所述n为大于等于1的任一整数,所述像素值包括图像像素值和填充像素值。S201. Input the pixel values of the pixels in the nth row in the image to be processed into the first register group in sequence, where n is any integer greater than or equal to 1, and the pixel values include image pixel values and padding pixel values.
S202、当将所述第n行中最后一个图像像素值的相邻填充像素值输入所述第一寄存器组中时,将所述图像中第n+1行的第一个图像像素值输入第二 寄存器组。S202. When inputting the adjacent filling pixel value of the last image pixel value in the nth row into the first register group, input the first image pixel value of the n+1th row in the image into the first register group. Two register bank.
本实施例中,待处理的图像边缘设有填充像素,如图3所示,待处理的图像的像素包括图像像素和填充像素,图3中数字表示的像素为图像像素,填充像素位于图像像素区域的四周,图3中空白表示的像素为填充像素,其中,图像像素的像素值称为图像像素值,填充像素的像素值称为填充像素值。例如:填充像素分别填充在待处理的图像的第一行和最后一行,以及待处理的图像的第1-2列、倒数第1-2列,其中,待处理的图像行方向填充的填充像素的行数以及列方向填充的填充像素的列数不限于此,可按具体实际应用场景而定。其中,待处理的图像中第1行中的数字1至8表示的像素为图像像素,例如:数字1表示图像像素1,数字2表示图像像素2,其它行也类似。In this embodiment, the edge of the image to be processed is provided with filled pixels. As shown in Figure 3, the pixels of the image to be processed include image pixels and filled pixels. The pixels represented by numbers in Figure 3 are image pixels, and the filled pixels are located in image pixels. Around the area, the pixels indicated by the blanks in Figure 3 are filled pixels. Among them, the pixel value of the image pixel is called the image pixel value, and the pixel value of the filled pixel is called the filled pixel value. For example: the filling pixels are respectively filled in the first row and the last row of the image to be processed, as well as the 1-2 columns and the last 1-2 columns of the image to be processed. Among them, the filling pixels are filled in the row direction of the image to be processed The number of rows and the number of columns of filled pixels filled in the column direction are not limited to this, and can be determined according to specific actual application scenarios. Among them, the pixels represented by numbers 1 to 8 in the first row of the image to be processed are image pixels. For example, the number 1 represents image pixel 1, the number 2 represents image pixel 2, and other rows are similar.
本实施例中,将待处理的图像中第n行的像素的像素值依次输入第一寄存器组中,n为大于等于1的任一整数,当将所述第n行中最后一个图像像素值的相邻填充像素值输入所述第一寄存器组中时,将所述图像中第n+1行的第一个图像像素值输入第二寄存器组。然后将待处理的图像中第n+1行的像素的像素值依次输入第二寄存器组中,当将所述第n+1行中最后一个图像像素值的相邻填充像素值输入所述第二寄存器组中时,将所述图像中第n+2行的第一个图像像素值输入第一寄存器组。以此类推,后续不再赘述。在一些情况下,第一寄存器组可以为第二寄存器组,第二寄存器组可以为第一寄存器组,例如:在输入第n+1行的像素的像素值时,第二寄存器组作为第一寄存器组,在输入第n+2行的像素的像素值时,第一寄存器组作为第二寄存器组。在另一些实现方式中,也可以是在将所述第n行中最后一个图像像素后的任一填充像素的像素值输入所述第一寄存器组中时,将所述图像中第n+1行的第一个图像像素值输入第二寄存器组。In this embodiment, the pixel values of the pixels in the nth row of the image to be processed are sequentially input into the first register group, where n is any integer greater than or equal to 1, when the last image pixel value in the nth row is When the adjacent padding pixel value of is input into the first register group, the pixel value of the first image in the n+1th row in the image is input into the second register group. Then the pixel values of the pixels in the n+1th row of the image to be processed are sequentially input into the second register group. When the adjacent filling pixel value of the last image pixel value in the n+1th row is input into the first When in the second register group, input the pixel value of the first image in the n+2th row in the image into the first register group. By analogy, I won't repeat it in the follow-up. In some cases, the first register group may be the second register group, and the second register group may be the first register group. For example, when the pixel value of the pixel in the n+1th row is input, the second register group serves as the first register group. In the register group, when the pixel value of the pixel in the n+2th row is input, the first register group serves as the second register group. In other implementations, when the pixel value of any filling pixel after the last image pixel in the nth row is input into the first register group, the n+1th pixel in the image The first image pixel value of the row is input into the second register group.
而相关技术中,是将第n行的像素的像素值全部输入至寄存器组后,才开始将第n+1行的像素的像素值全部输入至寄存器组。而本申请实施例中设有两组寄存器组(第一寄存器组和第二寄存器组),相邻两行的像素的像素值分别输入至不同的寄存器组,所以本实施例在第n行的像素的像素值未全部输入至第一寄存器组时,就开始将第n+1行的像素的像素值输入第二寄存器组,因此,第n+1行的像素值输入第二寄存器组的时间复用了第n行的像素值输入第一寄存器组的部分时间,提高了图像处理效率。In the related art, all the pixel values of the pixels in the nth row are input to the register group before all the pixel values of the pixels in the n+1th row are input to the register group. In the embodiment of this application, there are two sets of register sets (the first register set and the second register set), and the pixel values of the pixels in two adjacent rows are input to different register sets. Therefore, in this embodiment, the When the pixel value of the pixel is not all input to the first register group, the pixel value of the pixel in the n+1th row is input to the second register group. Therefore, the time when the pixel value in the n+1th row is input to the second register group Part of the time when the pixel value of the nth row is input to the first register group is multiplexed, which improves the image processing efficiency.
以n等于2,即如图3中的第2行为例,将图像像素1的像素值输入第一寄存器组,再将图像像素2的像素值输入第一寄存器组,…,再将图像像素的像素值输入第一寄存器组,再将倒数第二个填充像素的像素值输入第一寄存器组,再将最后一个填充像素的像素值输入第一寄存器组。其中,当将倒数第二个填充像素的像素值输入第一寄存器组时,将第3行中的图像像素9的像素值输入第二寄存器组中,而且在将倒数第1个填充像素的像素值输入第一寄存器组时,将第3行中的图像像素10的像素值输入第二寄存器组中,对相邻两行来说节省了输入两个像素值的时间,或者,当倒数第一个填充像素的像素值输入第一寄存器组中,将第3行中的图像像素9的像素值输入第二寄存器组中,对相邻两行来说节省了向第一寄存器组输入1个像素值的时间。Taking n equal to 2, that is, the second line in Figure 3, the pixel value of image pixel 1 is input to the first register group, and then the pixel value of image pixel 2 is input to the first register group,..., and then the pixel value of the image pixel is input to the first register group. The pixel value is input to the first register group, the pixel value of the penultimate filling pixel is input to the first register group, and the pixel value of the last filling pixel is input to the first register group. Among them, when the pixel value of the penultimate filling pixel is input to the first register group, the pixel value of the image pixel 9 in the third row is input into the second register group, and the pixel value of the penultimate filling pixel is input to the second register group. When the value is input to the first register group, the pixel value of the image pixel 10 in the third row is input into the second register group, which saves the time of inputting two pixel values for two adjacent rows, or when the last one is the last Input the pixel value of one filling pixel into the first register group, and input the pixel value of the image pixel 9 in the third row into the second register group. For two adjacent rows, it saves inputting 1 pixel into the first register group. Value of time.
本实施例中,通过将待处理的图像中第n行的像素的像素值依次输入第一寄存器组中,当将所述第n行中最后一个图像像素值的相邻填充像素值输入所述第一寄存器组中时,将所述图像中第n+1行的第一个图像像素值输入第二寄存器组。由于本实施例中设有第一寄存器组和第二寄存器组,相邻行的像素的像素值可分别输入不同的寄存器组,在将第n行的像素的像素值未完全输入至第一寄存器组时,可开始将第n+1行的第一个图像像素值输入至第二寄存器组中,因此,第n+1行的像素值输入第二寄存器组的时间复用了第n行的像素值输入第一寄存器组的部分时间,提高了图像处理效率。In this embodiment, by sequentially inputting the pixel values of the pixels in the nth row of the image to be processed into the first register group, when the adjacent filling pixel value of the last image pixel value in the nth row is input into the When in the first register set, input the pixel value of the first image in the n+1th row in the image into the second register set. Since the first register group and the second register group are provided in this embodiment, the pixel values of pixels in adjacent rows can be input into different register groups respectively, and the pixel values of pixels in the nth row are not completely input to the first register. When grouping, you can start to input the first image pixel value of the n+1th row into the second register group. Therefore, the time when the pixel value of the n+1th row is input into the second register group is multiplexed with the nth row Part of the time for the pixel value to be input to the first register set improves the image processing efficiency.
在一些实施例中,池化窗的宽度为w个像素,所述池化窗的高度为h个像素,所述池化窗根据预设行步长沿行方向滑动并根据预设列步长沿列方向滑动,池化窗可以包括待处理的图像中连续h行中连续w列的像素,总像素为w*h个像素。其中,每次池化窗滑动,池化窗会包括滑动后相应位置的像素。当第n行中属于同一池化窗内的w个像素值输入至第一寄存器组中时,也就是当第一寄存器组中已寄存w个像素值,并且这w个像素值属于待处理的图像中同一行,以及还属于同一池化窗,本实施例还获取所述w个像素值的运算像素值,例如获取第一寄存器组中寄存的w个像素值,并对w个像素值进行相应运算,获得运算结果,该运算结果称为该w个像素值的运算像素值。因此,可以获得第n行中属于不同池化窗内的w个像素值的运算像素值。In some embodiments, the width of the pooling window is w pixels, the height of the pooling window is h pixels, and the pooling window slides in the row direction according to the preset row step length and according to the preset column step length Sliding along the column direction, the pooling window may include pixels in consecutive h rows of w consecutive columns in the image to be processed, and the total pixels are w*h pixels. Among them, each time the pooling window slides, the pooling window will include the pixels at the corresponding position after the sliding. When w pixel values belonging to the same pooling window in the nth row are input into the first register group, that is, when w pixel values have been registered in the first register group, and these w pixel values belong to the to-be-processed In the same row in the image, and also belong to the same pooling window, this embodiment also obtains the calculated pixel values of the w pixel values, for example, obtains the w pixel values registered in the first register group, and performs operations on the w pixel values. Corresponding operations, the operation result is obtained, and the operation result is called the operation pixel value of the w pixel values. Therefore, the calculated pixel values of w pixel values belonging to different pooling windows in the nth row can be obtained.
当第n+1行中属于同一池化窗内的w个像素值输入至第二寄存器组中时, 也就是当第二寄存器组中已寄存w个像素值,并且这w个像素值属于待处理的图像中同一行,以及还属于同一池化窗,本实施例还获取所述w个像素值的运算像素值,例如获取第二寄存器组中寄存的w个像素值,并对w个像素值进行相应运算,获得运算结果,该运算结果称为该w个像素值的运算像素值。因此,可以获得第n+1行中属于同一池化窗内的w个像素值的运算像素值。When w pixel values belonging to the same pooling window in the n+1th row are input into the second register group, that is, when w pixel values have been registered in the second register group, and these w pixel values belong to the In the processed image for the same row and also belong to the same pooling window, this embodiment also obtains the calculated pixel values of the w pixel values, for example, obtains the w pixel values registered in the second register group, and compares the w pixels Perform corresponding operations on the values to obtain the result of the operation. The result of the operation is called the calculated pixel value of the w pixel values. Therefore, the calculated pixel values of w pixel values belonging to the same pooling window in the n+1th row can be obtained.
类似处理,可以获得第n+h-1行中属于同一池化窗内的w个像素值的运算像素值。Similar processing, the calculated pixel values of the w pixel values belonging to the same pooling window in the n+h-1th row can be obtained.
其中,当获得同一池化窗内每行的w个像素值的运算像素值时,根据每行的w个像素值的运算像素值,确定所述池化窗中w*h个像素值的运算像素值。例如当获得同一池化窗内第n行的w个像素值的运算像素值、第n+1行的w个像素值的运算像素值、…、第n+h-1行的w个像素值的运算像素值时,对同一池化窗内第n行的w个像素值的运算像素值、第n+1行的w个像素值的运算像素值、…、第n+h-1行的w个像素值的运算像素值进行相应运算,获得运算结果,该运算结果称为该池化窗中w*h个像素值的运算像素值。Wherein, when the calculated pixel values of the w pixel values of each row in the same pooling window are obtained, the calculation of w*h pixel values in the pooling window is determined according to the calculated pixel values of the w pixel values of each row Pixel values. For example, when obtaining the calculated pixel value of the w pixel values of the nth row in the same pooling window, the calculated pixel value of the w pixel values of the n+1th row,..., the w pixel values of the n+h-1th row When calculating the pixel value of the same pooling window, the calculated pixel value of the w pixel values of the nth row, the calculated pixel value of the w pixel values of the n+1th row,..., the n+h-1th row of the same pooling window The calculated pixel values of w pixel values are subjected to corresponding calculations to obtain the calculation result, which is called the calculated pixel value of w*h pixel values in the pooling window.
其中,池化窗每滑动一次输出一个池化结果,该池化结果即为对应运算获得的w*h个像素值的运算像素值。Among them, each time the pooling window slides, a pooling result is output, and the pooling result is the calculated pixel value of the w*h pixel values obtained by the corresponding operation.
在一些实施例中,所述第一寄存器组或所述第二寄存器组至少包括w个寄存器,每个寄存器用于寄存单个像素值。In some embodiments, the first register group or the second register group includes at least w registers, and each register is used to register a single pixel value.
本实施例中,第一寄存器组中至少包括w个寄存器,并且第一寄存器组寄存的像素值的个数与第一寄存器组包括的寄存器的数量相同,因此,第一寄存器组可寄存的像素值为至少w个。第二寄存器组中至少包括w个寄存器,并且第二寄存器组寄存的像素值的个数与第二寄存器组包括的寄存器的数量相同,因此,第二寄存器组可寄存的像素值为至少w个。In this embodiment, the first register group includes at least w registers, and the number of pixel values registered in the first register group is the same as the number of registers included in the first register group. Therefore, the pixels that can be registered in the first register group The value is at least w. The second register group includes at least w registers, and the number of pixel values registered in the second register group is the same as the number of registers included in the second register group. Therefore, the second register group can register at least w pixel values .
以第一寄存器组或第二寄存器组中包括w个寄存器为例,该w例如为3,如图4所示,从左到右的方向分别为寄存器1、寄存器2和寄存器3,在将待处理的图像的像素的像素值输入第一寄存器组或第二寄存器组时,是将图像的像素的像素值在连续的时钟周期内,输入该寄存器组。Taking the first register group or the second register group including w registers as an example, the w is 3, for example, as shown in Fig. 4, the directions from left to right are register 1, register 2, and register 3 respectively. When the pixel values of the pixels of the processed image are input into the first register group or the second register group, the pixel values of the pixels of the image are input into the register group in consecutive clock cycles.
以图3中第二行的像素的像素值为例,若寄存器1已寄存图像像素3的像素值,寄存器2已寄存图像像素2的像素值,寄存器3已寄存图像像素1 的像素值,若需要输入图像像素4的像素值时,则在下一个时钟周期内,将图像像素4的像素值输入寄存器1,同时将寄存器1中寄存的图像像素3的像素值输入寄存器2、将寄存器2中寄存的图像像素2的像素值输入寄存器3,也即将寄存器1的值更新为图像像素4的像素值、将寄存器2的值更新为图像像素3的像素值、将寄存器3的值更新为图像像素2的像素值。这样保证第一寄存器组中寄存的是3个像素的像素值,并且寄存的是最近输入的3个像素的像素值。Taking the pixel value of the pixel in the second row in Figure 3, for example, if register 1 has registered the pixel value of image pixel 3, register 2 has registered the pixel value of image pixel 2, and register 3 has registered the pixel value of image pixel 1, if When the pixel value of image pixel 4 needs to be input, in the next clock cycle, the pixel value of image pixel 4 is input to register 1, and the pixel value of image pixel 3 registered in register 1 is input to register 2, and register 2 is registered The pixel value of image pixel 2 is input to register 3, that is, the value of register 1 is updated to the pixel value of image pixel 4, the value of register 2 is updated to the pixel value of image pixel 3, and the value of register 3 is updated to image pixel 2. The pixel value. In this way, it is ensured that the pixel values of 3 pixels are registered in the first register group, and the pixel values of the most recently input 3 pixels are registered.
在一些实施例中,在获取w个像素值的运算像素值之后,将该w个像素值的运算像素值存储至缓存中,以便在获得同一池化窗内每行的w个像素值的运算像素值时,及时从缓存中获取之前运算获得的同一池化窗内各行的w个像素值的运算像素值。In some embodiments, after obtaining the calculated pixel values of w pixel values, the calculated pixel values of the w pixel values are stored in a buffer, so that the calculation of the w pixel values of each row in the same pooling window is obtained. When the pixel value is used, the calculated pixel value of the w pixel values of each row in the same pooling window obtained by the previous operation is obtained from the cache in time.
在一些实施例中,所述缓存至少包括h个子缓存,以保证同一池化窗内不同行的w个像素值的运算像素值可以同时存储在缓存中。同一池化窗内不同行的w个像素值的运算像素值存储在不同的子缓存中,以便在获取同一池化窗内各行的w个像素值的运算像素值时分别从不同的子缓存中获取,以提高获取运算像素值的效率。例如h等于3,以缓存包括3个子缓存为例,如图5所示,同一池化窗内第n行的w个像素值的运算像素值存储在子缓存1中,第n+1行的w个像素值的运算像素值存储在子缓存2中,第n+2行的w个像素值的运算像素值存储在子缓存3中。In some embodiments, the buffer includes at least h sub-buffers to ensure that the calculated pixel values of w pixel values of different rows in the same pooling window can be stored in the buffer at the same time. The calculated pixel values of w pixel values of different rows in the same pooling window are stored in different sub-buffers, so that the calculated pixel values of w pixel values of each row in the same pooling window are obtained from different sub-buffers. Obtain, in order to improve the efficiency of obtaining the calculated pixel value. For example, h is equal to 3, and the buffer includes 3 sub-buffers as an example. As shown in Figure 5, the calculated pixel values of the w pixel values of the nth row in the same pooling window are stored in sub-buffer 1, and the n+1th row The calculated pixel values of w pixel values are stored in the sub-buffer 2, and the calculated pixel values of the w pixel values in the n+2th row are stored in the sub-buffer 3.
可选地,属于同一行且属于不同池化窗内的w个像素值的运算像素值可以存储在同一子缓存中。在池化窗沿列方向进行滑动时会形成多个池化窗,如图5所示,第n行中属于第一个池化窗的w个像素值的运算像素值存在子缓存的地址0中,属于第2个池化窗的w个像素值的运算像素值存在子缓存地址2中,属于第3个池化窗的w个像素值的运算像素值存在子缓存地址3中,以此类推。Optionally, the calculated pixel values of w pixel values belonging to the same row and belonging to different pooling windows may be stored in the same sub-buffer. When the pooling window slides in the column direction, multiple pooling windows are formed. As shown in Figure 5, the calculated pixel values of w pixel values belonging to the first pooling window in the nth row are stored in the address 0 of the sub-buffer , The calculated pixel values of w pixel values belonging to the second pooling window are stored in sub-buffer address 2, and the calculated pixel values of w pixel values belonging to the third pooling window are stored in sub-buffer address 3, and so on .
可选的,每个子缓存中共有width个地址,其中width对应于待处理图像在行方向上的图像像素的个数,以图3为例,width为8。如此,每个子缓存最大可以支持池化窗的宽度为1个像素时的存储操作。Optionally, there are a total of width addresses in each sub-buffer, where width corresponds to the number of image pixels in the row direction of the image to be processed. Taking FIG. 3 as an example, the width is 8. In this way, each sub-buffer can support the storage operation when the width of the pooling window is 1 pixel at most.
可选的,当执行最大池化操作时,每个地址对应的存储空间可分为两部分,其中第一部分为上述w个像素值的运算像素值,也即最大像素值,第二 部分为该最大像素值对应的地址信息。如此,在后续输出每个池化窗的最大像素值时,可以同时输出该最大像素值对应的地址信息,以便于后续处理。以图3为例,第一个池化窗的最大像素值对应的地址信息为图像像素9的地址信息。示例的,可以以图像左上角的图像像素为原点确定每个图像像素的地址信息。Optionally, when the maximum pooling operation is performed, the storage space corresponding to each address can be divided into two parts, where the first part is the calculated pixel value of the above w pixel values, that is, the maximum pixel value, and the second part is the The address information corresponding to the maximum pixel value. In this way, when the maximum pixel value of each pooling window is subsequently output, the address information corresponding to the maximum pixel value can be output at the same time to facilitate subsequent processing. Taking FIG. 3 as an example, the address information corresponding to the maximum pixel value of the first pooling window is the address information of the image pixel 9. For example, the image pixel at the upper left corner of the image can be used as the origin to determine the address information of each image pixel.
在一些实施例中,同一池化窗内不同行的w个像素值的运算像素值存储在相应子缓存中的相同位置。例如:如图5所示,若同一个池化窗内第1行的w个像素值的运算像素值存在子缓存1的地址0对应位置中,则同一个池化窗内第2行的w个像素值的运算像素值存在子缓存2的地址0对应位置中,同一个池化窗内第3行的w个像素值的运算像素值存在子缓存3的地址0对应位置中。若同一个池化窗内第1行的w个像素值的运算像素值存在子缓存1的地址2对应位置中,则同一个池化窗内第2行的w个像素值的运算像素值存在子缓存2的地址2对应位置中,同一个池化窗内第3行的w个像素值的运算像素值存在子缓存3的地址2对应位置中。In some embodiments, the calculated pixel values of w pixel values of different rows in the same pooling window are stored in the same position in the corresponding sub-buffer. For example: as shown in Figure 5, if the calculated pixel values of the w pixel values in the first row in the same pooling window are stored in the corresponding position of address 0 of the sub-buffer 1, then the w in the second row in the same pooling window The calculated pixel value of each pixel value is stored in the address 0 corresponding position of the sub-buffer 2, and the calculated pixel value of the w pixel values in the third row of the same pooling window is stored in the address 0 corresponding position of the sub-buffer 3. If the calculated pixel values of the w pixel values of the first row in the same pooling window are stored in the corresponding location of address 2 of the sub-buffer 1, then the calculated pixel values of the w pixel values of the second row in the same pooling window exist In the location corresponding to the address 2 of the sub-buffer 2, the calculated pixel values of the w pixel values in the third row in the same pooling window are stored in the location corresponding to the address 2 of the sub-buffer 3.
因此,在获取缓存中同一池化窗内各行的w个像素值的运算像素值时,根据相同的地址信息,从各个子缓存内的相同位置获取运算像素值,即可获得同一池化窗内各行的w个像素值的运算像素值。Therefore, when obtaining the calculated pixel value of the w pixel values of each row in the same pooling window in the buffer, according to the same address information, obtain the calculated pixel value from the same position in each sub-buffer, and you can obtain the calculated pixel value in the same pooling window. The calculated pixel value of the w pixel values of each row.
在一些实施例中,上述根据每行的w个像素值的运算像素值,确定所述池化窗中w*h个像素值的运算像素值的一种可能的实现方式为:当获得所述池化窗中最后一行的w个像素值的运算像素值时,则在将所述最后一行的w个像素值的运算像素值存储至所述缓存的同时,将所述最后一行的w个像素值的运算像素值输入第三寄存器组中;从所述缓存中读取所述池化窗内其它h-1行中每行的w个像素值的运算像素值,并输入所述第三寄存器组中;对所述第三寄存器组中寄存的h个运算像素值进行运算,确定所述池化窗中w*h个像素值的运算像素值。可选的,同一个池化窗的最后一行的w个像素值的运算像素值,以及其它h-1行中每行的w个像素值的运算像素值可以同时输入至第三寄存器组中。In some embodiments, a possible implementation of determining the calculated pixel values of the w*h pixel values in the pooling window according to the calculated pixel values of the w pixel values in each row is: when the When the calculated pixel values of the w pixel values of the last row in the pooling window are stored, while storing the calculated pixel values of the w pixel values of the last row in the buffer, store the w pixels of the last row The calculated pixel value of the value is input into the third register group; the calculated pixel value of the w pixel values of each of the other h-1 rows in the pooling window is read from the buffer, and is input into the third register In the group; perform operations on the h arithmetic pixel values registered in the third register group, and determine the arithmetic pixel values of w*h pixel values in the pooling window. Optionally, the calculated pixel values of w pixel values in the last row of the same pooling window and the calculated pixel values of w pixel values in each row in other h-1 rows can be simultaneously input into the third register group.
本实施例中,第三寄存器组至少包括h个寄存器,每个寄存器用于寄存单个像素值,所以第三寄存器可以同时寄存同一池化窗内各行的w个像素值的运算像素值,即h个运算像素值。In this embodiment, the third register group includes at least h registers, and each register is used to register a single pixel value. Therefore, the third register can simultaneously register the arithmetic pixel values of w pixel values of each row in the same pooling window, that is, h The pixel value of the operation.
由于本实施例在获得池化窗中最后一行的w个像素值的运算像素值时,并不是将最后一行的w个像素值的运算像素值先输入缓存中后再从缓存中取出输入第三寄存器组,而是在将最后一行的w个像素值的运算像素值输入缓存的同时还输入第三寄存器组,复用了将一个运算像素值输入缓存的时间,节省了处理时间,提高了处理效率。Since this embodiment obtains the calculated pixel values of the w pixel values of the last row in the pooling window, it does not first input the calculated pixel values of the w pixel values of the last row into the buffer and then take it out of the buffer and input the third Register group, instead of inputting the calculated pixel values of w pixel values in the last row into the buffer, it also inputs the third register group, which multiplexes the time of inputting an arithmetic pixel value into the buffer, saving processing time and improving processing effectiveness.
在一些实施例中,在获得第n+h行中w个像素值的运算像素值后,还将所述缓存中存储的第n行中相应列方向的w个像素值的运算像素值替换为所述第n+h行中w个像素值的运算像素值。以如图5所示,以h=3为例,若子缓存1已存储第n行中w个像素值的运算像素值,子缓存2已存储第n+1行中w个像素值的运算像素值,子缓存3已存储第n+2行中w个像素值的运算像素值,而且当前获得第n+3行中w个像素值的运算像素值,则将缓存中存储的该第n行中w个像素值的运算像素值替换为第n+3行中w个像素值的运算像素值,例如:将第n+3行中依次获得的w个像素值的运算像素值依次存储至子缓存1的各个地址对应的位置,这样缓存中包括h个子缓存就可以更新存储最新获得的h行的w个像素值的运算像素值,节省缓存空间。In some embodiments, after the calculated pixel value of the w pixel values in the n+h row is obtained, the calculated pixel value of the w pixel values in the corresponding column direction in the nth row stored in the buffer is replaced with The calculated pixel value of the w pixel values in the n+hth row. As shown in Figure 5, taking h=3 as an example, if the sub-buffer 1 has stored the calculated pixel values of w pixel values in the nth row, and the sub-buffer 2 has stored the calculated pixel values of w pixel values in the n+1th row The sub-buffer 3 has stored the calculated pixel value of the w pixel value in the n+2th row, and the calculated pixel value of the w pixel value in the n+3th row is currently obtained, then the nth row stored in the buffer Replace the calculated pixel values of w pixel values in the n+3th row with the calculated pixel values of the w pixel values in the n+3th row. For example, store the calculated pixel values of the w pixel values sequentially obtained in the n+3th row in the sub The location corresponding to each address of the buffer 1, so that the buffer including h sub-buffers can update the calculated pixel values storing the w pixel values of the h rows newly obtained, thereby saving buffer space.
在一些实施例中,上述获得w个像素值的运算像素值的一种可能的实现方式为:根据池化模式对w个像素值进行运算,得到w个像素值的运算像素值。本实施例中,当第n行中属于同一池化窗内的w个像素值输入至第一寄存器组中时,根据池化模式对第一寄存器组中的w个像素值进行运算,得到第n行中属于同一池化窗内的w个像素值的运算像素值。当第n+1行中属于同一池化窗内的w个像素值输入至第二寄存器组中时,根据池化模式对第二寄存器组中的w个像素值进行运算,得到第n+1行中属于同一池化窗内的w个像素值的运算像素值。In some embodiments, a possible implementation manner for obtaining the arithmetic pixel values of the w pixel values is: performing operations on the w pixel values according to the pooling mode to obtain the arithmetic pixel values of the w pixel values. In this embodiment, when w pixel values belonging to the same pooling window in the nth row are input into the first register group, the w pixel values in the first register group are operated according to the pooling mode to obtain the The calculated pixel values of w pixel values belonging to the same pooling window in the n rows. When the w pixel values belonging to the same pooling window in the n+1th row are input into the second register group, the w pixel values in the second register group are operated according to the pooling mode to obtain the n+1th The calculated pixel values of w pixel values in the same pooling window in the row.
当属于同一池化窗内的每行的w个像素值的运算像素值输入至第三寄存器组时,即第三寄存器组中同时存储有属于同一池化窗内h行中每行的w个像素值的运算像素值,根据池化模式对第三寄存器组中的h个运算像素值进行运算,得到属于同一池化窗中第n+1行中w*h个像素值的运算像素值。When the arithmetic pixel values of w pixel values belonging to each row in the same pooling window are input to the third register group, that is, the third register group simultaneously stores w belonging to each row in h rows in the same pooling window The calculated pixel value of the pixel value is calculated on the h operation pixel values in the third register group according to the pooling mode to obtain the operation pixel values belonging to the w*h pixel values in the n+1th row in the same pooling window.
可选地,若池化模式为最大池化,则运算像素值为最大像素值,即对第一寄存器组或第二寄存器组或第三寄存器组中寄存的像素值进行大小比较,从这些像素值中确定最大像素值,该最大像素值称为这些像素值的运算像素 值。Optionally, if the pooling mode is the maximum pooling, the calculated pixel value is the maximum pixel value, that is, the pixel values registered in the first register group or the second register group or the third register group are compared in size, and from these pixels The maximum pixel value is determined in the value, and the maximum pixel value is called the calculated pixel value of these pixel values.
可选地,若池化模式为均值池化,则所述运算像素值为累加像素值。也就是对第一寄存器组或第二寄存器组或第三寄存器组中寄存的像素值进行累加,获得这些像素值的累加像素值,该累加像素值称为这些像素值的运算像素值。Optionally, if the pooling mode is average pooling, the calculated pixel value is an accumulated pixel value. That is, the pixel values registered in the first register group or the second register group or the third register group are accumulated to obtain the accumulated pixel value of these pixel values, and the accumulated pixel value is called the calculated pixel value of these pixel values.
可选地,若池化模式为均值池化,则所述运算像素值为平均像素值。也就是对第一寄存器组或第二寄存器组中寄存的像素值进行累加,获得这些像素值的累加像素值,并将该累加像素值除以w,获得平均像素值,该平均像素值称为w个像素值的运算像素值。对第三寄存器组中寄存的像素值进行累加,获得这些像素值的累加像素值,并将该累加像素值除以h,获得平均像素值,该平均像素值称为w*h个像素值的运算像素值。Optionally, if the pooling mode is average pooling, the calculated pixel value is an average pixel value. That is, the pixel values registered in the first register group or the second register group are accumulated to obtain the accumulated pixel value of these pixel values, and the accumulated pixel value is divided by w to obtain the average pixel value. The average pixel value is called The calculated pixel value of w pixel values. Accumulate the pixel values registered in the third register group to obtain the accumulated pixel value of these pixel values, and divide the accumulated pixel value by h to obtain the average pixel value. The average pixel value is called the w*h pixel value Calculate the pixel value.
在一些实施例中,上述根据池化模式对所述w个像素值进行运算,得到所述运算像素值的一种可能的实现方式为:将所述第一寄存器组或所述第二寄存器组中寄存的像素值,输出给运算单元,以使所述运算单元输出所述运算像素值;以及获取所述运算单元输出的所述运算像素值。In some embodiments, a possible implementation manner of performing operations on the w pixel values according to the pooling mode to obtain the calculated pixel values is: combining the first register set or the second register set The pixel value registered in is output to the arithmetic unit, so that the arithmetic unit outputs the arithmetic pixel value; and the arithmetic pixel value output by the arithmetic unit is acquired.
在第一寄存器组或第二寄存器组中同时寄存有同一池化窗内的w个像素值时,将该第一寄存器组或第二寄存器组中寄存的w个像素值,输出运算单元,以使运算单元根据池化模式对w个像素值进行运算,得到w个像素值的运算像素值,然后获得运算单元输出的运算像素值。When the w pixel values in the same pooling window are registered in the first register group or the second register group at the same time, the w pixel values registered in the first register group or the second register group are output to the arithmetic unit to The arithmetic unit is made to perform operations on the w pixel values according to the pooling mode to obtain the arithmetic pixel values of the w pixel values, and then obtain the arithmetic pixel values output by the arithmetic unit.
在第三寄存器组中同时寄存有同一池化窗内h行中各行的w个像素值的运算像素值时,将该第三寄存器组中寄存的h个运算像素值,输出运算单元,以使运算单元根据池化模式对h个运算像素值进行运算,得到h个运算像素值的运算像素值,然后获得运算单元输出的w*h行像素值的运算像素值。When the operation pixel values of the w pixel values of each row in h rows in the same pooling window are registered in the third register group at the same time, the h operation pixel values registered in the third register group are output to the operation unit, so that The arithmetic unit performs operations on h arithmetic pixel values according to the pooling mode to obtain the arithmetic pixel values of h arithmetic pixel values, and then obtains the arithmetic pixel values of the w*h row pixel values output by the arithmetic unit.
在一些实施例中,若所述池化模式为最大池化,将所述运算单元配置为比较器;若所述池化模式为均值池化,将所述运算单元配置为加法器。在一些实施例中,运算单元包括加法器,当运算模式为均值池化时,加法器输出累加像素值。可选地,若运算像素值为平均像素值,运算单元还可以包括乘法器,乘法器将加法器输出的累加像素值与1/w或者1/h相乘,获得平均像素值。In some embodiments, if the pooling mode is maximum pooling, the arithmetic unit is configured as a comparator; if the pooling mode is average pooling, the arithmetic unit is configured as an adder. In some embodiments, the operation unit includes an adder, and when the operation mode is average pooling, the adder outputs the accumulated pixel value. Optionally, if the calculated pixel value is an average pixel value, the arithmetic unit may further include a multiplier. The multiplier multiplies the accumulated pixel value output by the adder by 1/w or 1/h to obtain the average pixel value.
可选地,将运算单元配置为比较器可以复用加法器,将两个像素值进行 比较时,将其中一个像素值A输入加法器,将另一个像素值B与-1相乘得到-B也输入加法器,加法器对A与-B相加,得到和值,即为A-B,如果A-B大于0,则A大于B,若A-B小于0,则A小于B,若A-B等于0,则A等于B。在一些实施例中,由于乘法器占用的资源较多,当B为一个有符号数时,可以将B取反后加1得到-B。Optionally, the arithmetic unit is configured as a comparator to multiplex the adder. When two pixel values are compared, one of the pixel values A is input to the adder, and the other pixel value B is multiplied by -1 to obtain -B Also input the adder, the adder adds A and -B to get the sum value, which is AB, if AB is greater than 0, then A is greater than B, if AB is less than 0, then A is less than B, if AB is equal to 0, then A Equal to B. In some embodiments, because the multiplier occupies more resources, when B is a signed number, B can be inverted and then added by 1 to obtain -B.
因此,本实施例的运算单元可以复用加法器来实现比较器的功能,节省硬件成本。Therefore, the arithmetic unit of this embodiment can reuse the adder to realize the function of the comparator, saving hardware cost.
在一些实施例中,还可以根据池化窗的大小,对运算单元的输入进行配置。例如:若池化窗的宽度或高度为3个像素,当池化模式为最大池化时,将运算单元中2个加法器中的第一个加法器的输入配置为待运算的其中两个像素值,该2个加法器中第二个加法器的输入为第一个加法器的输出和剩余的像素值。需要说明的是,若池化模式为最大池化,则将运算单元中除上述2个加法器之外的其它加法器的输入均配置为最小值,若池化模式为均值池化,则将运算单元中除上述2个加法器之外的其它加法器的输出均配置为0。In some embodiments, the input of the arithmetic unit can also be configured according to the size of the pooling window. For example: if the width or height of the pooling window is 3 pixels, when the pooling mode is maximum pooling, the input of the first adder of the two adders in the arithmetic unit is configured as two of the to-be-calculated adders Pixel value, the input of the second adder of the two adders is the output of the first adder and the remaining pixel values. It should be noted that if the pooling mode is the maximum pooling, the inputs of the adders other than the above two adders in the arithmetic unit are configured to the minimum value. If the pooling mode is the average pooling, the The outputs of the adders other than the above two adders in the arithmetic unit are all configured as 0.
在一些实施例中,输出相邻行中w个像素值的运算像素值的运算单元分别为第一运算单元和第二运算单元,输出所述池化窗中w*h个像素值的运算像素值的运算单元为第三运算单元。In some embodiments, the arithmetic units that output the arithmetic pixel values of w pixel values in adjacent rows are a first arithmetic unit and a second arithmetic unit, respectively, and output the arithmetic pixels of w*h pixel values in the pooling window. The operation unit of the value is the third operation unit.
例如:用于获取第一寄存器组中存储的w个像素值的运算像素值为第一运算单元,用于获取第二寄存器组中存储的w个像素值的运算像素值为第二运算单元,也就是用于分别输出相邻行中w个像素值的运算像素值的运算单元不是同一运算单元,可以保证相邻两行的运算不会相互影响,节省池化时间,提高池化效率。另外,用于获取第三寄存器组中存储的h个运算像素值的运算像素值为第三运算单元,第三运算单元与第一运算单元、第二运算单元不是同一运算单元,这样可以保证运算过程连续,不会中断,提高了池化效率。For example: the arithmetic pixel value used to obtain the w pixel values stored in the first register group is the first arithmetic unit, and the arithmetic pixel value used to obtain the w pixel values stored in the second register group is the second arithmetic unit, That is, the arithmetic units used to respectively output the arithmetic pixel values of w pixel values in adjacent rows are not the same arithmetic unit, which can ensure that the operations of two adjacent rows will not affect each other, save pooling time and improve pooling efficiency. In addition, the arithmetic pixel value used to obtain the h arithmetic pixel values stored in the third register group is the third arithmetic unit, and the third arithmetic unit is not the same arithmetic unit as the first arithmetic unit and the second arithmetic unit, so that the calculation can be guaranteed The process is continuous and will not be interrupted, which improves the efficiency of pooling.
在一些实施例中,若所述池化模式为最大池化,则所述填充像素值为最小像素值,可以保证填充像素值不会影响实际的最大像素值的运算结果。若所述池化模式为均值池化,则所述填充像素值为0,可以保证填充像素值不会影响实际的平均像素值或累加像素值的运算结果。In some embodiments, if the pooling mode is maximum pooling, the filled pixel value is the minimum pixel value, which can ensure that the filled pixel value does not affect the actual maximum pixel value calculation result. If the pooling mode is average pooling, the filled pixel value is 0, which can ensure that the filled pixel value does not affect the actual average pixel value or the calculation result of the accumulated pixel value.
在一些实施例中,还可以对原始图像进行分层处理,获得多层子图像; 所述每层子图像中每个像素的像素值为原始图像中每个像素的相同位的像素值;所述待处理的图像为所述多层子图像中的任一子图像。然后对每层子图像执行上述各实施例的方案。In some embodiments, it is also possible to perform layered processing on the original image to obtain a multi-layer sub-image; the pixel value of each pixel in each layer of the sub-image is the pixel value of the same bit of each pixel in the original image; The image to be processed is any sub-image in the multi-layer sub-image. Then, the solutions of the foregoing embodiments are executed for each layer of sub-images.
若原始图像中的像素值为16位(bit),则可以对原始图像进行分层处理,例如分为两层,获得两层子图像,分别为第一层子图像和第二层子图像,其中,第一层子图像中每个像素的像素值可以是原始图像中对应像素的像素值中的第1位至第8位,第二层子图像中每个像素的像素值可以是原始图像中对应像素的像素值中的第9位至第16位。然后对第一层子图像执行上述各实施例的方案,获得第一层子图像的池化结果,以及对第二层子图像执行上述各实施例的方案,获得第二层子图像的池化结果。本实施例还可以根据第一层子图像的池化结果与第二层子图像的池化结果,得到原始图像的池化结果。例如,将第一层子图像与第二层子图像对应的池化窗的池化结果进行相加。If the pixel value in the original image is 16 bits, the original image can be layered, for example, divided into two layers to obtain two layers of sub-images, which are the first layer of sub-images and the second layer of sub-images. Among them, the pixel value of each pixel in the first layer sub-image can be the first to eighth bits in the pixel value of the corresponding pixel in the original image, and the pixel value of each pixel in the second layer sub-image can be the original image The 9th to 16th bits in the pixel value of the corresponding pixel in. Then execute the solutions of the foregoing embodiments on the first layer of sub-images to obtain the pooling result of the first layer of sub-images, and execute the solutions of the foregoing embodiments on the second layer of sub-images to obtain the pooling of the second layer of sub-images result. In this embodiment, the pooling result of the original image can also be obtained according to the pooling result of the first layer sub-images and the pooling result of the second layer sub-images. For example, the pooling results of the pooling windows corresponding to the sub-images of the first layer and the sub-images of the second layer are added.
其中,处理第一层子图像所需的硬件与处理第二层子图像所需的硬件可以不是同一硬件,从而实现并行处理第一层子图像和第二层子图像,提高池化效率。Among them, the hardware required for processing the first-layer sub-image and the hardware required for processing the second-layer sub-image may not be the same hardware, so that the parallel processing of the first-layer sub-image and the second-layer sub-image is realized, and the pooling efficiency is improved.
在一些实施例中,还可以对原始图像进行分块处理,例如,沿行方向和/或列方向上将原始图像划分为多个分块,然后对每个图像块执行上述各实施例的方案。如此,当原始图像的数据量比较大时,可以将多个图像块进行单独处理,减少图像处理所需要的存储空间。In some embodiments, the original image may also be divided into blocks, for example, the original image is divided into multiple blocks along the row direction and/or column direction, and then the solutions of the foregoing embodiments are executed for each image block. . In this way, when the data volume of the original image is relatively large, multiple image blocks can be processed separately, reducing the storage space required for image processing.
在一些实施例中,上述各实施例可用于同时处理多张原始图像,以进一步提高并行度,提高池化操作的效率。例如并行处理32张原始图像,每张图像中每个图像像素为16bit,那么在一个时钟周期中可以输入512bit的数据。可选的,每个图像像素也可分为高8位和低8位分别处理。In some embodiments, the foregoing embodiments can be used to process multiple original images at the same time, so as to further increase the degree of parallelism and improve the efficiency of the pooling operation. For example, if 32 original images are processed in parallel, and each image pixel in each image is 16 bits, then 512 bits of data can be input in one clock cycle. Optionally, each image pixel can also be divided into high 8 bits and low 8 bits to be processed separately.
下面参照图3至图5,对本申请一种实现方式进行描述。Hereinafter, an implementation manner of the present application will be described with reference to FIGS. 3 to 5.
根据池化模式设置各寄存器组中的初始值,若池化模式为均值池化,则初始值为0,若池化模式为最大化池化,则初始值为最小像素值,比如像素值为8比特,则最小像素值表示的是-128。Set the initial value in each register group according to the pooling mode. If the pooling mode is average pooling, the initial value is 0; if the pooling mode is maximized pooling, the initial value is the minimum pixel value, such as the pixel value 8 bits, the smallest pixel value represents -128.
将图3中第2行的图像像素1的像素值输入第一寄存器组的寄存器1,由于此时图像像素1的像素值表示是第一个池化窗中第2行的累加像素值(或平均像素值或最大像素值),还将图像像素1的像素值输入缓存中子缓存1 的地址0中。Input the pixel value of image pixel 1 in row 2 in Figure 3 into register 1 of the first register group, because the pixel value of image pixel 1 at this time represents the accumulated pixel value of row 2 in the first pooling window (or Average pixel value or maximum pixel value), and input the pixel value of image pixel 1 into address 0 of sub-buffer 1 in the buffer.
将图像像素2的像素值输入第一寄存器组的寄存器1,同时将寄存器1寄存的图像像素1的像素值输入寄存器2。The pixel value of image pixel 2 is input to register 1 of the first register group, and the pixel value of image pixel 1 registered by register 1 is input to register 2.
将图像像素3的像素值输入第一寄存器组的寄存器1,同时将寄存器1寄存的图像像素2的像素值输入寄存器2并将寄存器2寄存的图像像素1的像素值输入寄存器3。而且还获取第一寄存器组中寄存的图像像素1、图像像素2、图像像素3的像素值的累加像素值(或平均像素值或最大像素值),并将其输入缓存中子缓存1的地址1中。The pixel value of image pixel 3 is input to register 1 of the first register group, while the pixel value of image pixel 2 registered in register 1 is input to register 2 and the pixel value of image pixel 1 registered in register 2 is input to register 3. It also obtains the accumulated pixel value (or average pixel value or maximum pixel value) of the pixel values of image pixel 1, image pixel 2, image pixel 3 registered in the first register group, and inputs it to the address of sub-buffer 1 in the buffer. 1 in.
将图像像素4的像素值输入第一寄存器组的寄存器1,同时将寄存器1寄存的图像像素3的像素值输入寄存器2并将寄存器2寄存的图像像素2的像素值输入寄存器3。The pixel value of the image pixel 4 is input to the register 1 of the first register group, the pixel value of the image pixel 3 registered in the register 1 is input to the register 2 and the pixel value of the image pixel 2 registered in the register 2 is input to the register 3.
将图像像素5的像素值输入第一寄存器组,输入图像像素5的过程此处不再赘述。而且还获取第一寄存器组中寄存的图像像素3、图像像素4、图像像素5的像素值的累加像素值(或平均像素值或最大像素值),并将其输入缓存中子缓存1的地址2中。The pixel value of the image pixel 5 is input into the first register group, and the process of inputting the image pixel 5 will not be repeated here. It also obtains the accumulated pixel value (or average pixel value or maximum pixel value) of the pixel values of image pixel 3, image pixel 4, and image pixel 5 registered in the first register group, and inputs it to the address of sub-buffer 1 in the buffer. 2 in.
将图像像素6的像素值输入第一寄存器组,输入图像像素6的过程此处不再赘述。The pixel value of the image pixel 6 is input into the first register group, and the process of inputting the image pixel 6 is not repeated here.
将图像像素7的像素值输入第一寄存器组,输入图像像素7的过程此处不再赘述。而且还获取第一寄存器组中寄存的图像像素5、图像像素6、图像像素7的像素值的累加像素值(或平均像素值或最大像素值),并将其输入缓存中子缓存1的地址3中。The pixel value of the image pixel 7 is input into the first register group, and the process of inputting the image pixel 7 will not be repeated here. It also obtains the accumulated pixel value (or average pixel value or maximum pixel value) of the pixel values of image pixels 5, image pixels 6, and image pixels 7 registered in the first register group, and inputs them to the address of sub-buffer 1 in the buffer. 3 in.
将图像像素8的像素值输入第一寄存器组,输入图像像素8的过程此处不再赘述。The pixel value of the image pixel 8 is input into the first register group, and the process of inputting the image pixel 8 will not be repeated here.
将图像像素8相邻的填充像素的像素值输入第一寄存器组,输入图像像素8的过程此处不再赘述。而且还获取第一寄存器组中寄存的图像像素7、图像像素8、填充像素的像素值的累加像素值(或平均像素值或最大像素值),并将其输入缓存中子缓存1的地址4中。The pixel value of the filling pixel adjacent to the image pixel 8 is input into the first register group, and the process of inputting the image pixel 8 will not be repeated here. It also obtains the accumulated pixel value (or average pixel value or maximum pixel value) of the pixel values of the image pixels 7, image pixels 8, and filling pixels registered in the first register group, and inputs them to the address 4 of the sub-buffer 1 in the buffer. in.
而且在将图像像素8相邻的填充像素的像素值输入第一寄存器组的同时,将第3行的图像像素9的像素值输入第二寄存器组的寄存器1,由于此时图像像素9的像素值表示是第一个池化窗中第3行的累加像素值(或平均像素 值或最大像素值),还将图像像素9的像素值输入缓存中子缓存2的地址0中。从子缓存1的地址0的位置处获取第一个池化窗中第2行的累加像素值(或平均像素值或最大像素值),即图像像素1的像素值,并将图像像素1的像素值输入第三寄存器组。还从子缓存2的地址0的位置处获取第一个池化窗中第3行的累加像素值(或平均像素值或最大像素值)并输入第三寄存器组,或者,在将图像像素9的像素值输入缓存中子缓存2的地址0的位置的同时将图像像素9的像素值输入第三寄存器组。通过加法器获得图像像素1和图像像素9的累加像素值或平均像素值,或者,通过比较器获得图像像素1和图像像素9的最大像素值,然后将图像像素1和图像像素9的累加像素值或平均像素值或最大像素值作为第一个池化窗的池化结果输出。于此同时,第二寄存器组的打拍一直在进行,由于采用的是不同的寄存器组和加法器/比较器,列维度的比较或累加不会影响第3行的比较或累加。And while the pixel value of the filling pixel adjacent to the image pixel 8 is input into the first register group, the pixel value of the image pixel 9 in the third row is input into the register 1 of the second register group, because at this time the pixel value of the image pixel 9 The value represents the accumulated pixel value (or average pixel value or maximum pixel value) of the third row in the first pooling window, and the pixel value of the image pixel 9 is also input into the address 0 of the sub-buffer 2 in the buffer. Obtain the accumulated pixel value (or average pixel value or maximum pixel value) of the second row in the first pooling window from the location of address 0 of sub-buffer 1, that is, the pixel value of image pixel 1, and add the value of image pixel 1 The pixel value is input to the third register group. It also obtains the accumulated pixel value (or average pixel value or maximum pixel value) of the third row in the first pooling window from the location of address 0 of the sub-buffer 2 and enters it into the third register group, or, in the image pixel 9 The pixel value of is input into the position of address 0 of sub-buffer 2 in the buffer, and the pixel value of image pixel 9 is input into the third register group. Obtain the accumulated pixel value or average pixel value of image pixel 1 and image pixel 9 through an adder, or obtain the maximum pixel value of image pixel 1 and image pixel 9 through a comparator, and then add the accumulated pixel value of image pixel 1 and image pixel 9 The value or the average pixel value or the maximum pixel value is output as the pooling result of the first pooling window. At the same time, the beating of the second register set has been going on. Since different register sets and adders/comparators are used, the comparison or accumulation of column dimensions will not affect the comparison or accumulation of the third row.
将图像像素10的像素值输入第二寄存器组,输入图像像素10的过程此处不再赘述。The pixel value of the image pixel 10 is input into the second register group, and the process of inputting the image pixel 10 will not be repeated here.
将图像像素11的像素值输入第二寄存器组,输入图像像素11的过程此处不再赘述。而且还获取第二寄存器组中寄存的图像像素9、图像像素10、图像像素11的像素值的累加像素值(或平均像素值或最大像素值),并将其输入缓存中子缓存2的地址1中。The pixel value of the image pixel 11 is input into the second register group, and the process of inputting the image pixel 11 will not be repeated here. It also obtains the accumulated pixel value (or average pixel value or maximum pixel value) of the pixel values of image pixel 9, image pixel 10, and image pixel 11 registered in the second register group, and inputs it to the address of sub-buffer 2 in the buffer. 1 in.
此时,从子缓存1的地址1的位置处获取第2个池化窗中第2行的累加像素值(或平均像素值或最大像素值),即图像像素1、图像像素2、图像像素3的累加像素值(或平均像素值或最大像素值)并输入第三寄存器组。还从子缓存2的地址1的位置处获取第2个池化窗中第3行的累加像素值(或平均像素值或最大像素值)并输入第三寄存器组,或者,在将图像像素9、图像像素10、图像像素11的像素值的累加像素值(或平均像素值或最大像素值)输入缓存中子缓存2的地址1的位置的同时将其输入第三寄存器组。通过加法器获得第2个池化窗内所有像素的累加像素值或平均像素值,或者,通过比较器获得第2个池化窗内所有像素中的最大像素值,然后将获得累加像素值或平均像素值或最大像素值作为第2个池化窗的池化结果输出。于此同时,第二寄存器组的打拍一直在进行,由于采用的是不同的寄存器组和加法器/比较器,列维度的比较或累加不会影响第3行的比较或累加。At this time, get the accumulated pixel value (or average pixel value or maximum pixel value) of the second row in the second pooling window from the position of address 1 of sub-buffer 1, namely image pixel 1, image pixel 2, image pixel The accumulated pixel value of 3 (or average pixel value or maximum pixel value) is input into the third register group. It also obtains the accumulated pixel value (or average pixel value or maximum pixel value) of the third row in the second pooling window from the location of address 1 of the sub-buffer 2 and enters it into the third register group, or, in the image pixel 9 , The accumulated pixel value (or average pixel value or maximum pixel value) of the pixel values of the image pixel 10 and the image pixel 11 is input into the position of address 1 of the sub-buffer 2 in the buffer and into the third register group at the same time. Obtain the accumulated pixel value or average pixel value of all pixels in the second pooling window through the adder, or obtain the maximum pixel value among all the pixels in the second pooling window through the comparator, and then obtain the accumulated pixel value or The average pixel value or the maximum pixel value is output as the pooling result of the second pooling window. At the same time, the beating of the second register set has been going on. Since different register sets and adders/comparators are used, the comparison or accumulation of column dimensions will not affect the comparison or accumulation of the third row.
在一些实现方式中,图3所示的图像像素值为8bit,在实际应用中,原始图像的图像像素值为16bit,因此将原始图像拆解成两个单个像素值为8bit的待处理的图像,char类型的并行度是short的两倍,因此,16bit类型,需要2个上述类似的硬件结构,例如处理像素值8bit的待处理的图像时,需要3个寄存器组以及3个加法器/比较器,则对于16bit的像素值,则共需要6个寄存器组以及6个加法器/比较器。可选的,当寄存器的位宽为16bit时,可采用3个寄存器组以及6个加法器/比较器。可以理解的,所需要的硬件的数量与硬件的位宽相适应,本领域技术人员可根据实际应用场景确定硬件数量。In some implementations, the pixel value of the image shown in Figure 3 is 8bit. In practical applications, the image pixel value of the original image is 16bit. Therefore, the original image is disassembled into two images to be processed with a single pixel value of 8bit. The parallelism of the char type is twice that of the short. Therefore, the 16bit type requires two similar hardware structures as described above. For example, when processing an image to be processed with a pixel value of 8bit, three register sets and three adders/comparators are required. For a 16-bit pixel value, a total of 6 register sets and 6 adders/comparators are required. Optionally, when the bit width of the register is 16 bits, 3 register groups and 6 adders/comparators can be used. It can be understood that the amount of hardware required is compatible with the bit width of the hardware, and those skilled in the art can determine the amount of hardware according to actual application scenarios.
可选地,写入子缓存的数据来自比较器输出的最大像素值或加法器输出的累加像素值。由于子缓存分开,每个子缓存独立控制,这里给每个子缓存分配一个地址。每个比较器/加法器都会输出地址的写使能,以将运算像素值输出给对应的子缓存。Optionally, the data written into the sub-buffer comes from the maximum pixel value output by the comparator or the accumulated pixel value output by the adder. Since the sub-buffer is separated, each sub-buffer is independently controlled, and each sub-buffer is assigned an address here. Each comparator/adder will output the address write enable to output the calculated pixel value to the corresponding sub-buffer.
图6为本申请一实施例提供的图像处理设备的结构示意图,如图6所示,本实施例的图像处理设备600包括:第一寄存器组601、第二寄存器组602和处理器603通过总线连接。可选地,本实施例的图像处理设备600还可以包括缓存604,缓存604通过总线与上述部件连接。可选地,本实施例的图像处理设备600还可以包括第三寄存器组605,第三寄存器组605通过总线与上述部件连接。可选地,本实施例的图像处理设备600还可以包括运算单元606,运算单元606通过总线与上述部件连接,本实施例中示出三个运算单元,3个运算单元分别与上述3个寄存器组对应。FIG. 6 is a schematic structural diagram of an image processing device provided by an embodiment of the application. As shown in FIG. 6, the image processing device 600 of this embodiment includes: a first register group 601, a second register group 602, and a processor 603 through a bus connection. Optionally, the image processing device 600 of this embodiment may further include a cache 604, and the cache 604 is connected to the foregoing components through a bus. Optionally, the image processing device 600 of this embodiment may further include a third register group 605, and the third register group 605 is connected to the foregoing components through a bus. Optionally, the image processing device 600 of this embodiment may further include an arithmetic unit 606, which is connected to the foregoing components through a bus. In this embodiment, three arithmetic units are shown, and the three arithmetic units are connected to the foregoing three registers. Group correspondence.
其中,待处理的图像边缘设有填充像素。所述处理器603,用于将所述待处理的图像中第n行的像素的像素值依次输入第一寄存器组601中,所述n为大于等于1的任一整数,所述像素值包括图像像素值和填充像素值;当将所述第n行中最后一个图像像素值的相邻填充像素值输入所述第一寄存器组601中时,将所述图像中第n+1行的第一个图像像素值输入第二寄存器组602。Among them, the edge of the image to be processed is provided with filled pixels. The processor 603 is configured to sequentially input the pixel values of the pixels in the nth row in the image to be processed into the first register group 601, where n is any integer greater than or equal to 1, and the pixel values include Image pixel value and padding pixel value; when the adjacent padding pixel value of the last image pixel value in the nth row is input into the first register group 601, the n+1th row in the image An image pixel value is input to the second register group 602.
在一些实施例中,所述处理器603,还用于:In some embodiments, the processor 603 is further configured to:
当第n行中属于同一池化窗内的w个像素值输入至所述第一寄存器组601中时,获取所述w个像素值的运算像素值,所述池化窗的宽度为w个像素,所述池化窗的高度为h个像素,所述池化窗根据预设行步长沿行方向滑 动并根据预设列步长沿列方向滑动;When w pixel values belonging to the same pooling window in the nth row are input into the first register group 601, the calculated pixel values of the w pixel values are obtained, and the width of the pooling window is w Pixels, the height of the pooling window is h pixels, and the pooling window slides in a row direction according to a preset row step length and slides in a column direction according to a preset column step length;
当获得同一池化窗内每行的w个像素值的运算像素值时,根据每行的w个像素值的运算像素值,确定所述池化窗中w*h个像素值的运算像素值。When the calculated pixel values of w pixel values in each row in the same pooling window are obtained, the calculated pixel values of w*h pixel values in the pooling window are determined according to the calculated pixel values of w pixel values in each row .
在一些实施例中,所述第一寄存器组601或所述第二寄存器组602至少包括w个寄存器,每个寄存器用于寄存单个像素值。In some embodiments, the first register group 601 or the second register group 602 includes at least w registers, and each register is used to register a single pixel value.
在一些实施例中,所述处理器603,还用于在获取所述w个像素值的运算像素值之后,将所述w个像素值的运算像素值存储至缓存604中。In some embodiments, the processor 603 is further configured to store the calculated pixel values of the w pixel values in the buffer 604 after obtaining the calculated pixel values of the w pixel values.
在一些实施例中,所述缓存604至少包括h个子缓存,同一池化窗内不同行的w个像素值的运算像素值存储在不同的子缓存中。In some embodiments, the buffer 604 includes at least h sub-buffers, and the calculated pixel values of w pixel values of different rows in the same pooling window are stored in different sub-buffers.
在一些实施例中,同一池化窗内不同行的w个像素值的运算像素值存储在相应子缓存604中的相同位置。In some embodiments, the calculated pixel values of w pixel values of different rows in the same pooling window are stored in the same location in the corresponding sub-buffer 604.
在一些实施例中,所述处理器603在根据每行的w个像素值的运算像素值,确定所述池化窗中w*h个像素值的运算像素值时,具体用于:In some embodiments, when the processor 603 determines the calculated pixel values of w*h pixel values in the pooling window according to the calculated pixel values of w pixel values in each row, it is specifically configured to:
当获得所述池化窗中最后一行的w个像素值的运算像素值时,则在将所述最后一行的w个像素值的运算像素值存储至所述缓存604的同时,将所述最后一行的w个像素值的运算像素值输入第三寄存器组605中;When the calculated pixel values of the w pixel values of the last row in the pooling window are obtained, while the calculated pixel values of the w pixel values of the last row are stored in the buffer 604, the last The calculated pixel values of w pixel values of a row are input into the third register group 605;
从所述缓存604中读取所述池化窗内其它h-1行中每行的w个像素值的运算像素值,并输入所述第三寄存器组605中;Read the calculated pixel values of the w pixel values of each of the other h-1 rows in the pooling window from the buffer 604, and input them into the third register group 605;
对所述第三寄存器组605中寄存的h个运算像素值进行运算,确定所述池化窗中w*h个像素值的运算像素值。Perform calculations on the h arithmetic pixel values registered in the third register group 605, and determine the arithmetic pixel values of w*h pixel values in the pooling window.
在一些实施例中,所述处理器603,还用于:In some embodiments, the processor 603 is further configured to:
在获得第n+h行中w个像素值的运算像素值后,将所述缓存604中存储的第n行中相应列方向的w个像素值的运算像素值替换为所述第n+h行中w个像素值的运算像素值。After obtaining the calculated pixel values of the w pixel values in the n+h row, replace the calculated pixel values of the w pixel values in the corresponding column direction in the nth row stored in the buffer 604 with the n+h The calculated pixel value of w pixel values in the row.
在一些实施例中,所述处理器603在获取所述w个像素值的运算像素值时,具体用于:根据池化模式对所述w个像素值进行运算,得到所述运算像素值。In some embodiments, when the processor 603 obtains the calculated pixel values of the w pixel values, it is specifically configured to: perform operations on the w pixel values according to a pooling mode to obtain the calculated pixel values.
在一些实施例中,若所述池化模式为最大池化,则所述运算像素值为最大像素值;若所述池化模式为均值池化,则所述运算像素值为平均像素值或累加像素值。In some embodiments, if the pooling mode is maximum pooling, the calculated pixel value is the maximum pixel value; if the pooling mode is average pooling, the calculated pixel value is the average pixel value or Accumulate pixel values.
在一些实施例中,所述处理器603,在根据池化模式对所述w个像素值进行运算,得到所述运算像素值时,具体用于:将所述第一寄存器组601或所述第二寄存器组602中寄存的像素值,输出给运算单元606,以使所述运算单元606输出所述运算像素值;以及获取所述运算单元606输出的所述运算像素值。In some embodiments, the processor 603, when performing operations on the w pixel values according to the pooling mode to obtain the calculated pixel values, is specifically configured to: use the first register set 601 or the The pixel value registered in the second register group 602 is output to the arithmetic unit 606 so that the arithmetic unit 606 outputs the arithmetic pixel value; and the arithmetic pixel value output by the arithmetic unit 606 is obtained.
在一些实施例中,所述处理器603,还用于:In some embodiments, the processor 603 is further configured to:
若所述池化模式为最大池化,将所述运算单元606配置为比较器;If the pooling mode is maximum pooling, configure the arithmetic unit 606 as a comparator;
若所述池化模式为均值池化,将所述运算单元606配置为加法器。If the pooling mode is average pooling, the computing unit 606 is configured as an adder.
在一些实施例中,所述处理器603,还用于:根据所述池化窗的大小,对所述运算单元606的输入进行配置。In some embodiments, the processor 603 is further configured to configure the input of the computing unit 606 according to the size of the pooling window.
在一些实施例中,输出相邻行中w个像素值的运算像素值的运算单元606分别为第一运算单元和第二运算单元,输出所述池化窗中w*h个像素值的运算像素值的运算单元606为第三运算单元。In some embodiments, the arithmetic unit 606 that outputs the arithmetic pixel values of w pixel values in adjacent rows is a first arithmetic unit and a second arithmetic unit, and outputs the arithmetic of w*h pixel values in the pooling window. The pixel value calculation unit 606 is the third calculation unit.
在一些实施例中,若所述池化模式为最大池化,则所述填充像素值为最小像素值;In some embodiments, if the pooling mode is maximum pooling, the filled pixel value is the smallest pixel value;
若所述池化模式为均值池化,则所述填充像素值为0。If the pooling mode is average pooling, the filled pixel value is 0.
在一些实施例中,所述处理器603,还用于对原始图像进行分层处理,获得多层子图像;In some embodiments, the processor 603 is further configured to perform layered processing on the original image to obtain multiple sub-images;
所述每层子图像中每个像素的像素值为原始图像中每个像素的相同位的像素值;The pixel value of each pixel in the sub-image of each layer is the pixel value of the same bit of each pixel in the original image;
所述待处理的图像为所述多层子图像中的任一子图像。The image to be processed is any sub-image in the multi-layer sub-image.
可选地,本实施例的图像处理设备600还可以包括:用于存储程序代码的存储器(图中未示出),存储器用于存储程序代码,当程序代码被执行时,所述图像处理设备600可以实现上述的技术方案。Optionally, the image processing device 600 of this embodiment may further include: a memory (not shown in the figure) for storing program codes. The memory is used for storing program codes. When the program codes are executed, the image processing device 600 can implement the above-mentioned technical solutions.
本实施例的图像处理设备,可以用于执行图2及对应方法实施例的技术方案,其实现原理和技术效果类似,此处不再赘述。The image processing device of this embodiment can be used to implement the technical solutions of FIG. 2 and the corresponding method embodiment, and its implementation principles and technical effects are similar, and will not be repeated here.
本申请另一实施例还提供一种图像处理设备,该图像处理设备包括存储器和处理器;存储器用于存储程序指令,处理器用于调用存储器中的程序指令执行上述各实施例的方案。Another embodiment of the present application further provides an image processing device including a memory and a processor; the memory is used for storing program instructions, and the processor is used for calling the program instructions in the memory to execute the solutions of the foregoing embodiments.
图7为本申请一实施例提供的可移动平台的结构示意图,如图7所示, 本实施例的可移动平台700可以包括:第一寄存器组701、第二寄存器组702和处理器703通过总线连接。可选地,本实施例的可移动平台700还可以包括缓存704,缓存704通过总线与上述部件连接。可选地,本实施例的可移动平台700还可以包括第三寄存器组705,第三寄存器组705通过总线与上述部件连接。可选地,本实施例的可移动平台700还可以包括运算单元706,运算单元706通过总线与上述部件连接,本实施例中示出三个运算单元,3个运算单元分别与上述3个寄存器组对应。FIG. 7 is a schematic structural diagram of a movable platform provided by an embodiment of the application. As shown in FIG. 7, the movable platform 700 of this embodiment may include: a first register set 701, a second register set 702, and a processor 703 Bus connection. Optionally, the movable platform 700 of this embodiment may further include a cache 704, and the cache 704 is connected to the foregoing components through a bus. Optionally, the movable platform 700 of this embodiment may further include a third register set 705, and the third register set 705 is connected to the foregoing components through a bus. Optionally, the movable platform 700 of this embodiment may further include an arithmetic unit 706, which is connected to the above-mentioned components through a bus. In this embodiment, three arithmetic units are shown, and the three arithmetic units are connected to the above-mentioned three registers. Group correspondence.
其中,待处理的图像边缘设有填充像素。所述处理器703,用于将所述待处理的图像中第n行的像素的像素值依次输入第一寄存器组701中,所述n为大于等于1的任一整数,所述像素值包括图像像素值和填充像素值;当将所述第n行中最后一个图像像素值的相邻填充像素值输入所述第一寄存器组701中时,将所述图像中第n+1行的第一个图像像素值输入第二寄存器组702。Among them, the edge of the image to be processed is provided with filled pixels. The processor 703 is configured to sequentially input the pixel values of the pixels in the nth row in the image to be processed into the first register group 701, where n is any integer greater than or equal to 1, and the pixel values include Image pixel value and padding pixel value; when the adjacent padding pixel value of the last image pixel value in the nth row is input into the first register group 701, the n+1th row in the image An image pixel value is input to the second register group 702.
在一些实施例中,所述处理器703,还用于:In some embodiments, the processor 703 is further configured to:
当第n行中属于同一池化窗内的w个像素值输入至所述第一寄存器组701中时,获取所述w个像素值的运算像素值,所述池化窗的宽度为w个像素,所述池化窗的高度为h个像素,所述池化窗根据预设行步长沿行方向滑动并根据预设列步长沿列方向滑动;When w pixel values belonging to the same pooling window in the nth row are input into the first register group 701, the calculated pixel values of the w pixel values are obtained, and the width of the pooling window is w Pixels, the height of the pooling window is h pixels, and the pooling window slides in a row direction according to a preset row step length and slides in a column direction according to a preset column step length;
当获得同一池化窗内每行的w个像素值的运算像素值时,根据每行的w个像素值的运算像素值,确定所述池化窗中w*h个像素值的运算像素值。When the calculated pixel values of w pixel values in each row in the same pooling window are obtained, the calculated pixel values of w*h pixel values in the pooling window are determined according to the calculated pixel values of w pixel values in each row .
在一些实施例中,所述第一寄存器组701或所述第二寄存器组702至少包括w个寄存器,每个寄存器用于寄存单个像素值。In some embodiments, the first register group 701 or the second register group 702 includes at least w registers, and each register is used to register a single pixel value.
在一些实施例中,所述处理器703,还用于在获取所述w个像素值的运算像素值之后,将所述w个像素值的运算像素值存储至缓存704中。In some embodiments, the processor 703 is further configured to store the calculated pixel values of the w pixel values in the buffer 704 after obtaining the calculated pixel values of the w pixel values.
在一些实施例中,所述缓存704至少包括h个子缓存,同一池化窗内不同行的w个像素值的运算像素值存储在不同的子缓存中。In some embodiments, the buffer 704 includes at least h sub-buffers, and the calculated pixel values of w pixel values of different rows in the same pooling window are stored in different sub-buffers.
在一些实施例中,同一池化窗内不同行的w个像素值的运算像素值存储在相应子缓存704中的相同位置。In some embodiments, the calculated pixel values of w pixel values of different rows in the same pooling window are stored in the same position in the corresponding sub-buffer 704.
在一些实施例中,所述处理器703在根据每行的w个像素值的运算像素值,确定所述池化窗中w*h个像素值的运算像素值时,具体用于:In some embodiments, when the processor 703 determines the calculated pixel values of w*h pixel values in the pooling window according to the calculated pixel values of w pixel values in each row, it is specifically configured to:
当获得所述池化窗中最后一行的w个像素值的运算像素值时,则在将所述最后一行的w个像素值的运算像素值存储至所述缓存704的同时,将所述最后一行的w个像素值的运算像素值输入第三寄存器组705中;When the calculated pixel values of the w pixel values of the last row in the pooling window are obtained, while the calculated pixel values of the w pixel values of the last row are stored in the buffer 704, the last The calculated pixel values of w pixel values of a row are input into the third register group 705;
从所述缓存704中读取所述池化窗内其它h-1行中每行的w个像素值的运算像素值,并输入所述第三寄存器组705中;Read from the buffer 704 the calculated pixel values of the w pixel values of each of the other h-1 rows in the pooling window, and input them into the third register group 705;
对所述第三寄存器组705中寄存的h个运算像素值进行运算,确定所述池化窗中w*h个像素值的运算像素值。Perform calculations on the h arithmetic pixel values registered in the third register group 705, and determine the arithmetic pixel values of w*h pixel values in the pooling window.
在一些实施例中,所述处理器703,还用于:In some embodiments, the processor 703 is further configured to:
在获得第n+h行中w个像素值的运算像素值后,将所述缓存704中存储的第n行中相应列方向的w个像素值的运算像素值替换为所述第n+h行中w个像素值的运算像素值。After obtaining the calculated pixel value of the w pixel values in the n+h row, replace the calculated pixel value of the w pixel values in the corresponding column direction in the nth row stored in the buffer 704 with the n+h The calculated pixel value of w pixel values in the row.
在一些实施例中,所述处理器703在获取所述w个像素值的运算像素值时,具体用于:根据池化模式对所述w个像素值进行运算,得到所述运算像素值。In some embodiments, when the processor 703 obtains the calculated pixel values of the w pixel values, it is specifically configured to: perform operations on the w pixel values according to a pooling mode to obtain the calculated pixel values.
在一些实施例中,若所述池化模式为最大池化,则所述运算像素值为最大像素值;若所述池化模式为均值池化,则所述运算像素值为平均像素值或累加像素值。In some embodiments, if the pooling mode is maximum pooling, the calculated pixel value is the maximum pixel value; if the pooling mode is average pooling, the calculated pixel value is the average pixel value or Accumulate pixel values.
在一些实施例中,所述处理器703,在根据池化模式对所述w个像素值进行运算,得到所述运算像素值时,具体用于:将所述第一寄存器组701或所述第二寄存器组702中寄存的像素值,输出给运算单元706,以使所述运算单元706输出所述运算像素值;以及获取所述运算单元706输出的所述运算像素值。In some embodiments, the processor 703, when performing operations on the w pixel values according to the pooling mode to obtain the calculated pixel values, is specifically configured to: use the first register set 701 or the The pixel value registered in the second register group 702 is output to the arithmetic unit 706 so that the arithmetic unit 706 outputs the arithmetic pixel value; and the arithmetic pixel value output by the arithmetic unit 706 is obtained.
在一些实施例中,所述处理器703,还用于:In some embodiments, the processor 703 is further configured to:
若所述池化模式为最大池化,将所述运算单元706配置为比较器;If the pooling mode is maximum pooling, configure the arithmetic unit 706 as a comparator;
若所述池化模式为均值池化,将所述运算单元706配置为加法器。If the pooling mode is average pooling, the computing unit 706 is configured as an adder.
在一些实施例中,所述处理器703,还用于:根据所述池化窗的大小,对所述运算单元706的输入进行配置。In some embodiments, the processor 703 is further configured to configure the input of the computing unit 706 according to the size of the pooling window.
在一些实施例中,输出相邻行中w个像素值的运算像素值的运算单元706分别为第一运算单元和第二运算单元,输出所述池化窗中w*h个像素值的运算像素值的运算单元706为第三运算单元。In some embodiments, the arithmetic unit 706 that outputs the arithmetic pixel values of w pixel values in adjacent rows is a first arithmetic unit and a second arithmetic unit, and outputs the arithmetic of w*h pixel values in the pooling window. The pixel value calculation unit 706 is the third calculation unit.
在一些实施例中,若所述池化模式为最大池化,则所述填充像素值为最小像素值;In some embodiments, if the pooling mode is maximum pooling, the filled pixel value is the smallest pixel value;
若所述池化模式为均值池化,则所述填充像素值为0。If the pooling mode is average pooling, the filled pixel value is 0.
在一些实施例中,所述处理器703,还用于对原始图像进行分层处理,获得多层子图像;In some embodiments, the processor 703 is further configured to perform layered processing on the original image to obtain multiple layers of sub-images;
所述每层子图像中每个像素的像素值为原始图像中每个像素的相同位的像素值;The pixel value of each pixel in the sub-image of each layer is the pixel value of the same bit of each pixel in the original image;
所述待处理的图像为所述多层子图像中的任一子图像。The image to be processed is any sub-image in the multi-layer sub-image.
可选地,本实施例的可移动平台700还可以包括:用于存储程序代码的存储器(图中未示出),存储器用于存储程序代码,当程序代码被执行时,所述可移动平台700可以实现上述的技术方案。Optionally, the movable platform 700 of this embodiment may further include: a memory (not shown in the figure) for storing program codes, the memory is used for storing program codes, and when the program codes are executed, the movable platform 700 can implement the above-mentioned technical solutions.
本实施例的可移动平台,可以用于执行图2及对应方法实施例的技术方案,其实现原理和技术效果类似,此处不再赘述。The movable platform of this embodiment can be used to implement the technical solutions of FIG. 2 and the corresponding method embodiments, and its implementation principles and technical effects are similar, and will not be repeated here.
图8为本申请另一实施例提供的可移动平台的结构示意图,如图8所示,本实施例的可移动平台800可以包括:可移动平台本体801以及图像处理设备802。FIG. 8 is a schematic structural diagram of a movable platform provided by another embodiment of this application. As shown in FIG. 8, the movable platform 800 of this embodiment may include: a movable platform body 801 and an image processing device 802.
其中,所述图像处理设备802安装于所述可移动平台本体801上。图像处理设备802可以是独立于可移动平台本体801的设备。Wherein, the image processing device 802 is installed on the movable platform body 801. The image processing device 802 may be a device independent of the movable platform body 801.
其中,图像处理设备802可以采用图6所示装置实施例的结构,其对应地,可以执行图2及其对应方法实施例的技术方案,其实现原理和技术效果类似,此处不再赘述。The image processing device 802 may adopt the structure of the apparatus embodiment shown in FIG. 6, and correspondingly, may execute the technical solutions of FIG. 2 and its corresponding method embodiments. The implementation principles and technical effects are similar, and will not be repeated here.
本领域普通技术人员可以理解:实现上述方法实施例的全部或部分步骤可以通过程序指令相关的硬件来完成,前述的程序可以存储于一计算机可读取存储介质中,该程序在执行时,执行包括上述方法实施例的步骤;而前述的存储介质包括:只读内存(Read-Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。A person of ordinary skill in the art can understand that all or part of the steps in the above method embodiments can be implemented by a program instructing relevant hardware. The foregoing program can be stored in a computer readable storage medium. When the program is executed, it is executed. Including the steps of the foregoing method embodiment; and the foregoing storage medium includes: read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), magnetic disks or optical disks, etc., which can store program codes Medium.
最后应说明的是:以上各实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述各实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改, 或者对其中部分或者全部技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的范围。Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the application, not to limit them; although the application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that: The technical solutions described in the foregoing embodiments can still be modified, or some or all of the technical features can be equivalently replaced; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the technical solutions of the embodiments of the present application. range.

Claims (35)

  1. 一种图像处理方法,其特征在于,待处理的图像边缘设有填充像素,所述方法包括:An image processing method, characterized in that the edge of the image to be processed is provided with padding pixels, and the method includes:
    将所述待处理的图像中第n行的像素的像素值依次输入第一寄存器组中,所述n为大于等于1的任一整数,所述像素值包括图像像素值和填充像素值;Sequentially input the pixel values of the pixels in the nth row in the image to be processed into the first register group, where n is any integer greater than or equal to 1, and the pixel values include image pixel values and padding pixel values;
    当将所述第n行中最后一个图像像素值的相邻填充像素值输入所述第一寄存器组中时,将所述图像中第n+1行的第一个图像像素值输入第二寄存器组。When the adjacent filling pixel value of the last image pixel value in the nth row is input into the first register group, the first image pixel value in the n+1th row in the image is input into the second register group.
  2. 根据权利要求1所述的方法,其特征在于,还包括:The method according to claim 1, further comprising:
    当第n行中属于同一池化窗内的w个像素值输入至所述第一寄存器组中时,获取所述w个像素值的运算像素值,所述池化窗的宽度为w个像素,所述池化窗的高度为h个像素,所述池化窗根据预设行步长沿行方向滑动并根据预设列步长沿列方向滑动;When the w pixel values belonging to the same pooling window in the nth row are input into the first register group, the calculated pixel values of the w pixel values are obtained, and the width of the pooling window is w pixels , The height of the pooling window is h pixels, and the pooling window slides in the row direction according to the preset row step length and slides in the column direction according to the preset column step length;
    当获得同一池化窗内每行的w个像素值的运算像素值时,根据每行的w个像素值的运算像素值,确定所述池化窗中w*h个像素值的运算像素值。When the calculated pixel values of w pixel values in each row in the same pooling window are obtained, the calculated pixel values of w*h pixel values in the pooling window are determined according to the calculated pixel values of w pixel values in each row .
  3. 根据权利要求2所述的方法,其特征在于,所述第一寄存器组或所述第二寄存器组至少包括w个寄存器,每个寄存器用于寄存单个像素值。The method according to claim 2, wherein the first register group or the second register group includes at least w registers, and each register is used to register a single pixel value.
  4. 根据权利要求2所述的方法,其特征在于,所述获取所述w个像素值的运算像素值之后,还包括:The method according to claim 2, wherein after said obtaining the calculated pixel values of the w pixel values, the method further comprises:
    将所述w个像素值的运算像素值存储至缓存中。The calculated pixel values of the w pixel values are stored in the buffer.
  5. 根据权利要求4所述的方法,其特征在于,所述缓存至少包括h个子缓存,同一池化窗内不同行的w个像素值的运算像素值存储在不同的子缓存中。The method according to claim 4, wherein the buffer includes at least h sub-buffers, and the calculated pixel values of w pixel values of different rows in the same pooling window are stored in different sub-buffers.
  6. 根据权利要求5所述的方法,其特征在于,同一池化窗内不同行的w个像素值的运算像素值存储在相应子缓存中的相同位置。The method according to claim 5, wherein the calculated pixel values of the w pixel values of different rows in the same pooling window are stored in the same position in the corresponding sub-buffer.
  7. 根据权利要求4-6任一项所述的方法,其特征在于,所述根据每行的w个像素值的运算像素值,确定所述池化窗中w*h个像素值的运算像素值,包括:The method according to any one of claims 4-6, wherein the calculated pixel values of w*h pixel values in the pooling window are determined according to the calculated pixel values of w pixel values in each row ,include:
    当获得所述池化窗中最后一行的w个像素值的运算像素值时,则在将所述最后一行的w个像素值的运算像素值存储至所述缓存的同时,将所述最后 一行的w个像素值的运算像素值输入第三寄存器组中;When the calculated pixel values of the w pixel values of the last row in the pooling window are obtained, while the calculated pixel values of the w pixel values of the last row are stored in the buffer, the last row The calculated pixel values of the w pixel values are input into the third register group;
    从所述缓存中读取所述池化窗内其它h-1行中每行的w个像素值的运算像素值,并输入所述第三寄存器组中;Read the calculated pixel values of the w pixel values of each of the other h-1 rows in the pooling window from the buffer, and input them into the third register group;
    对所述第三寄存器组中寄存的h个运算像素值进行运算,确定所述池化窗中w*h个像素值的运算像素值。Perform an operation on the h arithmetic pixel values registered in the third register group, and determine the arithmetic pixel values of w*h pixel values in the pooling window.
  8. 根据权利要求4-7任一项所述的方法,其特征在于,还包括:The method according to any one of claims 4-7, further comprising:
    在获得第n+h行中w个像素值的运算像素值后,将所述缓存中存储的第n行中相应列方向的w个像素值的运算像素值替换为所述第n+h行中w个像素值的运算像素值。After obtaining the calculated pixel value of the w pixel values in the n+h row, replace the calculated pixel value of the w pixel values in the corresponding column direction in the nth row in the buffer with the n+h row The calculated pixel value of w pixel values in.
  9. 根据权利要求2-8任一项所述的方法,其特征在于,所述获取所述w个像素值的运算像素值,包括:The method according to any one of claims 2-8, wherein the obtaining the calculated pixel values of the w pixel values comprises:
    根据池化模式对所述w个像素值进行运算,得到所述运算像素值。Perform operations on the w pixel values according to the pooling mode to obtain the calculated pixel values.
  10. 根据权利要求9所述的方法,其特征在于,若所述池化模式为最大池化,则所述运算像素值为最大像素值;若所述池化模式为均值池化,则所述运算像素值为平均像素值或累加像素值。The method according to claim 9, wherein if the pooling mode is maximum pooling, the calculated pixel value is the maximum pixel value; if the pooling mode is average pooling, then the calculation The pixel value is an average pixel value or an accumulated pixel value.
  11. 根据权利要求9所述的方法,其特征在于,所述根据池化模式对所述w个像素值进行运算,得到所述运算像素值,包括:The method according to claim 9, wherein the calculating the w pixel values according to the pooling mode to obtain the calculated pixel value comprises:
    将所述第一寄存器组或所述第二寄存器组中寄存的像素值,输出给运算单元,以使所述运算单元输出所述运算像素值;Output the pixel value registered in the first register group or the second register group to an arithmetic unit, so that the arithmetic unit outputs the arithmetic pixel value;
    获取所述运算单元输出的所述运算像素值。Obtaining the calculated pixel value output by the arithmetic unit.
  12. 根据权利要求11所述的方法,其特征在于,若所述池化模式为最大池化,将所述运算单元配置为比较器;11. The method according to claim 11, wherein if the pooling mode is maximum pooling, the arithmetic unit is configured as a comparator;
    若所述池化模式为均值池化,将所述运算单元配置为加法器。If the pooling mode is average pooling, the arithmetic unit is configured as an adder.
  13. 根据权利要求11或12所述的方法,其特征在于,还包括:The method according to claim 11 or 12, further comprising:
    根据所述池化窗的大小,对所述运算单元的输入进行配置。According to the size of the pooling window, the input of the arithmetic unit is configured.
  14. 根据权利要求11-13任一项所述的方法,其特征在于,输出相邻行中w个像素值的运算像素值的运算单元分别为第一运算单元和第二运算单元,输出所述池化窗中w*h个像素值的运算像素值的运算单元为第三运算单元。The method according to any one of claims 11-13, wherein the arithmetic units that output the arithmetic pixel values of w pixel values in adjacent rows are respectively a first arithmetic unit and a second arithmetic unit, and output the pool The arithmetic unit for calculating the pixel values of w*h pixel values in the window is the third arithmetic unit.
  15. 根据权利要求9-14任一项所述的方法,其特征在于,若所述池化模式为最大池化,则所述填充像素值为最小像素值;The method according to any one of claims 9-14, wherein if the pooling mode is maximum pooling, the filled pixel value is the minimum pixel value;
    若所述池化模式为均值池化,则所述填充像素值为0。If the pooling mode is average pooling, the filled pixel value is 0.
  16. 根据权利要求1-15任一项所述的方法,其特征在于,还包括:The method according to any one of claims 1-15, further comprising:
    对原始图像进行分层处理,获得多层子图像;Perform layered processing on the original image to obtain multiple sub-images;
    每层子图像中每个像素的像素值为原始图像中每个像素的相同位的像素值;The pixel value of each pixel in each layer of sub-image is the same bit pixel value of each pixel in the original image;
    所述待处理的图像为所述多层子图像中的任一子图像。The image to be processed is any sub-image in the multi-layer sub-image.
  17. 一种图像处理设备,其特征在于,待处理的图像边缘设有填充像素,所述图像处理设备包括:第一寄存器组、第二寄存器组和处理器;An image processing device, characterized in that the edge of the image to be processed is provided with filling pixels, and the image processing device includes: a first register group, a second register group, and a processor;
    所述处理器,用于将所述待处理的图像中第n行的像素的像素值依次输入第一寄存器组中,所述n为大于等于1的任一整数,所述像素值包括图像像素值和填充像素值;当将所述第n行中最后一个图像像素值的相邻填充像素值输入所述第一寄存器组中时,将所述图像中第n+1行的第一个图像像素值输入第二寄存器组。The processor is configured to sequentially input the pixel values of the pixels in the nth row in the image to be processed into the first register group, where n is any integer greater than or equal to 1, and the pixel values include image pixels Value and padding pixel value; when the adjacent padding pixel value of the last image pixel value in the nth row is input into the first register group, the first image in the n+1th row in the image The pixel value is input to the second register group.
  18. 根据权利要求17所述的设备,其特征在于,所述处理器,还用于:The device according to claim 17, wherein the processor is further configured to:
    当第n行中属于同一池化窗内的w个像素值输入至所述第一寄存器组中时,获取所述w个像素值的运算像素值,所述池化窗的宽度为w个像素,所述池化窗的高度为h个像素,所述池化窗根据预设行步长沿行方向滑动并根据预设列步长沿列方向滑动;When the w pixel values belonging to the same pooling window in the nth row are input into the first register group, the calculated pixel values of the w pixel values are obtained, and the width of the pooling window is w pixels , The height of the pooling window is h pixels, and the pooling window slides in the row direction according to the preset row step length and slides in the column direction according to the preset column step length;
    当获得同一池化窗内每行的w个像素值的运算像素值时,根据每行的w个像素值的运算像素值,确定所述池化窗中w*h个像素值的运算像素值。When the calculated pixel values of w pixel values in each row in the same pooling window are obtained, the calculated pixel values of w*h pixel values in the pooling window are determined according to the calculated pixel values of w pixel values in each row .
  19. 根据权利要求18所述的设备,其特征在于,所述第一寄存器组或所述第二寄存器组至少包括w个寄存器,每个寄存器用于寄存单个像素值。The device according to claim 18, wherein the first register group or the second register group includes at least w registers, and each register is used to register a single pixel value.
  20. 根据权利要求18所述的设备,其特征在于,还包括缓存;The device according to claim 18, further comprising a cache;
    所述处理器,还用于在获取所述w个像素值的运算像素值之后,将所述w个像素值的运算像素值存储至缓存中。The processor is further configured to store the calculated pixel values of the w pixel values in a buffer after obtaining the calculated pixel values of the w pixel values.
  21. 根据权利要求20所述的设备,其特征在于,所述缓存至少包括h个子缓存,同一池化窗内不同行的w个像素值的运算像素值存储在不同的子缓存中。The device according to claim 20, wherein the buffer includes at least h sub-buffers, and the calculated pixel values of w pixel values of different rows in the same pooling window are stored in different sub-buffers.
  22. 根据权利要求21所述的设备,其特征在于,同一池化窗内不同行的w个像素值的运算像素值存储在相应子缓存中的相同位置。The device according to claim 21, wherein the calculated pixel values of the w pixel values of different rows in the same pooling window are stored in the same position in the corresponding sub-buffer.
  23. 根据权利要求20-22任一项所述的设备,其特征在于,还包括第三寄存器组;The device according to any one of claims 20-22, further comprising a third register set;
    所述处理器在根据每行的w个像素值的运算像素值,确定所述池化窗中w*h个像素值的运算像素值时,具体用于:When the processor determines the calculated pixel values of w*h pixel values in the pooling window according to the calculated pixel values of w pixel values in each row, it is specifically used for:
    当获得所述池化窗中最后一行的w个像素值的运算像素值时,则在将所述最后一行的w个像素值的运算像素值存储至所述缓存的同时,将所述最后一行的w个像素值的运算像素值输入第三寄存器组中;When the calculated pixel values of the w pixel values of the last row in the pooling window are obtained, while the calculated pixel values of the w pixel values of the last row are stored in the buffer, the last row The calculated pixel values of the w pixel values are input into the third register group;
    从所述缓存中读取所述池化窗内其它h-1行中每行的w个像素值的运算像素值,并输入所述第三寄存器组中;Read the calculated pixel values of the w pixel values of each of the other h-1 rows in the pooling window from the buffer, and input them into the third register group;
    对所述第三寄存器组中寄存的h个运算像素值进行运算,确定所述池化窗中w*h个像素值的运算像素值。Perform an operation on the h arithmetic pixel values registered in the third register group, and determine the arithmetic pixel values of w*h pixel values in the pooling window.
  24. 根据权利要求20-23任一项所述的设备,其特征在于,所述处理器,还用于:The device according to any one of claims 20-23, wherein the processor is further configured to:
    在获得第n+h行中w个像素值的运算像素值后,将所述缓存中存储的第n行中相应列方向的w个像素值的运算像素值替换为所述第n+h行中w个像素值的运算像素值。After obtaining the calculated pixel values of the w pixel values in the n+h row, replace the calculated pixel values of the w pixel values in the corresponding column direction in the nth row in the buffer with the n+h row The calculated pixel value of w pixel values in.
  25. 根据权利要求18-24任一项所述的设备,其特征在于,所述处理器在获取所述w个像素值的运算像素值时,具体用于:根据池化模式对所述w个像素值进行运算,得到所述运算像素值。The device according to any one of claims 18-24, wherein when the processor obtains the calculated pixel values of the w pixel values, it is specifically configured to: Value is calculated to obtain the calculated pixel value.
  26. 根据权利要求25所述的设备,其特征在于,若所述池化模式为最大池化,则所述运算像素值为最大像素值;若所述池化模式为均值池化,则所述运算像素值为平均像素值或累加像素值。The device according to claim 25, wherein if the pooling mode is maximum pooling, the calculated pixel value is the maximum pixel value; if the pooling mode is average pooling, the calculated pixel value The pixel value is an average pixel value or an accumulated pixel value.
  27. 根据权利要求26所述的设备,其特征在于,还包括运算单元;The device according to claim 26, further comprising an arithmetic unit;
    所述处理器,在根据池化模式对所述w个像素值进行运算,得到所述运算像素值时,具体用于:将所述第一寄存器组或所述第二寄存器组中寄存的像素值,输出给运算单元,以使所述运算单元输出所述运算像素值;以及获取所述运算单元输出的所述运算像素值。The processor, when performing operations on the w pixel values according to the pooling mode to obtain the calculated pixel values, is specifically configured to: transfer the pixels registered in the first register group or the second register group The value is output to the arithmetic unit, so that the arithmetic unit outputs the arithmetic pixel value; and the arithmetic pixel value output by the arithmetic unit is obtained.
  28. 根据权利要求27所述的设备,其特征在于,所述处理器,还用于:The device according to claim 27, wherein the processor is further configured to:
    若所述池化模式为最大池化,将所述运算单元配置为比较器;If the pooling mode is maximum pooling, configure the arithmetic unit as a comparator;
    若所述池化模式为均值池化,将所述运算单元配置为加法器。If the pooling mode is average pooling, the computing unit is configured as an adder.
  29. 根据权利要求27或28所述的设备,其特征在于,所述处理器,还用于:根据所述池化窗的大小,对所述运算单元的输入进行配置。The device according to claim 27 or 28, wherein the processor is further configured to configure the input of the arithmetic unit according to the size of the pooling window.
  30. 根据权利要求27-29任一项所述的设备,其特征在于,输出相邻行中w个像素值的运算像素值的运算单元分别为第一运算单元和第二运算单元,输出所述池化窗中w*h个像素值的运算像素值的运算单元为第三运算单元。The device according to any one of claims 27-29, wherein the arithmetic units that output the arithmetic pixel values of w pixel values in adjacent rows are respectively a first arithmetic unit and a second arithmetic unit, and output the pool The arithmetic unit for calculating the pixel values of the w*h pixel values in the window is the third arithmetic unit.
  31. 根据权利要求25-30任一项所述的设备,其特征在于,若所述池化模式为最大池化,则所述填充像素值为最小像素值;The device according to any one of claims 25-30, wherein if the pooling mode is maximum pooling, the filled pixel value is a minimum pixel value;
    若所述池化模式为均值池化,则所述填充像素值为0。If the pooling mode is average pooling, the filled pixel value is 0.
  32. 根据权利要求17-31任一项所述的设备,其特征在于,所述处理器,还用于对原始图像进行分层处理,获得多层子图像;The device according to any one of claims 17-31, wherein the processor is further configured to perform layered processing on the original image to obtain multiple layers of sub-images;
    每层子图像中每个像素的像素值为原始图像中每个像素的相同位的像素值;The pixel value of each pixel in each layer of sub-image is the same bit pixel value of each pixel in the original image;
    所述待处理的图像为所述多层子图像中的任一子图像。The image to be processed is any sub-image in the multi-layer sub-image.
  33. 一种可移动平台,其特征在于,包括:可移动平台本体以及如权利要求17-32任一项所述的图像处理设备,其中,所述图像处理设备安装于所述可移动平台本体上。A movable platform, characterized by comprising: a movable platform body and the image processing device according to any one of claims 17-32, wherein the image processing device is installed on the movable platform body.
  34. 根据权利要求33所述的可移动平台,其特征在于,所述可移动平台包括手持电话、手持云台、无人机、无人车、无人船、机器人或自动驾驶汽车。The mobile platform of claim 33, wherein the mobile platform comprises a handheld phone, a handheld pan/tilt, a drone, an unmanned vehicle, an unmanned boat, a robot, or an autonomous vehicle.
  35. 一种可读存储介质,其特征在于,所述可读存储介质上存储有计算机程序;所述计算机程序在被执行时,实现如权利要求1-16任一项所述的图像处理方法。A readable storage medium, characterized in that a computer program is stored on the readable storage medium; when the computer program is executed, the image processing method according to any one of claims 1-16 is realized.
PCT/CN2019/113433 2019-10-25 2019-10-25 Image processing method and device, and movable platform WO2021077427A1 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201980034354.9A CN112204606A (en) 2019-10-25 2019-10-25 Image processing method, device and movable platform
PCT/CN2019/113433 WO2021077427A1 (en) 2019-10-25 2019-10-25 Image processing method and device, and movable platform

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2019/113433 WO2021077427A1 (en) 2019-10-25 2019-10-25 Image processing method and device, and movable platform

Publications (1)

Publication Number Publication Date
WO2021077427A1 true WO2021077427A1 (en) 2021-04-29

Family

ID=74004606

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/113433 WO2021077427A1 (en) 2019-10-25 2019-10-25 Image processing method and device, and movable platform

Country Status (2)

Country Link
CN (1) CN112204606A (en)
WO (1) WO2021077427A1 (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1882902A (en) * 2003-11-25 2006-12-20 爱特梅尔股份有限公司 Serial peripheral interface (SPI) apparatus with write buffer for improving data throughput
EP2903289A1 (en) * 2014-01-31 2015-08-05 Thomson Licensing Receiver for layered real-time data stream and method of operating the same
CN108717571A (en) * 2018-06-01 2018-10-30 阿依瓦(北京)技术有限公司 A kind of acceleration method and device for artificial intelligence
CN109034373A (en) * 2018-07-02 2018-12-18 鼎视智慧(北京)科技有限公司 The parallel processor and processing method of convolutional neural networks
CN110009103A (en) * 2019-03-26 2019-07-12 深兰科技(上海)有限公司 A kind of method and apparatus of deep learning convolutional calculation
CN110322389A (en) * 2018-03-29 2019-10-11 上海熠知电子科技有限公司 Pond method, apparatus and system, computer readable storage medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1882902A (en) * 2003-11-25 2006-12-20 爱特梅尔股份有限公司 Serial peripheral interface (SPI) apparatus with write buffer for improving data throughput
EP2903289A1 (en) * 2014-01-31 2015-08-05 Thomson Licensing Receiver for layered real-time data stream and method of operating the same
CN110322389A (en) * 2018-03-29 2019-10-11 上海熠知电子科技有限公司 Pond method, apparatus and system, computer readable storage medium
CN108717571A (en) * 2018-06-01 2018-10-30 阿依瓦(北京)技术有限公司 A kind of acceleration method and device for artificial intelligence
CN109034373A (en) * 2018-07-02 2018-12-18 鼎视智慧(北京)科技有限公司 The parallel processor and processing method of convolutional neural networks
CN110009103A (en) * 2019-03-26 2019-07-12 深兰科技(上海)有限公司 A kind of method and apparatus of deep learning convolutional calculation

Also Published As

Publication number Publication date
CN112204606A (en) 2021-01-08

Similar Documents

Publication Publication Date Title
US11024005B2 (en) Optical flow tracking device and method
US11100652B2 (en) Method and system for feature tracking using image pyramids
WO2020113423A1 (en) Target scene three-dimensional reconstruction method and system, and unmanned aerial vehicle
US20200221062A1 (en) Image processing method and device
WO2020237471A1 (en) Flight route generation method, terminal and unmanned aerial vehicle
WO2020172800A1 (en) Patrol control method for movable platform, and movable platform
US20210009270A1 (en) Methods and system for composing and capturing images
WO2022021027A1 (en) Target tracking method and apparatus, unmanned aerial vehicle, system, and readable storage medium
WO2019183789A1 (en) Method and apparatus for controlling unmanned aerial vehicle, and unmanned aerial vehicle
WO2022016534A1 (en) Flight control method of unmanned aerial vehicle and unmanned aerial vehicle
WO2021056507A1 (en) Method for processing floating point number, device, and mobile platform
WO2021081774A1 (en) Parameter optimization method and apparatus, control device, and aircraft
WO2021217371A1 (en) Control method and apparatus for movable platform
US20210209133A1 (en) Data processing method and mobile platform
CN108885463A (en) Long-range control method, equipment and the system of unmanned plane
WO2020062089A1 (en) Magnetic sensor calibration method and movable platform
CN111247389A (en) Data processing method and device for shooting equipment and image processing equipment
WO2021077427A1 (en) Image processing method and device, and movable platform
WO2021168821A1 (en) Mobile platform control method and device
WO2021056503A1 (en) Positioning method and apparatus for movable platform, movable platform, and storage medium
WO2021031184A1 (en) Image processing method, apparatus, and movable platform
WO2019019172A1 (en) Adaptive Image Processing in a Robotic Vehicle
WO2020113417A1 (en) Three-dimensional reconstruction method and system for target scene, and unmanned aerial vehicle
US20210208605A1 (en) Data processing method and device, and unmanned aerial vehicle
WO2021035749A1 (en) Method and device for optimizing three-dimensional reconstruction model, and movable platform

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: 19949985

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: 19949985

Country of ref document: EP

Kind code of ref document: A1