Next Article in Journal
Multi-Scale Driving Mechanisms of the Spatiotemporal Distribution of Soil pH in High-Standard Farmland Within the Hilly Regions of Southern China
Previous Article in Journal
Navigation Line Extraction Method for Alfalfa Crops Based on RACG-RandLA Point Cloud Segmentation Model
Previous Article in Special Issue
A Lightweight Framework for Tea Shoot Detection and Plucking Point Localization Enabled by Modified YOLOv11s-Seg Model
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

FruitDet: A Multi-Module Lightweight Detector for Young Apple Fruits Under Day–Night Orchard Conditions

1
College of Mechanical and Electrical Engineering, Shihezi University, Shihezi 832000, China
2
Key Laboratory of Northwest Agricultural Equipment, Ministry of Agriculture and Rural Affairs, Shihezi 832003, China
3
College of Information Science and Computing, Shihezi University, Shihezi 832000, China
4
College of Agriculture, Shihezi University, Shihezi 832000, China
5
College of Information Engineering, Huzhou University, Huzhou 313000, China
*
Author to whom correspondence should be addressed.
Agriculture 2026, 16(15), 1684; https://doi.org/10.3390/agriculture16151684
Submission received: 9 July 2026 / Revised: 24 July 2026 / Accepted: 29 July 2026 / Published: 5 August 2026
(This article belongs to the Special Issue Advances in Precision Agriculture in Orchard)

Abstract

Reliable perception of young apple fruits in natural orchards is a prerequisite for automated thinning and intelligent orchard management, yet remains difficult in real field conditions due to small fruit size, dense distribution, branch–leaf occlusion, background similarity, and severe illumination degradation at night. This study presents FruitDet, a lightweight multi-module detector designed for robust day–night young apple fruit detection in complex orchard environments. A field dataset was established in a high-density apple orchard in Aksu, Xinjiang, covering daylight and low-light night-time scenes with diverse occlusion, scale, and illumination variations. To improve detection robustness without sacrificing computational efficiency, FruitDet combines three complementary mechanisms: an inverted-bottleneck-based multi-scale feature enhancement module for preserving small-fruit details, a channel–spatial attention module for suppressing foliage and illumination interference, and a lightweight Transformer-based context module for modeling long-range dependencies between fruits and surrounding orchard structures. In daytime scenes, FruitDet achieved 91.904% precision, 77.557% recall, 83.254% mAP50, and 66.427% mAP50–95; in night-time scenes, it maintained 90.107% precision, 75.135% recall, 80.544% mAP50, and 64.719% mAP50–95. Compared with mainstream detectors including YOLOv5n, YOLOv8n, YOLO11n, YOLO26n, Faster R-CNN, RT-DETR, and RT-DETRv2, FruitDet consistently delivered higher accuracy across lighting conditions. Ablation, visualization, public-dataset testing, and edge-deployment experiments verified that the proposed modules jointly improve small-object representation, background discrimination, low-light robustness, and real-time applicability. With 2.960 M parameters, 3.726 G FLOPs, and approximately 180 FPS, FruitDet offers a practical and efficient visual perception approach for Young fruit monitoring was conducted under both daytime and night-time orchard conditions covered in this study. All-weather orchard monitoring and robotic young-fruit thinning. The shareable data are available

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.

2. Materials and Methods

2.1. Intelligent Object Detection in Complex Orchard Environments

We built the detection pipeline in three stages: mobile image capture and manual annotation of young fruits in orchard settings; training a deep model to handle occlusion and uneven light; and evaluation via statistical analysis and visual inspection for accuracy, speed, and practical value. Figure 1 outlines the workflow.

2.2. Data Collection

