Brain tumor MRI image detection method based on improved YOLOv8n

By improving the YOLOv8n model, using a lightweight backbone network based on StarNet and the C2f_Star module, the parameterless SimAM attention module was introduced, which solved the problem of high parameter quantity and calculation complexity in the existing technology, and realized a high accuracy and lightweight brain tumor MRI image detection method.

CN119648705AInactive Publication Date: 2025-03-18CHANGCHUN UNIV

Patent Information

Application Number
CN202510179448.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-02-19
Publication Date
2025-03-18
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

The existing brain tumor MRI image detection methods have challenges in parameter quantity and computational complexity, which limits their practical application in the field of medical diagnosis.

Method used

By improving the YOLOv8n model, adopting a lightweight backbone network based on StarNet and the C2f_Star module, a parameter-free SimAM attention module is introduced to optimize the backbone and neck network of the model to reduce the amount of parameters and calculation requirements.

Benefits of technology

The high accuracy and lightweight model are achieved, which significantly reduces the number of parameters and computing requirements of the model, making it run more efficiently on devices with limited computing resources to meet the needs of clinical diagnosis.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119648705A_ABST
    Figure CN119648705A_ABST
Patent Text Reader

Abstract

The invention discloses a brain tumor MRI image detection method based on improved YOLOv8n, and belongs to the crossing field of computer science and technology and medical image.The method comprises the steps that a brain tumor MRI image to be detected is obtained, and the brain tumor MRI image to be detected is input into a brain tumor MRI image detection network model to obtain a brain tumor detection result; the brain tumor MRI image detection network model adopts an improved YOLOv8n model; according to the improved YOLOv8n model, a lightweight backbone network improved based on StarNet is used as a backbone network of the model on the basis of an original YOLOv8n model, a simple and parameter-free attention module SimAM is introduced behind an SPPF layer, an improved C2fStar module is used for replacing a C2f module in a neck network, and the improved YOLOv8n model has higher efficiency and better adaptability while high precision is kept; especially in an environment where computing resources are limited.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the intersection of computer science and medical imaging, and in particular, relates to a brain tumor MRI image detection method based on improved YOLOv8n. Background Art

[0002] The detection of brain tumors is a key aspect of medical diagnosis. Magnetic resonance imaging (MRI) is the best imaging technology for visualizing and detecting tumors in the brain. The YOLO (You Only Look Once) series of algorithms have been proven to accurately detect brain tumors. The application of improvements based on the YOLO series of algorithms in brain tumor MRI image detection is one of the current research hotspots. Among them, RCS-YOLO proposes an innovative architecture that combines reparameterized convolution based on channel rearrangement (RCS) and one-time aggregation module (RCS-OSA). This new architecture draws on the advantages of RepVGG / RepConv and ShuffleNet to design a new module, RCS. In the training phase, RCS uses its multi-branch topological structure to capture rich feature information; in the inference phase, the multi-branch structure is optimized to a single-branch structure through structural reparameterization technology, which effectively reduces memory consumption and accelerates the inference process. The RCS-OSA module enhances feature reuse and information flow by stacking RCS modules. By setting different numbers of stacked modules at different layers of the network, the computational burden is reduced and the memory usage is reduced. In addition, the model also achieves alignment and information exchange of feature maps of different sizes through multi-scale feature fusion technology. RCS-YOLO further reduces the number of convolutional layers and computational complexity by reducing the number of detection heads from 3 to 2, thereby improving the inference speed and overall computational efficiency. BGF-YOLO introduces dual-layer routing attention (BRA), general feature pyramid network (GFPN) and additional detection heads on the basis of YOLOv8 to enhance the detection ability of the model. As an attention mechanism, BRA focuses on focusing on important feature areas, reduces feature redundancy through a dynamic and sparse attention mechanism, and increases the model's attention to brain tumor areas. GFPN is a feature pyramid network that aims to enrich feature representation by fusing features at different levels, thereby enhancing the detection ability of the model. In addition to the original three detection heads, BGF-YOLO also introduces an additional detection head to improve the model's detection ability for objects of different sizes. While maintaining high accuracy, the model also shows good computational efficiency. Although existing methods have achieved certain results in performance, they still face challenges in terms of parameter amount and computational complexity, which limits their practical applications in the field of medical diagnosis. Summary of the invention

[0003] In view of this, the purpose of this invention is to propose a brain tumor MRI image detection method based on improved YOLOv8n, by targetedly improving the C2f module in the backbone network (Backbone) and the neck network (Neck), and introducing the attention mechanism, to achieve high accuracy and lightweight model, aiming to significantly reduce the number of model parameters and computing requirements while maintaining high accuracy. This improvement enables the model to run more efficiently on devices with limited computing resources, thereby better meeting the actual needs of clinical diagnosis.

