A method for endoscopic image lesion detection
By improving the YOLO-RSP model, the problem of low accuracy in lesion identification in the early diagnosis of bladder cancer was solved, and the model's detection capability and computational efficiency in complex environments were improved, especially the identification effect of small, low-contrast lesions.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- NORTHEASTERN UNIV CHINA
- Filing Date
- 2025-07-30
- Publication Date
- 2026-04-17
AI Technical Summary
Existing technologies for the early diagnosis of bladder cancer suffer from problems such as low accuracy in lesion identification and easy misdiagnosis or missed diagnosis. In particular, the model's generalization ability is insufficient in complex environments, and the computational efficiency bottleneck is obvious, making it difficult to effectively detect small, low-contrast lesions.
An improved YOLO-RSP model is adopted, and the YOLOv10 network structure is optimized by designing the RSD-OSA module and the PSCoordATT module. Combined with the NWD loss function, the small target detection capability and localization stability are improved.
It improves the accuracy and efficiency of bladder cancer lesion detection, enhances robustness in complex environments, reduces background noise interference, and improves the detection capability of small lesions.
Smart Images

Figure CN120931602B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the technical field of automatic lesion detection, and more specifically, to a method for detecting lesions using endoscopic images. Background Technology
[0002] Bladder cancer, a common malignant tumor of the urinary system with a high incidence and recurrence rate, often presents with subtle early symptoms, making accurate early diagnosis a significant challenge. Endoscopic examinations (such as white light endoscopy / WLE, narrow-band imaging / NBI, and fluorescence endoscopy) are the gold standard for clinical diagnosis; however, in practice, they are limited by subjective factors such as the complex intrabladder environment (e.g., blood, air bubbles, reflections), variations in lesion morphology and size (especially low-contrast flat lesions), and physician experience, resulting in low accuracy and a high risk of misdiagnosis or missed diagnosis.
[0003] In recent years, deep learning technology has demonstrated strong potential in the field of medical image analysis. Cystoscopy image analysis based on object detection models (such as improved Mask R-CNN, YOLOv3, and models combined with Transformer) has been shown to significantly improve the sensitivity and specificity of lesion (especially small lesions) identification, providing strong support for improving diagnostic efficiency and accuracy, assisting medical decision-making, and promoting resource balance. However, the practical application and promotion of this technology still faces severe challenges: First, the scarcity and lack of diversity of publicly available high-quality cystoscopy image datasets limit the model's generalization ability and result in significant domain shift issues; second, actual examination images are often affected by blood, air bubbles, reflections, and blurring, severely impacting lesion visibility and model detection accuracy; third, bladder cancer lesions (especially flat lesions) themselves are morphologically variable, have blurred boundaries, and low color contrast, posing a challenge to the model's recognition ability; fourth, existing high-performance models may face computational efficiency bottlenecks in clinical deployment, and their generalization ability in complex and variable real-world scenarios still needs further verification and improvement.
[0004] Therefore, overcoming data scarcity, improving robustness under complex image quality, enhancing the detection capability for diverse lesions (especially small, low-contrast lesions), and optimizing model efficiency to facilitate clinical deployment are key issues that current automated endoscopic image detection technology for bladder cancer urgently needs to address. Summary of the Invention
[0005] The present invention aims to solve at least one of the technical problems existing in the prior art or related art.
[0006] Therefore, the purpose of this invention is to provide a method for detecting lesions in endoscopic images.
[0007] To achieve the above objectives, the present invention provides a method for detecting lesions in endoscopic images. This method includes: Step S1: acquiring an endoscopic image dataset; Step S2: preprocessing the endoscopic image dataset; Step S3: dividing the preprocessed endoscopic image dataset into a training set, a validation set, and a test set according to a preset ratio; Step S4: building a YOLO-RSP model; wherein the YOLO-RSP model is an improved model based on the YOLOv10 network; the YOLO-RSP model includes: a backbone network, a neck network, and a detection head network; the backbone network is used to receive the preprocessed endoscopic image dataset and extract features from the preprocessed endoscopic image dataset to generate feature maps at different scales; the neck network is used to... The system fuses feature maps of different scales generated by the backbone network and transmits the fused feature maps of different scales to the detection head network. The detection head network receives the fused feature maps of different scales and outputs the classification and localization detection results of different lesions in the endoscopic image dataset based on the fused feature maps of different scales. The backbone network specifically includes: a first convolutional module, a second convolutional module, a first RSD-OSA module, a third convolutional module, a second RSD-OSA module, a first SCDown module, a third RSD-OSA module, a second SCDown module, a first C2fCIB module, an SPPF module, and a PSCoordATT module that are interconnected.
[0008] The preprocessed endoscopic image dataset is convolved through the first convolution module to adjust the number of channels, resulting in feature map C1. Feature map C1 is then convolved through the second convolution module to extract high-level image features, resulting in feature map C2. Feature map C2 is then convolved and reparameterized through the first RSD-OSA module to enhance the perception of lesions of different sizes and reduce the model's parameters, resulting in feature map C3. Feature map C3 is then convolved through the third convolution module to fuse features, resulting in feature map C4. Feature map C4 is then reparameterized and shuffled through the second RSD-OSA module to fuse features, resulting in feature map C5. Feature map C5 is then downsampled through the first SCDown module to reduce the image size. The feature map size is adjusted to reduce model parameters, resulting in feature map C6. Feature map C6 undergoes convolution and reparameterization operations through the third RSD-OSA module to fuse features, resulting in feature map C7. Feature map C7 undergoes downsampling operations through the second SCDown module to extract high-dimensional features, further reducing model parameters, resulting in feature map C8. Feature map C8 undergoes convolution and channel obfuscation operations through the first C2fCIB module to improve feature fusion capabilities, resulting in feature map C9. Feature map C9 undergoes spatial pyramid pooling fast operations through the SPPF module to fuse multi-scale receptive field features, resulting in feature map C10. Feature map C10 undergoes attention operations through the PSCoordATT module to increase the weights of key regions, resulting in feature map C11.
[0009] The neck network specifically includes: a first upsample module, a first concat module, a fourth RSD-OSA module, a second upsample module, a second concat module, a fifth RSD-OSA module, a CBS module, a third concat module, a second C2fCIB module, a third SCDown module, a fourth concat module, and a third C2fCIB module, all interconnected. Feature map C11 undergoes upsampling through the first upsample module to extract high-dimensional information parameters, resulting in feature map C12. Feature map C12 and feature map C7 are fused through the first concat module to obtain feature map C13. Feature map C13 undergoes convolution and channel obfuscation through the fourth RSD-OSA module to fuse features, resulting in feature map C14. Feature map C14 undergoes upsampling through the second upsample module to extract features of different dimensions, resulting in feature map C15. Feature map C15 and feature map C5 are fused through the second... The Concat module performs feature fusion to obtain feature map C16; feature map C16 is then cascaded through the fifth RSD-OSA module to extract features at different depths, resulting in feature map C17; feature map C17 is then convolved through the CBS module for feature compression, resulting in feature map C18; feature map C18 and feature map C14 are fused through the third Concat module to obtain feature map C19; feature map C19 is then refined and enhanced through compact inverted bottleneck convolution through the second C2fCIB module, resulting in feature map C20; feature map C20 is then max-pooled through the third SCDown module to retain high-frequency information, resulting in feature map C21; feature map C21 and feature map C11 are fused through the fourth Concat module to obtain feature map C22; feature map C22 is then recombined through multi-branch feature fusion through the third C2fCIB module to improve feature extraction capabilities, resulting in feature map C23.
[0010] The detection head network specifically includes three independent detection heads: a first detection head, a second detection head, and a third detection head. Each independent detection head consists of a one-to-one head and a one-to-many head. Both the one-to-one head and the one-to-many head consist of a classification head and a regression head. The classification head is responsible for predicting the category of each bounding box, and the regression head is responsible for predicting the location of the bounding box. Specifically, the first detection head receives the feature map C17 and outputs the classification and localization detection results of different lesions in the endoscopic image dataset based on the feature map C17. The second detection head receives the feature map C20 and outputs the classification and localization detection results of different lesions in the endoscopic image dataset based on the feature map C20. The third detection head receives the feature map C23 and outputs the classification and localization detection results of different lesions in the endoscopic image dataset based on the feature map C23.
[0011] Step S5: Based on the constructed loss function, train the YOLO-RSP model using the training set; Step S6: Input the validation set into the trained YOLO-RSP model for optimization; Step S7: Input the test set into the finally optimized YOLO-RSP model to obtain the classification and localization detection results of different lesions in the test set.
[0012] Preferably, each RSD-OSA module specifically includes: a first RepVGG module, a first RSD module, a second RSD module, a channel shuffling module, a fifth Concat module, and a second RepVGG module that are interconnected.
[0013] In this process, the input features of each RSD-OSA module are passed through the first RepVGG module to obtain feature map C100; feature map C100 is input to the first RSD module for deep feature extraction to obtain feature map C101; feature map C101 is input to the second RSD module for deep feature extraction to obtain feature map C102; feature maps C100, C101, and C102 are subjected to channel shuffling by the channel shuffling module, and then the feature maps after channel shuffling are input to the fifth Concat module for feature fusion to obtain feature map C103; feature map C103 is passed through the second RepVGG module for feature transmission and feature output.
[0014] Preferably, the PSCoordATT module specifically includes: a fourth convolutional module, a CoordAtt module, a sixth Concat module, a fifth convolutional module, a sixth convolutional module, a seventh Concat module, and a seventh convolutional module, all interconnected; wherein, the input features of the PSCoordATT module are convolved through the fourth convolutional module to extract features, resulting in feature map C104; feature map C104 is input to the CoordAtt module for attention weighting to enhance the feature weights of key parts, resulting in feature map C105; feature map C105 and feature map C104 are... The features are then fed into the sixth Concat module for feature fusion to obtain feature map C106; feature map C106 is fed into the fifth convolution module for convolution to extract depth features to obtain feature map C107; feature map C107 is fed into the sixth convolution module for convolution to extract features to obtain feature map C108; feature map C108, feature map C104, and feature map C106 are simultaneously fed into the seventh Concat module for feature fusion to obtain feature map C109; feature map C109 is then convolved by the seventh convolution module before feature output.
[0015] Preferably, the constructed loss function is the NWD loss function; the NWD loss function is a loss function based on normalized Wasserstein distance.
[0016] The mathematical expression corresponding to the NWD loss function is:
[0017]
[0018] In equation (1), B represents the true target bounding box; Indicates the prediction box; The Gaussian distribution representing the center point of the true target bounding box; The Gaussian distribution representing the center point of the prediction box; Represents the second-order Wasserstein distance; μ represents the normalization factor. B This represents the average center point value of the true target bounding box. Σ represents the covariance matrix of the center points of the true target bounding boxes; B This represents the mean value of the center point of the prediction box; The covariance matrix of the center point of the prediction box;
[0019] The mathematical expression for the second-order Wasserstein distance is:
[0020]
[0021] In equation (2), Tr(·) represents the offset distance of the center point; Tr(·) represents the trace of the calculated covariance matrix, which is used to measure the degree of scale matching.
[0022] Preferably, step S2 specifically includes: step S2.1: performing data annotation and unified conversion of the data annotation format on the endoscopic image dataset; step S2.2: performing data augmentation on the endoscopic image dataset.
[0023] The beneficial effects of this invention are:
[0024] This invention provides a lesion detection method for endoscopic images, focusing on lesion detection in YOLOv10 endoscopic images, and optimizing it to address the issues of small lesions and blurred boundaries. Specifically, the YOLOv10 target detection model is optimized based on the characteristics of endoscopic images. First, the network structure is adjusted to improve the small target detection capability, taking into account the imaging characteristics of bladder lesions. An RSD-OSA (Reparameterized Shuffle Dilated Convolution with One-Shot Aggregation) module is designed, which achieves efficient extraction and aggregation of multi-scale features through joint modeling using reparameterized convolution, channel shuffling, and dilated convolution. A PSCoordATT module is constructed, which enhances the model's spatial focusing ability on lesion regions based on a coordinate attention mechanism, reducing background noise interference. Second, to address the instability of the traditional IoU loss function in small target lesion detection, the loss function is optimized. Specifically, a normalized Wasserstein distance (NWD) loss function is introduced, improving the localization stability and regression accuracy in small target detection.
[0025] Additional aspects and advantages of the invention will become apparent from the description which follows, or may be learned by practice of the invention. Attached Figure Description
[0026] Figure 1 A schematic flowchart of an endoscopic image lesion detection method according to an embodiment of the present invention is shown;
[0027] Figure 2 An architecture diagram of a YOLO-RSP model according to an embodiment of the present invention is shown;
[0028] Figure 3 The diagram illustrates the architecture of the RSD module in the RSD-OSA module of a YOLO-RSP model according to an embodiment of the present invention.
[0029] Figure 4The diagram illustrates the architecture of the RSD-OSA module within the YOLO-RSP model of an embodiment of the present invention.
[0030] Figure 5 An architecture diagram of the PSCoordATT module in the YOLO-RSP model of an embodiment of the present invention is shown;
[0031] Figure 6a This illustrates a real-world labeled image from a publicly available dataset representing an embodiment of the present invention;
[0032] Figure 6b A schematic diagram of the detection results using the output of the underlying network on a public dataset according to an embodiment of the present invention is shown;
[0033] Figure 6c The diagram illustrates the detection results of a public dataset using the YOLO-RSP model on the same image, according to an embodiment of the present invention. Detailed Implementation
[0034] To better understand the above-mentioned objectives, features, and advantages of the present invention, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments. It should be noted that, unless otherwise specified, the embodiments and features described in these embodiments can be combined with each other.
[0035] Many specific details are set forth in the following description in order to provide a full understanding of the invention. However, the invention may also be practiced in other ways different from those described herein, and therefore the scope of protection of the invention is not limited to the specific embodiments disclosed below.
[0036] Figure 1 A schematic flowchart of an endoscopic image lesion detection method according to an embodiment of the present invention is shown. Figure 1 As shown, the endoscopic image lesion detection method includes:
[0037] Step S1: Obtain the endoscopic image dataset;
[0038] Step S2: Preprocess the endoscopic image dataset;
[0039] Step S3: Divide the preprocessed endoscopic image dataset into training set, validation set, and test set according to a preset ratio;
[0040] Step S4: Build the YOLO-RSP model; the YOLO-RSP model is an improved model based on the YOLOv10 network; the YOLO-RSP model includes: backbone network, neck network, and detection head network;
[0041] The backbone network receives the preprocessed endoscopic image dataset and extracts features from it to generate feature maps at different scales. The neck network fuses the feature maps at different scales generated by the backbone network and passes the fused feature maps to the detection head network. The detection head network receives the fused feature maps at different scales and outputs the classification and localization results of different lesions in the endoscopic image dataset based on the fused feature maps at different scales.
[0042] like Figure 2 As shown, the backbone network specifically includes: a first convolutional module, a second convolutional module, a first RSD-OSA module, a third convolutional module, a second RSD-OSA module, a first SCDown module, a third RSD-OSA module, a second SCDown module, a first C2fCIB module, an SPPF module, and a PSCoordATT module that are interconnected.
[0043] The preprocessed endoscopic image dataset is convolved using a first convolution module to adjust the number of channels, resulting in feature map C1. Feature map C1 is then convolved using a second convolution module to extract high-level image features, resulting in feature map C2. Feature map C2 is then convolved and reparameterized using a first RSD-OSA module to enhance the perception of lesions of different sizes and reduce the model's parameters, resulting in feature map C3. Feature map C3 is then convolved using a third convolution module to fuse features, resulting in feature map C4. Feature map C4 is then reparameterized and shuffled using a second RSD-OSA module to fuse features, resulting in feature map C5. Finally, feature map C5 is downsampled using a first SCDown module to reduce the feature map size. The model's parameters are reduced to obtain feature map C6. Feature map C6 is then subjected to convolution and reparameterization operations by the third RSD-OSA module to fuse features, resulting in feature map C7. Feature map C7 is then subjected to downsampling operations by the second SCDown module to extract high-dimensional features, further reducing model parameters, resulting in feature map C8. Feature map C8 is then subjected to convolution and channel obfuscation operations by the first C2fCIB module to improve feature fusion capabilities, resulting in feature map C9. Feature map C9 is then subjected to spatial pyramid pooling operations by the SPPF module to fuse multi-scale receptive field features, resulting in feature map C10. Feature map C10 is then subjected to attention operations by the PSCoordATT module to increase the weights of key regions, resulting in feature map C11.
[0044] The neck network specifically includes: a first upsample module, a first Concat module, a fourth RSD-OSA module, a second upsample module, a second Concat module, a fifth RSD-OSA module, a CBS module, a third Concat module, a second C2fCIB module, a third SCDown module, a fourth Concat module, and a third C2fCIB module that are interconnected.
[0045] In this process, feature map C11 undergoes upsampling through the first upsample module to extract high-dimensional information parameters, resulting in feature map C12. Feature maps C12 and C7 are then fused through the first Concat module to obtain feature map C13. Feature map C13 undergoes convolution and channel obfuscation through the fourth RSD-OSA module to fuse features, resulting in feature map C14. Feature map C14 undergoes upsampling through the second upsample module to extract features of different dimensions, resulting in feature map C15. Feature maps C15 and C5 are then fused through the second Concat module to obtain feature map C16. Feature map C16 undergoes cascaded operations through the fifth RSD-OSA module to extract features of different depths, resulting in feature map C16. 17; Feature map C17 is convolved using the CBS module for feature compression to obtain feature map C18; Feature map C18 and feature map C14 are fused using the third Concat module to obtain feature map C19; Feature map C19 is refined and enhanced using the second C2fCIB module through compact inverted bottleneck convolution to obtain feature map C20; Feature map C20 is max-pooled using the third SCDown module to retain high-frequency information to obtain feature map C21; Feature map C21 and feature map C11 are fused using the fourth Concat module to obtain feature map C22; Feature map C22 is recombined using the third C2fCIB module through multi-branch feature recombination to fuse features and improve feature extraction capabilities to obtain feature map C23;
[0046] The detection head network specifically includes three independent detection heads: a first detection head, a second detection head, and a third detection head. Each independent detection head consists of a one-to-one head and a one-to-many head. Both the one-to-one head and the one-to-many head consist of a classification head and a regression head. The classification head is responsible for predicting the category to which each bounding box belongs, and the regression head is responsible for predicting the location of the bounding box.
[0047] The first detection head receives feature map C17 and outputs classification and localization detection results for different lesions in the endoscopic image dataset based on feature map C17; the second detection head receives feature map C20 and outputs classification and localization detection results for different lesions in the endoscopic image dataset based on feature map C20; the third detection head receives feature map C23 and outputs classification and localization detection results for different lesions in the endoscopic image dataset based on feature map C23.
[0048] Step S5: Based on the constructed loss function, train the YOLO-RSP model using the training set;
[0049] Step S6: Input the validation set into the trained YOLO-RSP model for optimization;
[0050] Step S7: Input the test set into the final optimized YOLO-RSP model to obtain the classification and localization detection results of different lesions in the test set.
[0051] This invention provides a lesion detection method for endoscopic images, focusing on lesion detection in YOLOv10 endoscopic images, and optimizing it to address the issues of small lesions and blurred boundaries. The YOLOv10 target detection model is optimized based on the characteristics of endoscopic images. The network structure is adjusted to suit the imaging characteristics of bladder lesions, improving the ability to detect small targets. Specifically, an RSD-OSA (Reparameterized Shuffle Dilated Convolution with One-Shot Aggregation) module is designed, which achieves efficient extraction and aggregation of multi-scale features through joint modeling using reparameterized convolution, channel shuffling, and dilated convolution; a PSCoordATT module is constructed, which enhances the model's spatial focusing ability on lesion regions based on a coordinate attention mechanism, reducing background noise interference.
[0052] In one embodiment of the present invention, such as Figure 4As shown, each RSD-OSA module specifically includes: a first RepVGG module, a first RSD module, a second RSD module, a channel shuffling module, a fifth Concat module, and a second RepVGG module, all interconnected. The input features of each RSD-OSA module are passed through the first RepVGG module to obtain feature map C100. Feature map C100 is input to the first RSD module for deep feature extraction to obtain feature map C101. Feature map C101 is input to the second RSD module for deep feature extraction to obtain feature map C102. Feature maps C100, C101, and C102 undergo channel shuffling through the channel shuffling module, and the resulting feature maps are then input to the fifth Concat module for feature fusion to obtain feature map C103. Feature map C103 is passed through the second RepVGG module for feature transmission and output.
[0053] In one embodiment of the present invention, such as Figure 5 As shown, the PSCoordATT module specifically includes: a fourth convolutional module, a CoordAtt module, a sixth Concat module, a fifth convolutional module, a sixth convolutional module, a seventh Concat module, and a seventh convolutional module, all interconnected. The input features of the PSCoordATT module are convolved through the fourth convolutional module to extract features, resulting in feature map C104. Feature map C104 is then input to the CoordAtt module for attention weighting to enhance the feature weights of key regions, resulting in feature map C105. Feature map C105 and feature map C105... C104 is simultaneously input to the sixth Concat module for feature fusion to obtain feature map C106; feature map C106 is input to the fifth convolution module for convolution operation to extract depth features to obtain feature map C107; feature map C107 is input to the sixth convolution module for convolution operation to extract features to obtain feature map C108; feature maps C108, C104, and C106 are simultaneously input to the seventh Concat module for feature fusion to obtain feature map C109; feature map C109 is then convolved by the seventh convolution module before feature output.
[0054] In this embodiment, the PSCoordATT module can focus on important regions in the image, assign more weight to these important regions, and improve the accuracy of lesion detection in high-noise or high-complexity environments.
[0055] In one embodiment of the present invention, the constructed loss function is the NWD loss function; the NWD loss function is a loss function based on normalized Wasserstein distance; wherein, the mathematical expression corresponding to the NWD loss function is:
[0056]
[0057] In equation (1), B represents the true target bounding box; Indicates the prediction box; The Gaussian distribution representing the center point of the true target bounding box; The Gaussian distribution representing the center point of the prediction box; Represents the second-order Wasserstein distance; μ represents the normalization factor. B This represents the average center point value of the true target bounding box. Σ represents the covariance matrix of the center points of the true target bounding boxes; B This represents the mean value of the center point of the prediction box; The covariance matrix of the center point of the prediction box;
[0058] The mathematical expression for the second-order Wasserstein distance is:
[0059]
[0060] In equation (2), Tr(·) represents the offset distance of the center point; Tr(·) represents the trace of the calculated covariance matrix, which is used to measure the degree of scale matching.
[0061] In this embodiment, we optimized the loss function to address the instability of the traditional IoU loss function in small target detection. Specifically, we introduced the Normalized Wasserstein Distance (NWD) loss function, which improved the localization stability and regression accuracy in small target detection.
[0062] In one embodiment of the present invention, step S2 specifically includes: step S2.1: performing data annotation and unified conversion of the data annotation format on the endoscopic image dataset; step S2.2: performing data augmentation on the endoscopic image dataset.
[0063] The technical solution of the present invention will be illustrated below with a specific embodiment. This specific embodiment of the endoscopic image lesion detection method is implemented through the following steps:
[0064] 1) Step S1: Obtain the endoscope image dataset.
[0065] This specific implementation integrates three public datasets (PLOS One Gastric Polyp, CVC-ClinicDB, and Kvasir-SEG) to construct a pre-trained dataset called "PolypFusion".
[0066] The PLOS One Gastric Polyp dataset, published by the journal PLOS One, aims to support research on the identification and diagnosis of gastric polyps. This dataset provides diverse samples, helping to improve the robustness of polyp detection algorithms. The PLOS One Gastric Polyp dataset contains 758 endoscopic images of gastric polyps.
[0067] CVC-ClinicDB Dataset: CVC-ClinicDB is a publicly available dataset released by the Catalan Vision Center. This dataset contains 612 high-resolution colonoscopy images with detailed polyp region segmentation labels, making it suitable for semantic segmentation tasks.
[0068] The Kvasir-SEG dataset, provided by Simula Research Laboratory, contains 1000 endoscopic images covering various polyp types, along with pixel-level segmentation masks.
[0069] To improve the model's detection capabilities in specific clinical scenarios, a cystoscopy image dataset named BladScope (Bladder Endoscopic Dataset) was created. This dataset was provided by the urology department of a hospital, and all images were acquired under white light using a flexible cystoscope (CYF-V2, Olympus Medical Systems, Tokyo, Japan). After rigorous screening and quality control, 423 high-quality images were obtained. The original image resolution was 720×480, and it was uniformly adjusted to 512×512 before being input into the network. The BladScope dataset covers three types of bladder lesions: 139 images of bladder stones, 148 images of papillary bladder masses, and 137 images of bladder polyps.
[0070] By integrating the three public and private datasets mentioned above, the constructed PolypFusion and BladScope datasets possess high diversity and large data volume, providing a solid foundation for training deep learning models.
[0071] 2) Step S2: Preprocess the endoscopic image dataset. Step S2 specifically includes: Step S2.1: Perform data annotation and unified conversion of the data annotation format on the endoscopic image dataset; Step S2.2: Perform data augmentation on the endoscopic image dataset.
[0072] The main tasks of data preprocessing include data labeling, data transformation, and data augmentation.
[0073] ① Data Labeling and Transformation: This specific embodiment performs fine labeling and unified transformation on both public datasets and self-made datasets. For public datasets, such as PLOS One Gastric Polyp, CVC-ClinicDB, and Kvasir-SEG, the original labeling formats differ somewhat. The former typically uses bounding boxes or segmentation masks, while the latter are mostly binary segmented images. To unify the labeling format, the segmentation masks are first processed. The contour detection algorithm in the OpenCV library is used to extract the bounding rectangles of the target regions, and their coordinates and category information are converted into Pascal VOC format XML files. This format can effectively support the training and validation of common object detection frameworks (such as YOLO and Faster R-CNN).
[0074] The private bladder lesion image dataset covers three common lesion types: bladder stones, bladder papillomas, and bladder polyps. These three types of lesions differ significantly in morphology, boundary, and color. In the self-made cystoscopy image dataset (BLADSCOPE), due to the lack of readily available annotation information, we used the open-source annotation tool LabelImg to manually annotate each image. LabelImg supports multiple mainstream annotation formats. During the annotation process, professional operators manually drew rectangles using a mouse to precisely delineate the visible lesion areas in the images. Clear classification labels were set for different types of lesions, including bladder stones, papillary masses, and polyps, and a unified naming convention was adopted to ensure consistency and standardization of annotation labels. All annotation files were saved in Pascal VOC format, which describes the location and category of the target in each image in XML format, offering good universality and compatibility. After the annotation is completed, all images undergo a double-check mechanism: two people with medical imaging backgrounds independently check the position and labels of all annotation boxes, and reach a consensus on disputed samples through negotiation, so as to minimize the fluctuation of model performance caused by annotation errors, subjective biases or omissions.
[0075] ② Data Augmentation: Multiple data augmentation strategies were employed, including geometric transformations, color transformations, noise addition, and blurring. Geometric transformations included rotation, flipping, scaling, and translation operations, which altered the spatial structure of the images to simulate lesion morphology at different angles and scales. For color transformations, brightness, contrast, hue, and saturation were adjusted to enhance the model's adaptability to different lighting and color variations. For noise addition, Gaussian noise and salt and pepper noise were used to enhance sample diversity, while Gaussian blur and sharpening operations were employed to further improve the model's sensitivity to blurred images and detailed features. Furthermore, a randomized combination augmentation strategy was used, randomly applying several augmentation methods in each training batch to ensure the model could learn multiple visual features. Regarding the number of augmented samples, the self-made cystoscope dataset was tripled, bringing the training set to 1140 images.
[0076] 3) Step S3: Divide the preprocessed endoscopic image dataset into training set, validation set and test set according to a preset ratio of 8:1:1.
[0077] After integrating publicly available datasets, a total of 2370 image samples were obtained, including 758 from the PLOS OneGastric Polyp dataset, 612 from the CVC-ClinicDB dataset, and 1000 from the Kvasir-SEG dataset. Based on an 8:1:1 split ratio, a training set of 1896 images, a validation set of 237 images, and a test set of 237 images were obtained. For the self-made cystoscopy dataset BLADSCOPE, a total of 423 images were divided into a training set of 338 images, a validation set of 43 images, and a test set of 42 images, all in the same ratio. During the construction of the training set, data augmentation strategies were used to expand the number of samples, ultimately reaching a training set size of 1140 images, significantly improving the model's generalization ability.
[0078] During the partitioning process, we ensured the balance of data across different categories to avoid any particular type of lesion occupying an excessively high proportion in a specific subset, which could lead to training or evaluation bias. Simultaneously, we randomly shuffled the sample order before each subset partition to ensure that the model sees a representative sample distribution during both training and validation phases.
[0079] 4) Step S4: Build the YOLO-RSP model; the YOLO-RSP model is an improved model based on the YOLOv10 network; the YOLO-RSP model includes: backbone network, neck network, and detection head network;
[0080] A backbone network receives the preprocessed endoscopic image dataset and extracts features from it to generate feature maps at different scales. A neck network fuses the feature maps at different scales generated by the backbone network and passes the fused feature maps to the detection head network. The detection head network receives the fused feature maps at different scales and outputs the classification and localization results of different lesions in the endoscopic image dataset based on the fused feature maps.
[0081] like Figure 2 As shown, the backbone network specifically includes: a first convolutional module, a second convolutional module, a first RSD-OSA module, a third convolutional module, a second RSD-OSA module, a first SCDown module, a third RSD-OSA module, a second SCDown module, a first C2fCIB module, an SPPF module, and a PSCoordATT module that are interconnected.
[0082] The preprocessed endoscopic image dataset is convolved using a first convolution module to adjust the number of channels, resulting in feature map C1. Feature map C1 is then convolved using a second convolution module to extract high-level image features, resulting in feature map C2. Feature map C2 is then convolved and reparameterized using a first RSD-OSA module to enhance the perception of lesions of different sizes and reduce the model's parameters, resulting in feature map C3. Feature map C3 is then convolved using a third convolution module to fuse features, resulting in feature map C4. Feature map C4 is then reparameterized and shuffled using a second RSD-OSA module to fuse features, resulting in feature map C5. Finally, feature map C5 is downsampled using a first SCDown module to reduce the feature map size. The model's parameters are reduced to obtain feature map C6. Feature map C6 is then subjected to convolution and reparameterization operations by the third RSD-OSA module to fuse features, resulting in feature map C7. Feature map C7 is then subjected to downsampling operations by the second SCDown module to extract high-dimensional features, further reducing model parameters, resulting in feature map C8. Feature map C8 is then subjected to convolution and channel obfuscation operations by the first C2fCIB module to improve feature fusion capabilities, resulting in feature map C9. Feature map C9 is then subjected to spatial pyramid pooling operations by the SPPF module to fuse multi-scale receptive field features, resulting in feature map C10. Feature map C10 is then subjected to attention operations by the PSCoordATT module to increase the weights of key regions, resulting in feature map C11.
[0083] The neck network specifically includes: a first upsample module, a first concat module, a fourth RSD-OSA module, a second upsample module, a second concat module, a fifth RSD-OSA module, a CBS module, a third concat module, a second C2fCIB module, a third SCDown module, a fourth concat module, and a third C2fCIB module, all interconnected. Feature map C11 undergoes upsampling through the first upsample module to extract high-dimensional information parameters, resulting in feature map C12. Feature maps C12 and C7 are fused through the first concat module to obtain feature map C13. Feature map C13 undergoes convolution and channel obfuscation through the fourth RSD-OSA module to fuse features, resulting in feature map C14. Feature map C14 undergoes upsampling through the second upsample module to extract features of different dimensions, resulting in feature map C15. Feature maps C15 and C5... Feature map C16 is obtained by feature fusion through the second Concat module; feature map C16 is then cascaded through the fifth RSD-OSA module to extract features at different depths, resulting in feature map C17; feature map C17 is then convolved through the CBS module for feature compression, resulting in feature map C18; feature maps C18 and C14 are fused through the third Concat module to obtain feature map C19; feature map C19 is then refined and enhanced through compact inverted bottleneck convolution through the second C2fCIB module, resulting in feature map C20; feature map C20 is then max-pooled through the third SCDown module to retain high-frequency information, resulting in feature map C21; feature maps C21 and C11 are fused through the fourth Concat module to obtain feature map C22; feature map C22 is then recombined through multi-branch feature fusion through the third C2fCIB module to improve feature extraction capabilities, resulting in feature map C23.
[0084] The detection head network specifically includes three independent detection heads: a first detection head, a second detection head, and a third detection head. Each independent detection head consists of a one-to-one head and a one-to-many head. Both the one-to-one head and the one-to-many head consist of a classification head and a regression head. The classification head is responsible for predicting the category of each bounding box, and the regression head is responsible for predicting the location of the bounding box. Specifically, the first detection head receives feature map C17 and outputs classification and localization detection results for different lesions in the endoscopic image dataset based on feature map C17. The second detection head receives feature map C20 and outputs classification and localization detection results for different lesions in the endoscopic image dataset based on feature map C20. The third detection head receives feature map C23 and outputs classification and localization detection results for different lesions in the endoscopic image dataset based on feature map C23.
[0085] like Figure 4 As shown, each RSD-OSA module specifically includes: a first RepVGG module, a first RSD module, a second RSD module, a channel shuffling module, a fifth Concat module, and a second RepVGG module, all interconnected. The input features of each RSD-OSA module are passed through the first RepVGG module to obtain feature map C100. Feature map C100 is input to the first RSD module for deep feature extraction to obtain feature map C101. Feature map C101 is input to the second RSD module for deep feature extraction to obtain feature map C102. Feature maps C100, C101, and C102 undergo channel shuffling through the channel shuffling module, and the resulting feature maps are then input to the fifth Concat module for feature fusion to obtain feature map C103. Feature map C103 is passed through the second RepVGG module for feature transmission and output.
[0086] like Figure 4 As shown, in the RSD-OSA structure, the input features are divided into two parts: one part is directly passed to the output layer, retaining the information of low-level features. The other part undergoes RSD processing to extract deep features, and then is fused with the directly passed features through channel shuffling. This feature fusion method ensures the interaction of information at different levels, improves the model's ability to detect lesions at different scales, and avoids the information loss problem that may exist in the traditional FPN structure.
[0087] like Figure 5As shown, the PSCoordATT module specifically includes: a fourth convolutional module, a CoordAtt module, a sixth Concat module, a fifth convolutional module, a sixth convolutional module, a seventh Concat module, and a seventh convolutional module, all interconnected. The input features of the PSCoordATT module are convolved through the fourth convolutional module to extract features, resulting in feature map C104. Feature map C104 is then input to the CoordAtt module for attention weighting to enhance the feature weights of key regions, resulting in feature map C105. Feature map C105 and feature map C105... C104 is simultaneously input to the sixth Concat module for feature fusion to obtain feature map C106; feature map C106 is input to the fifth convolution module for convolution operation to extract depth features to obtain feature map C107; feature map C107 is input to the sixth convolution module for convolution operation to extract features to obtain feature map C108; feature maps C108, C104, and C106 are simultaneously input to the seventh Concat module for feature fusion to obtain feature map C109; feature map C109 is then convolved by the seventh convolution module before feature output.
[0088] In step S4, we propose an improved model based on the YOLOv10 architecture, named the YOLO-RSP (YOLO with RSD-OSA and PSCoordATT) model. This model combines two key modules—the coordinate attention-based PSCoordATT module and the channel shuffle-based reparameterized RSD-OSA module.
[0089] Specifically, to enhance the network's ability to extract features from lesion regions while reducing computational overhead, the RSD-OSA (Reparameterized Shuffle Dilated Convolution with One-Shot Aggregation) module was proposed. The experimental environment and evaluation metrics, the RSD mechanism, and the OSA mechanism are described in detail below.
[0090] I. Experimental Environment and Evaluation Indicators.
[0091] 1. Experimental Hardware Configuration. The experimental environment was configured as follows during model training and inference: The operating system was Windows 11. The processor was a 12th Gen Intel(R) Core(TM) i5-12400F, 2500MHz, with 6 cores and 12 logic processors. The computing platform used an NVIDIA RTX A4000 GPU with 16GB of video memory. For the software environment, Python 3.10 was used for programming, with PyTorch 1.11.0 as the main deep learning framework. Code development and debugging were completed in the PyCharm integrated development environment. The number of epochs for model training was set to 300, the batch size was uniformly set to 16, and the input image resolution was set to 512×512. The AdamW algorithm was used for model optimization, with an initial learning rate of 0.001429 and momentum of 0.9.
[0092] 2. Evaluation indicators.
[0093] Precision measures the percentage of truly positive samples detected by an algorithm. It can be calculated using the following formula:
[0094]
[0095] TP (True Positive) represents a true positive, meaning the correct target was detected. FP (False Positive) represents a false positive, meaning the wrong target was detected (false detection). Accuracy is typically used to measure the number of false alarms.
[0096] Recall measures how many positive samples are correctly detected. It is typically used to measure the number of missed detections. It is calculated using the following formula:
[0097]
[0098] TP (True Positive) represents a true positive instance. FN (False Negative) represents a false negative instance, i.e., a target that was missed during detection.
[0099] mAP (Mean Average Precision) is the average precision across all categories. It is a commonly used comprehensive metric in object detection to measure the accuracy of the detection model. Its calculation formula is as follows:
[0100]
[0101] Where N is the number of categories, AP iThis is the average precision for category i. AP (Average Precision) is an important metric for measuring model performance in object detection tasks, especially in classification and localization accuracy. AP evaluates the model's performance at different thresholds by calculating the balance between precision and recall. Its calculation formula is shown below:
[0102]
[0103] mAP@50 is the average accuracy calculated with an IoU threshold of 0.5. In object detection tasks, it calculates whether the Intersection over Union (IoU) between the predicted and ground truth bounding boxes is greater than 0.5; if it is, the prediction is considered correct. This metric is typically used to evaluate the model's accuracy under lenient standards. mAP@50-95 is the average accuracy calculated with IoU thresholds ranging from 0.5 to 0.95 (with a step size of 0.05). This metric is more stringent, requiring the IoU between the predicted and ground truth bounding boxes to achieve a certain accuracy across multiple different thresholds, providing a more comprehensive evaluation of the object detection model's performance.
[0104] II. RSD Mechanism: Reparameterized Convolution Based on Channel Shuffle. The RSD mechanism greatly improves the performance of the model in endoscopic image lesion detection by combining three strategies: reparameterized convolution (RepConv), channel shuffle, and dilated convolution.
[0105] 1. Reparameterization
[0106] Reparameterized Convolution (RepConv) is a technique that employs a multi-branch structure during training to enhance feature learning capabilities, while converting it to a single equivalent structure during inference to improve computational efficiency. Its core idea is to use different network structures during training and inference, thereby reducing the computational burden during inference while maintaining model capabilities. Reparameterization allows the model to use more complex multi-path structures to extract richer feature information during training, and then simplifies it to an equivalent single-branch network during inference, accelerating inference and reducing computation. In the RSD-OSA module, the reparameterization strategy enables the model to fully utilize the advantages of multi-path feature extraction during training, while fusing the multi-branch structure into an equivalent single-branch network during inference, thereby improving inference speed and reducing memory consumption. Specifically, RSD employs the following reparameterization process: ① Training phase: Using standard 3×3 convolutions, 1×1 convolutions, and Identity skip connections, rich feature representations are learned through a multi-path structure. ② Inference Stage: Multi-branch structures are merged into equivalent 3×3 convolutions, significantly reducing computational requirements during inference while maintaining similar feature representation capabilities. This process is represented by the following formula:
[0107] W rep =W 3×3 +∑W 1×1 +I
[0108] Among them, W rep It is the reparameterized convolution kernel, W 3×3 and W 1×1 These are the weights of the 3×3 convolution and the 1×1 convolution, respectively; I represents the weight of the identity mapping.
[0109] 2. Channel Shuffle
[0110] In traditional convolutional neural network (CNN) architectures, channel information is typically processed independently, resulting in insufficient interaction between feature information from different channels. Channel shuffling, on the other hand, rearranges feature channels, enabling information from different channels to interact, thereby improving the model's expressive power.
[0111] Channel shuffling implementation: Channel shuffling is usually used in conjunction with channel grouping. The specific process involves first dividing the input feature map's channels into G groups (i.e., each group contains C / G channels). Convolution operations are performed independently within each group to reduce computational complexity. Channel rearrangement recombines the channels from each group in a specific way to ensure sufficient cross-group information interaction. The mathematical representation of channel shuffling is as follows: Assuming the input feature X has C channels and is divided into G groups, the channel shuffling operation can be represented as:
[0112] X shuffled =Shuffle(X)
[0113] Channel shuffling allows for the effective fusion of information from different channels. Channel grouping reduces computational costs, while channel shuffling compensates for the information loss caused by grouping, thus achieving a balance between computational efficiency and feature representation capabilities.
[0114] 3. Dilated Convolution
[0115] Dilated convolution, while maintaining the same computational complexity, can capture a wider range of feature information, demonstrating superior performance in various visual tasks, particularly image segmentation and object detection. Traditional convolution operations involve sliding a convolution kernel (e.g., 3×3 or 5×5) across the input image and extracting image features through element-wise multiplication and summation. However, traditional convolution suffers from a limited receptive field. To expand the receptive field, a common approach is to increase the kernel size (e.g., 5×5, 7×7), but this increases computational overhead, especially when processing high-resolution images. Dilated convolution effectively solves this problem. It expands the receptive field by inserting holes (or gaps) between the elements of the kernel, so that each element of the kernel spans one or more pixels instead of adjacent pixels, thus increasing computational cost. The size of the holes in dilated convolution is controlled by setting the dilation rate of the kernel. When the dilation factor is 1, dilated convolution is the same as standard convolution; when the dilation factor is greater than 1, there will be a larger gap between the elements of the convolution kernel, thereby expanding the receptive field.
[0116] Therefore, the RSD mechanism, through reparameterized convolution, channel shuffling, and dilated convolution techniques, not only optimizes the model's computational efficiency but also enhances its feature extraction capabilities. Especially in endoscopic image lesion detection tasks, the RSD mechanism enables the model to significantly improve inference speed and computational efficiency while maintaining high accuracy. By introducing this structure, the model can maintain high detection accuracy and accelerate the inference process when facing complex backgrounds and lesions of different scales. This advantage makes the RSD module a powerful application potential in modern object detection tasks, such as... Figure 3 As shown, the RSD module improves the receptive field of the model through reparameterization, dilated convolution, and channel shuffle techniques, making the model more sensitive to lesions of different sizes, thereby improving the accuracy of identifying lesions of different sizes.
[0117] III. OSA Mechanism: One-Shot Aggregation. The OSA (One-Shot Aggregation) mechanism aims to improve the computational efficiency and feature representation capability of the network. The main advantages of the OSA mechanism include: by aggregating features from different receptive fields in one step, the network can simultaneously capture local and global information, improving object detection capabilities. It also makes the network more efficient by reducing redundant feature computation and storage requirements. In the RSD-OSA module, OSA ensures efficient information transfer by performing a one-time fusion between the features processed by RSD and the directly passed features, thereby improving the network's detection performance. Feature fusion is a key part of the RSD-OSA module, improving the model's semantic information extraction capability through cross-level feature connections. In the RSD-OSA design, only three cascaded features are retained to balance computational cost and feature representation capability, avoiding increased computational complexity due to excessive cascading.
[0118] IV. Application of RSD-OSA in the YOLOv10 Architecture. In the improved YOLOv10 architecture, the RSD-OSA module was used to replace the original YOLO C2f structure to enhance the model's feature extraction capabilities. By reducing computational burden through the RSD mechanism and combining it with OSA to aggregate features in one step, the detection capability for lesions at different scales is improved. Through these optimizations, YOLOv10 achieves higher detection accuracy through the RSD-OSA module, while reducing the model's computational load and inference time, ensuring the model's real-time performance and efficiency in clinical applications. Furthermore, due to the powerful capabilities of the RSD-OSA module in multi-scale feature fusion, YOLOv10 can better handle the detection of different types of lesions, reducing the occurrence of missed and false positives.
[0119] V. Experimental Results Analysis. To verify the performance improvement effect of the RSD-OSA module on the YOLOv10 model, a comparative experiment was conducted on a private dataset for this specific embodiment. The experiment compared the performance of the standard YOLOv10 model and the improved model (YOLO-RSD-OSA) after introducing the RSD-OSA module on multiple metrics. Table 1 shows the main performance results of the two models in the experiment.
[0120] Table 1. Test results of the YOLOv10-n model on a private dataset.
[0121]
[0122] As shown in Tables 1 and 2, the overall mAP50 and mAP50-95 scores for YOLOv10 and YOLO-RSD-OSA are nearly identical, at 0.967 and 0.965 respectively. However, YOLO-RSD-OSA shows a slight advantage in mAP50-95, reaching 0.791, a slight improvement over YOLOv10's 0.782. This indicates that the RSD-OSA module improves the model's performance in multi-scale target detection.
[0123] Table 2 shows the test results of YOLO-RSD-OSA on the private dataset.
[0124]
[0125] In performance comparisons across various lesion types, YOLO-RSD-OSA showed a decrease in both precision and recall for the Bladderstone class. Precision was 0.856, lower than YOLOv10's 0.921, but recall improved to 0.931, higher than YOLOv10's 0.906. YOLO-RSD-OSA demonstrated improved precision and recall for the Papillary class, with values of 0.924 and 0.942 respectively, higher than YOLOv10 (0.955 and 0.942). It also exhibited superior detection capabilities at mAP50 (0.973) and mAP50-95 (0.785). YOLO-RSD-OSA significantly improves precision (0.934) and recall (0.925) for the Polypoid class compared to YOLOv10 (0.858 and 0.917), and also performs better in mAP50 and mAP50-95 metrics, at 0.952 and 0.815, respectively.
[0126] Comparative experimental results show that YOLO-RSD-OSA, compared to YOLOv10, improves precision and recall for most lesion categories (especially Polypoid and Papillary), particularly excelling in precision detection of small objects and in complex backgrounds. While YOLO-RSD-OSA's performance slightly declines in the BladderStone class, its improved recall compensates for this deficiency and contributes to enhancing the model's overall robustness.
[0127] For the inference speed evaluation experiment, the FPS and inference latency of the two models were compared under the same hardware environment. The improved YOLOv10 showed a significant improvement in inference speed, especially in terms of memory consumption and computational load. The RSD-OSA module demonstrated excellent computational efficiency, reducing computational costs. Furthermore, through computational complexity analysis, the FLOPs, parameter count, and memory usage of the two models were compared. The results show that the RSD-OSA module significantly reduced the computational complexity of the model while maintaining detection accuracy, particularly in terms of memory consumption and inference time, thus improving the model's practical application efficiency. Table 3 presents the performance analysis of the YOLOv10-n model and the YOLO-RSD-OSA model.
[0128] Table 3 Performance Analysis and Comparison Experiments of the Models
[0129]
[0130] As shown in Table 3, YOLO-RSD-OSA improves inference speed by approximately 10% compared to YOLOv10, achieving an FPS of 72.53, while YOLOv10's is 65.79. In terms of latency, YOLO-RSD-OSA achieves 13.79ms, slightly lower than YOLOv10's 15.20ms, demonstrating the optimized computational efficiency of the RSD-OSA module and its ability to meet real-time detection requirements. Although YOLO-RSD-OSA increases GFLOPS and parameter count by approximately 2.4 times compared to YOLOv10 (6.32 GFLOPS and 4.78M parameters), it improves accuracy (mAP@50) to 0.9696, indicating that the introduced computational complexity enhances feature extraction capabilities while maintaining efficient inference speed. Despite the increased computational complexity, the RSD-OSA module, through optimized computation and feature aggregation, does not significantly increase memory consumption and maintains low inference latency, thus achieving good application efficiency.
[0131] Furthermore, while traditional attention mechanisms can enhance feature representation to some extent, they often fail to effectively capture global location information, resulting in insufficient attention to small targets. Therefore, this specific embodiment proposes a PSCoordATT module based on Coordinate Attention (CA), replacing the PSA (Parallel Spatial Attention) module in the original YOLO structure, to more effectively improve the model's ability to detect lesion regions. The core idea of the PSCoordATT module is to combine coordinate attention mechanisms by encoding information in the horizontal and vertical directions separately, allowing the network to retain global dependencies while focusing on local features.
[0132] The following sections will detail the design and improvement of the PSCoordATT module, its role in target detection, and the analysis and optimization of its computational complexity.
[0133] I. Design and improvement of the PSCoordATT module.
[0134] To meet the specific needs of small lesion detection, an innovative attention module, PSCoordATT, integrating Pixel-wise Attention (PSA) and Coordinate Attention (CA), is proposed. This PSCoordATT module optimizes local feature extraction and spatial awareness by combining PSA and CA mechanisms, enhancing the network's detection performance for small lesions. The PSA mechanism calculates feature importance at the pixel level, thereby improving the model's response to small target regions. Unlike global attention, PSA focuses on information interaction within local regions, enabling more accurate capture of the feature distribution of small lesions. The CA mechanism in PSCoordATT enhances the spatial localization ability of the target, allowing the model to more accurately capture the boundary information of lesion regions in complex backgrounds. PSA and CA mechanisms calculate pixel-level and coordinate-level attention weights respectively, which are then fused into the original feature map through a weighted summation. This fusion method considers both local and global information, thereby improving detection robustness.
[0135] II. The Role of PSCoordATT in Object Detection. PSCoordATT is primarily used to enhance the YOLOv10 network's ability to detect small lesions. Its main function is to address the issue that small targets occupy only a few pixels on the feature map, making them susceptible to being overwhelmed by high-level semantic information during traditional convolutional operations. PSCoordATT, by combining PSA and CA mechanisms, allows the model to extract deep features while preserving fine-grained spatial information, thus reducing the chance of missing small targets. In endoscopic images, lesion areas typically have low contrast with normal tissue and are easily affected by background noise. PSCoordATT uses attention weighting to reduce the weight of non-target regions, thereby improving detection stability. Through the introduction of spatial attention mechanisms, PSCoordATT enables the model to better adapt to lesion areas of different shapes and scales, improving its generalization ability across different datasets.
[0136] III. Computational Complexity Analysis and Optimization.
[0137] In designing PSCoordATT, we optimized computational complexity (FLOPs) to ensure that the model maintains high inference speed while improving performance. Traditional self-attention mechanisms have high computational complexity (O(N)). 2 PSCoordATT reduces computational load by using 1D global pooling and grouped computation, bringing the computational complexity close to O(N). It replaces standard 3×3 convolutions with lightweight 1×1 convolutions to reduce the number of parameters. During inference, PSCoordATT reduces computation through weight sharing, performing attention calculations only at key layers to ensure real-time model performance. Channel shuffle technology is employed to improve computational efficiency and further reduce computational redundancy.
[0138] To verify the computational efficiency of PSCoordATT, we compared the computational complexity of YOLOv10 under different attention mechanisms. The experimental results are shown in Table 4, where PCA is an abbreviation for the PSCoordATT module. The results show that the PSCoordATT module significantly reduces computational complexity while maintaining detection accuracy and high inference speed, and its computational load is significantly lower than traditional self-attention mechanisms and other common attention modules.
[0139] Table 4. Performance Comparison Test Results of Different Attention Modules
[0140]
[0141] IV. Ablation Experiment: To verify the effectiveness of PSCoordATT in detecting small lesions, we conducted an ablation experiment and analyzed its impact on detection accuracy. YOLOv10 was used as the baseline model, and tests were conducted on endoscopy image datasets with no attention, SE, CBAM, and RSD-OSA. Evaluation metrics included mAP (mean precision), F1-score, and recall. The experimental results are shown in Table 5 below:
[0142] Table 5. Experimental results comparing the precision of different attention levels.
[0143]
[0144] Table 5 shows that the proposed PSCoordATT module effectively improves the performance of the YOLOv10 network in small lesion detection by integrating Pixel-wise Attention (PSA) and CoordinateAttention (CA) mechanisms. Through refined feature extraction, enhanced spatial awareness, and efficient computational optimization, PSCoordATT improves detection accuracy while maintaining low computational complexity, and performs best among the four attention mechanisms listed in the table. This makes the PSCoordATT module an effective tool for small lesion detection tasks, improving the model's generalization ability and providing robust performance in different application scenarios.
[0145] The YOLO-RSP model was evaluated using three different configurations: PSCOOdAtt alone, RSD-OSA alone, and a combination of PSCOOdAtt and RSD-OSA. These three configurations were used to verify the impact of each component and its combination on model performance. The main performance metrics evaluated included: precision, recall, mAP@50 (average precision at an IoU threshold of 0.5), and mAP@50-95 (average precision from IoU thresholds of 0.5 to 0.95). The results of the ablation experiments are shown in Table 6 below.
[0146] Table 6 Ablation experiment results of different modules on the private dataset.
[0147]
[0148] As can be seen from Table 6, in the configuration using only PSCOOdAtt, the model's precision is 0.905, recall is 0.933, and mAP@50 is 0.965. Although this configuration performs well under standard conditions, its mAP@50-95 metric of 0.791 indicates that the model's performance is relatively weak under more stringent evaluation criteria. Secondly, when using only RSD-OSA, the model's precision is 0.945 and recall is 0.914, demonstrating higher precision and recall than when PSCOOdAtt is used alone. Although mAP@50 is slightly lower at 0.961, mAP@50-95 improves to 0.796, indicating that RSD-OSA plays a positive role in improving the model's generalization ability and handling complex tasks. Finally, the model achieves optimal performance with the combined configuration of PSCOOdAtt and RSD-OSA. With a precision of 0.943 and a recall of 0.929, mAP@50 improved to 0.978, and mAP@50-95 further improved to 0.807, the combination of the two components demonstrates a significant advantage across all evaluation metrics. This improvement reflects that combining these two optimized components effectively enhances the model's performance, enabling it to achieve better results across a variety of tasks.
[0149] Table 7 Results of the comparative experiment using publicly available datasets
[0150]
[0151] Table 7 shows the test results on public datasets. RA represents the RSD-OSA module, PCA represents the PSCOOdAtt module, and the YOLO-RSP model represents the RA module + PCA module. As shown in the table, the improved model (YOLO-RSP) outperforms YOLOv10 and its improved versions (YOLO-RSD-OSA and YOLO-PA) on multiple evaluation metrics. Specifically, the YOLO-RSP model achieves excellent performance with precision (0.897) and recall (0.908), demonstrating high accuracy and low false negative rate in object detection. Furthermore, the YOLO-RSP model achieves scores of 0.93 and 0.658 on mAP@0.5 and mAP@0.5:0.95, respectively, significantly exceeding other models. This indicates that the improved model excels in object localization and small lesion detection accuracy, especially when handling complex backgrounds and small objects, where the model's performance is significantly optimized.
[0152] 5) Step S5: Based on the constructed loss function, train the YOLO-RSP model using the training set. The constructed loss function is the NWD loss function; the NWD loss function is a loss function based on normalized Wasserstein distance; wherein, the mathematical expression corresponding to the NWD loss function is:
[0153]
[0154] In equation (1), B represents the true target bounding box; Indicates the prediction box; The Gaussian distribution representing the center point of the true target bounding box; The Gaussian distribution representing the center point of the prediction box; Represents the second-order Wasserstein distance; μ represents the normalization factor to reduce scale dependence and make the loss more stable. B This represents the average center point value of the true target bounding box. Σ represents the covariance matrix of the center points of the true target bounding boxes; B This represents the mean value of the center point of the prediction box; The covariance matrix of the center point of the prediction box;
[0155] The mathematical expression for the second-order Wasserstein distance is:
[0156]
[0157] In equation (2), Tr(·) represents the offset distance of the center point; Tr(·) represents the trace of the calculated covariance matrix, which is used to measure the degree of scale matching.
[0158] In step S5, the NWD loss function is used to optimize target localization accuracy based on normalized Wasserstein distance. The following sections will explain the theoretical basis of the NWD loss function, the motivation for introducing it, and the impact of NWD on the original YOLOv10 loss function.
[0159] I. Theoretical basis of NWD loss function.
[0160] In object detection tasks, traditional bounding box regression losses (such as IoU Loss, GIoU Loss, and DIoU Loss) primarily measure the geometric overlap between the predicted and ground truth bounding boxes. However, these loss functions cannot adequately consider the matching of object box shape and scale, especially in small object detection scenarios, where conventional IoU and its variants struggle to provide stable gradient signals. Therefore, this specific implementation introduces a loss function based on Normalized Wasserstein Distance (NWD) to improve the accuracy of bounding box regression. Wasserstein distance is a metric that measures the difference between two probability distributions and is commonly used in optimal transport problems. NWD is normalized, making it computationally stable and more robust to scale changes. Its mathematical definition is as follows:
[0161]
[0162] In equation (1), B represents the true target bounding box; Indicates the prediction box; The Gaussian distribution representing the center point of the true target bounding box; The Gaussian distribution representing the center point of the prediction box; Represents the second-order Wasserstein distance; This represents the normalization factor, which reduces scale dependence and makes the loss more stable.
[0163] The mathematical expression for the second-order Wasserstein distance is:
[0164]
[0165] In equation (2), Tr(·) represents the offset distance of the center point; Tr(·) represents the trace of the calculated covariance matrix, which is used to measure the degree of scale matching.
[0166] II. Motivation for introducing the NWD loss function.
[0167] In the traditional YOLO framework, bounding box regression primarily relies on IoU Loss or its variants. However, IoU only considers the region overlap ratio and does not directly reflect the shape matching degree between the predicted and ground truth bounding boxes. Especially in small object detection tasks, IoU may not provide sufficient gradient information, leading to unstable training. Therefore, our main motivations for introducing the NWD loss function are: 1. Improving the accuracy of small object detection: Small objects have small bounding boxes, and IoU lacks sufficient gradient information when scales change. NWD models the center point of the bounding box and the scale matching degree through Wasserstein distance, which can more stably optimize the localization accuracy of small objects. 2. Reducing scale bias: After normalizing the Wasserstein distance, NWD makes the loss calculation of bounding boxes consistent across different scales, enhancing its adaptability to targets of different scales. 3. Optimizing the shape matching of bounding boxes: Compared to IoU, which only focuses on overlapping regions, NWD calculates the shape matching degree of the bounding boxes through the covariance matrix, making the regression more accurate.
[0168] III. The impact of NWD on the original loss function of YOLOv10.
[0169] In the original YOLOv10, localization error was primarily measured by the Box Loss, a loss function based on the Intersection over Union (IoU). However, this type of IoU-related loss function suffers from the vanishing gradient problem when the predicted and ground truth boxes have no intersection (IoU = 0). Therefore, a normalized Wasserstein distance (NWD) was introduced as a supplementary loss term for target box regression in the improved YOLOv10 to enhance the model's localization accuracy in cases of small targets, complex backgrounds, and overlapping targets. Unlike the original Box Loss, NWD does not rely on the overlap area between the predicted and ground truth boxes. Instead, it captures richer spatial relationships by measuring the distance between their center points and scale differences, thus providing a smoother and more continuous optimization signal. The introduction of NWD effectively alleviates the problem of IoU non-differentiability or excessively small gradients in the early stages of prediction, enhancing the model's learning ability on low-quality samples. Furthermore, the introduction of NWD improves the performance of the classification branch (Cls). The NWD (Nearest Dimensioning Loss) also had indirect positive effects. Because the bounding box regression was more accurate and the target region localization was more concentrated, the network had clearer contextual information when extracting features, improving the stability and accuracy of category prediction. When used in conjunction with DFL (Distribution Focal Loss), NWD supplemented DFL's shortcomings in modeling boundary distribution. DFL mainly optimizes the distribution regression of bounding boxes, making the predicted boxes better align with the edges of the ground truth boxes, while NWD focuses on the position and scale matching of the overall boxes. The two complement each other in the target localization task, synergistically improving the accuracy of boundary regression. In summary, introducing NWD not only optimized the performance of the localization loss function but also enhanced the stability and robustness of the entire detection network to a certain extent.
[0170] To further verify the effectiveness of the proposed method, a set of control experiments was designed in this specific embodiment to compare the performance of the YOLOv10 model, the YOLO-RSP model, and the YOLO-RSP+NWD model (which incorporates the NWD loss function into the YOLO-RSP model). The experiments mainly evaluated the model performance under different metrics, including precision, recall, mAP@50 (average precision at an IoU threshold of 0.5), and mAP@50-95 (average precision from IoU thresholds of 0.5 to 0.95). Table 8 shows the experimental results for the three models:
[0171] Table 8 Experimental results for different modules
[0172]
[0173] As shown in Table 8, the YOLOv10 model performs excellently across all metrics, but its performance is significantly improved after the upgrade. Specifically, the YOLO-RSP model's precision increased to 0.943, recall increased to 0.929, mAP@50 also significantly improved to 0.978, and mAP@50-95 reached 0.807. Compared to the YOLOv10 model's precision of 0.911, recall of 0.922, mAP@50 of 0.967, and mAP@50-95 of 0.782, the performance improvement is significant.
[0174] Furthermore, in the YOLO-RSP+NWD model, the addition of the NWD loss function further improved the precision to 0.950, the recall to 0.946, the mAP@50 to 0.979, and the mAP@50-95 to 0.801. Compared to the YOLO-RSP model, although mAP@50-95 decreased slightly, the improvement in precision and recall indicates that the introduction of the NWD loss function played a positive role in improving the model's detection capability and the accuracy of target recognition.
[0175] In summary, the addition of the NWD loss function significantly improves YOLOv10's performance in small object detection, especially in bounding box scale matching and precise localization. Experimental results show that NWD, combined with Box Loss, Cls Loss, and DFLLOss, further optimizes detection accuracy while maintaining a good balance in computational cost. Comparative experiments show that the YOLO-RSP model significantly improves the accuracy and recall of YOLOv10 by introducing improved strategies, especially in mAP@50. The YOLO-RSP+NWD model further optimizes performance by introducing the NWD loss function. Although there is a slight decrease in mAP@50-95, the overall improvement in accuracy and recall demonstrates the effectiveness of the NWD loss function in improving model accuracy. Overall, the YOLO-RSP model in this specific embodiment demonstrates better performance than the traditional YOLOv10 across multiple evaluation metrics.
[0176] 6) Step S6: Input the validation set into the trained YOLO-RSP model for optimization.
[0177] 7) Step S7: Input the test set into the final optimized YOLO-RSP model to obtain the classification and localization detection results of different lesions in the test set.
[0178] In this specific embodiment, we also conducted the same comparative experiment on a public dataset and demonstrated the performance difference between the YOLO-RSP model and the traditional YOLOv10 model. The experimental results on the public dataset further validated the superiority of the YOLO-RSP model in different data environments, providing a more reliable basis for the model's practical application. Figure 6a , Figure 6b ,and Figure 6c The test results are presented on a public dataset. In each image, the size and location of the bounding box, as well as the confidence score, are clearly displayed for easy comparison of the detection capabilities of each model. Figure 6a , Figure 6b ,and Figure 6c As can be seen, the YOLO-RSP model also demonstrates strong detection performance on publicly available datasets, capable of identifying more lesion regions with blurred boundaries or smaller sizes in complex scenes and achieving more accurate target localization. Compared to the original YOLOv10, the YOLO-RSP model exhibits stronger target perception and localization accuracy, validating its good generalization ability across different datasets. Therefore, the endoscopic image lesion detection method proposed in this invention has significant advantages and practicality.
[0179] The above description is merely a preferred embodiment of the present invention and is not intended to limit the invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A method for detecting lesions in endoscopic images, characterized in that, include: Step S1: Obtain the endoscopic image dataset; Step S2: Preprocess the endoscopic image dataset; Step S3: Divide the preprocessed endoscopic image dataset into training set, validation set and test set according to a preset ratio; Step S4: Build the YOLO-RSP model; wherein, the YOLO-RSP model is an improved model based on the YOLOv10 network; the YOLO-RSP model includes: a backbone network, a neck network, and a detection head network; The backbone network is used to receive the preprocessed endoscopic image dataset and extract features from the preprocessed endoscopic image dataset to generate feature maps at different scales. The neck network is used to fuse feature maps of different scales generated by the backbone network and pass the fused feature maps of different scales to the detection head network. The detection head network is used to receive fused feature maps of different scales and output classification and localization detection results of different lesions in the endoscopic image dataset based on the fused feature maps of different scales. The backbone network specifically includes: a first convolutional module, a second convolutional module, a first RSD-OSA module, a third convolutional module, a second RSD-OSA module, a first SCDown module, a third RSD-OSA module, a second SCDown module, a first C2fCIB module, an SPPF module, and a PSCoordATT module that are interconnected. The preprocessed endoscopic image dataset is convolved through the first convolution module to adjust the number of channels, resulting in feature map C1; the feature map C1 Feature map C2 is obtained by performing convolution operations through the second convolution module to extract high-level image features. Feature map C2 is then subjected to convolution and reparameterization operations through the first RSD-OSA module to enhance the perception of lesions of different sizes and reduce the model parameters, resulting in feature map C3. Feature map C3 is then subjected to convolution operations through the third convolution module to fuse features, resulting in feature map C4. Feature map C4 is then subjected to reparameterization and channel shuffling operations through the second RSD-OSA module to fuse features, resulting in feature map C5. Feature map C5 is then subjected to downsampling operations through the first SCDown module to reduce the feature map size and reduce the model parameters, resulting in feature map C6. Feature map C6 is then subjected to convolution and reparameterization operations through the third RSD-OSA module to fuse features, resulting in feature map C7. Feature map C7 is then subjected to downsampling operations through the second SCDown module to extract high-dimensional features and reduce the model parameters, resulting in feature map C8. Feature map C8 is then subjected to convolution operations through the first C2fCIB module. The module performs convolution and channel confusion operations to improve feature fusion capability, resulting in feature map C9; feature map C9 is then subjected to spatial pyramid pooling fast operation by the SPPF module to fuse multi-scale receptive field features, resulting in feature map C10; feature map C10 is then subjected to attention operation by the PSCoordATT module to increase the weight of key regions, resulting in feature map C11. The neck network specifically includes: a first upsample module, a first Concat module, a fourth RSD-OSA module, a second upsample module, a second Concat module, a fifth RSD-OSA module, a CBS module, a third Concat module, a second C2fCIB module, a third SCDown module, a fourth Concat module, and a third C2fCIB module that are interconnected. Specifically, feature map C11 undergoes upsampling through the first upsample module to extract high-dimensional information parameters, resulting in feature map C12; feature map C12 and feature map C7 are fused through the first Concat module to obtain feature map C13; feature map C13 undergoes convolution and channel obfuscation operations through the fourth RSD-OSA module to fuse features, resulting in feature map C14; feature map C14 undergoes upsampling through the second upsample module to extract features of different dimensions, resulting in feature map C15; feature map C15 and feature map C5 are fused through the second Concat module to obtain feature map C16; feature map C16 is cascaded through the fifth RSD-OSA module to obtain... Features at different depths are extracted to obtain feature map C17; feature map C17 is convolved through the CBS module for feature compression to obtain feature map C18; feature map C18 and feature map C14 are fused through the third Concat module to obtain feature map C19; feature map C19 is refined and enhanced through compact inverted bottleneck convolution through the second C2fCIB module to obtain feature map C20; feature map C20 is max-pooled through the third SCDown module to retain high-frequency information to obtain feature map C21; feature map C21 and feature map C11 are fused through the fourth Concat module to obtain feature map C22; feature map C22 is recombined through multi-branch feature fusion through the third C2fCIB module to improve feature extraction capability to obtain feature map C23. The detection head network specifically includes: three independent detection heads: a first detection head, a second detection head, and a third detection head; each independent detection head consists of a one-to-one head and a one-to-many head; each one-to-one head and each one-to-many head consists of a classification head and a regression head; the classification head is responsible for predicting the category to which each bounding box belongs; the regression head is responsible for predicting the location of the bounding box. The first detection head is used to receive the feature map C17 and output the classification and localization detection results of different lesions in the endoscopic image dataset based on the feature map C17; the second detection head is used to receive the feature map C20 and output the classification and localization detection results of different lesions in the endoscopic image dataset based on the feature map C20; the third detection head is used to receive the feature map C23 and output the classification and localization detection results of different lesions in the endoscopic image dataset based on the feature map C23. Step S5: Based on the constructed loss function, train the YOLO-RSP model using the training set; Step S6: Input the validation set into the trained YOLO-RSP model for optimization; Step S7: Input the test set into the final optimized YOLO-RSP model to obtain the classification and localization detection results of different lesions in the test set; Each RSD-OSA module specifically includes: a first RepVGG module, a first RSD module, a second RSD module, a channel shuffling module, a fifth Concat module, and a second RepVGG module that are interconnected. In this process, the input features of each RSD-OSA module are passed through the first RepVGG module to obtain feature map C100; feature map C100 is input to the first RSD module for deep feature extraction to obtain feature map C101; feature map C101 is input to the second RSD module for deep feature extraction to obtain feature map C102; feature maps C100, C101, and C102 are subjected to channel shuffling by the channel shuffling module, and then the feature maps after channel shuffling are input to the fifth Concat module for feature fusion to obtain feature map C103; feature map C103 is passed through the second RepVGG module for feature transmission and feature output. The PSCoordATT module specifically includes: a fourth convolutional module, a CoordAtt module, a sixth Concat module, a fifth convolutional module, a sixth convolutional module, a seventh Concat module, and a seventh convolutional module that are interconnected. In this process, the input features of the PSCoordATT module are convolved by the fourth convolution module to extract features, resulting in feature map C104. Feature map C104 is then input to the CoordAtt module for attention weighting to enhance the feature weights of key parts, resulting in feature map C105. Feature maps C105 and C104 are simultaneously input to the sixth Concat module for feature fusion, resulting in feature map C106. Feature map C106 is then input to the fifth convolution module for convolution to extract depth features, resulting in feature map C107. Feature map C107 is then input to the sixth convolution module for convolution to extract features, resulting in feature map C108. Feature maps C108, C104, and C106 are simultaneously input to the seventh Concat module for feature fusion, resulting in feature map C109. Feature map C109 is then convolved by the seventh convolution module before feature output. The constructed loss function is the NWD loss function; the NWD loss function is a loss function based on normalized Wasserstein distance. The mathematical expression corresponding to the NWD loss function is: (1) In equation (1), Represents the actual target bounding box; Indicates the prediction box; The Gaussian distribution representing the center point of the true target bounding box; The Gaussian distribution representing the center point of the prediction box; Represents the second-order Wasserstein distance; Indicates the normalization factor; This represents the average center point value of the true target bounding box. This represents the mean value of the center point of the prediction box; The covariance matrix representing the center points of the true target bounding box; The covariance matrix of the center point of the prediction box; The mathematical expression corresponding to the second-order Wasserstein distance is: (2) In equation (2), This represents the distance offset from the center point; This represents the trace of the calculated covariance matrix, which is used to measure the degree of scale fit.
2. The endoscopic image lesion detection method according to claim 1, characterized in that, Step S2 specifically includes: Step S2.1: Perform data annotation and unified conversion of the data annotation format on the endoscopic image dataset; Step S2.2: Perform data augmentation on the endoscopic image dataset.
Citation Information
Patent Citations
Improved CT image pulmonary nodule detection method and device and storage medium
CN117422913A
ACU-YOLO deep learning method for rapid human body acupoint recognition
CN119181111A