The image data for this study were collected at the High-Standard Dwarf-Rootstock High-Density Apple Demonstration Base in Aksu, Xinjiang (81.70° E, 40.68° N, 1320 m), a typical arid oasis region. A standard RGB camera was used with automatic ISO, shutter speed, and white balance settings, and a fixed f/1.8 aperture under natural light. In this study, only the camera aperture was fixed at f/1.8, while the ISO, shutter speed, and white balance were automatically adjusted by the camera. Therefore, the image acquisition process still involved automatic exposure adaptation to changes in ambient illumination. Fixing the aperture was primarily intended to reduce one hardware-related control variable while also increasing light intake under night-time conditions. However, ISO and exposure time were not independently controlled or analyzed as experimental variables in this study. Consequently, the individual effects of different exposure settings on detection performance cannot yet be quantitatively determined. This acquisition setup was selected to reflect practical orchard monitoring conditions as closely as possible, without relying on additional artificial illumination or complex imaging equipment. All images were saved as JPEGs at their original resolution. Beginning on 15 May 2024, photographs were taken every three days, capturing early morning, midday, and evening scenes under various weather conditions. Each tree was photographed from both backlit and front-lit angles, at distances ranging from 0.1 to 1.5 m, over the course of dozens of hours. This multi-period and multi-angle collection strategy helped increase the diversity of the samples and better represent the visual complexity encountered in real production environments. The raw images of young fruit varied significantly in terms of density, noise, lighting, occlusion, and color blending, which could easily lead to overfitting. Therefore, two categories (A and B) were created based on scene type (Figure 2). During data screening, only nearly identical consecutive frames, severely out-of-focus images, and images with insufficient valid visual information for reliable annotation were removed. Challenging samples involving occlusion, uneven illumination, background similarity, low contrast, and moderate blur were retained. This screening process ultimately resulted in 1800 images suitable for reliable annotation and model training. Removing near-duplicate images helps prevent a small number of consecutive scenes from being over-represented in the dataset and reduces the risk of highly similar images being assigned to different data subsets. However, excluding severely blurred images may introduce a certain degree of image-quality selection bias. Therefore, the robustness of the model under extremely blurred conditions is in need of further evaluation. After manual screening to remove duplicates and blurry shots, 1800 high-quality images with clear edges and rich texture were retained. These were split into training, validation, and test sets in a 7:2:1 ratio for model development and evaluation. Specifically, the dataset contains 900 daytime images and 900 night-time images. After being divided according to a 7:2:1 ratio, the training set contained 1260 images, including 630 daytime and 630 night-time images; the validation set contained 360 images, including 180 daytime and 180 night-time images; and the test set contained 180 images, including 90 daytime and 90 night-time images. A total of 12,642 young apple fruit instances were manually annotated across the entire dataset. All statistics were calculated based on the original images before data augmentation. Labelme was used to place tight rectangular boxes around each young apple, carefully enclosing the fruit while avoiding unnecessary background clutter. For every annotated object, a corresponding text file records the class label alongside its normalized spatial coordinates—ensuring the model receives consistently high-quality supervision from the very start. All bounding boxes were stored using normalized floating-point coordinates and underwent corresponding geometric transformations during image resizing, padding, and data augmentation. Coordinate normalization essentially converts pixel coordinates into proportional values relative to the image width and height and therefore does not alter the relative geometric relationships of the bounding boxes. Localization errors in dense fruit clusters are more likely to arise from ambiguous boundaries between adjacent fruits, limited spatial resolution of the images, uncertainty in manual annotation, and competition among overlapping predicted bounding boxes during non-maximum suppression, rather than from coordinate normalization itself. To prevent data leakage, the training, validation, and test sets were split before data augmentation was performed. Random data augmentation methods, including rotation, translation, and Mosaic augmentation, were applied only to the training set. No random data augmentation was applied to the validation or test sets; these subsets underwent only deterministic preprocessing operations, such as image resizing, padding, and normalization. Therefore, an original image and its augmented versions could not simultaneously appear in different dataset subsets. To push generalization further and guard against the narrow variability of orchard imagery, the dataset was expanded through rotation, translation, and mosaic augmentation, all handled within the Albumentations library. These augmentation operations were designed to simulate changes in fruit position, camera viewpoint, and partial overlap, thereby improving the robustness of the detection model under complex field conditions. The rotation, translation, and Mosaic augmentation strategies currently employed mainly alter object positions, viewing perspectives, and local overlap relationships, and therefore belong primarily to spatial geometric augmentation methods. These operations cannot adequately simulate the highlight saturation, glare, local overexposure, deep shadows, and dynamic-range compression that may occur under extreme backlighting conditions. Consequently, geometric augmentation can improve the model’s robustness to variations in object position and viewing perspective, but it cannot completely prevent false detections caused by extreme backlighting. Annotation files were updated in lockstep to reflect each geometric transformation accurately (Figure 3). This process also strengthened dataset consistency and reduced annotation-related training errors. Such management further improved traceability during subsequent model training and evaluation. Every augmented sample is assigned a UUID-based filename, which eliminates any risk of accidental overwrites and keeps the pairing between image and label unambiguous across all training iterations. The specific scene classifications and feature descriptions of the dataset are summarized in Table 1.

3. Method

3.1. FruitDet Model

Daytime and night-time detection in orchards is often inaccurate. To fix that, we built FruitDet. It has three modules: AUIB, ACSAM, and MViT-T, working together to perform feature extraction and fusion (Figure 4). Specifically, AUIB is embedded in the backbone network, where it replaces the standard C3k2 convolutional modules at selected feature extraction stages. ACSAM is positioned at the output end of the backbone, after the final AUIB-enhanced feature module and before the neck network. MViT-T is located in the high-level feature fusion stage of the neck and is placed before the detection head. The original detection head remains unchanged. Each module handles different parts of the neck and head. They add some algorithmic complexity, but they also improve detection of dense, occluded young fruits through multi-dimensional feature enhancement and global context modeling. The fixed upsampling and downsampling ratios employed in the neck network ensure spatial alignment among feature maps at different scales, but they may not be optimal for all extremely small objects located near image boundaries. Objects at the image edges are often only partially visible, have limited surrounding contextual information, and may also be affected by image resizing, padding, and repeated resampling. Therefore, fixed-scale feature fusion cannot guarantee that every tiny fruit located near the image boundary will be fully preserved throughout the feature-processing pipeline.

3.2. AUIB Module

In FPN, multi-scale fusion often blurs semantics and weakens spatial precision for small targets. AUIB addresses this by borrowing the inverted bottleneck principle—expand channels first, then squeeze—boosting nonlinear capacity at low cost. Within the backbone network of FruitDet. Within FruitDet’s head, AUIB replaces the standard convolutional stack alongside C3k2, enabling leaner cross-layer interaction.
Specifically, the structure of the AUIB module is shown in Figure 5. Given an input feature map X R H × W × C , of a young apple fruit, the channel dimension is first expanded to t × C (typically t > 1) via 1 × 1 convolutions to increase the feature dimension for apple detection and enrich the expressive power of the young apple fruit:
X e x p a n d = C o n v 1 × 1 e x p a n d ( X )
Next, deep separable convolutions are used for feature extraction in the spatial dimension; these typically employ 3 × 3 or 5 × 5 convolutional kernels, which can capture local spatial information at a relatively low computational cost:
X d w = D W C o n v k × k ( X e x p a n d )
The output of the deep convolution on the young apple fruit is then passed through a 1 × 1 convolution to reduce the number of channels back to C:
X p r o j e c t = C o n v 1 × 1 p e o j e c t ( X d w )
Finally, the input is added to the compressed features via a residual connection to produce the final output:
X o u t = X + X p r o j e c t
The entire process can be formalized as follows:
X o u t = X + C o n v 1 × 1 ( D W C o n v ( C o n v 1 × 1 ( X ) ) )
DWConv handles depthwise convolution for young apples. Stride-2 downsampling occurs directly within that depthwise layer, with the residual path adjusted accordingly. This expand–depthwise–squeeze pattern keeps the model lean, suppresses clutter-induced false positives, and strengthens feature reuse. Inside FruitDet’s C3k2, AUIB stacks with skip connections form a more capable extractor for young apples—blending shallow detail with deeper semantics to enrich multi-scale representation and feed stronger features into the attention stages. This study did not independently measure sensor temperature or the image noise induced by sensor heating. Therefore, the performance of the depthwise separable convolution in AUIB under sustained sensor temperature increases cannot yet be quantitatively evaluated. Depthwise convolution performs spatial feature extraction separately for each channel and may therefore preserve some channel-specific noise before cross-channel information is fused through pointwise convolution. Under high-noise conditions, the fine textures and weak boundaries of young fruits may be more substantially disturbed. The detailed process of the AUIB module is illustrated in Algorithm 1.
Algorithm 1: AUIB
Input:
  X: input feature map
  k: depthwise convolution kernel size
