A colon polyp target detection method and system based on improved YOLOv8

By embedding attention mechanism module in the YOLOv8 model, the problems of small, blurred boundary, irregular shape and low contrast colon polyps detection accuracy and high leakage detection rate in the prior art are solved, and higher detection accuracy and lower leakage detection rate are achieved.

CN119131369BActive Publication Date: 2025-04-04南昌大学第一附属医院
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411603802.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-11-12
Publication Date
2025-04-04
Estimated Expiration
2044-11-12

AI Technical Summary

Technical Problem

The prior art detects small, blurred boundary, irregular shape and low contrast colon polyps, with low detection accuracy and high missed detection rate.

Method used

The attention mechanism module is embedded in the Backbone and Neck sections of the YOLOv8 model, including the first attention mechanism module and the second attention mechanism module to enhance the characteristic information of small goals and irregular boundary goals.

Benefits of technology

The accuracy of colon polyps detection is significantly improved, especially in complex background or low contrast detection tasks, reducing missed detection and improving detection capabilities for small targets and irregular shapes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119131369B_ABST
    Figure CN119131369B_ABST
Patent Text Reader

Abstract

The present application relates to the field of medical detection technology, and specifically discloses a colon polyp target detection method and system based on improved YOLOv8, the method comprising obtaining an image data set of colon polyps, preprocessing the image data set, and dividing the preprocessed image data set into a training set, a validation set, and a test set; building an improved detection model, wherein the first attention mechanism module is embedded in the C2f module of the network structure part of the basic model, and the second attention mechanism module is embedded in the C2f module of another network structure part, the training set is input into the improved model for iterative training, and the performance of the trained model is evaluated based on the validation set to obtain an optimized colon polyp target inspection model; the test set is input into the colon polyp target inspection model to obtain a colon polyp target inspection result, and the method improves the detection accuracy of small target detection and colon polyp targets with blurred boundaries.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of medical detection technology, and in particular to a method and system for detecting colon polyps based on improved YOLOv8. Background Art

[0002] Colon polyps refer to abnormal growths of tissue that form on the inner wall of the colon. Although most polyps are benign, they may develop into colorectal cancer. Early detection of polyps is crucial to preventing colorectal cancer.

[0003] In recent years, YOLO (You Only Look Once), as a classic real-time target detection algorithm, has demonstrated high detection speed and certain accuracy in the field of medical imaging, especially in polyp detection. It has a lighter network structure, higher detection accuracy and real-time performance. However, YOLOv8 has limitations in detecting small targets with blurred boundaries, especially in complex backgrounds, such as intestinal folds or images with impurities, which can easily lead to missed detections and reduced accuracy.

[0004] In order to further improve the accuracy of polyp detection, existing technologies have attempted to enhance the recognition ability of small targets by improving the structure of the YOLO model. For example, in the field of target detection, some improvement schemes have been proposed, such as introducing feature pyramid structures or multi-scale detection technology, aiming to improve the model's detection performance of small targets in complex scenes. However, current research on medical imaging still lacks a detection model specifically optimized for irregular edges and low-contrast polyps. Therefore, how to effectively improve the detection accuracy of colon polyps, especially the detection of small, irregularly shaped, and fuzzy-bounded polyps, is still a technical problem that needs to be solved urgently. Summary of the invention

[0005] The present application aims to solve the problems of low detection accuracy and high missed detection rate of target detection methods in the prior art for small, fuzzy-boundary, irregularly shaped and low-contrast colon polyps. Based on this, a colon polyp target detection method and system based on improved YOLOv8 are proposed.

[0006] In order to achieve the above objectives, in a first aspect, the present application provides a method for detecting colon polyps based on an improved YOLOv8, comprising:

[0007] Acquire an image dataset of colon polyps, preprocess the image dataset, and divide the preprocessed image dataset into a training set, a validation set, and a test set;

[0008] Building an improved YOLOv8 model, including embedding a first attention mechanism module in the second C2f and third C2f modules of the Backbone part of the YOLOv8 basic model, and embedding a second attention mechanism module in the second C2f and third C2f modules of the Neck part;

[0009] Inputting the training set into the improved YOLOv8 model for iterative training, and performing performance evaluation on the trained model based on the validation set to obtain an optimized colon polyp target inspection model;

[0010] The test set is input into the colon polyp target inspection model to obtain the corresponding colon polyp target inspection result.

[0011] In some embodiments that may be implemented, in the step of embedding the first attention mechanism module in the second C2f and third C2f modules of the Backbone part of the YOLOv8 base model, the data processing process of the first attention mechanism module includes:

[0012] The input feature map is transformed through convolution operation to generate an output feature map with twice the number of channels as the original input feature map;

[0013] The output feature map is split along the channel dimension and is split into two feature maps through a chunk operation, and the two feature maps are used as the basis for subsequent feature fusion;

[0014] Calculating a portion of the feature maps to obtain corresponding feature weights, and enhancing local feature expressions of the corresponding feature maps based on the feature weights;

[0015] The enhanced feature map is superimposed with the input feature map with the same number of corresponding channels to retain the initial features and enhance the detail and boundary expression ability of the feature map.

[0016] In some possible embodiments, the output feature map is segmented along the channel dimension and is segmented into two feature maps through a chunk operation. The two feature maps are used as a basis for subsequent feature fusion, including:

[0017] The two-part feature map includes a first part feature map and a second part feature map. The first part feature map and the second part feature map have the same number of feature channels. The first part feature map is used to retain basic features, and the second part feature map is used as a subsequent feature fusion enhancement.

[0018] In some possible embodiments, the step of calculating a portion of the feature maps to obtain corresponding feature weights, and enhancing the local feature expression of the corresponding feature maps based on the feature weights, includes:

[0019] For each feature map of the second part of feature maps, calculating the difference between the feature map and the mean of each channel, and squaring the difference to obtain a square difference feature map;

[0020] Normalizing the squared difference feature map to generate an attention map, where the attention map is used to characterize the feature weight of each position in the feature map;

[0021] The attention map is element-wise multiplied by the second part feature map to obtain a reweighted feature map.

[0022] In some possible embodiments, the normalizing the squared difference feature map to generate an attention map, where the attention map is used to characterize the feature weight of each position in the feature map, includes:

[0023] The calculation expression of the normalization process is:

[0024] In the formula, Indicates that the feature map is The value of the position, represents the mean value of the channel, n is a constant, To learn the parameters.

[0025] In some embodiments that may be implemented, the step of performing element-by-element multiplication of the attention map and the second part of the feature map to obtain a reweighted feature map includes:

[0026] The element-by-element multiplication calculation expression is:

[0027] in, , Indicates that the feature map is The value of the position, Indicates that the feature map is The normalized value of the position.

[0028] In some possible embodiments, in the step of embedding the second attention mechanism module in the second C2f and third C2f modules of the Neck part, the data processing process of the second attention mechanism module includes:

[0029] Adaptively average pool the input original feature map to obtain the global information of each channel;

[0030] Performing a convolution operation on each channel to adjust the weight of each channel, and performing nonlinear processing on the weight to obtain an attention weight of each channel;

[0031] Multiplying the attention weight by the original feature map element by element to generate a re-weighted enhanced feature map;

[0032] The enhanced feature maps are spliced ​​in the channel dimension, and the spliced ​​feature maps are convolutionally fused and output.

[0033] Compared with the prior art, the technical solution provided by the embodiment of the present application includes at least the following beneficial effects or advantages:

[0034] The method of the present application builds an improved YOLOv8 model for colon polyp target detection. Specifically, a first attention mechanism module is embedded in the second C2f and third C2f modules of the Backbone part of the YOLOv8 basic model, and a second attention mechanism module is embedded in the second C2f and third C2f modules of the Neck part. The first attention mechanism module can adaptively enhance the feature information of small targets and irregular boundary targets for colon polyps, thereby improving the detection accuracy of the model, especially in the colon polyp detection task with complex background or low contrast, it has a significant improvement effect. The second attention mechanism can effectively improve the model's detection ability for targets in complex backgrounds, which not only enhances the network's sensitivity and discrimination to features, but also improves the model's ability to capture subtle features. In this way, when performing target detection on colon polyps, it is not easy to miss detection in complex backgrounds such as intestinal folds or images with impurities, and at the same time improves the detection accuracy of small target detection, irregular shapes and colon polyp targets with blurred boundaries.

[0035] In a second aspect, the present application provides a colon polyp target detection system based on improved YOLOv8, comprising:

[0036] an acquisition module, configured to acquire an image dataset of colon polyps, preprocess the image dataset, and divide the preprocessed image dataset into a training set, a validation set, and a test set;

[0037] The model building module is configured to build an improved YOLOv8 model, wherein the first attention mechanism module is embedded in the second C2f and third C2f modules of the Backbone part of the YOLOv8 basic model, and the second attention mechanism module is embedded in the second C2f and third C2f modules of the Neck part;

[0038] A model optimization module is configured to input the training set into the improved YOLOv8 model for iterative training, and to perform performance evaluation on the trained model based on the validation set to obtain an optimized colon polyp target inspection model;

[0039] The data processing module is configured to input the test set into the colon polyp target inspection model to obtain corresponding colon polyp target inspection results.

[0040] In a third aspect, the present application further provides an electronic device, including:

[0041] at least one processor; and

[0042] a memory communicatively connected to the at least one processor; wherein,

[0043] The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the steps of the colon polyp target detection method based on improved YOLOv8 provided in the first aspect above.

[0044] In a fourth aspect, the present application also provides a computer-readable storage medium having computer program instructions stored thereon, and when the computer program instructions are executed by a processor, the steps of the colon polyp target detection method based on improved YOLOv8 provided in the first aspect are implemented.

[0045] It can be understood that the beneficial effects of the technical solutions provided in the second, third and fourth aspects can be found in the relevant description of the first aspect, and will not be repeated here.

[0046] Additional aspects and advantages of the present application will be given in part in the description below, and in part will become apparent from the description below, or will be learned through the practice of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0047] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0048] Figure 1 It is a flow chart of a method for detecting colon polyps based on improved YOLOv8 according to an embodiment of the present application;

[0049] Figure 2 It is a data processing flow chart of the improved YOLOv8 model shown in an embodiment of the present application;

[0050] Figure 3 It is a sub-flow chart of a colon polyp target detection method based on improved YOLOv8 according to an embodiment of the present application;

[0051] Figure 4is another sub-flow chart of a method for detecting colon polyps based on improved YOLOv8 according to an embodiment of the present application;

[0052] Figure 5 It is a detection result diagram based on the existing YOLOv8n model shown in an embodiment of the present application;

[0053] Figure 6 It is a detection result diagram based on the improved SAES-YOLOv8 model shown in an embodiment of the present application;

[0054] Figure 7 is another detection result diagram based on the existing YOLOv8n model shown in an embodiment of the present application;

[0055] Figure 8 is another detection result diagram based on the improved SAES-YOLOv8 model shown in an embodiment of the present application;

[0056] Fig. 9 It is a block diagram of a colon polyp target detection system based on improved YOLOv8 according to an embodiment of the present application;

[0057] Fig.10 It is a structural block diagram of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION

