Fractional bit network quantization for convolutional neural network models

Through the fractional bit network quantization method, a 1-bit convolution kernel subset is allocated to the convolution layer of the CNN model, which solves the problem of high storage and computing costs of the CNN model on resource-constrained devices, achieves effective compression and acceleration of the model, and ensures It not only improves the accuracy of the model, but also improves the inference speed.

CN118541701APending Publication Date: 2024-08-23INTEL CORP
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202280088232.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2022-03-03
Publication Date
2024-08-23

AI Technical Summary

Technical Problem

Existing CNN models have high memory, computing and power costs due to the huge number of learnable parameters on resource-constrained devices, which limits their widespread use on mobile or embedded devices, and existing 1-bit network quantization schemes have not Able to provide customized compression and acceleration solutions without losing model accuracy.

Method used

The Fractional Bit Network Quantization (DebNeQ) method is proposed to convert the CNN model from a 32-bit or 16-bit floating point model to a fractional bit model by assigning a 1-bit subset of convolution kernels to the convolutional layer, either shared or specific to the convolutional layer. Bit convolution kernel candidates reduce the number of bits represented by the weight, and update the convolution kernel through training to achieve compression and acceleration of the CNN model.

Benefits of technology

It achieves about K×K/N times compression of the CNN model and brings significant speed improvement without loss of model accuracy. It is suitable for advanced AI hardware accelerator design and deep learning inference.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118541701A
    Figure CN118541701A
Patent Text Reader

Abstract

Methods, apparatus, systems, and articles of manufacture for quantizing a CNN model, including, for a convolutional layer of the CNN model: allocating a subset of 1-bit convolution kernels to the convolutional layer, where the convolutional layer includes 32-bit or 16-bit floating-point convolution kernels of size K * K, and the subset of 1-bit convolution kernels includes 2N 1-bit convolution kernel candidates of size K * K, 1 < = Nlt; k * K, and both K and N are positive integers; and performing weight quantization of the convolutional layer by selecting a 1-bit convolution kernel candidate from the subset of 1-bit convolution kernels as a 1-bit convolution kernel of the convolutional layer.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments described herein generally relate to the field of neural networks, and more specifically to fractional-bit network quantization of a Convolutional Neural Network (CNN) model. Background Art

[0002] Convolutional Neural Network (CNN) models are powerful learning models that achieve state-of-the-art performance on many computer vision tasks. CNN models include an input layer, an output layer, and at least one hidden layer between them, and use sophisticated mathematical modeling to process data transmitted between these network layers. BRIEF DESCRIPTION OF THE DRAWINGS

[0003] Various advantages of the embodiments will become apparent to those skilled in the art upon reading the following description and appended claims, and by referring to the following drawings, in which:

[0004] Figure 1 is a flowchart illustrating a method for quantizing a CNN model according to some embodiments of the present disclosure;

[0005] Figure 2 is a schematic diagram illustrating an example 1-bit convolution kernel subset according to some embodiments of the present disclosure;

[0006] Figure 3 is a schematic diagram showing the speed improvement of a fractional-bit CNN model relative to a 1-bit CNN model according to some embodiments of the present disclosure;

[0007] Figure 4 is a flowchart illustrating a method for training a CNN model according to some embodiments of the present disclosure;

[0008] Figure 5 is a block diagram illustrating components capable of reading instructions from a machine-readable or computer-readable medium and performing any one or more of the methods discussed herein, according to some example embodiments;

[0009] Figure 6 is a block diagram of an example processor platform according to some embodiments of the present disclosure; and

[0010] Fig. 7A is a schematic diagram showing the various layers within a CNN model.

[0011] Figure 7B is a schematic diagram showing exemplary computational stages within a convolutional layer of a CNN model. DETAILED DESCRIPTION

[0012] The various aspects of the illustrative embodiments will be described using terms that are commonly used by those skilled in the art to convey the essence of the present disclosure to other persons skilled in the art. However, it will be appreciated by those skilled in the art that many alternative embodiments may also be implemented using some parts of the described aspects. For illustration, specific numbers, materials, and configurations are recorded to provide a thorough understanding of the illustrative embodiments. However, it will be appreciated by those skilled in the art that alternative embodiments may also be implemented without these specific details. In other cases, known features may be omitted or simplified to avoid blurring the illustrative embodiments.

[0013] In addition, various operations will be described as multiple discrete operations in sequence in a manner that is most helpful for understanding the illustrative embodiments; however, the order of description should not be interpreted as meaning that these operations are necessarily order-dependent. In particular, these operations do not need to be performed in the order presented.

