# A Methodology to Design Quantized Deep Neural Networks for Automatic Modulation Recognition

^{1}

^{2}

^{*}

## Abstract

**:**

## 1. Introduction

- We determine the strength of the relationship between the trainable parameters of a DNN architecture and objectives such as model performance (i.e., accuracy) and inference cost (related to model size).
- We provide a method of analysis to determine the degree of quantification that is required in each layer to achieve the desired trade-off between both objectives.

## 2. Background

#### 2.1. Quantization

#### 2.2. Quantization Frameworks

- The model is developed and trained using Brevitas since it allows designing QNNs with different quantization levels oriented to their deployment in FPGAs. One distinguishing factor of Brevitas is its ability to allow input features to be quantized. Quantizing the input features is an aspect to consider since it is a feature that is not implemented in other frameworks and provides one more source of additional reduction that counts a lot in very constraineddevices such as the FPGA.
- Once the model is trained, it is exported using the ONNX standard. ONNX enables DL models to be transformed into a portable format. This preliminary step is carried out to bring the DL model to specific hardware.
- Once the model is in a standard format, it can be translated into the FPGA logic by FINN, using the Finn-hlslib Vivado HLS FPGA library.

## 3. Related Work

#### 3.1. AMR

#### 3.2. AMR with Low Computational Cost

## 4. Design Methodology for Quantization Selection

Algorithm 1 Screening: Detection of relevant parameters. |

Require: I/Q samples data set $DS$. |

Require: DNN model M. |

Require: Set I with different number of bits to quantize the input parameter. |

Require: Set a with different number of bits to quantize the activation function parameter on all layers. |

Require: Set W with different number of bits to quantize the weight parameter on all layers. |

1: Initialize set E of experiments |

2: for $i\in I$ do |

3: Quantize M’s input with i bits |

4: for $a\in A$ do |

5: Quantize M’s activation functions with a bits |

6: for $w\in W$ do |

7: Quantize M’s weights with w bits |

8: Apply quantize-aware training to M and use dataset $DS$ |

9: $Accurac{y}_{\{}i,a,w\}\leftarrow $ Calculate accuracy of M |

10: $NICS\{i,a,w\}\leftarrow $ Calculate NICS of M |

11: $Experiment\{i,a,w\}\leftarrow $ [$NICS\{i,a,w\}$, $Accurac{y}_{\{}i,a,w\}$] |

12: $E=E\cap Experiment\{i,a,w\}$ |

13: end for |

14: end for |

15: end for |

16: Calculate Spearman’s correlation analysis on E |

17: Return E and the parameter with higher correlation with respect to accuracy and NICS |

Algorithm 2 Stage 2: Layered evaluation for weights. |

Require: I/Q samples data set $DS$. |

Require: DNN model M. |

Require: Set L with the layers of M to be quantized. |

Require: Fixed number of bits i to quantize the input parameter. |

Require: Fixed number of bits a to quantize the activation function parameter on all layers. |

Require: Set W with different number of bits to quantize the weight parameter. |

1: Initialize set E of experiments |

2: for $l\in L$ do |

3: Quantize M’s input with i bits |

4: Quantize M’s activation functions with a bits |

5: for $w\in W$ do |

6: for $p\in L\wedge p\ne l$ do |

7: Quantize layer p of model M with max [W] bits |

8: end for |

9: Quantize layer l of model M with w bits |

10: Apply quantize-aware training to M and use dataset $DS$ |

11: $Accuracy\{l,w\}\leftarrow $ Calculate accuracy of M |

12: $NICS\{l,w\}\leftarrow $ Calculate NICS of M |

13: $Experiment\{l,w\}\leftarrow $ [$NICS\{l,w\}$, $Accurac{y}_{\{}l,w\}$] |

14: $E=E\cap Experiment\{l,w\}$ |

15: end for |

16: end for |

17: Return E |

## 5. Analysis and Results

#### 5.1. Stage 1: Screening, Analyzing the Effect of Quantizing Inputs, Activations, and Weights Reference Model

