Few-shot learning for avocado ripeness detection: A transformer-based NIR approach
This study explores Few-Shot Learning (FSL) to improve a pre-trained Transformer model for classifying avocado ripeness using Near-Infrared (NIR) spectral data from a portable, low-cost scanner. The goal is to allow users in the field to customise the model with little local data, decreasing reliance on centralised retraining while keeping predictive accuracy intact. A dataset was created with spectral scans from the AS7265x sensor, capturing 18 wavelengths for each sample. The population consists of Buccaneer avocado samples at three ripeness stages: raw, aged, and ripe. Subsets of different sizes were extracted for simulation to represent various k-shot support scenarios, from 2% to 50% of the total labelled data per class. A few-shot Transformer architecture classified samples in episodic learning conditions. We assessed performance through average F1-score, ROC AUC, and confusion matrices using 5-fold cross-validation. Findings show that with as little as 20% labelled support data per class, the model achieves over 80% F1-score, demonstrating a clear performance gain through minimal shot expansion. Classification accuracy keeps improving until it levels off around 40–50% shot ratios. This study advances embedded agricultural AI by demonstrating the effective use of few-shot adaptation in portable NIR scanners for localised model improvement. Limitations involve possible sensitivity to class imbalance and noise in low-shot scenarios, necessitating strong sampling and calibration.
Authors
- Prasert Luekhong (ORCID: https://orcid.org/0000-0002-6324-3363)
- Chokemongkol Nadee
- Krisda Yingkayun
- Panudech Tipauksorn (ORCID: https://orcid.org/0009-0007-1471-9912)
Institutions
- Rajamangala University of Technology Lanna (TH)
Publication Details
- Journal
- Smart Agricultural Technology
- Published
- 2025-09-23
- DOI
- https://doi.org/10.1016/j.atech.2025.101448
- Primary Topic
- Spectroscopy and Chemometric Analyses
- Type
- article
- Field-Weighted Citation Impact
- 0.00