[0004] To achieve the above-mentioned purpose, the technical scheme provided by the present invention is as follows: a brain tumor MRI image detection method based on improved YOLOv8n, comprising obtaining a brain tumor MRI image to be detected, and inputting the brain tumor MRI image to be detected into a brain tumor MRI image detection network model to obtain a brain tumor detection result; the brain tumor MRI image detection network model adopts an improved YOLOv8n model; the improved YOLOv8n model is based on the original YOLOv8n model, using an improved lightweight backbone network based on StarNet, and using an improved C2f_Star module to replace the C2f module in the neck network Neck; the improved lightweight backbone network based on StarNet includes a StarNet_S050 module and an SPPF layer, and a parameter-free attention module SimAM is introduced after the SPPF layer; the StarNet_S050 module includes five layers, consisting of an input layer and four downsampling stages; the improved C2f_Star module replaces the Bottleneck module in the C2f module with a Star_Block module The Star_Block module is configured as follows: for an input feature map of size H×W×C, it first performs preliminary feature extraction through a depthwise separable convolution DWConv with a convolution kernel size of K*K, a stride of S, and a padding of P; then, the feature map is divided into two parts, the first part of the feature map passes through a 1×1 convolution layer Conv and a ReLU6 activation function in turn to obtain f1(x), and the second part of the feature map passes through a 1×1 convolution layer Conv to obtain f2(x); then, f1(x) and f2(x) are element-wise multiplied through a star operation to enhance the feature map. The feature map after the star operation is further extracted and transformed through a 1×1 convolutional layer Conv and a depthwise separable convolution DWConv with a kernel size of K*K, a step size of S, and a padding of P to extract and transform the feature map information; finally, the obtained feature map information is added to the feature information of the input feature map to realize the residual connection, and then regularized through the DropPath layer to output a feature map of size H×W×C, where H is the height of the feature map, W is the width of the feature map, C is the number of channels of the feature map, and K=7, S=3, and P=1.

[0005] Furthermore, the improved lightweight backbone network based on StarNet is configured as follows: the input layer of the network receives an original image of size 640×640×3, firstly reduces the original image size to 320×320 through a 3×3 batch normalization convolution ConvBN module with 16 channels, and converts the number of channels to 16, generating a feature map of size 320×320×16; then, the feature map undergoes four stages of downsampling, each of which includes a ConvBN module and a series of feature enhancement modules St ar_Block; in the first downsampling stage, the feature map of size 320×320×16 is converted to a feature map of size 160×160×32 through a ConvBN module with 32 channels, and batch normalization is performed to reduce internal covariate shift. The batch normalized feature map is then further extracted through the Star_Block module, and the output feature map of size 160×160×32 is output; then, the feature map continues to pass through three downsampling stages with 64, 128, and 256 channels respectively. , after the same processing flow, four feature maps with sizes of 80×80×64, 40×40×128 and 20×20×256 are finally generated; the number of Star_Block modules in the four downsampling stages is 1, 1, 3, and 1 respectively; after four stages of downsampling processing, four feature maps with sizes of 160×160×32, 80×80×64, 40×40×128 and 20×20×256 are generated; the feature maps with sizes of 80×80×64 and 40×40×128 are directly fed into the neck network Neck performs feature fusion; the feature map with a size of 20×20×256 is subjected to multi-scale feature extraction through the SPPF layer. The SPPF layer first uses a convolution layer to reduce the number of channels to 128, then uses the maximum pooling layer to extract features at different scales, and combines the features of different scales together through the feature splicing layer. Finally, a convolution layer is used to restore the number of channels to 256 to output a feature map with a size of 20×20×256 for subsequent processing. This process enables the feature map to maintain its original size while fusing multi-scale information.

[0006] Furthermore, the attention module SimAM is configured as follows: the feature map of size 20×20×256 output from the SPPF layer is used as the original input feature map of the attention module SimAM Input into the attention module SimAM, first keep the channel dimension unchanged, and calculate the original input feature map through formula 1 The average value in the spatial dimension ; Then, the original input feature map is calculated by formula 2 Its average value in spatial dimension The square of the difference between ; Then, perform a global average pooling operation using Formula 3 and square the difference Compress in the spatial dimension to obtain a feature map of size 1×1×256 ; The feature map The feature map is obtained by normalizing it through formula 4 , and processed using the Sigmoid activation function through formula 5 to obtain a three-dimensional weight matrix ; Finally, the original input feature map is made With the three-dimensional weight matrix Multiply to achieve feature weighting, output feature map of size 20×20×256 ; Formula 1: ; Formula 2: ; Formula 3: ; Formula 4: ; Formula 5: ; Formula 6: ; in, and are the height and width of the feature map respectively; and are the horizontal and vertical axes respectively; is the position of the pixel in the feature map.

[0007] Further, the C2f_Star module is configured as follows: for an input feature map of size H×W×C, where H is the height of the feature map, W is the width of the feature map, and C is the number of channels of the feature map, first, the number of channels is doubled through a 1×1 Conv convolution operation to form a feature map of size H×W×2C; then, the feature map is split into two feature maps of size H×W×C, and one of the feature maps of size H×W×C after the split is deeply processed through n Star_Block modules to output n feature maps of H×W×C; the two feature maps of size H×W×C after the split are then concatenated with the processed n feature maps of H×W×C to form a feature map of size H×W×(2+n)×C; finally, through another 1×1 Conv convolution operation, the number of channels of the feature map of size H×W×(2+n)×C is adjusted to C2, and a feature map of size H×W×C2 is output.