#### 5.2. Stage 2: Layered Evaluation, Analyzing the Impact of Quantization per Layer

#### 5.3. Stage 3: Data Dispersion and Spearman Mapping, Distribution of the Results by Layer

#### 5.4. Stage 4: Selection of the Quantization Level per Layer

Algorithm 3 Stage 3 and 4: Layered Discriminated Quantization LDQ. |

Require: Set E from Algorithm 2 |

Require: Set L with the layers of M to be quantized |

Require:${\alpha}_{1}\in range[0,1]$ and ${\alpha}_{2}\in range[0,1]$, where ${\alpha}_{1}+{\alpha}_{2}=1$ |

1: for $l\in \left|L\right|$ do |

2: ${E}_{n}\leftarrow \left[\right]$ |

3: ${E}_{a}\leftarrow \left[\right]$ |

4: for $w\in W$ do |

5: ${E}_{n}={E}_{n}\cap E\{l,w\}\left[0\right]$ |

6: ${E}_{a}={E}_{1}\cap E\{l,w\}\left[1\right]$ |

7: end for |

8: ${S}_{a{M}_{l}}\leftarrow $ Calculate Spearman’s correlation analysis on ${E}_{a}$ |

9: ${S}_{n{M}_{l}}\leftarrow $ Calculate Spearman’s correlation analysis on ${E}_{n}$ |

10: ${\beta}_{laye{r}_{l}}=$ Apply Equation (8) using ${S}_{a{M}_{l}}$ |

11: ${\delta}_{laye{r}_{l}}=$ Apply Equation (9) using ${S}_{n{M}_{l}}$ |

12: end for |

13: for $j;\phantom{\rule{4pt}{0ex}}j++;\phantom{\rule{4pt}{0ex}}|{\alpha}_{1}|$ do |

14: for $l\in \left|L\right|$ do |

15: $Q\{{\alpha}_{1}\left[j\right],{\alpha}_{2}\left[j\right]\}\left[l\right]\leftarrow $ Apply Equation (10) with parameters ${\alpha}_{1}={\alpha}_{1}\left[j\right]$ |

16: ${\beta}_{layer}={\beta}_{laye{r}_{l}}$, ${\alpha}_{2}={\alpha}_{2}\left[j\right]$, and ${\delta}_{layer}={\delta}_{laye{r}_{l}}$ |

17: end for |

18: end for |

19: Return E |

#### 5.5. Classification Evaluation

## 6. Conclusions and Future Work

## Author Contributions

## Funding

## Institutional Review Board Statement

## Informed Consent Statement

## Data Availability Statement

## Conflicts of Interest

## Abbreviations

AI | Artificial intelligence |

ML | Machine learning |

CNN | Convolutional neural network |

FC | Fully connected layers |

5G | Fifth-generation technology standard for broadband cellular networks |

5G-NR | 5G new radio |

SDR | Software-defined radio |

ISM | Industrial, scientific, and medical |

ANN | Artificial neural network |

GNN | Graph neural network |

SNR | Signal-to-noise ratio |

BW | Bandwidth |

AWGN | Additive white Gaussian noise |

DL | Deep learning |

NUC | Next unit of computing |

RU | Radio unit |

DU | Distributed unit |

USRP | Universal software radio peripheral |

ReLU | Rectified linear unit |

DNN | Deep neural network |

FPGA | Field-programmable gate array |

I/Q | In-phase and quadrature components |

ENN | Extensible neural networks |

DBN | Deep belief networks |

ENN | Extensible neural networks |

PSD | Power spectral density |

KNN | K-nearest neighbors |

HDMF | Heterogeneous deep model fusion |

BOPS | Bit Operations |

LSTM | Long short-term memory |

SCF | Spectral correlation function |

DBN | Deep belief network |

SAE | Sparse autoencoder |

CR | Cognitive radio |

RAN | Radio access networks |

QNN | Quantized neural network |

QCNN | Quantized convolutional neural network |