[0058] The embodiments of the present application are described in detail below. The embodiments described with reference to the accompanying drawings are exemplary. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0059] It should be noted that, unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein in the specification of this application are only for the purpose of describing specific implementations and are not intended to limit this application. The term "and / or" used herein includes any and all combinations of one or more of the related listed items.

[0060] See also Figures 1 to 4 , Figure 1 The flowchart of the colon polyp target detection method based on improved YOLOv8 provided in this embodiment is shown. Figure 2 The data processing flow chart of the improved YOLOv8 model provided by this implementation is shown, Figure 3 A sub-flow chart of the colon polyp target detection method based on improved YOLOv8 provided in this implementation is shown, Figure 4 Another sub-flowchart of the colon polyp target detection method based on improved YOLOv8 provided by this embodiment is shown.

[0061] like Figures 1 to 4 As shown, this embodiment provides a colon polyp target detection method based on improved YOLOv8, including:

[0062] Step S100: acquiring an image dataset of colon polyps, preprocessing the image dataset, and dividing the preprocessed image dataset into a training set, a validation set, and a test set;

[0063] In this step, the original colon polyp image data set can be obtained by obtaining image data saved from historical diagnoses. During the data processing process, the image data set can be stored in a database, so that when a subsequent model needs an image data set, the corresponding database can be used to load image data for colon polyp target detection. Data storage and transmission in the database are existing technologies and will not be elaborated here.

[0064] Optionally, a colon polyp image dataset is collected, and the X-AnyLAbeling image annotation tool can be used to annotate defect targets in the collected image data and build a sample database to facilitate subsequent model training and optimization.

[0065] Of course, since the collected image data set still has a lot of noise or uneven image size, the image data set can be preprocessed. The preprocessing may include image scaling and cropping, image smoothing, image format conversion or histogram equalization processing, etc. The specific preprocessing can be selected according to actual needs and is not limited here.

[0066] In order to facilitate the subsequent model training optimization, the preprocessed image dataset needs to be divided into training set, validation set and test set. For the amount of data contained in the training set, validation set and test set, the image dataset can be divided into 70% training set, 20% validation set and 10% test set for subsequent model training and performance verification.

[0067] Step S200: building an improved YOLOv8 model, including embedding a first attention mechanism module in the second C2f and third C2f modules of the Backbone part of the YOLOv8 basic model, and embedding a second attention mechanism module in the second C2f and third C2f modules of the Neck part;

[0068] In this step, it should be noted that the colon polyp target detection method implemented in this embodiment is based on the improved YOLOv8 model. For the YOLOv8 basic model, it can be combined with Figure 2 As shown in Figure 1, the architecture of YOLOv8 mainly includes Backbone, Neck and Detect network structures. Since the YOLOv8 basic model is an existing model, Figure 2Part of the Backbone, Neck, and Detect network structures shown in FIG. 1 are not described in detail here.

[0069] In actual applications, it is found that for the YOLOv8 basic model, YOLOv8 has limitations in detecting small targets with blurred boundaries, especially in complex backgrounds, such as intestinal folds or images with impurities, which are prone to missed detection and reduced accuracy. Of course, the existing technology also attempts to enhance the recognition ability of small targets by improving the structure of the YOLO model. For example, in the field of target detection, such as introducing feature pyramid structures or multi-scale detection technology, the purpose is to improve the model's detection performance for small targets in complex scenes. However, current research on medical imaging still lacks a detection model specifically optimized for irregular edges and low-contrast polyps. Therefore, the model proposed in this embodiment is specifically optimized for the detection of irregular edges and low-contrast polyps.

[0070] In some embodiments, a first attention mechanism module is embedded in the second C2f and third C2f modules of the Backbone part of the YOLOv8 base model, and a second attention mechanism module is embedded in the second C2f and third C2f modules of the Neck part. Preferably, the first attention mechanism module may be a SimAM (Simple Adaptive Module) module, and the second attention mechanism module may be an EffectiveSE (Effective Squeeze-and-Excitation) module.

[0071] Optionally, the SimAM module is embedded in the C2f structure to form the C2f_SimAM module, and the 4th and 6th C2f modules of the YOLOv8 model backbone are replaced; at the same time, the EffectiveSE is embedded in the C2f structure to form the C2f_EffectiveSE module, which replaces the 15th and 18th C2f modules of the YOLOv8 model neck. In this way, in the 4th and 6th layers of the YOLOv8 model backbone, the original C2f modules are replaced by the C2f_SimAM module. In view of the complex edges and morphology of colon polyps, the C2f_SimAM module embeds the SimAM attention mechanism into the C2f structure, first performs channel expansion and convolution processing, and then uses the SimAM module to adaptively correct the spatial features to achieve feature branch fusion and output at different scales.

[0072] Optionally, in the 15th and 18th layers of the YOLOv8 model neck, the original C2f module is replaced by the C2f_EffectiveSE module. In order to handle the complex relationship between the local and global feature information of colon polyps, the C2f_EffectiveSE module combines the EffectiveSE attention mechanism, first performs channel convolution expansion on the features, and then completes feature fusion and output through global average pooling and channel feature adjustment. By embedding the SimAM module in the 4th and 6th layers of the backbone, and embedding the EffectiveSE module in the 15th and 18th layers of the neck, an improved YOLOv8 model structure is formed. This model processes and fuses features at different levels for the complex characteristics of colon polyps, and optimizes and adjusts the overall architecture.

