# ClipQ: Clipping Optimization for the Post-Training Quantization of Convolutional Neural Network
## 4 Experiments
### Object Detection and Semantic Segmentation  
The performance of ClipQ on object detection and semantic segmentation tasks is shown in this section. Object detection networks can be divided into one-stage networks and two-stage networks. Compared with the two-stage network, the one-stage network has a faster detection speed, so it is often used in mobile devices. SSD, Yolo, and RetinaNet are classic one-stage networks, and their quantization results are shown in Tables 2 and 3. Among them, the backbone of RetinaNet is ResNet50, so the model size is larger. The backbone of YoloV3 and SSD are both MobileNetV2. CSPDarknet with the depth factor of 0.33 and the width factor of 0.375 is the backbone of YoloX. As one can see, for 8-bit quantization, the precision (MAP) degradation caused by ClipQ is 0.2% \(\sim\) 0.4%.  
Further quantizing the model to 6 bits, ClipQ achieves 35.9 accuracy on RetinaNet. Compared with Jacob and ACIQ, the accuracy is improved by 0.6%. For YoloV3, YoloX, and SSD, the advantages of ClipQ are more obvious. It results in 2.5%, 1.6%, 1% accuracy degradation, respectively. The performance of Jacob and ACIQ is terrible. Especially for YoloV3, they result in more than a 5% accuracy drop. The nonlinear activation functions LeakReLu and Swish are used in YoloV3 and YoloX. It seems like they are not friendly to quantization, although they improve the performance of the floating-point networks to a certain extent. We intuitively show the quantization results of the object detection network in Figure 10. As will be readily seen, ClipQ is closer to the floating-point model in both category accuracy and target box position compared to ACIQ and Jacob.  
To demonstrate the applicability of our method to semantic segmentation, we apply ClipQ for FCN, PSPNet, DeepLabV3+, PSANet, and GCNet. The results are also listed in Tables 2 and 3. FCN is a fully convolutional network. After being proposed, it gradually became the basic framework of the semantic segmentation network. PSPNet exploits the capability of global context information by different region-based context aggregation  
\begin{table}
\begin{tabular}{c c c} \hline \hline  & **FP32** & **ClipQ** \\ \hline ResNet18 & 69.76\% & 69.69\% \\ ResNet50 & 76.13\% & 76.01\% \\ VGG11 & 70.37\% & 70.28\% \\ DenseNet121 & 74.65\% & 74.54\% \\ \hline \hline \end{tabular}
\end{table}
Table 1: The 8-bit quantization result of the nonlightweight networks.  
Figure 9: Weight standard deviation change of MobileNetV2, ShuffleNetV1, and MnasNetV1. They are sorted from smallest to largest.  
through a pyramid pooling module. DeepLab proposes atrous convolution and atrous spatial convolution pooling pyramid modules, which effectively improve the segmentation ability of the network. Along with the success of the attention mechanism in sequence tasks, it has also been widely used in semantic segmentation networks. For example, PSANet constructs the correlation of different location features through a learnable attention mask. GCNet proposes a lightweight global context module based on the Squeeze-Excitation Network. It can not only effectively model the global context but also be applied to multiple layers in a backbone network to construct a global context network.  
ClipQ performs excellently on the 8-bit quantization of the above networks. It achieves almost lossless quantization. The quantization accuracy (MIOU) of PSPNet, DeepLabV3+, and PSANet even outperforms the floating-point model. For FCN and GCNet, ClipQ only leads to 0.01% and 0.14% accuracy degradation. The 6-bit quantization results are also shown in Tables 2 and 3, and the visualization results are shown in Figure 11. ClipQ achieves better accuracy than Jacob and ACIQ. The quantization accuracy is improved by 5.04% and 2.09% on average, respectively. Especially for PSPNet, ClipQ overbears Jacob, with an advance of accuracy by 10.44%. Meanwhile, it exceeds ACIQ by 7.59%.