An image classification method based on a full-quantization VGG style convolutional neural network

By improving the reparameterized network structure and lookup table inference, the stability and efficiency problems of image classification algorithms under low bit quantization are solved, achieving high image classification performance and hardware friendliness, and making it suitable for devices with low computing power.

CN119152250BActive Publication Date: 2026-11-27BEIJING INST OF TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411058129.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-02
Publication Date
2026-11-27
Estimated Expiration
2044-08-02

AI Technical Summary

Technical Problem

Existing image classification algorithms suffer from high hardware resource consumption and performance degradation after quantization in scenarios with high energy efficiency requirements. In particular, heavily parameterized networks are difficult to train and deploy stably when using low-bit quantization.

Method used

An improved reparameterization strategy is adopted, introducing an additional batch regularization layer and lookup table. Combined with a learning quantization step size algorithm, the network structure is optimized and low-bit quantization perceptual training is performed. The inference is converted into lookup table inference, which simplifies the network structure and avoids full-precision computation.

Benefits of technology

It significantly improves the accuracy and inference speed of image classification after low-bit quantization, reduces hardware resource consumption, and is suitable for devices with low computing power.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119152250B_ABST
    Figure CN119152250B_ABST
Patent Text Reader

Abstract

The application relates to an image classification method based on a full-quantization VGG style convolutional neural network, and belongs to the technical field of artificial intelligence and image processing. First, a full-precision image classification network is pre-trained to provide good initialization weights with high precision and quantization friendliness for low-bit quantization. Then, low-bit quantization perception training is carried out to obtain excellent low-bit quantization VGG style convolutional neural network weights. Low-precision-high-precision number conversion mapping, batch regularization layers and activation layers in the quantized network are fused and merged into a lookup table parameter, and the remaining convolutional layer network parameters are converted from floating point number representation low pseudo low-precision integer into real low-precision integer network parameters for deployment. The converted image classification network is used for image classification. The application greatly improves the performance of the low-bit quantization VGG style convolutional neural network, improves the accuracy and inference speed of image classification, and has high practical application value.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to an image classification method based on a fully quantized VGG-style convolutional neural network, specifically an image classification method based on a lookup table to implement fully quantized inference of a VGG-style convolutional neural network, belonging to the field of artificial intelligence and image processing technology. Background Technology

[0002] Image classification is a crucial image understanding task, aiming to determine the specific category of an input image. In recent years, deep neural networks (DNNs) have made significant progress in computer vision, natural language processing, and speech recognition, achieving remarkable results in image classification as well. Thanks to increasingly efficient network structures and ever-increasing computational and parameter volumes, the performance of DNN-based image classification algorithms has continuously improved. However, in practical applications, the ever-growing computational demands of these algorithms necessitate their deployment on high-performance computing devices (such as GPUs and FPGA servers), resulting in very high energy consumption. Many real-world applications, such as autonomous driving, always-on devices, and mobile devices, can only provide limited computational power and energy. Therefore, designing a simple, low-energy-consumption image classification algorithm while maintaining state-of-the-art performance is crucial for the practical application of image classification technology.

[0003] Existing research on image classification algorithms and efficient deep neural network inference techniques mainly includes network search, network pruning, and network quantization. Among these, network quantization is the most direct and effective method. Its purpose is to reduce the bit width of DNN weights and activation values, and to use lower-precision integers, or even binary XOR operations (XNOR), for DNN inference, thereby significantly reducing the hardware resource overhead of the network model during inference, saving memory usage, and reducing energy consumption during the inference stage. Uniform quantization is a commonly used quantization method, which maps full-precision values ​​uniformly to integer representations using the same step size. DoReFa-Net uses quantization gradients for network quantization. LSQ utilizes the gradients from backpropagation to learn the quantization step size. Some existing works have also considered applying non-uniform mapping quantization. LQ-Nets obtain non-uniform quantization levels by learning a set of floating-point values. Miyashita uses quadratic power (PoT) values ​​to represent weights and activations. Li further proposed additive power of two (APoT) to better match the data distribution. Recently, Wang proposed learning lookup tables as quantizers. These efforts have enabled DNNs to operate at very low bit rates with even better performance. However, these network quantization efforts typically focus on quantizing convolutional and fully connected layers, as these consume the majority of the computation during DNN inference, and their computational operations are still performed at full precision, such as batch normalization, residuals, and first and last layers. This issue means that high-precision computing hardware is still required when deploying image classification networks, and it introduces data precision conversion problems, which to some extent offsets the efficiency advantages of quantization in image classification.

