## 2 Materials and Methods
### Optimization and Test Strategy
#### 2.6.2 Optimization of Quantized LiteRT DNN Models Using Representative Datasets  
As illustrated in Figure 5, the optimization process is applied to two quantized LiteRT models (IntQ and Ful-IntQ), both requiring calibration to convert the variable tensors to the int8 format, according to Table 1 and Equations (1) and (2). In theory, the representative dataset (RDSs) used for the calibration are the only input influencing the quantization process of TFLite models. Therefore, selecting an optimal number and content of RDS samples from the calibration dataset is essential to achieve the best possible quantization performance. We quantify the error introduced by quantization as the difference between the output of the quantized LiteRT DNN model (denoted as pVFQ) and the output of the reference TF DNN model (pVFREF) across all ECG recordings in the validation database (size N), using the mean absolute error (MAE) as the statistical metric. Further MAE of pVF is interpreted as a percentage relative to the maximum probability range of 1:  
\[\text{MAE}(\text{pVF})=100\frac{\sum_{i=1}^{\text{N}}\left|pVFQ-pVFREF\right|}{ \text{N}},\% \tag{3}\]  
Using the validation result (3) to compare models generated with different RDS selections, the optimal model is the one that provides \(\text{MAE}(\text{pVF})\rightarrow\text{min}\). Notably, we ensure the independence between MAE(pVF) estimation and the RDS selection by using \begin{table}
\begin{tabular}{c c c c} \hline \hline \multicolumn{4}{c}{**Out-of-Hospital Cardiac Arrest ECG Databases**} \\ \hline \hline  & **Calibration** & **Validation** & **Test** \\ \hline Shockable rhythms & & & \\ Ventricular fibrillation (VF) & 255 & 433 & 414 \\ \hline Non-shockable rhythms & & & \\ Normal sinus rhythm (NSR) & 162 & 254 & 247 \\ Other non-shockable rhythm (ONR) & 1251 & 2514 & 2267 \\ Asystole (ASYS) & 2638 & 5331 & 4554 \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Number of 10 s ECG episodes, included in the calibration, validation, and test datasets, collected from out-of-hospital cardiac arrest databases with respective arrhythmia annotations. The calibration dataset includes both noise-free and noise-corrupted ECG signals, while validation and test datasets include only noise-free cases as required by the AHA guidelines [84]. non-overlapping calibration and validation datasets, according to Table 2. The content of the ECG recordings included in RDS might be different. We study four RDS selection strategies:  
* RDS random selection: The RDS includes \(S\) ECG recordings randomly chosen from the calibration database. * RDS rhythm-based selection: The RDS includes \(S\) ECG recordings randomly selected from the calibration database in a balanced proportion of annotated rhythms (VF, NSR, ONR, and ASYS). * RDS amplitude-based selection: The RDS includes \(S\) ECG recordings randomly selected from the calibration database, evenly distributed across five root mean square (RMS) amplitude ranges of the ECG signal: \(<\)100 \(\mu\)V, 100-200 \(\mu\)V, 200-500 \(\mu\)V, 500-1000 \(\mu\)V, and \(>\)1000 \(\mu\)V.
* Total calibration database: RDS contains the entire calibration dataset (4306 samples). The first three RDS selection strategies evaluate 13 different RDS sizes, i.e., \(S\) = 10, 20, 40, 80, 120, 160, 200, 250, 300, 350, 400, 500, or 1000 ECG recordings from the calibration dataset. For each RDS size, 100 random sets of ECG recordings are generated, resulting in a total of 1300 RDS configurations analyzed to optimize the quantization process for both IntQ and Full-IntQ LiteRT models independently. Testing  
As illustrated in Figure 5, the testing of different DNN models is performed directly on their respective target platforms:  
* GPU-based workstation: Runs the original TF DNN model within its development environment. * Raspberry Pi 4 microcontroller: Executes the embedded LiteRT DNN model without quantization. * STM32F7 microcontroller: Runs the C++ LiteRT DNN model tested both without quantization and with three quantization types (DynQ, IntQ, and Full-IntQ).