[0008] In summary, compared with the prior art, the brain tumor MRI image detection method based on improved YOLOv8n proposed in the present invention is based on the YOLOv8n architecture, and the model adopts a lightweight backbone network based on the improvement of StarNet. By streamlining the number of network layers, a significant reduction in the number of model parameters and the amount of calculation is achieved. After the SPPF layer of the backbone network, the parameter-free attention module SimAM is introduced for the first time. This innovation effectively improves the performance of the model without adding additional parameters and computational complexity. In addition, the C2f module in the neck network is replaced with an improved C2f_Star module. This improvement not only enhances the feature fusion capability of the neck network, but also reduces the number of parameters and the amount of calculation of the model, and further improves the overall performance of the model. These optimization measures enable the model of the present invention to have higher efficiency and better adaptability while maintaining high precision, especially in an environment with limited computing resources. BRIEF DESCRIPTION OF THE DRAWINGS

[0009] Figure 1 This is the original YOLOv8n structure diagram; Figure 2 This is the improved YOLOv8n structure diagram of the present invention; Figure 3 This is a structural diagram of the improved backbone network of the present invention; Figure 4 This is the structure diagram of C2f_Star; Figure 5 This is the Star_Block structure diagram; Figure 6 This is the neck network structure diagram based on multi-scale feature fusion of C2f_Star; Figure 7 Schematic diagram of the change of model training loss indicators; Figure 8 Schematic diagram of the changes in model training performance indicators; Fig. 9 This is a schematic diagram showing the location structure of an MRI image that is successfully labeled with a suspected brain tumor in an embodiment of the present invention. DETAILED DESCRIPTION

[0010] In order to make the purpose, features and advantages of the present invention more obvious and easy to understand, the technical scheme in the present invention is clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the present invention is not limited to the following embodiments, and the specific implementation method can be determined according to the technical scheme of the present invention and the actual situation. In order to avoid confusing the essence of the present invention, the known methods, processes and procedures are not described in detail.

[0011] The technical solution adopted by the brain tumor MRI image detection method based on improved YOLOv8n proposed in the present invention is as follows: 1. Lightweight backbone network based on StarNet Figure 1 The original YOLOv8n structure diagram is shown; Figure 2 The figure shows the structure diagram of the improved YOLOv8n of the present invention; in the original YOLOv8n model, the backbone network adopts a structure similar to CSPDarknet, which is composed of Conv convolutional layers, C2f modules and SPPF (Spatial Pyramid Pooling Fast) modules, which are jointly responsible for extracting features from the input image. Although this structure performs well in feature extraction, its high parameter count and computational complexity limit the model's deployment capabilities on devices with limited computing resources. In order to address this challenge, the present invention designs a more lightweight backbone network based on the StarNet network, which is mainly composed of StarNet_S050 modules and SPPF (Spatial PyramidPooling Fast) layers, as shown in FIG. Figure 3 As shown in the figure. The StarNet_S050 module is a streamlined variant of StarNet. Compared with the original nine-layer convolutional structure of YOLOv8n, StarNet_S050 contains only five layers, consisting of an input layer and four downsampling stages. Its network size is significantly reduced, which significantly reduces the complexity of the model, the number of parameters and the computational requirements. This design gradually extracts features of different scales through multiple stages and gradually increases the number of channels to enhance the expressiveness of the features. The output of each stage is collected to form the multi-scale feature output of the model, which enhances the representation ability of the feature map.

[0012] The working principle of the improved backbone network is as follows: the input layer of the network receives original images of size 640×640×3, which are first reduced to 320×320 by a 3×3 batch normalization convolution (ConvBN) module with 16 channels, and the number of channels is converted to 16, resulting in a feature map of size 320×320×16. Subsequently, the feature map of size 320×320×16 undergoes four stages of downsampling, each of which contains a ConvBN module and a series of feature enhancement modules Star_Block. In the first downsampling stage, the feature map of size 320×320×16 is converted to a feature map of size 160×160×32 by a ConvBN module with 32 channels, and batch normalization is performed to reduce internal covariate shift, stabilize the training process and accelerate the convergence of the model. The batch normalized feature map is then further extracted through the Star_Block module, and the output feature map of size 160×160×32 is output. Subsequently, the feature map continues to pass through three downsampling stages with 64, 128, and 256 channels, and after the same processing flow, four feature maps of sizes 80×80×64, 40×40×128, and 20×20×256 are finally generated. The number of Star_Block modules in the four downsampling stages is 1, 1, 3, and 1, respectively. This design aims to balance computational efficiency and model capacity, ensuring that the model is neither too complex to train nor too simple to overfit. After four stages of downsampling, feature maps of four sizes are generated: 160×160×32, 80×80×64, 40×40×128, and 20×20×256. Feature maps of sizes 80×80×64 and 40×40×128 are directly fed into the neck network (Neck) for feature fusion. The feature map of size 20×20×256 is subjected to multi-scale feature extraction through the SPPF layer, which first uses a convolutional layer to reduce the number of channels to 128, then uses a maximum pooling layer to extract features at different scales, and combines these multi-scale features through a feature concatenation layer. Finally, a convolutional layer is used to restore the number of channels to 256 to output a feature map of size 20×20×256 for subsequent processing. This process allows the feature map to maintain its original size while integrating multi-scale information, improving the model's ability to detect different objects.

[0013] Through this innovation, the backbone network of the present invention significantly reduces the number of model parameters and computational complexity while maintaining efficient feature extraction capabilities, making it more suitable for deployment on devices with limited computing resources while maintaining high-accuracy detection performance. This lightweight design not only improves the practicality of the model, but also provides new possibilities for deploying efficient target detection models in various environments.

