# Pep-VGGNet: A Novel Transfer Learning Method for Pepper Leaf Disease Diagnosis
## 3 Methodology
### Theoretical Background Behind the Performance Analysis of the DL Model  
A confusion matrix is one of the most prominent methods for summarising a classifier's quality. It shows the absolute number of correct and false predictions on a set of test data. To provide a clearer picture of their performance, the DL models are also tested using the following criteria: accuracy, loss, precision, recall, and F1 score. For better organisation of the section, all symbols used during the calculations are listed in Table 2.  
The confusion matrix describes the performance of a classification model by showing the true vs. predicted classifications [32]. For the confusion matrix of M classes, represented in Equation (1):  
\[CM=\begin{bmatrix}a_{11}&a_{21}&\dots&a_{M1}\\ a_{12}&a_{22}&\dots&a_{M2}\\ \vdots&\vdots&\ddots&\vdots\\ a_{1M}&a_{2M}&\dots&a_{MM}\\ \end{bmatrix} \tag{1}\]  
For a predicted class \(k\), parameters \(TP_{k}\), \(FN_{k}\), \(FP_{k}\), and \(TN_{k}\) are calculated through Equations (2)-(5):  
\[TP_{k}=a_{ik}\quad for\quad i=k \tag{2}\]  
\[FN_{k}=\sum_{i=1}^{M}a_{ik}\quad for\quad i\
eq k \tag{3}\]  
\[FP_{k}=\sum_{i=1}^{M}a_{ki}\quad for\quad i\
eq k \tag{4}\]  
\[TN_{k}=\sum_{i=1,k=1}^{M}a_{ik}-TP_{k}-FN_{k}-FP_{k} \tag{5}\]  
\begin{table}
\begin{tabular}{l l} \hline \hline
**Symbol** & **Definition** \\ \hline \(CM\) & Confusion Matrix \\ \(a_{ik}\) & Number of predictions of the actual \(i\)th class predicted as \(k\)th class \\ \(TP_{k}\) & True positive predictions for the \(k\)th class \\ \(FP_{k}\) & False positive predictions for the \(k\)th class \\ \(TN_{k}\) & True negative predictions for the \(k\)th class \\ \(FN_{k}\) & False negative predictions for the \(k\)th class \\ \(i\) & Actual class \\ \(k\) & Predicted class \\ \(M\) & Number of classes \\ \(1\) & APHID \\ \(2\) & BURNT \\ \(3\) & CATERPILLAR \\ \(4\) & HEALTHY \\ \(5\) & MILDEW \\ \(6\) & MITE \\ \(7\) & WORM \\ \hline \hline \end{tabular}
\end{table}
Table 2: Nomenclature used during the calculations.  
Accuracy is the ratio of total correct predictions over the total number of predictions, and it is given as in Equation (6):  
\[Accuracy=\frac{\sum_{k=1}^{M}(TP_{k}+TN_{k})}{\sum_{k=1}^{M}(TP_{k}+TN_{k}+FP_{k}+ FN_{k})} \tag{6}\]  
The loss function measures the error between the model's predictions and the actual values, and it is represented by Equation (7):  
\[Loss=\frac{1}{M}\sum_{k=1}^{M}\sum_{i=1}^{M}a_{ik}\log a_{ik} \tag{7}\]  
Precision can be defined as the ratio of true positive predictions to the total predicted positive samples. It indicates how many predicted positive instances are correct [33; 34; 35]. It is given by Equation (8) as follows:  
\[Precision_{k}=\frac{TP_{k}}{TP_{k}+FP_{k}} \tag{8}\]  
Recall, also known as sensitivity, is the ratio of true positive predictions _TP_ to the total actual positive samples (_TP_ + _FN_). This metric shows how well the model identifies the positive class; in other words, it indicates how effectively the model captures the actual positives. The recall of the \(k\)th class is represented by Equation (9) as follows:  
\[Recall_{k}=\frac{TP_{k}}{TP_{k}+FN_{k}} \tag{9}\]  
Finally, F1 score is the harmonic mean of precision and recall. The metric balances both metrics are used to better reflect the overall model performance, especially in case of class imbalance. A higher F1 score indicates better model performance [29; 34]. The F1 score of the \(k\)th class is represented by Equation (10) as follows:  
\[F1_{k}score=2\frac{Precision_{k}\cdot Recall_{k}}{Precision_{k}+Recall_{k}} \tag{10}\]