[0014] CNN models are specialized feed-forward neural network models for processing data with a known grid-like topology, such as image data. Therefore, CNN models are often used for computer vision and image recognition applications, but they can also be used for other types of pattern recognition, such as speech and language processing.

[0015] Fig. 7A is a schematic diagram showing the various layers within a CNN model. Fig. 7A As shown, an exemplary CNN model for modeling image processing may receive an input 702 describing the red, green, and blue (RGB) components of an input image. The input 702 may be processed by a plurality of convolutional layers (e.g., a first convolutional layer 704, a second convolutional layer 706). The outputs from the plurality of convolutional layers may optionally be processed by a set of fully connected layers 708. The neurons in the fully connected layers have full connections to all activations in the previous layers, as previously described for feedforward networks. The outputs from the fully connected layers 708 may be used to generate output results from the network. Activations within the fully connected layers 708 may be calculated using matrix multiplications instead of convolutions. Not all CNN implementations utilize fully connected layers 708. For example, in some implementations, the second convolutional layer 706 may generate the output of the CNN model.

[0016] The convolutional layers are sparsely connected, which is different from the traditional neural network configuration found in the fully connected layer 708. Traditional neural network layers are fully connected, so that every output unit interacts with every input unit. However, the convolutional layers are sparsely connected because the output of the convolution of a field (rather than the individual state values ​​of each node in the field) is input to the nodes of the subsequent layers, as shown in the figure. The convolution kernel associated with the convolutional layer performs the convolution operation, and its output is sent to the next layer. The dimensionality reduction performed within the convolutional layer is one aspect that enables the CNN model to scale to process large images.

[0017] Figure 7B is a schematic diagram showing exemplary computational stages within a convolutional layer of a CNN model. Input 712 to the convolutional layer of the CNN model may be processed in three stages of a convolutional layer 714. The three stages may include a convolution stage 716, a detector stage 718, and a pooling stage 720. The convolutional layer 714 may then output data to a subsequent convolutional layer. The final convolutional layer of the network may generate output feature map data or provide input to a fully connected layer, for example, to generate a classification value for the input to the CNN model.

[0018] In the convolution stage 716, several convolutions are performed in parallel to produce a set of linear activations. The convolution stage 716 may include an affine transformation, which is any transformation that can be specified as a linear transformation plus a translation. Affine transformations include rotations, translations, scaling, and combinations of these transformations. The convolution stage calculates the output of a function (e.g., a neuron) connected to a specific partition in the input, which can be determined as a local partition associated with the neuron. The neuron calculates the dot product between the weight of the neuron and the partition in the local input to which the neuron is connected. The output from the convolution stage 716 defines a set of linear activations that are processed by the subsequent stages of the convolution layer 714.

[0019] The linear activations may be processed by the detector stage 718. In the detector stage 718, each linear activation is processed by a nonlinear activation function. The nonlinear activation function increases the nonlinear properties of the entire network without affecting the receptive field of the convolutional layer. Several types of nonlinear activation functions may be used. One particular type is the rectified linear unit (ReLU), which uses an activation function defined as f(x) = max(0, x) so that the threshold of the activation is zero.

[0020] The pooling stage 720 uses a pooling function that replaces the output of the second convolutional layer 706 using summary statistics of neighboring outputs. The pooling function can be used to introduce translation invariance into the neural network so that a small translation of the input does not change the pooled output. The invariance of local translation may be useful in scenarios where the presence of a feature in the input data is more important than the exact location of the feature. Various types of pooling functions can be used during the pooling stage 720, including maximum pooling, average pooling, and 12-norm pooling. In addition, some CNN implementations do not include a pooling stage. Instead, such an implementation replaces an additional convolution stage with an increased stride relative to the previous convolution stage.

[0021] The output from the convolutional layer 714 may then be processed by the next layer 722. The next layer 722 may be an additional convolutional layer or one of the fully connected layers 708. For example, Fig. 7AThe first convolutional layer 704 may output to the second convolutional layer 706, and the second convolutional layer may output to the first layer in the fully connected layer 708.

[0022] CNN models have demonstrated record-breaking results in almost all computer vision tasks. The leading performance of CNN models is attributed to the huge number of learnable parameters, even up to hundreds of millions, regardless of whether large-scale datasets and powerful hardware resources are available. However, this in turn brings heavy memory, computation, and power costs, which hinders their widespread use, especially on resource-constrained devices. In order to make CNN models applicable on mobile or embedded or graphics processing unit (GPU) devices, a lot of research efforts have been invested in the network quantization of CNN models in academia and the industry.

