# A Methodology to Design Quantized Deep Neural Networks for Automatic Modulation Recognition
## 5 Analysis and Results
### Stage 3: Data Dispersion and Spearman Mapping, Distribution of the Results by Layer  
We obtained the accuracy and the inference cost for each configuration \((i8,a8,w)\) in which the quantized value for the weights in a given layer were varied. Then, we analyzed the data distribution of those results, i.e., whether it was possible to define a specific behavior that would shed light on possible alternatives for quantification by layer discrimination. Figure 5a shows the box plot of the mean, median, and quartiles of the results obtained in the previous stage per layer and their impact on the inference cost. The figure shows that NICS is symmetric in the bit range used in the experiments. In this sense, it is observed that layer two (CNN L2) has the most significant impact on the reduction of the NICS, and to a lesser extent, layers three (CNN L3) and four (CNN L4). However, the input layer (CNN L1) does not significantly impact the computational cost reduction when quantified in the range of 2 to 8 bits. As for the FC layers, it is observed that the first dense layer (D1) significantly reduces the computational cost when quantized, but the output layer (D3) does not. Furthermore, Figure 5a shows that each quantized layer has an exponential effect on the computational cost reduction; this behavior is due to the max pooling filter applied to the output of the convolutional layers. Similarly, Figure 5b shows the box plot of the results obtained and their impact on accuracy. From the figure, we can see that the quantization of each layer does not have a clear effect or general behavior regarding accuracy. This indicates that each layer could be quantized independently to achieve good accuracy with a lower computational cost. Nevertheless, we still need to determine the recommended quantization level for each model layer. \begin{table}
\begin{tabular}{l c c c c c c c c c c} \hline \hline \multirow{2}{*}{**VG10 1D CNN**} & \multicolumn{10}{c}{**Run**} \\ \cline{2-11}  & **1** & **2** & **3** & **4** & **5** & **6** & **7** & **8** & **9** & **10** \\ \hline
**Conv 1 (CNN L1)** & **2** & 8 & 8 & 8 & 8 & 8 & 8 & 8 & 8 & 8 \\
**Conv 2 (CNN L2)** & 8 & **2** & 8 & 8 & 8 & 8 & 8 & 8 & 8 & 8 \\
**Conv 3 (CNN L3)** & 8 & 8 & **2** & 8 & 8 & 8 & 8 & 8 & 8 \\
**Conv 4 (CNN L4)** & 8 & 8 & 8 & **2** & 8 & 8 & 8 & 8 & 8 \\
**Conv 5 (CNN L5)** & 8 & 8 & 8 & 8 & **2** & 8 & 8 & 8 & 8 \\
**Conv 6 (CNN L6)** & 8 & 8 & 8 & 8 & 8 & **2** & 8 & 8 & 8 & 8 \\
**Conv 7 (CNN L7)** & 8 & 8 & 8 & 8 & 8 & 8 & **2** & 8 & 8 & 8 \\
**FC 1 (D1)** & 8 & 8 & 8 & 8 & 8 & 8 & 8 & **2** & 8 & 8 \\
**FC 2 (D2)** & 8 & 8 & 8 & 8 & 8 & 8 & 8 & **2** & 8 \\
**FC out (D3)** & 8 & 8 & 8 & 8 & 8 & 8 & 8 & 8 & **2** & 8 \\ \hline \hline \end{tabular}
\end{table} 
Table 3: Example of quantization in each layer independently; in this case, the inputs and activations were statically set to a given value (e.g., 8 bits) while the quantization values of the weights were varied in each run at a given layer (e.g., 2 bits). To determine the recommended quantization level per layer, we calculated the Spearman's correlation coefficient with the results obtained from the previous stage. Figure 6 shows a box plot with Spearman's correlation. As can be observed, it is possible to measure how strong the relationship is between each layer and the accuracy (see Figure 6a) and the inference cost (see Figure 6b) is. Concerning the accuracy, we observe that the results are dispersed. However, in most cases, the median of the data is above or below \(\rho=0\), indicating a possible direction at the quantization level; that is, the quantization level should be increased (\(\rho>0\)) or decreased (\(\rho<0\)). In the case of the inference cost, we observe that there is no dispersion in the results. Only layers one, six, and fully connected layer two showed minimal dispersion. However, a similar approach can be followed to define the direction at the quantization level.