[0014] 2. Simple parameter-free attention module SimAM Traditional attention mechanisms, such as channel attention in SENet (Squeeze-and-Excitation Networks) or spatial and channel attention in CBAM (Convolutional Block Attention Module), can improve the accuracy of the model, but usually introduce additional parameters and computational burden. These mechanisms give the model more flexible feature fusion capabilities by explicitly modeling the relationship between different channels or spatial positions in the feature map. However, this enhanced feature fusion capability often comes at the expense of increasing the number of parameters and computational complexity of the model. Therefore, the present invention refers to an efficient parameter-free attention module SimAM (Simple, Parameter-Free Attention Module). SimAM can provide three-dimensional attention weights for convolutional neural networks without adding additional parameters. It cleverly combines channel attention and spatial attention, thereby improving the network's expressive power and more effectively extracting image features.

[0015] In the present invention, the SimAM attention mechanism is applied to the backbone network of the YOLOv8n model for the first time, that is, the attention module SimAM is inserted after the SPPF layer to enhance the feature extraction capability of the backbone network and improve the overall performance of the model without increasing the number of model parameters and computational complexity. The workflow of the attention module SimAM in the model proposed by the present invention is as follows: the feature map of size 20×20×256 output from the SPPF layer is used as the original input feature map of the attention module SimAM Input into the attention module SimAM, first keep the channel dimension unchanged, and calculate the original input feature map through formula 1 The average value in the spatial dimension ; Then, the original input feature map is calculated by formula 2 Its average value in spatial dimension The square of the difference between ; Then, perform a global average pooling operation using Formula 3 and square the difference Compress in the spatial dimension to obtain a feature map of size 1×1×256 ; The feature map The feature map is obtained by normalizing it through formula 4 , and processed using the Sigmoid activation function through formula 5 to obtain a three-dimensional weight matrix ; Finally, the original input feature map is made With the three-dimensional weight matrix Multiply to achieve feature weighting, output feature map of size 20×20×256 ; Formula 1: ; Formula 2: ; Formula 3: ; Formula 4: ; Formula 5: ; Formula 6: ; in, and are the height and width of the feature map respectively; and are the horizontal and vertical axes respectively; is the position of the pixel in the feature map. Through this process, the attention module SimAM does not change the original input feature map. Under the premise of the spatial size and number of channels, by calculating the original input feature map The average The difference between , performs global mean pooling, standardization and Sigmoid activation to generate a three-dimensional weight matrix The three-dimensional weight matrix With the original input feature map Multiplication effectively highlights the important features of the feature map and suppresses irrelevant parts. This method not only improves the model's attention to useful information, but also reduces unnecessary computational complexity.

[0016] 3. Multi-scale feature fusion neck network based on C2f_Star The Neck network in the YOLOv8n model is a Feature Pyramid Network (FPN) structure that is responsible for extracting and fusing information from feature maps of different scales to generate multi-scale feature representations. The network consists of an upsampling layer (Upsample), a concatenation layer (Concat), a convolution layer (Conv), and a C2f layer. The upsampling layer restores the spatial information lost in the downsampling process by increasing the spatial size of the feature map, so that the feature map can be effectively spliced ​​with the feature map of higher resolution. The concatenation layer merges feature maps of different levels along the channel dimension, and by adding the number of channels, combines the semantic information of the high level with the spatial information of the low level to obtain a richer feature representation. The convolution layer is used to extract local information in the feature map and adjust the size and number of channels of the feature map so that it can be spliced ​​with feature maps of other levels. The C2f layer better aggregates multi-scale information by splicing the output of different Bottleneck modules with the original feature map.

[0017] In this invention, the Neck part of the YOLOv8n model is innovatively optimized, and the C2f_Star module is proposed. Figure 4 As shown in the figure, the original C2f module is replaced. The core of this improvement is to replace the Bottleneck module in C2f with the Star_Block module with better performance, as shown in the figure. Figure 5 As shown in the figure, the processing efficiency of the feature map is significantly improved. The workflow of the C2f_Star module is as follows: for an input feature map of size H×W×C, where H is the height of the feature map, W is the width of the feature map, and C is the number of channels of the feature map, first, the number of channels is doubled through a 1×1 Conv convolution operation to form a feature map of size H×W×2C; then, the feature map is split into two feature maps of size H×W×C, and one of the feature maps of size H×W×C after the split is deeply processed through n Star_Block modules, and n feature maps of size H×W×C are output; the two feature maps of size H×W×C after the split are then concatenated with the processed n feature maps of H×W×C to form a feature map of size H×W×(2+n)×C; finally, through another 1×1 Conv convolution operation, the number of channels of the feature map of size H×W×(2+n)×C is adjusted to C2, and a feature map of size H×W×C2 is output.

