1. Introduction
Wireless capsule endoscopy (WCE) has become an important non-invasive modality for evaluating small-bowel disorders because it enables visualization of intestinal mucosa beyond the reach of conventional endoscopy [
1,
2]. It is widely used for suspected small-bowel bleeding and for the assessment of inflammatory, vascular, and neoplastic lesions. However, a single examination may generate tens of thousands of images, while lesion-containing frames usually account for only a small proportion. Consequently, manual reading is time-consuming and vulnerable to fatigue-related oversight and inter-observer variability, which has motivated increasing interest in AI-assisted analysis for improving diagnostic efficiency and consistency [
3,
4,
5].
Despite the rapid development of deep learning in medical image analysis, automated lesion detection in WCE images remains difficult because capsule frames are frequently affected by illumination variation, specular reflection, debris or fluid interference, motion blur, irregular mucosal textures, and substantial lesion-scale variation. Under these conditions, subtle pathological patterns are easily masked by complex background responses, making small lesions and weak-boundary lesions difficult to distinguish [
6,
7]. Existing detection paradigms still show important limitations in WCE imagery. CNN-based detectors are efficient, but repeated downsampling may weaken fine-grained lesion cues. Transformer-based detectors improve long-range dependency modeling, but their practical use still requires careful balancing of computational cost, data efficiency, and preservation of local structural detail [
7,
8,
9]. Therefore, although both paradigms have made substantial progress, neither fully resolves the core challenges of WCE lesion detection.
In addition to spatial modeling, the temporal continuity of capsule endoscopy videos has motivated attempts to exploit inter-frame information for automated analysis. Recent studies have explored temporal filtering, small-bowel localization, and sequential lesion analysis to improve recognition stability and reduce irrelevant frames before lesion detection [
10,
11]. Nevertheless, practical deployment of temporal methods remains constrained by the extreme length of WCE sequences, limited temporal annotation, and the intermittent visibility of lesions caused by capsule motion and viewpoint variation. As a result, most current WCE computer-aided detection systems still depend heavily on frame-level spatial analysis, making robust spatial representation learning a central determinant of lesion detection performance [
12].
Based on these observations, two key technical gaps remain in current WCE lesion detection methods. First, illumination variation and background interference can obscure subtle lesion boundaries and reduce feature discriminability, requiring stronger feature enhancement and noise suppression. Second, small and low-contrast lesions are highly vulnerable to information loss during progressive downsampling and cross-scale fusion, which weakens localization accuracy and lesion sensitivity. To address these challenges, this study proposes YOLOv12-WCIRS, an improved YOLOv12-based framework for small intestinal lesion detection in WCE images. Built upon the official YOLOv12 baseline [
13], the proposed method introduces a Weighted Convolution module for local enhancement, a Contextual Selection Fusion Module and an Information Integration Attention Fusion module for selective multi-scale interaction and background suppression, a Receptive Field Attention-based detection head for more accurate localization, and a Scale Dynamic Loss for scale-aware optimization during training. Experiments on the SEE-AI dataset and additional external validation on overlapping categories in Kvasir-Capsule show that the proposed model achieves stronger detection performance, improved robustness in complex backgrounds, and competitive computational efficiency [
14].
The main contributions of this study are summarized as follows:
We develop a WCE-oriented lesion detection framework, termed YOLOv12-WCIRS, for small intestinal lesion detection under challenging conditions such as small lesion size, blurred boundaries, complex mucosal background, and scale imbalance.
The proposed framework performs a task-oriented redesign of the YOLOv12 pipeline by jointly integrating local feature enhancement, selective cross-scale fusion, localization-aware prediction, and scale-aware optimization.
We establish a broader evaluation setting that includes representative YOLO-based, Transformer-based, and hybrid detectors, together with cross-dataset validation on overlapping lesion categories.
Comparative experiments, ablation study, category-wise analysis, normal-frame false-alarm evaluation, and false-positive/false-negative breakdown jointly demonstrate the effectiveness and practical value of the proposed framework for WCE lesion detection.
2. Related Work
2.1. Deep Learning-Based Lesion Detection in WCE Images
Wireless capsule endoscopy (WCE) has become an important imaging modality for gastrointestinal and small-bowel evaluation because of its non-invasive nature, but automated analysis remains challenging due to image artifacts, large frame volume, subtle lesion appearance, background interference, and substantial variation in lesion scale and morphology [
15]. Recent WCE-specific studies show that lesion detectors must be adapted to the distinctive visual properties of capsule endoscopy images rather than relying only on generic object-detection strategies. Chen et al. developed a convolutional-neural-network-based system for automated recognition of 12 categories of small-bowel lesions and reported strong external validation performance together with real-time video marking capability [
16]. Xiao et al. proposed WCE_Detection for recognizing 23 classes of digestive tract lesions and adopted a multi-detection-head strategy to handle diverse lesion shapes and scales [
17]. Ye et al. further proposed TSD-YOLO, introducing a Tiny Detection Layer, SimAM-based neck refinement, and DIoU-based regression to better preserve shallow information and improve tiny-lesion detection in WCE videos [
18]. These studies indicate that effective WCE lesion detection depends heavily on fine-grained local representation, multi-scale feature interaction, and robustness to visually confusing mucosal backgrounds.
2.2. YOLO-Based Detection Methods and the Evolution to YOLOv12
Among real-time object detectors, the YOLO family has remained highly influential because it provides a favorable balance between detection accuracy and inference efficiency. Representative developments such as YOLOv10 and YOLOv11 have improved end-to-end optimization, architectural efficiency, and broader applicability across detection-related tasks [
19,
20]. More recent medical-imaging studies suggest that the evolution toward newer YOLO variants has continued into YOLOv12, which has shown strong performance in clinically oriented detection tasks beyond conventional natural-image benchmarks [
21,
22]. These studies indicate that newer YOLO variants remain attractive for medical image analysis because they preserve deployment-oriented efficiency while offering stronger performance under complex visual conditions. However, these advances have mostly been validated in non-WCE tasks, whereas capsule endoscopy still poses distinctive challenges including tiny lesions, weak boundaries, and highly confusing mucosal backgrounds.
In parallel, Transformer-based and hybrid detectors have attracted increasing attention because of their stronger global context modeling and cross-region interaction, and therefore provide an important complementary comparison axis to YOLO-based methods in medical image analysis [
8,
9]. For WCE lesion detection, a meaningful evaluation should thus consider not only improvements within the YOLO family, but also broader architectural comparison under a unified protocol.
2.3. Recent Authoritative YOLO-Series and Clinically Relevant Detection Models
Recent detector research has also emphasized module-level innovation, including cross-scale fusion, receptive-field-aware convolution, scale-dynamic optimization, and weighted local enhancement. These developments show that detector performance can be improved when architecture and optimization are carefully tailored to the target task. Representative recent YOLO-series and clinically relevant detection models are summarized in
Table 1. However, from the perspective of WCE lesion detection, several important limitations remain.
In addition to the mainstream YOLO lineage, recent studies have increasingly emphasized task-oriented detector redesign in clinically relevant settings. Some methods improve performance through better training strategies, lightweight deployment, backbone–neck–loss co-design, or ensemble inference, while others focus on stronger feature fusion, localization refinement, or more adaptive optimization. These developments show that recent detectors can achieve strong performance when their architecture and training strategy are carefully aligned with the target task.
For WCE lesion detection, these findings imply that detector improvement should not rely only on generic backbone replacement or isolated architectural novelty. Instead, clinically useful performance requires coordinated handling of fine-grained lesion representation, multi-scale interaction, background suppression, and prediction sensitivity. This perspective is particularly relevant for capsule endoscopy, where lesion appearance is often subtle and highly variable, and where both missed detections and false alarms can directly affect practical usability.
2.4. Design Inspirations from Related Modules
Recent module-level studies provide additional methodological support for WCE-oriented detector redesign. For selective multi-scale fusion, Hu et al. proposed CFM in DSFNet to improve the interaction between high-level semantic features and low-level detail features [
30]. Similarly, MLP-Net introduced the Contextual Selection Fusion Module (CSFM) to progressively aggregate shallow spatial details and deep semantic information from coarse to fine scales [
29]. These ideas are directly relevant to WCE lesion detection, where subtle texture cues and lesion semantics must be integrated without introducing excessive background interference. Motivated by these observations, our framework adopts CSFM together with an additional interaction-aware fusion strategy to strengthen cross-layer feature integration.
For receptive-field-aware local modeling, Zhang et al. proposed RFAConv, showing that position-sensitive weighting within the receptive field can improve discriminative local representation with limited computational overhead [
31]. This is particularly relevant to WCE imagery, where many lesions occupy only part of the receptive field and can be diluted by uniform convolution. Accordingly, we introduce RFAHeadDetect to strengthen localization sensitivity for irregular lesion regions.
For scale-aware optimization, Yang et al. proposed Scale-based Dynamic Loss (SD Loss) for infrared small-target detection, showing that dynamic reweighting of loss terms according to target scale can improve sensitivity to dim and tiny targets [
32]. Since very small intestinal lesions are also vulnerable to being overwhelmed by the gradients of larger and easier targets, this strategy is well suited to WCE lesion detection. In addition, Xu et al. proposed a lightweight improved YOLOv12 model and incorporated weighted convolution to enhance local feature extraction under low-contrast conditions [
33]. Although the application scenario differs from WCE, this design provides useful methodological inspiration for our WConv module. Taken together, these studies suggest that effective detection of subtle targets depends on coordinated design of cross-scale fusion, receptive-field-aware local weighting, scale-sensitive optimization, and adaptive local feature enhancement.
3. Input Dataset
The experiments in this study are conducted on the SEE-AI dataset, an open-access small-bowel capsule endoscopy (SBCE) resource developed for artificial-intelligence-assisted lesion analysis. According to the original dataset publication, SEE-AI was collected using the PillCamTM SB3 system at Kyushu University Hospital and contains image data from 523 SBCE examinations performed between September 2014 and June 2021. In total, the dataset includes 18,481 images, among which 12,320 images contain annotated lesions corresponding to 23,033 lesion instances, while the remaining 6161 images are normal samples. These properties make SEE-AI a clinically relevant benchmark for developing and evaluating automated WCE lesion detection systems.
SEE-AI covers 12 lesion categories, namely angiodysplasia, erosion, stenosis, lymphangiectasia, lymph follicle, SMT, polyp-like lesions, bleeding, diverticulum, erythema, foreign body, and vein, and all lesion regions are annotated with bounding boxes in YOLO format. Compared with binary or coarse-grained medical image datasets, this multi-category design is more suitable for studying fine-grained lesion discrimination under realistic endoscopic conditions. Recent WCE studies have likewise emphasized that lesion recognition in capsule endoscopy is not a simple binary classification problem, but a multi-class fine-grained recognition task, because lesion regions often occupy only a small portion of the image and exhibit high inter-class similarity together with strong intra-class variation.
Representative SEE-AI samples, as shown in
Figure 1, reveal substantial variability in lesion size, morphology, color, boundary clarity, and background complexity. In many images, lesion regions are small and off-center, making them vulnerable to feature loss during downsampling. In addition, WCE frames are frequently affected by non-uniform illumination, specular reflection, intestinal folds, bubbles, fluids, and residual contents, all of which may obscure lesion details or introduce lesion-like interference. Similar difficulties have been repeatedly highlighted in recent WCE studies, where variable image conditions, subtle abnormalities, and weak local contrasts were identified as major obstacles to robust automated analysis [
34,
35].
In addition to visual complexity, the dataset also presents a clear class imbalance, as shown in
Figure 2. The histogram indicates that categories such as lymph follicle and erosion contain substantially more instances than rare categories such as diverticulum, resulting in a long-tailed distribution. This imbalance increases the difficulty of model training in two ways. On the one hand, majority classes tend to dominate gradient updates during optimization, making the detector more biased toward frequent lesion types. On the other hand, minority classes are more likely to suffer from insufficient representation learning and unstable decision boundaries. Consequently, the SEE-AI dataset introduces not only a visual challenge caused by small, weak, and irregular lesions, but also an optimization challenge caused by skewed class distribution. These characteristics place higher demands on local feature enhancement, cross-scale fusion, and scale-aware optimization.
Overall, SEE-AI is a clinically valuable yet highly challenging benchmark for WCE lesion detection. Its public availability, multi-category annotations, and inclusion of both lesion and normal images make it an important dataset for intelligent diagnosis research. At the same time, its inherent characteristics—small lesion regions, weak boundaries, strong background interference, class imbalance, and temporal redundancy among adjacent frames from the same examination—also reveal the limitations of directly applying generic object detectors to WCE imagery. Because SEE-AI images originate from long SBCE examinations, neighboring frames may be highly correlated. Therefore, to reduce the risk of temporal leakage and to obtain a more rigorous estimate of model generalization, dataset partitioning was performed at the examination level rather than at the individual image level, as detailed in
Section 4.6. These observations motivate the development of a task-oriented detection framework tailored to the characteristics of capsule endoscopy images. Therefore, in the next section, an improved YOLOv12-based lesion detection framework is presented to address the above challenges.
4. Proposed Model
To address the challenges of small intestinal lesion detection in wireless capsule endoscopy (WCE) images, this study proposes YOLOv12-WCIRS, an improved YOLOv12-based framework. As discussed above, WCE images are characterized by small lesions, blurred boundaries, weak texture contrast, strong mucosal background interference, and long-tailed class distribution, all of which increase detection difficulty. Although YOLOv12 provides an efficient attention-centric real-time detection baseline, its original design is intended for general object detection rather than fine-grained lesion analysis. Directly applying it to WCE images may therefore result in insufficient local sensitivity, limited cross-scale interaction, inadequate background suppression, and suboptimal learning of small lesions. To address these limitations, YOLOv12-WCIRS reconstructs the YOLOv12 detection pipeline in a task-oriented manner, as shown in
Figure 3.
The proposed framework introduces four coordinated improvements along the detection chain. WConv enhances lesion-aware local representation in the backbone. CSFM and IIA_Fusion strengthen selective multi-scale fusion and suppress background interference in the neck. RFAHeadDetect improves sensitivity to location-specific cues in the prediction stage, and SD Loss further optimizes learning for lesions of different scales. Therefore, YOLOv12-WCIRS is designed as a progressive WCE-oriented detector rather than a loose combination of independent modules.
Formally, given an input WCE image
, the detection process of YOLOv12-WCIRS can be expressed as:
where
denotes local enhancement in the backbone,
and
denote selective fusion and attention-guided refinement in the neck, and
denotes the receptive-field-aware detection head. During training, the prediction is further optimized by SD Loss. Equation (1) shows that the proposed model is organized as a complete and continuous detection process rather than as several isolated plug-ins.
4.1. Stage 1: Backbone Feature Extraction and Local Enhancement
The first stage of YOLOv12-WCIRS focuses on the backbone. In the original YOLOv12 pipeline, hierarchical feature extraction gradually converts the input image into more abstract representations. However, this process is not fully sufficient for WCE images, because lesion regions often occupy only a small part of the field of view and are frequently characterized by weak local texture variation, slight color abnormality, or subtle edge distortion. Under such conditions, conventional convolution may treat lesion-relevant and background pixels too uniformly, causing discriminative lesion cues to be weakened at an early stage. Motivated by weighted convolution studies, YOLOv12-WCIRS introduces WConv into the backbone, as illustrated in
Figure 4, to strengthen local feature extraction before deeper abstraction occurs.
Let
denote the input feature map. The output of standard convolution at location
is:
where
denotes the convolution kernel weights. Equation (2) assumes that all spatial positions inside the receptive field are processed with the same kernel weights. For WCE lesion detection, this assumption is suboptimal because subtle lesion pixels may be surrounded by dominant mucosal background structures.
To address this limitation, WConv reformulates the convolution as a weighted local aggregation process:
where
is the adaptive importance coefficient assigned to the
-th position in the receptive field. The weight map is generated from the input feature context as
where
denotes a nonlinear activation. Through Equations (3) and (4), lesion-relevant local regions receive larger responses, while irrelevant background pixels are comparatively suppressed. Therefore, the Stage 1 output can be written as
Although Stage 1 improves lesion-aware local representation, it still operates mainly at the feature extraction level. It cannot fully solve the mismatch between shallow detailed cues and deep semantic information across scales. This motivates the second stage of the proposed model.
4.2. Stage 2: Neck-Based Cross-Scale Fusion and Attention Refinement
The second stage of YOLOv12-WCIRS focuses on the neck, where multi-scale feature interaction is performed. In YOLOv12, the neck is designed to aggregate features of different resolutions so that the detector can jointly exploit shallow spatial detail and deep semantic abstraction. However, in WCE lesion detection, simple multi-scale fusion is often insufficient. Shallow features preserve lesion boundaries and fine textures, whereas deep features contain stronger contextual semantics. If they are fused indiscriminately, shallow lesion cues may be diluted and background interference may be amplified. To address this problem, Stage 2 is designed as a two-step process: selective cross-scale fusion followed by attention-guided refinement, as shown in
Figure 5 and
Figure 6. This stage is implemented by CSFM and IIA_Fusion [
36].
4.2.1. Contextual Selection Fusion Module (CSFM)
CSFM is introduced to adaptively integrate shallow and deep features instead of directly concatenating them. According to the underlying CSFM idea, low-level details and high-level semantics should be fused from coarse to fine through adaptive channel and spatial selection. Let
denote the current-level feature and
denote the higher-level feature. After upsampling the higher-level feature, the channel selection factor is computed as:
where
,
, and
denote point-wise convolution, average pooling, and upsampling, respectively. The channel-refined feature is then obtained as:
which allows the network to preserve more useful channel-wise responses.
To further model spatial importance, the spatial selection factor is defined as
and the final selective fusion output is:
Equations (6)–(9) indicate that CSFM performs adaptive cross-layer fusion rather than uniform aggregation. This is particularly important for WCE lesion detection, where multi-scale lesion cues are weak and easily submerged by irrelevant structures. The visual design in
Figure 5 is consistent with this principle, showing that different feature levels are first mined and reweighted before being integrated into a unified fused representation.
4.2.2. Information Integration Attention Fusion (IIA_Fusion)
Although CSFM enhances cross-scale interaction, the fused features may still contain substantial background responses caused by folds, fluids, bubbles, and specular reflections. To further refine the fused features, YOLOv12-WCIRS introduces IIA_Fusion, as shown in
Figure 6. This module jointly models channel attention, spatial attention, and cross-feature interaction attention, and then uses these weights to modulate the input features before fusion refinement. Such a design is consistent with recent attention integration strategies that reconstruct spatial dependencies and improve the localization of task-relevant regions.
Let the three input features to the module be
,
, and
. They are first concatenated into:
from which three types of attention maps are generated: channel attention
, spatial attention
, and cross-feature interaction attention
. The three features are then reweighted as:
where
denotes element-wise or broadcast multiplication according to the dimension of the attention map. The refined features are concatenated again:
and then passed through the fusion refinement branch:
Equation (13) follows the structure shown in
Figure 6: compression by
convolution, normalization, nonlinear activation,
convolution, and residual refinement. In essence, IIA_Fusion not only merges the inputs, but also explicitly emphasizes lesion-related responses while suppressing redundant activations. Therefore, the Stage 2 output can be summarized as:
At this point, the detector obtains multi-scale feature maps that are more discriminative, more lesion-aware, and less sensitive to complex background interference.
The synergy lies in the fact that while WConv preserves fine-grained lesion details in the early feature extraction stage, IIA_Fusion helps prevent these weak yet clinically relevant responses from being overwhelmed by complex mucosal backgrounds during multi-scale fusion, thereby forming a more robust lesion-oriented feature flow for SBCE images.
4.3. Stage 3: Receptive-Field-Aware Prediction and Scale-Aware Optimization
After local enhancement and cross-scale refinement, the final stage of YOLOv12-WCIRS aims to improve prediction and optimization. Even after Stage 2, lesion detection remains difficult because many lesions exhibit weak boundaries and irregular shapes, which makes standard head prediction unstable. In addition, lesions of different scales contribute unequally during training, so small lesions are more easily overwhelmed by large and easy targets. Therefore, Stage 3 couples RFAHeadDetect and SD Loss, as illustrated in
Figure 7, to improve both prediction quality and optimization balance.
4.3.1. RFAHeadDetect
RFAHeadDetect is designed to enhance the sensitivity of the prediction head to location-specific information within the receptive field. Existing receptive-field attention studies have shown that standard convolution applies the same parameters across different spatial positions, which limits its ability to capture local positional differences. For lesion detection in WCE images, this limitation is particularly problematic because the discriminative regions are often weak, incomplete, or irregularly shaped. Therefore, the prediction head is reformulated as a multi-branch receptive-field aggregation process:
where
is the set of receptive-field branches,
denotes the transformation under the
-th branch, and
is the adaptive branch weight. The branch weights are generated as:
where
denotes the branch weighting function. The architecture shown in
Figure 7 further illustrates this idea: the head first enhances receptive-field features, then performs adaptive feature fusion and weighting, and finally outputs classification, boundary regression, and center/objectness predictions. In this way, RFAHeadDetect improves the sensitivity of the detector to local lesion cues inside the receptive field instead of treating all local positions equally.
4.3.2. Scale Dynamic Loss (SD Loss)
Improving the head alone is not sufficient, because lesion-scale imbalance still affects training. Small lesions are inherently harder to localize and are more sensitive to bounding-box fluctuations, yet conventional unified optimization tends to bias learning toward larger targets. To solve this problem, YOLOv12-WCIRS adopts Scale Dynamic Loss, whose main idea is to dynamically adjust the influence of each target according to its size. Recent SD-loss studies show that such scale-aware weighting can improve the regression performance of small and difficult targets by modifying the contribution of scale-related and location-related terms during training.
The scale-aware regression loss is defined as:
where
denotes the regression loss for the
-th target and
is the dynamic scale coefficient. To enhance the contribution of small lesions, the coefficient is defined as
where
is the target scale and
is a small constant for numerical stability. According to Equation (18), smaller lesions receive larger optimization weights and thus contribute more strongly to gradient updates. The final training objective is:
where
and
denote the classification and objectness losses, respectively. Therefore, Stage 3 completes the transition from refined feature representation to lesion-aware prediction and scale-aware optimization.
4.4. Integrated Discussion
The proposed YOLOv12-WCIRS is designed as a task-oriented enhancement of the original YOLOv12 pipeline rather than a loose combination of independent plug-in modules. Its overall logic follows the major bottlenecks of WCE lesion detection. WConv is introduced in the backbone to strengthen fine-grained local representation for small, weakly contrasted lesions that are easily submerged by surrounding mucosal textures. CSFM and IIA_Fusion are employed in the neck to improve the interaction between shallow detailed cues and deep semantic information while suppressing background interference caused by folds, bubbles, fluids, and specular reflections. RFAHeadDetect is used in the prediction head, while SD Loss is introduced in the optimization stage to enhance location-sensitive modeling and reduce optimization bias toward larger and easier targets. Therefore, the proposed framework should be understood as a coordinated WCE-oriented redesign of feature extraction, feature fusion, prediction, and optimization, aiming to improve lesion sensitivity and localization robustness under the combined challenges of small lesion size, blurred boundaries, complex background responses, and scale imbalance in capsule endoscopy images. More specifically, different modules were introduced to address different WCE-specific challenges: WConv improves sensitivity to tiny lesions through receptive-field reweighting, CSFM enhances the integration of weak low-contrast cues with higher-level semantics, and IIA_Fusion suppresses background interference caused by bubbles, residue, folds, and specular reflections.
4.5. Evaluation Metrics
To comprehensively evaluate the effectiveness of the proposed detector, performance is reported using standard COCO-style object detection metrics, including mean Average Precision (mAP) and mAP at IoU threshold 0.5 (
mAP@50). In addition, the number of trainable parameters (Params), GFLOPs, and inference speed (FPS) are reported to assess the computational efficiency and deployment potential of the proposed method [
37].
For a given confidence threshold
, let
,
, and
denote the numbers of true positives, false positives, and false negatives, respectively. The corresponding precision and recall are defined as:
By varying the confidence threshold , a precision–recall curve can be obtained, and the area under this curve gives the Average Precision (AP) at a specific IoU threshold.
Following the COCO evaluation protocol, the overall detection performance is summarized by mean Average Precision (mAP), defined as:
which averages the AP values over IoU thresholds from 0.50 to 0.95 with a step of 0.05. To further evaluate detection quality under a looser matching criterion, we additionally report
Besides accuracy-related metrics, model efficiency is also considered. Let
denote the set of all trainable parameters in the network. The total number of trainable parameters is defined as:
The computational complexity is measured using
, which are defined as
In addition, inference speed is measured in frames per second (FPS), which reflects the real-time capability of the detector during deployment. Together, these metrics jointly characterize the detection accuracy, localization robustness, and computational efficiency of the proposed YOLOv12-WCIRS framework.
In addition to detection metrics, clinical utility on normal WCE frames was also evaluated. Specifically, for frames without any annotated lesion, a frame was considered falsely alarmed if the detector produced at least one lesion prediction after post-processing. Based on this definition, normal-frame specificity and false positive rate were computed as:
where
denotes the number of normal frames with no predicted lesion and
denotes the number of normal frames with at least one predicted lesion. To provide a more intuitive measure for large-scale WCE screening, we also report the number of false alarms per 10,000 normal frames, defined as:
where
is the total number of normal frames in the evaluated subset.
4.6. Implementation Details
All comparative methods in
Table 2 were reimplemented/retrained on the SEE-AI split under the same preprocessing and optimization settings; no results were copied directly from the original papers.
All experiments were implemented in Python using PyTorch [
38] 2.5.1 within the Ultralytics 8.3.174 framework on a workstation equipped with an NVIDIA RTX 4070 GPU and CUDA 13.1. The proposed model and all comparative methods, including YOLO-based, Transformer-based, and hybrid detectors, were trained and evaluated under a unified protocol with the same data preprocessing, augmentation strategy, dataset split, and evaluation criteria.
To avoid data leakage caused by temporal continuity in WCE frames, the SEE-AI dataset was partitioned at the examination level rather than at the image level. The 523 SBCE examinations were divided into training, validation, and test sets at a ratio of 70%:15%:15%, corresponding to 366, 78, and 79 examinations, respectively. The split was stratified as much as possible to preserve the proportions of lesion and normal samples as well as lesion-category distribution across subsets. A fixed random seed (seed = 42) was used only for generating the examination-level data split, and this split was kept unchanged for all subsequent experiments. All methods were trained and evaluated on exactly the same split.
During training, all input images were resized to 640 × 640. The main hyperparameters were set as follows: epochs = 500, batch size = 8, initial learning rate = 0.01, weight decay = 0.0005, and momentum = 0.937. Automatic mixed precision (AMP) was enabled. All models were initialized with COCO-pretrained weights using the same initialization protocol to ensure fairness.
Data augmentation was performed with Albumentations [
39], including Mosaic (1.0), random scaling (scale = 0.5), and Copy-Paste (0.1), while MixUp was disabled (0.0). Inference was conducted at 640 × 640 with confidence threshold = 0.25 and IoU threshold for non-maximum suppression = 0.70. All FPS values were measured on the same RTX 4070 platform under identical inference settings.
For external validation, the best checkpoint trained on SEE-AI was directly applied to Kvasir-Capsule without additional fine-tuning. Because the category systems of SEE-AI and Kvasir-Capsule are not fully identical, the external benchmark was conducted on overlapping lesion categories only.
4.7. Statistical Analysis
To evaluate whether the performance improvement of the proposed model was statistically reliable, statistical analysis was conducted based on repeated training runs rather than ambiguous image-level paired observations. Specifically, the direct baseline YOLOv12 and the proposed YOLOv12-WCIRS were each trained and evaluated five times on the same fixed examination-level split generated in
Section 4.6, while using different training random seeds for weight initialization, data-order shuffling, and stochastic optimization. For each run, the
mAP@50 and
mAP@50–95 values on the test set were recorded.
These repeated-run performance values were treated as paired observations because the two models were evaluated under the same data split and matched random-seed setting. Results are reported as mean ± standard deviation. A paired two-sided
t-test was used to compare the run-level performance of YOLOv12 and YOLOv12-WCIRS, with the significance level set to α = 0.05. The paired t-statistic is defined as:
where
denotes the mean of the paired performance differences,
denotes the standard deviation of the differences, and n denotes the number of paired runs. This formulation evaluates whether the observed improvement reflects a stable and systematic gain across repeated experiments rather than random variation. The detailed statistical results are reported in
Section 5.6.
5. Results
To comprehensively evaluate the effectiveness of the proposed YOLOv12-WCIRS framework for WCE lesion detection, this section presents a detailed performance analysis from six perspectives: comparative benchmarking, cross-dataset external validation and normal-frame analysis, error analysis with qualitative results, controlled ablation study, per-class performance comparison, and statistical significance evaluation.
5.1. Comparative Experiments
To comprehensively evaluate the proposed method, YOLOv12-WCIRS was compared with representative YOLO-based detectors as well as recent Transformer-based and hybrid detectors under the same experimental protocol. The results are summarized in
Table 2.
YOLOv12-WCIRS achieved the best overall performance, reaching 83.4% mAP@50 and 61.1% mAP@50–95. Compared with its direct baseline YOLOv12, the proposed model improved mAP@50 from 76.9% to 83.4%, corresponding to a gain of 6.5 percentage points. More importantly, this gain was not obtained by increasing model complexity. In contrast, YOLOv12-WCIRS reduced GFLOPs from 120.8 G to 102.6 G and reduced the number of parameters from 34.8 M to 25.6 M, while also increasing FPS from 96.4 to 220.8. These results indicate that the proposed framework improves both detection performance and deployment efficiency rather than relying on heavier architecture.
Beyond the YOLO family, two broader baselines were further included: RT-DETRv2 as a representative real-time Transformer/hybrid detector and Deformable DETR as a representative classical Transformer detector. RT-DETRv2 achieved 75.3% mAP@50 and 48.1% mAP@50–95, while Deformable DETR achieved 76.5% and 49.9%, respectively. Both remained below YOLOv12-WCIRS in accuracy, and both also exhibited higher computational cost and lower inference speed under the same hardware setting. This result suggests that the proposed WCE-oriented redesign remains competitive not only within the YOLO family, but also under broader architectural comparison.
Overall, the comparison results support three conclusions. First, YOLOv12-WCIRS provides a clear and stable performance advantage on the SEE-AI benchmark. Second, the gain over YOLOv12 is not attributable to increased architectural complexity. Third, the proposed model remains favorable when compared with representative Transformer-based and hybrid detectors, indicating that WCE-specific redesign is more important than simply adopting a more recent detector category.
5.2. Cross-Dataset External Validation and Normal-Frame False-Alarm Analysis
To further assess generalization beyond the SEE-AI benchmark, cross-dataset external validation was conducted on overlapping lesion categories between SEE-AI and Kvasir-Capsule. As shown in
Table 3, YOLOv12-WCIRS achieved a mean AP@50 of 84.4%, with mean precision and recall of 88.6% and 85.8%, respectively, indicating that the proposed detector preserves competitive lesion-recognition ability under cross-dataset distribution shift.
In addition to lesion recognition, normal-frame performance was evaluated to better reflect clinical applicability. On the SEE-AI test set, YOLOv12-WCIRS improved specificity on normal frames from 93.24% to 95.47% and reduced false alarms per 10,000 normal frames from 676.10 to 453.40 (
Table 4). On the Kvasir-Capsule normal clean mucosa subset, the proposed model further improved specificity from 87.15% to 91.67% and reduced false alarms from 1285.0 to 833.0 per 10,000 normal frames (
Table 5).
These results indicate that YOLOv12-WCIRS not only improves lesion detection performance, but also reduces non-lesion false alarms in both in-domain and external settings. This is particularly meaningful for WCE-assisted reading, where a large proportion of frames are normal and excessive false alarms may directly increase clinical review burden.
The remaining performance gap under cross-dataset evaluation is likely related to domain shift introduced by differences in capsule devices, illumination characteristics, mucosal color representation, and annotation criteria across datasets, which suggests a promising direction for future domain adaptation research.
5.3. Error Analysis and Qualitative Results
To better understand the behavior of the proposed detector beyond overall mAP, false-negative and false-positive cases were further analyzed. The false-negative breakdown is summarized in
Table 6. Compared with YOLOv12, YOLOv12-WCIRS reduced the total number of false-negative boxes from 88 to 60. The largest reductions were observed in tiny lesions, low-contrast lesions, and ambiguous-boundary lesions, indicating improved sensitivity to subtle and difficult targets. Missed detections remained in rare categories and other challenging cases, suggesting that data scarcity and strong visual ambiguity still limit performance in the hardest scenarios.
The false-positive breakdown is summarized in
Table 7. YOLOv12-WCIRS reduced the total number of false-positive boxes from 96 to 70. In particular, false alarms caused by mucosal folds, vascular-like structures, bubbles, residue, and reflections were reduced, indicating stronger robustness to lesion-like background interference. These results are consistent with the intended role of the proposed fusion and attention-guided refinement design, which aims to preserve lesion-sensitive cues while suppressing irrelevant responses.
Representative qualitative comparisons shown in
Figure 8 further support these quantitative findings. In normal clean mucosa images, the baseline is more likely to produce false alarms on non-lesion regions, whereas YOLOv12-WCIRS suppresses such responses more effectively. In lesion cases such as angiectasia and lymphangiectasia, the proposed model yields more accurate localization and more reliable category prediction, showing improved robustness under weak contrast and visually confusing backgrounds.
Grad-CAM visualizations shown in
Figure 9 provide additional interpretability evidence. Compared with YOLOv12, YOLOv12-WCIRS exhibits more concentrated lesion-oriented attention, while reducing scattered activation on surrounding non-lesion regions. This suggests that the proposed framework improves not only final detection performance, but also the internal feature attention pattern, making the detector more focused on clinically meaningful regions. Overall, the error breakdown and qualitative analyses consistently indicate that YOLOv12-WCIRS improves lesion sensitivity, background suppression, and localization robustness in challenging WCE scenarios.
5.4. Ablation Study
To evaluate the contribution of each proposed component and to determine whether the observed performance gain was derived from coordinated design rather than uncontrolled architectural accumulation, ablation experiments were conducted on the SEE-AI dataset using YOLOv12 as the direct baseline. All ablation variants were trained and evaluated under the same experimental protocol, with identical data split, preprocessing, augmentation strategy, optimization settings, and inference thresholds; only the module configuration was changed. The results are summarized in
Table 8.
The baseline YOLOv12 achieved 76.9% mAP@50. After introducing the modules individually, the performance increased to 78.0% with WConv, 78.8% with CSFM, 80.1% with IIA_Fusion, 80.5% with RFAHeadDetect, and 80.8% with SD Loss, corresponding to gains of +1.1, +1.9, +3.2, +3.6, and +3.9 percentage points, respectively. These results indicate that all proposed components contribute positively under controlled conditions and that the performance improvement cannot be attributed to a single isolated modification alone.
Among the single-module variants, the largest gains were obtained by SD Loss, followed by RFAHeadDetect and IIA_Fusion. This pattern suggests that the main difficulties of WCE lesion detection are not limited to local feature extraction, but also involve lesion-aware prediction and scale-imbalanced optimization. In other words, even when useful lesion features are preserved, detection performance may remain suboptimal if the prediction stage is insufficiently sensitive to subtle lesion cues or if the optimization objective does not adequately emphasize small and difficult targets.
The combination experiments further demonstrate the complementary nature of the proposed components. YOLOv12-CIRS achieved 81.4%, YOLOv12-WIRS reached 81.8%, YOLOv12-WCRS achieved 82.3%, and YOLOv12-WCIS achieved 82.7% mAP@50. When all modules except SD Loss were used, YOLOv12-WCIR further increased the performance to 83.0%, and the final YOLOv12-WCIRS achieved 83.4%, corresponding to a total improvement of 6.5 percentage points over the direct baseline YOLOv12. This progressive trend indicates that the proposed modules do not function as a random accumulation of design choices; instead, they provide cumulative and complementary benefits. Specifically, WConv enhances local lesion cues, CSFM improves selective cross-scale interaction, IIA_Fusion suppresses background interference, RFAHeadDetect strengthens localization sensitivity, and SD Loss improves scale-aware training. Their joint use therefore yields a more stable and coordinated improvement than any single module alone.
5.5. Per-Class Comparison on the SEE-AI Dataset
Since the proposed model achieved strong overall performance, a category-level comparison was further conducted on the 12 lesion classes of the SEE-AI dataset using YOLOv12 as the direct baseline. The results are presented in
Table 9. At the overall level,
mAP@50 increased from 76.9% for YOLOv12 to 83.4% for YOLOv12-WCIRS, corresponding to an improvement of 6.5 percentage points. This result indicates that the proposed framework provides a clear overall advantage for multi-class WCE lesion detection.
More importantly, YOLOv12-WCIRS improved the detection performance across all 12 lesion categories. The largest gains were observed for vein (+13.5 percentage points, 76.4% → 89.9%), stenosis (+10.9, 77.8% → 88.7%), polyp-like lesions (+7.7, 78.5% → 86.2%), bleeding (+7.1, 77.0% → 84.1%), foreign body (+6.9, 75.0% → 81.9%), diverticulum (+6.6, 79.2% → 85.8%), erythema (+6.3, 77.7% → 84.0%), SMT (+4.1, 78.9% → 83.0%), and lymphangiectasia (+3.4, 77.1% → 80.5%). Improvements were also observed for angiodysplasia, erosion, and lymph follicle. These results suggest that the proposed framework is broadly effective across lesion categories, especially for visually challenging targets involving small lesion size, irregular morphology, weak boundaries, or strong background interference.
To further analyze the detection behavior, the precision–recall (PR) curves of YOLOv12 and YOLOv12-WCIRS are shown in
Figure 10. The PR curve of the proposed model is generally higher than that of the baseline, particularly in the medium- to high-recall region, where comparatively high precision is still maintained. This indicates that the proposed method reduces missed detections while effectively controlling false positives. Overall, the category-wise and PR-curve analyses jointly support the robustness of the proposed design and further confirm its advantage across diverse lesion categories in the SEE-AI dataset.
5.6. Statistical Significance Analysis
To evaluate the stability of the observed performance gain, repeated experiments were conducted for YOLOv12 and YOLOv12-WCIRS using the same dataset split and training configuration. The results are summarized in
Table 9 and further illustrated in
Figure 11 and
Figure 12. Across repeated runs, YOLOv12-WCIRS consistently achieved higher
mAP@50 and
mAP@50–95 than the direct baseline YOLOv12, with a smaller performance fluctuation range.
A paired t-test was further performed on the repeated-run results. For mAP@50, the proposed model showed a statistically significant improvement over YOLOv12 (); the same trend was observed for mAP@50–95. These results indicate that the performance gain of YOLOv12-WCIRS is not caused by random training fluctuation, but reflects a stable advantage under the current experimental setting.
Taken together, the repeated-run statistics support the reliability of the proposed design. Combined with the comparative experiments, controlled ablation study, external validation, and error analysis, these results provide stronger evidence that the performance improvement of YOLOv12-WCIRS is reproducible and statistically meaningful rather than incidental.
6. Discussion
The results of this study indicate that the performance gain of YOLOv12-WCIRS is not limited to a single metric, but reflects a more consistent improvement across overall accuracy, category-wise detection, error reduction, and external validation. Compared with YOLOv12 and other representative YOLO-based, Transformer-based, and hybrid detectors, the proposed model achieved stronger detection performance while maintaining competitive efficiency. Combined with the controlled ablation study, these results suggest that the gain is derived from coordinated WCE-oriented redesign rather than from random module stacking or uncontrolled architectural expansion.
From the perspective of detection behavior, the error analysis provides a more detailed explanation of why the model is effective. YOLOv12-WCIRS reduced false negatives for tiny lesions, low-contrast lesions, and ambiguous-boundary lesions, indicating improved sensitivity to subtle abnormalities. It also reduced false positives caused by mucosal folds, vascular-like textures, bubbles, residue, and reflections, indicating stronger robustness to lesion-like background interference. These findings are consistent with the intended functions of WConv, CSFM, IIA_Fusion, RFAHeadDetect, and SD Loss, which respectively enhance local lesion representation, selective cross-scale interaction, background suppression, localization sensitivity, and scale-aware optimization.
The external validation results further strengthen the practical relevance of this study. Although the cross-dataset benchmark was conducted only on overlapping categories between SEE-AI and Kvasir-Capsule, due to differences in category definitions, the proposed model still maintained favorable lesion-recognition performance under distribution shift. In addition, the reduction in normal-frame false alarms is clinically meaningful because WCE examinations contain a large proportion of non-lesion frames, and excessive false alarms may directly increase review burden during assisted reading.
Several limitations should also be noted. First, the external validation was not a strict full-class one-to-one benchmark. Second, the current framework remains a frame-level detector and does not explicitly model temporal continuity across WCE videos. Third, some rare and visually ambiguous lesions remain difficult. Future work will therefore focus on broader multi-dataset validation, stronger rare-class learning, and temporally aware capsule endoscopy analysis.
In particular, the error analysis indicates that tiny lesions still remain a major source of false negatives. Future work will therefore explore super-resolution preprocessing and temporally consistent modeling to further enhance the recognition of subtle lesion cues.
7. Conclusions
This study proposed YOLOv12-WCIRS, a WCE-oriented improvement of YOLOv12 for small intestinal lesion detection in capsule endoscopy images. By jointly enhancing local feature extraction, selective multi-scale fusion, prediction sensitivity, and scale-aware optimization, the proposed framework achieved superior performance on the SEE-AI dataset.
Compared with YOLOv12, YOLOv12-WCIRS improved mAP@50 from 76.9% to 83.4% and mAP@50–95 from 50.6% to 61.1%, while also showing stronger robustness in category-wise evaluation, external validation, normal-frame false-alarm analysis, and error breakdown. These results indicate that coordinated detector redesign can improve both detection accuracy and practical usability in WCE lesion analysis.
Overall, YOLOv12-WCIRS provides an effective and deployment-oriented solution for WCE lesion detection. Although broader external validation and temporal modeling remain to be explored, the present study offers useful evidence that task-oriented detector redesign is a promising direction for computer-aided capsule endoscopy.