[0073] Combination Figure 2 As shown, after the attention mechanism module is embedded, the Backbone network includes a first convolution module, a second convolution module, a first C2f module, a third convolution module, a first C2f_SimAM module, a fourth convolution module, a second C2f_SimAM module, a fifth convolution module, a second C2f module, and an SPPF module connected in sequence; wherein the first C2f_SimAM module is connected to the second aggregation module, the second C2f_SimAM module is connected to the first aggregation module, and the SPPF module is simultaneously connected to the first upsampling module and the fourth aggregation module; the Neck network includes a first upsampling module, a first aggregation module, a third C2f module, a second upsampling module, a second aggregation module, a first C2f_EffectiveSE module, a first Conv convolution module, a third aggregation module, a second C2f_EffectiveSE module, a second Conv convolution module, a fourth aggregation module, and a fourth C2f module connected in sequence; the third C2f module is connected to the third aggregation module.

[0074] Optionally, the detection head Detect includes three identical decoupling heads, which are used to predict the type and position of the target. The original detection head of YOLOv8 is maintained in the algorithm. The first C2f_EffectiveSE module, the second C2f_EffectiveSE module, and the fourth C2f module are respectively connected to the three decoupling heads of Detect.

[0075] In some embodiments, Figure 3 As shown, the data processing process of the first attention mechanism module includes:

[0076] Step S211: performing feature transformation on the input feature map through a convolution operation to generate an output feature map with twice the number of channels as the original input feature map;

[0077] In this step, it can be understood that the input feature map is the image data of colon polyps input to the model. In the improved YOLOv8 model, the input feature map is first subjected to a preliminary feature transformation through a convolutional layer Conv to generate a feature map with twice the number of channels of the original input.

[0078] Step S212: The output feature map is divided along the channel dimension and divided into two feature maps through a chunk operation, and the two feature maps are used as the basis for subsequent feature fusion;

[0079] In this step, the two-part feature map includes a first-part feature map and a second-part feature map. The first-part feature map and the second-part feature map have the same number of feature channels. The first-part feature map is used to retain basic features, and the second-part feature map is used as a subsequent feature fusion enhancement.

[0080] Specifically, the output feature map is then split along the channel dimension, and the feature map is divided into two parts through the chunk operation, each containing the same number of feature channels. The first part is used to retain the basic features, while the second part will be further processed. The feature map of the second part is processed by the SimAM_Bottleneck submodules in turn. Each SimAM_Bottleneck submodule first performs a convolution operation on the feature map through the convolution layer Conv to reduce the number of channels and perform local feature extraction, and then passes through the SimAM module for processing.

[0081] Step S213: Calculate a portion of the feature maps to obtain corresponding feature weights, and enhance the local feature expression of the corresponding feature maps based on the feature weights;

[0082] In this step, the difference between each feature map of the second part and the mean of each channel is calculated, and the difference is squared to obtain a square difference feature map; the square difference feature map is normalized to generate an attention map, which is used to characterize the feature weights of each position in the feature map; the attention map is element-wise multiplied with the feature map of the second part to enhance the areas with high weights and realize the detection of small targets and complex boundaries.

[0083] In one example, the feature map in the SimAM module is firstly averaged to obtain the mean deviation of the feature map, and then the square deviation from the mean is calculated through a square operation. The key step of the SimAM module is to adjust this information to feature weights in the range of [0,1] by normalizing the square deviation of the mean. Finally, these weights are adjusted through the Sigmoid activation function and multiplied with the input feature map to enhance the local feature expression.

[0084] Optionally, for each input feature map, calculate its mean with each channel The difference between them is squared to obtain the square difference feature map

[0085] in, Indicates that the feature map is The value of the position, Indicates the mean value of the channel.

[0086] The squared difference feature map is normalized to generate an attention map. The attention map is used to characterize the feature weights of each position in the feature map. The calculation expression for the normalization is:

[0087] In the formula, Indicates that the feature map is The value of the position, represents the mean value of the channel, n is a constant, To learn the parameters.

[0088] Optionally, the normalized feature map is used to generate an attention map through the Sigmoid activation function σ. The attention map is used to identify which areas are more important. The Sigmoid activation function expression is , multiply the attention map by the feature map of the second part element by element to enhance the area with high weight and realize the detection of small targets and complex boundaries. The element-by-element multiplication calculation expression is: ;

[0089] in, Indicates that the feature map is The value of the position, Indicates that the feature map is The normalized value of the position.

[0090] Step S214: superimpose the enhanced feature map with the input feature map having the same number of corresponding channels to retain the initial features and enhance the detail and boundary expression capability of the feature map.

[0091] In this step, the processed and enhanced feature map is fed back to SimAM_Bottleneck and added to the input feature map through residual connection (when the number of channels is the same) to retain the initial features and enhance the details and boundary expression ability of the feature map. After all submodules are processed, the feature map processed by the SimAM_Bottleneck module is concatenated with the initial feature map in the channel dimension and passed through the convolution layer Conv((2 + n) self.c, c2, 1) perform feature fusion to obtain the output feature map of the C2f_SimAM module.

[0092] After the above processing, the C2f_SimAM module can adaptively enhance the feature information of small targets and targets with irregular boundaries, thereby improving the detection accuracy of the model, especially in the task of detecting colon polyps with complex backgrounds or low contrast, with a significant improvement effect.

[0093] In some embodiments, Figure 4 As shown, the data processing process of the second attention mechanism module includes:

[0094] Step S221: Adaptively average pool the input original feature map to obtain global information of each channel;

[0095] In this step, the second attention mechanism module can be an EffectiveSE module. Specifically, the initial processing and channel expansion of the feature map, the input feature map is first processed by Conv(c1, 2 self.c, 1, 1) performs convolution operation, expands to 2 times the number of channels, and generates feature maps for subsequent processing, channel segmentation and preliminary feature extraction. The expanded feature map is divided into two parts, which are used as inputs and continue to be processed by the EffectiveSE_Bottleneck sequence. The EffectiveSE_Bottleneck module first extracts features through convolution operation, and then enters the EffectiveSE module for processing.