[0018] The processing flow of the Star_Block module is as follows: for an input feature map of size H×W×C, a preliminary feature extraction is first performed through a depthwise separable convolution DWConv with a kernel size of K*K, a step size of S, and a padding of P, where K=7, P=1, and S=3; then, the feature map is divided into two parts: the first part of the feature map passes through a 1×1 convolution layer Conv and a ReLU6 activation function in turn to obtain f1(x), and the second part of the feature map passes through a 1×1 convolution layer Conv to obtain f2(x), and then f1(x) is combined with f2(x) is element-wise multiplied by star operation to enhance the interaction between features. The feature map after star operation is further extracted and transformed by 1×1 convolution layer Conv and depthwise separable convolution DWConv with kernel size K*K, stride S and padding P, K=7, P=1, S=3; finally, the obtained feature map information is added to the feature information of the input feature map to realize residual connection, and then regularized by DropPath layer and output feature map with size H×W×C. The C2f_Star module significantly enhances the expressiveness of features compared with the original C2f module by introducing the innovative operation of Star_Block, especially when processing complex or multi-scale features. This improvement not only improves the operation efficiency of the model by simplifying the calculation, but also optimizes the gradient flow and accelerates the training convergence process of the model. At the same time, it reduces the computational cost of the model, making the model more suitable for deployment in environments with limited computing resources. These improvements reduce the number of parameters and computational complexity while maintaining the high accuracy of the model, providing new ideas and design directions for the development of the YOLOv8 model.

[0019] The optimized neck network Neck, such as Figure 6As shown in the figure, the multi-scale feature fusion neck network structure diagram based on C2f_Star still uses the multi-scale feature fusion strategy of the original model to enhance the performance of the model. The workflow is as follows: First, the feature map of size 20×20×256 output by the attention module SimAM is processed, and its size is doubled through the Upsample layer to obtain a feature map of size 40×40×256. Then, this feature map is concatenated with the feature map of size 40×40×128 generated by the third downsampling operation of Backbone in the Concat layer. The concatenated feature map of size 40×40×384 is then sent to the C2f_Star module, and after processing, a feature map of size 40×40×512 is output. Furthermore, the feature map of size 40×40×512 is twice upsampled again through the Upsample layer to obtain a feature map of size 80×80×512, and it is concatenated with the feature map of size 80×80×64 generated by the second downsampling operation of Backbone. The size of the concatenated feature map is 80×80×576. It is processed by the C2f_Star module again to obtain a feature map p3 with a size of 80×80×256. At the same time, the feature map p3 is also sent to the next convolution module (Conv). The size of the convolution feature map is 40×40×256. It is concatenated with the previously generated feature map of size 40×40×512. The size of the concatenated feature map is 40×40×768 and is input to the C2f_Star module again. The output is a feature map p4 with a size of 40×40×512. Finally, the feature map p4 is also sent to the next convolution module (Conv). The size of the feature map after convolution is 20×20×512, which is spliced ​​with the feature map of size 20×20×256 output by the attention module SimAM. The size of the spliced ​​feature map is 20×20×768, which is further processed by the C2f_Star module, and the final output size is a feature map p5 of 20×20×1024. The optimized neck network Neck not only adopts a multi-scale feature fusion strategy to enhance the spatial size of the feature map, but also significantly improves the representation ability of the feature map through the synergy of the C2f_Star module and the attention module SimAM. It also effectively integrates feature information of different scales, providing a more comprehensive and refined feature representation for subsequent further processing, thereby significantly improving the performance of the model.

[0020] 4. Head structure and loss calculation In the target detection model, the head of the network plays a key role in decision-making. It is responsible for generating the final detection results based on the multi-scale feature maps provided by the Neck part. The Head of the YOLOv8n model consists of three detection heads of different scales, which process the multi-scale feature maps p3, p4 and p5 respectively, and perform the localization and classification tasks of feature points. The feature maps p3, p4 and p5 are processed by the corresponding detection heads and output feature maps of sizes 80×80×64, 40×40×128 and 20×20×256 respectively. Each detection head is subdivided into two branches, which are processed by the cv2 module and the cv3 module respectively to calculate the bounding box regression loss (Bbox.Loss), distributed focal loss (Dfl.Loss) and classification loss (CLs.Loss), and the results are merged into the final feature information. After decoding, these feature information will be converted into the location of the bounding box and the probability of the category to obtain the detection result.

[0021] Both the cv2 module and the cv3 module consist of two ordinary convolutional layers (Conv) and one standard convolutional layer (Conv2d). The cv2 module focuses on the positioning of the bounding box. It first converts the number of channels of the feature map from the original value to C2 through a convolutional layer, then passes it through another convolutional layer to keep the number of channels as C2, and finally outputs the regression information of the bounding box through the Conv2d layer. Bbox.loss is calculated by the mean square error (MSE) loss function to measure the difference between the predicted bounding box and the true bounding box. Its calculation formula 7 is as follows: Formula 7: ; in, are the coordinates of the ground-truth bounding box, are the coordinates of the predicted bounding box, Indicates the number of coordinate points.

[0022] When reg_max (reg_max is a parameter used in the algorithm to control the granularity of discretized regression, which determines the range of distribution prediction) is greater than 1, Dfl.loss is also used to calculate the distributed focal loss. Its calculation formula 8 is as follows: Formula 8: ; in, is the predicted probability distribution, is the true distribution; The cv3 module is responsible for the classification task. It first converts the number of channels of the feature map from the original value to C3 through a convolutional layer. C3 is determined based on the number of channels (ch) of the feature map and the number of detected categories (nc). Then, the feature map passes through another convolutional layer, keeping the number of channels as C3, and finally converts the number of channels to nc through the Conv2d layer to obtain the probability distribution of the classification. CLs.loss is calculated by the cross entropy loss function, which measures the difference between the category label predicted by the model and the true label. Its calculation formula 9 is as follows: Formula 9: ; in, is an indicator, which is 1 if sample o belongs to category c, otherwise it is 0; is the probability that the model predicts that sample o belongs to category c.