Output:
  Y: enhanced output feature map
  1:  Function AUIB(Z, t, k):
  2:      C ← channels(Z)
  3:      Z1 ← Conv1 × 1_expand(Z, t·C)
  4:      Z2 ← DWConv_{k×k}(Z1)
  5:      Z3 ← Conv1 × 1_project(Z2, C)
  6:      Z4 ← Z + Z3
  7:      Return Z4
  8:  End function
  9:  Function C3k2_Apple(X, n, t, k):
  10:    Y ← X
  11:    For i ← 1 to n do
  12:        Y ← AUIB(Y, t, k)
  13:    End for
  14:    Return Y
  15: End function

3.3. ACSAM Attention Module

To cut through the visual clutter of branches, leaves, dappled light, and other orchard background elements, ACSAM is positioned at the output end of the FruitDet backbone, after the final AUIB-enhanced feature extraction module and before the feature maps are fed into the neck network. ACSAM is inserted right at the tail end of the backbone. Its job is to infer attention weights sequentially—first across channels, then across spatial positions—so that the network learns to lock onto young apple regions while suppressing the surrounding noise that would otherwise confuse the detector. Structurally, ACSAM consists of two cooperating sub-modules: a channel attention module (CAM) and a spatial attention module (SAM). They work in tandem, with CAM highlighting which feature channels matter most and SAM pinpointing where in the image to focus, thereby delivering a cleaner, more discriminative feature map to the subsequent detection head.
For an input feature map F R C × H × W of a young apple, channel attention first pools spatially with both global average and max pooling, giving two channel features F a v g c and F m a x c , each of size C × 1 × 1. Both go through a shared MLP, then their outputs are added element-wise. A Sigmoid activation produces channel attention weights M c R C × 1 × 1 :
M c ( F ) = σ ( M L P ( A v g P o o l ( F ) ) + M L P ( M a x P o o l ( F ) ) )
Here, σ denotes the sigmoid function. The MLP consists of two 1 × 1 convolutional layers (the first reduces the number of channels to C/r, and the second restores it to C, where r is the reduction ratio). The M c is multiplied channel-by-channel with the input feature map of the young apple fruit, resulting in the channel-weighted feature map of the young fruit, F′:
F = M c ( F ) F
The spatial attention module takes F′ as input and performs average pooling and max pooling along the channel axis to obtain two 2D feature maps, F a v g s R 1 × H × W and F m a x s R 1 × H × W . After concatenating these two maps, a 7 × 7 convolutional layer reduces the number of channels to 1, and a Sigmoid activation function is then applied to generate spatial attention weights M s R 1 × H × W :
M s ( F ) = σ ( 7 × 7 ( [ A v g P o o l ( F ) ; M a x P o o l ( F ) ] ) )
Here, 7 × 7 denotes a convolutional layer with a 7 × 7 convolutional kernel. By multiplying the spatial attention weights element-wise with F′, we obtain the final feature map F″ of the young apple fruit:
F = M s ( F ) F
Therefore, the overall calculation for the A C S A M module can be expressed as:
F o u t = A C S A M ( F ) = F
ACSAM is connected to the backbone output through a residual attention mechanism, enhancing the high-level backbone features before they enter the neck network for multi-scale feature fusion. The ACSAM module is integrated into the neck of FruitDet using a residual approach, immediately following the AUIB module, ensuring that the feature map of young apples possesses strong target recognition capabilities before being transmitted to the detection head. By enhancing the channel correlation and spatial saliency of young apples, ACSAM effectively reduces false detections caused by leaf occlusion and uneven lighting, thereby improving localization accuracy. ACSAM reduces irrelevant background responses through channel-wise and spatial feature recalibration. However, the attention mechanism itself does not provide explicit instance segmentation, contour constraints, or geometric priors for young fruits. When leaves and young fruits exhibit similar colors, textures, and local brightness distributions, they may generate similar attention responses. This ambiguity becomes more pronounced under low-contrast and occluded conditions. Therefore, although ACSAM can reduce background interference, it cannot completely eliminate all false-positive detections caused by leaves with appearances similar to those of young fruits. The Sigmoid activation function constrains the attention weights to the range of 0 to 1, thereby enabling the recalibration of channel-wise and spatial responses. However, it cannot recover texture or edge information that has already been lost due to severe blur, underexposure, or noise. In addition, when the pre-activation feature values become excessively large or small, the Sigmoid function may enter its saturation region. Residual attention connections can preserve part of the original feature information, but they cannot fully compensate for severely degraded input images. The detailed process of the ACSAM module is illustrated in Algorithm 2. The structure of the ACSAM module is shown in Figure 6.
Algorithm 2: ACSAM
Input:
  F: input feature map
  r: channel reduction ratio
Output:
  F_out: output feature map enhanced by channel and spatial attention
  1:   Function ACSAM(F, r):                          
  2:       C, H, W ← shape(F)                          
  3:       F_avg_c ← AvgPool(F)                        
  4:       F_max_c ← MaxPool(F)                        
  5:       M_c_avg ← Conv1 × 1(ReLU(Conv1 × 1(F_avg_c, C/r)), C)  
  
  6:       M_c_max ← Conv1 × 1(ReLU(Conv1 × 1(F_max_c, C/r)), C)  
  
  7:       M_c ← σ(M_c_avg + M_c_max)              
  8:       F′ ← M_c ⊙ F                              
  9:       F_avg_s ← AvgPool(F′, dim = channel)          
  10:     F_max_s ← MaxPool(F′, dim = channel)        
  11:     F_concat ← Concat(F_avg_s, F_max_s)        
  12:     M_s ← σ(Conv7 × 7(F_concat))                
  13:     F″ ← M_s ⊙ F′                            
  14:     Return F″                                
  15: End function                                  

3.4. MViT-T Global Context Module