[0096] Optionally, perform adaptive average pooling on the input original feature map to obtain each channel The global information of the adaptive average pooling formula is:

[0097] It should be noted that if add_maxpool is enabled, the result of the maximum pooling is combined: .

[0098] Step S222: performing a convolution operation on each channel to adjust the weight of each channel, and performing nonlinear processing on the weight to obtain an attention weight of each channel;

[0099] In this step, the channel weight calculation includes: the global feature is adjusted through the 1x1 convolution layer channel weight, the weight is activated by the Sigmoid function Perform nonlinear processing, such as the Sigmoid activation function mentioned above Compute the description and then output the attention weights for each channel: ,

[0100] Step S223: multiplying the attention weight by the original feature map element by element to generate a re-weighted enhanced feature map;

[0101] In this step, the original feature map is multiplied element by element with the calculated channel attention weight to generate a reweighted feature map to enhance the expressiveness of important features. The calculation formula is: s , where is the original feature map element, is the attention weight.

[0102] Step S224: splicing the enhanced feature maps in the channel dimension, and performing convolution fusion on the spliced ​​feature maps and outputting them.

[0103] In this step, all processed feature maps are concatenated in the channel dimension and then fused through the convolution operation Conv to generate the final output. It should be noted that through the processing of the EffectiveSE module, C2f_EffectiveSE can effectively improve the model's ability to detect targets in complex backgrounds. It not only enhances the network's sensitivity and discrimination to features, but also improves the model's ability to capture subtle features through flexible channel operations and attention mechanisms.

[0104] Step S300: inputting the training set into the improved YOLOv8 model for iterative training, and performing performance evaluation on the trained model based on the validation set to obtain an optimized colon polyp target inspection model;

[0105] In this step, an improved YOLOv8 model is built through step S200. Specifically, the improved YOLOv8 colon polyp target detection model is trained and verified based on the training set and the verification set to obtain the optimal colon polyp target detection model. It should be noted that the training and verification process is a prior art and will not be elaborated here. It is worth noting that different CUDA versions may cause differences between model training results. The improved YOLOv8 model experimental environment in this embodiment can be an NVIDIA GeForce RTX 3090 graphics card, using CUDA version 11.7 and PyTorch version 2.0.0. The training parameter settings can be as shown in Table 1. The optimized colon polyp target inspection model is obtained through training and verification.

[0106] Table 1 shows the improved YOLOv8 model training parameters

[0107]

[0108] Step S400: inputting the test set into the colon polyp target inspection model to obtain corresponding colon polyp target inspection results.

[0109] In this step, the test set may be the colon polyp image data to be processed and collected for detection, and the corresponding colon polyp target inspection result is obtained by inputting the image data into the colon polyp target inspection model.

[0110] It should be noted that the above-mentioned embodiment method steps are used for colon polyp target detection by building an improved YOLOv8 model. Specifically, a first attention mechanism module is embedded in the second C2f and third C2f modules of the Backbone part of the YOLOv8 basic model, and a second attention mechanism module is embedded in the second C2f and third C2f modules of the Neck part. The first attention mechanism module can adaptively enhance the feature information of small targets and irregular boundary targets for colon polyps, thereby improving the detection accuracy of the model, especially in the colon polyp detection task with complex background or low contrast, it has a significant improvement effect. The second attention mechanism can effectively improve the model's detection ability for targets in complex backgrounds, which not only enhances the network's sensitivity and discrimination to features, but also improves the model's ability to capture subtle features. In this way, when performing target detection on colon polyps, it is not easy to miss detection in complex backgrounds, such as intestinal folds or images with impurities, and at the same time improves the detection accuracy of small target detection, irregular shapes and colon polyp targets with blurred boundaries.

[0111] See also Figures 5 to 8 , Figure 5 The detection result diagram based on the existing YOLOv8n model provided by this implementation is shown. Figure 6 The detection result diagram based on the improved SAES-YOLOv8 model provided by this implementation is shown. Figure 7 Another detection result diagram based on the existing YOLOv8n model provided by this implementation is shown, Figure 8 Another detection result diagram based on the improved SAES-YOLOv8 model provided by this implementation is shown.

[0112] like Figures 5 to 8 As shown, this embodiment provides an actual ablation comparison experiment between the colon polyp target inspection model based on the improved YOLOv8 in the above embodiment and the existing model. For the convenience of description, the above colon polyp target inspection model is uniformly described by the SAES-YOLOv8 model, and the content is as follows:

[0113] 1. Performance indicators

[0114] In the YOLO model series, the main indicators for evaluating network performance include precision (Precision, P), recall (Recall, R), mean average precision (mAP), etc. This experiment mainly uses mAP50 and mAP50:95 as performance reference indicators. Among them, mAP@0.5 refers to the mAP value when the IoU threshold is 0.5, and mAP@0.5:0.95 means the average mAP value when the IoU starts from 50% and increases to 95% with a step size of 0.05. The higher the average precision, the better the overall detection accuracy of the model. The calculation formulas for each indicator are as follows:

[0115]

[0116]

[0117]

[0118]

[0119] In the test, TP is the number of correctly predicted positive samples, FN is the number of incorrectly predicted negative samples, and FP is the number of incorrectly predicted positive samples. AP For accuracy.

[0120] When studying the optimization and improvement of performance, the number of model parameters and the amount of computation are also parameters that need to be considered, so the FLOPs and Params indicators need to be introduced. FLOPs refers to the number of floating-point operations required for the model to perform a forward propagation, reflecting the computational load of the model when processing a single input. Params refers to the total number of parameters in the model. The number of parameters is a direct indicator of the model size and affects the storage requirements of the model.