[0023] The extreme quantization solution for CNN models is 1-bit network quantization (where the parameters of the CNN model are forced to be set to 1-bit values ​​{-1, 1}). Specifically, the basic concept of 1-bit network quantization is as follows: Assume that M = {f(W l ,A l ;X l )|1≤l≤L} is a 32-bit floating-point CNN model (it should be understood that the 32-bit floating-point CNN model is only an example, and it can also be a 64-bit or 16-bit floating-point CNN model or a block floating-point (BFP)-16CNN model), where W l is the set of 32-bit floating-point weights of the lth convolutional layer, X l is the input set of the lth convolutional layer, A l is the activation set of the lth convolutional layer, and L is the number of convolutional layers in the 32-bit floating-point CNN model M. The purpose of 1-bit network quantization is to convert the 32-bit floating-point CNN model M into a 1-bit CNN model, which has only the quantized weight set Its entries are represented by α l B, where B∈{1,-1}, α l is a positive scaling factor specific to the lth convolutional layer. Mathematically, the objective function of 1-bit network quantization for a 32-bit floating-point CNN model M can be defined as follows:

[0024]

[0025] The optimization of the objective function (1) can be easily solved, for example, using the popular Straight-Through Estimator (STE).

[0026] Compared to 32-bit floating-point CNN models, 1-bit network quantization brings significant storage and latency reduction (32x compression and up to 58x speed improvement) by replacing time-intensive multiplication operations with cheap bit-wise XOR and bit counting operations, thereby simplifying the deployment of CNN solutions, especially for specialized Artificial Intelligent (AI) devices.

[0027] Existing 1-bit network quantization solutions, including but not limited to Binary-Weight-Network (BWN), DoReFa-Net, XOR-NON network, Ternary-Binary Network (TBN), Loss-aware Binary Network (LBN), Explicit Loss-error-aware Quantization (ELQ), Learned Quantization (LQ) network, Differentiable Soft Quantization (DSQ) and Information Retention (IR) network, focus on the design of binary quantization schemes, aiming to obtain binary networks with high accuracy.

[0028] Benefiting from the great progress in binary network design in recent years, modern binary networks have only a small drop in accuracy compared to full-precision reference models. For single-class or multi-class vision applications, such as face detection / verification, pedestrian / human detection, etc., 1-bit CNN models have been popular because the accuracy drop is negligible (usually less than 1%). However, to date, there is no solution tailored for compressing and accelerating 1-bit CNN models without losing model accuracy.

[0029] The present disclosure proposes Decimal-Bit Network Quantization (DebNeQ) for compression and acceleration of 1-bit CNN models without losing model accuracy.

[0030] Figure 1 is a flow chart showing a method 100 for quantizing a CNN model according to some embodiments of the present disclosure. Figure 1As shown, method 100 includes, for the convolutional layer of a CNN model: S102, allocating a subset of 1-bit convolutional kernels to the convolutional layer, where the convolutional layer includes 32-bit or 16-bit floating-point convolutional kernels of size K×K, and the subset of 1-bit convolutional kernels includes 2 N candidate 1-bit convolutional kernels of size K×K, 1 ≤ N < K×K, and both K and N are positive integers; and S104, performing weight quantization of the convolutional layer by selecting a candidate 1-bit convolutional kernel from the subset of 1-bit convolutional kernels as the 1-bit convolutional kernel of the convolutional layer.

[0031] Compared with the 1-bit CNN model, the CNN model obtained from the quantization of method 100 is compressed by approximately K×K / N times. Therefore, the quantization of method 100 is called DebNeQ, and the CNN model obtained from the quantization of method 100 is called a fractional-bit CNN model.

[0032] Specifically, in the 1-bit CNN model, a 1-bit convolutional kernel of size K×K requires K×K bits to represent all its weights. According to the layout of {1, -1} values, there are a total of 2 K×K candidate 1-bit convolutional kernels for the 1-bit convolutional kernel. In contrast, in the fractional-bit CNN model, the number of candidate 1-bit convolutional kernels for the 1-bit convolutional kernel is forced to be 2 N , 1 ≤ N < K×K. On average, only N bits instead of K×K bits are needed to represent all the weights of a 1-bit convolutional kernel of size K×K.

