1. Introduction
Young fruit detection is key for smart orchard management. It supports fruit thinning, growth monitoring, fruit set counts, and yield prediction. But real orchards create many problems: light changes drastically between day and night, causing unstable images; branches and leaves hide the fruits; young fruits are small and easily blend into the background; and their texture looks too similar to leaves and branches, so false positives and missed detections happen often. These issues make robust, real-time detection hard to achieve.
Most existing methods for detecting young fruit work well only in ideal settings: single daytime scenes, fixed lighting, and low occlusion. In real orchards, they struggle. Most algorithms are designed for well-lit daytime conditions, so they lack robustness under extreme lighting like low light, backlight, or night-time shadows. Under low light, they often fail to extract features, miss targets, or produce false positives. Improved solutions have clear bottlenecks. Adding attention mechanisms can make local targets more salient, but they do not model global context well, so they cannot handle occlusion from leaves and branches or similar backgrounds. For example, Wang, C.J. et al. [
1] proposed AMSA-YOLO based on an adaptive multi-scale attention mechanism, including a scale-aware module, adaptive spatial attention, and adaptive channel attention. It increased mAP for small object detection on COCO by 3.6 percentage points and also improved performance on VisDrone and CrowdHuman. Liu et al. [
2] tackled small green object detection in complex orchards with MAE-YOLOv8, which uses a multi-scale attention enhancement module to improve green plum detection accuracy. Aghili, M.E. et al. [
3] proposed YOLO-PICO. Its main innovation is the expansion attention module, which combines spatial-channel feature fusion to enhance fine-grained details. They also introduced the SNAP metric to measure parameter efficiency, making it a base model for expert ensemble frameworks aimed at small-object recognition. Qi, Z. et al. [
4] integrated Rep Block, PConv, and EMA attention modules, improving the model’s mAP50 by 2.9%. Sun, H. et al. [
5] improved YOLOv7 for night-time pear detection, using multi-scale features and attention to boost accuracy under low light. Lin, X. et al. [
6] proposed SDA-YOLO for peach detection in complex orchards, adding partial convolutions and channel attention. Li, S. et al. [
7] added a coordinate attention mechanism to YOLOv5 to accurately find and locate densely clustered dragon fruits in natural orchards. Wang, M. et al. [
8] improved YOLOv8 with a self-calibrated coordinate (SCC) attention module and enhanced feature fusion for precise apple detection in complex backgrounds. Luo, Y. et al. [
9] proposed YOLO-CFruit based on YOLOv5, using a convolutional pyramid attention mechanism to make fruit detection more robust in complex backgrounds. Wu, X. et al. [
10] proposed an improved YOLOv8 that combines attention and multi-scale feature fusion. It works better for detecting grapes in complex scenes. These methods do help, but they still struggle with changing light, messy backgrounds, and heavy occlusion. So their robustness and generalization stay limited.
Some researchers turned to Transformers to fix the lack of global modeling. But that often adds many parameters and computation, slowing down inference. That makes real-time edge deployment hard. For example, Tang, J. et al. [
11] proposed a YOLOv8 with a hybrid attention Transformer for fruit ripeness detection. The Transformer helps global feature modeling, improving recognition accuracy in complex backgrounds. Li, J. et al. [
12] proposed a Transformer-enhanced real-time method to identify and thin young fruits in complex orchards, combining it with YOLO. Cao, H. et al. [
13] used YOLOv8n-CSE with artificial light and a fixed angle to detect lychee clusters at night. Xu, L. et al. [
14] tackled night-time apple-harvesting image problems with a YOLOv4-based day–night detection method plus image enhancement. Kutyrev, A. et al. [
15] used YOLO for real-time apple detection through AI-driven night-time orchard monitoring, supporting sustainable fruit production. Jrondi, Z. et al. [
16] compared DETR with YOLOv8 for citrus fruit detection, trying to show what end-to-end Transformers can do in this area. Liu, X. et al. [
17] stuck a Transformer encoding module into YOLO’s backbone or neck to boost multi-scale feature interaction, which made fruit detection more robust in complex natural scenes. Zhao, K. et al. [
18] combined Swin Transformer with YOLO for orchard detection, using window-based self-attention to handle occluded and small fruits better. Hu, J. et al. [
19] proposed TC-YOLO, adding Transformer modules and coordinate attention to YOLOv5. That noticeably improved detection of occluded and small apples in complex orchards. Yang et al. [
20] developed LS-YOLOv8s by integrating a lightweight Swin Transformer module into YOLOv8s, improving fruit detection robustness under complex illumination and occlusion while retaining real-time performance. Lu, S [
21] Zheng et al. improved YOLO with a Transformer, using multi-scale feature fusion and the Transformer’s long-range dependency modeling. That raised detection rates for fruits with different ripeness levels and sizes in orchards. Still, night-time recognition remained weak. To tackle those issues, other researchers added extra modules. Yu, Z.H. et al. [
22] proposed ADRConv, a self-anti-disturbance convolutional module. It pulls local gradient info using second-order central differences, which boosts edge features of small objects and cuts background noise. On VisDrone, it beat YOLOv8 by 4.3% in detection accuracy. John Canny et al. [
23] proposed a classic edge detection method that satisfies optimal detection, precise localization, and single-edge response. They formalized edge detection as a signal detection and optimization problem. Nie, Y. et al. [
24] built a dual-backbone feature extraction architecture that combines knowledge distillation with model pruning. This cuts model size a lot while maintaining accuracy. They also released the SmallDarkY dataset for small-object detection in low-light night-time conditions. Li et al. [
25] used Mask R-CNN for pixel-level detection and precise localization of foreign objects like stones and plastic film residues in agricultural soil. Wang, Z.N. et al. [
26] proposed S-YOLO, a small-object detection framework based on YOLOv10. The key innovations include an enhanced small-object detection layer, the C2fGCU gated convolutional unit (which adjusts activation intensity on the fly and suppresses background interference), and a dynamic multi-scale fusion module. On VisDrone2019, mAP50:95 improved by 5.3 percentage points over Faster R-CNN. Yang, X.Y. et al. [
27] proposed YOLO-TinyFuse, which combines the P2 feature layer, ModifiedNeck, and BiFPN. On the Olive dataset, it got 92.3% mAP50, which was 2.6% higher than YOLOv8n. Huang, X.Y. et al. [
28] proposed BEAM-YOLO for detecting small rice pest targets. With MEN, BAFE, EM-BFPN, and SCAU modules, it reached 86.6% mAP50 and 72.7% mAP50-95 on JRICE-PD, improvements of 3.3% and 3.0% over YOLOv11. Ref. [
29] proposed AHG-YOLO for multi-class detection of occluded pears in complex orchards, aiming to improve accuracy. Zhicheng Gu et al. [
30] proposed RTDETR-CASA, adding multi-scale dilated convolutions, feature-focused downsamplers, and adaptive upsampling to the neck. It improves tomato detection, but further testing is still needed to determine how well it adapts to extremely complex scenes.
We needed a method that balances accuracy and efficiency for day–night apple orchard management, so we built a dataset covering various lighting and occlusion levels. Using lightweight models, we propose FruitDet, a multi-module collaborative detector for young apples. AUIB, ACSAM, and MViT-T work together: AUIB improves multi-scale local features across backbone layers to handle lighting changes; ACSAM at the backbone’s end suppresses background and highlights young fruit features; and MViT-T in the fusion layer captures long-range dependencies for better localization. The design tackles small target size and heavy occlusion. Experiments show that it works well for day–night detection, supporting smart orchard digitalization and offering a practical solution for complex agricultural scenes.
The main contributions of this paper are as follows:
We constructed a dedicated day–night young-apple-fruit detection dataset collected in a commercial orchard, covering natural daylight, low-light night-time conditions, and diverse occlusion patterns.
We proposed FruitDet, a lightweight detector that integrates AUIB, ACSAM, and MViT-T to jointly enhance local multi-scale representation, suppress background interference, and model global contextual dependencies.
Extensive experiments, including ablation studies, comparisons with mainstream detectors, cross-scene evaluation, and qualitative visualization, demonstrate that FruitDet consistently improves detection accuracy and robustness in both daytime and night-time orchard environments.
The remainder of this paper is organized as follows:
Section 2 covers how we built the day–night young apple dataset.
Section 3 explains the FruitDet model design.
Section 4 tests the model, compares results, and runs ablation studies to show how the modules work together.
Section 5 summarizes the work, points out limitations, and suggests future directions.
4. Experimental Results and Analysis
4.1. Experimental Environment
The study was trained and evaluated on Ubuntu 22.04, with an Intel Xeon Platinum 8470Q CPU and an NVIDIA RTX 5090 GPU (32 GB VRAM). Software: Python 3.12, CUDA 12.8, PyTorch 2.8.0. Input images are 640 × 640 pixels. We ran 300 epochs with a batch size of 128. Hyperparameters are listed in
Table 2.
To ensure the fairness of the model comparisons, FruitDet and all comparison models were trained and evaluated using the same training, validation, and test sets. The input image size was uniformly set to 640 × 640 pixels for all models, and each model was trained for 300 epochs using the same data augmentation strategy on the training set. No random data augmentation was applied to the validation or test sets. All models were evaluated on the same test set using identical confidence thresholds, non-maximum suppression thresholds, and evaluation procedures for calculating precision, recall, mAP50, and mAP50–95. To preserve the original characteristics of the different detection frameworks, each model retained the network architecture and loss function provided in its official implementation, while all other experimental conditions were kept as consistent as possible.
All results reported in this study were obtained from a single complete training run consisting of 300 epochs. Repeated experiments using different random seeds were not conducted.
4.2. Evaluation Criteria
We used several metrics to evaluate the model: precision (P), recall (R), mean average precision (mAP), mAP50-95, number of parameters (M), FLOPs (G), FPS, and model size (MB). Precision tells us how accurate the detections are, whereas recall tells us how many true positives we caught. Together they show how well the model separates positive from negative samples. Looking at all these metrics gives a balanced view of both accuracy and practical usability.
Here, represents the number of classes, denotes the average precision for the i-th class, and refers to the value calculated at a specific threshold. TP, FP, and FN represent the number of correctly detected young fruits, the number of incorrectly detected young fruits, and the number of missed young fruits, respectively. The formulas for each metric are as follows. The experimental results consistently show that the precision of FruitDet is higher than its recall, indicating that the model exhibits a relatively conservative detection behavior under the current confidence threshold and non-maximum suppression settings. Young fruits with clear contours, relatively large apparent sizes, and limited occlusion generally receive higher prediction confidence scores, resulting in fewer false-positive detections. In contrast, small, heavily occluded, densely overlapping, and low-contrast young fruits tend to produce lower confidence scores and are therefore more likely to be filtered out during confidence-thresholding or non-maximum suppression. This increases the number of missed detections and consequently reduces recall.
4.3. Ablation Experiment
Ablation experiments were run to evaluate how much each module (AUIB, ACSAM, and MViT-T) contributes. YOLO11n served as the baseline, with all parameter settings kept uniform. Tests were conducted under two typical lighting conditions: daytime and night-time.
Table 3 and
Table 4 present the ablation results for day and night, respectively.
Table 3 shows daytime results. Adding any single module improves performance. AUIB gives the biggest recall jump, from 72.338% to 74.269%, and mAP50 reaches 78.020% (up 0.399 points over baseline). Its expansion–compression design helps capture more young fruits. MViT-T pushes precision to 86.589%, and mAP50-95 to 61.014% (up 0.411 points). Global self-attention captures context between fruit and environment, improving localization. ACSAM lifts precision by 0.166 points and recall by 1.297 points, showing that channel-spatial attention helps focus on targets and suppress background. Each module also affects model size and speed differently. AUIB cuts parameters from 2.590 M to 2.449 M, FLOPs from 3.220 G to 3.120 G, and model size from 5.235 MB to 4.950 MB, while FPS climbs to 235.212. Its lightweight residual structure reduces redundancy and speeds up inference. MViT-T raises parameters to 3.542 M, FLOPs to 4.768 G, and model size to 7.159 MB, while FPS drops to 153.500. That extra cost comes from global self-attention. ACSAM keeps parameters and FLOPs almost the same as baseline, FPS drops slightly to 197.007, and model size grows only a little, confirming that attention mechanisms can boost performance at very low computational cost.
Among all combinations, FruitDet leads daytime metrics: precision 91.904%, recall 77.557%, mAP50 83.254%, mAP50-95 66.427%—gains of 6.778, 5.219, 5.633, and 5.824 points over baseline. Parameters edge up slightly (2.960 M, +0.37 M), FLOPs to 3.726 G (+0.506 G), model size to 5.982 MB (+0.747 MB), and FPS stays at 181.060. Such modest overhead for clear accuracy gains confirms that the three modules complement each other well, striking an optimal performance–efficiency balance. The complete FruitDet model has fewer parameters and lower FLOPs than some of the two-module configurations because it is not constructed by simply stacking the three modules. Instead, the final architecture is jointly optimized through module replacement and feature-dimension compression. Specifically, AUIB replaces the original computationally expensive standard convolutional modules with a lightweight expansion–depthwise convolution–projection structure. Meanwhile, the high-level features fed into MViT-T are projected into a lower-dimensional feature space before self-attention computation. ACSAM introduces only a relatively small additional computational overhead. Consequently, the reductions in parameter count and computational cost achieved through convolutional module replacement and feature compression outweigh the additional overhead introduced by ACSAM, resulting in fewer parameters and lower FLOPs for the complete FruitDet model than for some two-module combinations.
AUIB replaces selected standard convolutional modules with a lightweight architecture consisting of channel expansion, depthwise convolution, and channel projection. Meanwhile, the high-level features are projected into a lower-dimensional channel space before being fed into MViT-T for self-attention computation. These lightweight operations partially offset the additional parameters introduced by the attention modules. Consequently, the model size increased only moderately, from 5.235 MB for the baseline model to 5.982 MB for FruitDet.
Night-time brings poor lighting, low contrast, and blurred edges, raising missed detections and false alarms.
Table 4 shows baseline mAP50 at 75.748% and mAP50-95 at 59.340%. ACSAM alone lifts precision to 84.542%, recall to 72.258%, mAP50 to 76.211%, proving attention remains effective. AUIB alone pushes recall to 72.545% and mAP50-95 to 60.290%, aiding blurry targets. When MViT-T was added individually to the baseline model, the night-time precision decreased from 84.398% to 83.936%, corresponding to a reduction of 0.462 percentage points. Under low-light conditions, self-attention may propagate not only useful contextual information related to young fruits, but also correlated background noise, leaf textures, and illumination artifacts. In the absence of the local-detail enhancement provided by AUIB and the background-suppression capability of ACSAM, some background responses that resemble fruit features may be amplified, thereby increasing false-positive detections. When all three modules were jointly integrated, the night-time precision increased to 90.107%, indicating that the complementary effects of AUIB, ACSAM, and MViT-T can more effectively suppress background interference while preserving and integrating discriminative fruit features under low-light conditions. MViT-T alone raises mAP50 to 76.508% but slightly lowers precision, while global context introduces some noise. Efficiency varies: AUIB trims parameters, FLOPs, and size while lifting FPS to 233.582; MViT-T adds overhead (3.542 M, 4.768 G, 146.057 FPS) for global context; ACSAM barely alters costs. Among two-module pairs, AUIB + MViT-T excels at night (mAP50 79.477%, mAP50-95 62.575%). FruitDet, with all three, achieves top night-time scores: precision 90.107%, recall 75.135%, mAP50 80.544%, mAP50-95 64.719%—gains of 5.709, 3.961, 4.796, and 5.379 points over baseline. At 2.960 M parameters, 3.726 G FLOPs, 5.982 MB, and 180.301 FPS, FruitDet balances real-time speed and light weight in dim, cluttered orchards.
Compared with the baseline model, the inference speed of the complete FruitDet model decreased from 205.940 FPS to 181.060 FPS on the daytime test set, representing a reduction of approximately 12.08%. On the night-time test set, the inference speed decreased by approximately 12.03%. The additional latency mainly arises from the pooling operations, attention-weight generation, and feature recalibration in ACSAM, as well as the tokenization, self-attention, feed-forward network, Fold-based reconstruction, and feature fusion operations in MViT-T. Although AUIB reduces part of the computational cost associated with standard convolutional operations, these savings are insufficient to fully offset the additional computational overhead introduced by ACSAM and MViT-T.
4.4. Performance Comparison with Mainstream Models
To comprehensively assess FruitDet’s detection performance across lighting conditions, we compared it with mainstream models YOLOv5n and YOLOv8n, as well as the baseline YOLO11n, in daytime and night-time scenarios. The results appear in
Table 5 and
Table 6.
Table 5 reports daytime performance, where FruitDet leads all metrics: precision 91.904%, recall 77.557%, mAP50 83.254%, mAP50-95 66.427%. Gains over YOLOv5n are 6.295, 6.046, 6.958, and 6.248 points; over YOLOv8n, 5.882, 5.334, 5.848, and 5.821; over Faster R-CNN, 8.026, 6.658, 7.826, and 7.121; over YOLO11n, 6.778, 5.219, 5.633, and 5.824; over YOLO26n, 3.058, 1.192, 3.730, and 3.840; over RT-DETR, 5.476, 4.284, 4.700, and 4.139; over RT-DETRv2, 4.232, 3.398, 3.868, and 2.889. These improvements stem from the synergy of AUIB, ACSAM, and MViT-T, which together enhance multi-scale features, sharpen target focus, and capture global context. While FruitDet does not top the charts in Params, FLOPs, or FPS, its lightweight design yields substantial accuracy gains, confirming that the multi-module collaboration hits an optimal performance–efficiency balance.
Table 6 shows night-time results. Lighting is poor, contrast is low, and edges are blurry. Still, FruitDet leads with 90.107% precision, 75.135% recall, 80.544% mAP50, and 64.719% mAP50-95. Compared to YOLOv5n, FruitDet improves precision by 5.486 percentage points, recall by 3.64, mAP50 by 5.697, and mAP50-95 by 5.195. Against YOLOv8n, the gains are 4.804, 4.695, 6.039, and 6.274. Against Faster R-CNN, they are 6.154, 4.884, 5.174, and 5.185. Against baseline YOLO11n, they are 5.709, 3.961, 4.796, and 5.379. Against YOLO26n, they are 2.686, 1.609, 3.302, and 2.761. Against RT-DETR, they are 4.125, 2.908, 4.907, and 4.352. Against RT-DETRv2, they are 3.078, 1.996, 2.159, and 2.162. AUIB boosts multi-scale features, ACSAM focuses on targets and suppresses noise, and MViT-T captures global context. Together they handle blurry targets, lift recall, and improve localization. Params, FLOPs, and FPS are not the absolute best, but the balance between lightweight design and high accuracy is solid. Under the models and experimental conditions evaluated in this study, FruitDet achieved a relatively favorable balance between detection accuracy and computational efficiency. The multi-module strategy hits a Pareto optimum between performance and efficiency.
Compared with the daytime scenario, FruitDet’s recall in the night-time scenario decreased from 77.557% to 75.135%, representing an absolute decline of 2.422 percentage points and a relative decrease of approximately 3.12%. This reduction was mainly attributable to lower image contrast, weakened fruit boundaries, underexposure in local regions, leaf occlusion, and increased imaging noise under night-time conditions. In such cases, small-sized and partially visible young fruits exhibit insufficient discriminative features, causing their prediction confidence scores to fall below the predefined threshold and consequently increasing the number of missed detections.
Figure 8 visually compares the comprehensive performance of the eight models across multiple evaluation metrics, highlighting the balanced advantages of our proposed method.
FruitDet delivers remarkably consistent performance across diurnal conditions. In daylight, it reaches 91.904% precision, 77.557% recall, mAP50 83.254%, and mAP50-95 66.427%, demonstrating strong detection capability under sufficient illumination and clear visual contrast. At night, despite low contrast, uneven illumination, shadow interference, and increased image noise, it still achieves 90.107% precision, 75.135% recall, mAP50 80.544%, and mAP50-95 64.719%. The relatively small decline between daytime and night-time results indicates that the model maintains stable recognition ability even when fruit edges become less distinct, object boundaries are weakened, and background interference becomes more severe. This performance stability is particularly important for orchard environments, where lighting conditions change continuously and young apples are often partially hidden by leaves, branches, or overlapping fruits. Compared with conventional detection models, FruitDet shows stronger adaptability to illumination shifts and complex fruit distributions, which helps reduce missed detections in dense canopy regions. This robustness stems from three synergistic modules: AUIB enhances multi-scale features via reverse residuals, ACSAM applies channel–spatial attention to suppress foliage and lighting interference, and MViT-T captures global context to localize occluded or blurred fruits. By combining lightweight local feature extraction, adaptive attention refinement, and long-range contextual modeling, FruitDet can better distinguish young apples from visually similar backgrounds. These mechanisms also improve feature selectivity, allowing the network to focus on true fruit regions while weakening irrelevant background responses. Together, they secure strong accuracy in bright and adverse conditions, supporting reliable fruit detection across complex orchard scenes and providing a solid technical foundation for automated yield estimation and intelligent orchard management.
The mAP50 of FruitDet decreased from 83.254% under daytime conditions to 80.544% under night-time conditions, while mAP50–95 decreased from 66.427% to 64.719%. Although these reductions are relatively limited, the remaining missed detections at night may still cause some young fruits to be overlooked by a robotic thinning system, thereby affecting the completeness of target coverage during thinning operations. Therefore, FruitDet should currently be regarded as a visual perception component of an automated fruit-thinning system rather than as a fully validated end-to-end thinning system. Practical deployment will require further integration and validation with multi-view observation, temporal confirmation across consecutive frames, object tracking, depth-based localization, and robotic-arm execution.
Figure 9 and
Figure 10 together trace FruitDet’s learning dynamics across diurnal extremes. In daylight, FruitDet’s precision climbs past 0.92 and its mAP50–95 surpasses 0.66, while competing YOLO variants plateau earlier and lower, suggesting weaker convergence, limited feature discrimination, and reduced sensitivity to small targets. At night, FruitDet holds precision above 0.90 and mAP50–95 above 0.64, whereas benchmark models stall below 0.88 and 0.63, respectively. Stronger augmentation and attention largely offset low-light penalties, narrowing performance gaps by 5–10% and helping the model retain sensitivity to small, dense, and partially obscured young fruits. The smoother convergence curves also indicate that FruitDet learns more stable feature representations during training, rather than relying on illumination-specific patterns. This suggests that the proposed modules not only improve final detection accuracy but also enhance optimization stability throughout the training process. In addition, the sustained improvement of mAP50-95 reflects better localization precision across multiple IoU thresholds, indicating that FruitDet is not only able to detect fruits but also to predict their bounding boxes more accurately. The consistent upward trajectories—under both bright and degraded illumination—confirm that FruitDet’s modular design yields resilient convergence, finer multi-scale handling, and a higher performance ceiling. Moreover, reduced performance fluctuation between daytime and night-time experiments further verifies the model’s robustness under changing acquisition conditions. These results indicate that FruitDet can adapt effectively to illumination variation, occlusion, fruit-background color similarity, and background complexity, making it a dependable candidate for round-the-clock orchard monitoring and practical deployment in real agricultural production scenarios.
Figure 11 and
Figure 12 are the visualization of the results and the heatmap, respectively.
4.5. Robustness Analysis Under Transition Lighting Conditions
In practical orchard monitoring, transitional periods such as dusk and dawn present distinctive challenges characterized by highly nonuniform illumination, including strong backlighting and rapidly changing shadows. Unlike the relatively uniform illumination at midday or the consistently low-light conditions encountered late at night, these scenes often exhibit an extremely high dynamic range. Background regions, such as the sky, may lose detail because of overexposure, whereas the target fruits may be underexposed when located in shadowed areas.
To evaluate the robustness of the model under these complex conditions, qualitative tests were conducted using images captured during these transitional periods. As shown in
Figure 13, FruitDet exhibited better adaptability to nonuniform illumination than the baseline model. Even in severely backlit scenes, where the contrast between the fruits and the background was substantially reduced, FruitDet was still able to localize young fruits with relatively high confidence.
This robustness may be attributed primarily to the complementary effects of ACSAM and AUIB. By generating spatial attention maps, ACSAM can suppress interference from high-intensity background responses, such as sky glare, while adaptively increasing the feature weights of fruit regions located in darker areas. Meanwhile, AUIB helps preserve fine-grained texture information in low-light regions and reduces the loss of local features during downsampling. These qualitative results suggest that FruitDet can maintain relatively reliable detection performance under the challenging illumination transitions from daytime to night-time.
4.6. Results on Public Datasets
Further systematically evaluate the generalization ability and robustness of the model proposed in this paper, we subjected our model to rigorous validation using the publicly available pear fruit dataset curated by Kodors et al. [
31]. In this experiment, FruitDet and all comparison models were independently retrained on the public pear dataset rather than being directly evaluated using model weights obtained from training on the apple dataset. The pear dataset was divided into training, validation, and test sets at a ratio of 7:2:1. All models used the same dataset split, input image size, number of training epochs, data augmentation strategy, and evaluation protocol. Model selection was performed based on the validation set, and the final results reported in
Table 7 and
Table 8 were obtained from the independent test set. The results demonstrate that FruitDet can maintain strong detection performance when independently retrained on a fruit dataset characterized by different object shapes, textures, backgrounds, and image-acquisition conditions. This finding indicates that the FruitDet architecture possesses favorable cross-fruit dataset generalization capability, rather than zero-shot cross-domain transfer capability. As depicted in
Table 7 and
Table 8, our model demonstrates consistent performance across heterogeneous datasets, maintaining a leading edge over benchmark models in terms of precision, recall, and composite mAP metrics. Notably, FruitDet establishes a notable margin over competitors in both precision and recall rates, as well as mAP50 and mAP50-95 scores, affirming its superior discriminative capacity and stable feature extraction capability under cross-domain conditions. This indicates that the proposed model does not merely adapt to the apple dataset used for training and testing, but also retains strong recognition ability when transferred to fruit images with different shapes, textures, backgrounds, and acquisition conditions. The pear dataset introduces additional visual challenges, including variations in fruit size, color similarity between fruit and foliage, partial occlusion, uneven illumination, and complex canopy structures, all of which place higher demands on the robustness of detection algorithms.
After independent retraining on the public pear dataset, FruitDet achieved an mAP50 of 83.861% on the daytime subset and 81.421% on the night-time subset. However, the public dataset does not provide annotations for illumination direction or light incidence angle. Therefore, this study cannot separately quantify the detection performance under frontal lighting, side lighting, and backlighting conditions. This experiment evaluates the cross-dataset adaptability of FruitDet after independent retraining rather than independently validating its robustness across all illumination angles.
While not optimized for parameter count, floating-point operations, or inference speed, FruitDet nonetheless achieves this accuracy gain without resorting to aggressive model compression, instead striking a balance between computational efficiency and performance. This suggests that the improvements mainly arise from more effective feature representation and attention-guided information fusion rather than simply increasing model complexity. The AUIB module strengthens multi-scale feature extraction, ACSAM enhances attention to informative fruit regions while suppressing background interference, and MViT-T contributes global contextual modeling for better localization of overlapping or visually ambiguous targets. Visually,
Figure 14 reveals that even in regions characterized by dense fruit overlap—challenges known to degrade detection confidence in other models—FruitDet sustains relatively stable confidence scores, avoiding the precipitous drops observed in comparison systems. Moreover, its detection boxes remain more complete and better aligned with fruit boundaries, indicating improved localization stability in crowded scenes. Collectively, these findings lend further credence to FruitDet’s transferable robustness in complex orchard scenarios, strengthening the empirical foundation for its deployment in automated fruit detection tasks and supporting its potential application to broader fruit-monitoring environments. FruitDet localizes objects using axis-aligned rectangular bounding boxes. For elongated, tilted, or irregularly shaped fruits, such bounding boxes may include a substantial amount of background and cannot precisely conform to the true object contours. Even when a target is correctly identified, this representation may reduce localization accuracy under stricter IoU thresholds and consequently affect mAP50–95. The experiments on the public pear dataset demonstrate that the model can learn variations in fruit appearance; however, they do not eliminate the inherent geometric limitations of rectangular bounding-box regression.
The daytime results on the public pear dataset are presented in
Table 7, while the night-time results are reported in
Table 8. The recall of FruitDet on this dataset decreased from 78.012% under daytime conditions to 75.936% under night-time conditions, corresponding to an absolute decrease of 2.076 percentage points. This reduction is mainly associated with lower night-time contrast, weakened object boundaries, partial occlusion, and increased noise under low-light conditions. All relevant table references throughout the manuscript have been carefully checked and standardized to avoid confusion between the table numbers corresponding to the daytime and night-time results. In the night-time evaluation on the public pear dataset, YOLO11n achieved an inference speed of 190.137 FPS, whereas FruitDet achieved 174.006 FPS, corresponding to a reduction of approximately 8.48%. This decrease is mainly attributable to the additional attention computation, feature rearrangement, and feature fusion operations introduced by ACSAM and MViT-T. The number of parameters and FLOPs are determined by the network architecture and therefore remain unchanged across different datasets. In contrast, the measured FPS may be affected by runtime conditions, data-loading overhead, and the timing methodology. Consequently, small variations in inference speed may occur across evaluations conducted on different datasets.
Further analysis of the visualization results on the public pear dataset showed that the remaining missed detections were mainly associated with small, heavily occluded, and densely overlapping fruits. False-positive detections occurred primarily in leaf regions whose colors or local approximately circular textures resembled those of fruits. Because this dataset involves a single-class object detection task, a class confusion matrix provides only limited information for error analysis. Therefore, the error types were analyzed mainly from the perspectives of object size, degree of occlusion, fruit density, and illumination conditions. The observed failure cases were generally consistent with those identified on the apple dataset, as illustrated in the figure below.
Table 7 and
Table 8 present the results obtained by independently retraining the models on the daytime and night-time subsets of the public pear dataset, respectively, while
Table 9 reports the model complexity and inference speed measured on the workstation. These results support the conclusion that FruitDet possesses a certain degree of cross-dataset day–night detection capability and deployment potential under the current evaluation conditions. However, they do not demonstrate that the model has general all-weather applicability across a comprehensive range of meteorological conditions, such as rain, snow, dense fog, and dust storms.
4.7. Failure Analysis
As shown in
Figure 15, FruitDet still struggles with certain young-apple scenarios. The first row displays daytime (A) and night-time (B) detections, with yellow boxes marking failure regions; the second row provides zoomed-in views.
Table 8 provides the overall statistical results for night-time testing on the public pear dataset and therefore cannot directly reflect the detail-preservation capability of AUIB under specific visual conditions. The relevant qualitative evidence is derived primarily from
Figure 14. When targets are extremely small, multiple fruits are densely overlapped, images are severely backlit or underexposed, substantial blur is present, or fruits are extensively occluded, AUIB may still be unable to preserve sufficient target details.
In daylight (Group A), dense clusters of small fruit cause feature interference, yielding overlapping detection boxes (left). In densely overlapping regions, the visible area of each fruit is reduced, the boundaries between adjacent instances become ambiguous, and the amount of discriminative information available for each individual fruit consequently decreases. At the same time, multiple predicted bounding boxes may exhibit a high degree of spatial overlap and compete with one another during non-maximum suppression. A local feature region may also simultaneously cover multiple fruits and leaves, thereby reducing the distinctiveness of instance-level features. Together, these factors can lead to lower prediction confidence scores. Because the current dataset does not provide precise occlusion-ratio annotations, this interpretation is based primarily on the qualitative observations presented in
Figure 14. In highly dense fruit clusters, multiple adjacent young fruits may produce highly similar and spatially entangled feature tokens. Although MViT-T can model long-range dependencies across different spatial regions, the module does not explicitly encode boundaries between individual fruit instances. When a fixed image patch simultaneously contains multiple fruits and leaves, self-attention may aggregate contextual information from different instances, resulting in less discriminative instance-level feature representations. Backlighting further erodes edge and texture cues, lowering confidence and causing missed detections (right). Under extreme backlighting, young fruits may be located in a relatively dark foreground, while the bright background may become overexposed. This can compress foreground contrast and cause the fruits to exhibit a near-silhouette appearance. Under such conditions, surface texture, color gradients, and edge information may all be simultaneously weakened. In contrast, side lighting generally preserves texture on at least one side of the fruit, together with light–dark intensity gradients and partial contour information, thereby providing the model with more discriminative visual cues.
Night-time (Group B) brings different challenges. Heavy leaf occlusion restricts visible fruit area, and even MViT-T’s global modeling lacks the shape priors to identify partially hidden targets (left). The current FruitDet model does not explicitly incorporate shape priors such as fruit roundness, contour continuity, boundary curvature, occluded-contour completion, instance masks, or three-dimensional geometry. Although MViT-T can learn contextual relationships between target objects and their surrounding environment, it cannot directly infer the complete shape of fruit regions occluded by leaves. When only a small visible portion of a young fruit remains, the model may still be unable to reliably distinguish it from background textures. Under extreme backlight, low contrast blurs boundaries, causing background textures to be mistaken for fruit—false positives (right). In low-contrast night-time environments, the color differences between young fruits and leaves are substantially reduced, causing the model to rely more heavily on incomplete texture and shape cues. Local highlights on leaves, blurred patches, and approximately circular shadow regions may produce local feature responses similar to those of young fruits and may consequently be assigned erroneous fruit confidence scores.
When young fruits occupy only a few pixels after input-image resizing or backbone downsampling, the ability of AUIB to preserve fine-grained features becomes limited. Moreover, under challenging conditions such as severe overlap among multiple young fruits, strong mixing of fruit boundaries with leaf textures, severe backlighting, extreme underexposure, motion blur, defocus blur, and large-area occlusion, the edge and texture information in the original image may already be substantially degraded or lost. AUIB can enhance the available local features, but it cannot recover visual information that has already been lost from the original image.
Though the lightweight design achieves real-time performance, these failures reveal lingering weaknesses with dense clusters and harsh lighting. Future work will target stronger global context aggregation to better suppress background noise and reduce false negatives.
4.8. Edge Deployment
In this section, the model was deployed at the edge. FruitDet was deployed on an AI development board based on the RK3588 platform. The input resolution was set to 640 × 640 pixels, the batch size was set to 1, and inference was performed using FP16 precision. On the RK3588 platform, the average inference latency was 28.6 ms per image, and the peak runtime memory consumption was 186 MB. The reported peak runtime memory consumption of 186 MB corresponds only to single-model inference using the FruitDet detection model with an input resolution of 640 × 640 pixels, a batch size of 1, and FP16 precision. It does not include the additional memory overhead associated with video decoding, image buffering, object tracking, re-identification features, historical trajectories, counting states, or communication tasks.
Figure 16 shows an experiment demonstrating FruitDet’s autonomous recognition capability in the natural orchard environment of Aksu, Xinjiang, where illumination, canopy density, and fruit distribution vary considerably in real field conditions.
Table 9 summarizes the model complexity and workstation inference speed. FruitDet contains 2.960 M parameters, requires 3.726 G FLOPs, and has a model size of 5.982 MB. The inference speed of 181.060 FPS was measured on the NVIDIA RTX 5090 workstation described in
Section 4.1 and is reported separately from the runtime performance obtained on the RK3588 edge platform.
Table 9 confirm its edge readiness, with only 2.960 M parameters, 3.726 G FLOPs, and a 5.982 MB footprint. These lightweight characteristics indicate that FruitDet can be stored, loaded, and executed efficiently on resource-constrained devices without imposing excessive memory or computational pressure. Its inference speed remains stable at 181.060 FPS. Compared with heavier detectors such as Faster R-CNN and RT-DETR, which sacrifice efficiency for model size, and baseline YOLO variants, which often compromise accuracy, FruitDet achieves a better balance among accuracy, speed, and lightweight deployment. This balance is particularly valuable for orchard monitoring tasks, where edge devices must process continuous image streams while maintaining low latency and stable detection quality. In practical applications, such efficiency can reduce dependence on cloud computing, lower data transmission costs, and support timely decision-making directly in the field.
FruitDet’s compact design benefits from three modules: AUIB enhances spatial detail without increasing parameters, ACSAM suppresses background clutter and focuses on fruit regions, and MViT-T introduces global context with limited computational cost. Together, they form a lightweight architecture suitable for edge deployment while preserving sufficient feature representation ability for complex fruit detection. AUIB improves local feature extraction for small and dense young fruits, ACSAM helps the network distinguish fruit targets from leaves, branches, and lighting interference, and MViT-T strengthens the understanding of broader spatial relationships in crowded canopy scenes. With fixed parameters, FLOPs, and model size across different lighting conditions, FruitDet maintains stable inference speed and low resource consumption. This consistency suggests that the model can operate reliably under both daytime and night-time conditions without requiring separate optimization or hardware adjustment. These results indicate a favorable accuracy–efficiency balance, making FruitDet a practical candidate for embedded agricultural vision systems where real-time performance, limited memory use and acceptable real-time performance low power consumption, and robustness under variable illumination are essential. Different CPU, GPU, and NPU architectures may exhibit different execution efficiencies for convolution, attention computation, memory access, and feature rearrangement operations. Moreover, its lightweight structure provides potential for deployment on mobile robots, unmanned ground vehicles, and portable orchard monitoring platforms, further supporting intelligent fruit management and precision agriculture in real production environments. The FLOPs of FruitDet increased from 3.220 G for the baseline model to 3.726 G, corresponding to an increase of approximately 15.71%. However, FLOPs cannot be directly equated with the actual power consumption of a device. The total board-level power consumption is also affected by factors such as memory access, NPU utilization, operating frequency, numerical precision, and operator implementation.
Figure 17 shows the analysis of the model.
To further evaluate the detection stability of the proposed model under real-world continuous field operation conditions, the mAP50 distributions of different object detection models were statistically analyzed in an Aksu orchard. Specifically,
Figure 17a presents the daytime detection results, while
Figure 17b shows the night-time results. Overall, all models achieved higher detection accuracy under daytime conditions than at night, indicating that illumination variations exert a substantial influence on detection performance in orchard environments. In the daytime scenario, FruitDet, RT-DETRv2, and RT-DETR achieved superior mAP50% values, with compact distributions and relatively high median values, demonstrating favorable detection accuracy and robustness. In contrast, YOLOv5n and Faster R-CNN exhibited comparatively lower performance. Under night-time conditions, the mAP50 values of all models decreased to varying degrees, with the YOLO-series models and Faster R-CNN showing more pronounced fluctuations. The performance distribution observed during continuous night-time operation was relatively broader. This variability may be associated with changes in local illumination, the camera’s automatic exposure response, shifts in shadow positions, variations in fruit occlusion and target density, and fluctuations in image noise. These explanations should be regarded as reasonable hypotheses based on the characteristics of the observed scenes rather than as causal conclusions validated through controlled experiments. Notably, FruitDet maintained the highest mAP50% value under low-light conditions, indicating its stronger adaptability to challenging illumination environments. Overall, these results demonstrate that FruitDet provides superior detection accuracy and stability across day–night continuous operation scenarios, making it more suitable for real-time detection tasks in complex orchard environments.
5. Summary and Outlook
To address the issues of insufficient detection accuracy for young apple fruits in orchards due to differences in daytime and night-time illumination and low-light conditions at night, this paper investigates high-precision detection of young apple fruits in complex scenarios. A dedicated dataset covering diverse lighting and occlusion scenarios was constructed. By integrating the AUIB, ACSAM, and MViT-T modules, the FruitDet multi-module fusion detection method was proposed, effectively addressing the challenges of difficult night-time fruit recognition and unstable detection accuracy between day and night, thereby significantly improving the accuracy and robustness of young apple fruit detection under the evaluated daytime and night-time orchard conditions across all scenarios.
Both data collection and experimental validation in this study were conducted in the same high-density apple orchard in Aksu, primarily under natural daytime and low-light night-time conditions. Complex weather conditions such as rain, snow, dense fog, and dust storms were not systematically included. Therefore, the model robustness described in this paper should be understood as its adaptability to daytime and night-time conditions within the tested orchard environment, rather than as evidence of general all-weather applicability. The current dataset does not include controlled samples collected under severe dust storms, dense fog, heavy rainfall, or snowfall. Therefore, this study cannot draw quantitative conclusions regarding the detection performance of FruitDet under these environmental conditions. Dust and dense fog may introduce atmospheric scattering, reduce image contrast, cause color shifts, weaken target boundaries, and decrease the visibility of distant objects, thereby interfering with feature extraction and object localization. The current dataset was not specifically stratified according to fruit-tree developmental stage or canopy density. Therefore, this study cannot demonstrate that the model would maintain the same degree of recall improvement under the substantially denser canopy conditions that may occur during later growth stages. The present findings are applicable only to the developmental stages and canopy conditions actually represented in the dataset.
Although the method presented in this paper has achieved good results, there is still room for optimization. Future research directions are as follows:
Future work will investigate multisource sensing approaches, including near-infrared imaging, thermal imaging, depth information, and active illumination, with the aim of improving the visibility of young fruits in extremely dark and heavily shadowed regions through complementary sensing modalities. Conduct research on multi-source data fusion, integrating multi-spectral, depth, and other multimodal data to further improve detection performance in extremely complex scenarios.
FruitDet serves as a visual perception component within an automated fruit-thinning system and cannot independently perform end-to-end thinning decision-making and execution. Future work will integrate FruitDet with object tracking, duplicate-target elimination, fruit counting, depth-based localization, thinning decision-making, and robotic-arm path planning [
32]. It will investigate intelligent numbering and individual tracking technologies for young apple fruits, combining them with counting models to enable yield prediction and provide end-to-end decision support for automated fruit thinning.
Future work will establish multi-season and multi-year datasets and investigate domain adaptation, continual learning, and periodic model-updating strategies.
Future work will investigate a task-oriented semantic communication framework for collaborative orchard AI–IoT systems. Rather than continuously transmitting full-resolution images, edge devices could directly extract and compress the visual semantic information required by downstream tasks [
33]. High-level features, object bounding boxes, confidence scores, occlusion states, fruit identity labels, and timestamps generated by FruitDet could be encoded as semantic messages and transmitted to the cloud or other collaborative edge nodes over bandwidth-constrained networks.