[0121] 2. Method Comparison

[0122] In order to comprehensively evaluate the performance of the C2f_SimAM module and the C2f_EffectiveSE module designed in the present invention, this embodiment adopts the method of ablation experiment. The experiment aims to verify the advantages of the embedded attention mechanism compared with the original module, especially in improving the performance of colon polyp target defect detection.

[0123] The experiment first used the original YOLOv8n model as the baseline model to test the colon polyp dataset. Preliminary experimental results show that the YOLOv8n model can achieve relatively good performance when dealing with medium and large targets such as colon polyps, with mAP@0.5 reaching 0.821, demonstrating its good recognition ability for the overall characteristics of the target. However, due to the complex and diverse characteristics of colon polyps, blurred edges and morphological diversity, the model's performance on mAP@0.5:0.95 is relatively weak, reaching only 0.460. This finding shows that there is still room for improvement in the YOLOv8n model for polyp detection with complex structures. Therefore, in subsequent experiments, we introduced the C2f_SimAM and C2f_EffectiveSE modules to improve the model from the perspectives of local feature enhancement and global feature channel reweighting, respectively.

[0124] From the ablation experiment comparison in Table 2, it can be seen that the C2f_SimAM module enhances the polyps with complex features through a local adaptive mechanism. After the introduction of the C2f_SimAM module, the model improved mAP@0.5 by 2.1% to 0.842, showing its enhanced effect on feature extraction. However, since C2f_SimAM focuses more on the adaptive adjustment of local features, it has a slight decrease in mAP@0.5:0.95, which has decreased by 0.9% to 0.451.

[0125] The C2f_EffectiveSE module improves the model's ability to capture polyp features by optimizing the global information interaction between channels. Compared with C2f_SimAM, C2f_EffectiveSE performs well in mAP@0.5:0.95, reaching 0.459, which is basically the same as the baseline model, and also has a slight improvement in mAP@0.5, increasing by 0.8% to 0.829. This shows that the EffectiveSE module effectively improves the model's detection ability in complex backgrounds, especially the stability of feature expression.

[0126] When the C2f_SimAM and C2f_EffectiveSE modules are introduced together (i.e., the SAES-YOLOv8 model in the above embodiment), the model shows the best overall performance. On mAP@0.5, SAES-YOLOv8 achieves a score of 0.853, which is 3.2% higher than the baseline model. More significantly, mAP@0.5:0.95 is increased to 0.477, which is 3.7% higher than the baseline model, proving that the combined improvement performs well in polyp detection tasks with complex features. It is worth noting that although two improved modules are introduced, the number of parameters and FLOPs of the model has hardly increased, remaining at 3.011M and 8.1G, demonstrating that this method maintains its lightweight characteristics while ensuring performance improvement.

[0127] Table 2 shows the comparison data of ablation experiments of various models

[0128]

[0129] 3. Detection effect analysis

[0130] As mentioned above, the original YOLOv8n model has certain limitations when dealing with complex features of polyp detection, especially in the performance index of mAP@0.5:0.95, which is relatively weak. This is mainly due to the complex structure, unclear edges and diverse morphology of colon polyps, which makes it difficult for the model to effectively distinguish the target area from the background.