[0023] V. Experiment and Analysis The experimental data of the present invention is derived from the Br35H public dataset, which contains 801 annotated brain tumor MRI images. The dataset is divided into a training set (500 images), a validation set (201 images), and a test set (100 images), which are used for model training, validation, and testing, respectively.

[0024] During the model training and validation phase, image data and its corresponding label data are loaded into the model. After resizing, maximum and minimum normalization, and color channel conversion preprocessing operations, the image size is uniformly set to 640×640×3 and input in RGB color channel format. In the data enhancement phase, the present invention uses a variety of transformation techniques, including blurring (such as Gaussian blurring and median blurring), conversion to grayscale, and contrast-limited adaptive histogram equalization (CLAHE). Each transformation is set with a 1% application probability (p=0.01) and is applied independently to each image with a probability of 1%. Given that the Br35H public dataset has been annotated, the present invention corrects and optimizes the labels in the data preprocessing phase to ensure that the labels and image data can be correctly matched and matched in the data loading, enhancement, and model training phases. The preprocessed label data is integrated into the data loading process to ensure that during model training and validation, the data loader can simultaneously load the image data and its corresponding label data, and pass them as input to the model for training and validation.

[0025] The present invention inputs the Br35H training set into the improved YOLOv8n model for model training. The parameters of model training are configured as follows: the learning rate is set to 0.001, the momentum parameter is 0.937, the weight decay coefficient is 0.0005, the batch size is 4, and the training rounds are set to 120. The optimization algorithm uses SGD (stochastic gradient descent) to optimize the model training process. The hardware configuration of the training environment includes a 64-bit Linux operating system, an NVIDIA GeForce RTX 3090 graphics card, and 24GB of video memory. In terms of software environment, the operating environment is Python 3.8.19 and PyTorch 1.13.1, the latter of which is built on CUDA version 11.7.

[0026] The present invention uses the following evaluation indicators to measure the model performance: accuracy (Precision), recall (Recall), mAP 50-95 As well as the model parameters (Param) and computational complexity, where computational complexity is expressed in GFLOPs. Precision refers to the proportion of true brain tumors among all samples tested positive, reflecting the accuracy of the model. Recall measures the proportion of all actual brain tumors detected by the model. The average accuracy (AP) evaluates the performance of the model on a single category, while the mean average accuracy (mAP) is the average of AP over all categories, which is used to evaluate the overall performance of the model on multiple categories. In particular, mAP 50-95 It is the average value of mAP calculated within the IoU (intersection over union) threshold range of 50% to 95%, which is used to more carefully evaluate the performance of the model under different matching strictness. In addition, Param and GFLOPs reflect the computational requirements and complexity of the model, which are the evaluation focus of this improvement. The calculation formula is as follows: TP (True Positive) represents the number of brain tumors correctly labeled as brain tumors by the model, FP (False Positive) represents the number of non-brain tumors incorrectly labeled as brain tumors by the model, FN (False Negative) represents the number of brain tumors incorrectly labeled as non-brain tumors by the model, P(r) represents the accuracy at the recall rate r, and N represents the number of brain tumor categories evaluated.

[0027] Formula 10: ; Formula 11: ; Formula 12: ; Formula 13: ; Figure 7 and Figure 8The changes in loss and performance indicators during the training process of the model of the present invention are shown. With the increase in the number of training rounds, the loss functions of the model, including the bounding box regression loss (Bbox.Loss), classification loss (CLs.Loss), and distributed focal loss (Dfl.Loss), all show a significant downward trend, which indicates that the performance of the model in locating and classifying objects continues to improve. At the same time, the accuracy (Precision) and recall (Recall) of the model are also gradually improving, showing that the model's ability to predict positive samples and identify positive samples is enhanced. In addition, the mean average precision (mAP) indicator, whether at an IoU threshold of 0.5 (mAP 50 ) or 0.5 to 0.95 (mAP 50-95 ), all show a steady upward trend, further demonstrating the significant improvement in the overall detection performance of the model. These results collectively demonstrate that the proposed model has good learning and generalization capabilities in the brain tumor detection task.

[0028] In order to explore the specific contribution of each improvement point to the model performance, the present invention conducts a systematic ablation experiment. Specifically, the present invention gradually introduces three modules, StarNet, SimAM and C2f_Star, and evaluates their respective impacts on the model on the validation set. The ablation experiment results are shown in Table 1, where Method represents the method.

[0029] Table 1 Ablation experiment

[0030] Experimental analysis: After the introduction of the StarNet module, although the accuracy of the model dropped slightly to 0.944 and the recall rate dropped to 0.908, the mAP 50-95 However, these minor performance drops are traded for significant model simplification, with the number of parameters reduced to 2212979 and the computational complexity reduced to 6.5 GFLOPs. This shows that the StarNet module has been successful in reducing model complexity. After further introducing the SimAM module, the model's accuracy increased to 0.958, although the recall rate dropped slightly to 0.887, and the mAP 50-95 The model is improved to 0.686. At this time, the number of parameters remains unchanged at 2212979, and the computational complexity is maintained at 6.5 GFLOPs. The introduction of the SimAM module improves the accuracy while keeping the model lightweight. Finally, after the introduction of the C2f_Star module, the accuracy of the model is further improved to 0.964, the recall rate is restored to 0.917, and the mAP is 50-95The C2f_Star module not only further improves the accuracy, recall and mAP of the model, but also improves the accuracy, recall and mAP of the model. 50-95 , and the number of parameters and computational complexity have been reduced. With the gradual addition of StarNet, SimAM, and C2f_Star modules, the model has significantly reduced the demand for computing resources while maintaining or even exceeding the performance of the original model, showing stronger practical application potential, especially in medical diagnosis environments with limited computing resources. These improvements not only improve the detection performance of the model, but also significantly reduce the number of parameters and computational complexity, verifying the effectiveness of our improvements.

