This site needs JavaScript to work properly. Please enable it to take advantage of the complete set of features!
Skip to main page content
U.S. flag

An official website of the United States government

Dot gov

The .gov means it’s official.
Federal government websites often end in .gov or .mil. Before sharing sensitive information, make sure you’re on a federal government site.

Https

The site is secure.
The https:// ensures that you are connecting to the official website and that any information you provide is encrypted and transmitted securely.

Access keys NCBI Homepage MyNCBI Homepage Main Content Main Navigation

Save citation to file

Add to Collections

Name must be less than 100 characters
Unable to load your collection due to an error
Please try again

Add to My Bibliography

Unable to load your delegates due to an error
Please try again

Your saved search

Would you like email updates of new search results?
Saved Search Alert Radio Buttons
()

Create a file for external citation management software

Your RSS Feed

. 2024 Jun 14;13(12):1869.
doi: 10.3390/foods13121869.

Optimizing Strawberry Disease and Quality Detection with Vision Transformers and Attention-Based Convolutional Neural Networks

Affiliations

Affiliations

  • 1 Department of Electrical & Computer Engineering, Western University, London, ON N6A 3K7, Canada.
  • 2 Ivey Business School, Western University, London, ON N6A 3K7, Canada.

Optimizing Strawberry Disease and Quality Detection with Vision Transformers and Attention-Based Convolutional Neural Networks

Kimia Aghamohammadesmaeilketabforoosh et al. Foods. .
. 2024 Jun 14;13(12):1869.
doi: 10.3390/foods13121869.

Affiliations

  • 1 Department of Electrical & Computer Engineering, Western University, London, ON N6A 3K7, Canada.
  • 2 Ivey Business School, Western University, London, ON N6A 3K7, Canada.

Abstract

Machine learning and computer vision have proven to be valuable tools for farmers to streamline their resource utilization to lead to more sustainable and efficient agricultural production. These techniques have been applied to strawberry cultivation in the past with limited success. To build on this past work, in this study, two separate sets of strawberry images, along with their associated diseases, were collected and subjected to resizing and augmentation. Subsequently, a combined dataset consisting of nine classes was utilized to fine-tune three distinct pretrained models: vision transformer (ViT), MobileNetV2, and ResNet18. To address the imbalanced class distribution in the dataset, each class was assigned weights to ensure nearly equal impact during the training process. To enhance the outcomes, new images were generated by removing backgrounds, reducing noise, and flipping them. The performances of ViT, MobileNetV2, and ResNet18 were compared after being selected. Customization specific to the task was applied to all three algorithms, and their performances were assessed. Throughout this experiment, none of the layers were frozen, ensuring all layers remained active during training. Attention heads were incorporated into the first five and last five layers of MobileNetV2 and ResNet18, while the architecture of ViT was modified. The results indicated accuracy factors of 98.4%, 98.1%, and 97.9% for ViT, MobileNetV2, and ResNet18, respectively. Despite the data being imbalanced, the precision, which indicates the proportion of correctly identified positive instances among all predicted positive instances, approached nearly 99% with the ViT. MobileNetV2 and ResNet18 demonstrated similar results. Overall, the analysis revealed that the vision transformer model exhibited superior performance in strawberry ripeness and disease classification. The inclusion of attention heads in the early layers of ResNet18 and MobileNet18, along with the inherent attention mechanism in ViT, improved the accuracy of image identification. These findings offer the potential for farmers to enhance strawberry cultivation through passive camera monitoring alone, promoting the health and well-being of the population.

Keywords: MobileNetV2; ResNet18; computer vision; image classification; machine learning; monitoring; strawberries; vision transformers; yield monitoring.

PubMed Disclaimer

Conflict of interest statement

The authors declare no conflict of interest.

Figures

Figure 1

Figure 1

Images of the seven diseases…

Figure 1

Images of the seven diseases in strawberries and their leaves: ( a )…

Figure 1
Images of the seven diseases in strawberries and their leaves: (a) angular leaf spot; (b) anthracnose fruit rot; (c) blossom blight; (d) gray mold; (e) leaf spot; (f) powdery mildew leaf; (g) powdery mildew fruit.
Figure 2

Figure 2

Strawberries dataset before and after…

Figure 2

Strawberries dataset before and after cropping.

Figure 2
Strawberries dataset before and after cropping.
Figure 3

Figure 3

Preprocessing steps.

Figure 3

Preprocessing steps.

Figure 3
Preprocessing steps.
Figure 4

Figure 4

Architecture of a ViT.

Figure 4

Architecture of a ViT.

Figure 4
Architecture of a ViT.
Figure 5

Figure 5

Original MobileNetV2’s architecture.

Figure 5

Original MobileNetV2’s architecture.

Figure 5
Original MobileNetV2’s architecture.
Figure 6

Figure 6

Original ResNet18’s architecture.

Figure 6

Original ResNet18’s architecture.

Figure 6
Original ResNet18’s architecture.
Figure 7

Figure 7

Procedure for the algorithms.

Figure 7

Procedure for the algorithms.

Figure 7
Procedure for the algorithms.
Figure 8

Figure 8

Confusion matrix for ( a

Figure 8

Confusion matrix for ( a ) vision transformer, ( b ) MobileNetV2, and…

Figure 8
Confusion matrix for (a) vision transformer, (b) MobileNetV2, and (c) ResNet18.
Figure 8

Figure 8

Confusion matrix for ( a

Figure 8

Confusion matrix for ( a ) vision transformer, ( b ) MobileNetV2, and…

Figure 8
Confusion matrix for (a) vision transformer, (b) MobileNetV2, and (c) ResNet18.

References

    1. Shorif Uddin M., Bansal J.C. Computer Vision and Machine Learning in Agriculture. Algorithms for Intelligent Systems. Volume 2 Springer; Singapore: 2021.
    1. Hadipour-Rokni R., Askari Asli-Ardeh E., Jahanbakhshi A., Esmaili paeen-Afrakoti I., Sabzi S. Intelligent Detection of Citrus Fruit Pests Using Machine Vision System and Convolutional Neural Network through Transfer Learning Technique. Comput. Biol. Med. 2023;155:106611. doi: 10.1016/j.compbiomed.2023.106611. - DOI - PubMed
    1. Zhou C., Hu J., Xu Z., Yue J., Ye H., Yang G. A Novel Greenhouse-Based System for the Detection and Plumpness Assessment of Strawberry Using an Improved Deep Learning Technique. Front. Plant Sci. 2020;11:559. doi: 10.3389/fpls.2020.00559. - DOI - PMC - PubMed
    1. Lello F., Dida M., Mkiramweni M., Matiko J., Akol R., Nsabagwa M., Katumba A. Fruit Fly Automatic Detection and Monitoring Techniques: A Review. Smart Agric. Technol. 2023;5:100294. doi: 10.1016/j.atech.2023.100294. - DOI
    1. Suryanarayana T.M.V. Principal Component Regression for Crop Yield Estimation [Electronic Resource] 1st ed. Springer; Singapore: 2016. Springer Briefs in Applied Sciences and Technology.

LinkOut - more resources

Cite
Morty Proxy This is a proxified and sanitized view of the page, visit original site.