[0004] The second shortcoming in current image classification algorithm research is the lack of consideration for joint design with network architecture and network quantization. Instead, quantization algorithms are typically applied to existing classic networks for testing, such as VGG and ResNet. This leads to two problems. First, many state-of-the-art networks aim for optimal performance across the full precision domain. While these networks boast highly efficient architectures and state-of-the-art performance, and have achieved a certain balance between computation and parameter count during design, their more complex network structures and data flows result in additional hardware resource overhead. Related research indicates that many efficient network architectures can experience performance degradation after quantization, such as EfficientNet and MobileNets. This quantization degradation problem limits the performance of image classification algorithms in energy-efficient scenarios.

[0005] Recently, reparameterization techniques have provided a new design perspective for improving the efficiency of image classification algorithms. Reparameterization introduces structural priors, helping simple network modules learn optimal parameters. It simplifies the network structure during inference and reduces computational overhead while maintaining the same performance. Simple reparameterization strategies typically use Batch Normalization (BN) folding and convolutional fusion strategies. RepVGG enhances the performance of VGG-type networks through structural priors, retaining only convolutions and activation functions for inference. This significantly simplifies the model structure, improves computational friendliness, and elevates reparameterization to a new level. MobileOne extends reparameterized networks to mobile devices, achieving high-level performance with millisecond-level latency. Recently, reparameterization techniques for network architectures such as CNNs, MLPs, and Transformers have been extensively explored. These strategies have been widely used in low-level vision tasks and various high-level vision tasks.

[0006] While reparameterization techniques offer simplified network structures and advanced performance, they suffer from quantization collapse, a problem common to many efficient image classification algorithms. Some works have attempted to quantize RepVGG to INT8, but achieving lower bit quantization remains challenging. Furthermore, reparameterized RepVGG lacks batch normalization, making quantization-aware training (QAT) methods difficult to apply; adding batch normalization (BN) to reparameterized networks without sacrificing performance is also extremely difficult. Quantization of reparameterized networks remains a pressing issue. Summary of the Invention

[0007] The purpose of this invention is to address the shortcomings and defects of existing technologies by creatively proposing an image classification method based on a fully quantized VGG-style convolutional neural network. This invention improves the strategy of using reparameterization to enhance network quantization performance, significantly improving the performance of VGG-style image classification networks after low-bit full quantization, thereby enhancing the accuracy and inference speed of image classification.

[0008] This method mainly includes the pre-training full-precision image classification network stage, the low-bit quantization perception training stage, the classification model conversion stage, and the classification model deployment stage.

[0009] In the pre-training stage of the full-precision image classification network, an improved quantization-friendly reparameterization network is pre-trained to obtain a high-performance, quantization-friendly full-precision image classification network. This stage provides good initial values ​​for subsequent low-bit quantization-aware training, helping to improve the network performance after low-bit quantization. Existing reparameterization networks suffer from large variances in weights and activations, which, despite their advanced performance, are not conducive to network quantization and lead to performance degradation after quantization. A good quantization initialization weight should have two characteristics: smaller variance in weights and activations, and smaller quantization error. To address this issue, this invention selects an improved quantization-friendly reparameterization network for full-precision pre-training. Firstly, an additional batch regularization layer is added to the original three reparameterization branches to reduce heteroscedasticity caused by branch addition. Secondly, the batch regularization layers in the residual branch and the 1×1 branch are removed to avoid extreme values ​​and variance amplification caused by the ReLU activation function. This improvement significantly enhances the performance of the quantized model.