[0031] In order to further explore the performance advantages of the improved YOLOv8n model and its potential in practical applications, the present invention inputs the test set into the trained network model for experiments and compares it with other models. The comparative experimental results are shown in Table 2, where Method represents the method.

[0032] Table 2 Comparative experiment

[0033] Experimental analysis: The present invention compares the improved YOLOv8n model with the other two models RCS-YOLO and BGF-YOLO. The improved YOLOv8n achieves 0.93 in precision, slightly higher than 0.926 of RCS-YOLO and significantly higher than 0.917 of BGF-YOLO. In terms of recall, the improved YOLOv8n leads with a score of 0.869, exceeding 0.828 of RCS-YOLO and 0.844 of BGF-YOLO. In addition, the improved YOLOv8n has a higher mAP than the previous model. 50-95 The indicators also showed excellent performance, with a score of 0.638, which is a significant improvement over RCS-YOLO's 0.573 and BGF-YOLO's 0.616. In terms of model parameter quantity (Param) and computational complexity (GFLOPs), the improved YOLOv8n has 2.01 million parameters and 6.1 GFLOPs, which are significantly lower than RCS-YOLO's 45.7 million parameters and 94.5 GFLOPs, and BGF-YOLO's 3.39 million parameters and 22.2 GFLOPs, showing higher efficiency. These results show that the improvements of the present invention not only improve the performance of the model, but also optimize the consumption of computing resources, making the improved YOLOv8n more advantageous in practical applications and easier to deploy in environments with limited computing resources.

[0034] Fig. 9 The displayed MRI image was successfully labeled with the location of a suspected brain tumor. The model assigned a high probability score of 0.9 to the detection results of the suspected tumor area, which shows that the model can not only effectively identify potential brain tumors, but also locate their specific locations with a high accuracy. It can be seen that the improved YOLOv8n model has shown excellent performance in the brain tumor detection task.

[0035] VI. Conclusion In the present invention, based on the YOLOv8n algorithm, a highly accurate and lightweight model that can be used for brain tumor MRI image detection is successfully improved. The model adopts a lightweight backbone network based on the improvement of StarNet, and through the carefully designed network structure optimization, the parameter amount and computing requirements of the model are greatly reduced. After the SPPF layer of the backbone network, the parameter-free SimAM attention mechanism is introduced, which effectively improves the feature extraction ability of the model without adding additional parameters and computational complexity. In addition, the C2f module in the neck network is upgraded to the C2f_Star module. This improvement not only enhances the feature fusion capability of the model, but also further reduces the parameter amount and computational complexity of the model.

[0036] The effectiveness of the model is verified on the Br35H public dataset. The improved YOLOv8n has an accuracy of 0.93, a recall of 0.869 and mAP. 50-95 0.638 is better than the existing model in key indicators. Compared with RCS-YOLO and BGF-YOLO, the improved YOLOv8n has slightly higher accuracy, recall rate and mAP. 50-95 More importantly, the improved model has significantly lower model parameters (2.01 million) and computational complexity (GFLOPs 6.1) than other models, making it one of the lightest models.

[0037] The improved YOLOv8n model successfully marked the location of suspected brain tumors in MRI images and gave a high probability score, which fully demonstrated the excellent performance of the model in the task of brain tumor detection. Nevertheless, the present invention emphasizes that the output of the model should be regarded as part of an auxiliary diagnostic tool rather than a final medical conclusion. The final diagnostic decision still needs to be made by professional medical personnel based on comprehensive clinical data. In summary, the application of this model provides new ideas and technical support for the auxiliary diagnosis of brain tumors, showing significant practical value and huge development potential.

Claims

1. A brain tumor MRI image detection method based on improved YOLOv8n, comprising acquiring a brain tumor MRI image to be detected, and inputting the brain tumor MRI image to be detected into a brain tumor MRI image detection network model to obtain a brain tumor detection result; characterized in that: The brain tumor MRI image detection network model adopts an improved YOLOv8n model; the improved YOLOv8n model is based on the original YOLOv8n model, using an improved lightweight backbone network based on StarNet, and using an improved C2f_Star module to replace the C2f module in the neck network Neck; the improved lightweight backbone network based on StarNet includes a StarNet_S050 module and an SPPF layer, and a parameter-free attention module SimAM is introduced after the SPPF layer; the StarNet_S050 module contains five layers, consisting of an input layer and four downsampling stages; the improved C2f_Star module replaces the Bottleneck module in the C2f module with a Star_Block module, and the Star_Block module is configured to, for an input feature map of size H×W×C, first, through convolution The depthwise separable convolution DWConv with a kernel size of K*K, a stride of S and a padding of P is used for preliminary feature extraction; then, the feature map is divided into two parts, the first part of the feature map passes through the 1×1 convolution layer Conv and the ReLU6 activation function in turn to obtain f1(x), and the second part of the feature map passes through the 1×1 convolution layer Conv to obtain f2(x); then, f1(x) and f2(x) are element-wise multiplied through a star operation, and the feature map after the star operation is further extracted and transformed through a 1×1 convolution layer Conv and a depthwise separable convolution DWConv with a kernel size of K*K, a stride of S and a padding of P; finally, the obtained feature map information is added to the feature information of the input feature map to realize the residual connection, and then regularized through the DropPath layer and outputs a feature map of size H×W×C, where H is the height of the feature map, W is the width of the feature map, and C is the number of channels of the feature map.

