## 4 Results
### Model Evaluation  
The model was developed in Python with TensorFlow, Keras, and other libraries such as NumPy, Matplotlib, and TensorBoard. Accuracy, precision, recall, and f1 score were the evaluation metrics. The following equations represent how to calculate each.  
\[Accuracy=\frac{TP+TN}{TP+TN+FP+FN} \tag{1}\]  
\[Precision=\frac{TP}{TP+FP} \tag{2}\]  
\[Recall=\frac{TP}{TP+FN} \tag{3}\]  
\[F1\ Score=2\times\frac{(precision\times recall)}{(precision+recall)} \tag{4}\]  
TP represents the number of optimistic predictions, TN represents the number of negative projections, FP represents the number of false positives, and FN represents the number of false negatives.  
Figure 12 shows the model's performance for leaf disease identification and classification during the training and validation phases. The results show an accuracy of 97.4% in the training phase and 92% in the validation phase, which are pretty good values and are within the range of values obtained in other published works in the literature.  
A confusion matrix was generated to analyze the results of how our supervised algorithm works [94; 95]. Figure 13 shows the confusion matrix.  
Results show that the proposed model predicted half of the classes with an accuracy equal to or greater than 98%. Only the class with the lowest number of images for training (_Tomato_mosaic_virus_) obtained a 94% value.  
Table 6 concentrates on the proposed model's results in the dataset's disease classification process for each class. The recall metric is high in each category of the dataset, showing that the accuracy of the proposed model is high (>90%), correctly classifying the diseases.  
Figure 12: Model’s accuracy values during the training and validation processes.  
The model was saved as a hierarchical data file and was used during the prediction process, with some results shown in Figure 14.  
Finally, a comparison was made with a work that analyzes different techniques for disease detection in tomato plants [96]. ResNet50, Xception, MobileNet, ShuffleNet, and DenseNet were compared with the five techniques used in this work. Our model was trained with the dataset used in that work (Plant Village), but with 13,112 images. The dataset was distributed 80% for training and 20% for validation. The accuracy of the training process was compared. The results are shown in Figure 15. From these results, we can conclude two things. The first is that the proposed model only underperforms the VGG16 model structure with a difference of about 1.2%. The second conclusion is that our model had a similar performance even when the training used a smaller number of images, which shows the stability of the proposed model.  
\begin{table}
\begin{tabular}{l c c c c} \hline \hline
**Category** & **Precision** & **Recall** & **f1-Score** & **Support** \\ \hline tomato bacterial spot & 0.96 & 0.96 & 0.97 & 100 \\ tomato late blight & 0.99 & 0.98 & 0.98 & 100 \\ tomato yellow leaf curl virus & 0.98 & 0.98 & 0.98 & 100 \\ tomato early blight & 0.96 & 0.97 & 0.97 & 100 \\ tomato Septoria leaf spot & 0.98 & 0.97 & 0.99 & 100 \\ tomato mosaic virus & 0.94 & 0.98 & 0.91 & 100 \\ tomato target spot & 0.98 & 0.98 & 0.98 & 100 \\ tomato leaf mold & 0.96 & 0.97 & 0.99 & 100 \\ tomato spider mites two spotted & 0.97 & 0.98 & 0.97 & 100 \\ tomato healthy & 0.98 & 0.98 & 0.98 & 100 \\ \hline \hline \end{tabular}
\end{table}
Table 6: Class-wise performance of the proposed model.  
Figure 13: Confusion matrix of the proposed model, (0) tomato bacterial spot, (1) tomato late blight, (2) tomato yellow leaf curl virus, (3) tomato early blight, (4) tomato Septoria leaf spot, (5) tomato mosaic virus, (6) tomato target spot, (7) tomato leaf mold, (8) tomato spider mites two spotted, (9) tomato healthy.