NICS | Normalized inference cost score |

FLOPs | Floating-point operations per second |

FINN | Experimental Framework from Xilinx Research Labs |

AMR | Automatic modulation recognition |

FCC | Federal Communications Commission |

SDR | Software-defined radio |

API | Application programming interface |

DSP | Digital signal processor |

DSA | Dynamic spectrum access |

AMC | Automatic modulation classification |

DNN | Deep neural network |

DL | Deep learning |

LB | Likelihood-based |

FB | Feature-based |

LDQ | Layered discriminated quantization |

RF | Radio frequency |

ONNX | Open neural network exchange |

HLS | High-level synthesis |

GPU | Graphics processing unit |

CPU | Central processing unit |

## References

- Bkassiny, M.; Li, Y.; Jayaweera, S.K. A Survey on Machine-Learning Techniques in Cognitive Radios. IEEE Commun. Surv. Tutor.
**2013**, 15, 1136–1159. [Google Scholar] [CrossRef] - Garhwal, A.; Bhattacharya, P.P. A survey on dynamic spectrum access techniques for cognitive radio. arXiv
**2012**, arXiv:1201.1964. [Google Scholar] [CrossRef] - Zhu, Z.; Nandi, A.K. Automatic Modulation Classification: Principles, Algorithms and Applications; John Wiley & Sons: Hoboken, NJ, USA, 2014. [Google Scholar] [CrossRef]
- Dobre, O.A. Signal identification for emerging intelligent radios: Classical problems and new challenges. IEEE Instrum. Meas. Mag.
**2015**, 18, 11–18. [Google Scholar] [CrossRef] - O’Shea, T.J.; Corgan, J.; Clancy, T.C. Convolutional Radio Modulation Recognition Networks. In Proceedings of the Engineering Applications of Neural Networks; Jayne, C., Iliadis, L., Eds.; Springer International Publishing: Berlin/Heidelberg, Germany, 2016; pp. 213–226. [Google Scholar]
- Dobre, O.A.; Abdi, A.; Bar-Ness, Y.; Su, W. Survey of automatic modulation classification techniques: Classical approaches and new trends. IET Commun.
**2007**, 1, 137–156. [Google Scholar] [CrossRef] [Green Version] - Liu, X.; Yang, D.; Gamal, A.E. Deep neural network architectures for modulation classification. In Proceedings of the 2017 51st Asilomar Conference on Signals, Systems, and Computers, Pacific Grove, CA, USA, 29 October–1 November 2017; pp. 915–919. [Google Scholar] [CrossRef] [Green Version]
- Peng, S.; Jiang, H.; Wang, H.; Alwageed, H.; Zhou, Y.; Sebdani, M.M.; Yao, Y.D. Modulation Classification Based on Signal Constellation Diagrams and Deep Learning. IEEE Trans. Neural Netw. Learn. Syst.
**2019**, 30, 718–727. [Google Scholar] [CrossRef] - Mao, Y.; Dong, Y.Y.; Sun, T.; Rao, X.; Dong, C.X. Attentive Siamese Networks for Automatic Modulation Classification Based on Multitiming Constellation Diagrams. IEEE Trans. Neural Netw. Learn. Syst.
**2021**, 1–15. [Google Scholar] [CrossRef] - Tilghman, P. Will rule the airwaves: A DARPA grand challenge seeks autonomous radios to manage the wireless spectrum. IEEE Spectr.
**2019**, 56, 28–33. [Google Scholar] [CrossRef] - Camelo, M.; Soto, P.; Latré, S. A General Approach for Traffic Classification in Wireless Networks using Deep Learning. IEEE Trans. Netw. Serv. Manag.
**2021**, 1. [Google Scholar] [CrossRef] - Garcia-Saavedra, A.; Costa-Pérez, X. O-RAN: Disrupting the Virtualized RAN Ecosystem. IEEE Commun. Stand. Mag.
**2021**, 1–8. [Google Scholar] [CrossRef] - Budgett, S.; de Waard, P. Quantized neural networks for modulation recognition. In Proceedings of the Artificial Intelligence and Machine Learning for Multi-Domain Operations Applications IV SPIE, Orlando, FL, USA, 3 April–13 June 2022; Volume 12113, pp. 397–412. [Google Scholar]
- Blott, M.; Preußer, T.B.; Fraser, N.J.; Gambardella, G.; O’Brien, K.; Umuroglu, Y.; Leeser, M.; Vissers, K. FINN-R: An end-to-end deep-learning framework for fast exploration of quantized neural networks. ACM Trans. Reconfigurable Technol. Syst. (TRETS)
**2018**, 11, 1–23. [Google Scholar] [CrossRef] - Kumar, S.; Mahapatra, R.; Singh, A. Automatic Modulation Recognition: An FPGA Implementation. IEEE Commun. Lett.
**2022**, 26, 2062–2066. [Google Scholar] [CrossRef] - Kumar, N.; Rawat, M.; Rawat, K. Software-defined radio transceiver design using FPGA-based system-on-chip embedded platform with adaptive digital predistortion. IEEE Access
**2020**, 8, 214882–214893. [Google Scholar] [CrossRef] - Umuroglu, Y.; Fraser, N.J.; Gambardella, G.; Blott, M.; Leong, P.; Jahre, M.; Vissers, K. Finn: A framework for fast, scalable binarized neural network inference. In Proceedings of the 2017 ACM/SIGDA International Symposium on Field-Programmable Gate Arrays, Monterey, CA, USA, 22–24 February 2017; pp. 65–74. [Google Scholar]
- Pappalardo, A.; Umuroglu, Y.; Blott, M.; Mitrevski, J.; Hawks, B.; Tran, N.; Loncar, V.; Summers, S.; Borras, H.; Muhizi, J.; et al. QONNX: Representing Arbitrary-Precision Quantized Neural Networks. arXiv
**2022**, arXiv:2206.07527. [Google Scholar] - Haggui, H.; Affes, S.; Bellili, F. FPGA-SDR integration and experimental validation of a joint DA ML SNR and doppler spread estimator for 5G cognitive transceivers. IEEE Access
**2019**, 7, 69464–69480. [Google Scholar] [CrossRef] - Reiter, P.; Karagiannakis, P.; Ireland, M.; Greenland, S.; Crockett, L. FPGA acceleration of a quantized neural network for remote-sensed cloud detection. In Proceedings of the 7th International Workshop on On-Board Payload Data Compression, Virtual, 21–23 September 2020. [Google Scholar]
- Lin, Y.; Zhao, H.; Tu, Y.; Mao, S.; Dou, Z. Threats of adversarial attacks in DNN-based modulation recognition. In Proceedings of the IEEE INFOCOM 2020-IEEE Conference on Computer Communications, Toronto, ON, Canada, 6–9 July 2020; pp. 2469–2478. [Google Scholar]
- Goodfellow, I.; Bengio, Y.; Courville, A. Deep Learning; MIT Press: Cambridge, MA, USA, 2016. [Google Scholar]
- Kim, S.H.; Kim, J.W.; Doan, V.S.; Kim, D.S. Lightweight deep learning model for automatic modulation classification in cognitive radio networks. IEEE Access
**2020**, 8, 197532–197541. [Google Scholar] [CrossRef] - Hiremath, S.M.; Behura, S.; Kedia, S.; Deshmukh, S.; Patra, S.K. Deep learning-based modulation classification using time and stockwell domain channeling. In Proceedings of the 2019 National Conference on Communications (NCC), Bangalore, India, 20–23 February 2019; pp. 1–6. [Google Scholar]
- Wang, Y.; Liu, M.; Yang, J.; Gui, G. Data-driven deep learning for automatic modulation recognition in cognitive radios. IEEE Trans. Veh. Technol.
**2019**, 68, 4074–4077. [Google Scholar] [CrossRef] - Qing Yang, G. Modulation classification based on extensible neural networks. Math. Probl. Eng.
**2017**, 2017, 6416019. [Google Scholar] [CrossRef] [Green Version] - Zhang, D.; Ding, W.; Zhang, B.; Xie, C.; Li, H.; Liu, C.; Han, J. Automatic modulation classification based on deep learning for unmanned aerial vehicles. Sensors
**2018**, 18, 924. [Google Scholar] [CrossRef] - Huang, S.; Dai, R.; Huang, J.; Yao, Y.; Gao, Y.; Ning, F.; Feng, Z. Automatic modulation classification using gated recurrent residual network. IEEE Internet Things J.
**2020**, 7, 7795–7807. [Google Scholar] [CrossRef] - Fu, X.; Gui, G.; Wang, Y.; Ohtsuki, T.; Adebisi, B.; Gacanin, H.; Adachi, F. Lightweight automatic modulation classification based on decentralized learning. IEEE Trans. Cogn. Commun. Netw.
**2021**, 8, 57–70. [Google Scholar] [CrossRef] - Zhang, X.; Zhao, H.; Zhu, H.; Adebisi, B.; Gui, G.; Gacanin, H.; Adachi, F. NAS-AMR: Neural Architecture Search Based Automatic Modulation Recognition for Integrated Sensing and Communication Systems. IEEE Trans. Cogn. Commun. Netw.
**2022**, 8, 1374–1386. [Google Scholar] [CrossRef] - Ali, A.; Yangyu, F.; Liu, S. Automatic modulation classification of digital modulation signals with stacked autoencoders. Digit. Signal Process.
**2017**, 71, 108–116. [Google Scholar] [CrossRef] - Liu, Y.; Liu, Y.; Yang, C. Modulation recognition with graph convolutional network. IEEE Wirel. Commun. Lett.
**2020**, 9, 624–627. [Google Scholar] [CrossRef] - Tu, Y.; Lin, Y. Deep neural network compression technique towards efficient digital signal modulation recognition in edge device. IEEE Access
**2019**, 7, 58113–58119. [Google Scholar] [CrossRef] - Gunst, R.F.; Mason, R.L. Fractional factorial design. Wiley Interdiscip. Rev. Comput. Stat.
**2009**, 1, 234–244. [Google Scholar] [CrossRef] - Ducasse, Q.; Cotret, P.; Lagadec, L.; Stewart, R. Benchmarking Quantized Neural Networks on FPGAs with FINN. In Proceedings of the DATE Friday Workshop on System-Level Design Methods for Deep Learning on Heterogeneous Architectures, Virtual, 5 February 2021. [Google Scholar]
- Bacchus, P.; Stewart, R.; Komendantskaya, E. Accuracy, training time and hardware efficiency trade-offs for quantized neural networks on fpgas. In Proceedings of the International Symposium on Applied Reconfigurable Computing; Springer: Berlin/Heidelberg, Germany, 2020; pp. 121–135. [Google Scholar]
- O’Shea, T.J.; Roy, T.; Clancy, T.C. Over-the-Air Deep Learning Based Radio Signal Classification. IEEE J. Sel. Top. Signal Process.
**2018**, 12, 168–179. [Google Scholar] [CrossRef] - Simonyan, K.; Zisserman, A. Very deep convolutional networks for large-scale image recognition. arXiv
**2014**, arXiv:1409.1556. [Google Scholar]

