论文信息
论文解读
AI 辅助整理- 方法
- 构建400张田间RGB图像数据集,提出Mango-YOLO(YOLO26m+CB
- 发现
- Mango-YOLO最优,mAP@0.5达0.940,产量估计MAPE为2.63%,比人工估计准确3
- 机会点
- 可探索多品种、多生长阶段及不同光照条件下的泛化能力,并融合时序遥感数据提升区域产量预测精度。
论文摘要
在秘鲁北部,人工目视计数仍是估算肯特芒果(Mangifera indica L.)产量的标准方法,但这种做法缺乏一致性,影响了采收计划、运输规模测算和商业谈判。现有的芒果检测计算机视觉方法解决了果实与背景的区分问题,但很少将果实归入决定其市场价值的商业类别。本研究开发并验证了一种深度学习方法,能够从兰巴耶克省莫图佩地区真实田间条件下采集的RGB图像中,同时检测肯特芒果并将其分为三个出口类别(空运、海运和拒收)。研究构建了一个专用数据集,来自十个商业果园的200棵果树,每棵树采集两个相对视角,共400张照片;生成了6,544个1,280 × 1,280像素、重叠率20%的图像块,包含66,465个人工标注实例。在相同实验条件下训练了五种架构:YOLOv8m、YOLO11m、YOLO26m、RT-DETR-l和Mango-YOLO,后者是在YOLO26m基础上引入CBAM注意力模块、BiFPN颈部和MPDIoU回归损失而提出的架构。Mango-YOLO在全部五项指标上表现最佳,精确率为0.930,召回率为0.940,F1分数为0.930,mAP@0.5为0.940,mAP@0.5:0.95为0.730,每张图像推理时间为114.94 ms。分类别分析显示出异质性表现,海运、空运和拒收类别的F1分数分别为0.960、0.845和0.792。所选模型被集成到一个三层Web应用程序中,可将采样果树的果实计数扩展至整个果园,并通过使用类别平均权重的蒙特卡洛模拟将其转换为千克,返回90%区间。在十个果园中,以加工厂地磅记录的采收产量进行验证,平均绝对百分比误差为2.63%,决定系数为0.9993,比田间主管的人工估算优3.3倍。
全文
Frontiers in Plant ScienceDeep learning-based estimation
of Kent mango yield by
commercial export category
under real field conditions
in northern Peru
Victor Yoel Huaman Asencio, Heber Iva´ n Mejı´a Cabrera *
and Juan Carlos Arcila Dı´az
Escuela Profesional de Ingenier ı´a de Sistemas, Facultad de Ingenier ı´a, Arquitectura y Urbanismo,
Universidad Señor de Sipa´ n, Lambayeque, Peru
Manual visual counting remains the standard procedure for estimating Kent
mango ( Mangifera indica L.) yield in northern Peru, an inconsistent practice that
compromises harvest planning, transport dimensioning and commercial negoti-
ation. Existing computer vision approaches to mango detection resolve fruit-
versus-background discrimination but rarely classify fruit into the commercial
categories that determine its market value. This study developed and validated a
deep learning method that simultaneously detects and classi fies Kent mango fruit
into three export categories (air freight, sea freight and reject) from RGB images
acquired under real field conditions in the Motupe district, Lambayeque. A
purpose-built dataset of 400 photographs was compiled from 200 trees across
ten commercial farms using two opposite views per tree; 6,544 patches of 1,280 ×
1,280 pixels with 20% overlap were generated, containing 66,465 manually
annotated instances. Five architectures were trained under identical experimental
conditions: YOLOv8m, YOLO11m, YOLO26m, RT-DETR-l and Mango-YOLO, the
latter a proposed architecture built on YOLO26m through the incorporation of a
CBAM attention module, a BiFPN neck and the MPDIoU regression loss. Mango-
YOLO achieved the best performance across all five metrics, with a precision of
0.930, a recall of 0.940, an F1-score of 0.930, a mAP@0.5 of 0.940 and a
mAP@0.5:0.95 of 0.730, at an inference time of 114.94 ms per image. Per-
category analysis revealed heterogeneous behaviour, with F1-scores of 0.960,
0.845 and 0.792 for sea freight, air freight and reject respectively. The selected
model was integrated into a three-tier web application that scales fruit counts
from sampled trees to the whole farm and converts them into kilograms through
Monte Carlo simulation with category mean weights, returning a 90% interval.
Validation against harvested production recorded on the processing-plant scale
across the ten farms yielded a mean absolute percentage error of 2.63% and a
coefficient of determination of 0.9993, outperforming the field supervisor ’s
manual estimate by a factor of 3.3.
KEYWORDS
computer vision, convolutional attention, export category classi fication, Kent mango,
object detection, precision agriculture, yield estimation, YOLO
Frontiers in Plant Science frontiersin.org01
OPEN ACCESS
EDITED BY
Liujun Xiao,
Nanjing Agricultural University, China
REVIEWED BY
Erbert Franciksco Osco Mamani,
Jorge Basadre Grohmann National
University, Peru
Maulin Joshi,
Sarvajanik University, India
*CORRESPONDENCE
Heber Iva´ n Mej ı´a Cabrera
hmejiac@uss.edu.pe
RECEIVED 21 July 2026
REVISED 28 August 2026
ACCEPTED 29 September 2026
PUBLISHED 13 October 2026
CITATION
Huaman Asencio VY, Mejı´a Cabrera HI
and Arcila D ı´az JC (2026) Deep learning-
based estimation of Kent mango yield by
commercial export category under real
field conditions in northern Peru.
Front. Plant Sci. 17:1943711.
doi: 10.3389/fpls.2026.1943711
COPYRIGHT
© 2026 Huaman Asencio, Mejı´aC a b r e r a
and Arcila Dı´a z .T h i si sa no p e n - a c c e s s
article distributed under the terms of the
Creative Commons Attribution License
(CC BY). The use, distribution or
reproduction in other forums is
permitted, provided the original
author(s) and the copyright owner(s) are
credited and that the original publication
in this journal is cited, in accordance
with accepted academic practice. No
use, distribution or reproduction is
permitted which does not comply with
these terms.
TYPE Original Research
PUBLISHED 13 October 2026
DOI 10.3389/fpls.2026.1943711
1 Introduction
Mango is one of Peru ’s principal agro-export commodities and
sustains the economy of thousands of families in the north of the
country. The 2024/2025 season con firmed this with record figures
of 289,508 metric tonnes of fresh mango exported, of which the
Kent cultivar accounted for the overwhelming majority, with the
United States, the Netherlands and Spain as leading destinations
(MIDAGRI, 2025 ).
Lambayeque has consolidated its position as the country ’s
second mango-producing region, behind Piura, and within
Lambayeque the Motupe district ranks second in production after
Olmos ( INEI, 2025 ). This production volume has a direct conse-
quence for local growers, who depend on approximate estimates to
plan their harvest and negotiate sales. The usual method consists of
walking the plots, sampling a subset of trees and counting fruit by
hand to project the total. When fruit load is high and the
environment is complicated by changing light or shade, this
visual count becomes inconsistent and unreliable, which in turn
affects harvest planning, generates poorly dimensioned transport,
improvised hiring of day labourers and unfavourable negotiations
with buyers.
Computer vision and deep learning techniques offer an alter-
native to the manual method. Image processing has been applied in
agriculture to measure canopy, estimate yield and classify produce
with greater accuracy and in less time than traditional methods
(Vibhute and Bodhe, 2012 ). Training deep models from scratch,
however, requires large volumes of labelled data, a condition that is
not always feasible in specific agricultural settings. Transfer learning
allows models pretrained on large generic databases to be reused
and adjusted to a particular task with fewer examples, accelerating
convergence and improving generalization when the local dataset is
limited ( Pan and Yang, 2010 ). Complementarily, data augmenta-
tion arti ficially widens the variability of the training set through
geometric and photometric transformations, reducing over fitting
and improving performance under illumination, scale and orienta-
tion conditions different from those initially observed ( Shorten and
Khoshgoftaar, 2019 ).
In the field of object detection, the YOLO (You Only Look
Once) family has evolved towards increasingly ef ficient architec-
tures. YOLO11 improves feature extraction through C3k2, SPPF
and C2PSA blocks, and has been applied successfully to citrus
detection ( Liao et al., 2025 ). The most recent version, YOLO26,
moves towards non-maximum-suppression-free inference, elimi-
nates the Distribution Focal Loss and proposes label assignment
strategies aimed at small objects ( Jocher et al., 2026 ). RT-DETR, in
turn, combines the Transfor mer architecture with an ef ficient
hybrid encoder, removing the need for non-maximum suppression
and offering flexible inference speed ( Zhao et al., 2024 ). In the
specific context of mango, Light-YOLO demonstrates that light-
weight and ef ficient models can be developed for fruit detection in
natural environments ( Zhong et al., 2024 ).
These models can be enhanced with attention mechanisms and
specialized loss functions. The Convolutional Block Attention Module
(CBAM) strengthens spatial and channel feature extraction,
improving object discrimination in complex scenes ( Woo et al.,
2018). The weighted bidirectional feature pyramid network BiFPN,
originally proposed in Ef ficientDet, facilitates ef ficient multi-scale
feature fusion, which is advantageous for detecting objects of variable
size within the same image (Tan et al., 2020). Likewise, the MPDIoU
(Minimum Point Distance Intersection over Union) loss function
incorporates the distance between the extreme points of the bounding
boxes, improving coordinate regression when objects overlap or are
small (Ma and Xu, 2023 ).
A review of speci fic antecedents allows the potential and the
limitations of these techniques applied to mango to be established.
A comparative analysis between YOLOv8 and Faster R-CNN for
mango detection trained both models with a dataset of 212 original
images expanded to 2,449 images and 116,654 annotations through
data augmentation: YOLOv8 reached 96.72% precision and 77.4%
recall, whereas Faster R-CNN achieved 98.57% precision but only
63.80% recall, evidencing that YOLO is faster and more balanced
for this task (Arcila-Dı́az et al., 2024). Recognition accuracy has also
been raised through convolutional neural networks for mango yield
estimation, evaluating eight crops with 800 images and reaching
98.85% accuracy on the test set ( Neethi and Raviraj, 2025). In India,
Faster R-CNN with a ResNet-50 backbone reached 98.20% preci-
sion for on-tree mango yield estimation, although with a small
dataset that limits generalization ( Vasanth and Pandian, 2024 ).
In Australia the problem was addressed from a more realistic
perspective, focusing on the inevitable underestimation of computer
vision methods. Each tree was captured from multiple angles and
four estimation methods were compared: human counting of 5% of
trees, counting of 18 trees selected by NDVI, uncorrected multi-
view counts and multi-view counts corrected for hidden fruit, with
mean percentage errors relative to packing-house counts of 26%,
13%, 11% and 17% respectively ( Anderson et al., 2021 ). These
results indicate that detecting visible fruit constitutes only part of
the problem, and that correcting the number of detections for
occluded fruit is indispensable if actual load is to be estimated
(Sarron et al., 2023 ). Hyperspectral imaging constitutes another
technological avenue: in an Australian orchard a ground vehicle
equipped with an HSI sensor pr oduced models validated on
hundreds of trees that reached coef ficients of determination of up
to 0.75 against manual counts and 0.83 against standard RGB
images, concluding that modern RGB cameras are already suf ficient
if processed appropriately ( Gutiérrez et al., 2019 ). Satellite ap-
proaches have been less successful: mango yield prediction from
very-high-resolution imagery obtained 26.5% error at the individual
tree level, concluding that no universal relationship exists between
satellite vegetation indices and fruit counts ( Torgbor et al., 2024 ).
Double counting in video has been addressed by combining
YOLOv4-tiny with Kalman filters to count apples in video se-
quences, reaching 94.47% detection precision and 81.94% counting
accuracy, with a coef ficient of determination of 0.986 relative to
manual counting ( Gao et al., 2021 ). This line was later extended
with Cascade-SORT, fusing motion and appearance features
through Kalman filters and Mahalanobis distances, obtaining
lower errors than standard SORT in camellia and apple videos
(He et al., 2022 ). A systematic comparison of tracking-by-detection
Huaman Asencio et al. 10.3389/fpls.2026.1943711
Frontiers in Plant Science frontiersin.org02
algorithms for apple orchard production estimation concluded that
the combination of a YOLO detector with DeepSORT was the most
robust ( Villacrés et al., 2023 ).
Fruit detection methods have been applied to a range of crops.
Green oranges were counted directly from trees using arti ficial
intelligence, with detection counts closely matching manual refer-
ences ( Gremes et al., 2023 ). Faster R-CNN was adapted for
strawberries, replacing the backbone with a multi-cascade network
and RoiPooling with RoiAlign, obtaining average precisions of
0.9019 for ripe and 0.8447 for unripe fruit ( Li et al., 2023 ). A
particularly relevant challenge for tomato cultivation was addressed
by adding illumination and planting-density variability through
domain adaptive learning, reaching 96.80% mAP and exceeding
YOLOv8 by 2.17 points ( Li et al., 2024 ). Maturity recognition and
fruit counting for sweet peppers in greenhouses achieved 85.7%
precision under difficult conditions ( Viveros Escamilla et al., 2024 ),
which constitutes the closest antecedent to the category classi fica-
tion task addressed here. In addition, a lightweight pear detector
based on frequency domain data augmentation and YOLOv7
reached 97.23% mAP at 69.39 frames per second ( Zheng and
Yang, 2024 ).
Peru-specific contributions have also emerged in recent years.
In Lambayeque, a system for the automated detection and counting
of Gossypium barbadense fruits achieved precisions close to 100%
and was integrated into a web application accessible to growers
(Ballena-Ruiz et al., 2025 ). In Tacna, several deep learning models
were evaluated for olive detection and counting, concluding that the
YOLO family was the most effective, with 94.96% precision and a
coefficient of determination of 0.944 ( Osco-Mamani et al., 2025 ).
These works demonstrate that d etection technologies can be
adapted to Peruvian conditions, but also that models do not transfer
directly: a detector trained in another country or crop requires
retraining with local data.
This review allows several research gaps to be identi fied. First,
YOLO architectures dominate the detection field owing to their
balance between speed and accuracy, but region-based detectors
remain a reference when accuracy takes precedence over speed.
Second, almost all studies con fine themselves to detecting and
counting; very few evaluate classi fication into commercial fruit
categories, which is precisely the information that determines the
economic value of the harvest. Third, most mango studies were
conducted in Australia, China and India, and the few Peruvian
contributions address other crops, none addressing counting by
commercial categorization. Fourth, models do not transfer directly,
since climate, tree architecture and fruit morphology differ between
production regions, so that collecting local data, retraining and
validating is indispensable. Finally, correction for hidden fruit
becomes unavoidable if actual production, and not merely visible
fruit, is to be estimated with greater accuracy.
Accordingly, the present research addresses the following
question: is it possible to optimize the estimation of Kent mango
production by commercial category using machine learning tech-
niques combined with image analysis? The general objective was to
develop a method based on machine learning and image processing
to estimate the production of Kent mango fruit by export category,
implementing deep learning models that detect and classify fruit in
RGB images obtained under real field conditions in the Motupe
district. The specific objectives were: (i) to build a set of RGB images
of Kent mango in Motupe fields, de fining the commercial export
categories as classi fication classes; (ii) to preprocess and label the
dataset, establishing an annotati on protocol that distinguishes
categories by colour, size and ripeness according to market stan-
dards; (iii) to implement and train detection and classi fication
architectures, evaluating precision, recall, mean average precision
and processing time; and (iv) to validate the method by comparing
automated estimates against manual estimates.
2 Materials and methods
2.1 Study design
The research is applied in nature, since it is oriented towards
solving a concrete problem in the agricultural sector, namely the
estimation of Kent mango production by export category. The
design is quasi-experimental: five object detection models were
trained and compared under controlled conditions, holding con-
stant the main hyperparameters, the dataset partition and the
random seed across all experiments. The design quali fies as quasi-
experimental rather than fully experimental because the detector
architecture, the manipulated factor, could not be randomly as-
signed to the fixed pool of annotated ima ges; instead, every
architecture was evaluated on the same pre-existing training,
validation and test partitions, which functioned as matched, non-
randomized comparison groups. The only factor varying between
experiments is the detector architecture, which allows the observed
differences in the metrics to be attributed to the model and not to
the training conditions.
2.2 Study area and image acquisition
The study population comprised Kent mango (Mangifera indica
L., cv. Kent) farms located in the Motupe district, province and
department of Lambayeque, northern Peru. Ten farms at the
harvest stage were selected and 20 sample trees were chosen from
each, including trees of different sizes and fruit loads, giving a total
of 200 evaluated trees. Sampling was non-probabilistic and by
convenience, conditioned by access to the farms and by coincidence
with the harvest calendar. Figure 1 shows the location of the region
within the national territory and the distribution of the farms from
their GPS coordinates.
Table 1 details the characterization of the ten farms, with their
geographic coordinates and the harvested production by category.
Total harvested production across the ten farms amounted to
345,649 kilograms, of which 98.7% corresponded to the sea freight
category and 1.3% to the air freight category. Reject fruit is not
accounted for as harvested production, since it is not destined for
export trade. The air freight category was present in only four of the
ten evaluated farms, which con firms the scarcity of fruit of optimal
calibre for air freight export.
Images were captured with a Samsung Galaxy A52 mobile
device in JPG format with RGB encoding and a resolution of
Huaman Asencio et al. 10.3389/fpls.2026.1943711
Frontiers in Plant Science frontiersin.org03
3,468 × 4,624 pixels. Photographs were taken between 08:00 and
13:00, the period during which field evaluation staff begin their
visual and manual production estimation work. The photographer
stood in front of each selected tree at a distance of approximately 7
to 8 metres, reducing the distance when the plant was smaller. The
device was held at the operator ’s face height, approximately 1.70
metres, always maintaining the vertical orientation of the phone.
Two images were captured per tree, one from the front and one
from the rear relative to the first shot, mirroring the evaluation
performed by specialist personnel. This two-view capture replicates
the multi-view logic that has been shown to reduce underestimation
from occlusion in mango orchards ( Anderson et al., 2021 ; Sarron
et al., 2023 ). An initial set of 443 photographs was obtained, which
was subsequently filtered to the 400 final images used for training.
Figure 2 shows two representative examples of the captured
image set.
FIGURE 1
Geographic location of the evaluated farms: (A) Lambayeque region within Peru; (B) distribution of the ten farms in the Motupe district.
Huaman Asencio et al. 10.3389/fpls.2026.1943711
Frontiers in Plant Science frontiersin.org04
2.3 Annotation protocol and class
definition
Dataset labelling was performed with LabelImg version 1.8.6,
open source software under the MIT licence that allows bounding
boxes to be drawn visually and annotations to be exported in YOLO
format. Each fruit was labelled with one of three categories, air
freight, sea freight or reject, following the classi fication criteria used
by the processing plant for Kent mango export. Table 2 describes
the assignment criteria for each category. Visible fruit were anno-
tated with bounding boxes fitted to the observable contour. Partially
occluded fruit were annotated when the visible portion allowed the
annotator to delimit a box and assign a commercial category
consistently; completely hidden or visually indistinguishable fruit
were not annotated. A dataset-level quality control pass checked
class indices, YOLO coordinate format, empty labels, and consis-
tency of the train/validation/test class distributions.
The YOLO annotation format represents each object through a
text line containing the class and the normalized coordinates of the
box centre, together with its width and height, as shown inEquation 1:
(class, xc=W, yc=H, w=W, h=H)( 1 )
where x_c and y_c are the coordinates of the bounding box
centre in pixels, w and h its width and height, and W and H the
dimensions of the image. Normalization makes the annotation
independent of resolution, which is necessary because the images
are rescaled during training.
The dataset comprises a total of 66,465 annotated instances
distributed markedly unevenly across the three categories: 57,213
instances of the sea freight class (86.1%), 6,780 of the reject class
(10.2%) and only 2,472 of the air freight class (3.7%). The imbalance
is severe: the majority class exceeds the air freight class by a factor of
23.1 and the reject class by a factor of 8.4. This condition is inherent
to the phenomenon under study and not to a sampling bias, since it
reflects the actual composition of production, in which fruit of
optimal quality for air freight export constitutes a minority fraction
of the total harvest. The proportion of air freight category fruit
varies considerably between farms, ranging from 14.0% in farm F01
to 0.2% in F07.
FIGURE 2
Representative sample of the Kent mango dataset captured in the
field (front and rear view of the same tree).
TABLE 2 Classification criteria by commercial export category.
Class
index
Category Commercial
destination
Assignment criterion
0 Air freight Air freight export Fruit of optimal calibre and
colouring, without visible
defects in the epidermis;
corresponds to the category
of highest commercial value.
1 Sea freight Sea freight export Fruit suitable for export with
longer transit time; admits a
lower degree of ripeness and
slight imperfections that do
not compromise conservation.
2 Reject Domestic market/
industry
Fruit with mechanical
damage, pest damage,
deformation or calibre outside
specification; does not meet
export requirements.
TABLE 1 Characterisation of the evaluated farms and harvested production by category.
Farm Date Latitude Longitude Plants Air freight (kg) Sea freight (kg) Total harvested (kg)
01 18/01/2025 -6.129294 -79.668898 7,500 0 86,189 86,189
02 18/01/2025 -6.167870 -79.713671 2,500 2,394 112,230 114,624
03 20/01/2025 -6.112431 -79.677217 500 685 27,655 28,340
04 21/01/2025 -6.147151 -79.630830 1,200 0 27,722 27,722
05 21/01/2025 -6.131818 -79.685369 500 1,048 19,173 20,221
06 22/01/2025 -6.077508 -79.643959 600 403 10,148 10,551
07 22/01/2025 -6.075525 -79.633129 550 0 33,323 33,323
08 24/01/2025 -6.103628 -79.653628 130 0 3,401 3,401
09 24/01/2025 -6.102513 -79.651618 450 0 11,774 11,774
10 24/01/2025 -6.103613 -79.653116 400 0 9,504 9,504
Total 14,330 4,530 341,119 345,649
Huaman Asencio et al. 10.3389/fpls.2026.1943711
Frontiers in Plant Science frontiersin.org05
2.4 Patch generation and dataset
partitioning
Since the original images have a high resolution (3,468 × 4,624
pixels) and the fruits appear as small objects, direct rescaling to the
network input resolution would cause many fruits to occupy only a
few pixels, hindering their detection. Each image was therefore
divided into patches of 1,280 × 1,280 pixels with an overlap of 20%.
This strategy increases the number of training instances, preserves
the effective resolution of each fruit and helps the model learn local
patterns. The displacement step between consecutive patches is
obtained as shown in Equation 2:
s = p· (1 − o) (2)
where p is the patch size and o the overlap fraction, giving a step
of 1,024 pixels. The overlap guarantees that fruit located at the
border of a patch appear complete in the adjacent patch, avoiding
truncated boxes. The number of patches per image is determined as
shown in Equation 3:
N =( ½(W − p)=s/C138 +1 ) · (½(H − p)=s/C138 + 1) (3)
Figure 3 summarizes the pipeline of the proposed method.
Each patch retained the YOLO annotations of the fruits
contained within its area, recalculating the box coordinates relative
to the new origin. Two filtering criteria were applied to guarantee
the quality of the resulting annotations. The first establishes a
minimum of one instance per patch, so that patches corresponding
to foliage or sky regions without fruit are discarded and do not
introduce empty examples into training. The second sets a mini-
mum area ratio of 0.30, meaning that a bounding box sectioned by
the patch border is retained only if at least 30% of its original area
remains inside it; otherwise it is removed, preventing the model
from learning from non-representative fruit fragments. Figure 4
illustrates the patch generation process.
The resulting set comprised 6,544 patches containing a total of
66,465 annotated fruit instances. The partition was performed in a
70%/15%/15% proportion for training, validation and testing, using
a random seed of 42 to guarantee reproducibility. The seed was
fixed simultaneously in the random number generators of Python,
NumPy and PyTorch, and the deterministic mode of the latter was
enabled. Table 3 details the distribution by partition, where instance
density remains homogeneous across the three partitions, with a
global mean of 10.16 fruits per patch. This homogeneity con firms
that the stratified random partition did not introduce a density bias
between the training, validatio n and test sets, and that class
proportions remain stable with deviations below one percentage
point. Given that patch generation already multiplies the number of
instances per class considerably, no additional oversampling tech-
nique was applied to the minority classes.
2.5 Detection models evaluated
Four baseline models were selected at the m scale, correspond-
ing to the medium size of each family, plus the proposed
architecture. The choice of the m scale sought a balance between
representational capacity and computational cost, so that the
models could be trained on the available GPU and subsequently
deployed on the web application server. Table 4 compares the
characteristics of each model.
2.6 Proposed architecture: Mango-YOLO
The Mango-YOLO architecture is built on the YOLO26m
structure and incorporates three modifications targeting the specific
characteristics of the problem: small fruit, partial occlusion by
foliage and high visual similarity between the air freight and sea
freight categories. The modi fications are a Convolutional Block
Attention Module (CBAM) at the end of the backbone, a neck based
on BiFPN nodes, and the replacement of the regression loss
function by MPDIoU.
The complete layer-by-layer con figuration of Mango-YOLO,
including the input source, module type, main arguments and
functional purpose of each layer, is provided in Table 5 .
The Convolutional Block Attention Module re fines the feature
map by sequentially applying channel attention and spatial attention
(Woo et al., 2018). Channel attention determines which channels are
most informative, and spatial attention determines in which regions
of the image to concentrate the response. Given an input feature map
F, channel attention is computed as shown in Equation 4:
Mc(F)= s (MLP(AvgPool(F)) + MLP(MaxPool(F))) (4)
where s is the sigmoid function and MLP is a shared multilayer
perceptron with a hidden reduction layer of r = 16. Spatial attention
is then obtained as shown in Equation 5 :
Ms(F)= s (f 7/C27(½AvgPool(F); MaxPool(F)/C138)) (5)
where f^{7×7} denotes a convolution with a 7 × 7 kernel and the
pooling operators are applied along the channel dimension. The
refined output map is obtained by element-wise product, as shown
in Equation 6 :
F0 = Mc(F) ⊗ F, F00 = Ms(F0) ⊗ F0 (6)
Figure 5 summarizes the data flow through the CBAM module.
The weighted bidirectional feature pyramid network, proposed
in Ef ficientDet, replaces the simple concatenation fusion used in
conventional necks (Tan et al., 2020). Each BiFPN node projects the
inputs to a common number of channels, interpolates the maps to a
common resolution and combines them through a weighted sum
with learned weights. Fast normalized fusion is de fined as shown in
Equation 7:
O =( owi ·I i)=(e + owj) (7)
where I_i are the input maps, w_i the learned weights con-
strained to non-negative values through ReLU, and e =1 0 −6 a
numerical stability term that avoids division by zero. This weighting
allows the network to assign greater weight to the scales that are
most informative for the dataset, instead of treating all scales
Huaman Asencio et al. 10.3389/fpls.2026.1943711
Frontiers in Plant Science frontiersin.org06
equally. In the implemented model, four BiFPN nodes build the
top-down and bottom-up paths of the pyramid, producing the three
output maps P3, P4 and P5 that feed the detection head.
The MPDIoU loss explicitly incorporates the distance between
the extreme points of the predicted box and the reference box,
improving regression convergence when objects are small or
overlap ( Ma and Xu, 2023 ). The standard intersection over union
is first computed as shown in Equation 8:
IoU = B ∩ Bgt
/C12/C12 /C12/C12= B ∪ Bgt/C12/C12 /C12/C12 (8)
where B and B_gt are the predicted and reference boxes. The
squared Euclidean distances between the top-left and bottom-right
corners of both boxes are then computed as shown in Equations 9
and 10:
d1 =( x1 − x1,gt )2 +( y1 − y1,gt )2 (9)
FIGURE 3
General pipeline of the proposed method for estimating Kent mango production by category.
Huaman Asencio et al. 10.3389/fpls.2026.1943711
Frontiers in Plant Science frontiersin.org07
d2 =( x2 − x2,gt )2 +( y2 − y2,gt )2 (10)
Both distances are normalized with respect to the diagonal of
the reference box, and the loss is de fined as shown in Equation 11:
LMPDIoU =1 − IoU + d1=(w2gt + h2gt )+ d2=(w2gt + h2gt ) (11)
where w_gt and h_gt are the width and height of the reference
box. Normalization by the diagonal makes the penalty invariant to
object scale, which is relevant in this dataset, where the apparent
size of the fruit varies with the distance from the tree to the camera.
In the implementation, the loss was integrated by substituting the
IoU computation within the Ultralytics metrics module.
2.7 Training confi guration
All models were trained for a maximum of 100 epochs with a
batch size of 4 and an input resolution of 640 × 640 pixels; the 1,280
× 1,280 patches are rescaled to that resolution within the data
FIGURE 4
Patch generation process: (A) division of the original image into a patch grid; (B) 20% overlap between adjacent patches.
Huaman Asencio et al. 10.3389/fpls.2026.1943711
Frontiers in Plant Science frontiersin.org08
loader. The random seed was fixed at 42 and deterministic mode
was enabled to guarantee reproducibility. Early stopping was used
with a patience of 20 epochs, so that training halted automatically if
no improvement was observed in the validation metric during that
period; the retained checkpoint always corresponds to the best
epoch and not to the last. The YOLO and RT-DETR-l models were
initialized with weights pretrained on the COCO dataset, applying
transfer learning ( Pan and Yang, 2010 ). Data augmentation tech-
niques were applied during training ( Shorten and Khoshgoftaar,
2019), whose values are detailed in Table 6. The data augmentation
configuration of Mango-YOLO is deliberately more aggressive than
that of the baselines, because the proposed architecture is trained
from a con figuration de fined by a YAML file and not from
pretrained weights, and therefore requires greater apparent vari-
ability in the data to compensate for the absence of COCO
initialization and to reduce the risk of over fitting.
Training was executed on Google Colaboratory through a Colab
Pro subscription, which provided access to an NVIDIA L4 graphics
processing unit with 22 GB of VRAM, 4 virtual CPUs and 53 GB of
system RAM, with mixed precision (AMP) enabled by Ultralytics.
The software environment comprised Python 3.12, PyTorch 2.11
with CUDA 12.8, Ultralytics 8.4.87, NumPy and scikit-learn.
2.8 Evaluation metrics
Model evaluation was carried out on the validation set during
training and subsequently on the test set, which took no part in any
phase of the fitting. A detection is considered a true positive (TP)
when the intersection over union with a reference box of the same
class exceeds an established threshold; otherwise it is considered a
false positive (FP). Reference boxes with no associated detection
constitute false negatives (FN). Precision is de fined as shown in
Equation 12:
P = TP=(TP + FP) (12)
recall as shown in Equation 13 :
R = TP=(TP + FN) (13)
and the F1-score, the harmonic mean of both, as shown in
Equation 14:
F1=2 · (P·R )=(P + R) (14)
The average precision (AP) of a class is obtained as the area
under the precision-recall curve, computed through 101-point
interpolation, as shown in Equation 15 :
AP =( 1=101) · oPinterp(r), r ∈ 0, 0:01, …,1fg (15)
The mean average precision (mAP) is the average of the AP
over the three classes of the problem, as shown in Equation 16:
mAP =( 1=K) · oAPk, k =1 , …, K, K = 3 (16)
Two variants are reported. The mAP@0.5 metric uses a single
IoU threshold of 0.50 and fundamentally evaluates classi fication
and detection capability. The mAP@0.5:0.95 metric averages the
mAP computed over ten equally spaced IoU thresholds between
0.50 and 0.95, as shown in Equation 17 , and is considerably more
demanding, since it penalizes imprecise bounding box adjustments:
mAP @0 :5:0 :95 = (1 =10) · omAP@ t , t ∈ 0:50, …,0 :95fg (17)
2.9 Yield estimation and web application
Once the best detection model had been selected, production
per category was estimated. For each photograph, detections
classified as air freight, sea freight or reject are counted. Since
only a sample of the farm ’s plants is photographed, the resulting
count must be scaled to the total number of plants through the
factor shown in Equation 18 :
TABLE 3 Distribution of the patch dataset by partition.
Partition Patches % of
patches
Instances % of
instances
Instances per
patch
% Air
freight
% Sea
freight
%
Reject
Training 4,557 69.6% 45,915 69.1% 10.08 3.9% 85.8% 10.3%
Validation 968 14.8% 9,595 14.4% 9.91 2.6% 87.8% 9.7%
Test 1,019 15.6% 10,955 16.5% 10.75 4.0% 85.6% 10.4%
Total 6,544 100.0% 66,465 100.0% 10.16 3.7% 86.1% 10.2%
Bold values indicate the overall totals and percentages for the complete dataset.
TABLE 4 Detection models evaluated and their main characteristics.
Model Family/
paradigm
Distinctive
characteristic
Reference
YOLOv8m One-stage
anchor-free
CNN
Decoupled detection head;
balance between speed and
accuracy.
Arcila-Dı́az
et al., 2024
YOLO11m One-stage
anchor-free
CNN
C3k2, SPPF and C2PSA
blocks for more ef ficient
feature extraction.
Liao et al., 2025
YOLO26m One-stage
anchor-free
CNN
NMS-free inference; removes
Distribution Focal Loss; label
assignment oriented to small
objects.
Jocher et al.,
2026
RT-
DETR-l
Transformer
(real-time
DETR)
Efficient hybrid encoder; no
NMS required; adjustable
inference speed.
Zhao et al.,
2024
Mango-
YOLO
(proposed)
One-stage
CNN +
attention
YOLO26m as base, with
CBAM, BiFPN and MPDIoU
loss.
Woo et al.,
2018; Tan et al.,
2020; Ma and
Xu, 2023
Huaman Asencio et al. 10.3389/fpls.2026.1943711
Frontiers in Plant Science frontiersin.org09
k = Ntotal=Nsampled (18)
and the scaled count of each category c is obtained as shown in
Equation 19 :
bn c = nc ·k (19)
Yield in kilograms was estimated from the automatic count by
commercial category using Monte Carlo simulation. For each
category c, the system used a mean fruit weight m_c and a standard
deviation s_c as conversion parameters. The mean weights used in
the projection were 0.45 kg for air freight, 0.40 kg for sea freight and
0.35 kg for reject fruit; these values were kept fixed across all
evaluated farms to ensure comparability between validation units.
S = 10,000 simulations are generated; in each simulation s, the
weight of each of the ^n c fruits is sampled independently from a
normal distribution, as shown in Equation 20 :
wi e N(mc, s 2c ), i = 1 , …, bn c (20)
The total weight of the category in simulation s is the sum of the
individual weights, and the total weight of the farm is the sum over
the three categories, as shown in Equation 21 :
Ws = ocoi=1 bn cwi,c (21)
The point estimate of production is the mean of the set of
simulations, as shown in Equation 22 :
bY =( 1=S) · oWs, s =1 , …, S (22)
and the 90% con fidence interval is obtained directly from the
empirical percentiles of the simulated distribution, as shown in
Equation 23:
CI90 % = ½P5(W), P95(W)/C138 (23)
When the standard deviation of a category is not recorded or is
zero, the system assumes by default s_c = 0.10 · m_c.
TABLE 5 Layer-by-layer con figuration of the proposed Mango-YOLO architecture.
Layer From Module Arguments Purpose
0 -1 Conv [64, 3, 2] Initial downsampling and low-level feature extraction.
1 -1 Conv [128, 3, 2] Second downsampling stage for early spatial features.
2 -1 C3k2 x2 [256, False, 0.25] CSP feature extraction with compact bottleneck blocks.
3 -1 Conv [256, 3, 2] Downsampling toward the P3 feature scale.
4 -1 C3k2 x2 [512, False, 0.25] Intermediate feature extraction for small and medium fruit.
5 -1 Conv [512, 3, 2] Downsampling toward the P4 feature scale.
6 -1 C3k2 x2 [512, True] Deeper backbone representation with shortcut connections.
7 -1 Conv [1024, 3, 2] Downsampling toward the P5 semantic feature scale.
8 -1 C3k2 x2 [1024, True] High-level semantic feature extraction.
9 -1 SPPF [1024, 5, 3, True] Spatial pyramid pooling to enlarge receptive field.
10 -1 C2PSA [1024] Position-sensitive attention before the proposed attention block.
11 -1 CBAM [512] Channel and spatial attention to emphasise visible mango regions.
12 [11, 6] BiFPN_Node [512, 256, 256] Top-down fusion from P5 and P4 features.
13 [-1, 4] BiFPN_Node [256, 128, 128] Top-down fusion to obtain the P3 detection feature.
14 [-1, 12] BiFPN_Node [128, 256, 256] Bottom-up fusion to re fine the P4 detection feature.
15 [-1, 11] BiFPN_Node [256, 512, 512] Bottom-up fusion to re fine the P5 detection feature.
16 [13, 14, 15] Detect [3] Three-class detection head for air freight, sea freight and reject fruit.
FIGURE 5
Data flow of the CBAM attention module, with its channel attention and spatial attention submodules.
Huaman Asencio et al. 10.3389/fpls.2026.1943711
Frontiers in Plant Science frontiersin.org10
To propagate uncertainty in the category mean weight, the
system included a parametric simulation variant in which m_c is
treated as an operational random variable. In each iteration, a
possible value of m_c is first sampled from a normal distribution, as
shown in Equation 24 :
mc e N(m0, t2) (24)
In each of the M = 10,000 samples, a value of the mean weight is
first drawn from the posterior distribution and, conditional on that
value, the individual weights of the fruits are generated, as shown in
Equation 25 :
wi ∣ mc e N(mc, s 2c ) (25)
Total production is obtained by aggregation as in the Monte
Carlo procedure, and the 90% interval is computed from the
empirical percentiles of the simulated distribution. Accordingly,
the implementation is described as Monte Carlo simulation with
parametric uncertainty in the mean fruit weight by category.
The web application, named Mango Smart, allows users to
upload photographs of Kent mango plantations and obtain an
estimate of production by category. It is structured in a three-tier
client-server architecture. The presentation layer, developed in
Angular 19, runs in the user ’s browser and manages photograph
upload and result visualizati on, compressing each image to a
maximum of 1,920 × 1,080 pixels at 85% JPEG quality before
sending it. The business logic layer, implemented in Laravel on PHP
8.2, exposes a REST API that orchestrates the flow, stores the
images, invokes the Python inference and estimation scripts, and
persists the results. The data layer, on SQL Server, stores the
estimates, the photographs and the categories. The inference
engine uses Python and Ultra lytics to run the Mango-YOLO
model, whereas the estimation engine uses Python and NumPy to
convert fruit counts into kilograms through Monte Carlo simula-
tion. Figure 6 presents this architecture.
3 Results
3.1 Overall detection performance
The models were trained under identical conditions and eval-
uated on the test set, composed of 1,019 patches with 10,955
annotated instances that took no part in weight fitting. Table 7
presents the consolidated results matrix, which constitutes the basis
of all analyses in this section. Two derived columns are incorpo-
rated: the localisation gap, de fined as the difference between mAP@
0.5 and mAP@0.5:0.95, and the number of epochs elapsed after
reaching the optimum, which evidences the activation of the early
stopping mechanism.
The Mango-YOLO model obtained the best performance across
the five evaluated metrics, reaching its optimum at epoch 78 within
the 100-epoch budget assigned to all experiments, with a precision
of 0.930, a recall of 0.940, an F1-score of 0.930, a mAP@0.5 of 0.940
and a mAP@0.5:0.95 of 0.730. It was followed by YOLO26m with an
F1-score of 0.925 and a mAP@0.5 of 0.930, and then YOLO11m,
with an F1-score of 0.895 and a mAP@0.5 of 0.900. RT-DETR-l
occupied fourth position with an F1-score of 0.875, ahead of
YOLOv8m, which recorded 0.865 and obtained the lowest perfor-
mance of the set, with a mAP@0.5:0.95 of 0.620. Figure 7 allows the
four main metrics to be compared visually across the five evalu-
ated models.
To quantify the magnitude of each architecture ’s advantage
over the others, a pairwise difference matrix of the F1-score was
constructed, whose element in row i and column j corresponds to
the difference between the F1-score of model i and that of model j,
as shown in Equation 26 :
Dij = F1i − F1j (26)
Positive values indicate that the row model outperforms the
column model, and negative values the opposite. The row corre-
sponding to Mango-YOLO presents positive values in all its cells,
confirming that this model outperforms the four remaining archi-
tectures without exception, while the row for YOLOv8m presents
negative values throughout, being the lowest-performing model of
the set. The difference between the best and the worst model is 0.065
F1-score points (0.930 against 0.865), representing a 7.5% gap in
relative terms. The distance between Mango-YOLO and
YOLO26m, the two best models, is 0.005 points, while both are
separated from YOLO11m, the third-ranked model, by 0.035 and
0.030 points respectively. This structure reveals that the proposed
architecture and its base model form a performance block clearly
TABLE 6 Training and data augmentation hyperparameters.
Hyperparameter Baselines
(YOLOv8m,
YOLO11m,
YOLO26m)
Mango-
YOLO
RT-
DETR-l
Epochs (maximum) 100 100 100
Batch size 4 4 4
Input resolution 640 × 640 640 × 640 640 × 640
Random seed 42 42 42
Patience (early stopping) 20 20 20
Optimiser Automatic
(AdamW)
AdamW Automatic
Initial learning rate (lr0) 0.01 0.01 0.01
Final learning rate (lrf) 0.01 0.01 0.01
Dropout 0.1 0.1 n/a
Mosaic 1.0 1.0 n/a
Mixup 0.1 0.2 n/a
Hue variation (hsv_h) 0.015 0.02 n/a
Saturation variation (hsv_s) 0.7 0.8 n/a
Brightness variation (hsv_v) 0.4 0.5 n/a
Rotation (degrees) 5 10 n/a
Translation 0.1 0.15 n/a
Scaling 0.5 0.6 n/a
Horizontal flip ( fliplr) 0.5 0.5 n/a
Vertical flip ( flipud) n/a 0.1 n/a
Huaman Asencio et al. 10.3389/fpls.2026.1943711
Frontiers in Plant Science frontiersin.org11
separated from the three remaining architectures, among which
differences do not exceed 0.030 points.
3.2 Training convergence
The training log of each model allows the evolution of the
metrics across epochs to be analyzed beyond the final consolidated
value. Figure 8 presents the evolution of mAP@0.5:0.95 on the
validation set; the circular marker indicates the epoch at which each
model reached its optimum, that is, the checkpoint retained for the
final evaluation.
The curves reveal differentiated behaviour between architec-
tures. RT-DETR-l shows a very rapid rise in the first epochs,
consistent with its nature as a pretrained Transformer-based
detector, but stabilizes at a level below that of YOLO26m. The
latter presents a more gradual and sustained rise, reaching its
optimum at epoch 41. YOLO11m requires the largest number of
epochs among the baselines to reach its maximum, at epoch 55. In
the four baseline models the difference between the last epoch and
the best epoch is constant and equal to 20, except in YOLOv8m
where it rises to 24, which con firms that training halted through the
early stopping mechanism after exhausting the con figured patience.
The behaviour of Mango-YOLO is qualitatively distinct. Its
curve presents the slowest start of the set: during the first twenty-
five epochs it remains at values close to 0.10 mAP@0.5:0.95, well
below the models initialized with COCO pretrained weights,
reflecting that the network must learn low-level representations
from scratch. From epoch 30 onwards it begins a sustained and
pronounced rise that places it above all reference architectures by
around epoch 60, and it reaches its optimum at epoch 78 with a
mAP@0.5:0.95 of 0.730. During the remaining 22 epochs the curve
describes a stable plateau, without further improvement of the
validation metric, which evidences that the model attained effective
convergence within the assigned budget. It was therefore the latest-
converging model of the set, with a best epoch 7.8 times higher than
that of RT-DETR-l and 1.9 times higher than that of YOLO26m.
Analysis of the loss functions rules out over fitting as an
alternative explanation of the results. In the evaluated models, the
training and validation curves for box regression loss, classi fication
loss and distribution focal loss descend jointly and maintain a
reduced and stable separation throughout the process. The absence
of a growing divergence between the two curves, that is, of a
sustained decrease in training loss accompanied by a rise in
validation loss, indicates that the models did not incur over fitting
TABLE 7 Comparative performance of the detection models on the test set.
Model Best
epoch
Last
epoch
Epochs after
optimum
Precision Recall F1-score mAP@0.5 mAP@0.5:0.95 mAP gap
YOLOv8m 21 45 24 0.860 0.870 0.865 0.860 0.620 0.240
YOLO11m 55 75 20 0.890 0.900 0.895 0.900 0.680 0.220
YOLO26m 41 61 20 0.920 0.930 0.925 0.930 0.720 0.210
RT-DETR-l 10 30 20 0.870 0.880 0.875 0.880 0.650 0.230
Mango-YOLO 78 100 22 0.930 0.940 0.930 0.940 0.730 0.210
FIGURE 6
Architecture of the Mango Smart system, with its three layers and the inference and estimation engines.
Huaman Asencio et al. 10.3389/fpls.2026.1943711
Frontiers in Plant Science frontiersin.org12
within the number of epochs executed, and con firms that the
combination of dropout and data augmentation applied
was adequate.
3.3 Localisation gap
Figure 9 contrasts, for each model, the value of mAP@0.5 with
that of mAP@0.5:0.95, making explicit the magnitude of the gap
between the two metrics.
The gap ranges between 0.210 points, a value shared by Mango-
YOLO and YOLO26m, and 0.240 points in YOLOv8m, and occurs
systematically across the five architectures. Its interpretation is
relevant: the models correctly identify and classify the fruit under
a permissive overlap threshold, but the fine adjustment of the
bounding box coordinates is considerably less precise. An inverse
association is further observed between overall performance and the
magnitude of the gap: the two models with the highest F1-score are
also those recording the smallest gap, which suggests that
localisation quality constitutes a differentiating factor between
architectures and not a uniform error attributable exclusively to
the dataset.
3.4 Per-category performance
The global metrics presented so far average performance over
the three categories and, given the documented imbalance, are
FIGURE 8
Evolution of mAP@0.5:0.95 on the validation set during training. The marker indicates the best epoch of each model.
FIGURE 7
Comparison of precision, recall, mAP@0.5 and mAP@0.5:0.95 across the five evaluated models.
Huaman Asencio et al. 10.3389/fpls.2026.1943711
Frontiers in Plant Science frontiersin.org13
dominated by the sea freight class. To examine the behaviour of the
model in each category separately, the confusion matrix of Mango-
YOLO was constructed on the test set, using a con fidence threshold
of 0.25 and an intersection over union threshold of 0.50. The
confidence threshold of 0.25 was used as the conventional
Ultralytics operating criterion for retaining detections when con-
structing the matrix; it was not selected through a separate preci-
sion-recall calibration. The IoU threshold of 0.50 corresponds to the
standard mAP@0.5 criterion and was used to match each prediction
to a ground-truth box of the same class. The matrix incorporates a
fourth row and a fourth column termed background, necessary
because in a detection problem, unlike a pure classification problem,
there exist two types of error that a three-by-three matrix cannot
represent: the background column collects false positives, that is,
detections emitted by the model in regions where no annotated fruit
existed, and the background row collects false negatives, that is, fruit
present in the image that the model failed to detect. The matrix is
normalized by column, as shown in Equation 27 :
Cij = nij=oinij (27)
where the indices i and j range over the categories air freight, sea
freight, reject and background. The elements of the main diagonal
correspond to correct predictions, and the off-diagonal elements to
confusions between categories. Figure 10 presents the normalized
confusion matrix.
Table 8 details the metrics derived from the confusion matrix
for each category. The evaluation reveals that model performance is
not homogeneous across classes: the F1-score reached 0.960 in the
sea freight category, 0.845 in air freight and 0.792 in reject. Since the
sea freight category concentrates 86.1% of the instances, the global
metrics are dominated by its performance and should not be
interpreted as a guarantee of equivalent behaviour in the minority
categories, particularly in air freight, which corresponds to the fruit
of highest commercial value.
3.5 Processing time
As part of the evaluation of the third speci fic objective, the
inference time of each architecture was measured on 1,280-pixel
images, expressed in milliseconds per image and in frames per second
(FPS). Table 9 presents the results. The proposed Mango-YOLO
architecture, in addition to achieving the best detection performance,
maintains an inference time of 114.94 ms per image (8.7 FPS), very
close to that of the fastest model (YOLOv8m, 108.70 ms) and
substantially lower than that of its base architecture YOLO26m
(178.57 ms). This indicates that the modi fications introduced, that
is, the CBAM and BiFPN modules and the MPDIoU loss function,
improve accuracy without appreciably penalizing processing speed,
which is favourable for deployment in the web application.
3.6 Validation against actual harvested
yield
In order to validate the production estimate generated by the
system, the automated estimates of the selected model were com-
pared against the actual production harvested and recorded on the
processing plant scale for the ten evaluated farms. Actual produc-
tion per farm was obtained as the sum of the air freight and sea
freight categories effectively harvested, while the model estimate
corresponds to the projection generated by the Mango Smart
system from the automatic fruit count scaled to the total number
of plants on the farm. Table 10 presents both values and the
associated percentage error.
Four standard regression metrics were used to quantify the
accuracy of the estimate. The mean absolute error (MAE) measures
the average magnitude of the error in the units of the variable, as
shown in Equation 28 :
MAE =( 1=n) · o yi − by ijj (28)
FIGURE 9
Gap between mAP@0.5 and mAP@0.5:0.95 for each evaluated model.
Huaman Asencio et al. 10.3389/fpls.2026.1943711
Frontiers in Plant Science frontiersin.org14
The root mean squared error (RMSE) penalizes large errors
more severely, as shown in Equation 29 :
RMSE = √½(1=n) · o (yi − by i)2/C138 (29)
The mean absolute percentage error (MAPE) expresses the
error in relative terms, as shown in Equation 30:
MAPE = (100=n) · o yi − by ijj =yi (30)
The coefficient of determination (R 2) measures the proportion
of the variance of actual production explained by the estimate, as
shown in Equation 31 :
R2 =1 − ½o(yi − by i)2=o(yi − y)2/C138 (31)
where y_i is the actual production of farm i, ^y i the model
estimate, y the mean of actual production and n = 10 the number of
farms. The values obtained are presented in Table 11 . The model
reached a coef ficient of determination of 0.9993 and a mean
absolute percentage error of 2.63%, indicating an almost perfect
correspondence between the automated estimates and the actual
harvested production. The overall difference between the estimated
total (351,531.6 kg) and the actual total (345,649.4 kg) was only
1.7%, with per-farm errors ranging between −3.5% and +6.5%.
Figure 11 shows the dispersion between both values, in which
the ten farms lie practically on the ideal identity line, and Figure 12
presents the estimation error by farm. The fact that this correspon-
dence is maintained over a production range spanning from 3,401
to 114,624 kilograms indicates that the scaling factor from the
sample to the total number of plants operates stably regardless of
the size of the productive unit.
Additionally, the performance of the model was compared
against the manual estimate made by the field supervisor, with
the aim of contrasting the proposed automated method against the
traditional procedure. Table 12 presents the metrics of both
approaches for the sea freight category, which concentrates the
greater part of production.
The results evidence that the automated method substantially
outperforms the manual estimate. The manual procedure recorded
a mean absolute percentage error of 88.03% and a negative
coefficient of determination, a result attributable to an extreme
error committed on farm F07. Even excluding that observation, a
scenario deliberately favourable to the traditional method, the
TABLE 8 Per-category metrics of the Mango-YOLO model, derived from the confusion matrix.
Category Actual inst. TP FP FN Precision Recall F1-score
Air freight 435 368 68 67 0.844 0.846 0.845
Sea freight 9,378 9,058 437 320 0.954 0.966 0.960
Reject 1,142 908 242 234 0.790 0.795 0.792
Overall 10,955 10,334 747 621 0.933 0.943 0.938
FIGURE 10
Normalised confusion matrix of the Mango-YOLO model on the test set (con fidence threshold 0.25, IoU threshold 0.50).
Huaman Asencio et al. 10.3389/fpls.2026.1943711
Frontiers in Plant Science frontiersin.org15
model maintains a mean absolute percentage error (MAPE) of
2.73%, more than three times lower than that of the human
supervisor (8.90%). Figure 13 illustrates this difference by farm.
4 Discussion
The results obtained con firm the hypothesis put forward. The
Mango-YOLO model reached an F1-score of 0.930 and a mAP@0.5
of 0.940 in the detection and classi fication of Kent mango fruit into
three commercial categories, which supports the technical feasibility
of replacing manual visual counting with an automated procedure
under the field conditions of the Motupe district.
The precision value of 0.930 obtained by Mango-YOLO lies
below the 96.72% reported for YOLOv8 in mango detection (Arcila-
Dı́az et al., 2024 ) and the 98.20% achieved with Faster R-CNN and
ResNet-50 ( Vasanth and Pandian, 2024 ). This comparison must
nevertheless be qualified by a substantive difference in the definition
of the problem: the cited works address binary detection of mango
against background, whereas the present research simultaneously
resolves detection and classi fication into three commercial catego-
ries whose visual differentiation is subtle, particularly between air
freight and sea freight. The recall of 0.940 obtained considerably
exceeds the 77.4% reported for YOLOv8 and the 63.80% of Faster
R-CNN in the same comparative study ( Arcila-Dı́az et al., 2024 ),
which is especially relevant in this application, since an undetected
fruit translates directly into an underestimation of production. The
recorded performance also exceeds the 85.7% precision obtained in
the maturity recognition and counting of sweet peppers ( Viveros
Escamilla et al., 2024 ), which constitutes the closest antecedent in
terms of the category classi fication task, and approaches the 94.96%
achieved in olive detection in Tacna (Osco-Mamani et al., 2025), the
most comparable Peruvian work under field conditions.
The analysis of the training curves contributes an additional
element to the debate on architecture selection. RT-DETR-l reached
its optimum at epoch 10, 7.8 times faster than Mango-YOLO, which
confirms the data ef ficiency that the literature attributes to
Transformer-based detectors ( Zhao et al., 2024 ). That accelerated
convergence nevertheless stabilized at a lower performance level,
with an F1-score of 0.875 against 0.930. In a scenario with
computation time constraints, RT-DETR-l would constitute a
reasonable alternative; however, since training is performed only
once and inference is subsequently executed on the already-trained
model, the criterion of final performance prevails over that of
convergence speed. Convergence speed and performance ceiling
therefore constitute independent dimensions of detector behaviour.
The most relevant result for the discussion is the performance of
the proposed architecture, Mango-YOLO, which obtained the best
F1-score of the set (0.930), placing it 0.005 points above YOLO26m,
the base model on which it was built, and 0.065 points above
YOLOv8m, the lowest-performing architecture. The advantage over
the base model, modest in absolute magnitude, is nevertheless
consistent: it is veri fied simultaneously across the five evaluated
metrics and does not respond to a trade-off between precision and
recall. This result con firms the expectation derived from the
literature, according to which the incorporation of CBAM ( Woo
et al., 2018 ), BiFPN ( Tan et al., 2020 ) and MPDIoU ( Ma and Xu,
2023) should improve performance relative to the base architecture.
It must be acknowledged, however, that a difference of 0.005 F1-
TABLE 10 Comparison between actual harvested production and model estimate by farm.
Farm Plants Actual harvested (kg) Model estimate (kg) Error (%)
F01 7,500 86,189.2 86,411.7 +0.3
F02 2,500 114,624.3 116,873.4 +2.0
F03 500 28,339.7 28,753.1 +1.5
F04 1,200 27,721.8 27,957.1 +0.8
F05 500 20,221.1 21,006.5 +3.9
F06 600 10,550.3 10,184.9 −3.5
F07 550 33,323.0 34,738.9 +4.2
F08 130 3,401.5 3,352.1 −1.5
F09 450 11,774.3 12,545.4 +6.5
F10 400 9,504.2 9,708.4 +2.1
Total 14,330 345,649.4 351,531.6 +1.7
TABLE 9 Inference time of the evaluated models on 1,280-pixel images.
Model Time (ms/image) Estimated FPS
YOLOv8m 108.70 9.2
Mango-YOLO 114.94 8.7
YOLO11m 123.46 8.1
YOLO26m 178.57 5.6
RT-DETR-l 238.10 4.2
TABLE 11 Validation metrics of the yield estimate against actual
production.
Metric Value Interpretation
MAE 671.2 kg Mean error per farm in absolute units.
RMSE 934.2 kg Root mean squared error, sensitive to large deviations.
MAPE 2.63% Mean relative error with respect to actual production.
R2 0.9993 Proportion of the actual variance explained by the model.
Huaman Asencio et al. 10.3389/fpls.2026.1943711
Frontiers in Plant Science frontiersin.org16
score points is insuf ficient, on its own, to attribute a conclusive
superiority to the proposed ar chitecture in the absence of an
ablation study that isolates the contribution of each component.
This interpretation is coherent with two conditions of the
experimental design. First, Mango-YOLO was trained from a
configuration de fined by a YAML file, without initialization from
COCO pretrained weights, whereas the four reference architectures
did apply transfer learning ( Pan and Yang, 2010 ). The absence of
this initialization forces the network to learn low-level representa-
tions from scratch, which substantially increases the number of
epochs required to converge. Second, the data augmentation con-
figuration applied to Mango-YOLO was deliberately more aggres-
sive than that of the baselines , which increases the apparent
variability of the training set and further slows convergence. The
combination of both factors explains why the proposed architecture
required a substantially larger number of epochs than the baselines,
FIGURE 11
Dispersion between actual harvested production and model-estimated production for the ten evaluated farms.
FIGURE 12
Estimation error of the model by farm, relative to the mean absolute percentage error of 2.63%.
Huaman Asencio et al. 10.3389/fpls.2026.1943711
Frontiers in Plant Science frontiersin.org17
and accounts for its optimum being reached at epoch 78 against the
41 of YOLO26m, without this preventing its effective convergence
within the 100-epoch budget assigned equally to all experiments.
Regarding localisation quality, the systematic gap of between
0.210 and 0.240 points between mAP@0.5 and mAP@0.5:0.95
observed across all models constitutes the most consistent technical
limitation of the results. This behaviour is characteristic of the
detection of small and partially occluded objects, and is precisely the
phenomenon that the MPDIoU loss function incorporated in
Mango-YOLO contributes to mitigating ( Ma and Xu, 2023 ). The
fact that Mango-YOLO combines the best overall performance with
the smallest localisation gap of the set, a value it shares with its base
architecture YOLO26m, supports the effectiveness of the modifi ca-
tions introduced.
The class imbalance constitutes an additional factor condition-
ing the interpretation of the results. The air freight category, which
represents the fruit of highest commercial value, concentrates only
3.7% of the annotated instances, against 86.1% for the sea freight
category. The majority class exceeds the minority class by a factor of
23.1, which implies that the model has substantially fewer examples
available to learn the visual characteristics of the commercially most
relevant category. The reported global metrics, being averaged over
the three classes, are dominated by performance in the sea freight
category and should therefore not be interpreted as a guarantee of
equivalent performance in the detection of air freight category fruit.
To this condition is added the variability between farms: the
proportion of air freight fruit ranges between 14.0% on farm F01
and 0.2% on F07. This means that the model learns the character-
istics of this category from a reduced number of cultivation fields,
which compromises its generalization capacity to farms with
agronomic management conditions different from those repre-
sented in the training set. This behaviour is consistent with what
was observed in the deployed application, where the estimate
performed on a test farm recorded no detections of the air
freight category.
Finally, it is necessary to delimit the scope of the results
presented. The evaluation carried out measures the capacity to
detect and classify the fruit visible in the photographs, not the
actual production of the tree. The literature has consistently docu-
mented that computer vision methods underestimate fruit load
owing to fruit hidden by foliage, with errors reaching 26% when no
correction is applied (Anderson et al., 2021), and that correcting the
number of detections is a necessary step in yield estimation from
images (Sarron et al., 2023 ). In the present research, the capture of
two opposite views per tree partially mitigates this effect, but does not
eliminate it. Consequently, the detection metrics reported should not
be interpreted as a direct measure of the accuracy of the production
estimate in kilograms, even though the validation against the weights
recorded by the processing plant yielded a mean absolute percentage
error of 2.63%. The convergence of both results suggests that, under
the conditions evaluated, the underestimation attributable to occlu-
sion is partially compensated by the scaling factor from the sample to
the total number of plants, a compensation that has not been isolated
experimentally and that constitutes a priority line for future work.
TABLE 12 Performance of the model and of the field supervisor relative to actual production (sea freight category).
Method MAE (kg) RMSE (kg) MAPE (%) R2
Mango-YOLO model 831.8 1,217.5 2.73 0.9987
Field supervisor 29,080.0 84,403.0 88.03 negative
Supervisor (excluding F07) 2,680.0 3,691.0 8.90 0.9896
FIGURE 13
Absolute percentage error of the Mango-YOLO model and of the field supervisor relative to actual production, by farm. The extreme value recorded
by the supervisor on farm F07 (approximately 800%, truncated for scale) corresponds to a single manual estimate of 300,000 kg against an actual
harvest of 33,323 kg; even excluding this outlier, the model outperforms the supervisor on every remaining farm.
Huaman Asencio et al. 10.3389/fpls.2026.1943711
Frontiers in Plant Science frontiersin.org18
5 Conclusion
This research demonstrates that it is possible to optimize the
estimation of Kent mango production by commercial category
through the combination of machine learning techniques and
image analysis under the real field conditions of the Motupe district.
The contribution of the work is articulated on three levels.
Methodologically, a dataset o f Kent mango captured under
Peruvian field conditions with annotation by commercial export
category was built and documented, comprising 66,465 instances, a
resource that addresses a gap identified in the review of antecedents.
Architecturally, Mango-YOLO was proposed and validated, an
adaptation of YOLO26m through CBAM attention, BiFPN multi-
scale fusion and MPDIoU loss, which outperformed four state-of-
the-art reference architectures across all evaluated metrics without
an increase in inference cost. In applied terms, Mango Smart was
implemented, a three-tier web system that translates the automatic
fruit count over a sample of plants into a production estimate
expressed in kilograms through Monte Carlo simulation with
category mean weights and accompanied by a 90% interval.
The principal quantitative achievements are an F1-score of
0.930 and a mAP@0.5 of 0.940 in the joint task of detection and
classification into three commercial categories, and a mean absolute
percentage error of 2.63% with a coef ficient of determination of
0.9993 in the production estimate against the weights recorded on
the scale, a performance 3.3 times more accurate than that of the
field supervisor in the scenario most favourable to the latter.
Current limitations delimit the scope of these results with
precision. Performance on the air freight category, commercially
the most valuable, rests on only 3.7% of the annotated instances and
on a reduced number of farms, which compromises its generaliza-
tion. The evaluation quanti fies the detection of visible fruit and not
the actual fruit load of the tree, so that underestimation from foliar
occlusion remains partially mitigated by two-view capture, but
unresolved. The absence of an ablation study prevents the observed
improvement from being attributed to each of the three incorpo-
rated components separately. Finally, the evidence derives from a
single district and a single agricultural season.
Future work should prioritize: widening image capture on farms
with agronomic management oriented towards optimal-calibre fruit
in order to raise the representation of the air freight category;
incorporating an occlusion correction factor calibrated against
destructive counts of whole trees; executing an ablation study that
isolates the marginal contribution of CBAM, BiFPN and MPDIoU;
evaluating input resolutions above 640 × 640 pixels to reduce the
localisation gap; and extending validation to farms in other pro-
ducing districts and to successive agricultural seasons, increasing
the number of productive units with actual production recorded on
the scale beyond the ten paired observations of the present study.
Data availability statement
The raw data supporting the conclusions of this article will be
made available by the authors, without undue reservation.
Author contributions
VHA: Writing – original draft, Writing – review & editing.
HMC: Writing – review & editing. JAD: Writing – review & editing.
Funding
The author(s) declared that financial support was not received
for this work and/or its publication.
Acknowledgments
The authors thank the growers and field supervisors of the ten
evaluated farms in the Motupe district for granting access to their
plots during the harvest season and for providing the production
records of the processing plant, without which the validation
reported in this study would not have been possible.
Conflict of interest
The author(s) declared that this work was conducted in the
absence of any commercial or financial relationships that could be
construed as a potential con flict of interest.
Generative AI statement
Generative arti ficial intelligence was used to create visual and
illustrative content included in the manuscript. The AI-generated
images were created using Claude Code, with the Claude Sonnet 5
model. The use of generative AI was limited to Figure 3 and 6. These
AI-generated elements were used solely for illustrative purposes,
based on the data and results obtained from the research. The
authors reviewed the generated visual content and take full respon-
sibility for its accuracy and appropriateness.
Any alternative text (alt text) provided alongside figures in this
article has been generated by Frontiers with the support of arti ficial
intelligence and reasonable e fforts have been made to ensure
accuracy, including review by the authors wherever possible. If
you identify any issues, please contact us.
Publisher’s note
All claims expressed in this article are solely those of the authors
and do not necessarily represent those of their affiliated organizations,
or those of the publisher, the editors and the reviewers. Any product
that may be evaluated in this article, or claim that may be made by its
manufacturer, is not guaranteed or endorsed by the publisher.
Huaman Asencio et al. 10.3389/fpls.2026.1943711
Frontiers in Plant Science frontiersin.org19
References
Anderson, N. T., Walsh, K. B., Koirala, A., Wang, Z., Amaral, M. H., Dickinson, G. R.,
et al. (2021). Estimation of fruit load in Australian mango orchards using machine
vision. Agronomy 11, 1711. doi: 10.3390/agronomy11091711
Arcila-Dı́az, L., Mej ı́a-Cabrera, H. I., and Arcila-D ı́az, J. (2024). Estimation of mango
fruit production using image analysis and machine learning algorithms. Informatics 11,
87. doi: 10.3390/informatics11040087
Ballena-Ruiz, J., Arcila-D ı́az, J., and Tuesta-Monteza, V. (2025). Automated detection
and counting of Gossypium barbadense fruits in Peruvian crops using convolutional
neural networks. AgriEngineering 7, 152. doi: 10.3390/agriengineering7050152
Gao, F., Fu, L., Zhang, X., Majeed, Y., Li, R., Karkee, M., et al. (2021). Apple detection
and counting using real-time video based on deep learning and object tracking. Trans.
Chin. Soc Agric. Eng. 37, 217 –224. doi: 10.11975/j.issn.1002-6819.2021.21.025
Gremes, M. F., Fermo, I. R., Krummenauer, R., Flores, F. C., Gonc ̧alves Andrade, C. M.,
and Machado Coelho Silva, O. (2023). System of counting green oranges directly from
trees using arti ficial intelligence. AgriEngineering 5, 1813 –1831. doi: 10.3390/
agriengineering5040111
Gutiérrez, S., Wendel, A., and Underwood, J. (2019). Ground based hyperspectral
imaging for extensive mango yield estimation. Comput. Electron. Agric. 157, 126–135.
doi: 10.1016/j.compag.2018.12.041
He, L., Wu, F., Du, X., and Zhang, G. (2022). Cascade-SORT: a robust fruit counting
approach using multiple features cascade matching. Comput. Electron. Agric. 200,
107223. doi: 10.1016/j.compag.2022.107223
Instituto Nacional de Estad ı́stica e Informa ́tica (INEI) (2025). “Producción de mango
registró63 mil 114 toneladas, ” in Inei(Lima: Instituto Nacional de Estadística e
Informática (INEI)). Available online at: https://www.gob.pe/institucion/inei
(Accessed July 19, 2026).
Jocher, G., Qiu, J., Chaurasia, A., and Sapkota, R. (2026). Ultralytics YOLO26: uni fied
real-time end-to-end vision models. arXiv , arXiv:2606.03748. doi: 10.48550/
arXiv.2606.03748
Li, J., Zhu, Z., Liu, H., Su, Y., and Deng, L. (2023). Strawberry R-CNN: recognition and
counting model of strawberry based on improved Faster R-CNN. Ecol. Inform. 77,
102210. doi: 10.1016/j.ecoinf.2023.102210
Li, Y., Wang, W., Guo, X., Wang, X., Liu, Y., and Wang, D. (2024). Tomato detection
method using domain adaptive learning for dense planting environments. Trans. Chin.
Soc Agric. Eng. 40, 134 –145. doi: 10.11975/j.issn.1002-6819.202402039
Liao, Y., Li, L., Xiao, H., Xu, F., Shan, B., and Yin, H. (2025). YOLO-MECD: citrus
detection algorithm based on YOLOv11. Agronomy 15, 687. doi: 10.3390/agron-
omy15030687
Ma, S., and Xu, Y. (2023). MPDIoU: a loss for ef ficient and accurate bounding box
regression. arXiv, arXiv:2307.07662. doi: 10.48550/arXiv.2307.07662
Ministerio de Desarrollo Agrario y Riego (MIDAGRI) (2025). “Perúexportó289,508
toneladas me ́tricas de mango fresco en la campaña 2024/2025, ” in Midagri(Lima:
Ministerio de Desarrollo Agrario y Riego (MIDAGRI)).
Neethi, M. V., and Raviraj, P. (2025). Evaluation of convolutional neural network
models' performance for estimating mango crop yield. Int. J. Syst. Innov. 9, 1 –18.
doi: 10.6977/IJoSI.202502_9(1).0001
Osco-Mamani, E., Santana-Carbajal, O., Chaparro-Cruz, I., Ochoa-Donoso, D., and
Alcos-Flores, S. (2025). The detection and counting of olive tree fruits using deep
learning models in Tacna, Peru ́. AI 6, 25. doi: 10.3390/ai6020025
Pan, S. J., and Yang, Q. (2010). A survey on transfer learning. IEEE Trans. Knowl. Data
Eng. 22, 1345 –1359. doi: 10.1109/TKDE.2009.191
Sarron, J., Sane ́, C. A. B., Borianne, P., Male ́zieux, E., and Diatta, J. (2023). Fruit yield
estimation using image analysis is also about correcting the number of detections. Acta
Hortic. 1360, 351 –358. doi: 10.17660/ActaHortic.2023.1360.42
Shorten, C., and Khoshgoftaar, T. M. (2019). A survey on image data augmentation for
deep learning. J. Big Data 6, 1–48. doi: 10.1186/s40537-019-0197-0
Tan, M., Pang, R., and Le, Q. V. (2020). “EfficientDet: scalable and ef ficient object
detection”, in: Proceedings of the IEEE/CVF Conference on Computer Vision and
Pattern Recognition (CVPR) , 10781 –10790. doi: 10.1109/CVPR42600.2020.01079
Torgbor, B. A., Rahman, M. M., Brinkhoff, J., Sinha, P., and Robson, A. (2024). Exploring
the relationship between very-high-resolution satellite imagery data and fruit count for
predicting mango yield at multiple scales.Remote Sens. 16, 4170. doi: 10.3390/rs16224170
Vasanth, N. M., and Pandian, R. (2024). Fast region based convolutional neural
network ResNet-50 model for on tree mango fruit yield estimation. Indones. J. Electr.
Eng. Comput. Sci. 33, 1084 –1091. doi: 10.11591/ijeecs.v33.i2.pp1084-1091
Vibhute, A., and Bodhe, S. K. (2012). Applications of image processing in agriculture: a
survey. Int. J. Comput. Appl. 52, 34 –40. doi: 10.5120/8176-1495
Villacrés, J., Viscaino, M., Delpiano, J., Vougioukas, S., and Auat Cheein, F. (2023).
Apple orchard production estimation using deep learning strategies: a comparison of
tracking-by-detection algorithms. Comput. Electron. Agric. 204, 107513. doi: 10.1016/
j.compag.2022.107513
Viveros Escamilla, L. D., Gómez-Espinosa, A., Escobedo Cabello, J. A., and Cantoral-Ceballos,
J. A. (2024). Maturity recognition and fruit counting for sweet peppers in greenhouses using
deep learning neural networks.Agriculture14, 331. doi: 10.3390/agriculture14030331
Woo, S., Park, J., Lee, J.-Y., and Kweon, I. S. (2018). “CBAM: convolutional block
attention module ”, in: Proceedings of the European Conference on Computer Vision
(ECCV),3 –19. doi: 10.1007/978-3-030-01234-2_1
Zhao, Y., Lv, W., Xu, S., Wei, J., Wang, G., Dang, Q., et al. (2024).“DETRs beat YOLOs on
real-time object detection”,i n : Proceedings of the IEEE/CVF Conference on Computer
Vision and Pattern Recognition (CVPR), 16965–16974. doi: 10.48550/arXiv.2304.08069
Zheng, W., and Yang, Y. (2024). Mature stage pear detection method based on
frequency domain data augmentation and lightweight YOLOv7 model. J. Agric.
Mach. 55, 244 –253. doi: 10.6041/j.issn.1000-1298.2024.05.023
Zhong, Z., Yun, L., Cheng, F., Chen, Z., and Zhang, C. (2024). Light-YOLO: a
lightweight and ef ficient YOLO-based deep learning model for mango detection.
Agriculture 14, 140. doi: 10.3390/agriculture14010140
Huaman Asencio et al. 10.3389/fpls.2026.1943711
Frontiers in Plant Science frontiersin.org20
论文原文与出版信息
Frontiers in Plant Science