Determining the exact ripeness stage of a Hass avocado (
Persea americana) has traditionally relied on subjective visual checks and physical firmness testing. In the post-harvest agricultural supply chain, this manual approach is labor-intensive and prone to misclassification especially during subtle color transitions. In this publication
Artikel Alpukat Teuku Vaickal I summarize our peer-reviewed research published in
JATI (Jurnal Mahasiswa Teknik Informatika), Vol. 10 No. 4 (August 2026), where we developed an automated computer vision system using
YOLOv8-cls to classify Hass avocado ripeness into five granular stages.
Publication Citation: Teuku Vaickal Rizki Irdian, Nila Hardi, & Minda Septiani (2026). "Klasifikasi Kematangan Alpukat Hass Menggunakan YOLO v8 Berdasarkan 5 Tahap Kematangan." JATI (Jurnal Mahasiswa Teknik Informatika), 10(4), 7304–7309.
// Why 5-Stage Classification Matters

Unlike standard binary freshness detection (fresh vs. spoiled) or coarse three-stage grading systems, real-world supply chains require fine-grained ripeness mapping to minimize post-harvest food loss. Using only standard RGB digital images without expensive hyperspectral or ultraviolet sensors our study evaluated
YOLOv8-cls across five distinct biological ripening phases:
- Class 1 – Unripe: Uniform deep green skin with firm texture.
- Class 2 – Breaking: Initial transition phase with subtle chromatic shifts.
- Class 3 – Ripe (First Phase): Early consumption window with darkening skin pigmentation.
- Class 4 – Ripe (Second Phase): Peak ripeness with rich purplish-black skin.
- Class 5 – Over-ripe: Past peak quality, requiring immediate sorting to prevent spoilage spread.
// Dataset & Experimental Methodology

To ensure strong generalization and prevent data leakage, we utilized a public photographic dataset from Mendeley Data comprising
14,710 high-resolution digital images of Hass avocados. All images were preprocessed to a uniform resolution of
224×224 pixels and normalized to the
[0, 1] pixel range.Using stratified sampling, the dataset was partitioned into three subsets:
- Training Set (70%): 10,297 images
- Validation Set (20%): 2,942 images
- Testing Set (10%): 1,471 unseen images for unbiased evaluation
The
YOLOv8s-cls architecture was trained in a Kaggle Notebooks environment powered by
dual NVIDIA T4 GPUs (16GB GDDR6 VRAM) over
50 epochs with a batch size of 32.
// Key Evaluation Results & Confusion Matrix Analysis
Evaluated against 1,471 unseen test images, the model achieved a robust
Overall Accuracy of 84.97%, with a macro-average
Precision of 84.39%,
Recall of 84.27%, and an
F1-Score of 84%.
Per-Class Performance Breakdown
- Unripe: 94% Precision | 94% Recall | 94% F1-Score
- Ripe (First Phase): 74% Precision | 79% Recall | 76% F1-Score
- Ripe (Second Phase): 79% Precision | 74% Recall | 77% F1-Score
- Over-ripe: 94% Precision | 92% Recall | 93% F1-Score
In live inference tests on contrasting fruit samples, the model accurately classified an unripe sample with a
97.44% confidence score and distinguished an early-ripe sample with an
81.53% confidence score. The confusion matrix confirmed exceptional reliability at the extreme ends of the spectrum (94% for Unripe and 92% for Over-ripe), while minor misclassifications occurred primarily between adjacent transitional phases where skin color features naturally overlap.
// Practical Impact & Future Work
By leveraging a lightweight classification backbone rather than heavy bounding-box detection models, this system offers a scalable, non-destructive quality control framework that can run efficiently on resource-constrained hardware. For future iterations, extending training beyond 50 epochs, integrating hybrid attention mechanisms (such as SE or CBAM) to capture subtle skin texture changes during the
Breaking phase, and deploying onto edge devices for on-site agricultural sorting will further push accuracy in unstructured lighting environments.