**Figure 1.**General scheme of an SDR device. Two general stages are identified, the first is the RF-front-end, and the second is the baseband processing stage. FPGA is the closest hardware accelerator to the RF-front-end; it is here where DL algorithms can be downloaded to fulfill specific CR tasks. Taken from [16].

**Figure 4.**Effect of quantization in the VGG10 1D-CNN architecture regarding the accuracy and inference cost. Inputs, activations, and weights are quantized in a range of 2 to 8 bits in the first stage (in aquamarine). Points in different colors represent the degree of quantization in the weights (see the second-stage methodology). In blue, the points with the best solutions obtained thus far with the Pareto front are highlighted.

**Figure 5.**Impact of quantization applied in the VGG10 1D-CNN architecture proposed by [37] used in the classification of communication signals. Panel (

**a**) shows the effect of the reduction in computational cost observed in each CNN layer. Panel (

**b**) shows the accuracy observed at each layer. In this case, the red dots indicate outlier accuracy values corresponding to configurations with a high degree of quantization.

**Figure 6.**Spearman’s correlation per layer. Panel (

**a**) shows the accuracy and Panel (

**b**) shows the NICS against each quantized CNN layer. Note that a correlation is negligible when $\rho <\left|0.1\right|$, low when $\left|0.1\right|<\rho <=\left|0.3\right|$, medium when $\left|0.3\right|<\rho <=\left|0.5\right|$, and strong or high when $\rho >\left|0.5\right|$.