[0033] Figure 2 is a schematic diagram showing an example subset of 1-bit convolutional kernels according to some embodiments of the present disclosure. As Figure 2 shown, the example subset of 1-bit convolutional kernels includes 2 4 = 16 candidate 1-bit convolutional kernels of size 3×3. When the example subset of 1-bit convolutional kernels is allocated to a convolutional layer of a CNN model that includes 32-bit or 16-bit floating-point convolutional kernels of size 3×3, a candidate 1-bit convolutional kernel can be selected from the example subset of 1-bit convolutional kernels as the 1-bit convolutional kernel of the convolutional layer, and 4 bits instead of 9 bits are needed to represent all the weights of each 1-bit convolutional kernel.

[0034] In addition, DebNeQ also transforms the computational process for CNN inference in a shared manner, bringing a significant speed improvement compared to the 1-bit CNN model. For example, assume C out is the number of output feature channels of the convolutional layer, and C in is the number of input feature channels of the convolutional layer. In the 1-bit CNN model, the K×K kernel-level 1-bit convolutional operation for each pixel is performed C out ×C inIn contrast, in the fractional-bit CNN model, the K×K kernel-level 1-bit convolution operation is performed twice for each pixel. N ×C in times, because 2 N 1-bit convolution kernel candidates are shared by all convolution kernels and each convolution kernel corresponds to one of the output feature channels, 2 N <<c out . Figure 3 is a schematic diagram showing the speed improvement of a fractional-bit CNN model relative to a 1-bit CNN model according to some embodiments of the present disclosure.

[0035] In some embodiments, the 1-bit convolution kernel subset may be shared by all convolution layers of the CNN model or may be specific to the convolution layer. The 1-bit convolution kernel subsets assigned to different convolution layers of the CNN model may include the same number of 1-bit convolution kernel candidates or different numbers of 1-bit convolution kernel candidates. The 1-bit convolution kernel candidates of the 1-bit convolution kernel subset may be predefined or randomly selected from a 1-bit convolution kernel set including all possible 1-bit convolution kernel candidates or a portion thereof.

[0036] In some embodiments, the objective function of network quantization of the CNN model may be defined as follows:

[0037]

[0038] in, is a subset of 1-bit convolution kernels, is the set of quantized weights of the convolutional layer, and W l It is the set of 32-bit or 16-bit floating-point weights of the convolutional layer.

[0039] As mentioned above, DebNeQ is used to convert CNN models from 32-bit or 16-bit floating point models to fractional bit models, and is a technology for compression and acceleration of 1-bit CNN models. In addition, as a new type of quantized CNN model, the fractional bit CNN model can be used in advanced AI HW / accelerator design for efficient deep learning inference.

[0040] Figure 4 4 is a flow chart showing a method 400 for training a CNN model according to some embodiments of the present disclosure. Figure 4 As shown, the method 400 includes: S402, training an initial CNN architecture configuration based on training data to generate a CNN model, the CNN model is a 32-bit or 16-bit floating point model; S404, for a convolution layer of the CNN model, assigning a 1-bit convolution kernel subset to the convolution layer, wherein the convolution layer includes a 32-bit or 16-bit floating point convolution kernel of size K×K, and the 1-bit convolution kernel subset includes 2N One 1-bit convolution kernel candidate of size K×K, where 1≤N<K×K, performs weight quantization of the convolutional layer by selecting a 1-bit convolution kernel candidate from the 1-bit convolution kernel subset as the 1-bit convolution kernel of the convolutional layer; and S406, updating the 32-bit or 16-bit floating-point convolution kernels of each convolutional layer of the CNN model and training the CNN model.

[0041] In some embodiments, method 400 further includes: S408, determining whether the number of training iterations of the CNN model reaches a preset number of iterations; and S410, when the number of training iterations of the CNN model does not reach the preset number of iterations, for the convolutional layer of the CNN model, refining the 1-bit convolution kernel subset, and then returning to S404 to perform weight quantization of the convolutional layer by selecting a 1-bit convolution kernel candidate from the refined 1-bit convolution kernel subset as the 1-bit convolution kernel of the convolutional layer, where the refined 1-bit convolution kernel subset includes 2 N 1-bit convolution kernel candidates of size K×K.

[0042] Extensive experiments show that compared with 1-bit CNN models, the model accuracy of fractional-bit CNN models is not lost.

[0043] Figure 5 is a block diagram showing components capable of reading instructions from a machine-readable or computer-readable medium (e.g., a non-transitory machine-readable storage medium) and performing any one or more of the methods discussed herein. Specifically, Figure 5 shows a graphical representation of hardware resources 500, which include one or more processors (or processor cores) 510, one or more memory / storage devices 520, and one or more communication resources 530, each of which can be communicatively coupled via a bus 540. For embodiments that utilize node virtualization (e.g., NFV), a hypervisor 502 can be executed to provide an execution environment for one or more network slices / sub-slices to utilize the hardware resources 500.

