Method and apparatus for reducing quantization latency
By determining the data type and size ratio in the neural network, and using scaling factors to scale parameters for quantization processing, the problem of long quantization waiting time is solved and processing efficiency is improved.
Patent Information
- Application Number
- CN202180090990.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-01-22
- Publication Date
- 2024-09-13
- Estimated Expiration
- 2041-01-22
AI Technical Summary
When the existing technology quantifies the data processed by the neural network, there is a long waiting time, which affects the processing efficiency.
By determining the data type of the neural network layer and its size ratio, scaling parameters using scaling factors, and quantizing the neural network, the quantization wait time is reduced.
Significantly reduce or eliminate the waiting time in quantization preprocessing, improving the efficiency of neural network processing.
Smart Images

Figure CN116830578B
Abstract
Description
Technical Field
[0001] The present disclosure relates to reducing quantization latency for data processed by a neural network. Some aspects of the present disclosure relate to incorporating quantization processing into a neural network implemented by a hardware accelerator.
[0002] background
[0003] Many devices and systems allow capturing a scene by generating an image (or frame) and / or video data (including multiple frames) of the scene. For example, a camera or a computing device including a camera (e.g., a mobile device (such as a mobile phone or smart phone) including one or more cameras) can capture a sequence of frames of a scene. The image and / or video data can be captured and processed by such devices and systems (e.g., mobile devices, IP cameras, etc.) and can be output for consumption (e.g., displayed on the device and / or other devices). In some cases, the image and / or video data can be captured by such devices and systems and output for processing and / or consumption by other devices.
[0004] Machine learning models (such as neural networks) can be used to perform high-quality image processing operations (as well as other operations). In some cases, hardware accelerators (e.g., digital signal processors (DSPs), neural processing units (NPUs), etc.) can be used to reduce the time and / or computing power involved in implementing machine learning models. Hardware accelerators can be configured to perform calculations using digital data having a specific data format (e.g., a specific integer data type). Data to be processed by a machine learning model implemented by a hardware accelerator must be converted (e.g., normalized and / or quantized) to have a corresponding data format. SUMMARY OF THE INVENTION
[0006] Systems and techniques for reducing quantization latency for data processed by a neural network are described herein. According to one illustrative example, a method for reducing quantization latency is provided, the method comprising: determining a first integer data type of data that at least one layer of a neural network is configured to process; determining a second integer data type of data received for processing by the neural network, the second integer data type being different from the first integer data type; determining a ratio between a first size of the first integer data type and a second size of the second integer data type; scaling parameters of the at least one layer of the neural network using a scaling factor corresponding to the ratio; quantizing the scaled parameters of the neural network; and inputting the received data to the neural network having the quantized and scaled parameters.
[0007] In another example, an apparatus for reducing quantization latency is provided, the apparatus comprising a memory and one or more processors coupled to the memory (e.g., implemented in a circuit system). The one or more processors are configured and capable of performing the following operations: determining a first integer data type of data that at least one layer of a neural network is configured to process; determining a second integer data type of data received for processing by the neural network, the second integer data type being different from the first integer data type; determining a ratio between a first size of the first integer data type and a second size of the second integer data type; scaling parameters of the at least one layer of the neural network using a scaling factor corresponding to the ratio; quantizing the scaled parameters of the neural network; and inputting the received data to the neural network having the quantized and scaled parameters.
[0008] In another example, a non-transitory computer-readable medium having instructions stored thereon is provided that, when executed by one or more processors, cause the one or more processors to: determine a first integer data type for data that at least one layer of a neural network is configured to process; determine a second integer data type for data received for processing by the neural network, the second integer data type being different from the first integer data type; determine a ratio between a first size of the first integer data type and a second size of the second integer data type; scale parameters of the at least one layer of the neural network using a scaling factor corresponding to the ratio; quantize the scaled parameters of the neural network; and input the received data to the neural network having the quantized and scaled parameters.
[0009] In another example, an apparatus for determining exposure of one or more frames is provided. The apparatus includes: means for determining a first integer data type of data that at least one layer of a neural network is configured to process; means for determining a second integer data type of data received for processing by the neural network, the second integer data type being different from the first integer data type; means for determining a ratio between a first size of the first integer data type and a second size of the second integer data type; means for scaling parameters of the at least one layer of the neural network using a scaling factor corresponding to the ratio; means for quantizing the scaled parameters of the neural network; and means for inputting the received data to the neural network having the quantized and scaled parameters.
[0010] In some aspects, the above methods, apparatus (devices) and computer-readable media further include: implementing the neural network using a hardware accelerator and data of the first integer data type.
[0011] In some aspects, the received data includes image data captured by a camera device. In some aspects, the neural network is trained to perform one or more image processing operations on the image data.
[0012] In some aspects, the above method, apparatus (device) and computer-readable medium further include: using training data of floating point data type to train the neural network. In some cases, training the neural network generates neural network parameters of the floating point data type.
[0013] In some aspects, the above-mentioned methods, apparatus (devices) and computer-readable media further include: converting the neural network parameters from the floating point data type to the first integer data type.
[0014] In some aspects, the at least one layer of the neural network corresponds to a single layer of the neural network. In some aspects, the scaling factor is a ratio between a first size of the first integer data type and a second size of the second integer data type.
[0015] In some aspects, the first size of the first integer data type corresponds to a first number of different integers that the first integer data type is configured to represent. In some aspects, the second size of the second integer data type corresponds to a second number of different integers that the second integer data type is configured to represent.
[0016] In some aspects, the at least one layer of the neural network comprises a convolutional layer or a deconvolutional layer. In some aspects, the at least one layer of the neural network comprises a scaling layer. In some aspects, the at least one layer of the neural network comprises a layer that performs element-wise operations.
[0017] In some aspects, the above methods, apparatus (devices) and computer-readable media further include: inputting the received data into the neural network without quantizing the received data.
[0018] In some aspects, the above methods, apparatus (devices) and computer-readable media further include: quantizing parameters of one or more additional layers of the neural network.
[0019] In some aspects, one or more of the apparatus described above is, is part of, and / or includes a mobile device (e.g., a mobile phone or so-called "smart phone" or other mobile device), a camera, an extended reality device (e.g., a virtual reality (VR) device, an augmented reality (AR) device, or a mixed reality (MR) device), a wearable device (e.g., a network-connected watch or other wearable device), a personal computer, a laptop computer, a server computer, a vehicle or a computing device or component of a vehicle, or other device. In some aspects, the apparatus includes one or more cameras for capturing one or more images. In some aspects, the apparatus further includes a display for displaying one or more images, notifications, and / or other displayable data. In some aspects, the apparatus described above may include one or more sensors (e.g., one or more inertial measurement units (IMUs), such as one or more gyroscopes, one or more accelerometers, any combination thereof, and / or other sensors).
[0020] This summary is neither intended to identify key features or essential features of the claimed subject matter nor is it intended to be used alone to determine the scope of the claimed subject matter. This subject matter should be understood by reference to appropriate portions of the entire specification of this patent, any or all drawings, and each claim.
[0021] The foregoing and other features and embodiments will become more apparent upon reference to the following description, claims and accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] Illustrative embodiments of the present application are described in detail below with reference to the following drawings:
[0024] Figure 1 is a block diagram illustrating an example architecture of an image capture and processing system according to some examples;
[0025] Figure 2A is a block diagram illustrating an example system for training a neural network using floating point data according to some examples;
[0026] Figure 2B is a block diagram illustrating an example system for quantizing a neural network according to some examples;
[0027] Figure 3 is a block diagram illustrating another example system for quantizing a neural network according to some examples;
[0028] Figure 4 is a flow chart illustrating an example of a process for reducing quantization latency according to some examples;
[0029] Figure 5is a diagram illustrating an example of a visual model for a neural network according to some examples;
[0030] Fig. 6A is a diagram illustrating an example of a model for a neural network including feedforward weights and recurrent weights according to some examples;
[0031] Figure 6B is a diagram illustrating an example of a model for a neural network including different connection types according to some examples;
[0032] Figure 7 is a diagram illustrating an example of a model for a convolutional neural network according to some examples;
[0033] Figure 8 is a diagram illustrating an example of a system for implementing certain aspects described herein.
[0034] Detailed description of embodiments
[0035] Provided below are certain aspects and embodiments of the present disclosure. Some of these aspects and embodiments can be applied independently and some of them can be applied in combination, which is obvious to those skilled in the art. In the following description, for the purpose of explanation, specific details are set forth in order to provide a thorough understanding of the embodiments of the present application. However, it is apparent that each embodiment can be implemented without these specific details. Each accompanying drawing and description are not intended to be restrictive.
[0036] The following description provides only exemplary embodiments and is not intended to limit the scope, applicability or configuration of the present disclosure. Instead, the following description of the exemplary embodiments will provide those skilled in the art with an enabling description for implementing the exemplary embodiments. It should be understood that various changes may be made to the functions and arrangements of the elements without departing from the spirit and scope of the present application as set forth in the appended claims.
[0037] Machine learning models (such as neural networks) can perform various image processing operations, natural language processing operations, and other operations. In some cases, hardware accelerators (e.g., digital signal processors (DSPs), neural processing units (NPUs), etc.) can be used to reduce the time and / or computing power involved in implementing machine learning models. Hardware accelerators can be configured to perform calculations using digital data of specific integer data types (e.g., INT12, INT16, etc.). In some cases, the raw data to be processed by the hardware accelerator may not have a corresponding data type. For example, a camera system may generate image frames with INT10 image data, while a hardware accelerator may be configured to process INT16 data. The raw input data must be converted into an appropriate data format before being processed by the hardware accelerator, which may traditionally involve high-latency normalization and / or quantization preprocessing.
[0038] The present disclosure describes systems, apparatuses (devices), methods, and computer-readable media (collectively, "systems and techniques") for reducing latency in quantization preprocessing. These systems and techniques can provide a neural network with the ability to efficiently quantize input data within one or more layers of the neural network. For example, data of one integer data type can be converted to another integer data type by scaling the data based on a ratio between the sizes (e.g., integer value ranges) of the respective integer data types. The disclosed systems and techniques can incorporate any necessary quantization preprocessing into the neural network by appropriately scaling the parameters of a neural network layer (e.g., multiplying the parameter value by the ratio). In this way, input data can be passed directly to the neural network during inference, and quantization preprocessing can be eliminated or significantly reduced.
[0039] Further details regarding reducing quantization latency are provided herein with respect to the various figures. Figure 1 1 is a block diagram illustrating the architecture of image capture and processing system 100. Image capture and processing system 100 includes various components used to capture and process an image of a scene (e.g., an image of scene 110). Image capture and processing system 100 can capture individual images (or photographs) and / or can capture a video including multiple images (or video frames) in a particular sequence. Lens 115 of system 100 faces scene 110 and receives light from scene 110. Lens 115 bends the light toward image sensor 130. Light received by lens 115 passes through an aperture controlled by one or more control mechanisms 120 and is received by image sensor 130.
[0040] The one or more control mechanisms 120 may control exposure, focus, and / or zoom based on information from the image sensor 130 and / or based on information from the image processor 150. The one or more control mechanisms 120 may include multiple mechanisms and components; for example, the control mechanisms 120 may include one or more exposure control mechanisms 125A, one or more focus control mechanisms 125B, and / or one or more zoom control mechanisms 125C. The one or more control mechanisms 120 may also include additional control mechanisms other than those illustrated, such as control mechanisms that control analog gain, flash, HDR, depth of field, and / or other image capture attributes.
[0041] The exposure control mechanism 125B of the control mechanism 120 can obtain the exposure setting. In some examples, the focus control mechanism 125B stores the focus setting in a memory register. Based on the focus setting, the focus control mechanism 125B can adjust the position of the lens 115 relative to the position of the image sensor 130. For example, based on the focus setting, the focus control mechanism 125B can move the lens 115 closer to the image sensor 130 or farther away from the image sensor 130 by actuating a motor or a servo, thereby adjusting the focus. In some cases, additional lenses may be included in the device 105A, such as one or more microlenses on each photodiode of the image sensor 130, each microlens bending the light received from the lens 115 toward the corresponding photodiode before it reaches the photodiode. The focus setting may be determined by contrast detection autofocus (CDAF), phase detection autofocus (PDAF), or some combination thereof. The focus setting may be determined using the control mechanism 120, the image sensor 130, and / or the image processor 150. The focus setting may be referred to as an image capture setting and / or an image processing setting.
[0042] The exposure control mechanism 125A of the control mechanism 120 can obtain an exposure setting. In some cases, the exposure control mechanism 125A stores the exposure setting in a memory register. Based on the exposure setting, the exposure control mechanism 125A can control the size of the aperture (e.g., aperture size or f / stop (f / stop)), the duration of the aperture opening (e.g., exposure time or shutter speed), the sensitivity of the image sensor 130 (e.g., ISO speed or film speed), the analog gain applied by the image sensor 130, or any combination thereof. The exposure setting can be referred to as an image capture setting and / or an image processing setting.
[0043] A zoom control mechanism 125C of the control mechanism 120 may obtain a zoom setting. In some examples, the zoom control mechanism 125C stores the zoom setting in a memory register. Based on the zoom setting, the zoom control mechanism 125C may control the focal length of a lens element assembly (lens assembly) including the lens 115 and one or more additional lenses. For example, the zoom control mechanism 125C may control the focal length of the lens assembly by actuating one or more motors or servos to move one or more lenses relative to each other. The zoom setting may be referred to as an image capture setting and / or an image processing setting. In some examples, the lens assembly may include a parfocal zoom lens or a variable focal length zoom lens. In some examples, the lens assembly may include a focusing lens (which may be lens 115 in some cases) that first receives light from the scene 110, wherein the light then passes through an afocal zoom system between the focusing lens (e.g., lens 115) and the image sensor 130 before the light reaches the image sensor 130. The afocal zoom system may, in some cases, include two positive (e.g., converging, convex) lenses of equal or similar focal lengths (e.g., within a threshold difference), with a negative (e.g., diverging, concave) lens between them. In some cases, the zoom control mechanism 125C moves one or more of the lenses in the afocal zoom system, such as one or both of the negative lens and the positive lens.
[0044] The image sensor 130 includes one or more arrays of photodiodes or other photosensitive elements. Each photodiode measures the amount of light that ultimately corresponds to a particular pixel in the image generated by the image sensor 130. In some cases, different photodiodes may be covered by different color filters and may therefore measure light that matches the color of the filter covering the photodiode. For example, a Bayer color filter includes a red filter, a blue filter, and a green filter, where each pixel of an image is generated based on red light data from at least one photodiode covered in the red filter, blue light data from at least one photodiode covered in the blue filter, and green light data from at least one photodiode covered in the green filter. Other types of color filters may use yellow, magenta, and / or cyan (also known as "emerald") color filters instead of or in addition to red, blue, and / or green color filters. Some image sensors may lack color filters entirely and may use different photodiodes (in some cases vertically stacked) throughout the pixel array. Different photodiodes throughout the pixel array may have different spectral sensitivity curves, thereby responding to different wavelengths of light without segmentation here. Monochrome image sensors may also lack color filters and, therefore, lack color depth.
[0045] In some cases, the image sensor 130 may alternatively or additionally include an opaque and / or reflective mask that blocks light from reaching certain photodiodes or portions of certain photodiodes at certain times and / or from certain angles, which may be used for phase detection autofocus (PDAF). The image sensor 130 may also include an analog gain amplifier to amplify the analog signal output by the photodiode and / or an analog-to-digital converter (ADC) to convert the analog signal output of the photodiode (and / or the analog signal amplified by the analog gain amplifier) into a digital signal. In some cases, certain components or functions discussed with respect to one or more control mechanisms 120 may alternatively or additionally be included in the image sensor 130. The image sensor 130 may be a charge coupled device (CCD) sensor, an electron multiplying CCD (EMCCD) sensor, an active pixel sensor (APS), a complementary metal oxide semiconductor (CMOS), an N-type metal oxide semiconductor (NMOS), a hybrid CCD / CMOS sensor (e.g., sCMOS), or some other combination thereof.
[0046] The image processor 150 may include one or more processors, such as one or more image signal processors (ISPs) (including ISP 154), one or more host processors (including host processor 152), and / or one or more other types of processors 810. In an illustrative example, the image processor 150 may represent and / or include a hardware accelerator (e.g., NPU) configured to implement a neural network. The host processor 152 may be a digital signal processor (DSP) and / or other type of processor. In some implementations, the image processor 150 is a single integrated circuit or chip (e.g., referred to as a system on a chip or SoC) that includes the host processor 152 and the ISP 154. In some cases, the chip may also include one or more input / output ports (e.g., input / output (I / O) port 156), a central processing unit (CPU), a graphics processing unit (GPU), a broadband modem (e.g., 3G, 4G or LTE, 5G, etc.), memory, connectivity components (e.g., Bluetooth TM, Global Positioning System (GPS), etc.), any combination thereof, and / or other components. The I / O port 156 may include any suitable input / output port or interface according to one or more protocols or specifications, such as an Inter-Integrated Circuit 2 (I2C) interface, an Inter-Integrated Circuit 3 (I3C) interface, a Serial Peripheral Interface (SPI) interface, a serial general purpose input / output (GPIO) interface, a Mobile Industry Processor Interface (MIPI) (such as a MIPI CSI-2 physical (PHY) layer port or interface, an Advanced High-Performance Bus (AHB) bus, any combination thereof, and / or other input / output ports. In an illustrative example, the host processor 152 may communicate with the image sensor 130 using an I2C port, and the ISP 154 may communicate with the image sensor 130 using a MIPI port.
[0047] The image processor 150 may perform a number of tasks, such as quantizing input data (e.g., raw image data captured by the image sensor 130), demosaicing, color space conversion, image frame downsampling, pixel interpolation, automatic exposure (AE) control, automatic gain control (AGC), CDAF, PDAF, automatic white balance, merging image frames to form an HDR image, image recognition, object recognition, feature recognition, input reception, managing output, managing memory, or some combination thereof. The image processor 150 may store image frames and / or processed images in a random access memory (RAM) 140 / 1220, a read-only memory (ROM) 145 / 1225, a cache 1212, a memory unit 1215, another storage device 1230, or some combination thereof.
[0048] Various input / output (I / O) devices 160 may be connected to the image processor 150. The I / O devices 160 may include a display screen, a keyboard, a keypad, a touch screen, a touch pad, a touch-sensitive surface, a printer, any other output device 1235, any other input device 1245, or some combination thereof. In some cases, subtitles may be input into the image processing device 105B through a physical keyboard or keypad of the I / O device 160, or through a virtual keyboard or keypad of a touch screen of the I / O device 160. The I / O 160 may include one or more ports, jacks, or other connectors that enable a wired connection between the device 105B and one or more peripheral devices, through which the device 105B can receive data from the one or more peripheral devices and / or transmit data to the one or more peripheral devices. The I / O 160 may include one or more wireless transceivers that enable a wireless connection between the device 105B and one or more peripheral devices, through which the device 105B can receive data from the one or more peripheral devices and / or transmit data to the one or more peripheral devices. Peripheral devices may include any of the types of I / O devices 160 discussed previously, and may themselves be considered I / O devices 160 once they are coupled to a port, jack, wireless transceiver, or other wired and / or wireless connector.
[0049] In some cases, the image capture and processing system 100 may be a single device. In some cases, the image capture and processing system 100 may be two or more separate devices, including an image capture device 105A (e.g., a camera) and an image processing device 105B (e.g., a computing device coupled to the camera). In some implementations, the image capture device 105A and the image processing device 105B may be coupled together, for example, via one or more wires, cables, or other electrical connectors, and / or wirelessly coupled together via one or more wireless transceivers. In some implementations, the image capture device 105A and the image processing device 105B may be disconnected from each other.
[0050] like Figure 1 As shown in the figure, the vertical dashed line will Figure 1 The image capture and processing system 100 is divided into two parts, respectively representing an image capture device 105A and an image processing device 105B. The image capture device 105A includes a lens 115, a control mechanism 120, and an image sensor 130. The image processing device 105B includes an image processor 150 (including an ISP 154 and a host processor 152), a RAM 140, a ROM 145, and an I / O 160. In some cases, some components illustrated in the image capture device 105A (such as the ISP 154 and / or the host processor 152) may be included in the image capture device 105A.
[0051] The image capture and processing system 100 may include an electronic device, such as a mobile or fixed telephone handset (e.g., a smart phone, a cellular phone, etc.), a desktop computer, a laptop or notebook computer, a tablet computer, a set-top box, a television, a camera, a display device, a digital media player, a video game console, a video streaming device, an Internet Protocol (IP) camera, or any other suitable electronic device. In some examples, the image capture and processing system 100 may include one or more wireless transceivers for wireless communication, such as cellular network communication, 802.11 wi-fi communication, wireless local area network (WLAN) communication, or some combination thereof. In some implementations, the image capture device 105A and the image processing device 105B may be different devices. For example, the image capture device 105A may include a camera device, and the image processing device 105B may include a computing device, such as a mobile handset, a desktop computer, or other computing device.
[0052] Although the image capture and processing system 100 is shown as including certain components, one of ordinary skill in the art will appreciate that the image capture and processing system 100 may include more than Figure 1 . The components of the image capture and processing system 100 may include software, hardware, or one or more combinations of software and hardware. For example, in some implementations, the components of the image capture and processing system 100 may include and / or may be implemented using electronic circuits or other electronic hardware (which may include one or more programmable electronic circuits (e.g., microprocessors, GPUs, DSPs, CPUs, and / or other suitable electronic circuits)), and / or may include and / or may be implemented using computer software, firmware, or any combination thereof to perform the various operations described herein. The software and / or firmware may include one or more instructions stored on a computer-readable storage medium and executable by one or more processors of an electronic device that implements the image capture and processing system 100.
[0053] The host processor 152 may configure the image sensor 130 with new parameter settings (e.g., via an external control interface such as I2C, I3C, SPI, GPIO, and / or other interfaces). In one illustrative example, the host processor 152 may update the exposure settings used by the image sensor 130 based on the internal processing results of the exposure control algorithm from past image frames. The host processor 152 may also dynamically configure the parameter settings of the internal pipeline or modules of the ISP 154 to match the settings of one or more input image frames from the image sensor 130 so that the image data is properly processed by the ISP 154. The processing (or pipeline) blocks or modules of the ISP 154 may include modules for lens / sensor noise correction, demosaicing, color conversion, correction or enhancement / suppression of image properties, denoising filters, sharpening filters, etc. The settings of different modules of the ISP 154 may be configured by the host processor 152. Each module may include a large number of tunable parameter settings. In addition, since different modules may affect similar aspects of the image, the modules may be interdependent. For example, denoising and texture correction or enhancement may both affect high frequency aspects of an image.As a result, a large number of parameters are used by the ISP to generate the final image from the captured raw image.
[0054] Figure 2A is a block diagram illustrating an example of a model training system 200(A). In some examples, the model training system 200(A) may be composed of Figure 1 . For example, the model training system 200(A) may be implemented by the image capture and processing system 100 illustrated in . For example, the model training system 200(A) may be implemented by the image processor 150, the image sensor 130, and / or any additional components of the image capture and processing system 100. In other examples, the model training system 200(A) may be implemented by a server or database configured to train a neural network model. The model training system 200(A) may be implemented by any additional or alternative computing device or system.
[0055] In some cases, the model training system 200(A) may generate a trained model 210. The trained model 210 may correspond to and / or include various types of machine learning models that are trained to perform one or more operations. In an illustrative example, the trained model 210 may be trained to perform one or more image processing operations on image data captured by a camera system (e.g., the image sensor 130 of the image capture and processing system 100). The trained model 210 may be trained to perform any other type of operation (e.g., natural language processing operations, recommendation operations, etc.). Furthermore, in one example, the trained model 210 may be a deep neural network, such as a convolutional neural network (CNN). Illustrative examples of deep neural networks are described below with reference to Figure 5 , Fig. 6A, Figure 6B and Figure 7 Additional examples of trained models 210 include, but are not limited to, time delay neural networks (TDNNs), deep feedforward neural networks (DFFNNs), recurrent neural networks (RNNs), autoencoders (AEs), variational AEs (VAEs), denoising AEs (DAEs), sparse AEs (SAEs), Markov chains (MCs), perceptrons, or some combination thereof.
[0056] The trained model 210 can be trained using training data 202, which represents any data set or set corresponding to the type and / or format of input data to be processed by the trained model 210 during inference. For example, if the trained model 210 is being trained to perform an image processing operation on an image frame, the training data 202 may include a large number (e.g., hundreds, thousands, or millions) of image frames having features, formats, and / or other characteristics related to the image processing operation. In an illustrative example, the training data 202 may include image frames captured by a mobile device. The image data of these image frames may have a specific data format. For example, a camera system of a mobile device may be configured to output raw image data having an INT8 data type, an INT10 data type, an INT12 data type, an INT16 data type, or any other integer data type. In some cases, it may be beneficial to convert training data of an integer type into data having a floating point data type. For example, training the trained model 210 using floating point data may improve the performance and / or accuracy of the trained model 210. Therefore, the model training system 200 (A) may include a normalization engine 204 that normalizes the integer type data of the training data 202 to floating point data. In the illustrative example, the normalization engine 204 may convert the integer type data having a size range (also referred to as an integer value range) of [0.0-1.0] to float32 data. The normalization engine 204 may use any suitable type of normalization function to convert the integer type data to any suitable type of floating point data. Figure 2A As shown in , normalization engine 204 may output normalized training data 206 .
[0057] In some cases, the training engine 208 of the model training system 200 (A) can use the normalized training data 206 to generate the trained model 210. For example, the training engine 208 can use the normalized training data 206 to iteratively adjust the parameters (e.g., weights, biases, etc.) of one or more layers and / or channels of the deep neural network. Once the deep neural network is fully trained, the training engine 208 can output the trained model 210. For example, the training engine 208 can output a model file indicating the values of the parameters (and their corresponding layers and / or channels) of the trained model 210. The trained model 210 can include any number of convolutional layers, deconvolutional layers, scaling layers, bias layers, fully connected layers, and / or other types of layers or combinations thereof. Because the training engine 208 uses floating point data to generate the trained model 210, the parameters within the model file are also floating point data.
[0058] In some examples, the trained model 210 can be implemented (during inference) using a hardware accelerator. As used herein, a "hardware accelerator" may include a portion of computer hardware designed to perform one or more specific tasks or operations. For example, a hardware accelerator may include and / or correspond to dedicated hardware. In an illustrative example, the trained model 210 may be implemented by a neural processing unit (NPU) or other microprocessors designed to accelerate the implementation of a machine learning algorithm. An example of an NPU that can implement the trained model 210 is a hexagonal tensor accelerator (HTA). Additional examples of hardware accelerators that can implement the trained model 210 include, but are not limited to, digital signal processors (DSPs), field programmable arrays (FPGAs), application specific integrated circuits (ASICs), visual processing units (VPUs), physical neural networks (PNNs), tensor processing units (TPUs), systems on chip (SoCs), and other hardware accelerators. However, the trained model 210 does not need to be implemented by a hardware accelerator or other dedicated hardware. For example, the trained model 210 may be implemented by a central processing unit (CPU) and / or any suitable general computing architecture.
[0059] In one example, the hardware accelerator implementing the trained model 210 may be a fixed-point accelerator. As used herein, a "fixed-point accelerator" may include a hardware accelerator designed to perform calculations using digital data of a specific integer data type. For example, a fixed-point accelerator may be configured and / or optimized to support INT8 data, INT10 data, INT12 data, INT16 data, or another integer data type. In some cases, a fixed-point accelerator may provide sufficiently high performance with low latency and / or low power. For example, a fixed-point accelerator (or other hardware accelerator) may be able to implement a neural network on a computing device (e.g., a mobile device) with relatively low processing power. However, a fixed-point accelerator may be incompatible with floating-point data (or integer type data that does not belong to a specific integer data type for which the fixed-point accelerator is configured). Therefore, in order to use the appropriate and / or optimal implementation of a machine learning model of a fixed-point accelerator, it may be necessary to quantize the machine learning model and / or input data. As used herein, "quantization" may refer to the process of converting floating-point data into integer type data.
[0060] Figure 2B is a block diagram of an example model implementation system 200(B) for quantizing a trained machine learning model and / or input data. In some examples, the model implementation system 200(B) may be composed of Figure 1 The model implementation system 200(B) may be implemented by the image capture and processing system 100 illustrated in FIG. For example, the model implementation system 200(B) may be implemented by the image processor 150 and / or the image sensor 130 of the image capture and processing system 100. The model implementation system 200(B) may be implemented by any additional or alternative computing device or system.
[0061] The model implementation system 200(B) represents an example of an architecture for performing conventional quantization preprocessing. For example, the model implementation system 200(B) may include a model quantization engine 222 that quantizes the floating point parameters of the trained model 210 (producing a fixed integer model 224). The model quantization engine 222 may implement any suitable type of quantization process. In an illustrative example, the quantization process may be performed using the following formula:
[0062]
[0063] as well as
[0064]
[0065] In the above formula, f is floating point data, q is quantized data, and f max and f min are the maximum and minimum values that can be represented by the floating-point data type, respectively. max and qmin are the maximum and minimum values that can be represented by the integer data type of the quantized data, respectively, and round is a rounding function. The rounding function can be a floor function, an upper limit function, a fixed function, or any suitable rounding function. In some cases, the fixed integer model 224 can correspond to a version of the trained model 210 that is configured to process input data having a specific integer data type (e.g., an integer data type associated with a specific hardware accelerator).
[0066] In some cases, the model implementation system 200 (B) may receive input data whose data type corresponds to the data type of the fixed integer model 224. For example, the model implementation system 200 (B) may receive INT10 input data, and the fixed integer model 224 may be configured to process the INT10 data. In these cases, the model implementation system 200 (B) may directly provide the input data to the fixed integer model 224 (producing the model output 226). However, in many scenarios, the received input data may have different data types. In an illustrative example, the model implementation system 200 may be implemented on a mobile device including a camera system and a fixed-point accelerator. In this example, the camera system may generate image frames having an INT10 data type, and the fixed-point accelerator may be configured to process image frames having an INT16 data type. Inputting INT10 data into the fixed-point accelerator may result in incorrect and / or unusable output. Therefore, the model implementation system 200 (B) may include a quantization system 212 that converts the input data into an appropriate integer data type. The conversion process may represent a quantization preprocessing that prepares the input data for inference. As shown, the quantization system 212 may include a normalization engine 228 (e.g., similar to the normalization engine 204 of the model training system 200(A)). The normalization engine 228 may receive input data 214 (corresponding to a first type of integer type data). The normalization engine 204 may perform one or more normalization processes on the input data 214, thereby producing normalized input data 216 (corresponding to floating point data). The data quantization engine 218 may then quantize the normalized input data 216 to generate quantized input data 220 (corresponding to a second type of integer type data). The data quantization engine 218 may implement any suitable type of quantization process (such as the quantization process implemented by the model quantization engine 222). The quantization system 212 may input the quantized input data 220 into a fixed integer model 224, thereby generating a model output 226.
[0067] In some cases, quantization preprocessing corresponding to the quantization system 212 can be implemented on the same computing device that generates the input data 214 and / or implements the fixed integer model 224. For example, the computing device can be a mobile device that includes a camera system for capturing image frames (e.g., input data 214) and a hardware accelerator for implementing the fixed integer model 224. In this example, the computing device can receive the fixed integer model 224 offline (e.g., a backend server or system configured to generate the fixed integer model can export the fixed integer model 224 to the computing device). In some examples, the computing device can be configured to implement quantization preprocessing in response to generating input data (e.g., image frames) to be processed by the fixed integer model 224, which is generated offline and consumes only fixed input data of the configured type. This quantization preprocessing can significantly increase the total amount of time involved in processing image frames using the fixed integer model 224. For example, quantization preprocessing for high-resolution image data can correspond to approximately 20% of the neural network processing time. In an illustrative example, preprocessing of 3000x4000x4 pixel input data using a CPU may take approximately 400 milliseconds, and inference of that input data using a fixed-point accelerator may take approximately 2 seconds. Thus, quantization preprocessing introduces undesirable latency in many image processing operations.
[0068] The disclosed systems and techniques can significantly reduce (or even eliminate) quantization preprocessing. For example, converting data of a first integer data type to a second integer data type can be accomplished by multiplying the data by a scalar value (referred to herein as a "scaling factor"). The scaling factor can correspond to a ratio between the size of the first integer data type and the size of the second integer data type. The size of the integer data type can correspond to the number of different integers that the integer data type can represent and / or is configured to represent. For example, the size range of the INT10 data type is 2 10 (for example, 1024), the size range of INT16 data type is 2 16 (e.g., 65536). The value represented by the INT10 data structure can be obtained by multiplying the value by 64 (e.g., or 2 6 ) to convert to an INT16 data structure.
[0069] Figure 3 3 is a block diagram of an example model implementation system 300 configured to reduce quantization latency based on the scaling factor techniques described above. For example, the model implementation system 300 may include a quantization system 312 that incorporates a scaling factor (e.g., scaling factor 304) into a neural network (e.g., Figure 2A and Figure 2B304). In this example, the quantization system 312 may include a scale factor engine 302 that determines a scale factor 304. The scale factor 304 may correspond to a scale factor suitable for converting data of a first integer data type to a second integer data type. For example, the scale factor engine 302 may determine a scale factor suitable for converting raw image data captured by a particular camera system to an integer data type that can be processed by a particular hardware accelerator. In some cases, the scale factor engine 302 may determine the scale factor 304 based on knowledge of the integer data type associated with the camera system and / or the hardware accelerator.
[0070] In some examples, the model scaling engine 306 of the quantization system 312 can scale (e.g., multiply) parameters of a layer of the trained model 210 based on the scaling factor 304. For example, the model scaling engine 306 can multiply each weight, bias, or other parameter of the layer by the scaling factor 304 (e.g., referred to as "broadcasting" the scaling factor 304 to the layer). In addition, if the layer includes multiple channels, the model scaling engine 306 can multiply the parameters of each channel by the scaling factor 304. In some cases, scaling the parameters of the layer by the scaling factor 304 can result in scaling the output of the layer by the scaling factor 304. In this manner, scaling the parameters can effectively convert the input data from a first integer data type to a second integer type. In an illustrative example, the model scaling engine 306 can implement a scaling factor of 64 within a layer of the trained model 210 to convert INT10 input data to INT16 input data.
[0071] In this example, the raw output of this layer is given by Given, where W is the value of parameter k, and X int16 is the value of the INT16 input data point. After implementing a scaling factor of 64, the output of this layer can be expressed as Given, where X int10 is the value of the INT10 input data point.
[0072] The model scaling engine 306 can scale parameters of various types of layers of the trained model 210. In an illustrative example, the model scaling engine 306 can scale parameters of a convolutional layer. In other examples, the model scaling engine 306 can scale parameters of a deconvolutional layer, a scaling layer, a layer that performs an element-level operation (e.g., an element-level bit shift operation and / or an element-level multiplication operation), and / or any suitable type of layer. In addition, the model scaling engine 306 can scale parameters of layers in any position within the trained model 210. For example, the model scaling engine 306 can scale parameters of a first layer, a second layer, a third layer, or any suitable layer. In addition, in some examples, the model scaling engine 306 can scale parameters of multiple layers. For example, the model scaling engine 306 can scale parameters of multiple layers by a scaling factor corresponding to a divisor of the scaling factor 304. In an illustrative example, if the scaling factor 304 is 32, the model scaling engine 306 can multiply the parameters of one layer by 2 and multiply the parameters of another layer by 16 (resulting in a total scaling factor of 32).
[0073] like Figure 3 As shown in , the model scaling engine 306 may output a scaled model 316, which includes one or more layers whose parameters have been scaled according to the scaling factor 304. As mentioned above, the parameters of the trained model 210 are floating point values. Therefore, the parameters of the scaled model 316 are also floating point values. In order to enable the hardware accelerator to implement the scaled model 316, the quantization system 312 may include a model quantization engine 322 that quantizes the scaled model 316 (thereby generating a fixed integer model 324). For example, the model quantization engine 322 may quantize each parameter of the scaled model 316. The model quantization engine 322 may use any suitable quantization process (such as the quantization process used by the model quantization engine 222 of the model implementation system 200 (B)). Once the fixed integer model 324 is generated, the model implementation system 300 may provide the input data 314 to the fixed integer model 324, thereby generating a model output 326.
[0074] In some cases, all or a portion of quantization system 312 may be implemented offline. For example, quantization system 312 may be implemented by a server or computing device that is remote from the computing device that implements fixed integer model 324 during inference. In an illustrative example, quantization system 312 may generate fixed integer model 324 on a backend server and then export fixed integer model 324 to one or more computing devices (e.g., mobile devices). The computing device that receives fixed integer model 324 may directly provide input data to fixed integer model 324. For example, Figure 3 As shown in FIG. , input data 314 may be passed directly to fixed integer model 324 (eg, without performing Figure 2BBecause the fixed integer model 324 has been adjusted based on the scaling factor 304, the integer data type of the input data 314 does not need to be normalized, quantized, or otherwise adjusted before being processed by the hardware accelerator. Therefore, the model implementation system 300 can eliminate (or nearly eliminate) the latency involved in the quantization preprocessing.
[0075] Figure 4 is a flow chart illustrating an example process 400 for reducing quantization latency using the systems and techniques described herein. At block 402, the process 400 includes determining a first integer data type of data that at least one layer of a neural network is configured to process. In some cases, the process 400 may implement the neural network using a hardware accelerator and data of the first integer data type. In some examples, the at least one layer of the neural network corresponds to a single layer of the neural network. In some examples, the at least one layer of the neural network includes a convolutional layer or a deconvolutional layer. In some examples, the at least one layer of the neural network includes a scaling layer. In some examples, the at least one layer of the neural network includes a layer that performs element-wise operations.
[0076] At block 404, process 400 includes determining a second integer data type for data received for processing by the neural network. The second integer data type is different from the first integer data type. In some cases, the received data (having the second integer data type) includes image data captured by a camera device. In some aspects, the neural network is trained to perform one or more image processing operations on the image data. In one illustrative example, as described above with reference to Figure 3 As described, the second integer data type may include raw image data captured by a particular camera system, and the first integer data type may be a data type that may be processed by a particular hardware accelerator.
[0077] At block 406, process 400 includes determining a ratio between a first size of the first integer data type and a second size of the second integer data type. In some cases, the first size corresponds to a size range (or integer value range) of the first integer data type, and the second size corresponds to a size range (or integer value range) of the second integer data type. For example, the first size of the first integer data type may correspond to a first number of different integers that the first integer data type is configured to represent, and the second size of the second integer data type may correspond to a second number of different integers that the second integer data type is configured to represent.
[0078] At block 408, process 400 includes scaling the parameters of the at least one layer of the neural network using a scaling factor corresponding to the ratio. For example, as mentioned above, the scaling factor (e.g., a scalar value) can correspond to a ratio between a first size of the first integer data type and a second size of the second integer data type. In one illustrative example, the size range of the INT10 data type is 2 10 (for example, 1024), and the size range of the INT16 data type is 2 16 (e.g., 65536). The value represented by the INT10 data structure can be obtained by multiplying the value by 64 (e.g., or 2 6 ) to an INT16 data structure. In some examples, the ratio and scaling factor may be obtained by Figure 3 The scaling factor engine 302 determines.
[0079] At block 410, process 400 includes quantizing the scaled parameters of the neural network. In some examples, the scaled parameters may be quantized by Figure 3 The scaled parameters may be quantized by the model quantization engine 322. For example, the model quantization engine 322 may quantize the scaled model 316 to produce a fixed integer model 324. Any suitable quantization process may be used.
[0080] At block 412, process 400 includes inputting the received data to a neural network having quantized and scaled parameters. For example, once fixed integer model 324 is generated, model implementation system 300 can provide input data 314 to fixed integer model 324, resulting in model output 326. In some cases, process 400 includes inputting the received data to the neural network without quantizing the received data. In some cases, process 400 includes quantizing parameters of one or more additional layers of the neural network.
[0081] In some cases, process 400 includes training the neural network using training data of a floating point data type. In some examples, training the neural network generates neural network parameters of a floating point data type. In some aspects, process 400 includes converting the neural network parameters from a floating point data type to a first integer data type.
[0082] Figure 5 is a diagram illustrating an example of a visual model 500 for a neural network. In some cases, the model 500 may correspond to Figure 2A , Figure 2B and Figure 3500 . In this example, the model 500 includes an input layer 504, an intermediate layer, which is generally referred to as a hidden layer 506, and an output layer 508. Each layer includes a certain number of nodes 502. In this example, each node 502 of the input layer 504 is connected to each node 502 of the hidden layer 506. These connections (which would be referred to as synapses in a brain model) are referred to as weights 550. The input layer 504 can receive input and can propagate the input to the hidden layer 506. Also in this example, each node 502 of the hidden layer 506 has a connection or weight 550 with each node 502 of the output layer 508. In some cases, a neural network implementation may include multiple hidden layers. The weighted sum calculated by the hidden layer 506 (or multiple hidden layers) is propagated to the output layer 508, which can present the final output for different purposes (e.g., providing classification results, detecting objects, tracking objects, and / or other suitable purposes). The outputs (weighted sums) of the different nodes 502 may be referred to as activations (also referred to as activation data), consistent with the brain model.
[0083] Examples of computations that may occur at each layer in the example vision model 500 are as follows:
[0084]
[0085] In the above formula, Wij is the weight, xi is the input activation, yj is the output activation, f() is the nonlinear function, and b is the bias term. Using the input image as an example, each connection between a node and the receptive field of the node can learn the weight Wij, and in some cases, learn the overall bias b so that each node learns to analyze its specific local receptive field in the input image. Each node of the hidden layer can have the same weights and biases (called shared weights and shared biases). Various nonlinear functions can be used to achieve different purposes.
[0086] Model 500 may be referred to as a directed weighted graph. In a directed graph, each connection to or from a node indicates a direction (e.g., into a node or away from a node). In a weighted graph, each connection may have a weight. Tools for developing neural networks may visualize the neural network as a directed weighted graph for ease of understanding and debugging. In some cases, these tools may also be used to train the neural network and output the trained weight values. Executing the neural network is to perform calculations on the input data using the weights.
[0087] A neural network with more than three layers (e.g., more than one hidden layer) is sometimes referred to as a deep neural network. A deep neural network can have, for example, five to more than one thousand layers. A neural network with many layers is able to learn high-level tasks with more complexity and abstraction than a shallower network. As an example, a deep neural network can be taught to recognize objects or scenes in an image. In this example, the pixels of an image can be fed to the input layer of a deep neural network, and the output of the first layer can indicate the presence of low-level features in the image, such as lines and edges. In subsequent layers, these features can be combined to measure the possible presence of higher-level features: lines can be combined into shapes, which can be further combined into shape sets. Given such information, a deep neural network can output the probability that a high-level feature represents a specific object or scene. For example, a deep neural network can output whether an image contains a cat or not.
[0088] The learning phase of a neural network is called training the neural network. During training, the neural network is taught to perform a task. As it learns the task, the values of the weights (and possibly biases) are determined. The underlying program for the neural network (e.g., the organization of nodes into layers, the connections between nodes in each layer, and the calculations performed by each node) does not need to change during training. Once trained, the neural network can perform the task by calculating results using the weight values (and in some cases, bias values) determined during training. For example, a neural network may output the probability that an image contains a particular object, the probability that an audio sequence contains a particular word, a bounding box around an object in an image, or a suggested action that should be taken. Running a program for a neural network is called inference.
[0089] There are many ways that weights can be trained. One approach is called supervised learning. In supervised learning, all training samples are labeled so that inputting each training sample into the neural network will produce a known result. Another approach is called unsupervised learning, where the training samples are not labeled. In unsupervised learning, the training aims to find structure in the data or clusters in the data. Semi-supervised learning is between supervised and unsupervised learning. In semi-supervised learning, a subset of the training data is labeled. The unlabeled data can be used to define the cluster boundaries, and the labeled data can be used to label the clusters.
[0090] Different kinds of neural networks have been developed. The various examples of neural networks can be divided into two forms: feed-forward and recursive. Fig. 6A 6 is a diagram illustrating an example of a model 610 for a neural network including feedforward weights 612 between an input layer 604 and a hidden layer 606, and recurrent weights 614 at an output layer 608. In a feedforward neural network, the computation is a series of operations on the output of the previous layer, with the last layer generating the output of the neural network. Fig. 6A In the illustrated example, feedforward is illustrated by hidden layer 606, whose nodes 602 operate only on the outputs of nodes 602 in input layer 604. Feedforward neural networks have no memory, and the output for a given input may always be the same, regardless of any previous inputs given to the neural network. A multilayer perceptron (MLP) is a type of neural network with only feedforward weights.
[0091] In contrast, recurrent neural networks have internal memory that allows dependencies to affect the output. In a recurrent neural network, some intermediate operations may generate values that are stored internally and can be used as input to other operations in conjunction with the processing of subsequent input data. Fig. 6A In the example of , recursion is illustrated by output layer 608, where the outputs of nodes 602 of output layer 608 are connected back to the inputs of nodes 602 of output layer 608. These loop-back connections may be referred to as recursive weights 614. Long short-term memory (LSTM) is a commonly used recursive neural network variant.
[0092] Figure 6B 6 is a diagram illustrating an example of a model 620 for a neural network including different types of connections. In this example model 620, the input layer 604 and the hidden layer 606 are fully connected 622 layers. In a fully connected layer, all output activations are composed of weighted input activations (e.g., the outputs of all nodes 602 in the input layer 604 are connected to the inputs of all nodes 602 in the hidden layer 606). Fully connected layers can require a lot of storage and computation. A multilayer perceptron neural network is a type of fully connected neural network.
[0093] In some applications, some connections between activations can be removed, for example by setting the weights for these connections to zero, without affecting the accuracy of the output. The result is a sparsely connected 624 layer, such as Figure 6B 606 and the output layer 608. Pooling is another example of a method that can implement the sparse connection 624 layer. In pooling, the outputs of the node clusters can be combined, for example, by finding the maximum, minimum, mean, or median.
[0094] A class of neural networks called convolutional neural networks (CNNs) are particularly effective for image recognition and classification (e.g., facial expression recognition and / or classification). A convolutional neural network can learn, for example, the categories of an image and can output a statistical likelihood that an input image falls into one of the categories.
[0095] Figure 7is a diagram illustrating an example of a model 700 for a convolutional neural network. Model 700 illustrates operations that may be included in a convolutional neural network: convolution, activation, pooling (also known as subsampling), batch normalization, and output generation (e.g., fully connected layers). As an example, the convolutional neural network illustrated by model 700 is a classification network that provides output predictions 714 for different classes of objects (e.g., dogs, cats, boats, birds). Any given convolutional network includes at least one convolutional layer, and may have many convolutional layers. Additionally, each convolutional layer need not be followed by a pooling layer. In some examples, a pooling layer may appear after multiple convolutional layers, or may not appear at all. Figure 7 The illustrated example convolutional network classifies an input image 720 into one of four categories: dog, cat, boat, or bird. In the illustrated example, upon receiving an image of a boat as input, the example neural network outputs the highest probability (0.94) for "boat" among the output predictions 714.
[0096] To generate the illustrated output predictions 714, the example convolutional neural network performs a first convolution 702 with a rectified linear unit (ReLU), pooling 704, a second convolution 706 with a ReLU, additional pooling 708, and then classifies using two fully connected layers 710, 712. In the first convolution 702 operation with ReLU, the input image 720 is convolved to produce one or more output feature maps 722 (including activation data). The first pooling 704 operation produces additional feature maps 724, which are used as input feature maps for the second convolution and ReLU 706 operations. The second convolution 706 operation with ReLU produces a second set of output feature maps 726 with activation data. The additional pooling 708 step also produces feature maps 728, which are input into the first fully connected layer 710. The output of the first fully connected layer 710 is input into the second fully connected layer 712. The output of the second fully connected layer 712 is the output prediction 714. In convolutional neural networks, the terms “higher layers” and “higher-level layers” refer to layers that are further away from the input image (e.g., in the example model 700, the second fully connected 712 layer is the highest layer).
[0097] Figure 7 The example of is an example of a convolutional neural network. Other examples may include additional or fewer convolution operations, ReLU operations, pooling operations, and / or fully connected layers. Convolution, nonlinearity (ReLU), pooling or subsampling, and classification operations are explained in more detail below.
[0098] When performing image processing functions (e.g., image recognition, object detection, object classification, object tracking, or other suitable functions), convolutional neural networks can operate on numerical or digital representations of images. An image can be represented in a computer as a matrix of pixel values. For example, a video frame captured at 1080p includes a pixel array of 1920 pixels wide and 1080 pixels high. Certain components of an image can be called channels. For example, a color image has three color channels: red (R), green (G), and blue (B) or brightness (Y), red chrominance (Cr), and blue chrominance (Cb). In this example, the color image can be represented as three two-dimensional matrices, one for each color, where the horizontal and vertical axes indicate the location of the pixel in the image, and the value between 0 and 255 indicates the color intensity of the pixel. As another example, a grayscale image has only one channel and can therefore be represented as a single two-dimensional matrix of pixel values. In this example, the pixel values can also be between 0 and 255, where, for example, 0 indicates black and 255 indicates white. In these examples, the upper limit value of 255 assumes that the pixel is represented by an 8-bit value. In other examples, more bits (eg, 16, 32, or more bits) may be used to represent a pixel, and the pixel may therefore have a higher upper value.
[0099] like Figure 7As shown in , a convolutional network is a sequence of layers. Each layer of a convolutional neural network converts the activation data (also called activation) of one volume into the activation of another volume by a differentiable function. For example, each layer can accept an input 3D volume, and the input 3D volume can be converted into an output 3D volume by a differentiable function. Three types of layers that can be used to build a convolutional neural network architecture may include a convolutional layer, a pooling layer, and one or more fully connected layers. The network also includes an input layer, which can save the original pixel values of the image. For example, the example image can have a width of 32 pixels, a height of 32 pixels, and three color channels (e.g., R, G, and B color channels). Each node of the convolutional layer is connected to a node (pixel) area of the input image. This area is called a receptive field. In some cases, the convolutional layer can calculate the output of the nodes (also called neurons) connected to the local area in the input, and each node calculates the dot product between its weight and the small area they are connected to in the input volume. If 12 filters are used, such a calculation can result in a volume of [32x32x12]. The ReLu layer may apply an element-wise activation function, such as thresholding max(0,x) to zero, which will keep the size of the volume constant at [32x32x12]. The pooling layer may perform a downsampling operation along the spatial dimensions (width, height), resulting in a reduced data volume, such as a data volume of size [16x16x12]. The fully connected layer may compute class scores, resulting in a volume of size [1x1x4], where each of the four (4) numbers corresponds to a class score, such as among the four classes of dog, cat, boat, and bird. The CIFAR-10 network is an example of such a network and has ten object classes. By using such a neural network, the original image can be transformed layer by layer from the raw pixel values to the final class scores. Some layers contain parameters, while some layers may not. For example, convolutional layers and fully connected layers perform transformations that are functions of the activations in the input volume and also functions of the parameters (weights and biases) of the nodes, while ReLu layers and pooling layers may implement fixed functions.
[0100] Convolution is a mathematical operation that can be used to extract features from an input image. Features that can be extracted include, for example, edges, curves, corners, spots, and ridges. Convolution learns image features by using small squares of input data, thereby preserving the spatial relationship between pixels.
[0101] Figure 8 is a diagram illustrating an example of a system for implementing certain aspects of the technology herein. Specifically, Figure 8An example of a computing system 800 is illustrated, which may be, for example, any computing device constituting an internal computing system, a remote computing system, a camera, or any component thereof, wherein the components of the system are in communication with each other using a connection 805. The connection 805 may be a physical connection using a bus, or a direct connection to the processor 810 (such as in a chipset architecture). The connection 805 may also be a virtual connection, a networked connection, or a logical connection.
[0102] In some embodiments, computing system 800 is a distributed system, where the functionality described in the present disclosure can be distributed across a data center, multiple data centers, a peer-to-peer network, etc. In some embodiments, one or more of the system components described herein represent many such components, each of which performs some or all of the functionality described for that component. In some embodiments, each component can be a physical or virtual device.
[0103] The example system 800 includes at least one processing unit (CPU or processor) 810 and connections 805 that couple various system components including system memory 815, such as read-only memory (ROM) 820 and random access memory (RAM) 825, to the processor 810. The computing system 800 may include a cache 812 of high-speed memory directly connected to the processor 810, in close proximity to the processor 810, or integrated as part of the processor 810.
[0104] Processor 810 may include any general purpose processor and hardware or software services, such as services 832, 834, and 836 stored in storage device 830 and configured to control processor 810, as well as special purpose processors where software instructions are incorporated into the actual processor design. Processor 810 may be essentially a fully self-contained computing system, including multiple cores or processors, buses, memory controllers, caches, etc. Multi-core processors may be symmetric or asymmetric.
[0105] To enable user interaction, the computing system 800 includes an input device 845 that can represent any number of input mechanisms, such as a microphone for voice, a touch-sensitive screen for gesture or graphical input, a keyboard, a mouse, motion input, voice, and the like. The computing system 800 may also include an output device 835, which may be one or more of several output mechanisms. In some instances, a multimodal system may enable a user to provide multiple types of input / output to communicate with the computing system 800. The computing system 800 may include a communication interface 840, which may generally govern and manage user input and system output. The communication interface may perform or facilitate the use of a wired and / or wireless transceiver to receive and / or transmit wired or wireless communications, including the use of an audio jack / plug, a microphone jack / plug, a universal serial bus (USB) port / plug, Ports / plugs, Ethernet ports / plugs, Fiber optic ports / plugs, Dedicated wired ports / plugs, Wireless signal transmission, Low energy (BLE) wireless signal transmission, Wireless signal transmission, radio frequency identification (RFID) wireless signal transmission, near field communication (NFC) wireless signal transmission, dedicated short range communication (DSRC) wireless signal transmission, 802.11 Wi-Fi wireless signal transmission, wireless local area network (WLAN) signal transmission, visible light communication (VLC), Worldwide Interoperability for Microwave Access (WiMAX), infrared (IR) communication wireless signal transmission, public switched telephone network (PSTN) signal transmission, integrated services digital network (ISDN) signal transmission, 3G / 4G / 5G / LTE cellular data network wireless signal transmission, ad hoc network signal transmission, radio wave signal transmission, microwave signal transmission, infrared signal transmission, visible light signal transmission, ultraviolet light signal transmission, wireless signal transmission along the electromagnetic spectrum, or some combination thereof. The communication interface 840 may also include one or more global navigation satellite system (GNSS) receivers or transceivers, which are used to determine the location of the computing system 800 based on receiving one or more signals from one or more satellites associated with one or more GNSS systems. GNSS systems include, but are not limited to, the United States-based Global Positioning System (GPS), the Russian-based Global Navigation Satellite System (GLONASS), the Chinese-based BeiDou Navigation Satellite System (BDS), and the European-based Galileo GNSS. There is no restriction to operating on any particular hardware arrangement, and thus the base features herein may be easily substituted for improved hardware or firmware arrangements as they are developed.
[0106] The storage device 830 may be a non-volatile and / or non-transitory and / or computer-readable memory device and may be a hard disk or other type of computer-readable medium capable of storing data accessible by a computer, such as a cassette, a flash memory card, a solid-state memory device, a digital versatile disk, a cassette, a floppy disk, a floppy disk, a hard disk, a magnetic tape, a magnetic stripe / magnetic stripe, any other magnetic storage medium, flash memory, a memristor memory, any other solid-state memory, a compact disc read-only memory (CD-ROM) disc, a rewritable compact disc (CD) disc, a digital video disc (DVD) disc, a Blu-ray disc (BDD) disc, a holographic disc, another optical medium, a secure digital (SD) card, a micro secure digital (microSD) card, a Memory Stick card, a smart card chip, an EMV chip, a subscriber identity module (SIM) card, a mini / micro / nano / pico SIM card, another integrated circuit (IC) chip / card, a random access memory (RAM), a static RAM (SRAM), a dynamic RAM (DRAM), a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a flash EPROM (FLASHEPROM), a cache memory (L1 / L2 / L3 / L4 / L5 / L#), a resistive random access memory (RRAM / ReRAM), a phase change memory (PCM), a spin transfer torque RAM (STT-RAM), another memory chip or box, and / or a combination thereof.
[0107] Storage device 830 may include software services, servers, services, etc., which cause the system to perform functions when the code defining such software is executed by processor 810. In some embodiments, hardware services that perform specific functions may include software components stored in a computer-readable medium connected to the necessary hardware components (such as processor 810, connection 805, output device 835, etc.) to perform the functions.
[0108] As used herein, the term "computer-readable medium" includes, but is not limited to, portable or non-portable storage devices, optical storage devices, and various other media capable of storing, containing or carrying (all) instructions and / or data. Computer-readable media may include non-transient media in which data can be stored and do not include carrier waves and / or transient electronic signals that are wirelessly or propagated through wired connections. Examples of non-transient media may include, but are not limited to, disks or tapes, optical storage media (such as compact discs (CDs) or digital versatile discs (DVDs)), flash memory, memory, or memory devices. Computer-readable media may have codes and / or machine-executable instructions stored thereon, which may represent any combination of procedures, functions, subroutines, programs, routines, subroutines, modules, software packages, classes, or instructions, data structures, or program statements. Code segments may be coupled to another code segment or hardware circuit by transmitting and / or receiving information, data, independent variables, parameters, or memory contents. Information, independent variables, parameters, data, etc. may be transmitted, forwarded, or transmitted using any suitable means, including memory sharing, message passing, token passing, network transmission, etc.
[0109] In some embodiments, computer-readable storage devices, media, and memories may include wired or wireless signals containing bit streams, etc. However, when referred to, non-transitory computer-readable storage media explicitly exclude media such as energy, carrier signals, electromagnetic waves, and signals themselves.
[0110] Specific details are provided in the above description to provide a detailed understanding of the embodiments and examples provided herein. However, it will be appreciated by those skilled in the art that these embodiments can also be put into practice without these specific details. For clarity, in some instances, the technology of the present invention may be presented as including various functional blocks, which include functional blocks including steps or routines in the method for implementing a combination of equipment, equipment components, software or hardware and software. Additional components other than those components shown in the accompanying drawings and / or described herein may be used. For example, circuits, systems, networks, processes and other components may be shown as components in block diagram form to avoid obscuring these embodiments in unnecessary details. In other instances, known circuits, processes, algorithms, structures and techniques may be shown without necessary details to avoid confusing various embodiments.
[0111] Various embodiments may be described above as processes or methods, which are depicted as flow charts, flow diagrams, data flow diagrams, structure diagrams, or block diagrams. Although flow charts may describe operations as sequential processes, many operations may be performed in parallel or concurrently. In addition, the order of operations may be rearranged. The process is terminated when the operations of the process are completed, but the process may have additional steps not included in the accompanying drawings. The process may correspond to a method, function, procedure, subroutine, subprogram, etc. When the process corresponds to a function, its termination corresponds to the function returning to the caller function or main function.
[0112] The process and method according to the above examples can be implemented using stored computer executable instructions or otherwise available computer executable instructions from computer readable media. These instructions may include, for example, instructions and data that cause or otherwise configure a general-purpose computer, a special-purpose computer, or a processing device to perform a certain function or function group. The various parts of the computer resources used can be accessed through a network. Computer executable instructions can be, for example, binary files, intermediate format instructions (such as assembly language), firmware, source code, etc. Examples of computer readable media that can be used to store instructions, information used during the method according to the described examples, and / or information created include disks or optical disks, flash memory, USB devices provided with non-volatile memory, networked storage devices, etc.
[0113] Devices implementing various processes and methods according to these disclosures may include hardware, software, firmware, middleware, microcode, hardware description language, or any combination thereof, and may adopt any of various form factors. When implemented in software, firmware, middleware, or microcode, program code or code segments (e.g., computer program products) for performing necessary tasks may be stored in a computer-readable or machine-readable medium. The processor may perform the necessary tasks. Typical examples of each form factor include: laptops, smart phones, mobile phones, tablet devices, or other small form factor personal computers, personal digital assistants, rack-mounted devices, stand-alone devices, etc. The functionality described herein may also be implemented with peripheral devices or plug-in cards. As a further example, such functionality may also be implemented on circuit boards among different chips or different processes executed on a single device.
[0114] The instructions, the medium for communicating those instructions, the computing resources for executing them, and other structures for supporting such computing resources are example means for providing the functions described in this disclosure.
[0115] In the above description, various aspects of the application are described with reference to their specific embodiments, but those skilled in the art will recognize that the application is not limited thereto. Thus, although the illustrative embodiments of the application have been described in detail herein, it is to be understood that each inventive concept can be implemented and adopted in various other ways, and the appended claims are not intended to be interpreted as including these variations, unless limited by the prior art. In addition, each embodiment can be utilized in any number of environments and applications beyond those described herein without departing from the broader spirit and scope of this specification. Accordingly, this specification and the accompanying drawings should be considered as illustrative rather than restrictive. For the purpose of explanation, each method is described in a specific order. It should be appreciated that in an alternative embodiment, each method can be performed in a different order than described.
[0116] One of ordinary skill will appreciate that the less than ("<") and greater than (">") symbols or terms used herein may be replaced by less than or equal to ("≤") and greater than or equal to ("≥") symbols, respectively, without departing from the scope of the present specification.
[0117] Where components are described as being “configured to” perform certain operations, such configuration may be achieved, for example, by designing electronic circuits or other hardware to perform the operations, by programming programmable electronic circuits (e.g., a microprocessor, or other suitable electronic circuits), or any combination thereof.
[0118] The phrase "coupled to" refers to any component being physically connected directly or indirectly to another component, and / or any component being in communication with another component directly or indirectly (e.g., connected to the other component via a wired or wireless connection and / or other suitable communication interface).
[0119] Claim language or other language reciting "at least one" of a set and / or "one or more" of a set indicates that one member of the set or multiple members of the set (in any combination) satisfies the claim. For example, claim language reciting "at least one of A and B" means A, B, or A and B. In another example, claim language reciting "at least one of A, B, and C" means A, B, C, or A and B, or A and C, or B and C, or A and B and C. The language of "at least one" of a set and / or "one or more" of a set does not limit the set to the items listed in the set. For example, claim language reciting "at least one of A and B" may mean A, B, or A and B, and may additionally include items not listed in the set of A and B.
[0120] The various illustrative logic boxes, modules, circuits, and algorithmic steps described in conjunction with the examples disclosed herein may be implemented as electronic hardware, computer software, firmware, or a combination thereof. To clearly illustrate this interchangeability of hardware and software, various illustrative components, blocks, modules, circuits, and steps are generally described above in terms of their functionality. Whether such functionality is implemented as hardware or software depends on the specific application and the design constraints imposed on the overall system. Technicians may implement the described functionality in different ways for each specific application, but such implementation decisions should not be interpreted as causing a departure from the scope of this application.
[0121] The techniques described herein may also be implemented with electronic hardware, computer software, firmware, or any combination thereof. These techniques may be implemented with any of a variety of devices, such as a general-purpose computer, a wireless communication device handset, or an integrated circuit device with multiple uses, including applications in wireless communication device handsets and other devices. Any features described as modules or components may be implemented together in an integrated logic device or individually as discrete but interoperable logic devices. If implemented with software, these techniques may be implemented at least in part by a computer-readable data storage medium including program codes, which include instructions that, when executed, perform one or more of the above methods. A computer-readable data storage medium may form a part of a computer program product, which may include packaging materials. A computer-readable medium may include a memory or data storage medium, such as a random access memory (RAM) (such as a synchronous dynamic random access memory (SDRAM)), a read-only memory (ROM), a non-volatile random access memory (NVRAM), an electrically erasable programmable read-only memory (EEPROM), a flash memory, a magnetic or optical data storage medium, and the like. These techniques may additionally or alternatively be implemented at least in part by a computer-readable communication medium that carries or communicates program code in the form of instructions or data structures that can be accessed, read, and / or executed by a computer, such as a propagated signal or wave.
[0122] The program code may be executed by a processor, which may include one or more processors, such as one or more digital signal processors (DSPs), general-purpose microprocessors, application-specific integrated circuits (ASICs), field programmable logic arrays (FPGAs), or other equivalent integrated or discrete logic circuit systems. Such processors may be configured to perform any of the techniques described in this disclosure. A general-purpose processor may be a microprocessor, but in an alternative, the processor may be any conventional processor, controller, microcontroller, or state machine. The processor may also be implemented as a combination of computing devices, for example, a combination of a DSP and a microprocessor, a plurality of microprocessors, one or more microprocessors in coordination with a DSP core, or any other such configuration. Accordingly, the term "processor" as used herein may refer to any of the above structures, any combination of the above structures, or any other structure or device suitable for implementing the techniques described herein. In addition, in some aspects, the functionality described herein may be provided in a dedicated software module or hardware module configured for encoding and decoding, or incorporated into a combined video codec (CODEC).
[0123] Illustrative aspects of the disclosure include:
[0124] Aspect 1. An apparatus for reducing quantization latency, the apparatus comprising: a memory; and one or more processors coupled to the memory, the one or more processors configured to: determine a first integer data type of data that at least one layer of a neural network is configured to process; determine a second integer data type of data received for processing by the neural network, the second integer data type being different from the first integer data type; determine a ratio between a first size of the first integer data type and a second size of the second integer data type; scale parameters of the at least one layer of the neural network using a scaling factor corresponding to the ratio; quantize the scaled parameters of the neural network; and input the received data to the neural network having the quantized and scaled parameters.
[0125] Aspect 2. The apparatus of Aspect 1 further comprises a hardware accelerator configured to implement the neural network using data of the first integer data type.
[0126] Aspect 3. An apparatus as in any of Aspects 1 or 2, wherein: the received data comprises image data captured by a camera device of the apparatus; and the neural network is trained to perform one or more image processing operations on the image data.
[0127] Aspect 4. An apparatus as in any one of Aspects 1 to 3, wherein the one or more processors are configured to train the neural network using training data of a floating point data type, wherein training the neural network generates neural network parameters of the floating point data type.
[0128] Aspect 5. The apparatus of aspect 4, wherein the one or more processors are configured to convert the neural network parameters from the floating point data type to the first integer data type.
[0129] Aspect 6. An apparatus as in any one of Aspects 1 to 5, wherein: the at least one layer of the neural network corresponds to a single layer of the neural network; and the scaling factor is a ratio between a first size of the first integer data type and a second size of the second integer data type.
[0130] Aspect 7. An apparatus as in any one of Aspects 1 to 6, wherein: the first size of the first integer data type corresponds to a first number of different integers that the first integer data type is configured to represent; and the second size of the second integer data type corresponds to a second number of different integers that the second integer data type is configured to represent.
[0131] Aspect 8. The device of any one of Aspects 1 to 7, wherein the at least one layer of the neural network comprises a convolutional layer or a deconvolutional layer.
[0132] Aspect 9. The apparatus of any one of Aspects 1 to 7, wherein the at least one layer of the neural network comprises a scaling layer.
[0133] Aspect 10. The apparatus of any one of Aspects 1 to 7, wherein the at least one layer of the neural network comprises a layer that performs element-wise operations.
[0134] Aspect 11. The apparatus of any one of Aspects 1 to 10, wherein the one or more processors are configured to input the received data into the neural network without quantizing the received data.
[0135] Aspect 12. The apparatus of any one of Aspects 1 to 11, wherein the one or more processors are configured to quantize parameters of one or more additional layers of the neural network.
[0136] Aspect 13. The apparatus of any one of aspects 1 to 12, wherein the apparatus comprises a mobile device.
[0137] Aspect 14. The device of any one of aspects 1 to 13, further comprising a display.
[0138] Aspect 15. A method of reducing quantization latency, the method comprising: determining a first integer data type of data that at least one layer of a neural network is configured to process; determining a second integer data type of data received for processing by the neural network, the second integer data type being different from the first integer data type; determining a ratio between a first size of the first integer data type and a second size of the second integer data type; scaling parameters of the at least one layer of the neural network using a scaling factor corresponding to the ratio; quantizing the scaled parameters of the neural network; and inputting the received data to the neural network having the quantized and scaled parameters.
[0139] Aspect 16. The apparatus of aspect 15, further comprising implementing the neural network using a hardware accelerator and data of the first integer data type.
[0140] Aspect 17. A method as in any one of Aspects 15 or 16, wherein: the received data comprises image data captured by a camera device; and the neural network is trained to perform one or more image processing operations on the image data.
[0141] Aspect 18. The method of any one of Aspects 15 to 17, further comprising: training the neural network using training data of a floating point data type, wherein training the neural network generates neural network parameters of the floating point data type.
[0142] Aspect 19. The method of Aspect 19 further comprises: converting the neural network parameter from the floating point data type to the first integer data type.
[0143] Aspect 20. A method as in any one of Aspects 15 to 19, wherein: the at least one layer of the neural network corresponds to a single layer of the neural network; and the scaling factor is a ratio between a first size of the first integer data type and a second size of the second integer data type.
[0144] Aspect 21. A method as described in any one of Aspects 15 to 20, wherein: the first size of the first integer data type corresponds to a first number of different integers that the first integer data type is configured to represent; and the second size of the second integer data type corresponds to a second number of different integers that the second integer data type is configured to represent.
[0145] Aspect 22. The method of any one of Aspects 15 to 21, wherein the at least one layer of the neural network comprises a convolutional layer or a deconvolutional layer.
[0146] Aspect 23. The method of any one of Aspects 15 to 21, wherein the at least one layer of the neural network comprises a scaling layer.
[0147] Aspect 24. The method of any one of Aspects 15 to 21, wherein the at least one layer of the neural network comprises a layer that performs element-wise operations.
[0148] Aspect 25. The method of any one of Aspects 15 to 24, further comprising: inputting the received data into the neural network without quantizing the received data.
[0149] Aspect 26. The method of any one of Aspects 15 to 25, further comprising: quantizing parameters of one or more additional layers of the neural network.
[0150] Aspect 27. A computer-readable storage medium storing instructions that, when executed by one or more processors, cause the one or more processors to perform any of the operations of Aspects 1 to 26.
[0151] Aspect 28. An apparatus comprising means for performing any of the operations of Aspects 1 to 26.
Claims
1. A device for reducing quantization waiting time, the device comprising: Memory; one or more processors coupled to the memory and configured to: determining a first integer data type for data that at least one layer of the neural network is configured to process; determining a second integer data type for data received for processing by the neural network, the second integer data type being different than the first integer data type; determining a ratio between a first size of the first integer data type and a second size of the second integer data type; scaling parameters of the at least one layer of the neural network using a scaling factor corresponding to the ratio; quantizing the scaled parameters of the neural network; as well as The received data is input to the neural network having quantized and scaled parameters.
2. The apparatus of claim 1 , further comprising a hardware accelerator configured to implement the neural network using data of the first integer data type.
3. The device of claim 1, wherein: The received data comprises image data captured by a camera device of the apparatus; and The neural network is trained to perform one or more image processing operations on the image data.
4. The device according to claim 1, wherein: The one or more processors are configured to train the neural network using training data of a floating point data type, wherein training the neural network generates neural network parameters of the floating point data type.
5. The device according to claim 4, wherein: The one or more processors are configured to convert the neural network parameters from the floating point data type to the first integer data type.
6. The device of claim 1, wherein: The at least one layer of the neural network corresponds to a single layer of the neural network; and The scaling factor is the ratio between the first size of the first integer data type and the second size of the second integer data type.
7. The device of claim 1, wherein: The first size of the first integer data type corresponds to a first number of different integers that the first integer data type is configured to represent; and The second size of the second integer data type corresponds to a second number of different integers that the second integer data type is configured to represent.
8. The device of claim 1, wherein: The at least one layer of the neural network comprises a convolutional layer or a deconvolutional layer.
9. The device of claim 1, wherein: The at least one layer of the neural network comprises a scaling layer.
10. The device of claim 1, wherein: The at least one layer of the neural network includes a layer that performs element-wise operations.
11. The device of claim 1, wherein: The one or more processors are configured to input the received data into the neural network without quantizing the received data.
12. The device of claim 1, wherein: The one or more processors are configured to quantize parameters of one or more additional layers of the neural network.
13. The device of claim 1, wherein: The apparatus comprises a mobile device.
14. The apparatus of claim 1, further comprising a display.
15. A method for reducing quantization waiting time, the method comprising: determining a first integer data type for data that at least one layer of the neural network is configured to process; determining a second integer data type for data received for processing by the neural network, the second integer data type being different than the first integer data type; determining a ratio between a first size of the first integer data type and a second size of the second integer data type; scaling parameters of the at least one layer of the neural network using a scaling factor corresponding to the ratio; quantizing the scaled parameters of the neural network; as well as The received data is input to the neural network having quantized and scaled parameters.
16. The method of claim 15, further comprising: The neural network is implemented using a hardware accelerator and data of the first integer data type.
17. The method of claim 15, wherein: The received data includes image data captured by a camera device; and The neural network is trained to perform one or more image processing operations on the image data.
18. The method of claim 15, further comprising: The neural network is trained using training data of a floating point data type, wherein training the neural network generates neural network parameters of the floating point data type.
19. The method of claim 18, further comprising: The neural network parameters are converted from the floating point data type to the first integer data type.
20. The method of claim 15, wherein: The at least one layer of the neural network corresponds to a single layer of the neural network; and The scaling factor is the ratio between the first size of the first integer data type and the second size of the second integer data type.
21. The method of claim 15, wherein: The first size of the first integer data type corresponds to a first number of different integers that the first integer data type is configured to represent; and The second size of the second integer data type corresponds to a second number of different integers that the second integer data type is configured to represent.
22. The method of claim 15, wherein: The at least one layer of the neural network comprises a convolutional layer or a deconvolutional layer.
23. The method of claim 15, wherein: The at least one layer of the neural network comprises a scaling layer.
24. The method of claim 15, wherein: The at least one layer of the neural network includes a layer that performs element-wise operations.
25. The method of claim 15, further comprising: The received data is input to the neural network without quantizing the received data.
26. The method of claim 15, further comprising: Parameters of one or more additional layers of the neural network are quantized.
27. A non-transitory computer readable medium having stored thereon instructions which, when executed by one or more processors, cause the one or more processors to: determining a first integer data type for data that at least one layer of the neural network is configured to process; determining a second integer data type for data received for processing by the neural network, the second integer data type being different than the first integer data type; determining a ratio between a first size of the first integer data type and a second size of the second integer data type; scaling parameters of the at least one layer of the neural network using a scaling factor corresponding to the ratio; quantizing the scaled parameters of the neural network; as well as The received data is input to the neural network having quantized and scaled parameters.
28. The non-transitory computer readable medium of claim 27, further comprising instructions that, when executed by the one or more processors, cause the one or more processors to implement the neural network using a hardware accelerator and data of the first integer data type.
29. The non-transitory computer readable medium of claim 27, wherein: The received data includes image data captured by a camera device; and The neural network is trained to perform one or more image processing operations on the image data.
30. The non-transitory computer readable medium of claim 27, further comprising instructions that, when executed by the one or more processors, cause the one or more processors to perform the following operations: train the neural network using training data of a floating point data type, wherein training the neural network generates neural network parameters of the floating point data type.