[0010] In the low-bit quantization-aware training phase, the learned quantization step size (LSQ) algorithm is used to achieve low-bit quantization. Since the reparameterized network does not retain batch regularization during the inference phase, gradient explosion and vanishing problems occur during QAT (Qimitation Aware Training) with the learned quantization step size, making it difficult for the network to converge effectively and leading to a degradation in image classification performance. To address this issue, this invention proposes adding an additional batch regularization layer to the reparameterized main branch, which is retained during the QAT phase, thereby effectively stabilizing gradients during training. This strategy significantly improves network performance and enables the network to operate even with a 2-bit width.

[0011] In the classification model conversion stage, the trained low-bit quantized network is converted into deployable network weight data. To further accelerate inference and completely avoid full-precision computation during the inference stage, we propose using a look-up table to replace the remaining full-precision operations in the quantized network. These operations include the low-precision-to-high-precision number transformation mapping generated by the quantization strategy, batch regularization layers, and activation layers. Thanks to rigorous mathematical derivation and code implementation, the converted network model can replace the original computational operations with more efficient equivalents, thus avoiding any performance loss.

[0012] During the classification algorithm deployment phase, the converted low-bit quantized network is imported into the computing hardware (ASIC) for actual inference computation. This computing hardware is implemented using an FPGA and runs the implemented perception algorithm only at low-precision integers.

[0013] To achieve the above objectives, the present invention employs the following technical solutions.

[0014] An image classification method based on a fully quantized VGG-style convolutional neural network includes the following steps:

[0015] Step 1: Pre-train a full-precision image classification network to provide good initial weights for the quantization stage; by constructing a quantization-friendly reparameterized image classification network model and optimizing the reparameterized network structure, quantization-friendly network weights are obtained while maintaining accuracy.

[0016] The reparameterized network introduces structural priors. During training, the original reparameterized module consists of a 3×3 convolutional branch difference, a 1×1 convolutional branch, and a residual branch with batch regularization. Each branch has a batch regularization layer, and the results of the three branches are summed and activated using the ReLU function. Additional batch regularization is added after the three branches, while the batch regularization in the residual branch and the 1×1 branch is removed.

[0017] Step 2: Train the obtained quantization-friendly reparameterized image classification network model using a low-bit quantization-aware training method to obtain a low-precision VGG-style image classification network.

[0018] During training, batch regularization of the main branch is retained, and a lookup table is used to replace batch regularization during subsequent deployment.

[0019] Step 3: Calculate the lookup table parameters based on the image classification network parameters;

[0020] The resulting low-precision VGG-style image classification network is converted into a fully quantized image classification network using lookup table inference.

[0021] Step 4: Deploy the transformed image classification network into the computing system and use the image classification network for image classification. During this process, the network parameters are kept fixed and will not be updated or transformed further.

[0022] Beneficial effects

[0023] Compared with the prior art, the present invention has the following advantages:

[0024] This invention is the first to propose using lookup tables for low-bit inference in deep neural networks and constructs the first low-bit quantization VGG-style convolutional neural network image classification algorithm. This method employs a reparameterization strategy and a stable quantization-based perceptual training strategy, significantly improving the performance of low-bit quantization VGG-style convolutional neural networks. Simultaneously, this invention provides a new approach to the quantization and deployment of neural networks, greatly enhancing the accuracy and inference speed of image classification, and possesses high practical application value. Attached Figure Description

[0025] Figure 1 This is a schematic diagram of the process of the present invention;

[0026] Figure 2 This is a general framework diagram of the present invention;

[0027] Figure 3 This is a schematic diagram of the fully quantized, high-efficiency reasoning principle of the present invention;

[0028] Figure 4 The training curve of this invention;

[0029] Figure 5 This is a visualization of the weights and activation values ​​of the present invention. Detailed Implementation

[0030] The present invention will now be described in further detail with reference to the accompanying drawings and embodiments.

[0031] like Figure 1 As shown, an image classification method based on a fully quantized VGG-style convolutional neural network includes the following steps:

[0032] Step 1: Pre-train a full-precision image classification network. This includes the following steps:

[0033] First, we construct a quantization-friendly, highly parameterized image classification network model.

[0034] Pre-trained full-precision image classification networks are used to provide good initial weights for the quantization stage. Good initial weights should have two characteristics: good accuracy and quantization friendliness. Reparameterization techniques can preserve the minimalist VGG-style network structure and performance during inference; however, this technique inherently suffers from quantization collapse. Current reparameterization techniques do not preserve batch regularization during quantization, leading to gradient vanishing and exploding problems during quantization-aware training.

[0035] To address the above issues, this invention optimizes the reparameterized network structure to obtain quantization-friendly network weights while maintaining accuracy.

[0036] Specifically, reparameterized networks introduce structural priors. During training, each reparameterized module includes multiple branches and multiple convolutional and batch regularization operations. These operations are all linear transformations and can be integrated into a single convolutional module during inference, thereby reducing network computation and accelerating computation.

[0037] The original reparameterization module consists of a 3×3 convolutional branch difference, a 1×1 convolutional branch, and a residual branch with batch regularization. Each branch has a batch regularization layer. The results of the three branches are summed and activated using the ReLU function. Through batch regularization folding and convolutional kernel fusion, these three branches can be transformed into a single convolution with almost no performance loss at full precision. However, this structure results in large variance and heteroscedasticity of network weights and activations, and introduces an inherent quantization collapse problem.

[0038] To address this issue, this invention improves the reparameterization prior. The sum of the three branches leads to heteroscedasticity, which can be resolved by adding additional batch regularization after the three branches. Simultaneously, adding batch regularization to the residual and 1×1 branches amplifies the extreme values ​​and variance caused by the previous ReLU activation function; therefore, the batch regularization in these branches should be removed. By adopting these two improvements, quantization-friendly initial full-precision weight parameters can be obtained, significantly improving the performance of the final quantized network.

[0039] For example, a full-precision model was trained for 120 epochs on the ImageNet-1K image classification dataset. Gradient descent optimization was performed on mini-batch data in each iteration, with a batch size of 256. The SGD optimizer was used, with an initial learning rate of 0.1, which was gradually reduced to 0 following a cosine curve. After training the full-precision network, the three branches were folded into individual 3×3 convolutions to obtain the deployment state, ready for subsequent initialization of the quantized network.

[0040] The transformation process includes convolution and batch regularization fusion strategies and multi-convolution kernel fusion strategies. First, consider the batch regularization operation, expressed as:

[0041]

[0042] Here, BN stands for Batch Regularization, X is the input to BN, μ and σ are the mean and variance of X, respectively, and γ and β are learnable affine transformation parameters. During training, μ and σ are updated using a moving average (EMA) strategy, while γ and β are trained directly using gradients.

[0043] Since both batch regularization and convolution are linear transformations, batch regularization can be incorporated into the convolution module, and the final parameters are expressed as follows:

[0044]

[0045] Where W and W′ are the convolution kernels before and after fusion, respectively, and b and b′ are the biases before and after fusion, respectively.

[0046] When fusing multiple convolutional kernels of different sizes, the final convolutional kernel is the largest among all the kernels to be fused. The remaining kernels are then padded with zeros to align with the largest kernel. Ultimately, the multi-kernel fusion strategy can be expressed as:

[0047]

[0048] in, W'0 represents the identity matrix corresponding to the residual, W'1 represents the fused 1×1 convolution kernel, and W'3 represents the unfused 3×3 convolution kernel.

[0049] Step 2: Low-bit quantization-aware training. The quantization-friendly reparameterized image classification network model is trained using a low-bit quantization-aware training method to obtain a low-precision VGG-style image classification network that uses low-precision integers for computation.

[0050] Specifically, to address the training instability issue caused by the lack of batch regularization during inference in reparameterized networks, batch regularization of the main branch is retained during the quantization-aware training phase, and a lookup table is used to replace batch regularization during subsequent deployment.

[0051] The network is trained with quantization awareness using the Learned Quantization Step Size (LSQ) method. LSQ is a uniform quantization method that establishes a linear mapping between floating-point numbers and the quantized low-bit integers. For quantization compensation S, the network contains the unquantized floating-point number F and the quantized integer I. The relationship between them can be expressed as:

[0052]

[0053] Among them, Q n =-2 n-1 and Q p =2 n-1 -1 represents the upper and lower bounds of the n-bit integer representation, respectively. Clip(x) is a truncation operation that truncates x into a floating-point number between -1 and 1. This represents the floor operation. For an integer I, it can be reversed and mapped to the floating-point field, and is called a pseudo-quantized floating-point number. Represented as:

[0054]

[0055] During quantization-aware training, the above mapping relationship allows the use of quantized pseudo-quantized floating-point numbers to simulate uniform integer operations using floating-point arithmetic. However, since quantization rounding is a non-differentiable operation, gradient backpropagation and network training present inherent difficulties. A commonly used approach is direct gradient backpropagation (STE), which directly backpropagates the gradient to the variable through rounding operations.

[0056] The full-precision network parameters obtained in step 1 are used as initial values, and the batch regularization layer is retained in the quantization-aware training.

[0057] In this embodiment, the network is trained for 90 cycles, and a cosine curve is used to decay the learning rate. The initial learning rate is set to 0.01.

[0058] Step 3: Calculate the lookup table parameters based on the image classification network parameters.

[0059] The resulting low-precision VGG-style image classification network is converted into a fully quantized image classification network using lookup table inference, further reducing the computational overhead and hardware resource consumption of the image classification network.

[0060] VGG-style convolutional neural networks are characterized by their extremely simple structure, avoiding skip connections during inference. In the quantized network, the operation between two low-precision convolutional layers involves: converting the activations output from the previous convolutional module from low precision to full precision, performing Batch Normalization (BN), ReLU, and converting the activations from full precision to low-precision integers before feeding them into the next convolutional module for computation. For example... Figure 2 As shown, all these transformations start with low-precision integers and ultimately output low-precision integers, especially BN and ReLU, which need to be run in full precision. Therefore, all these non-convolutional operations are transformed into lookup table operations to achieve fully quantized neural network inference.

[0061] Given that the output Y of the previous convolution is a low-precision integer, and Z, which will be fed into the next convolution, is also a low-precision integer, all transformations between them can be represented as:

[0062]

[0063] Where LUT stands for lookup table operation, and Θ represents the parameters of the lookup table. z S represents the quantization multiplier of the activation values ​​of the next convolutional layer. y S represents the quantization multiplier of the current convolutional layer activation values. w This represents the quantization multiplier of the current convolutional layer weights; M and N represent the quantization multiplier and bias after fusion, respectively. `clip` indicates this.

[0064] like Figure 3As shown, the lookup table transforms the original four computations into a single, simple, and fast lookup table operation, avoiding full-precision computation. While full-quantization inference can also be achieved through quantized Batch Normalization (BN), this approach leads to training instability, precision degradation, and still requires retaining the other three computational operations. In contrast, the hardware implementation of LUTs is highly efficient, especially on specially optimized computing devices, where it exhibits significantly lower hardware overhead.

[0065] Step 4: Use an image classification network to perform image classification reasoning and application. During this process, the network parameters are fixed and will not be updated or transformed.

[0066] Specifically, the transformed image classification network is deployed into a computing system. This system can be a server supporting low-precision computation or a dedicated FPGA computing device.

[0067] After preprocessing by image cropping and resizing, the input image data is fed into the computing system for image classification calculation and inference, outputting the image's depth features or category information. The accuracy of the image classification network can be evaluated by comparing the image category information with the true labels.

[0068] The image data to be processed is fed into the computing system for calculation and inference to obtain the extracted image depth features or image category information. Based on the true labels of the image data, the accuracy of the network classification is calculated to determine the final precision performance.

[0069] The deep features extracted by image classification networks can also be further applied to other applications such as image re-identification, image search, and abnormal image detection, providing reliable technical support for various applications and having high practical application value.

Claims