[0131] Combination Figures 5 to 8 As shown, Figure 5 and Figure 7 The results of colon polyp detection using YOLOv8n are shown. Figure 6 and Figure 8 The results of colon polyp detection using the SAES-YOLOv8 model are shown. When using YOLOv8n for detection ( Figure 5 As shown in the figure, the model failed to successfully detect the target polyp in the figure, resulting in missed detection. This may be because the features of the polyp are too complex and the edges are not clear. YOLOv8n cannot effectively distinguish the target from the background in this scenario. After using the improved SAES-YOLOv8 model ( Figure 6 As shown in the figure, the target is successfully detected. This shows that by introducing the SimAM and EffectiveSE modules, the SAES-YOLOv8 model enhances the perception of complex structure polyps, especially the extraction and expression of subtle features.

[0132] In addition, Figure 7 In this case, YOLOv8n not only detects a false target, but also gives a low confidence score on another target ( Figure 7), showing a false positive and low confidence. This false positive may be due to the model being confused in distinguishing the polyp from complex structures in the background. Figure 8 In the case of using the SAES-YOLOv8 model ( Figure 8 As shown in the figure, false detections are eliminated and the confidence score of another target in the same scene is improved, indicating that the model not only reduces false detections but also identifies and judges targets more accurately.

[0133] By comparison, we can conclude that the SAES-YOLOv8 model is significantly better than the original YOLOv8n model in dealing with complex polyp detection scenarios. It effectively reduces missed detections and false detections, and improves the confidence of target detection, showing its superior performance in dealing with complex structures of colon polyps.

[0134] By introducing the C2f_SimAM and C2f_EffectiveSE modules, the SAES-YOLOv8 model designed by the present invention successfully solves this problem. The SimAM module improves the model's ability to recognize complex polyp edges and details through local adaptive enhancement, while the EffectiveSE module further improves the accuracy of feature expression through channel weight adjustment. Overall, the SAES-YOLOv8 model has achieved significant improvements in multiple indicators, especially in the evaluation standard of mAP@0.5:0.95, showing stronger comprehensive performance.

[0135] See also Fig. 9 , Fig. 9 A block diagram of a colon polyp target detection system based on improved YOLOv8 provided by this embodiment is shown. The colon polyp target detection system 200 based on improved YOLOv8 includes:

[0136] An acquisition module 210 is configured to acquire an image dataset of colon polyps, preprocess the image dataset, and divide the preprocessed image dataset into a training set, a validation set, and a test set;

[0137] The model building module 220 is configured to build an improved YOLOv8 model, including embedding a first attention mechanism module in the second C2f and third C2f modules of the Backbone part of the YOLOv8 basic model, and embedding a second attention mechanism module in the second C2f and third C2f modules of the Neck part;

[0138] The model optimization module 230 is configured to input the training set into the improved YOLOv8 model for iterative training, and to perform performance evaluation on the trained model based on the validation set to obtain an optimized colon polyp target inspection model;

[0139] The data processing module 240 is configured to input the test set into the colon polyp target inspection model to obtain the corresponding colon polyp target inspection result.

[0140] It can be understood that, in the implementation of the colon polyp target detection system 200 based on the improved YOLOv8 in this embodiment, each module runs the above Figures 1 to 4 The steps of a method for detecting colon polyps based on improved YOLOv8 in the corresponding embodiment, and the technical effects that can be achieved can be referred to the above Figures 1 to 4 The description of the technical effects achieved in the corresponding embodiments will not be repeated here.

[0141] See also Fig.10 , Fig.10 5 is a block diagram of an electronic device provided in an embodiment of the present application. The server 500 of the electronic device includes: a processor 501, a memory 502, and a computer program 503 stored in the memory 502 and executable on the processor 501, such as a program for a method for detecting colon polyps based on an improved YOLOv8. When the processor 501 executes the computer program 503, the steps of the method for detecting colon polyps based on an improved YOLOv8 in the above-mentioned embodiments are implemented, such as Figure 1 The corresponding embodiment of step S100 to step S500. Alternatively, the processor 501 executes the computer program 503 to implement the above Fig. 9 The functions of each module in the corresponding embodiment are, for example, Fig. 9 For details on the functions of the modules (eg, acquisition module 210), please refer to Fig. 9 The relevant descriptions in the corresponding embodiments are not repeated here.

[0142] Exemplarily, the computer program 503 may be divided into one or more units, one or more units are stored in the memory 502, and are executed by the processor 501 to complete the technical solution provided in the above embodiment. One or more units may be a series of computer program instruction segments that can complete specific functions, and the instruction segments are used to describe the execution process of the computer program 503 in the server 500.

[0143] The electronic device may include, but is not limited to, a processor 501 and a memory 502. Those skilled in the art will appreciate that Fig.10 It is only an example of the server 500 in the electronic device and does not constitute a limitation of the server 500. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, the turntable terminal device may also include an input and output terminal device, a network access terminal device, a bus, etc.

[0144] The processor 501 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.

[0145] The memory 502 may be an internal storage unit of the server 500, such as a hard disk or memory of the server 500. The memory 502 may also be an external storage terminal device of the server 500, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the server 500. Further, the memory 502 may also include both an internal storage unit of the server 500 and an external storage terminal device. The memory 502 is used to store computer programs and other programs and data required by the turntable terminal device. The memory 502 may also be used to temporarily store data that has been output or is to be output.

[0146] In some embodiments, a computer-readable storage medium is also provided, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the colon polyp target detection method based on improved YOLOv8 as described in the above embodiment are implemented.

[0147] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0148] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Among them, the computer-readable storage medium can be non-volatile or volatile. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable storage medium may include: any entity or device capable of carrying computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electrical carrier signal, telecommunication signal and software distribution medium, etc.

[0149] The terms "first", "second", "third", etc. in the specification and claims of the present application and the drawings are used to distinguish different objects rather than to describe a specific order. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a series of steps or units are included, or optionally, steps or units not listed are included, or optionally, other steps or units inherent to these processes, methods, products or devices are included.

[0150] Only the part relevant to the present application is shown in the accompanying drawings, but not all of the content. Before discussing the exemplary embodiments in more detail, it should be mentioned that some exemplary embodiments are described as processing or methods depicted as flow charts. Although the flow chart describes each operation (or step) as a sequential process, many of the operations therein can be implemented in parallel, concurrently or simultaneously. In addition, the order of each operation can be rearranged. When its operation is completed, the process can be terminated, but it can also have additional steps not included in the accompanying drawings. The process can correspond to a method, function, procedure, subroutine, subprogram, etc.

[0151] The terms "component", "module", "system", "unit", etc. used in this specification are used to represent computer-related entities, hardware, firmware, a combination of hardware and software, software, or software in execution. For example, a unit can be, but is not limited to, a process running on a processor, a processor, an object, an executable file, an execution thread, a program, and / or distributed between two or more computers. In addition, these units can be executed from various computer-readable media having various data structures stored thereon. Units can communicate through local and / or remote processes, for example, based on signals having one or more data packets (e.g., data from a second unit interacting with another unit in a local system, a distributed system, and / or a network. For example, the Internet interacts with other systems via signals).

[0152] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "illustrative embodiments", "examples", "specific examples", or "some examples" means that the specific features, structures, materials, or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example.

[0153] Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Mentioning "embodiment" in this article means that the specific features, structures or characteristics described in conjunction with the embodiment may be included in at least one embodiment of the present embodiment application. The appearance of this phrase in various positions in the specification is not necessarily the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It can be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.

[0154] Although the embodiments of the present application have been shown and described, those skilled in the art will appreciate that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present application, and that the scope of the present application is defined by the claims and their equivalents.

[0155] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the disclosure disclosed herein. The present application is intended to cover any modification, use or adaptation of the present application, which follows the general principles of the present application and includes common knowledge or customary techniques in the art that are not disclosed in the present application. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present application are indicated by the following claims.

Claims

1. A colon polyp target detection method based on improved YOLOv8, characterized in that: include: Acquire an image dataset of colon polyps, preprocess the image dataset, and divide the preprocessed image dataset into a training set, a validation set, and a test set; An improved YOLOv8 model is constructed, wherein the first attention mechanism module is embedded in the second C2f and third C2f modules of the Backbone part of the YOLOv8 basic model, and the second attention mechanism module is embedded in the second C2f and third C2f modules of the Neck part, wherein the first attention mechanism module is a SimAM module, the second attention mechanism module is an EffectiveSE module, and the data processing process of the first attention mechanism module includes: The input feature map is transformed through convolution operation to generate an output feature map with twice the number of channels as the original input feature map; The output feature map is divided along the channel dimension and divided into two feature maps through a chunk operation, wherein the two feature maps are used as a basis for subsequent feature fusion, wherein the two feature maps include a first feature map and a second feature map, the first feature map and the second feature map have the same number of feature channels, the first feature map is used to retain basic features, and the second feature map is used as a subsequent feature fusion enhancement; Calculating a portion of the feature maps to obtain corresponding feature weights, and enhancing the local feature expression of the corresponding feature maps based on the feature weights, wherein the difference between each feature map of the second portion of feature maps and the mean of each channel is calculated, and the difference is squared to obtain a square difference feature map; The square difference feature map is normalized to generate an attention map, where the attention map is used to characterize the feature weight of each position in the feature map, wherein the calculation expression of the normalization process is: In the formula, Indicates that the feature map is The value of the position, represents the mean value of the channel, n is a constant, is the learning parameter; The attention map is element-wise multiplied with the second part of the feature map to obtain a reweighted feature map, wherein the element-wise multiplication calculation expression is: in, , Indicates that the feature map is The value of the position, Indicates that the feature map is The normalized value of the position; The enhanced feature map is superimposed with the input feature map with the same number of corresponding channels to retain the initial features and enhance the detail and boundary expression ability of the feature map; Inputting the training set into the improved YOLOv8 model for iterative training, and performing performance evaluation on the trained model based on the validation set to obtain an optimized colon polyp target inspection model; The test set is input into the colon polyp target inspection model to obtain the corresponding colon polyp target inspection result.

2. According to claim 1, a method for detecting colon polyps based on improved YOLOv8, characterized in that: In the step of embedding the second attention mechanism module in the second C2f and third C2f modules of the Neck part, the data processing process of the second attention mechanism module includes: Adaptively average pool the input original feature map to obtain the global information of each channel; Performing a convolution operation on each channel to adjust the weight of each channel, and performing nonlinear processing on the weight to obtain an attention weight of each channel; Multiplying the attention weight by the original feature map element by element to generate a re-weighted enhanced feature map; The enhanced feature maps are spliced ​​in the channel dimension, and the spliced ​​enhanced feature maps are convolutionally fused and output.

3. A colon polyp target detection system based on improved YOLOv8, characterized in that: include: an acquisition module, configured to acquire an image dataset of colon polyps, preprocess the image dataset, and divide the preprocessed image dataset into a training set, a validation set, and a test set; The model building module is configured to build an improved YOLOv8 model, wherein the first attention mechanism module is embedded in the second C2f and third C2f modules of the Backbone part of the YOLOv8 basic model, and the second attention mechanism module is embedded in the second C2f and third C2f modules of the Neck part, wherein the first attention mechanism module is a SimAM module, the second attention mechanism module is an EffectiveSE module, and the data processing process of the first attention mechanism module includes: The input feature map is transformed through convolution operation to generate an output feature map with twice the number of channels as the original input feature map; The output feature map is divided along the channel dimension and divided into two feature maps through a chunk operation, wherein the two feature maps are used as a basis for subsequent feature fusion, wherein the two feature maps include a first feature map and a second feature map, the first feature map and the second feature map have the same number of feature channels, the first feature map is used to retain basic features, and the second feature map is used as a subsequent feature fusion enhancement; Calculating a portion of the feature maps to obtain corresponding feature weights, and enhancing the local feature expression of the corresponding feature maps based on the feature weights, wherein the difference between each feature map of the second portion of feature maps and the mean of each channel is calculated, and the difference is squared to obtain a square difference feature map; The square difference feature map is normalized to generate an attention map, where the attention map is used to characterize the feature weight of each position in the feature map, wherein the calculation expression of the normalization process is: In the formula, Indicates that the feature map is The value of the position, represents the mean value of the channel, n is a constant, is the learning parameter; The attention map is element-wise multiplied with the second part of the feature map to obtain a reweighted feature map, wherein the element-wise multiplication calculation expression is: in, , Indicates that the feature map is The value of the position, Indicates that the feature map is The normalized value of the position; The enhanced feature map is superimposed with the input feature map with the same number of corresponding channels to retain the initial features and enhance the detail and boundary expression ability of the feature map; A model optimization module is configured to input the training set into the improved YOLOv8 model for iterative training, and to perform performance evaluation on the trained model based on the validation set to obtain an optimized colon polyp target inspection model; The data processing module is configured to input the test set into the colon polyp target inspection model to obtain corresponding colon polyp target inspection results.

4. An electronic device, characterized in that: include: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can perform the steps of a colon polyp target detection method based on improved YOLOv8 as described in any one of claims 1-2.

5. A computer-readable storage medium having computer program instructions stored thereon, characterized in that: When the computer program instructions are executed by a processor, the steps of a colon polyp target detection method based on improved YOLOv8 according to any one of claims 1-2 are implemented.

Citation Information

Patent Citations

  • Colonoscope polyp image detection method based on Mamba and YOLOv8

    CN118762009A