[0044] Processor 510 may include, for example, processor 512 and processor 514, where processor 512 and processor 514 may be, for example, a central processing unit (CPU), a graphics processing unit (GPU), a tensor processing unit (TPU), a visual processing unit (VPU), a field programmable gate array (FPGA), or any suitable combination of these.

[0045] The memory / storage device 520 may include main memory, disk storage, or any suitable combination of these. The memory / storage device 520 may include, but is not limited to, any type of volatile or non-volatile memory, such as dynamic random access memory (DRAM), static random access memory (SRAM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), flash memory, solid-state storage, etc.

[0046] The communication resources 530 may include an interconnect or network interface component or other appropriate device to communicate with one or more peripheral devices 504 or one or more databases 506 via the network 508. For example, the communication resources 530 may include a wired communication component (e.g., for coupling via a Universal Serial Bus (USB)), a cellular communication component, an NFC component, Components (e.g., low energy ), components, and other communication components.

[0047] The instructions 550 may include software, programs, applications, applet programs, apps, or other executable code for causing at least any one of the processors 510 to perform any one or more of the methods discussed herein. The instructions 550 may reside in whole or in part within at least one of the processors 510 (e.g., within a cache memory of the processor), within the memory / storage device 520, or within any suitable combination of these. In addition, any portion of the instructions 550 may be transferred to the hardware resources 500 from any combination of the peripheral device 504 or the database 506. Thus, the memory of the processor 510, the memory / storage device 520, the peripheral device 504, and the database 506 are examples of computer-readable and machine-readable media.

[0048] Figure 6 600 is a block diagram of an example processor platform according to some embodiments of the present disclosure. The processor platform 600 may be, for example, a server, a personal computer, a workstation, a self-learning machine (e.g., a neural network), a mobile device (e.g., a cellular phone, a smart phone, an iPad, etc.), or a processor platform 601. TM ), a personal digital assistant (PDA), an Internet home appliance, a DVD player, a CD player, a digital video recorder, a Blu-ray player, a game console, a personal video recorder, a set-top box, headphones or other wearable device, or any other type of computing device.

[0049] The processor platform 600 of the illustrated example includes a processor 612. The processor 612 of the illustrated example is hardware. For example, the processor 612 can be implemented by one or more integrated circuits, logic circuits, microprocessors, GPUs, DSPs, or controllers from any desired family or manufacturer. The hardware processor can be a semiconductor-based (e.g., silicon-based) device. In some embodiments, the processor implements one or more of the methods or processes described above.

[0050] The processor 612 of the illustrated example includes a local memory 613 (e.g., cache). The processor 612 of the illustrated example communicates with a main memory including a volatile memory 614 and a non-volatile memory 616 via a bus 618. The volatile memory 614 may be a synchronous dynamic random access memory (Synchronous Dynamic Random Access Memory, SDRAM), a dynamic random access memory (Dynamic Random Access Memory, DRAM), Dynamic Random Access Memory (DRAM) Dynamic Random Access Memory, ), and / or any other type of random access memory device. The non-volatile memory 616 may be implemented by flash memory and / or any other desired type of memory device. Access to the main memory 614, 616 is controlled by a memory controller.

[0051] The processor platform 600 of the illustrated example further includes an interface circuit 620. The interface circuit 620 may be implemented by any type of interface standard, such as an Ethernet interface, a universal serial bus (USB), interface, a near field communication (NFC) interface, and / or a PCI Express interface.

[0052] In the illustrated example, one or more input devices 622 are connected to the interface circuit 620. The input device(s) 622 allow a user to enter data and / or commands into the processor 612. The input device(s) may be implemented by, for example, an audio sensor, a microphone, a camera (still or video), a keyboard, buttons, a mouse, a touch screen, a trackpad, a trackball, and / or a voice recognition system.

[0053] One or more output devices 624 are also connected to the interface circuit 620 of the illustrated example. The output device 624 can be implemented by, for example, a display device (e.g., a light emitting diode (LED), an organic light emitting diode (OLED), a liquid crystal display (LCD), a cathode ray tube display (CRT), an in-place switching (IPS) display, a touch screen, etc.), a tactile output device, a printer, and / or a speaker. The interface circuit 620 of the illustrated example thus typically includes a graphics driver card, a graphics driver chip, and / or a graphics driver processor.