2. The brain tumor MRI image detection method based on improved YOLOv8n according to claim 1, characterized in that: K=7, S=3, P=1.

3. The brain tumor MRI image detection method based on improved YOLOv8n according to claim 2, characterized in that: The improved lightweight backbone network based on StarNet is configured as follows: the input layer of the network receives an original image of size 640×640×3. First, a 3×3 batch normalization convolution ConvBN module with a channel number of 16 is used to reduce the size of the original image to 320×320, and the number of channels is converted to 16, generating a feature map of size 320×320×16; then, the feature map undergoes four stages of downsampling processing, each of which includes a ConvBN module and a series of feature enhancement modules Star_Block; in the first downsampling stage, the feature map of size 320×320×16 is converted to a feature map of size 160×160×32 through a ConvBN module with a channel number of 32, and batch normalization is performed to reduce internal covariate shift. The batch normalized feature map is then further extracted through the Star_Block module, and a feature map of size 160×160×32 is output; then, the feature map continues to pass through the ConvBN module with channel numbers of 64, 128, respectively. The same processing flow is used to generate feature maps of four sizes: 80×80×64, 40×40×128, and 20×20×256. The number of Star_Block modules in the four downsampling stages is 1, 1, 3, and 1, respectively. After four stages of downsampling, feature maps of four sizes are generated: 160×160×32, 80×80×64, 40×40×128, and 20×20×256. The feature map of size 0×40×128 is directly sent to the neck network Neck for feature fusion; the feature map of size 20×20×256 is used for multi-scale feature extraction through the SPPF layer. The SPPF layer first uses a convolution layer to reduce the number of channels to 128, and then uses the maximum pooling layer to extract features at different scales, and combines the features of different scales together through the feature splicing layer. Finally, a convolution layer is used to restore the number of channels to 256 to output a feature map of size 20×20×256 for subsequent processing.

4. The brain tumor MRI image detection method based on improved YOLOv8n according to claim 3 is characterized in that: The attention module SimAM is configured as follows: the feature map of size 20×20×256 output from the SPPF layer is used as the original input feature map of the attention module SimAM Input into the attention module SimAM, first keep the channel dimension unchanged, and calculate the original input feature map through formula 1 The average value in the spatial dimension ; Then, the original input feature map is calculated by formula 2 Its average value in spatial dimension The square difference between ; Then, perform a global average pooling operation using Formula 3 and square the difference Compress in the spatial dimension to obtain a feature map of size 1×1×256 ; The feature map The feature map is obtained by normalizing it through formula 4 , and processed using the Sigmoid activation function through formula 5 to obtain a three-dimensional weight matrix ; Finally, the original input feature map is made With the three-dimensional weight matrix Multiply to achieve feature weighting, output feature map of size 20×20×256 ; Formula 1: ; Formula 2: ; Formula 3: ; Formula 4: ; Formula 5: ; Formula 6: ; in, and are the height and width of the feature map respectively; and are the horizontal and vertical axes respectively; is the position of the pixel in the feature map.

5. The brain tumor MRI image detection method based on improved YOLOv8n according to claim 4 is characterized in that: The C2f_Star module is configured as follows: for an input feature map of size H×W×C, where H is the height of the feature map, W is the width of the feature map, and C is the number of channels of the feature map, first, the number of channels is doubled through a 1×1 Conv convolution operation to form a feature map of size H×W×2C; then, the feature map is split into two feature maps of size H×W×C, one of the feature maps of size H×W×C after the split is deeply processed through n Star_Block modules, and n feature maps of H×W×C are output; the two feature maps of size H×W×C after the split are then concatenated with the processed n feature maps of H×W×C to form a feature map of size H×W×(2+n)×C; finally, through another 1×1 Conv convolution operation, the number of channels of the feature map of size H×W×(2+n)×C is adjusted to C2, and a feature map of size H×W×C2 is output.

Citation Information

Patent Citations

  • Lightweight multi-environment tomato detection method based on improved yolov8

    CN117557787A

  • YOLOv8-based primary central nervous system lymphoma detection and classification method and system

    CN119006916A

  • Wheat scab detection method and system based on unmanned aerial vehicle remote sensing and improved YOLOv8

    CN119206505A

Cited By

  • Allium chinense key point identification method and device, program product and storage medium

    CN120472208A

  • Multi-scale lightweight brain tumor segmentation method based on improved YOLOv8n-Seg

    CN120526155A

  • A multi-scale lightweight brain tumor segmentation method based on improved YOLOv8n-Seg

    CN120526155B

  • Charging pile occupation state detection method based on image recognition and storage medium

    CN121661041A

  • Liver minimal metastatic tumor image detection method based on improved YOLO model

    CN121685539A