1. An image classification method based on a fully quantized VGG-style convolutional neural network, characterized in that, This includes pre-trained full-precision image classification networks, low-bit quantization perceptual training, classification model conversion, and classification model deployment; Step 1: Pre-train a full-precision image classification network to provide good initial weights for the quantization stage; by constructing a quantization-friendly reparameterized image classification network model and optimizing the reparameterized network structure, quantization-friendly network weights are obtained while maintaining accuracy. Reparameterized networks introduce structural priors; during training, the original reparameterized modules include... Convolution branch difference, The convolutional branch and the residual branch with batch regularization, each branch having a batch regularization layer, are summed at the end and activated using the ReLU function. Additional batch regularization is added after the three branches, while the residual branch and... Batch regularization in branches; The batch regularization operation is represented as follows: Where BN represents batch regularization. It is the input of BN. and They are The mean and variance, and These are learnable affine transformation parameters; during training, and Update using a moving average strategy. and Training is performed directly using gradients; Batch regularization is incorporated into the convolutional module, and the final parameters are expressed as follows: in and These are the convolutional kernels before and after fusion, respectively. and These are the biases before and after fusion, respectively; Step 2: Train the obtained quantization-friendly reparameterized image classification network model using a low-bit quantization-aware training method to obtain a low-precision VGG-style image classification network. During training, batch regularization of the main branch is retained, and a lookup table is used to replace batch regularization during subsequent deployment. The network is trained using a method that learns quantization step size; For quantization compensation S, the floating-point number in the network before quantization... and quantized integers , is represented as: in, and , respectively represent the upper and lower bounds of the value represented by the n-bit integer; Clip(x) is the truncation operation, which truncates x into a floating-point number between -1 and 1; Indicates the rounding operation; For integers It can be reverse-mapped to the floating-point field, and is called pseudo-quantized floating-point number. , is represented as: During the quantization-sensing training process, the above mapping relationship is used to simulate integer uniformity by using quantized pseudo-quantized floating-point numbers and floating-point operations; at the same time, the gradient is directly fed back to the variable through the rounding operation. Step 3: Calculate the lookup table parameters based on the image classification network parameters; The resulting low-precision VGG-style image classification network is converted into a fully quantized image classification network using lookup table inference. Transform all non-convolutional operations into lookup table operations to achieve fully quantized neural network inference; For the output of the previous convolutional layer For low-precision integers, and the ones that will be fed into the next convolutional layer. For all low-precision integers, all transformations between them are represented as follows: in, For table lookup operations, For parameters of the lookup table; This represents the quantization multiplier for the activation values ​​of the next convolutional layer. This represents the quantization multiplier of the current convolutional layer activation values. This represents the quantization multiplier of the current convolutional layer weights; and These represent the quantization multiplier and bias after fusion, respectively; Here, B is the activation function; BN represents batch regularization. It is the input of BN. and They are The mean and variance, and These are learnable affine transformation parameters; and , respectively represent the upper and lower bounds of the value represented by the n-bit integer; Step 4: Deploy the transformed image classification network into the computing system and use the image classification network to perform image classification; during this process, the network parameters are fixed and will not be updated or transformed again. The process involves feeding the image data to be processed into a computing system for calculation and inference to obtain the extracted image depth features or image category information; and calculating the accuracy of network classification based on the true labels of the image data to determine the final precision performance.

2. The image classification method based on a fully quantized VGG-style convolutional neural network as described in claim 1, characterized in that, In step 1, when fusing multiple convolutional kernels of different sizes, the final convolutional kernel is the largest among all the convolutions to be fused, and the remaining convolutional kernels are padded with zeros. To align with the largest convolutional kernel; finally, the multi-kernel fusion strategy is expressed as: in, This represents the fused convolutional kernel. This represents the identity matrix corresponding to the residual. Indicates fusion Convolution kernel, Indicates before fusion Convolution kernel.

3. The image classification method based on a fully quantized VGG-style convolutional neural network as described in claim 1, wherein the computing system is a server that supports low-precision computation.

4. The image classification method based on a fully quantized VGG-style convolutional neural network as described in claim 1, wherein the computing system is an FPGA computing device.