[0054] The interface circuitry 620 of the illustrated example also includes communication devices, such as transmitters, receivers, transceivers, modems, residential gateways, wireless access points, and / or network interfaces, to facilitate data exchange with external machines (e.g., any kind of computing device) via a network 626. Communications may be via, for example, an Ethernet connection, a digital subscriber line (DSL) connection, a telephone line connection, a coaxial cable system, a satellite system, a line-of-sight wireless system, a cellular telephone system, and the like.

[0055] For example, interface circuit 620 may include a training data set input via (one or more) input devices 622 or retrieved from network 626.

[0056] The illustrated example of processor platform 600 also includes one or more mass storage devices 628 for storing software and / or data. Examples of such mass storage devices 628 include floppy disk drives, hard disk drives, compact disk drives, Blu-ray disk drives, redundant array of independent disks (RAID) systems, and digital versatile disk (DVD) drives.

[0057] Machine-executable instructions 632 may be stored in mass storage device 628, volatile memory 614, non-volatile memory 616, and / or on a removable non-transitory computer-readable storage medium such as a CD or DVD.

[0058] Additional notes and examples:

[0059] Example 1 includes a method for quantizing a convolutional neural network (CNN) model, the method including, for a convolutional layer of the CNN model: allocating a 1-bit convolutional kernel subset to the convolutional layer, where the convolutional layer includes 32-bit or 16-bit floating-point convolutional kernels of size K×K and the 1-bit convolutional kernel subset includes 2 N 1-bit convolutional kernel candidates of size K×K, 1 ≤ N < K×K; and performing weight quantization of the convolutional layer by selecting a 1-bit convolutional kernel candidate from the 1-bit convolutional kernel subset as the 1-bit convolutional kernel of the convolutional layer.

[0060] Example 2 includes the method as described in Example 1, where the 1-bit convolutional kernel subset is shared by all convolutional layers of the CNN model.

[0061] Example 3 includes the method as described in Example 1, where the 1-bit convolutional kernel subset is specific to the convolutional layer.

[0062] Example 4 includes the method as described in Example 3, where the 1-bit convolutional kernel subsets assigned to different convolutional layers of the CNN model include the same number of 1-bit convolutional kernel candidates.

[0063] Example 5 includes the method as described in Example 3, where the 1-bit convolutional kernel subsets assigned to different convolutional layers of the CNN model include different numbers of 1-bit convolutional kernel candidates.

[0064] Example 6 includes the method as described in Example 1, where the 1-bit convolutional kernel candidates of the 1-bit convolutional kernel subset are predefined.

[0065] Example 7 includes the method as described in Example 1, wherein the 1-bit convolution kernel candidates of the subset of 1-bit convolution kernels are randomly selected from a set of 1-bit convolution kernels that includes all possible 1-bit convolution kernel candidates or a part thereof.

[0066] Example 8 includes the method as described in Example 1, wherein the objective function for network quantization of the CNN model is defined as follows:

[0067]

[0068] wherein, is the subset of 1-bit convolution kernels, is the set of quantized weights of the convolutional layer, and W l is the set of 32-bit or 16-bit floating-point weights of the convolutional layer.

[0069] Example 9 includes a method for training a convolutional neural network (CNN) model, including: for a convolutional layer of the CNN model, allocating a subset of 1-bit convolution kernels, wherein the convolutional layer includes a 32-bit or 16-bit floating-point convolution kernel of size K×K and the subset of 1-bit convolution kernels includes 2 N 1-bit convolution kernel candidates of size K×K, 1≤N<K×K, performing weight quantization of the convolutional layer by selecting a 1-bit convolution kernel candidate from the subset of 1-bit convolution kernels as the 1-bit convolution kernel of the convolutional layer; and updating the 32-bit or 16-bit floating-point convolution kernels of each convolutional layer of the CNN model.

[0070] Example 10 includes the method as described in Example 9, further including: when the number of training iterations of the CNN model has not reached a preset number of iterations, for the convolutional layer of the CNN model, refining the subset of 1-bit convolution kernels, and performing weight quantization of the convolutional layer by selecting a 1-bit convolution kernel candidate from the refined subset of 1-bit convolution kernels as the 1-bit convolution kernel of the convolutional layer, wherein the refined subset of 1-bit convolution kernels includes 2 N 1-bit convolution kernel candidates of size K×K.

[0071] Example 11 includes the method as described in Example 9, wherein the subset of 1-bit convolution kernels is shared by all convolutional layers of the CNN model.

