# A Hybrid Deep Learning Approach for Cotton Plant Disease Detection Using BERT-ResNet-PSO
## 4 Results and Analysis  
The PlantVillage Extension Cotton Leaf Disease dataset is used in this study to demonstrate the effectiveness of the proposed hybrid deep learning approach. The dataset is made up of more than 4000 images of various diseased symptoms, including aviarum blight, leaf curl virus, fusarium wilt, alternaria leaf spot and healthy leaves. These images are represented in formats, such as JPEG, PNG or enhanced by a CSV file that contains disease category information for each image. Hence, during the initial processing steps, the images are parsed and arranged according to their annotations, forming a labeled dataset to enhance integration into the supervised learning stream. Every image is followed by normalization to obtain the same size and format of images across the dataset. In this work, rotation of the images, flipping and change in contrast are used to enhance the variety of data for improved model generalization during training. For segmentation tasks, the images are segmented, and only the leaf areas of concern are selected, which are then split into patch sizes that are best suited to be fed into the Vision Transformer Model developed based on the BERT Language Model. The images are split into patches and put through a linear embedding, followed by a positional embeddingto capture spatial information. The resulting embedded patches are then passed through the transformer encoder layer to derive the feature maps, which capture rich patterns in spatial and contextual domains. These features are then used in the segmentation head, which comes out with a pixel-wise mask that separates the diseased from the healthy part of the walnut leaf. To do the classification, the processed feature maps are transferred into the Residual Network (ResNet) architecture, which maps the feature maps into spaces that are appropriate for the classification of disease. The feature extraction is also enhanced through PSO to guarantee that the model has high outcome parameters. The optimized features are then passed to another module of classifiers to make an integrated decision on the results from different classifiers. It also presents a complete pipeline from raw data preparation to feature extraction, classification, and segmentation for a reliable diagnosis of cotton leaf diseases and the utilization of measurement benchmarks, such as accuracy, precision, recall, and F1-Score. Table 2 shows the comparison of different models in terms of their accuracy, precision, recall, F1-Score, and AUC. The performance of the BERT-ResNet-PSO model is evaluated among the evaluated models, followed by an excellent accuracy of 98.5%. Then we have EfficientNet, DenseNet, and ResNet-50, with 96.0%, 95.8%, and 95.2% accuracy, respectively. The 92.0% accuracy of the baseline CNN model is still higher than the 90.4% shown for an earlier model. At values of precision, the BERT-ResNet-PSO model is once again the highest at 98.2%, EfficientNet at 95.6%, and DenseNet at 95.3%. The precision values of ResNet-50, InceptionV3 and VGG 16 models are about the same, 94.8%, 94.0% and 94.0%, respectively. The precision of the baseline CNN model is 91.5%. Furthermore, the recall metric shows that the BERT-ResNet-PSO model, which has the highest recall value of 98.7%, also successfully identifies positive instances. For the next best recall, we observe EfficientNet (96.3%), DenseNet (96.0%), and ResNet-50 (95.5%). InceptionV3 and VGG16 reach recall of 94.8% and 94.0%, and the baseline CNN model obtains 92.3% recall. It is a similar trend with the F1-Score, which is a harmonic mean of precision and recall; from the F1-Score, we can see that the highest model is the BERT-ResNet-PSO model with F1 of 98.4%, and then the other two models follow the EfficientNet (95.9%), the DenseNet (95.6%), EfficientNet (95.6%) and the ResNet 50 (95.1%). The F1-Score for the baseline CNN model is 91.9%, and the F1-Score for the alternative architectures InceptionV3, VGG16 and a variation of CNN is 94.4% and 93.5%, respectively.