CNNs are inherently local—they capture nearby texture well but miss broader scene context. For young apples, that matters: fruit hides behind leaves, merges with branches, or falls under shifting light, so detection relies on relating each candidate to its surroundings. MViT-T is positioned in the high-level feature fusion stage of the FruitDet neck network, after multi-scale feature aggregation and before the detection head. This module combines the local representation capability of convolutional operations with the global contextual modeling capability of the Transformer. MViT-T, inserted at the high-level feature layers, combines convolution’s local precision with a Transformer’s global awareness. Unlike standard vision Transformers, it first uses deep convolution to extract fine-grained fruit cues. The feature map is then flattened for self-attention, which connects distant regions. Finally, the attended sequence is folded back and fused with the original local features. This interplay yields a representation that is both spatially grounded and globally informed—exactly what the detection head needs in cluttered orchard scenes.
Given an input feature map X R H × W × C of young apples, a 3 × 3 depthwise convolution is applied first, followed by a 1 × 1 convolution that reduces channels to d. That gives X p R H × W × d . Next, X p is split into non-overlapping patches of fixed size ( P h , P w ). The patch size adopted in MViT-T in this study was (ph × pw = 8 × 8). Smaller patches can preserve finer-grained spatial information, but they increase the number of tokens and consequently the computational cost of self-attention. In contrast, larger patches can reduce computational overhead, but they may combine small young fruits and surrounding branches or leaves within the same token. Therefore, the patch size needs to balance the preservation of fine details for small-object detection against computational efficiency. Each patch is flattened into a token, producing a sequence X t R N × L × d , where N = H / P h × W / P w is the number of patches and L = P h × P w is the pixels per patch
To keep spatial location info of the young apples, a learnable position embedding is added to each token. Learnable positional embeddings primarily encode the spatial locations of tokens within a fixed feature grid rather than directly representing the number or density of fruits. Variations in fruit density are mainly reflected through the token content and the attention relationships among different tokens. Therefore, positional embeddings can preserve spatial ordering, but they alone cannot guarantee that the model will adapt effectively to substantial changes in fruit density and canopy structure throughout the growing season. That sequence then goes into the MViT-T encoder, which has a multi-head self-attention (MSA) mechanism and a feedforward network (FFN) with a depth of:
X t   = M S A ( L N ( X t + E p o s ) ) + X t
X t = F F N ( L N ( X t ) ) + X t
Here, LN denotes layer normalization. Layer normalization can stabilize the numerical scale of token features within the Transformer encoder and reduce the model’s sensitivity to variations in intermediate feature magnitudes. However, layer normalization is not an image-level illumination correction mechanism and therefore cannot compensate for pixel saturation, highlight clipping, or glare caused by artificial lighting. When texture information in a local region is lost due to a sudden increase in illumination intensity, layer normalization cannot recover the missing visual information. The self-attention is computed in the standard form:
A t t e n t i o n ( Q , K , V ) = S o f t m a x   ( Q K T / d k ) V
Here, Q , K , and V are obtained via linear projection of the input, and d k is the dimension of the attention head. The sequence X t processed by MViT-T is refolded into a young fruit feature map X g R H × W × d , and then the number of channels is restored to C via a 1 × 1 convolution to obtain the globally enhanced feature. Finally, this feature is concatenated with the original input young fruit feature map X in the channel dimension and fused via another n × n convolution to obtain the final output.
X o u t = C o n v n × n ( [ C o n v 1 × 1 ( F o l d ( X t ) ) ; X ] )
Here, ‘Fold’ is the inverse operation for reconstructing spatial structure and ‘ C o n v n × n ’ denotes an n × n convolution. The Unfold and Fold operations involve feature rearrangement and data movement, which may introduce substantial memory and latency overhead when applied to high-resolution feature maps. To control this cost, MViT-T is applied only to the high-level, low-resolution feature maps in the neck network, and the channel dimension is compressed using a 1 × 1 convolution before tokenization. If the same operations were applied to higher-resolution features, memory-access overhead and inference latency would increase substantially. MViT-T has lower computational complexity than standard global self-attention because it divides feature maps into small patches and performs self-attention within each patch, while incorporating deep convolutions to preserve local details of young fruits. In this study, MViT-T is integrated into the high-level feature fusion layer of the neck network, immediately before the detection head. Specifically, it processes the fused features before they are fed into the detection head. In this paper, we integrate it into the high-level feature layers of FruitDet, enabling the model to capture contextual relationships between young fruits and complex backgrounds such as surrounding branches, leaves, and lighting, thereby enhancing the model’s ability to recognize partially occluded objects. This module works in synergy with AUIB and ACSAM: AUIB enhances multi-scale interactions, ACSAM focuses on key regions, and MViT-T captures global dependencies. Together, these three components improve the model’s detection stability and accuracy in natural orchard environments, and the improved FruitDet model enhances the detection performance of small apple fruit targets. To visualize the feature extraction capability of the proposed MViT-T module, we analyzed the output feature maps. As shown in Figure 7, the global context module effectively captures long-range dependencies. The detailed process of the MViT-T module is illustrated in Algorithm 3.
Algorithm 3: MViT-T
Input:
  X: input feature map        ph: patch height        pw: patch width
  d_enc: number of Transformer encoder layers     n: convolution kernel size for final feature fusion
Output:
  X_out: output feature map enhanced by local and global feature fusion:
  1:   Function MViT-T(X, ph, pw, d_enc, n):          
  2:       C, H, W ← shape(X)                          
  3:       Xp ← Conv1 × 1(DWConv3 × 3(X), d)              
  4:       N ← (H/ph) × (W/pw), L ← ph×pw              
  5:       Xt ← Unfold(Xp, ph, pw)                    
  6:       Xt ← Xt + Epos                              
  7:       For i ← 1 to d_enc do                      
  8:           Xt ← MSA(LN(Xt)) + Xt                  
  9:           Xt ← FFN(LN(Xt)) + Xt                  
  10:      End for                                    
  11:      Xg ← Fold(Xt, H, W, ph, pw)                
  12:      Xg ← Conv1 × 1(Xg, C)                        
  13:      X_out ← Convn×n(Concat(Xg, X))              
  14:      Return X_out                                
  15:  End function

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.
P r e c i s i o n = T P / ( T P + F P )
R e c a l l = T P / ( T P + F N )
A P = 0 1 P ( R ) d R
m A P = 1 / C i = 1 C A P i
m A P 50 95 = 1 / 10 I o U = 0.5 0.95 m A P I o U
Here, C represents the number of classes, A P i denotes the average precision for the i-th class, and m A P I o U refers to the m A P value calculated at a specific I o U 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.