**Figure 7.**Configurations obtained following the proposed methodology (in red). The solutions obtained in previous phases are also shown. Notice that by varying ${\alpha}_{1}$ and ${\alpha}_{2}$, different configurations can be obtained that were not found in the initial experimentation analyzed with the Pareto optimum.

**Figure 8.**Modulation classification accuracy of the original (unquantized) model and the quantized versions with different SNR values.

Frameworks | Technique | Supported Hardware |
---|---|---|

TensorFlowQuantization | Post-training float16 quantization Post-training dynamic range quantization Post-training integer quantization Quantization-aware training |
CPU, GPU CPU, GPU (Android) CPU, GPU (Android), EdgeTPU, Hexagon DSP CPU, GPU (Android), EdgeTPU, Hexagon DSP |

PytorchQuantization |
Dynamic/weight only quantization Static quantization Dynamic quantization | x86 CPUs with AVX2 support or higher. ARM CPUs (mobile/embedded devices) NVidia GPU –> TensorRT through fx2trt. |

PyTorchBrevitas | Quantization-aware training- -
- Integer quantization
- -
- Binary quantization
- -
- Ternary quantization
| FINN –> Xilinx FPGA |

**Table 2.**Degree of correlation between the quantified parameters (input, activations, weights) and the total BOPS, accuracy, and NICS. The weight is the parameter with the highest correlation.