[0072] Example 12 includes the method as described in Example 9, wherein the subset of 1-bit convolution kernels is specific to the convolutional layer.

[0073] Example 13 includes the method as described in Example 12, wherein the subsets of 1-bit convolution kernels assigned to different convolutional layers of the CNN model include the same number of 1-bit convolution kernel candidates.

[0074] Example 14 includes a method as described in Example 12, wherein the 1-bit convolution kernel subsets assigned to different convolutional layers of the CNN model include different numbers of 1-bit convolution kernel candidates.

[0075] Example 15 includes the method of Example 9, wherein the 1-bit convolution kernel candidates of the 1-bit convolution kernel subset are predefined.

[0076] Example 16 includes a method as described in Example 9, wherein the 1-bit convolution kernel candidates of the 1-bit convolution kernel subset are randomly selected from a 1-bit convolution kernel set including all possible 1-bit convolution kernel candidates or a portion thereof.

[0077] Example 17 includes the method of Example 9, wherein the objective function of the network quantization of the CNN model is defined as follows:

[0078]

[0079] in, is the 1-bit convolution kernel subset, is the set of quantized weights of the convolutional layer, and W l is the set of 32-bit or 16-bit floating-point weights of the convolutional layer.

[0080] Example 18 includes a machine-readable medium having instructions stored thereon, wherein the instructions, when executed by a processor circuit, cause the processor circuit to perform the method of any one of claims 1 to 17.

[0081] Example 19 includes an apparatus for a convolutional neural network (CNN), the apparatus comprising means for performing the method of any one of claims 1 to 17.

[0082] Example 20 includes a device for a convolutional neural network (CNN), comprising: a memory having instructions stored thereon; and a processor circuit coupled to the memory, wherein the instructions, when executed by the processor circuit, cause the processor circuit to perform a method as described in any one of claims 1 to 17.

[0083] The above detailed description includes reference to the accompanying drawings, which form a part of the detailed description. The accompanying drawings illustrate specific embodiments that can be implemented. These embodiments are also referred to as "examples" in this article. Such examples may include additional elements other than those shown or described. However, the inventors also contemplate examples in which only those elements shown or described are provided. In addition, the inventors also contemplate examples (or one or more aspects thereof) using any combination or arrangement of those elements shown or described, whether for a specific example (or one or more aspects thereof), or for other examples (or one or more aspects thereof) shown or described herein.

[0084] All publications, patents, and patent documents cited in this document are hereby incorporated by reference in their entirety, as if individually incorporated by reference. In the event of inconsistent usages between this document and those documents so incorporated by reference, the usage in the incorporated reference(s) should be considered supplementary to that of this document; for irreconcilable inconsistencies, the usage in this document controls.

[0085] In this document, the term "a" is used to include one or more than one, as is common in patent documents, independent of any other instance or use of "at least one" or "one or more". In this document, the term "or" is used to refer to a non-exclusive or, so that "A or B" includes "A but not B", "B but not A", and "A and B", unless otherwise indicated. In the appended claims, the terms "including" and "wherein" are used as the plain English equivalents of the corresponding terms "comprising" and "wherein". In addition, in the appended claims, the terms "including" and "comprising" are open-ended, that is, systems, devices, articles, or processes that include other elements in addition to those listed after such terms in the claims are still considered to fall within the scope of the claim. In addition, in the appended claims, the terms "first", "second", and "third", etc. are used merely as labels and are not intended to impose numerical requirements on their objects.

[0086] The above description is intended to be illustrative, not restrictive. For example, the above examples (or one or more aspects thereof) may be used in combination with each other. Other embodiments (for example) may be used by a person of ordinary skill in the art after viewing the above description. The abstract is to allow the reader to quickly determine the nature of the technical disclosure and is submitted with the understanding that it will not be used to interpret or limit the scope or meaning of the claims. In addition, in the above detailed description, various features may be grouped together to simplify the disclosure. This should not be interpreted as a desire that unclaimed public features are necessary for any claim. More precisely, the subject matter of the invention may be present in less than all the features of a particular disclosed embodiment. Thus, the attached claims are incorporated herein into the "Detailed Description" section, with each claim acting independently as a separate embodiment. The scope of the embodiment should be determined with reference to the attached claims and the full scope of equivalents to which such claims are entitled.

Claims