Author Contributions

Conceptualization, J.C. and H.Y.; data curation, J.C., J.Y. and L.T.; funding acquisition, H.Y. and Y.L.; investigation, J.C., J.Y. and R.Z.; methodology, J.C., J.Y. and J.L.; project administration, J.C., L.T. and Z.Z.; resources, H.Y.; software, J.C., J.Y., L.T., H.C. and H.Y.; supervision, H.Y. and Y.L.; validation, J.C., J.Y., L.T., J.L. and H.Y.; visualization, R.Z.; writing—original draft, J.C., J.Y., L.T. and H.Y.; writing—review and editing, J.C., J.Y., L.T., R.Z. and H.Y. All authors have read and agreed to the published version of the manuscript.

Funding

This work was supported by the Tianchi Talents Introduction Program (BT-2025-TCYC-0074), the High-Level Talent Program (RCZK202441), Key Laboratory of Agricultural Equipment in Northwest China, Ministry of Agriculture and Rural Affairs (KFKT202508), the Xinjiang Production and Construction Corps Key Agricultural Core Technology Research Program (NYHXGG2023AA402), and the Xinjiang Forest and Fruit Industry Technology System (XJLGCYJSTX04-2025). Corps-Level Undergraduate Education Reform Project (BTBKXM-2025-Y31) Shihezi University Undergraduate Education and Teaching Reform Research Project (JGY-2025-08), Project of Tianchi Talented Young Doctor (Grant No. CZ002558); Xinjiang Fruit Industry Technology System (Grant No. XJLGCYJSTX04-2026).

Institutional Review Board Statement

Not applicable.

Data Availability Statement

The data are available within the article.

Acknowledgments

The authors would like to thank their schools and colleges, as well as the funders of the project. All supports and assistance are sincerely appreciated. Additionally, we sincerely appreciate the work of the editor and the reviewers of the present paper.

Conflicts of Interest

The authors declare no conflicts of interest.

