WO2020135601A1 - 图像处理方法、装置、车载运算平台、电子设备及系统 - Google Patents

图像处理方法、装置、车载运算平台、电子设备及系统 Download PDF

Info

Publication number
WO2020135601A1
WO2020135601A1 PCT/CN2019/128763 CN2019128763W WO2020135601A1 WO 2020135601 A1 WO2020135601 A1 WO 2020135601A1 CN 2019128763 W CN2019128763 W CN 2019128763W WO 2020135601 A1 WO2020135601 A1 WO 2020135601A1
Authority
WO
WIPO (PCT)
Prior art keywords
fixed
point
convolutional neural
neural network
parameter
Prior art date
Application number
PCT/CN2019/128763
Other languages
English (en)
French (fr)
Inventor
程光亮
温拓朴
石建萍
Original Assignee
北京市商汤科技开发有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 北京市商汤科技开发有限公司 filed Critical 北京市商汤科技开发有限公司
Priority to JP2021533274A priority Critical patent/JP2022512211A/ja
Priority to KR1020217018149A priority patent/KR20210090249A/ko
Publication of WO2020135601A1 publication Critical patent/WO2020135601A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/23Clustering techniques
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/045Combinations of networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T1/00General purpose image data processing
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Definitions

  • the embodiments of the present application relate to computer technology, and in particular, to an image processing method, device, vehicle-mounted computing platform, electronic equipment, and system.
  • Convolutional neural networks play an important role in areas involving computer vision tasks. For example, in the field of intelligent driving, lane line detection and lane fitting can be performed based on convolutional neural networks. Before a convolutional neural network runs on a platform with limited hardware resources, it usually needs to be fixed-point. Among them, the fixed-point operation refers to the fixed-point conversion of the convolution parameters and intermediate layer results in the convolutional neural network represented by floating-point numbers into fixed-point numbers.
  • Embodiments of the present application provide an image processing method, device, vehicle-mounted computing platform, electronic equipment, and system.
  • the technical solution is as follows.
  • an image processing method provided includes:
  • an image processing apparatus includes:
  • the first processing module is used to perform fixed-point processing on the network parameters of the convolutional neural network using floating-point representation according to the fixed-point bit width hardware resources of the arithmetic unit, wherein the network parameters include the convolution of the convolutional neural network Parameters and layer output parameters;
  • the acquisition module is used to acquire the image to be processed
  • the second processing module is used to control the arithmetic unit to process the image according to the network parameters of the fixed-point processed convolutional neural network to obtain the processing result of the image.
  • a vehicle-mounted computing platform based on a field programmable gate array FPGA includes: a processor, an external memory, a memory, and an FPGA computing unit;
  • the external memory stores network parameters after the fixed-point processing of the convolutional neural network, and the network parameters include convolutional parameters and layer output parameters of the convolutional neural network;
  • the processor reads the network parameters of the fixed-point processing of the convolutional neural network into the memory, and inputs the data on the memory and the image to be processed to the FPGA arithmetic unit;
  • the FPGA arithmetic unit performs arithmetic processing on the image to be processed according to the network parameters of the convolutional neural network after the fixed-point processing to obtain the processing result of the image.
  • an electronic device includes:
  • the memory is used to store at least one executable instruction, and the executable instruction causes the processor to perform the operation corresponding to the image processing method according to any one of the embodiments.
  • an electronic device includes:
  • the processor and the image processing device according to any one of the embodiments; when the processor runs the image processing device, the modules in the image processing device according to any one of the embodiments are executed.
  • an intelligent driving system including the electronic device described in any one of the foregoing embodiments.
  • a computer-readable storage medium in which a computer program is stored, and the computer program is used to execute the image described in any one of the above embodiments Approach.
  • the image processing method, device, vehicle-mounted computing platform, electronic equipment and system provided in the embodiments of the present application first perform fixed-point processing on the convolutional neural network according to the fixed-point bit width hardware resource amount of the computing unit, and obtain the pending processing
  • the control arithmetic unit processes the image according to the network parameters of the convolutional neural network after the fixed-point processing, thereby realizing efficient image processing using the convolutional neural network on a platform with limited hardware resources.
  • FIG. 1 is a schematic flowchart of an image processing method provided by an embodiment of the present application.
  • FIG. 2 is another schematic flowchart of an image processing method provided by an embodiment of the present application.
  • FIG. 3 is another schematic flowchart of an image processing method provided by an embodiment of the present application.
  • FIG. 4 is another schematic flowchart of an image processing method provided by an embodiment of the present application.
  • FIG. 5 is another schematic flowchart of an image processing method provided by an embodiment of the present application.
  • FIG. 6 is another schematic flowchart of the image processing method provided by the embodiment of the present application.
  • FIG 7 is still another schematic flowchart of an image processing method provided by an embodiment of the present application.
  • FIG. 8 is a schematic structural diagram of an image processing apparatus provided by an embodiment of the present application.
  • FIG 9 is another schematic structural diagram of an image processing apparatus provided by an embodiment of the present application.
  • FIG. 10 is another schematic structural diagram of an image processing apparatus provided by an embodiment of the present application.
  • FIG. 11 is another schematic structural diagram of an image processing apparatus provided by an embodiment of the present application.
  • FIG. 12 is a schematic structural diagram of an on-board computing platform based on FPGA provided by an embodiment of the present application.
  • FIG. 13 is a physical block diagram of an electronic device 1300 provided by an embodiment of the present application.
  • the embodiments of the present application can be applied to a computer system/server, which can operate together with many other general-purpose or special-purpose computing system environments or configurations.
  • Examples of well-known computing systems, environments, and/or configurations suitable for use with computer systems/servers include, but are not limited to: personal computer systems, server computer systems, thin clients, thick clients, handheld or laptop devices, based on Microprocessor systems, set-top boxes, programmable consumer electronics, network personal computers, small computer systems, large computer systems, and distributed cloud computing technology environments that include any of the above systems, etc.
  • the computer system/server may be described in the general context of computer system executable instructions (such as program modules) executed by the computer system.
  • program modules may include routines, programs, target programs, components, logic, data structures, etc., which perform specific tasks or implement specific abstract data types.
  • the computer system/server can be implemented in a distributed cloud computing environment. In the distributed cloud computing environment, tasks are performed by remote processing devices linked through a communication network. In a distributed cloud computing environment, program modules may be located on local or remote computing system storage media including storage devices.
  • the image processing method provided in the embodiments of the present application can be applied to various scenes that use convolutional neural networks to perform image processing.
  • the embodiments of the present application may be applied in the field of intelligent driving, such as automatic driving and assisted driving technologies.
  • lane line detection and lane line fitting can be performed based on a convolutional neural network.
  • a convolutional neural network in the field of intelligent driving a fixed-point operation can be performed using the method described in the embodiments of the present application.
  • FIG. 1 is a schematic flowchart of an image processing method according to an embodiment of the present application.
  • the method may be executed by a processor in an electronic device that performs image processing, such as a central processing unit (Central Processing Unit, CPU for short).
  • a processor in an electronic device that performs image processing, such as a central processing unit (Central Processing Unit, CPU for short).
  • CPU Central Processing Unit
  • the method includes:
  • S101 Perform fixed-point processing on the network parameters expressed by the floating point of the convolutional neural network according to the fixed-point bit width hardware resources of the arithmetic unit.
  • the network parameters include convolution parameters of the convolutional neural network and layer output parameters.
  • the above-mentioned operation unit may be a calculation unit that supports fixed-point operation.
  • the arithmetic unit may be a digital signal processor (Digital Signal Processor, DSP for short) in the FPGA.
  • FPGA is an inexpensive and stable computing platform on which convolutional neural networks can be run.
  • the fixed-point width hardware resources of computing units are usually limited.
  • the amount of fixed-point bit width hardware resources is often as small as possible, such as 8-bit or 4-bit bit or even less bit-width hardware resource amounts to implement fixed-point operations.
  • the small amount of fixed-point bit width hardware resources often affects the calculation speed.
  • the convolutional neural network For platforms that require fast response or even real-time response, such as autonomous driving on-board computing platforms, it is necessary to adapt the convolutional neural network to the fixed-point bit width hardware. Optimization of the amount of resources to achieve accelerated computing on a limited resource platform.
  • the convolutional neural network before the convolutional neural network runs on a platform with limited hardware resources such as FPGA, it can first perform fixed-point operation to adapt the hardware fixed-point bit width resource amount, thereby simultaneously meeting the low power consumption of the computing platform and Respond quickly to requests.
  • the convolutional parameters of the convolutional neural network and the results of the intermediate layer are fixed-pointed as a fixed-point number.
  • the multiplication and addition of floating-point numbers can be converted to the multiplication and addition of fixed-point numbers.
  • operations such as multiplication and addition of fixed-point numbers can be performed directly using DSP. Therefore, fixed-point operations on network parameters of convolutional neural networks can reduce hardware consumption of platforms such as FPGA.
  • the convolutional neural network can be used in the image processing process.
  • the embodiments of the present application propose an image processing method based on the convolutional neural network.
  • the convolutional neural network is fixed-point processed according to the fixed-point bit width hardware resources of the arithmetic unit.
  • the control arithmetic unit processes the image through the convolutional neural network with fixed-point processing according to the network parameters, so as to realize the efficient image processing using the convolutional neural network on the platform with limited hardware resources.
  • the fixed-point bit width hardware resource of the DSP of the FPGA may be 4 bits to 8 bits, that is, the DSP of the FPGA may support the calculation of the fixed-point number of 4 bits to 8 bits. Accordingly, when performing fixed-point processing, the floating-point number needs to be fixed-pointed to a fixed-point number of 4 to 8 bits.
  • this step S101 may be executed by the processor invoking the corresponding instruction stored in the memory, or may be executed by the first processing module 801 executed by the processor.
  • the road surface image may be collected by the camera of the intelligent driving vehicle, and the processor may obtain the road surface image collected by the camera, and the road surface image is the image to be processed.
  • this step S102 may be executed by the processor invoking the corresponding instruction stored in the memory, or may be executed by the obtaining module 802 executed by the processor.
  • this step S103 may be executed by the processor invoking the corresponding instruction stored in the memory, or may be executed by the second processing module 803 executed by the processor.
  • the process of processing the above image may include, but is not limited to, at least one of the following: fixed-point multiplication, fixed-point addition, and movement.
  • the available image processing results may include but are not limited to at least one of the following:
  • the above object detection result may be the detection result of the lane line.
  • the convolutional neural network is first fixed-point processed according to the fixed-point bit width hardware resources of the arithmetic unit, and after acquiring the image to be processed, the arithmetic unit is controlled to perform the fixed-point convolutional neural network according to the network parameters
  • the network processes images to achieve efficient image processing using convolutional neural networks on platforms with limited hardware resources. By performing fixed-point processing on the convolutional neural network, it is possible to realize accelerated computing on a platform with limited hardware resources, thereby simultaneously meeting the needs of the computing platform for low power consumption and fast response.
  • a staged approach fixed-point method can be used, or a mixed fixed-point method that clusters the layer output parameters of the convolutional neural network can be used, or a combination of the two can be used The way.
  • the fixed-point parameters are determined according to the network parameters of the convolutional neural network, and then, the network parameters are determined according to the fixed-point parameters, the preset fixed-point function, and the fixed-point bit width hardware resources. Perform the first fixed point to obtain the first fixed point convolutional neural network.
  • the layer output parameters in the convolutional neural network are first clustered to obtain a preset number of clustering results, and further, according to the clustering
  • the results and the convolution parameters in the convolutional neural network are second fixed-pointed according to the fixed-point bit width hardware resources, and the second fixed-point convolutional neural network is obtained.
  • FIG. 2 is another schematic flowchart of an image processing method provided by an embodiment of the present application. As shown in FIG. 2, the above-mentioned staged approximation fixed-point process includes:
  • the fixed-point parameter is used to identify the number of decimal places of the fixed-point number corresponding to the network parameter.
  • the input of the embodiment of the present application is a full-precision floating-point convolutional neural network, that is, before executing the method of the embodiment of the present application, the network parameters in the convolutional neural network are expressed by floating-point numbers.
  • the above network parameters may include convolution parameters and layer output parameters.
  • the layer output parameter refers to the intermediate layer output result of the convolutional neural network, such as the intermediate layer feature map.
  • the fixed-point parameter is used to identify the number of decimal places of the fixed-point number corresponding to the network parameter.
  • the number of decimal places of the fixed-point number after fixed-point conversion can be determined according to the network parameters in the convolutional neural network.
  • the fixed-point function is a linear function with a preset slope, and the preset slope is greater than 0.
  • the first fixed-point may be performed in combination with the fixed-point parameter, the fixed-point function, and the fixed-point bit width hardware resource amount of the arithmetic unit.
  • the fixed-pointing function takes the form of a step at the local part of the function. In this embodiment, that is, through a staged process, a continuously changes from 1.0 to 0. It should be noted that the above fixed-point function is only an implementation manner, and those skilled in the art may determine a linear function with a preset slope as the fixed-point function according to actual needs.
  • this step may be performed multiple times in stages. In each stage, you can first assign a slope to the above fixed-point function, and perform the first fixed-point based on the slope. After the first fixed point of this stage is completed, the slope can be corrected, and a new first fixed point can be performed based on the corrected slope, and iteratively executed in turn until the slope of the fixed point function approaches the slope of the step function .
  • each training uses a preset slope for the first fixed-point, and in the next training, optionally, in response to the difference between the fixed-point function and the target step function is greater than
  • the preset difference corrects the slope of the fixed-point function; the new first fixed-point function is performed according to the fixed-point function after the modified slope; for example, to determine whether the difference between the fixed-point function and the target step function is greater than the preset difference, such as the slope difference Whether the value is greater than the preset difference, and if so, the first fixed point is continued with the new slope and iteratively executed in turn until the slope of the fixed point function approaches the slope of the step function.
  • the fixed-point function can be assigned a slope of 1 at the initial stage, and the above network parameters are fixed-pointed based on the fixed-point function . Iteratively execute in turn, gradually reducing the slope value in subsequent stages, and performing fixed-pointing based on the slopes assigned in each stage, respectively, until the slope approaches zero.
  • the process of performing fixed-pointing during training includes:
  • an initial slope is assigned to the fixed-point function, and then the network parameters are fixed-pointed based on the fixed-point function. Furthermore, the convolutional neural network is trained based on the fixed-point network parameters after the fixed-point function.
  • the training result meets expectations.
  • Based on the current convolutional neural network Based on the current convolutional neural network, perform the second stage of slope allocation, fixed-point and neural network training, and iteratively execute in turn until the slope approaches zero. Through this process, the result of the fixed-point function can gradually approach the result of the full fixed-point function in stages.
  • the fixed-point function with a specific slope is used to fixed-point the convolution parameters and layer output parameters of the convolutional neural network, so that the fixed-point result can gradually approximate the result of the full fixed-point, thereby reducing the fixed-point
  • the loss of precision in time reduces the error of fixed-point and improves the accuracy of fixed-point.
  • the following describes the hybrid fixed-point method of clustering the layer output parameters of the convolutional neural network, and the process of combining the above two methods.
  • FIG. 3 is another schematic flowchart of an image processing method provided by an embodiment of the present application.
  • the above hybrid fixed-point method of clustering the layer output parameters of the convolutional neural network includes:
  • the convolutional neural network mentioned in this step refers to the convolutional neural network after the above-mentioned first fixed-pointization.
  • the convolutional neural network is taken as the first fixed-point convolutional neural network as an example for description.
  • K-means clustering (Kmeans) method may be used to cluster the above-mentioned layer output parameters.
  • the obtained number of decimal places corresponding to the layer output parameter is the number of decimal places identified by the fixed point parameter.
  • the output parameters of these layers are clustered.
  • the kmeans method may be used to perform k-bit clustering on the above-layer layer output parameters.
  • k is an integer greater than 0.
  • the convolutional neural network mentioned in this step refers to the convolutional neural network after the above-mentioned first fixed-pointization.
  • the second fixed-pointing may be a fixed-pointing using a step function.
  • the fixed-point bit width can be reduced under the premise of ensuring the fixed-point accuracy, thereby reducing bandwidth consumption .
  • the layer output parameters can be expressed using a lower number of bits, so that a corresponding standard can be generated .
  • K-means clustering is used to obtain the number of 16 clusters
  • the output parameters of each layer can be expressed by using 4 bits.
  • the FPGA reads the data, it can only read 4 bits, that is, it only needs to read a smaller number of bits than before the clustering, and then the real data can be obtained by looking up the table, thereby reducing the bandwidth of the FPGA.
  • this embodiment relates to the process of determining fixed-point parameters according to the network parameters of the convolutional neural network.
  • step S201 includes:
  • the fixed-point parameter is determined according to the number of decimals of the convolution parameter and the number of decimals of the layer output parameter.
  • the convolution parameters and layer output parameters in the convolutional neural network are floating point numbers, and for these floating point numbers, in this embodiment, the floating point numbers The number of decimal places determines the above fixed-point parameters.
  • the maximum number of decimal places in the above-mentioned convolution parameter and the number of decimal places in the above-mentioned layer output parameter may be used as the number of decimal places corresponding to the fixed-point parameter.
  • the convolutional neural network has a convolution parameter with a value of 1.1 and two layer output parameters with values of 1.23 and 3.354, respectively, and the maximum number of decimal places is 3, the corresponding fixed-point parameters can be determined Has 3 decimal places.
  • the largest number of decimal places of the convolution parameter and the layer output parameter of the layer output parameter may be used as the decimal point corresponding to the fixed-point parameter.
  • this embodiment relates to a process of first fixed-pointing the above network parameters.
  • FIG. 4 is another schematic flowchart of an image processing method provided by an embodiment of the present application. As shown in FIG. 4, the above step S202 includes:
  • S401 Determine the fixed-point level of the network parameter according to the number of bits of the fixed-point bit width hardware resource amount and the fixed-point parameter.
  • the fixed-point level of the network parameter can be determined according to the number of bits of the fixed-point bit width hardware resource amount and the fixed-point parameter.
  • the fixed-point level of the network parameter includes -2, -1 , 0 and 1.
  • S402. Perform first fixed-pointing on the network parameters according to the fixed-pointing level and the fixed-pointing function to obtain a first fixed-point convolutional neural network.
  • the above network parameters may be first fixed-pointed in the following manner.
  • FIG. 5 is another schematic flowchart of an image processing method provided by an embodiment of the present application. As shown in FIG. 5, the above step S402 includes:
  • the target level is the fixed level closest to the value of the network parameter.
  • the network parameter A may be first fixed-pointed in the following manner, and the remaining networks
  • the first fixed-point parameterization method is the same as the network parameter A.
  • the fixed point level closest to the convolution kernel parameter can be determined by calculating the difference between the convolution core parameter and the fixed point level, for example, selecting the convolution kernel from the fixed point level
  • the fixed point level with the smallest difference between the parameters is taken as the closest fixed point level (eg, target level).
  • the convolution kernel parameter is calculated by The difference from the fixed-point level can be determined to be the closest fixed-point level to the convolution kernel parameter as -1.
  • the difference between the value of the network parameter and the fixed electrification level and the fixed-point level are input into the fixed-point function to obtain the first fixed-point result of the network parameter A.
  • L is the fixed point level (such as: target level)
  • S is the difference between the network parameter A and the target level
  • k is the corresponding slope of the current stage
  • the above fixed-point function is only one implementation, and those skilled in the art may determine a function related to the target level and the difference between the network parameter and the target level as the fixed-point function according to actual needs.
  • this embodiment relates to a process of clustering the above-mentioned layer output parameters.
  • FIG. 6 is another schematic flowchart of an image processing method provided by an embodiment of the present application. As shown in FIG. 6, the clustering process in step S301 includes:
  • S602. Perform cluster iterative processing according to the initial clustering center to obtain the preset number of clustering results.
  • the preset number of bits is 6, that is, the network parameters are represented by 6 bits
  • 4-bit clustering may be performed on the above-layer output parameters, and the 4 bits may identify 16 numbers Therefore, the above preset number may be 16.
  • 16 layer output parameters can be selected from the above layer output parameters according to specific principles, and the 16 layer output parameters are used as initial clustering centers, and then, according to the similarity of the remaining layer output parameters with these initial clustering centers , That is, the difference (usually, the smaller the difference, the higher the similarity), and the remaining layer output functions are assigned to these cluster centers, respectively, to form multiple clusters. Furthermore, the new cluster center of each cluster is calculated, and iterative processing of clusters is continued based on the new cluster center until the difference of the layer output parameters in each cluster meets the convergence condition, resulting in 16 clusters Category result.
  • this embodiment relates to a process of second fixed-pointing the clustering result.
  • FIG. 7 is still another schematic flowchart of the image processing method provided by the embodiment of the present application. As shown in FIG. 7, the above step S302 includes:
  • the cluster center of cluster 1 is first determined.
  • the cluster center may be an average value of output parameters of multiple layers included in cluster 1.
  • the second fixed point is used to pinpoint the clustering center to the fixed point level closest to the clustering center.
  • the second fixed point of the clustering center may include: a convolution parameter based on the clustering center and the convolution neural network using floating point representation, or, based on the clustering center and the first fixed point
  • the convolution parameters in the convolutional neural network are second fixed-pointed according to the amount of fixed-point bit width hardware resources.
  • the cluster center may be second-pointed.
  • the second fixed point can be fixed point by using a step function, that is, the step center is used to set the cluster center to the fixed point level closest to the cluster center.
  • the cluster center of cluster 1 is 1.2, after performing the second fixed-point using the step function, the cluster center may be fixed-pointed to 1.
  • the second fixed-point result of the cluster center of cluster 1 After the second fixed-point result of the cluster center of cluster 1 is determined, the second fixed-point result can be used as the second fixed-point result of the output parameters of each layer included in cluster 1.
  • clustering When performing clustering, a bit less than the number of bits of the output layer parameters is selected (for example, the layer output parameter is represented by 6 bits, then 4-bit clustering is performed) for clustering, so after the second fixed point is finally completed Only a small number of bits can be used to represent all the layer output parameters. Therefore, clustering reduces the fixed-point bit width on the premise of ensuring fixed-point precision, thereby achieving the purpose of reducing bandwidth consumption.
  • FIG. 8 is a schematic structural diagram of an image processing apparatus according to an embodiment of the present application. As shown in Figure 8, the device includes:
  • the first processing module 801 is configured to perform fixed-point processing on the network parameters represented by the floating point of the convolutional neural network according to the fixed-point bit width hardware resource amount of the arithmetic unit.
  • the network parameters include convolution parameters of the convolutional neural network and layer output parameters.
  • the obtaining module 802 is used to obtain an image to be processed.
  • the second processing module 803 is used to control the arithmetic unit to process the image according to the network parameters of the convolutional neural network after the fixed-point processing, and obtain the image processing result.
  • the first processing module 801 includes:
  • the clustering unit 8011 is configured to cluster the layer output parameters represented by floating point in the convolutional neural network to obtain a preset number of clustering results.
  • the second fixed-point unit 8012 is used to perform a second fixed-point conversion based on the clustering result, the convolution parameter expressed in floating point in the convolutional neural network, and the amount of fixed-point bit width hardware resources to obtain the second fixed-point convolutional nerve The internet.
  • FIG. 10 is another schematic structural diagram of an image processing apparatus provided by an embodiment of the present application. As shown in FIG. 10, the first processing module 801 further includes:
  • the determining unit 8013 is configured to determine fixed-point parameters according to network parameters represented by floating-point in the convolutional neural network, and the fixed-point parameters are used to identify the number of decimal places of the fixed-point number corresponding to the network parameter.
  • the first fixed-point unit 8014 is configured to perform a first fixed-point on the network parameters according to the fixed-point parameters, the preset fixed-point function, and the fixed-point bit width hardware resource amount to obtain the first fixed-point convolutional neural network .
  • the fixed-point function is a linear function with a preset slope, and the preset slope is greater than 0.
  • the first processing module 801 is used to:
  • the convolution parameter in the first fixed-point convolutional neural network and the fixed-point bit width hardware resource amount, the second fixed-point is performed to obtain the second fixed-point convolutional neural network.
  • the determining unit 8013 is used to:
  • the fixed-point parameters are determined according to the number of decimal places of the convolution parameter and the number of decimal places of the layer output parameter.
  • the determining unit 8013 is used to:
  • the first fixed-point unit 8014 is used to:
  • the fixed-point level of network parameters is determined according to the number of bits of fixed-point bit width hardware resources and fixed-point parameters.
  • the network parameters are first fixed-pointed to obtain the first fixed-point convolutional neural network.
  • the first fixed-point unit 8014 is used to:
  • the target level is the fixed point level closest to the value of the network parameter.
  • the difference value and the target level are input into a fixed-point function to obtain the first fixed-point result of the network parameters.
  • the first processing module 801 is used to:
  • iterative clustering processing is performed to obtain a preset number of clustering results.
  • the first processing module 801 is used to:
  • the second fixed-pointing is performed to obtain a second fixed-pointing result, wherein the second fixed-pointing is used to set the clustering center to a fixed-point level closest to the clustering center.
  • FIG. 11 is another schematic structural diagram of an image processing apparatus according to an embodiment of the present application. As shown in FIG. 11, the device also includes:
  • the update module 804 is configured to correct the slope of the fixed-point function when the difference between the fixed-point function and the target step function is greater than the preset difference; and perform a new first fixed-point function according to the fixed-point function after the corrected slope.
  • the second processing module 803 is used to:
  • the control arithmetic unit performs at least one of the following processing on the image according to the network parameters of the convolutional neural network after the fixed-point processing:
  • the image processing result includes at least one of the following:
  • the FPGA-based vehicle computing platform includes: a processor 1201, an external memory 1202, a memory 1203, and an FPGA computing unit 1204; wherein,
  • the external memory 1202 stores network parameters after the fixed-point processing of the convolutional neural network.
  • the network parameters include convolutional parameters and layer output parameters of the convolutional neural network.
  • the processor 1201 reads the network parameters of the fixed-point processing of the convolutional neural network into the memory 1203, and inputs the data on the memory 1203 and the image to be processed to the FPGA arithmetic unit.
  • the FPGA arithmetic unit 1204 performs arithmetic processing on the image to be processed according to the network parameters of the convolutional neural network after the fixed-point processing to obtain an image processing result.
  • the processor 1201 may also perform the steps in the image processing method provided in any of the foregoing embodiments, and reference may be made to the foregoing method embodiments, which will not be repeated here.
  • FIG. 13 is a physical block diagram of an electronic device 1300 provided by an embodiment of the present application. As shown in FIG. 13, the electronic device 1300 includes: a processor 1302 and a memory 1301;
  • the memory 1301 is used to store at least one executable instruction that enables the processor 1302 to perform the operation corresponding to the image processing method provided in any one of the foregoing embodiments.
  • An embodiment of the present application also provides an electronic device, including:
  • the processor and the image processing device provided in any one of the foregoing embodiments; when the processor runs the image processing device, the modules in the image processing device provided in any of the foregoing embodiments are executed.
  • An embodiment of the present application further provides an intelligent driving system, which includes the electronic device provided in any of the foregoing embodiments.
  • An embodiment of the present application further provides a computer-readable storage medium, and the computer-readable storage medium stores a computer program, and the computer program is used to execute the image processing method provided by any one of the foregoing embodiments.
  • the method and apparatus of the present application may be implemented in many ways.
  • the method and apparatus of the present application may be implemented by software, hardware, firmware, or any combination of software, hardware, and firmware.
  • the above sequence of steps for the method is for illustration only, and the steps of the method of the present application are not limited to the sequence specifically described above unless otherwise specifically stated.
  • the present application may also be implemented as programs recorded in a recording medium, and these programs include machine-readable instructions for implementing the method according to the present application.
  • the present application also covers a recording medium storing a program for executing the method according to the present application.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • General Physics & Mathematics (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Artificial Intelligence (AREA)
  • General Engineering & Computer Science (AREA)
  • Evolutionary Computation (AREA)
  • Molecular Biology (AREA)
  • Computational Linguistics (AREA)
  • Software Systems (AREA)
  • Mathematical Physics (AREA)
  • Health & Medical Sciences (AREA)
  • Biomedical Technology (AREA)
  • Biophysics (AREA)
  • Computing Systems (AREA)
  • General Health & Medical Sciences (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Evolutionary Biology (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Image Analysis (AREA)
  • Complex Calculations (AREA)

Abstract

一种图像处理方法、装置、车载运算平台、电子设备及系统,所述方法包括:根据运算单元的定点位宽硬件资源量对卷积神经网络使用浮点表示的网络参数进行定点化处理(S101),其中,所述网络参数包括所述卷积神经网络的卷积参数以及层输出参数;获取待处理的图像(S102);控制所述运算单元根据定点化处理后的卷积神经网络的网络参数处理所述图像,得到所述图像的处理结果(S103)。

Description

图像处理方法、装置、车载运算平台、电子设备及系统
本申请要求在2018年12月29日提交中国专利局、申请号为CN201811647408.2、发明名称为“图像处理方法、装置、车载运算平台、电子设备及系统”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请实施例涉及计算机技术,尤其涉及一种图像处理方法、装置、车载运算平台、电子设备及系统。
背景技术
卷积神经网络在涉及计算机视觉任务的领域中发挥着重要作用。例如,在智能驾驶领域,可以基于卷积神经网络进行车道线检测、车道拟合等。卷积神经网络在硬件资源有限的平台上运行之前,通常需要进行定点化操作。其中,定点化操作是指将用浮点数表示的卷积神经网络中的卷积参数和中间层结果定点化为用定点数表示。
发明内容
本申请实施例提供一种图像处理方法、装置、车载运算平台、电子设备及系统,所述技术方案如下。
根据本申请实施例的一个方面,提供的一种图像处理方法,包括:
根据运算单元的定点位宽硬件资源量对卷积神经网络使用浮点表示的网络参数进行定点化处理,其中,所述网络参数包括所述卷积神经网络的卷积参数以及层输出参数;
获取待处理的图像;
控制所述运算单元根据定点化处理后的卷积神经网络的网络参数处理所述图像,得到所述图像的处理结果。
根据本申请实施例的另一方面,提供的一种图像处理装置,包括:
第一处理模块,用于根据运算单元的定点位宽硬件资源量对卷积神经网络使用浮点表示的网络参数进行定点化处理,其中,所述网络参数包括所述卷积神经网络的卷积参数以及层输出参数;
获取模块,用于获取待处理的图像;
第二处理模块,用于控制所述运算单元根据定点化处理后的卷积神经网络的网络参数处理所述图像,得到所述图像的处理结果。
根据本申请实施例的又一方面,提供的一种基于现场可编程门阵列FPGA的车载运算平台,包括:处理器、外部存储器、内存和FPGA运算单元;
所述外部存储器中存储有卷积神经网络的定点化处理后的网络参数,所述网络参数包括所述卷积神经网络的卷积参数以及层输出参数;
所述处理器将所述卷积神经网络的定点化处理的网络参数读入所述内存,将所述内存上的数据和待处理的图像输入到所述FPGA运算单元;
所述FPGA运算单元根据定点化处理后的卷积神经网络的网络参数对所述待处理的图像进行运算处理,得到所述图像的处理结果。
根据本申请实施例的还一方面,提供的一种电子设备,包括:
处理器和存储器;
所述存储器用于存放至少一可执行指令,所述可执行指令使所述处理器执行如任一项实施例所述的图像处理方法对应的操作。
根据本申请实施例的再一方面,提供的一种电子设备,包括:
处理器和任一项实施例所述的图像处理装置;在处理器运行所述图像处理装置时,任一项实施例所述的图像处理装置中的模块被运行。
根据本申请实施例的再一方面,提供的一种智能驾驶系统,包括上述任一项实施例所述的电子设备。
根据本申请实施例的再一方面,提供的一种计算机可读存储介质,所述计算机可读存储介质中存储有计算机程序,所述计算机程序用于执行上述任一项实施例所述的图像处理方法。
本申请实施例所提供的图像处理方法、装置、车载运算平台、电子设备及系统,首先根据运算单元的定点位宽硬件资源量对卷积神经网络进行定点化处理,并在获取到待处理的图像后,控制运算单元根据定点化处理后的卷积神经网络的网络参数处理图像,从而实现在硬件资源有限的平台上使用卷积神经网络进行高效的图像处理。
下面通过附图和实施例,对本申请的技术方案做进一步的详细描述。
附图说明
构成说明书的一部分的附图描述了本申请的实施例,并且连同描述一起用于解释本申请的原理。
参照附图,根据下面的详细描述,可以更加清楚地理解本申请,其中:
图1为本申请实施例提供的图像处理方法的一个流程示意图。
图2为本申请实施例提供的图像处理方法的另一流程示意图。
图3为本申请实施例提供的图像处理方法的又一流程示意图。
图4为本申请实施例提供的图像处理方法的还一流程示意图。
图5为本申请实施例提供的图像处理方法的再一流程示意图。
图6为本申请实施例提供的图像处理方法的又再一流程示意图。
图7为本申请实施例提供的图像处理方法的还再一流程示意图。
图8为本申请实施例提供的图像处理装置的一个结构示意图。
图9为本申请实施例提供的图像处理装置的另一结构示意图。
图10为本申请实施例提供的图像处理装置的又一结构示意图。
图11为本申请实施例提供的图像处理装置的还一结构示意图。
图12为本申请实施例提供的基于FPGA的车载运算平台的结构示意图。
图13为本申请实施例提供的一种电子设备1300的实体框图。
具体实施方式
现在将参照附图来详细描述本申请的各种示例性实施例。应注意到:除非另外具体说明,否则在这些实施例中阐述的部件和步骤的相对布置、数字表达式和数值不限制本申请的范围。
同时,应当明白,为了便于描述,附图中所示出的各个部分的尺寸并不是按照实际的比例关系绘制的。
以下对至少一个示例性实施例的描述实际上仅仅是说明性的,决不作为对本申请及其应用或使用的任何限制。
对于相关领域普通技术人员已知的技术、方法和设备可能不作详细讨论,但在适当情况下,所述技术、方法和设备应当被视为说明书的一部分。
应注意到:相似的标号和字母在下面的附图中表示类似项,因此,一旦某一项在一个附图中被定义,则在随后的附图中不需要对其进行进一步讨论。
本申请实施例可以应用于计算机系统/服务器,其可与众多其它通用或专用计算系统环境或配置一起操作。适于与计算机系统/服务器一起使用的众所周知的计算系统、环境和/或配置的例子包括但不限于:个人计算机系统、服务器计算机系统、瘦客户机、厚客户机、手持或膝上设备、基于微处理器的系统、机顶盒、可编程消费电子产品、网络个人电脑、小型计算机系统﹑大型计算机系统和包括上述任何系统的分布式云计算技术环境,等等。
计算机系统/服务器可以在由计算机系统执行的计算机系统可执行指令(诸如程序模块)的一般语境下描述。通常,程序模块可以包括例程、程序、目标程序、组件、逻辑、数据结构等等,它们执行特定的任务或者实现特定的抽象数据类型。计算机系统/服务器可以在分布式云计算环境中实施,分布式云计算环境中,任务是由通过通信网络链接的远程处理设备执行的。在分布式云计算环境中,程序模块可以位于包括存储设备的本地或远程计算系统存储介质上。
本申请实施例所提供的图像处理方法,可以应用于各种使用卷积神经网络进行图像处理的场景中。示例性的,本申请实施例可以应用于智能驾驶领域中,例如自动驾驶和辅助驾驶技术中。在智能驾驶领域中可以基于卷积神经网络进行车道线检测、车道线拟合等,则对于智能驾驶领域中的卷积神经网络,可以使用本申请实施例所述的方法进行定点化操作。
图1为本申请实施例提供的图像处理方法的一个流程示意图,该方法的执行主体可以 为进行图像处理的电子设备中的处理器等,例如中央处理器(Central Processing Unit,简称CPU)。如图1所示,该方法包括:
S101、根据运算单元的定点位宽硬件资源量对卷积神经网络使用浮点表示的网络参数进行定点化处理。
其中,该网络参数包括卷积神经网络的卷积参数以及层输出参数。
可选的,上述运算单元可以是支持定点运算的计算单元。以现场可编程门阵列(Field-Programmable Gate Array,简称FPGA)为例,运算单元可以是FPGA中的数字信号处理器(Digital Signal Processor,简称DSP)。
卷积神经网络在硬件资源有限的平台上运行之前,需要进行定点化操作。示例性的,FPGA是一种廉价稳定的计算平台,可以在其上运行卷积神经网络。为了发挥FPGA等硬件平台低功耗、加速运算等方面的综合优势,运算单元的定点位宽硬件资源量通常较为有限。某些情形下,为了实现更低功耗往往会选择尽量小的定点位宽硬件资源量,比如8比特或4比特位甚至更少位宽硬件资源量来实现定点运算。然而,定点位宽硬件资源量少往往会影响运算速度,对于要求快速响应甚至是实时响应的平台,例如自动驾驶的车载运算平台等,则需要对卷积神经网络进行适配硬件定点位宽硬件资源量方面的优化,以实现在有限资源平台上的加速运算。出于上述需求,当卷积神经网络在FPGA等硬件资源有限的平台上运行之前,可以首先进行定点化操作,以适配硬件定点位宽资源量,从而同时满足对于运算平台的低功耗以及快速响应的要求。可选地,是将卷积神经网络的卷积参数和中间层结果定点化为用定点数表示。经过定点化操作之后,浮点数的乘加可以转换为定点数的乘加。对于FPGA等平台,定点数的乘法、加法等运算可以直接使用DSP来执行,因此,对卷积神经网络的网络参数进行定点化操作,可以减少FPGA等平台的硬件消耗。
卷积神经网络可以应用于图像处理过程中,本申请实施例提出一种基于卷积神经网络的图像处理方法,首先根据运算单元的定点位宽硬件资源量对卷积神经网络进行定点化处理,并在获取到待处理的图像后,控制运算单元根据网络参数经过定点化处理的卷积神经网络处理图像,从而实现在硬件资源有限的平台上使用卷积神经网络进行高效的图像处理。
在上述运算单元中,使用定点位宽硬件资源量来进行数据处理。示例性的,FPGA的DSP的定点位宽硬件资源量可以是4比特至8比特,即FPGA的DSP可以支持4比特至8比特的定点数的计算。相应的,在进行定点化处理时,需要将浮点数定点化为4比特至8比特的定点数。
在一个可选示例中,该步骤S101可以由处理器调用存储器存储的相应指令执行,也可以由被处理器运行的第一处理模块801执行。
S102、获取待处理的图像。
示例性的,在车道线检测、车道线拟合等场景下,可以由智能驾驶车辆的摄像头采集路面图像,处理器可以获取摄像头所采集的路面图像,该路面图像即为待处理的图像。
在一个可选示例中,该步骤S102可以由处理器调用存储器存储的相应指令执行,也 可以由被处理器运行的获取模块802执行。
S103、控制上述运算单元根据定点化处理后的卷积神经网络的网络参数处理上述图像,得到上述图像的处理结果。
在一个可选示例中,该步骤S103可以由处理器调用存储器存储的相应指令执行,也可以由被处理器运行的第二处理模块803执行。
可选的,处理上述图像的过程可以包括但不限于以下至少一项:定点乘法运算、定点加法运算、移动运算。
基于不同的场景,可以得到不同的图像处理结果。可以得到的图像的处理结果可以包括但不限于如下至少一项:
特征提取结果、分割结果、分类结果、对象检测/跟踪结果。
示例性的,上述对象检测结果可以是对车道线的检测结果。
本实施例中,首先根据运算单元的定点位宽硬件资源量对卷积神经网络进行定点化处理,并在获取到待处理的图像后,控制运算单元根据网络参数经过定点化处理的卷积神经网络处理图像,从而实现在硬件资源有限的平台上使用卷积神经网络进行高效的图像处理。通过对卷积神经网络进行定点化处理,能够实现在硬件资源有限的平台上实现加速运算,从而同时满足对于运算平台的低功耗以及快速响应的需求。
在上述步骤S101中进行定点化处理时,可以使用分阶段的逼近式定点化方式,或者,使用对卷积神经网络的层输出参数进行聚类的混合定点化方式,或者,使用上述二者结合的方式。
在上述使用分阶段的逼近式定点化方式中,首先根据卷积神经网络的网络参数确定定点化参数,进而,根据定点化参数、预设的定点化函数以及定点位宽硬件资源量对网络参数进行第一定点化,得到第一定点化后的卷积神经网络。
在上述对卷积神经网络的层输出参数进行聚类的混合定点化方式中,首先对卷积神经网络中的层输出参数进行聚类,得到预设数量的聚类结果,进而,根据聚类结果以及卷积神经网络中的卷积参数,根据定点位宽硬件资源量进行第二定点化,得到第二定点化后卷积神经网络。
在上述二者结合的方式中,可以进行分阶段的逼近式定点化,再对分阶段的逼近式定点化的结果进行上述混合定点化方式。
以下实施例分别进行说明。
图2为本申请实施例提供的图像处理方法的另一流程示意图,如图2所示,上述分阶段的逼近式定点化的过程包括:
S201、根据卷积神经网络中使用浮点表示的网络参数确定定点化参数。
其中,该定点化参数用于标识该网络参数对应的定点数的小数位数。
可选的,本申请实施例的输入为全精度浮点卷积神经网络,即在执行本申请实施例的方法之前,卷积神经网络中的网络参数使用浮点数表示。
可选的,上述网络参数可以包括卷积参数和层输出参数。其中,层输出参数是指卷积神经网络的中间层输出结果,例如中间层特征图等。
可选的,上述定点化参数用来标识上述网络参数对应的定点数的小数位数。在使用一次函数进行定点化之前,可以根据卷积神经网络中的网络参数确定定点化后的定点数的小数位数。
S202、根据上述定点化参数、预设的定点化函数以及上述定点位宽硬件资源量,对上述网络参数进行第一定点化,得到第一定点化后的卷积神经网络。
其中,该定点化函数为具有预设斜率的一次函数,该预设斜率大于0。
可选的,在确定出上述定点化参数之后,可以结合上述定点化参数、定点化函数以及运算单元的定点位宽硬件资源量进行第一定点化。
如下公式(1)为定点化函数的一个示例。
(x s=x q+a(x-x q)    公式(1)
其中,a为斜率,当a=1.0时,x s=x,相当于没有进行定点化。当a=0时,x s=x q,相当于完全定点化,此时,定点化函数在函数局部为一个阶跃的形式。本实施例中,即通过分阶段的过程,使a不断从1.0变为0。需要说明的是,上述定点化函数仅为一种实现方式,本领域技术人员可根据实际需要确定具有预设斜率的一次函数作为该定点化函数。
可选的,在实施过程中,本步骤可以分阶段执行多次。在每个阶段中,可以首先为上述定点化函数分配一个斜率,并基于斜率进行第一定点化。当完成本阶段的第一定点化之后,可以对斜率进行修正,并基于该修正后的斜率进行新的第一定点化,依次迭代执行,直至定点化函数的斜率逼近阶跃函数的斜率。例如,在卷积神经网络训练过程中,每次训练中,使用一个预设斜率进行第一定点化,在下一次训练时,可选地,响应于定点化函数与目标阶跃函数的差异大于预设差异,修正定点化函数的斜率;根据修正斜率后的定点化函数进行新的第一定点化;例如,判断定点化函数与目标阶跃函数的差异是否大于预设差异,例如斜率差值是否大于预设差值,若是,则使用新的斜率继续进行第一定点化,依次迭代执行,直至定点化函数的斜率逼近阶跃函数的斜率。
示例性的,假设将阶跃函数看作是斜率为0的一次函数,则在实施过程中,初始阶段可以为定点化函数分配斜率为1,并基于该定点化函数对上述网络参数进行定点化。依次迭代执行,在后续的阶段中逐渐减小斜率值,并分别基于每个阶段所分配的斜率进行定点化,直至斜率逼近0。
以在卷积神经网络的训练过程中执行定点化为例,在训练过程中进行定点化的过程包括:
在初始阶段为定点化函数分配一个初始斜率,再基于该定点化函数对网络参数进行定点化,进而,基于定点化后的定点网络参数对卷积神经网络进行训练,当训练结果符合预期之后,再基于当前所得到的卷积神经网络,执行第二阶段的斜率分配、定点化以及神经网络训练,依次迭代执行,直至斜率逼近0。通过该过程,使得定点化函数的结果可以分 阶段逐渐逼近完全定点化的结果。
本实施例中,通过使用具有特定斜率的定点化函数对卷积神经网络的卷积参数和层输出参数进行定点化,从而使得定点化结果可以逐渐逼近完全定点化的结果,从而降低了定点化时的精度损失,减小了定点化的误差,提升了定点化的准确度。
以下说明对卷积神经网络的层输出参数进行聚类的混合定点化方式,并说明上述两种方式结合的过程。
图3为本申请实施例提供的图像处理方法的又一流程示意图,如图3所示,上述对卷积神经网络的层输出参数进行聚类的混合定点化方式包括:
S301、对卷积神经网络中使用浮点表示的层输出参数进行聚类,得到预设数量的聚类结果。
如果使用上述两种方式结合的方式,则本步骤中所述的卷积神经网络是指进行上述第一定点化之后的卷积神经网络。
本实施例中以卷积神经网络为第一定点化后的卷积神经网络为例进行说明。
可选的,可以使用K均值聚类(Kmeans)方式对上述层输出参数进行聚类。
可选的,在经过上述第一定点化之后,所得到的上述层输出参数对应的小数位数为上述定点化参数所标识的小数位数。在此基础上,对这些层输出参数进行聚类。
示例性的,假设上述层输出参数为k+2比特的定点数,则可以使用Kmeans方式对上述层输出参数进行k比特的聚类。其中,k为大于0的整数。
S302、根据上述聚类结果、上述卷积神经网络中使用浮点表示的卷积参数以及定点位宽硬件资源量进行第二定点化,得到第二定点化后的卷积神经网络。
如果使用上述两种方式结合的方式,则本步骤中所述的卷积神经网络是指进行上述第一定点化之后的卷积神经网络。
可选的,上述第二定点化可以为使用阶跃函数的定点化。
本实施例中,通过对卷积神经网络的层输出参数进行聚类,并对聚类结果进行第二定点化,可以使得在保证定点化精度的前提下降低定点化位宽,进而减少带宽占用。示例性的,当本申请实施例所涉及的卷积神经网络应用于FPGA时,对层输出参数进行聚类表示之后,层输出参数可以使用较低的比特数来表示,从而可以生成一个对应标。例如,用K均值聚类得到16个聚类的数,则每一个层输出参数可以用使用4比特来表示。进而,FPGA在读取数据时,可以仅读取4比特,即只需读取比聚类前更少的比特数,进而可以通过查表的方式得到真实数据,从而降低的FPGA的带宽。
在上述实施例的基础上,本实施例涉及根据卷积神经网络的网络参数确定定点化参数的过程。
可选的,上述步骤S201包括:
根据上述卷积参数的小数位数以及上述层输出参数的小数位数,确定上述定点化参数。
可选的,在执行本申请实施例的方法之前,上述卷积神经网络中的卷积参数和层输出 参数分别为浮点数,针对这些浮点数,在本实施例中,可以根据这些浮点数对应的小数位数,确定上述定点化参数。
一种可选的实施方式,可以将上述卷积参数的小数位数和上述层输出参数的小数位数中的最大小数位数,作为上述定点化参数对应的小数位数。
示例性的,假设卷积神经网络中有一个卷积参数,值为1.1,有两个层输出参数,值分别为1.23和3.354,则最大小数位数为3,则可以确定上述定点化参数对应的小数位数为3。
另一种可选的实施方式中,可以将上述卷积参数的小数位数和上述层输出参数的小数位数中的占比最大的小数位数,作为上述定点化参数对应的小数位数。
示例性的,假设卷积神经网络中有两个卷积参数,值分别为1.1和1.2,有两个层输出参数,值分别为1.23和3.354,则占比最大的小数位数为1,则可以确定上述定点化参数对应的小数位数为1。
在上述实施例的基础上,本实施例涉及对上述网络参数进行第一定点化的过程。
图4为本申请实施例提供的图像处理方法的还一流程示意图,如图4所示,上述步骤S202包括:
S401、根据定点位宽硬件资源量的比特位数以及上述定点化参数,确定上述网络参数的定点化电平。
当经过上述的过程得到上述定点化参数之后,可以根据定点位宽硬件资源量的比特位数和上述定点化参数,确定上述网络参数的定点化电平。
示例性的,假设定点位宽硬件资源量的比特位数为2,经过上述过程确定定点化参数对应的小数位数为0,则可以确定上述网络参数的定点化电平包括-2,-1,0以及1。
S402、根据上述定点化电平以及上述定点化函数,对上述网络参数进行第一定点化,得到第一定点化后的卷积神经网络。
作为一种可选的实施方式,可以通过如下方式对上述网络参数进行第一定点化。
图5为本申请实施例提供的图像处理方法的再一流程示意图,如图5所示,上述步骤S402包括:
S501、确定上述网络参数的值与目标电平的差值。
其中,目标电平为与上述网络参数的值最接近的定点化电平。
S502、将上述差值以及定点化电平输入上述定点化函数中,得到对上述网络参数进行上述第一定点化的结果。
可选的,在确定出网络参数的定点化电平之后,在本实施例中,以其中一个网络参数A为例,可以按照下述方式对该网络参数A进行第一定点化,其余网络参数进行第一定点化的方式均与该网络参数A相同。
假设上述网络参数A为一个卷积核参数,则首先确定与该卷积核参数最接近的定点化电平。可选的,可以通过计算该卷积核参数与定点化电平的差值来确定与该卷积核参数最 接近的定点化电平,例如,从定点化电平中选择与该卷积核参数之间差值最小的定点化电平作为最接近的定点化电平(如:目标电平)。
示例性的,假设经过上述步骤确定出该卷积核参数的定点化电平为-2,-1,0以及1,该卷积核参数的值为-1.2,则通过计算该卷积核参数与定点化电平的差值,可以确定与该卷积核参数最接近的定点化电平为-1。
进而,将上述网络参数的值与定电化电平的差值和定点化电平输入到上述定点化函数中,得到对网络参数A进行第一定点化的结果。
可选的,假设上述定点化函数通过下述公式(2)表示。
L+S*k    公式(2)
其中,L为定点化电平(如:目标电平),S为网络参数A与目标电平的差值,k为当前阶段对应的斜率,则将由上述过程确定出的目标电平以及差值输入上述公式(2)之后,即可得到网络参数A的第一定点化的结果。
需要说明的是,上述定点化函数仅为一种实现方式,本领域技术人员可根据实际需要确定与目标电平以及网络参数与目标电平的差值相关的函数作为该定点化函数。
在上述实施例的基础上,本实施例涉及对上述层输出参数进行聚类的过程。
图6为本申请实施例提供的图像处理方法的又再一流程示意图,如图6所示,上述步骤S301中进行聚类的过程包括:
S601、从上述层输出参数中选择上述预设数量的层输出参数作为初始聚类中心。
S602、根据上述初始聚类中心进行聚类迭代处理,得到上述预设数量的聚类结果。
示例性的,假设上述预设的比特位数为6,即网络参数使用6比特表示,则本实施例中,可以对上述层输出参数进行4比特的聚类,该4比特可以标识16个数,因此上述预设数量可以为16个。
初始时,可以按照特定的原则从上述层输出参数中选择16个层输出参数,将该16个层输出参数作为初始聚类中心,进而,根据剩余层输出参数与这些初始聚类中心的相似程度,即差值(通常差值越小,表示相似程度越高),分别将剩余层输出函数分配给这些聚类中心,形成多个聚类。进而,计算每个聚类的新的聚类中心,并基于新的聚类中心继续进行聚类迭代处理,直至每个聚类中的层输出参数的差值满足收敛条件,从而得到16个聚类结果。
在上述实施例的基础上,本实施例涉及对上述聚类结果进行第二定点化的过程。
图7为本申请实施例提供的图像处理方法的还再一流程示意图,如图7所示,上述步骤S302包括:
S701、确定上述聚类结果的聚类中心。
经过上述处理之后,可以得到多个聚类,对于其中的每个聚类,都可以按照本实施例S701-S703的过程确定的第二定点化结果。
假设多个聚类中的其中一个聚类为聚类1,则本步骤中,首先确定该聚类1的聚类中 心。
可选的,该聚类中心可以为聚类1中所包括的多个层输出参数的平均值。
S702、对上述聚类中心进行第二定点化,得到上述聚类中心的第二定点化结果。
其中,该第二定点化用于将上述聚类中心定点化为与上述聚类中心最接近的定点化电平。
可选的,对上述聚类中心进行第二定点化可包括:基于聚类中心以及卷积神经网络中使用浮点表示的卷积参数,或者,基于聚类中心以及第一定点化后的卷积神经网络中的卷积参数,根据定点位宽硬件资源量进行第二定点化。
当确定出上述聚类1的聚类中心,可以对该聚类中心进行第二定点化。其中,该第二定点化可以使用阶跃函数进行定点化,即通过阶跃函数,将该聚类中心定点化为与该聚类中心最接近的定点化电平。
示例性的,假设聚类1的聚类中心为1.2,使用阶跃函数进行第二定点化之后,可以将该聚类中心定点化为1。
S703、将上述聚类中心的第二定点化结果作为上述聚类结果的第二定点化结果。
在确定出聚类1的聚类中心的第二定点化结果之后,即可将该第二定点化结果作为聚类1中所包括的各层输出参数的第二定点化结果。
由于在进行聚类时,选择了小于输出层参数的表示位数的比特位(例如层输出参数使用6比特表示,则进行4比特的聚类)进行聚类,因此最终完成第二定点化之后,仅使用较少的位数就可以表示所有的层输出参数,因此,通过聚类使得在保证定点化精度的前提下降低了定点化位宽,从而实现了减少带宽占用的目的。
本领域普通技术人员可以理解:实现上述方法实施例的全部或部分步骤可以通过程序指令相关的硬件来完成,前述的程序可以存储于一计算机可读取存储介质中,该程序在执行时,执行包括上述方法实施例的步骤;而前述的存储介质包括:ROM、RAM、磁碟或者光盘等各种可以存储程序代码的介质。
图8为本申请实施例提供的一种图像处理装置的一个结构示意图。如图8所示,该装置包括:
第一处理模块801,用于根据运算单元的定点位宽硬件资源量对卷积神经网络使用浮点表示的网络参数进行定点化处理。
其中,网络参数包括卷积神经网络的卷积参数以及层输出参数。
获取模块802,用于获取待处理的图像。
第二处理模块803,用于控制运算单元根据定点化处理后的卷积神经网络的网络参数处理图像,得到图像的处理结果。
该装置用于实现前述方法实施例,其实现原理和技术效果类似,此处不再赘述。
图9为本申请实施例提供的一种图像处理装置的另一结构示意图。如图9所示,第一处理模块801包括:
聚类单元8011,用于对卷积神经网络中使用浮点表示的层输出参数进行聚类,得到预设数量的聚类结果。
第二定点化单元8012,用于根据聚类结果、卷积神经网络中使用浮点表示的卷积参数以及定点位宽硬件资源量进行第二定点化,得到第二定点化后的卷积神经网络。
图10为本申请实施例提供的一种图像处理装置的又一结构示意图。如图10所示,第一处理模块801还包括:
确定单元8013,用于根据卷积神经网络中使用浮点表示的网络参数确定定点化参数,定点化参数用于标识网络参数对应的定点数的小数位数。
第一定点化单元8014,用于根据定点化参数、预设的定点化函数以及定点位宽硬件资源量对网络参数进行第一定点化,得到第一定点化后的卷积神经网络。
其中,定点化函数为具有预设斜率的一次函数,预设斜率大于0。
另一实施例中,第一处理模块801用于:
对第一定点化后的卷积神经网络中的层输出参数进行聚类,得到预设数量的聚类结果;
根据聚类结果、第一定点化后的卷积神经网络中的卷积参数以及定点位宽硬件资源量进行第二定点化,得到第二定点化后的卷积神经网络。
另一实施例中,确定单元8013用于:
根据卷积参数的小数位数以及层输出参数的小数位数,确定定点化参数。
另一实施例中,确定单元8013用于:
将卷积参数的小数位数和层输出参数的小数位数中的最大小数位数,作为定点化参数对应的小数位数。
另一实施例中,第一定点化单元8014用于:
根据定点位宽硬件资源量的比特位数以及定点化参数,确定网络参数的定点化电平。
根据定点化电平以及定点化函数,对网络参数进行第一定点化,得到第一定点化后的卷积神经网络。
另一实施例中,第一定点化单元8014用于:
确定网络参数的值与目标电平的差值。
其中,目标电平为与网络参数的值最接近的定点化电平;以及,
将差值以及目标电平输入定点化函数中,得到对网络参数进行第一定点化的结果。
另一实施例中,第一处理模块801用于:
从层输出参数中选择预设数量的层输出参数作为初始聚类中心;
根据初始聚类中心进行聚类迭代处理,得到预设数量的聚类结果。
另一实施例中,第一处理模块801用于:
确定聚类结果的聚类中心;
基于聚类中心以及卷积神经网络中使用浮点表示的卷积参数,或者,基于聚类中心以及第一定点化后的卷积神经网络中的卷积参数,根据定点位宽硬件资源量进行第二定点化, 得到第二定点化结果,其中,第二定点化用于将聚类中心定点化为与聚类中心最接近的定点化电平。
图11为本申请实施例提供的一种图像处理装置的还一结构示意图。如图11所示,该装置还包括:
更新模块804,用于在定点化函数与目标阶跃函数的差异大于预设差异时修正所述定点化函数的斜率;以及,根据修正斜率后的定点化函数进行新的第一定点化。
另一实施例中,第二处理模块803用于:
控制运算单元根据定点化处理后的卷积神经网络的网络参数对图像进行如下至少一项处理:
定点乘法运算、定点加法运算、移位运算。
另一实施例中,所述图像的处理结果包括如下至少一项:
特征提取结果、分割结果、分类结果、对象检测/跟踪结果。
本公开实施例提供的图像处理装置任一实施例的工作过程、设置方式及相应技术效果,均可以参照本公开上述相应方法实施例的具体描述,限于篇幅,在此不再赘述。
图12为本申请实施例提供的基于FPGA的车载运算平台的结构示意图。如图12所示,基于FPGA的车载运算平台包括:处理器1201、外部存储器1202、内存1203和FPGA运算单元1204;其中,
外部存储器1202中存储有卷积神经网络的定点化处理后的网络参数,网络参数包括卷积神经网络的卷积参数以及层输出参数。
处理器1201将卷积神经网络的定点化处理的网络参数读入内存1203,将内存1203上的数据和待处理的图像输入到FPGA运算单元。
FPGA运算单元1204根据定点化处理后的卷积神经网络的网络参数对待处理的图像进行运算处理,得到图像的处理结果。
处理器1201还可以执行上述任一实施例提供的图像处理方法中的步骤,可以参照前述方法实施例,此处不再赘述。
图13为本申请实施例提供的一种电子设备1300的实体框图,如图13所示,该电子设备1300包括:处理器1302和存储器1301;
存储器1301用于存放至少一可执行指令,该可执行指令使处理器1302执行如上述任一项实施例提供的图像处理方法对应的操作。
本申请实施例还提供一种电子设备,包括:
处理器和上述任一项实施例提供的图像处理装置;在处理器运行图像处理装置时,上述任一项实施例提供的图像处理装置中的模块被运行。
本申请实施例还提供一种智能驾驶系统,该智能驾驶系统包括上述任一实施例提供的电子设备。
本申请实施例还提供一种计算机可读存储介质,该计算机可读存储介质中存储有计算 机程序,该计算机程序用于执行上述任一项实施例提供的图像处理方法。
本说明书中各个实施例均采用递进的方式描述,每个实施例重点说明的都是与其它实施例的不同之处,各个实施例之间相同或相似的部分相互参见即可。对于系统实施例而言,由于其与方法实施例基本对应,所以描述的比较简单,相关之处参见方法实施例的部分说明即可。
可能以许多方式来实现本申请的方法和装置。例如,可通过软件、硬件、固件或者软件、硬件、固件的任何组合来实现本申请的方法和装置。用于所述方法的步骤的上述顺序仅是为了进行说明,本申请的方法的步骤不限于以上具体描述的顺序,除非以其它方式特别说明。此外,在一些实施例中,还可将本申请实施为记录在记录介质中的程序,这些程序包括用于实现根据本申请的方法的机器可读指令。因而,本申请还覆盖存储用于执行根据本申请的方法的程序的记录介质。
本申请的描述是为了示例和描述起见而给出的,而并不是无遗漏的或者将本申请限于所公开的形式。很多修改和变化对于本领域的普通技术人员而言是显然的。选择和描述实施例是为了更好说明本申请的原理和实际应用,并且使本领域的普通技术人员能够理解本申请从而设计适于特定用途的带有各种修改的各种实施例。

Claims (43)

  1. 一种图像处理方法,其特征在于,包括:
    根据运算单元的定点位宽硬件资源量对卷积神经网络使用浮点表示的网络参数进行定点化处理,其中,所述网络参数包括所述卷积神经网络的卷积参数以及层输出参数;
    获取待处理的图像;
    控制所述运算单元根据定点化处理后的卷积神经网络的网络参数处理所述图像,得到所述图像的处理结果。
  2. 根据权利要求1所述的方法,其特征在于,所述根据运算单元的定点位宽硬件资源量对卷积神经网络使用浮点表示的网络参数进行定点化处理,包括:
    对所述卷积神经网络中使用浮点表示的层输出参数进行聚类,得到预设数量的聚类结果;
    根据所述聚类结果、所述卷积神经网络中使用浮点表示的卷积参数以及所述定点位宽硬件资源量进行第二定点化,得到第二定点化后的所述卷积神经网络。
  3. 根据权利要求1所述的方法,其特征在于,所述根据运算单元的定点位宽硬件资源量对卷积神经网络使用浮点表示的网络参数进行定点化处理,包括:
    根据卷积神经网络中使用浮点表示的网络参数确定定点化参数,所述定点化参数用于标识所述网络参数对应的定点数的小数位数;
    根据所述定点化参数、预设的定点化函数以及所述定点位宽硬件资源量对所述网络参数进行第一定点化,得到第一定点化后的卷积神经网络,其中,所述定点化函数为具有预设斜率的一次函数,所述预设斜率大于0。
  4. 根据权利要求3所述的方法,其特征在于,还包括:
    对所述第一定点化后的卷积神经网络中的所述层输出参数进行聚类,得到预设数量的聚类结果;
    根据所述聚类结果、所述第一定点化后的卷积神经网络中的所述卷积参数以及所述定点位宽硬件资源量进行第二定点化,得到第二定点化后的所述卷积神经网络。
  5. 根据权利要求3或4所述的方法,其特征在于,所述根据卷积神经网络中使用浮点表示的网络参数确定定点化参数,包括:
    根据所述卷积参数的小数位数以及所述层输出参数的小数位数,确定所述定点化参数。
  6. 根据权利要求5所述的方法,其特征在于,所述根据所述卷积参数的位数以及所述层输出参数的位数,确定所述定点化参数,包括:
    将所述卷积参数的小数位数和所述层输出参数的小数位数中的最大小数位数,作为所述定点化参数对应的小数位数。
  7. 根据权利要求3-6任一项所述的方法,其特征在于,所述根据所述定点化参数、预设的定点化函数以及所述定点位宽硬件资源量对所述网络参数进行第一定点化,得到第一定点化后的卷积神经网络,包括:
    根据所述定点位宽硬件资源量的比特位数以及所述定点化参数,确定所述网络参数的定点化电平;
    根据所述定点化电平以及所述定点化函数,对所述网络参数进行第一定点化,得到第一定点化后的卷积神经网络。
  8. 根据权利要求7所述的方法,其特征在于,所述根据所述定点化电平以及所述定点化函数,对所述网络参数进行第一定点化,包括:
    确定所述网络参数的值与目标电平的差值;
    其中,所述目标电平为与所述网络参数的值最接近的所述定点化电平;
    将所述差值以及所述目标电平输入所述定点化函数中,得到对所述网络参数进行所述第一定点化的结果。
  9. 根据权利要求2或4所述的方法,其特征在于,所述进行聚类,得到预设数量的聚类结果,包括:
    从所述层输出参数中选择所述预设数量的层输出参数作为初始聚类中心;
    根据所述初始聚类中心进行聚类迭代处理,得到所述预设数量的聚类结果。
  10. 根据权利要求2或4所述的方法,其特征在于,所述进行第二定点化,包括:
    确定所述聚类结果的聚类中心;
    基于所述聚类中心以及所述卷积神经网络中使用浮点表示的卷积参数,或者,基于所述聚类中心以及第一定点化后的卷积神经网络中的所述卷积参数,根据所述定点位宽硬件资源量进行第二定点化,得到第二定点化结果,其中,所述第二定点化用于将所述聚类中心定点化为与所述聚类中心最接近的定点化电平。
  11. 根据权利要求3-8任一项所述的方法,其特征在于,还包括:
    响应于所述定点化函数与目标阶跃函数的差异大于预设差异,修正所述定点化函数的斜率;
    根据修正斜率后的定点化函数进行新的第一定点化。
  12. 根据权利要求1-11任一项所述的方法,其特征在于,所述控制所述运算单元根据定点化处理后的卷积神经网络的网络参数处理所述图像,包括:
    控制所述运算单元根据定点化处理后的卷积神经网络的网络参数对所述图像进行如下至少一项处理:
    定点乘法运算、定点加法运算、移位运算。
  13. 根据权利要求1-12任一项所述的方法,其特征在于,所述图像的处理结果包括如下至少一项:
    特征提取结果、分割结果、分类结果、对象检测/跟踪结果。
  14. 一种图像处理装置,其特征在于,包括:
    第一处理模块,用于根据运算单元的定点位宽硬件资源量对卷积神经网络使用浮点表示的网络参数进行定点化处理,其中,所述网络参数包括所述卷积神经网络的卷积参数以 及层输出参数;
    获取模块,用于获取待处理的图像;
    第二处理模块,用于控制所述运算单元根据定点化处理后的卷积神经网络的网络参数处理所述图像,得到所述图像的处理结果。
  15. 根据权利要求14所述的装置,其特征在于,所述第一处理模块包括:
    聚类单元,用于对所述卷积神经网络中使用浮点表示的层输出参数进行聚类,得到预设数量的聚类结果;
    第二定点化单元,用于根据所述聚类结果、所述卷积神经网络中使用浮点表示的卷积参数以及所述定点位宽硬件资源量进行第二定点化,得到第二定点化后的所述卷积神经网络。
  16. 根据权利要求14所述的装置,其特征在于,所述第一处理模块还包括:
    确定单元,用于根据卷积神经网络中使用浮点表示的网络参数确定定点化参数,所述定点化参数用于标识所述网络参数对应的定点数的小数位数;
    第一定点化单元,用于根据所述定点化参数、预设的定点化函数以及所述定点位宽硬件资源量对所述网络参数进行第一定点化,得到第一定点化后的卷积神经网络,其中,所述定点化函数为具有预设斜率的一次函数,所述预设斜率大于0。
  17. 根据权利要求16所述的装置,其特征在于,所述第一处理模块用于:
    对所述第一定点化后的卷积神经网络中的所述层输出参数进行聚类,得到预设数量的聚类结果;
    根据所述聚类结果、所述第一定点化后的卷积神经网络中的所述卷积参数以及所述定点位宽硬件资源量进行第二定点化,得到第二定点化后的所述卷积神经网络。
  18. 根据权利要求16或17所述的装置,其特征在于,所述确定单元用于:
    根据所述卷积参数的小数位数以及所述层输出参数的小数位数,确定所述定点化参数。
  19. 根据权利要求18所述的装置,其特征在于,所述确定单元用于:
    将所述卷积参数的小数位数和所述层输出参数的小数位数中的最大小数位数,作为所述定点化参数对应的小数位数。
  20. 根据权利要求16-19任一项所述的装置,其特征在于,所述第一定点化单元用于:
    根据所述定点位宽硬件资源量的比特位数以及所述定点化参数,确定所述网络参数的定点化电平;
    根据所述定点化电平以及所述定点化函数,对所述网络参数进行第一定点化,得到第一定点化后的卷积神经网络。
  21. 根据权利要求20所述的装置,其特征在于,所述第一定点化单元用于:
    确定所述网络参数的值与目标电平的差值;
    其中,所述目标电平为与所述网络参数的值最接近的所述定点化电平;以及,
    将所述差值以及所述目标电平输入所述定点化函数中,得到对所述网络参数进行所述 第一定点化的结果。
  22. 根据权利要求15或17所述的装置,其特征在于,所述第一处理模块用于:
    从所述层输出参数中选择所述预设数量的层输出参数作为初始聚类中心;
    根据所述初始聚类中心进行聚类迭代处理,得到所述预设数量的聚类结果。
  23. 根据权利要求15或17所述的装置,其特征在于,所述第一处理模块用于:
    确定所述聚类结果的聚类中心;
    基于所述聚类中心以及所述卷积神经网络中使用浮点表示的卷积参数,或者,基于所述聚类中心以及第一定点化后的卷积神经网络中的所述卷积参数,根据所述定点位宽硬件资源量进行第二定点化,得到第二定点化结果,其中,所述第二定点化用于将所述聚类中心定点化为与所述聚类中心最接近的定点化电平。
  24. 根据权利要求16-21任一项所述的装置,其特征在于,还包括:
    更新模块,用于在所述定点化函数与目标阶跃函数的差异大于预设差异时修正所述定点化函数的斜率;以及,根据修正斜率后的定点化函数进行新的第一定点化。
  25. 根据权利要求14-24任一项所述的装置,其特征在于,第二处理模块用于:
    控制所述运算单元根据定点化处理后的卷积神经网络的网络参数对所述图像进行如下至少一项处理:
    定点乘法运算、定点加法运算、移位运算。
  26. 根据权利要求14-25任一项所述的装置,其特征在于,所述图像的处理结果包括如下至少一项:
    特征提取结果、分割结果、分类结果、对象检测/跟踪结果。
  27. 一种基于现场可编程门阵列FPGA的车载运算平台,其特征在于,包括:处理器、外部存储器、内存和FPGA运算单元;
    所述外部存储器中存储有卷积神经网络的定点化处理后的网络参数,所述网络参数包括所述卷积神经网络的卷积参数以及层输出参数;
    所述处理器将所述卷积神经网络的定点化处理的网络参数读入所述内存,将所述内存上的数据和待处理的图像输入到所述FPGA运算单元;
    所述FPGA运算单元根据定点化处理后的卷积神经网络的网络参数对所述待处理的图像进行运算处理,得到所述图像的处理结果。
  28. 根据权利要求27所述的平台,其特征在于,所述处理器用于:
    对所述卷积神经网络中的层输出参数进行聚类,得到预设数量的聚类结果;
    根据所述聚类结果、所述卷积神经网络中使用浮点表示的卷积参数以及所述定点位宽硬件资源量进行第二定点化,得到第二定点化后的所述卷积神经网络。
  29. 根据权利要求27所述的平台,其特征在于,所述处理器用于:
    根据卷积神经网络中使用浮点表示的网络参数确定定点化参数,所述定点化参数用于标识所述网络参数对应的定点数的小数位数;
    根据所述定点化参数、预设的定点化函数以及所述定点位宽硬件资源量对所述网络参数进行第一定点化,得到第一定点化后的卷积神经网络,其中,所述定点化函数为具有预设斜率的一次函数,所述预设斜率大于0。
  30. 根据权利要求29所述的平台,其特征在于,所述处理器用于:
    对所述第一定点化后的卷积神经网络中的所述层输出参数进行聚类,得到预设数量的聚类结果;
    根据所述聚类结果、所述第一定点化后的卷积神经网络中的所述卷积参数以及所述定点位宽硬件资源量进行第二定点化,得到第二定点化后的所述卷积神经网络。
  31. 根据权利要求29或30所述的平台,其特征在于,所述处理器用于:
    根据所述卷积参数的小数位数以及所述层输出参数的小数位数,确定所述定点化参数。
  32. 根据权利要求31所述的平台,其特征在于,所述处理器用于:
    将所述卷积参数的小数位数和所述层输出参数的小数位数中的最大小数位数,作为所述定点化参数对应的小数位数。
  33. 根据权利要求29-32任一项所述的平台,其特征在于,所述处理器用于:
    根据所述定点位宽硬件资源量的比特位数以及所述定点化参数,确定所述网络参数的定点化电平;
    根据所述定点化电平以及所述定点化函数,对所述网络参数进行第一定点化,得到第一定点化后的卷积神经网络。
  34. 根据权利要求33所述的平台,其特征在于,所述处理器用于:
    确定所述网络参数的值与目标电平的差值;
    其中,所述目标电平为与所述网络参数的值最接近的所述定点化电平;
    将所述差值以及所述目标电平输入所述定点化函数中,得到对所述网络参数进行所述第一定点化的结果。
  35. 根据权利要求28或30所述的平台,其特征在于,所述处理器用于:
    从所述层输出参数中选择所述预设数量的层输出参数作为初始聚类中心;
    根据所述初始聚类中心进行聚类迭代处理,得到所述预设数量的聚类结果。
  36. 根据权利要求28或30所述的平台,其特征在于,所述处理器用于:
    确定所述聚类结果的聚类中心;
    基于所述聚类中心以及所述卷积神经网络中使用浮点表示的卷积参数,或者,基于所述聚类中心以及第一定点化后的卷积神经网络中的所述卷积参数,根据所述定点位宽硬件资源量进行第二定点化,得到第二定点化结果,其中,所述第二定点化用于将所述聚类中心定点化为与所述聚类中心最接近的定点化电平。
  37. 根据权利要求29-34任一项所述的平台,其特征在于,所述处理器用于:
    响应于所述定点化函数与目标阶跃函数的差异大于预设差异,修正所述定点化函数的斜率;
    根据修正斜率后的定点化函数进行新的第一定点化。
  38. 根据权利要求27-37任一项所述的平台,其特征在于,所述处理器用于:
    控制所述运算单元根据定点化处理后的卷积神经网络的网络参数对所述图像进行如下至少一项处理:
    定点乘法运算、定点加法运算、移位运算。
  39. 根据权利要求27-38任一项所述的平台,其特征在于,所述图像的处理结果包括如下至少一项:
    特征提取结果、分割结果、分类结果、对象检测/跟踪结果。
  40. 一种电子设备,其特征在于,包括:处理器和存储器;
    所述存储器用于存放至少一可执行指令,所述可执行指令使所述处理器执行如权利要求1-13任一项所述的图像处理方法对应的操作。
  41. 一种电子设备,其特征在于,包括:
    处理器和权利要求14-26任一项所述的图像处理装置;在处理器运行所述图像处理装置时,权利要求14-26任一项所述的图像处理装置中的模块被运行。
  42. 一种智能驾驶系统,其特征在于,包括权利要求40或41所述的电子设备。
  43. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质中存储有计算机程序,所述计算机程序用于执行权利要求1-13任一项所述的图像处理方法。
PCT/CN2019/128763 2018-12-29 2019-12-26 图像处理方法、装置、车载运算平台、电子设备及系统 WO2020135601A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
JP2021533274A JP2022512211A (ja) 2018-12-29 2019-12-26 画像処理方法、装置、車載演算プラットフォーム、電子機器及びシステム
KR1020217018149A KR20210090249A (ko) 2018-12-29 2019-12-26 이미지 처리 방법, 장치, 차량 탑재 연산 플랫폼, 전자 디바이스 및 시스템

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201811647408.2A CN111383157B (zh) 2018-12-29 2018-12-29 图像处理方法、装置、车载运算平台、电子设备及系统
CN201811647408.2 2018-12-29

Publications (1)

Publication Number Publication Date
WO2020135601A1 true WO2020135601A1 (zh) 2020-07-02

Family

ID=71125717

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/128763 WO2020135601A1 (zh) 2018-12-29 2019-12-26 图像处理方法、装置、车载运算平台、电子设备及系统

Country Status (4)

Country Link
JP (1) JP2022512211A (zh)
KR (1) KR20210090249A (zh)
CN (1) CN111383157B (zh)
WO (1) WO2020135601A1 (zh)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112308226A (zh) * 2020-08-03 2021-02-02 北京沃东天骏信息技术有限公司 神经网络模型的量化、用于输出信息的方法和装置
CN113780320A (zh) * 2020-10-27 2021-12-10 北京沃东天骏信息技术有限公司 物品识别方法、模型训练方法以及装置
WO2023272432A1 (zh) * 2021-06-28 2023-01-05 华为技术有限公司 图像处理方法和图像处理装置

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114611685B (zh) * 2022-03-08 2024-09-20 安谋科技(中国)有限公司 神经网络模型中的特征处理方法、介质、设备和程序产品

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106611216A (zh) * 2016-12-29 2017-05-03 北京旷视科技有限公司 基于神经网络的计算方法及装置
CN107239825A (zh) * 2016-08-22 2017-10-10 北京深鉴智能科技有限公司 考虑负载均衡的深度神经网络压缩方法
CN107480770A (zh) * 2017-07-27 2017-12-15 中国科学院自动化研究所 可调节量化位宽的神经网络量化与压缩的方法及装置
CN108053028A (zh) * 2017-12-21 2018-05-18 深圳云天励飞技术有限公司 数据定点化处理方法、装置、电子设备及计算机存储介质
CN108734264A (zh) * 2017-04-21 2018-11-02 展讯通信(上海)有限公司 深度神经网络模型压缩方法及装置、存储介质、终端

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10262259B2 (en) * 2015-05-08 2019-04-16 Qualcomm Incorporated Bit width selection for fixed point neural networks
US10838910B2 (en) * 2017-04-27 2020-11-17 Falcon Computing Systems and methods for systolic array design from a high-level program
CN107885214A (zh) * 2017-11-22 2018-04-06 济南浪潮高新科技投资发展有限公司 一种基于fpga的加速自动驾驶视觉感知的方法及装置
CN108830288A (zh) * 2018-04-25 2018-11-16 北京市商汤科技开发有限公司 图像处理方法、神经网络的训练方法、装置、设备及介质
CN109002881A (zh) * 2018-06-28 2018-12-14 郑州云海信息技术有限公司 基于fpga的深度神经网络的定点化计算方法及装置

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107239825A (zh) * 2016-08-22 2017-10-10 北京深鉴智能科技有限公司 考虑负载均衡的深度神经网络压缩方法
CN106611216A (zh) * 2016-12-29 2017-05-03 北京旷视科技有限公司 基于神经网络的计算方法及装置
CN108734264A (zh) * 2017-04-21 2018-11-02 展讯通信(上海)有限公司 深度神经网络模型压缩方法及装置、存储介质、终端
CN107480770A (zh) * 2017-07-27 2017-12-15 中国科学院自动化研究所 可调节量化位宽的神经网络量化与压缩的方法及装置
CN108053028A (zh) * 2017-12-21 2018-05-18 深圳云天励飞技术有限公司 数据定点化处理方法、装置、电子设备及计算机存储介质

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112308226A (zh) * 2020-08-03 2021-02-02 北京沃东天骏信息技术有限公司 神经网络模型的量化、用于输出信息的方法和装置
CN112308226B (zh) * 2020-08-03 2024-05-24 北京沃东天骏信息技术有限公司 神经网络模型的量化、用于输出信息的方法和装置
CN113780320A (zh) * 2020-10-27 2021-12-10 北京沃东天骏信息技术有限公司 物品识别方法、模型训练方法以及装置
WO2023272432A1 (zh) * 2021-06-28 2023-01-05 华为技术有限公司 图像处理方法和图像处理装置

Also Published As

Publication number Publication date
JP2022512211A (ja) 2022-02-02
CN111383157A (zh) 2020-07-07
KR20210090249A (ko) 2021-07-19
CN111383157B (zh) 2023-04-14

Similar Documents

Publication Publication Date Title
WO2020135601A1 (zh) 图像处理方法、装置、车载运算平台、电子设备及系统
KR102647858B1 (ko) 컨볼루션 신경망 계산을 위한 저전력 하드웨어 가속 방법 및 시스템
US20240104378A1 (en) Dynamic quantization of neural networks
US11429838B2 (en) Neural network device for neural network operation, method of operating neural network device, and application processor including the neural network device
EP3822857A1 (en) Target tracking method, device, electronic apparatus and storage medium
KR102655950B1 (ko) 뉴럴 네트워크의 고속 처리 방법 및 그 방법을 이용한 장치
CN111739005B (zh) 图像检测方法、装置、电子设备及存储介质
CN113920307A (zh) 模型的训练方法、装置、设备、存储介质及图像检测方法
US20220129740A1 (en) Convolutional neural networks with soft kernel selection
US20210374439A1 (en) Obstacle detection method and device, apparatus, and storage medium
CN110068824B (zh) 一种传感器位姿确定方法和装置
CN109064434B (zh) 图像增强的方法、装置、存储介质及计算机设备
US20240078284A1 (en) Two-way descriptor matching on deep learning accelerator
CN115388906B (zh) 位姿的确定方法、装置、电子设备和存储介质
CN110633717A (zh) 一种目标检测模型的训练方法和装置
US20220044109A1 (en) Quantization-aware training of quantized neural networks
CN110705696A (zh) 神经网络的量化与定点化融合方法及装置
CN115170815A (zh) 视觉任务处理及模型训练的方法、装置、介质
CN116030206A (zh) 地图生成方法、训练方法、装置、电子设备以及存储介质
CN113838134B (zh) 图像关键点检测方法、装置、终端和存储介质
CN114387197A (zh) 一种双目图像处理方法、装置、设备和存储介质
CN112966592A (zh) 手部关键点检测方法、装置、设备和介质
CN117351299A (zh) 图像生成及模型训练方法、装置、设备和存储介质
CN115019150B (zh) 目标检测定点模型建立方法、装置及可读存储介质
KR102358372B1 (ko) 영상의 스테레오 정합 방법 및 장치

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

Country of ref document: EP

Kind code of ref document: A1

ENP Entry into the national phase

Ref document number: 2021533274

Country of ref document: JP

Kind code of ref document: A

ENP Entry into the national phase

Ref document number: 20217018149

Country of ref document: KR

Kind code of ref document: A

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 01.10.2021)

122 Ep: pct application non-entry in european phase

Ref document number: 19904074

Country of ref document: EP

Kind code of ref document: A1