1. A method for quantizing a convolutional neural network (CNN) model, comprising: for a convolutional layer of the CNN model: A subset of 1-bit convolution kernels is assigned to the convolution layer, where: The convolutional layer includes a 32-bit or 16-bit floating-point convolutional kernel of size K×K, and the subset of 1-bit convolutional kernels includes 2 N 1-bit convolutional kernel candidates of size K×K, where 1 ≤ N < K×K, and both K and N are positive integers; and Weight quantization of the convolution layer is performed by selecting a 1-bit convolution kernel candidate from the 1-bit convolution kernel subset as the 1-bit convolution kernel of the convolution layer.

2. The method of claim 1, wherein: The 1-bit convolution kernel subset is shared by all convolutional layers of the CNN model.

3. The method of claim 1, wherein: The 1-bit convolution kernel subset is specific to the convolution layer.

4. The method of claim 3, wherein: The 1-bit convolution kernel subsets assigned to different convolution layers of the CNN model include the same number of 1-bit convolution kernel candidates.

5. The method of claim 3, wherein: The 1-bit convolution kernel subsets assigned to different convolution layers of the CNN model include different numbers of 1-bit convolution kernel candidates.

6. The method of claim 1, wherein: The 1-bit convolution kernel candidates of the 1-bit convolution kernel subset are predefined.

7. The method of claim 1, wherein: The 1-bit convolution kernel candidates of the 1-bit convolution kernel subset are randomly selected from the following 1-bit convolution kernel set: the 1-bit convolution kernel set includes all possible 1-bit convolution kernel candidates or a part of them.

8. The method of claim 1, wherein: The objective function of the network quantization of the CNN model is defined as follows: in, is the 1-bit convolution kernel subset, is the set of quantized weights of the convolutional layer, and W l is the set of 32-bit or 16-bit floating-point weights of the convolutional layer.

9. A method for training a convolutional neural network (CNN) model, comprising: For the convolutional layer of the CNN model, Allocate a subset of 1-bit convolutional kernels to the convolutional layer, where the convolutional layer includes 32-bit or 16-bit floating-point convolutional kernels of size K×K, and the subset of 1-bit convolutional kernels includes 2 N candidate 1-bit convolutional kernels of size K×K, 1≤N<K×K, and both K and N are positive integers. performing weight quantization of the convolution layer by selecting a 1-bit convolution kernel candidate from the 1-bit convolution kernel subset as the 1-bit convolution kernel of the convolution layer; and Update the 32-bit or 16-bit floating-point convolution kernel of each convolutional layer of the CNN model.

10. The method of claim 9, further comprising: When the number of training iterations of the CNN model does not reach a preset number of iterations, for the convolutional layer of the CNN model, Refine the 1-bit convolution kernel subset, and performing weight quantization of the convolutional layer by selecting a 1-bit convolutional kernel candidate from the refined 1-bit convolutional kernel subset as the 1-bit convolutional kernel of the convolutional layer, The refined 1-bit convolution kernel subset includes 2 N There are K×K 1-bit convolution kernel candidates.

11. The method of claim 9, wherein: The 1-bit convolution kernel subset is shared by all convolutional layers of the CNN model.

12. The method of claim 9, wherein: The 1-bit convolution kernel subset is specific to the convolution layer.

13. The method of claim 12, wherein: The 1-bit convolution kernel subsets assigned to different convolution layers of the CNN model include the same number of 1-bit convolution kernel candidates.

14. The method of claim 12, wherein: The 1-bit convolution kernel subsets assigned to different convolution layers of the CNN model include different numbers of 1-bit convolution kernel candidates.

15. The method of claim 9, wherein: The 1-bit convolution kernel candidates of the 1-bit convolution kernel subset are predefined.

16. The method of claim 9, wherein: The 1-bit convolution kernel candidates of the 1-bit convolution kernel subset are randomly selected from the following 1-bit convolution kernel set: the 1-bit convolution kernel set includes all possible 1-bit convolution kernel candidates or a part of them.

17. The method of claim 9, wherein: The objective function of the network quantization of the CNN model is defined as follows: in, is the 1-bit convolution kernel subset, is the set of quantized weights of the convolutional layer, and W l is the set of 32-bit or 16-bit floating-point weights of the convolutional layer.

18. A computer readable medium having instructions stored thereon, wherein: When the instructions are executed by a processor circuit, the processor circuit is caused to perform any method according to claims 1 to 17 .

19. An apparatus for a convolutional neural network (CNN), comprising means for performing any of the methods of claims 1 to 17.

20. An apparatus for a convolutional neural network (CNN), comprising: a memory having instructions stored therein; as well as A processor circuit is coupled to the memory, wherein the instructions, when executed by the processor circuit, cause the processor circuit to perform any of the methods of claims 1 to 17.