References

  1. Wang, C.; Sun, P.; Yang, C.; Teng, X.; Wang, R. AMSA-YOLO: Real-time object detection with adaptive multi-scale attention mechanism. Neural Netw. 2026, 197, 108545. [Google Scholar]
  2. Liu, Q.; Lv, J.; Zhang, C. MAE-YOLOv8-based small object detection of green crisp plum in real complex orchard environments. Comput. Electron. Agric. 2024, 226, 109458. [Google Scholar]
  3. Aghili, M.E.; Ghassemian, H.; Imani, M. YOLO-PICO: Lightweight object recognition in remote sensing images using expansion attention modules. Pattern Recognit. 2026, 176, 113114. [Google Scholar]
  4. Qi, Z.; Zhang, T.; Yuan, T.; Zhou, W.; Zhang, W. Assessment of the tomato cluster yield estimation algorithms via tracking-by-detection approaches. Inf. Process. Agric. 2025, 12, 445–455. [Google Scholar] [CrossRef]
  5. Sun, H.; Wang, B.; Xue, J. YOLO-P: An efficient method for pear fast detection in complex orchard picking environment. Front. Plant Sci. 2023, 13, 1089454. [Google Scholar] [CrossRef] [PubMed]
  6. Lin, X.; Dehao, L.; Du, Z.; Wen, B.; Wu, Z.; Tu, X. SDA-YOLO: An Object Detection Method for Peach Fruits in Complex Orchard Environments. Sensors 2025, 25, 4457. [Google Scholar] [CrossRef] [PubMed]
  7. Zhang, B.; Wang, R.; Zhang, H.; Yin, C.; Xia, Y.; Fu, M.; Fu, W. Dragon fruit detection in natural orchard environment by integrating coordinate attention mechanism with YOLOv5. Front. Plant Sci. 2022, 13, 1040923. [Google Scholar] [CrossRef] [PubMed]
  8. Wang, M.; Li, F. Real-Time Accurate Apple Detection Based on Improved YOLOv8n in Complex Natural Environments. Plants 2025, 14, 365. [Google Scholar] [CrossRef] [PubMed]
  9. Luo, Y.; Liu, Y.; Wang, H.; Chen, H.; Liao, K.; Li, L. YOLO-CFruit: A Robust Object Detection Method for Camellia oleifera Fruit in Complex Environments. Front. Plant Sci. 2024, 15, 1389961. [Google Scholar] [CrossRef] [PubMed]
  10. Wu, X.; Tang, R.; Mu, J.; Niu, Y.; Xu, Z.; Chen, Z. A Lightweight Grape Detection Model in Natural Environments Based on an Enhanced YOLOv8 Framework. Front. Plant Sci. 2024, 15, 1407839. [Google Scholar] [CrossRef] [PubMed]
  11. Tang, J.; Yu, Z.; Shao, C.S. Hybrid attention transformer integrated YOLOV8 for fruit ripeness detection. Sci. Rep. 2025, 15, 22652. [Google Scholar] [CrossRef] [PubMed]
  12. Li, J.; Li, X.; Hu, J.; Liang, M.; Jiang, K.; Yang, H.; Tian, M. A transformer-enhanced real-time detection method for young fruits in complex orchard environments. Smart Agric. Technol. 2026, 13, 101762. [Google Scholar] [CrossRef]
  13. Cao, H.; Zhang, G.; Zhao, A.; Wang, Q.; Zou, X.; Wang, H. YOLOv8n-CSE: A Model for Detecting Litchi in Nighttime Environments. Agronomy 2024, 14, 1924. [Google Scholar] [CrossRef]
  14. Xu, L.; Ni, T.; Zhou, F.; Lin, Q.; Chen, L.; Luo, Q.; Xia, K.; Xue, X.; Zheng, X.; Wu, S.; et al. Nighttime apple harvesting image enhancement based on a global–local feature fusion diffusion model. Comput. Electron. Agric. 2026, 246, 111672. [Google Scholar] [CrossRef]
  15. Kutyrev, A.; Khort, D.; Smirnov, I.; Zubina, V. AI-based orchard monitoring at night: Enhancing sustainable fruit production through real-time apple detection. E3S Web Conf. 2025, 614, 03008. [Google Scholar] [CrossRef]
  16. Jrondi, Z.; Moussaid, A.; Hadi, M.Y. Exploring End-to-End Object Detection with Transformers versus YOLOv8 for Enhanced Citrus Fruit Detection within Trees. Syst. Soft Comput. 2024, 6, 200103. [Google Scholar] [CrossRef]
  17. Liu, X.; Zhao, Y.; Chen, J.; Wu, M. Improved YOLO-based fruit detection in orchards using transformer feature fusion. Comput. Electron. Agric. 2024, 218, 108692. [Google Scholar]
  18. Zhao, K.; Wang, S.; Li, R.; Zhang, T.; Huang, Y. Orchard fruit detection based on YOLO and Swin Transformer under complex environments. Precis. Agric. 2024, 25, 1562–1581. [Google Scholar]
  19. Hu, J.; Fan, C.; Wang, Z.; Ruan, J.; Wu, S. Fruit Detection and Counting in Apple Orchards Based on Improved YOLOv7 and Multi-Object Tracking Methods. Sensors 2023, 23, 5903. [Google Scholar] [CrossRef] [PubMed]
  20. Yang, S.; Wang, W.; Gao, S.; Deng, Z. Strawberry ripeness detection based on YOLOv8 algorithm fused with LW-Swin Transformer. Comput. Electron. Agric. 2023, 215, 108360. [Google Scholar] [CrossRef]
  21. Lu, S.; Liu, X.; He, Z.; Zhang, X.; Liu, W.; Karkee, M. Swin-Transformer-YOLOv5 for Real-Time Wine Grape Bunch Detection. Remote Sens. 2022, 14, 5853. [Google Scholar] [CrossRef]
  22. Yu, Z.; Liang, H.; Ye, O.; Zhang, Y. ESOD-YOLOv8: Small object detection enhanced with auto-disturbance rejection convolution. Expert Syst. Appl. 2025, 258, 125124. [Google Scholar] [CrossRef]
  23. Canny, J. A computational approach to edge detection. IEEE Trans. Pattern Anal. Mach. Intell. 1986, 6, 679–698. [Google Scholar] [CrossRef]
  24. Nie, Y.; Lai, H.; Gao, G. DSOD-YOLO: A lightweight dual feature extraction method for small target detection. Digit. Signal Process. 2025, 152, 104723. [Google Scholar] [CrossRef]
  25. Li, Y.; Wang, C.; Wang, C.; Deng, X.; Zhao, Z.; Chen, S.; Lan, Y. Detection of the foreign object positions in agricultural soils using Mask-RCNN. Int. J. Agric. Biol. Eng. 2023, 16, 220–231. [Google Scholar] [CrossRef]
  26. Wang, Z.; Yan, F.; Wang, L.; Yin, Y.; Lin, J. S-YOLO: An enhanced small object detection method based on adaptive gating strategy and dynamic multi-scale focus module. Neural Netw. 2025, 191, 107782. [Google Scholar] [CrossRef] [PubMed]
  27. Yang, X.; Lin, Y.; Xiao, Q.; Liang, Z.; Ma, L.; ShuoGuo, Y.; Ade, K.; Tong, Z.; Chen, Y.; Cao, Y. A lightweight YOLO-TinyFuse model for small target detection of olive fruits. Front. Plant Sci. 2026, 17, 1773377. [Google Scholar] [CrossRef] [PubMed]
  28. Huang, X.Y.; Zhou, R.X. Rice pest detection via multi-scale edge network and wavelet attention enhancement. Front. Plant Sci. 2026, 17, 1748419. [Google Scholar] [CrossRef] [PubMed]
  29. Ma, N.; Sun, Y.; Li, C.; Liu, Z.; Song, H. AHG-YOLO: Multi-category detection for occluded pear fruits in complex orchard environments. Front. Plant Sci. 2025, 16, 1580325. [Google Scholar] [CrossRef] [PubMed]
  30. Gu, Z.; Ma, X.; Guan, H.; Jiang, Q.; Deng, H.; Wen, B.; Zhu, T.; Wu, X. Tomato fruit detection and phenotype calculation method based on the improved RTDETR model. Comput. Electron. Agric. 2024, 227, 109524. [Google Scholar] [CrossRef]
  31. Kodors, S.; Sondors, M.; Apeinans, I.; Zarembo, I.; Lacis, G.; Rubauskis, E.; Karklina, K. Importance of mosaic augmentation for agricultural image dataset. Agron. Res. 2024, 22, 168–179. [Google Scholar]
  32. Ben Hazem, Z.; Guler, N.; Altaif, A.H. Model-free trajectory tracking control of a 5-DOF Mitsubishi robotic arm using deep deterministic policy gradient algorithm. Discov. Robot. 2025, 1, 4. [Google Scholar] [CrossRef]
  33. Guler, N.; Hazem, Z.B. Semantic communication-based convolutional neural network for enhanced image classification. Frankl. Open 2024, 9, 100192. [Google Scholar] [CrossRef]