Total BOPS | NICS | Accuracy | |
---|---|---|---|

Input | 0.351 | 0.295 | 0.275 |

Activations | 0.470 | 0.336 | 0.442 |

Weights | 0.893 | 0.955 | 0.790 |

**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).

VG10 1D CNN | Run | |||||||||
---|---|---|---|---|---|---|---|---|---|---|

1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | |

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 | 8 |

Conv 4 (CNN L4) | 8 | 8 | 8 | 2 | 8 | 8 | 8 | 8 | 8 | 8 |

Conv 5 (CNN L5) | 8 | 8 | 8 | 8 | 2 | 8 | 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 | 8 | 2 | 8 |

FC out (D3) | 8 | 8 | 8 | 8 | 8 | 8 | 8 | 8 | 8 | 2 |

Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations. |

© 2022 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).

## Share and Cite

**MDPI and ACS Style**

Góez, D.; Soto, P.; Latré, S.; Gaviria, N.; Camelo, M.
A Methodology to Design Quantized Deep Neural Networks for Automatic Modulation Recognition. *Algorithms* **2022**, *15*, 441.
https://doi.org/10.3390/a15120441

**AMA Style**

Góez D, Soto P, Latré S, Gaviria N, Camelo M.
A Methodology to Design Quantized Deep Neural Networks for Automatic Modulation Recognition. *Algorithms*. 2022; 15(12):441.
https://doi.org/10.3390/a15120441

**Chicago/Turabian Style**

Góez, David, Paola Soto, Steven Latré, Natalia Gaviria, and Miguel Camelo.
2022. "A Methodology to Design Quantized Deep Neural Networks for Automatic Modulation Recognition" *Algorithms* 15, no. 12: 441.
https://doi.org/10.3390/a15120441