Figure 1. Framework for detecting young apples in complex orchard environments. Numbers 1–6 represent the sequential stages of the detection framework: (1) image acquisition in orchard, (2) manual annotation of immature fruits, (3) dataset construction, (4) neural network training for localization and recognition, (5) object detection output, and (6) qualitative result visualization with bounding boxes.
Figure 1. Framework for detecting young apples in complex orchard environments. Numbers 1–6 represent the sequential stages of the detection framework: (1) image acquisition in orchard, (2) manual annotation of immature fruits, (3) dataset construction, (4) neural network training for localization and recognition, (5) object detection output, and (6) qualitative result visualization with bounding boxes.
Agriculture 16 01684 g001
Figure 2. Two typical scenarios for detecting young apple fruits. The red boxes indicate the detected young apples by the proposed model. Subfigure (A) shows the detection scenario under bright natural light conditions. Subfigure (B) illustrates the detection performance in low-light environments where other lighting is required.
Figure 2. Two typical scenarios for detecting young apple fruits. The red boxes indicate the detected young apples by the proposed model. Subfigure (A) shows the detection scenario under bright natural light conditions. Subfigure (B) illustrates the detection performance in low-light environments where other lighting is required.
Agriculture 16 01684 g002
Figure 3. Image enhancement: (a) rotation, (b) translation, (c) mosaic.
Figure 3. Image enhancement: (a) rotation, (b) translation, (c) mosaic.
Agriculture 16 01684 g003
Figure 4. Network architecture of the proposed young fruit detection.
Figure 4. Network architecture of the proposed young fruit detection.
Agriculture 16 01684 g004
Figure 5. The AUIB module for addressing feature loss.
Figure 5. The AUIB module for addressing feature loss.
Agriculture 16 01684 g005
Figure 6. Two-layer attention-based ACSAM module that integrates spatial and channel dimensions.
Figure 6. Two-layer attention-based ACSAM module that integrates spatial and channel dimensions.
Agriculture 16 01684 g006
Figure 7. The global context MViT-T module in the hierarchical dual-path architecture. The color gradient in the output feature map represents the attention intensity, where purple indicates high attention weights and blue/cyan indicates low attention weights.
Figure 7. The global context MViT-T module in the hierarchical dual-path architecture. The color gradient in the output feature map represents the attention intensity, where purple indicates high attention weights and blue/cyan indicates low attention weights.
Agriculture 16 01684 g007
Figure 8. Visualizations of Table 5 and Table 6.
Figure 8. Visualizations of Table 5 and Table 6.
Agriculture 16 01684 g008
Figure 9. Accuracy convergence curves for this model and other mainstream detection models in Scenarios A and B.
Figure 9. Accuracy convergence curves for this model and other mainstream detection models in Scenarios A and B.
Agriculture 16 01684 g009
Figure 10. Convergence curves for MAP50-95 of this model and other mainstream detection models in Scenarios A and B.
Figure 10. Convergence curves for MAP50-95 of this model and other mainstream detection models in Scenarios A and B.
Agriculture 16 01684 g010
Figure 11. Comparison of model detection results across different scenarios. The red circles highlight the instances of missed detections and false alarms. (A) Normal daylight conditions; (B) Low-light night conditions.
Figure 11. Comparison of model detection results across different scenarios. The red circles highlight the instances of missed detections and false alarms. (A) Normal daylight conditions; (B) Low-light night conditions.
Agriculture 16 01684 g011
Figure 12. Comparison LayerCAM visualization results for different backbone networks across various scenarios. (A) Normal daylight conditions; (B) Low-light night conditions.
Figure 12. Comparison LayerCAM visualization results for different backbone networks across various scenarios. (A) Normal daylight conditions; (B) Low-light night conditions.
Agriculture 16 01684 g012
Figure 13. Visualization of detection results under transitional illumination conditions (dusk/dawn).
Figure 13. Visualization of detection results under transitional illumination conditions (dusk/dawn).
Agriculture 16 01684 g013
Figure 14. Detection performance of different models on a public dataset.
Figure 14. Detection performance of different models on a public dataset.
Agriculture 16 01684 g014aAgriculture 16 01684 g014b
Figure 15. Model false negative and false positive charts for two classic scenarios. (A) Normal daylight conditions; (B) Low-light night conditions.
Figure 15. Model false negative and false positive charts for two classic scenarios. (A) Normal daylight conditions; (B) Low-light night conditions.
Agriculture 16 01684 g015
Figure 16. Model actual edge deployment.
Figure 16. Model actual edge deployment.
Agriculture 16 01684 g016
Figure 17. Violin plots of mAP50 distributions for different models under continuous operation conditions in a real orchard in Aksu. (a) Violin plot of mAP50 distribution for different models under daytime conditions. (b) Violin plot of mAP50 distribution for different models under night-time conditions.
Figure 17. Violin plots of mAP50 distributions for different models under continuous operation conditions in a real orchard in Aksu. (a) Violin plot of mAP50 distribution for different models under daytime conditions. (b) Violin plot of mAP50 distribution for different models under night-time conditions.
Agriculture 16 01684 g017
Table 1. Scene classification and feature descriptions for the apple young fruit detection dataset.
Table 1. Scene classification and feature descriptions for the apple young fruit detection dataset.
DatasetScene DescriptionFeature Description
AScene of inspecting young apples under natural daylightNatural light provides bright illumination; however, the texture and noise in the background leaves significantly affect detection, making false negatives likely to occur.
BScenario for detecting young apples in low-light conditions at nightWithout natural sunlight, only moonlight, starlight, or artificial light remains. In such low-light conditions, image contrast drops, which leads to false positives and lower detection accuracy.
Table 2. Training hyperparameter settings.
Table 2. Training hyperparameter settings.
HyperparametersValue
optimizerAdamW
lr00.002
lrf0.01
Batch size128
Epoch300
Image size640 × 640
momentum0.9
mosaic0.5
workers8
Table 3. Comparison of performance in daytime melting tests. Note: “√” indicates that the module is included Note: Bold values indicate the best performance results in each row.
Table 3. Comparison of performance in daytime melting tests. Note: “√” indicates that the module is included Note: Bold values indicate the best performance results in each row.
BaselineAUIBACSAMMViT-TP
(%)
R
(%)
mAP50
(%)
mAP50-95
(%)
Params
(M)
FLOPs
(G)
FPSModel Size (MB)
85.12672.33877.62160.6032.5903.220205.9405.235
85.68374.26978.02061.2742.4493.120235.2124.950
85.29273.63577.34760.1322.5913.220197.0075.237
86.58973.94976.97461.0143.5424.768153.5007.159
87.87875.02281.09663.6582.4503.120206.1984.952
89.47176.13682.49165.9313.4014.668162.0856.874
88.63675.24478.55963.5063.5424.768142.7587.159
91.90477.55783.25466.4272.9603.726181.0605.982
Table 4. Comparison of performance in night-time thawing tests.
Table 4. Comparison of performance in night-time thawing tests.
BaselineAUIBACSAMMViT-TP
(%)
R
(%)
mAP50
(%)
mAP50-95
(%)
Params
(M)
FLOPs
(G)
FPSModel Size (MB)
84.39871.17475.74859.3402.5903.220204.9645.235
84.41472.54576.41360.2902.4493.120233.5824.950
84.54272.25876.21159.9422.5913.220190.6845.237
83.93671.14776.50859.5513.5424.768146.0577.159
86.87272.63477.464 61.0272.4503.120200.4904.952
88.81874.07979.47762.5753.4014.668160.0746.874
85.75573.65277.82061.8273.5424.768140.8847.159
90.10775.13580.54464.7192.9603.726180.3015.982
Table 5. Comparison of Model Performance in Daytime Scenarios.
Table 5. Comparison of Model Performance in Daytime Scenarios.
SceneModelPrecision
(%)
Recall
(%)
mAP50
(%)
mAP50-95
(%)
Params
(M)
FLOPs
(G)
FPSModel Size
(MB)
DayYolov5n85.60971.51176.29660.1791.9234.495198.7603.873
Yolov8n86.02272.22377.40660.6063.1608.700171.2606.215
Yolo11n85.12672.33877.62160.6032.5903.220205.9405.235
Yolo26n88.84674.36579.52462.58711.24017.86098.52022.147
FasterR-CNN83.87870.89975.42859.30641.200180.50021.630158.740
RT-DETR86.42873.27378.55462.28820.64062.37054.28081.936
RT-DETRv287.67274.15979.38663.53819.87058.94058.73079.420
FruitDet91.90477.55783.25466.4272.9603.726181.0605.982
Table 6. Comparison of model performance in night-time scenarios.
Table 6. Comparison of model performance in night-time scenarios.
SceneModelPrecision
(%)
Recall
(%)
mAP50
(%)
mAP50-95
(%)
Params
(M)
FLOPs
(G)
FPSModel Size
(MB)
NightYolov5n84.62171.49574.84759.5241.9234.495197.4203.873
Yolov8n85.30370.44074.50558.4453.1608.700169.9806.215
Yolo11n84.39871.17475.74859.3402.5903.220204.9645.235
Yolo26n87.42173.52677.24261.95811.24017.86097.31022.147
FasterR-CNN83.95370.25175.37059.53441.200180.50021.210158.740
RT-DETR85.98272.22775.63760.36720.64062.37053.64081.936
RT-DETRv287.02973.13978.38562.55719.87058.94057.98079.420
FruitDet90.10775.13580.54464.7192.9603.726180.3015.982
Table 7. Performance comparison of daytime scenes on public datasets.
Table 7. Performance comparison of daytime scenes on public datasets.
SceneModelPrecision
(%)
Recall
(%)
mAP50
(%)
mAP50-95
(%)
Params
(M)
FLOPs
(G)
FPSModel Size
(MB)
DayYolov5n86.03372.07276.63860.6341.9234.495185.3403.873
Yolov8n86.48172.41777.81461.1463.1608.700162.8106.215
Yolo11n85.95272.64178.10761.3272.5903.220199.6205.235
Yolo26n89.42674.83480.24363.76811.24017.86094.14022.147
FasterR-CNN84.81471.03775.88360.11241.200180.50019.380158.740
RT-DETR86.77173.77678.90862.94120.64062.37046.21081.936
RT-DETRv288.32274.86780.01664.27419.87058.94053.63079.420
FruitDet92.14978.01283.86167.1032.9603.726179.1105.982
Table 8. Performance comparison of night-time scenes across public datasets.
Table 8. Performance comparison of night-time scenes across public datasets.
SceneModelPrecision
(%)
Recall
(%)
mAP50
(%)
mAP50-95
(%)
Params
(M)
FLOPs
(G)
FPSModel Size
(MB)
NightYolov5n84.91470.52774.62760.3271.9234.495177.4103.873
Yolov8n85.83270.91274.93560.5833.1608.700159.3706.215
Yolo11n84.75871.85175.98860.5732.5903.220190.1375.235
Yolo26n87.96774.24377.92462.54311.24017.86091.33022.147
FasterR-CNN84.02770.62575.46160.98241.200180.50014.480158.740
RT-DETR86.21172.94875.16461.62720.64062.37042.57081.936
RT-DETRv287.84674.14478.32763.24819.87058.94051.73079.420
FruitDet90.98475.93681.42165.2672.9603.726174.0065.982
Table 9. Comparison of parameters.
Table 9. Comparison of parameters.
ModelParams (M)FLOPs (G)FPSModel Size (MB)
Yolov5n1.9234.495198.7603.873
Yolov8n3.1608.700171.2606.215
Yolo11n2.5903.220205.9405.235
Yolo26n11.24017.86098.52022.147
FasterR-CNN41.200180.50021.630158.740
RT-DETR20.64062.37054.28081.936
RT-DETRv219.87058.94058.73079.420
FruitDet2.9603.726181.0605.982
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Chen, J.; Yu, J.; Tang, L.; Zhang, R.; Li, J.; Chen, H.; Zhang, Z.; Liu, Y.; Yang, H. FruitDet: A Multi-Module Lightweight Detector for Young Apple Fruits Under Day–Night Orchard Conditions. Agriculture 2026, 16, 1684. https://doi.org/10.3390/agriculture16151684

AMA Style

Chen J, Yu J, Tang L, Zhang R, Li J, Chen H, Zhang Z, Liu Y, Yang H. FruitDet: A Multi-Module Lightweight Detector for Young Apple Fruits Under Day–Night Orchard Conditions. Agriculture. 2026; 16(15):1684. https://doi.org/10.3390/agriculture16151684

Chicago/Turabian Style

Chen, Jipeng, Jinzheng Yu, Langyu Tang, Rong Zhang, Jinyan Li, Hongda Chen, Zhiyuan Zhang, Yang Liu, and Hongfei Yang. 2026. "FruitDet: A Multi-Module Lightweight Detector for Young Apple Fruits Under Day–Night Orchard Conditions" Agriculture 16, no. 15: 1684. https://doi.org/10.3390/agriculture16151684

APA Style

Chen, J., Yu, J., Tang, L., Zhang, R., Li, J., Chen, H., Zhang, Z., Liu, Y., & Yang, H. (2026). FruitDet: A Multi-Module Lightweight Detector for Young Apple Fruits Under Day–Night Orchard Conditions. Agriculture, 16(15), 1684. https://doi.org/10.3390/agriculture16151684

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop