A brain tumor detection method integrating multi-level attention and deformable feature pyramids
By introducing a multi-level attention and deformable feature pyramid brain tumor detection method, the problem of insufficient accuracy in existing brain tumor MRI image detection technology is solved, and high-precision detection and localization of small target brain tumors is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- XIAN UNIV OF TECH
- Filing Date
- 2026-01-30
- Publication Date
- 2026-05-26
AI Technical Summary
Existing MRI image detection methods for brain tumors are insufficient in terms of detection and localization accuracy when faced with challenges such as blurred tumor boundaries, irregular shapes, complex backgrounds, and low contrast of small lesions. In particular, the sensitivity and localization ability of small target brain tumors need to be improved.
A brain tumor detection method integrating multi-level attention and deformable feature pyramids is adopted. By introducing the CBAM module, AIFI-HiLo module and RepC3-DCN feature fusion module, and combining the Focaler-EIoU loss function, the detection accuracy of the model for small target brain tumors is improved.
It significantly improves the detection accuracy and localization accuracy of small target brain tumors, meeting the dual requirements of high precision and practicality in medical image analysis, and performs particularly well in the detection of small targets.
Smart Images

Figure CN122089663A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of medical image processing and computer vision technology, specifically involving a brain tumor detection method that integrates multi-level attention and deformable feature pyramids. Background Technology
[0002] Brain tumors are among the most serious diseases of the central nervous system, characterized by high mortality and disability rates. Magnetic resonance imaging (MRI), with its excellent soft tissue contrast and multi-sequence imaging capabilities, has become a key tool for the diagnosis and surgical planning of brain tumors. However, brain tumor MRI images typically exhibit blurred tumor boundaries, significant differences in lesion scale, complex backgrounds, and low contrast with normal tissues. This presents a significant challenge to clinicians' manual interpretation, leading to issues such as high subjectivity, poor repeatability, low efficiency, and susceptibility to missed diagnoses due to visual fatigue.
[0003] In recent years, deep learning-based object detection algorithms have made significant progress in natural image processing and have been gradually applied to medical image analysis. Convolutional Neural Networks (CNNs), with their powerful local feature extraction capabilities, have played an important role in medical image detection. However, the inherent local receptive field of CNNs limits their ability to model long-range dependencies, which is particularly important for understanding medical images with complex global structures.
[0004] The Detection Transformer (DETR) series of models achieves end-to-end target detection by introducing the Transformer architecture and a global self-attention mechanism, avoiding the complex manual design (such as anchor box generation) in traditional methods. However, the original DETR and its variants still face many challenges when applied to medical images, especially brain tumor detection: 1) Standard multi-scale feature fusion networks (such as FPN) are not sufficiently adaptable to the geometrical irregularity and blurred boundaries of tumors; 2) The model has limited ability to filter features in complex background noise and low signal-to-noise ratio regions in medical images; 3) For lesions with huge scale differences, especially small volume and low contrast, the detection sensitivity and localization accuracy need to be improved.
[0005] Existing improvements, such as Deformable DETR which introduces deformable attention to enhance small target detection, Conditional DETR and DN-DETR which focus on accelerating model convergence, and RT-DETR which is optimized for real-time detection, have not been deeply customized and optimized specifically for the unique challenges of brain tumor MRI images (such as blurred boundaries, variable morphology, and the tendency to miss small lesions). Therefore, a dedicated brain tumor detection method is needed that integrates global context awareness, local geometric structure modeling, and high sensitivity to difficult samples (such as small tumors). Summary of the Invention
[0006] The purpose of this invention is to provide a brain tumor detection method that integrates multi-level attention and deformable feature pyramids. Based on the RT-DETR framework, this method significantly improves the detection accuracy of small target brain tumors by introducing a multi-level attention enhancement mechanism, an improved feature pyramid network, and a loss function optimized for difficult samples.
[0007] The technical solution adopted in this invention is a brain tumor detection method that integrates multi-level attention and deformable feature pyramids, comprising the following steps:
[0008] Step 1: Data preparation and preprocessing to obtain the final training set C used for model training; Step 2: Construct the Med-DETR network model; Step 3: Input the training set C obtained in Step 1 into the Med-DETR network model constructed in Step 2 to train the parameters of the Med-DETR network model.
[0009] The invention is further characterized in that: Step 1 is as follows: Step 1.1: Obtain brain tumor MRI image dataset A, and perform stratified sampling of brain tumor MRI image dataset A based on the tumor target scale. The specific process includes the following steps: First, based on the proportion of the area occupied by the tumor bounding box in each brain tumor MRI image in the brain tumor MRI image dataset A, the brain tumor MRI images are scaled. After completing the scale classification, the brain tumor MRI image dataset A was divided into small-scale brain tumor MRI images, medium-scale brain tumor MRI images, and large-scale brain tumor MRI images. Within each scale category, 80% of the total number of brain tumor MRI images were randomly selected as the training set, and the remaining 20% were selected as the test set. The training set images selected from each scale category are merged to form training set B1; the test set images selected from each scale category are merged to form test set B2, thereby ensuring that the distribution ratio of brain tumor images of different scales in training set B1 and test set B2 is consistent. Step 1.2: Perform data augmentation operations only on the brain tumor MRI images in training set B1. For each brain tumor MRI image in training set B1, perform one or more data augmentation operations independently according to a preset probability. The brain tumor MRI images obtained after data augmentation and their corresponding updated tumor target annotation files together constitute an augmented training image set, which is denoted as training set C. The augmented images obtained through one or more data augmentation operations, together with the brain tumor MRI images in the original training set B1 that have not undergone augmentation, form the final training set C used for model training. Training set C serves as the input data for model training in step 3.
[0010] In step 1.1, the specific scale classification standards are as follows: 1) Brain tumor MRI images in which the tumor bounding box occupies less than 5% of the area in the corresponding brain tumor MRI image are defined as small-scale tumor images; 2) Brain tumor MRI images in which the tumor bounding box occupies an area of 5% or more but less than 20% of the corresponding brain tumor MRI image are defined as mesoscale tumor images; 3) Brain tumor MRI images in which the tumor bounding box occupies an area of 20% or more in the corresponding brain tumor MRI image are defined as large-scale tumor images.
[0011] In step 1.2, the data augmentation operations specifically include the following methods: (1) Mosaic enhancement: Four different brain tumor MRI images are randomly selected from the training set B1 with a probability of 0.15. The four brain tumor MRI images are cropped and the cropped image regions are combined into a new brain tumor MRI image according to the preset stitching rules, which is called the enhanced image C1. At the same time, according to the change relationship of image spatial position during cropping and stitching, the corresponding tumor bounding box annotations in the original four brain tumor MRI images are mapped and updated to keep them consistent with the enhanced image C1. (2) Copy-Paste enhancement: With a probability of 0.15, the first brain tumor MRI image is randomly selected from the training set B1, and the tumor target region is cropped from the tumor bounding box region marked on it; then, a second different brain tumor MRI image is randomly selected from the training set B1, and the tumor target region is pasted into the non-tumor region of the second brain tumor MRI image to generate a new brain tumor MRI image, which is denoted as enhanced image C2; at the same time, the tumor bounding box annotation information in the pasted image is updated; (3) Random rotation enhancement: With a probability of 0.1, random rotation is performed on the brain tumor MRI images selected from training set B1, and the rotation angle is within... The range of 3° to +3° is randomly selected; during the rotation, the area that exceeds the boundary of the original image after rotation is filled with zero value, and the position of the tumor boundary box after rotation is updated simultaneously to generate the enhanced image C3.
[0012] (4) Random downsizing enhancement: With a probability of 0.2, the brain tumor MRI images selected in the training set B1 are randomly downsized and then filled to the original image size. The unfilled areas are filled with zero values. Enhanced image C4 is generated in this way. (5) Random noise: Random noise is superimposed on the pixel values of brain tumor MRI images selected in training set B1 with a probability of 0.1 to generate enhanced image C5, which is used to improve the robustness of the model to MRI image noise interference. (6) Random Gaussian blur enhancement: Gaussian blur processing is performed on the brain tumor MRI images selected in the training set B1 with a probability of 0.1 to simulate the image blurring caused by equipment performance or slight patient movement during the imaging process, and an enhanced image C6 is generated. (7) Random IoU cropping enhancement: With a probability of 0.5, random cropping operation based on cross-union constraint is performed on the brain tumor MRI images selected in the training set B1. The cropping region is generated on the premise of ensuring that at least one complete tumor target is retained. According to the spatial position change of the cropped image, the corresponding tumor bounding box annotation information is recalculated to generate the enhanced image C7.
[0013] In step 2, the Med-DETR network model includes three parts: a backbone network, an encoder, and a decoder.
[0014] In step 2, the backbone network is constructed to perform multi-level feature extraction on the input brain tumor MRI image; the backbone feature extraction network adopts the ResNet-34 network structure. A 640×640 brain tumor MRI image is input into the backbone network. After passing through multiple convolutional operations and downsampling operations, the brain tumor MRI image outputs three basic feature maps at different spatial scales, denoted as feature map S3, feature map S4, and feature map S5, respectively. The feature map S3 has a spatial size of 80×80 and 256 channels; The feature map S4 has a spatial size of 40×40 and 512 channels; The feature map S5 has a spatial size of 20×20 and 1024 channels; Feature maps S3, S4, and S5 together constitute the output of the backbone feature extraction network, which is used for subsequent encoder processing.
[0015] In step 2, the encoder receives three feature maps S3, S4 and S5 output from the backbone network, and performs channel mapping operations on feature maps S3, S4 and S5 respectively. Specifically, a 1×1 convolution operation is applied to feature maps S3, S4 and S5 respectively, and their channel numbers are uniformly mapped to 256, thereby obtaining channel-aligned feature maps, which are denoted as feature map P3, feature map P4 and feature map P5 respectively; Subsequently, CBAM modules are introduced into feature maps P3, P4, and P5 respectively to enhance the features at each scale through attention weighting. The CBAM module sequentially performs channel attention weighting and spatial attention weighting on the input feature maps, with 256 input channels and 256 output channels, to enhance the discriminative features of tumor-related regions and suppress irrelevant background information. The feature maps processed by CBAM are denoted as feature map Q3, feature map Q4, and feature map Q5, respectively.
[0016] On the highest-level feature map Q5, the AIFI-HiLo module is applied to model long-range dependencies. The AIFI-HiLo module is built based on the Transformer coding layer structure, replacing the standard self-attention module MSA in AIFI with the HiLo attention module. The processing flow of the AIFI-HiLo module is as follows: First, the feature map Q5 is transformed into a sequence form through dimensionality transformation and learnable positional encoding is added to explicitly introduce spatial location information, generating query vector Q, key vector K, and value vector V. Then, Q, K, and V are input into the HiLo attention module to simultaneously model local detail information and global contextual relationships. The output features of the HiLo attention module are added to the input feature sequence through residual connections and then subjected to layer normalization. The layer-normalized features are further input into a feedforward neural network for nonlinear transformation. The output of the feedforward neural network is again processed through residual connections and layer normalization to obtain the output feature map R5 of the AIFI-HiLo module, whose spatial size and number of channels are consistent with feature map Q5. After completing the AIFI-HiLo module processing, a multi-scale feature fusion module is constructed in the encoder. The multi-scale feature fusion module constitutes an improved feature pyramid network structure, which is used to realize the hierarchical fusion and information transfer between features of different scales. Furthermore, spatial domain feature fusion operations are performed on the multi-scale features to enhance the model's ability to express brain tumor targets of different sizes. The multi-scale feature fusion module adopts a bidirectional feature fusion approach, combining top-down and bottom-up methods. In the top-down fusion process, high-level semantic features are upsampled and concatenated with adjacent low-level features along the channel dimension. In the bottom-up fusion process, low-level features are downsampled and concatenated with adjacent high-level features to achieve information interaction between features of different scales. At each scale feature fusion node, a RepC3-DCN feature fusion module is introduced to replace the standard convolutional fusion structure. The RepC3-DCN feature fusion module processing flow is as follows: It adopts a dual-branch feature processing method based on a CSP structure, with the input being feature maps fused from adjacent scales. The input feature maps are processed in parallel into the first and second feature branches. In the first feature branch, the input feature map undergoes a 1×1 convolution operation, layer normalization, and SiLU activation function processing sequentially to perform channel compression and nonlinear mapping. Subsequently, the processed features are input into three cascaded deformable RepVggBlocks. Each deformable RepVggBlock contains a parallel structure of a 3×3 deformable convolution branch and a 1×1 standard convolution branch. The deformable convolution learns additional offsets, allowing the convolution kernel sampling points to dynamically adapt to the irregular shape of the tumor. The standard convolution retains the original receptive field, and the outputs of the two branches are summed and output through an activation function. In the second feature branch, the input feature map also undergoes a 1×1 convolution operation, layer normalization, and SiLU activation function processing sequentially. The activation function is used to preserve the channel mapping relationship of the original features and serves as the shallow feature propagation path. After the parallel processing of the two feature branches is completed, the output features of the first feature branch and the second feature branch are fused by adding them element by element to obtain the output feature map of the RepC3-DCN feature fusion module. Finally, after processing by the multi-scale feature fusion module, the encoder outputs three deeply fused feature maps with geometric adaptability, denoted as feature map F3, feature map F4, and feature map F5, which serve as the input to the decoder.
[0017] In step 2, the decoder is constructed to perform target decoding and detection prediction on the multi-scale feature map output by the encoder. The decoder adopts the original decoder structure in the RT-DETR model, including an IoU-aware query selection module, a decoder, and a detection head. The IoU-aware query selection module is used to filter queries based on the predicted target localization quality. Based on the filtered queries, the decoder and the detection head interact with the multi-scale feature map output by the encoder through a cross-attention mechanism to generate the category confidence of the brain tumor target and the corresponding bounding box location information. The output of the decoder is used to characterize the final detection result of the brain tumor target in the input brain tumor MRI image.
[0018] In step 3: Throughout the training process, training was conducted on a server equipped with NVIDIA GPUs; key hyperparameter settings were as follows: batch size of 8, initial learning rate of 0.0001, optimizer of Adam, weight decay of 0.0001, and number of training epochs of 150. During model training, the network structure of the Med-DETR network remains unchanged, and the model parameters are optimized and updated by adjusting the form of the loss function.
[0019] In step 3, the specific method for optimizing and updating the model parameters by adjusting the form of the loss function is as follows: During model training, the corresponding focusing weights are calculated based on the IoU value between the predicted bounding box and the ground truth bounding box, and the focusing weights are combined with the EIoU loss function to form the final bounding box regression loss. The specific formula for the adjusted loss function Focaler-EIoU is as follows: In the formula It is the total number of samples. It is a sample The predicted probability is calculated, with the focusing parameter γ set to 2.0, and the EIOU loss function... It is the EIOU loss calculated for each sample.
[0020] The beneficial effects of this invention are: This invention first effectively suppresses complex background interference in MRI images and enhances tumor features through the CBAM module; then, it improves the perception of small lesions and long-distance dependencies by collaboratively modeling local details and global context through the AIFI-HiLo module. Secondly, by integrating a deformable convolutional RepC3-DCN feature fusion module, the improved feature pyramid network acquires a dynamic receptive field, better adapting to the irregular and variable morphology and blurred boundaries of brain tumors, thus improving localization accuracy. Finally, the proposed Focaler-EIoU loss function, through optimization focusing on difficult-to-distinguish samples, improves the detection sensitivity and localization accuracy for small-volume, low-contrast, and other challenging tumor samples. With minimal increase in parameters and computational cost, it achieves a significant improvement in overall detection performance, particularly excelling in small target detection (APS), meeting the dual requirements of high accuracy and practicality in medical image analysis. Based on the RT-DETR framework, this method significantly improves the detection accuracy of small-target brain tumors by introducing a multi-level attention enhancement mechanism, an improved feature pyramid network, and a loss function optimized for challenging samples. Attached Figure Description
[0021] Figure 1 This is a flowchart illustrating the overall process of the method of the present invention. Figure 2 This is a schematic diagram of the overall structure of the Med-DETR network model in the method of this invention; Figure 3 This is a schematic diagram of the CBAM module in the method of the present invention; Figure 4 This is a schematic diagram of the AIFI-HiLo module in the method of the present invention; Figure 5 This is a schematic diagram of the RepC3-DCN feature fusion module proposed in the method of this invention.
[0022] Figure 6 This is a visual comparison of the detection performance of models YOLOv5s, YOLOv8s, and YOLO11s on brain tumor MRI images in Example 1. Figure 7 This is a visual comparison of the detection performance of models YOLOx-s, BGF-YOLO, and DN-DETR on brain tumor MRI images in Example 1; Figure 8 This is a visual comparison of the detection performance of models Deformable-DETR, RT-DETRv2, and RT-DETR on brain tumor MRI images in Example 1. Detailed Implementation
[0023] The present invention will now be described in detail with reference to the accompanying drawings and specific embodiments.
[0024] This invention provides a brain tumor detection method that integrates multi-level attention and deformable feature pyramids. The overall process includes data preparation, model building, and model training, as shown in the flowchart below. Figure 1 As shown, the specific implementation steps are as follows: Step 1: Data preparation and preprocessing; Step 1 is as follows: Step 1.1: Obtain brain tumor MRI image dataset A. Brain tumor MRI image dataset A contains 4438 brain tumor MRI images and 4438 corresponding tumor target annotation files. Each annotation file includes the bounding box location information of the tumor target in the corresponding brain tumor MRI image. The location information is annotated in the form of rectangular bounding boxes. The brain tumor MRI image dataset A is divided into stratified sampling based on the tumor target scale, specifically including the following process: First, based on the proportion of the area occupied by the tumor bounding box in each brain tumor MRI image in the brain tumor MRI image dataset A, the brain tumor MRI images are scaled. The specific scale grading criteria are as follows: 1) Brain tumor MRI images in which the tumor bounding box occupies less than 5% of the area in the corresponding brain tumor MRI image are defined as small-scale tumor images; 2) Brain tumor MRI images in which the tumor bounding box occupies an area of 5% or more but less than 20% of the corresponding brain tumor MRI image are defined as mesoscale tumor images; 3) Brain tumor MRI images in which the tumor bounding box occupies an area of 20% or more in the corresponding brain tumor MRI image are defined as large-scale tumor images.
[0025] After completing the above scale classification, the brain tumor MRI image dataset A was divided into small-scale brain tumor MRI images, medium-scale brain tumor MRI images, and large-scale brain tumor MRI images. Within each scale category, 80% of the total number of brain tumor MRI images were randomly selected as the training set, and the remaining 20% were selected as the test set. The training set images selected from each scale category are merged to form training set B1; the test set images selected from each scale category are merged to form test set B2, thereby ensuring that the distribution ratio of brain tumor images of different scales in training set B1 and test set B2 is consistent. Step 1.2: Perform data augmentation operations only on the brain tumor MRI images in training set B1. For each brain tumor MRI image in training set B1, perform one or more data augmentation operations independently according to a preset probability. The brain tumor MRI images obtained after data augmentation and their corresponding updated tumor target annotation files together constitute the augmented training image set, which is denoted as training set C. The data augmentation operations specifically include the following methods: (1) Mosaic enhancement: Four different brain tumor MRI images are randomly selected from the training set B1 with a probability of 0.15. The four brain tumor MRI images are cropped and the cropped image regions are combined into a new brain tumor MRI image according to the preset stitching rules, which is called the enhanced image C1. At the same time, according to the change relationship of image spatial position during cropping and stitching, the corresponding tumor bounding box annotations in the original four brain tumor MRI images are mapped and updated to keep them consistent with the enhanced image C1. (2) Copy-Paste enhancement: With a probability of 0.15, the first brain tumor MRI image is randomly selected from the training set B1, and the tumor target region is cropped from the tumor bounding box region marked on it; then, a second different brain tumor MRI image is randomly selected from the training set B1, and the tumor target region is pasted into the non-tumor region of the second brain tumor MRI image to generate a new brain tumor MRI image, which is denoted as enhanced image C2; at the same time, the tumor bounding box annotation information in the pasted image is updated; (3) Random Rotation Enhancement: With a probability of 0.1, random rotation is performed on the selected brain tumor MRI images in training set B1, with a rotation angle of... The range of 3° to +3° is randomly selected; during the rotation, the area that exceeds the boundary of the original image after rotation is filled with zero value, and the position of the tumor boundary box after rotation is updated simultaneously to generate the enhanced image C3.
[0026] (4) Random ZoomOut: With a probability of 0.2, random zoomout is performed on the brain tumor MRI images selected in the training set B1. The original image content is reduced by a random ratio and then filled to the original image size. The unfilled areas are filled with zero values. Enhanced image C4 is generated in this way to reduce the relative size ratio of the tumor target in the image, thereby increasing the training difficulty of small-scale brain tumor samples. (5) Random noise: Random noise is added to the pixel values of brain tumor MRI images selected in the training set B1 with a probability of 0.1 to generate an enhanced image C5, which is used to improve the robustness of the model to noise interference from MRI images. (6) Random Gaussian Blur Enhancement: Gaussian blur processing is performed on the brain tumor MRI images selected in the training set B1 with a probability of 0.1 to simulate the image blurring caused by equipment performance or slight patient movement during the imaging process, and to generate enhanced image C6. (7) Random IoU cropping enhancement: With a probability of 0.5, a random cropping operation based on the intersection-union constraint is performed on the brain tumor MRI images selected in the training set B1. The cropping region is generated on the premise of ensuring that at least one complete tumor target is retained. Based on the spatial position change of the cropped image, the corresponding tumor bounding box annotation information is recalculated to generate the enhanced image C7. The enhanced images C1 to C7 obtained through one or more of the above data augmentation operations, together with the brain tumor MRI images that have not undergone enhancement in the original training set B1, form the final training set C used for model training. The training set C serves as the input data for model training in step 3.
[0027] Step 2: Construct the Med-DETR network model (brain tumor detection network model); In step 2, a Med-DETR network model for brain tumor detection is constructed. The Med-DETR network model is used to extract features, enhance features, and predict targets from the brain tumor MRI images obtained in step 1. Its overall network structure is as follows: Figure 2 As shown.
[0028] The Med-DETR network model consists of three parts: a backbone network, an encoder, and a decoder. The functions and connections of each part are as follows: A backbone network was constructed to perform multi-level feature extraction on the input brain tumor MRI images; the backbone feature extraction network adopted the ResNet-34 network structure. A 640×640 brain tumor MRI image is input into the backbone network. The brain tumor MRI image is sourced from either the training set C or the test set B2. After passing through multiple convolutional operations and downsampling operations, the brain tumor MRI image outputs three basic feature maps at different spatial scales, denoted as feature map S3, feature map S4, and feature map S5, respectively. The feature map S3 has a spatial size of 80×80 and 256 channels; The feature map S4 has a spatial size of 40×40 and 512 channels; The feature map S5 has a spatial size of 20×20 and 1024 channels; Feature maps S3, S4, and S5 together constitute the output of the backbone feature extraction network, which is used for subsequent encoder processing. The encoder receives three feature maps S3, S4 and S5 output from the backbone network, and performs channel mapping operations on feature maps S3, S4 and S5 respectively. Specifically, a 1×1 convolution operation is applied to feature maps S3, S4 and S5 respectively, and their channel numbers are uniformly mapped to 256, thereby obtaining channel-aligned feature maps, which are denoted as feature map P3, feature map P4 and feature map P5 respectively; Subsequently, CBAM (Convolutional Block Attention Module) modules are introduced into feature maps P3, P4, and P5 respectively, as shown in the schematic diagram below. Figure 3 As shown, attention-weighted enhancement is applied to features at each scale. The CBAM module sequentially applies channel attention weighting and spatial attention weighting to the input feature map. It has 256 input channels and 256 output channels, which are used to enhance the discriminative features of tumor-related regions and suppress irrelevant background information. The feature maps processed by CBAM are denoted as feature map Q3, feature map Q4 and feature map Q5, respectively.
[0029] On the highest-level feature map Q5 (spatial size 20×20, number of channels 256), the AIFI-HiLo module is applied to model long-range dependencies; the AIFI-HiLo module is built based on the Transformer coding layer structure, replacing the standard self-attention module MSA in AIFI with the HiLo attention module; The AIFI-HiLo module's processing flow is as follows: First, the feature map Q5 is transformed into a sequence form through dimensionality transformation, and learnable positional encoding (PosEmbed) is added to explicitly introduce spatial location information, generating a query vector Q, a key vector K, and a value vector V. Then, Q, K, and V are input into the HiLo attention module to simultaneously model local detail information and global contextual relationships. The output features of the HiLo attention module are added to the input feature sequence via residual connections and then normalized. The normalized features are further input into a feedforward neural network for nonlinear transformation. The output of the feedforward neural network is again processed through residual connections and layer normalization to obtain the AIFI-HiLo module's output feature map R5, whose spatial size and number of channels are consistent with feature map Q5. The AIFI-HiLo module achieves global dependency modeling and semantic enhancement of high-level features while maintaining the feature dimension unchanged. Its structural diagram is shown below. Figure 4 As shown.
[0030] After completing the AIFI-HiLo module processing, a multi-scale feature fusion module is constructed in the encoder. The multi-scale feature fusion module constitutes an improved feature pyramid network structure, which is used to realize the hierarchical fusion and information transmission between features of different scales. Furthermore, spatial domain feature fusion operations are performed on the multi-scale features to enhance the model's ability to express brain tumor targets of different sizes. The multi-scale feature fusion module employs a bidirectional feature fusion approach, combining top-down and bottom-up methods. In the top-down fusion process, high-level semantic features are upsampled and concatenated with adjacent low-level features along the channel dimension. In the bottom-up fusion process, low-level features are downsampled and concatenated with adjacent high-level features to achieve information interaction between features of different scales. At each scale feature fusion node, a RepC3-DCN feature fusion module is introduced to replace the standard convolutional fusion structure, as illustrated in the diagram below. Figure 5 As shown.
[0031] The RepC3-DCN feature fusion module processing flow is as follows: It adopts a dual-branch feature processing method based on a CSP structure, with the input being feature maps fused from adjacent scales. The input feature maps are processed in parallel into the first and second feature branches. In the first feature branch, the input feature map undergoes a 1×1 convolution operation, layer normalization, and SiLU activation function processing sequentially to perform channel compression and nonlinear mapping. Subsequently, the processed features are input into three cascaded deformable RepVggBlocks. Each deformable RepVggBlock contains a parallel structure of a 3×3 deformable convolution (DCN) branch and a 1×1 standard convolution branch. The deformable convolution learns additional offsets, allowing the convolution kernel sampling points to dynamically adapt to the irregular shape of the tumor. The standard convolution retains the original receptive field. The outputs of the two branches are summed and output through an activation function. In the second feature branch, the input feature map also undergoes a 1×1 convolution operation, layer normalization, and SiLU activation function processing sequentially. Activation function processing is used to preserve the channel mapping relationship of the original features and serve as a shallow feature propagation path. After completing the parallel processing of the two feature branches, the output features of the first and second feature branches are fused by element-wise addition to obtain the output feature map of the RepC3-DCN feature fusion module. In this way, while ensuring that feature information is fully preserved, deformable convolution is introduced to adapt the modeling ability of complex tumor structures, thereby improving the expression effect of multi-scale feature fusion.
[0032] Finally, after processing by the multi-scale feature fusion module, the encoder outputs three deeply fused feature maps with geometric adaptive capabilities, denoted as feature map F3, feature map F4, and feature map F5, respectively (spatial dimensions of 80×80, 40×40, and 20×20, with a uniform output channel number of 256), which serve as the input to the decoder.
[0033] A decoder is constructed to perform target decoding and detection prediction on the multi-scale feature map output by the encoder. The decoder adopts the original decoder structure in the RT-DETR model, including an IoU-aware query selection module, a decoder, and a detection head. The IoU-aware query selection module is used to filter queries based on the predicted target localization quality to retain high-quality queries for subsequent decoding. Based on the filtered queries, the decoder and detection head interact with the multi-scale feature map output by the encoder through a cross-attention mechanism to generate the category confidence of the brain tumor target and the corresponding bounding box location information. The output of the decoder is used to represent the final detection result of the brain tumor target in the input brain tumor MRI image.
[0034] Step 3: Input the training set C obtained in Step 1 into the Med-DETR network model constructed in Step 2 to train the parameters of the Med-DETR network model; In step 3: Throughout the training process, training was conducted on a server equipped with NVIDIA GPUs; key hyperparameter settings were as follows: batch size of 8, initial learning rate of 0.0001, optimizer of Adam, weight decay of 0.0001, and number of training epochs of 150. During model training, the network structure of the Med-DETR network remains unchanged, and the model parameters are optimized and updated by adjusting the form of the loss function.
[0035] For the bounding box regression task targeting brain tumors, the Focaler-EIoU loss function is used as the optimization objective for bounding box regression. The Focaler-EIoU loss function is based on the EIoU loss function, but introduces a focusing weighting mechanism based on the intersection-union ratio between the predicted bounding box and the corresponding ground truth bounding box. This allows the model to assign higher loss weights to brain tumor targets with larger localization errors during training, thereby guiding the model to pay more attention to brain tumor targets that are small in size, have blurred boundaries, and are difficult to locate.
[0036] In step 3, the specific method for optimizing and updating the model parameters by adjusting the form of the loss function is as follows: During model training, the corresponding focusing weights are calculated based on the IoU value between the predicted bounding box and the ground truth bounding box, and the focusing weights are combined with the EIoU loss function to form the final bounding box regression loss. The specific formula for the adjusted loss function Focaler-EIoU is as follows: In the formula It is the total number of samples. It is a sample The predicted probability is calculated, with the focusing parameter γ set to 2.0, and the EIOU loss function... It is the EIOU loss calculated for each sample.
[0037] By introducing the Focaler-EIoU loss function, the model's localization accuracy and training stability for difficult samples are improved while maintaining overall detection accuracy.
[0038] The trained Med-DETR network model was used to detect brain tumor MRI images in test set B2.
[0039] Example 1 The effects of this invention will be further illustrated below with simulation experiments: This invention was implemented on a server equipped with an Intel Xeon Platinum 8352V CPU, an NVIDIA GeForce RTX 4090 GPU, and 120GB of memory. The software environment was Ubuntu Linux, PyTorch 2.0.1, and CUDA 11.8.
[0040] Step 1 was performed using the brain tumor MRI image dataset A as the experimental data source. A stratified sampling strategy was employed, stratifying the dataset based on the scale of the tumor target in each brain tumor MRI image. The dataset A was then divided into training set B1 and test set B2, with 80% and 20% of the data being tested, respectively. Data augmentation operations such as Mosaic, Copy-Paste, RandomRotate, RandomZoomOut, RandomNoise, RandomGaussianBlur, and RandomIoUCrop were performed only on training set B1 to obtain training set C, thereby improving the diversity of training samples and the model's generalization ability.
[0041] Perform step 2 to construct the Med-DETR network model (brain tumor detection network model). In step 3, the training parameters are set. The training set C is input into the brain tumor detection network model for training. Throughout the training process, the batch size is set to 8, the initial learning rate is 0.0001, the epoch is 150, and the optimizer is Adam. Simultaneously, for the bounding box regression task of brain tumor targets, the Focaler-EIoU loss function is used as the optimization objective for bounding box regression. Finally, the trained Med-DETR network model is used to detect brain tumor MRI images in the test set B2.
[0042] To verify the effectiveness of the proposed method, the Med-DETR network model was compared with several mainstream models, including YOLOv5s, YOLOv8s, YOLO11s, DETR, Deformable DETR, and RT-DETR, under the same dataset and training settings. Table 1 shows the evaluation metrics results with other mainstream models, including mean accuracy (AP), mean accuracy at different target scales (APS, APM, and APL), and mean accuracy at different IoU thresholds (AP50 and AP75).
[0043] This embodiment selects two representative brain tumor MRI images, and their visualization results are as follows: Figures 6-8As shown, the Med-DETR network model is more accurate in locating tumors of different sizes, with fewer false positives. From Figures 6-8 As can be seen, while methods based on the YOLO series, DN-DETR, and Deformable-DETR can detect most large lesions, they still exhibit localization offsets in tumors with blurred boundaries or small size. Some models also generate redundant false detection boxes in normal brain tissue. RT-DETR and RT-DETRv2 improve overall localization accuracy, but for small lesions near the brain limb with low contrast, the predicted boxes still do not completely overlap with the ground truth labels. In contrast, the Med-DETR network model proposed in this embodiment can cover the tumor region well in all examples, with the predicted boxes fitting the ground truth labels more closely. Furthermore, it has higher confidence and almost no false detections in the background region. This method, based on the RT-DETR framework, significantly improves the detection accuracy of small target brain tumors by introducing a multi-level attention enhancement mechanism, an improved feature fusion module, and a loss function optimized for difficult samples.
[0044] Table 1. Comparison of performance indicators of each comparative model
[0045] Experimental results show that the Med-DETR network model constructed in this invention achieves the best overall detection performance. Specifically, it achieves an average precision (AP) of 0.783 and an accuracy (AP50) of 0.964 at an IoU threshold of 0.5, both superior to all comparative models. This improvement in overall performance is attributed to the multi-level attention enhancement mechanism integrated in this invention: the CBAM module used after feature projection effectively suppresses complex background interference in brain tumor MRI images and enhances the discriminative features of the tumor region; while the AIFI-HiLo module in the encoder improves the perception ability of small lesions and long-distance dependencies by co-modeling local details and global context, which is directly reflected in the small target detection accuracy (APS) reaching 0.525, a significant improvement of 4.2% compared to the baseline RT-DETR model. Meanwhile, Med-DETR also performed well at a higher IoU threshold (AP75, 0.880), which verifies that the RepC3-DCN feature fusion module integrating deformable convolution (DCN) enables the improved feature pyramid network to have a dynamic receptive field, which can better adapt to the irregular, variable shape and blurred boundaries of brain tumors, thereby improving localization accuracy.
[0046] Example 2 A brain tumor detection method integrating multi-level attention and deformable feature pyramids includes the following steps: Step 1: Data preparation and preprocessing to obtain the final training set C used for model training; Step 2: Construct the Med-DETR network model; Step 3: Input the training set C obtained in Step 1 into the Med-DETR network model constructed in Step 2 to train the parameters of the Med-DETR network model.
[0047] Example 3 The difference from Example 2 is as follows: Step 1 is as follows: Step 1.1: Obtain brain tumor MRI image dataset A, and perform stratified sampling of brain tumor MRI image dataset A based on the tumor target scale. The specific process includes the following steps: First, based on the proportion of the area occupied by the tumor bounding box in each brain tumor MRI image in the brain tumor MRI image dataset A, the brain tumor MRI images are scaled. After completing the scale classification, the brain tumor MRI image dataset A was divided into small-scale brain tumor MRI images, medium-scale brain tumor MRI images, and large-scale brain tumor MRI images. Within each scale category, 80% of the total number of brain tumor MRI images were randomly selected as the training set, and the remaining 20% were selected as the test set. The training set images selected from each scale category are merged to form training set B1; the test set images selected from each scale category are merged to form test set B2, thereby ensuring that the distribution ratio of brain tumor images of different scales in training set B1 and test set B2 is consistent. Step 1.2: Perform data augmentation operations only on the brain tumor MRI images in training set B1. For each brain tumor MRI image in training set B1, perform one or more data augmentation operations independently according to a preset probability. The brain tumor MRI images obtained after data augmentation and their corresponding updated tumor target annotation files together constitute an augmented training image set, which is denoted as training set C. The augmented images obtained through one or more data augmentation operations, together with the brain tumor MRI images in the original training set B1 that have not undergone augmentation, form the final training set C used for model training. Training set C serves as the input data for model training in step 3.
[0048] Example 4 The difference from Example 3 is as follows: In step 1.1, the specific scale classification standards are as follows: 1) Brain tumor MRI images in which the tumor bounding box occupies less than 5% of the area in the corresponding brain tumor MRI image are defined as small-scale tumor images; 2) Brain tumor MRI images in which the tumor bounding box occupies an area of 5% or more but less than 20% of the corresponding brain tumor MRI image are defined as mesoscale tumor images; 3) Brain tumor MRI images in which the tumor bounding box occupies an area of 20% or more in the corresponding brain tumor MRI image are defined as large-scale tumor images.
[0049] Example 5 The difference from Example 4 is as follows: In step 1.2, the data augmentation operations specifically include the following methods: (1) Mosaic enhancement: Four different brain tumor MRI images are randomly selected from the training set B1 with a probability of 0.15. The four brain tumor MRI images are cropped and the cropped image regions are combined into a new brain tumor MRI image according to the preset stitching rules, which is called the enhanced image C1. At the same time, according to the change relationship of image spatial position during cropping and stitching, the corresponding tumor bounding box annotations in the original four brain tumor MRI images are mapped and updated to keep them consistent with the enhanced image C1. (2) Copy-Paste enhancement: With a probability of 0.15, the first brain tumor MRI image is randomly selected from the training set B1, and the tumor target region is cropped from the tumor bounding box region marked on it; then, a second different brain tumor MRI image is randomly selected from the training set B1, and the tumor target region is pasted into the non-tumor region of the second brain tumor MRI image to generate a new brain tumor MRI image, which is denoted as enhanced image C2; at the same time, the tumor bounding box annotation information in the pasted image is updated; (3) Random rotation enhancement: With a probability of 0.1, random rotation is performed on the brain tumor MRI images selected from training set B1, and the rotation angle is within... The range of 3° to +3° is randomly selected; during the rotation, the area that exceeds the boundary of the original image after rotation is filled with zero value, and the position of the tumor boundary box after rotation is updated simultaneously to generate the enhanced image C3.
[0050] (4) Random downsizing enhancement: With a probability of 0.2, the brain tumor MRI images selected in the training set B1 are randomly downsized and then filled to the original image size. The unfilled areas are filled with zero values. Enhanced image C4 is generated in this way. (5) Random noise: Random noise is superimposed on the pixel values of brain tumor MRI images selected in training set B1 with a probability of 0.1 to generate enhanced image C5, which is used to improve the robustness of the model to MRI image noise interference. (6) Random Gaussian blur enhancement: Gaussian blur processing is performed on the brain tumor MRI images selected in the training set B1 with a probability of 0.1 to simulate the image blurring caused by equipment performance or slight patient movement during the imaging process, and an enhanced image C6 is generated. (7) Random IoU cropping enhancement: With a probability of 0.5, random cropping operation based on cross-union constraint is performed on the brain tumor MRI images selected in the training set B1. The cropping region is generated on the premise of ensuring that at least one complete tumor target is retained. According to the spatial position change of the cropped image, the corresponding tumor bounding box annotation information is recalculated to generate the enhanced image C7.
[0051] Example 6 The difference from Example 5 is as follows: In step 2, the Med-DETR network model consists of three parts: the backbone network, the encoder, and the decoder.
Claims
1. A brain tumor detection method integrating multi-level attention and deformable feature pyramids, characterized in that, Includes the following steps: Step 1: Data preparation and preprocessing to obtain the final training set C used for model training; Step 2: Construct the Med-DETR network model; Step 3: Input the training set C obtained in Step 1 into the Med-DETR network model constructed in Step 2 to train the parameters of the Med-DETR network model.
2. The brain tumor detection method integrating multi-level attention and deformable feature pyramids according to claim 1, characterized in that, Step 1 is as follows: Step 1.1: Obtain brain tumor MRI image dataset A, and perform stratified sampling of brain tumor MRI image dataset A based on the tumor target scale. The specific process includes the following steps: First, based on the proportion of the area occupied by the tumor bounding box in each brain tumor MRI image in the brain tumor MRI image dataset A, the brain tumor MRI images are scaled. After completing the scale classification, the brain tumor MRI image dataset A was divided into small-scale brain tumor MRI images, medium-scale brain tumor MRI images, and large-scale brain tumor MRI images. Within each scale category, 80% of the total number of brain tumor MRI images were randomly selected as the training set, and the remaining 20% were selected as the test set. The training set images selected from each scale category are merged to form training set B1; the test set images selected from each scale category are merged to form test set B2, thereby ensuring that the distribution ratio of brain tumor images of different scales in training set B1 and test set B2 is consistent. Step 1.2: Perform data augmentation operations only on the brain tumor MRI images in training set B1. For each brain tumor MRI image in training set B1, perform one or more data augmentation operations independently according to a preset probability. The brain tumor MRI images obtained after data augmentation and their corresponding updated tumor target annotation files together constitute an augmented training image set, which is denoted as training set C. The augmented images obtained through one or more data augmentation operations, together with the brain tumor MRI images in the original training set B1 that have not undergone augmentation, form the final training set C used for model training. Training set C serves as the input data for model training in step 3.
3. The brain tumor detection method integrating multi-level attention and deformable feature pyramids according to claim 2, characterized in that, In step 1.1, the specific scale classification standards are as follows: 1) Brain tumor MRI images in which the tumor bounding box occupies less than 5% of the area in the corresponding brain tumor MRI image are defined as small-scale tumor images; 2) Brain tumor MRI images in which the tumor bounding box occupies an area of 5% or more but less than 20% of the corresponding brain tumor MRI image are defined as mesoscale tumor images; 3) Brain tumor MRI images in which the tumor bounding box occupies an area of 20% or more in the corresponding brain tumor MRI image are defined as large-scale tumor images.
4. The brain tumor detection method integrating multi-level attention and deformable feature pyramids according to claim 2, characterized in that, In step 1.2, the data augmentation operations specifically include the following methods: (1) Mosaic enhancement: Four different brain tumor MRI images are randomly selected from the training set B1 with a probability of 0.
15. The four brain tumor MRI images are cropped respectively, and the cropped image regions are combined into a new brain tumor MRI image according to the preset stitching rules, which is called the enhanced image C1. At the same time, according to the change relationship of image spatial position during cropping and stitching, the corresponding tumor bounding box annotations in the original four brain tumor MRI images are mapped and updated to keep them consistent with the enhanced image C1. (2) Copy-Paste enhancement: With a probability of 0.15, the first brain tumor MRI image is randomly selected from the training set B1, and the tumor target region is cropped from the tumor bounding box region marked on it; then, a second different brain tumor MRI image is randomly selected from the training set B1, and the tumor target region is pasted into the non-tumor region of the second brain tumor MRI image to generate a new brain tumor MRI image, which is denoted as enhanced image C2; at the same time, the tumor bounding box annotation information in the pasted image is updated; (3) Random rotation enhancement: With a probability of 0.1, random rotation is performed on the brain tumor MRI images selected from training set B1, and the rotation angle is within... Randomly selected within the range of 3° to +3°; during the rotation process, the area that exceeds the boundary of the original image after rotation is filled with zero value, and the position of the tumor bounding box after rotation is updated simultaneously to generate the enhanced image C3; (4) Random downsizing enhancement: With a probability of 0.2, the brain tumor MRI images selected in the training set B1 are randomly downsized and then filled to the original image size. The unfilled areas are filled with zero values. Enhanced image C4 is generated in this way. (5) Random noise: Random noise is superimposed on the pixel values of brain tumor MRI images selected in training set B1 with a probability of 0.1 to generate enhanced image C5, which is used to improve the robustness of the model to MRI image noise interference. (6) Random Gaussian blur enhancement: Gaussian blur processing is performed on the brain tumor MRI images selected in the training set B1 with a probability of 0.1 to simulate the image blurring caused by equipment performance or slight patient movement during the imaging process, and an enhanced image C6 is generated. (7) Random IoU cropping enhancement: With a probability of 0.5, random cropping operation based on cross-union constraint is performed on the brain tumor MRI images selected in the training set B1. The cropping region is generated on the premise of ensuring that at least one complete tumor target is retained. According to the spatial position change of the cropped image, the corresponding tumor bounding box annotation information is recalculated to generate the enhanced image C7.
5. The brain tumor detection method integrating multi-level attention and deformable feature pyramids according to claim 1, characterized in that, In step 2, the Med-DETR network model includes three parts: a backbone network, an encoder, and a decoder.
6. The brain tumor detection method integrating multi-level attention and deformable feature pyramids according to claim 5, characterized in that, In step 2, the construction of the backbone network is used to extract multi-level features from the input brain tumor MRI image; The backbone feature extraction network adopts the ResNet-34 network structure; A 640×640 brain tumor MRI image is input into the backbone network. After passing through multiple convolutional operations and downsampling operations, the brain tumor MRI image outputs three basic feature maps at different spatial scales, denoted as feature map S3, feature map S4, and feature map S5, respectively. The feature map S3 has a spatial size of 80×80 and 256 channels; The feature map S4 has a spatial size of 40×40 and 512 channels; The feature map S5 has a spatial size of 20×20 and 1024 channels; Feature maps S3, S4, and S5 together constitute the output of the backbone feature extraction network, which is used for subsequent encoder processing.
7. The brain tumor detection method integrating multi-level attention and deformable feature pyramids according to claim 5, characterized in that, In step 2, the encoder receives three feature maps S3, S4 and S5 output from the backbone network, and performs channel mapping operations on feature maps S3, S4 and S5 respectively. Specifically, a 1×1 convolution operation is applied to feature maps S3, S4 and S5 respectively, and their channel numbers are uniformly mapped to 256, thereby obtaining channel-aligned feature maps, which are denoted as feature map P3, feature map P4 and feature map P5 respectively; Subsequently, CBAM modules were introduced into feature maps P3, P4, and P5 respectively to enhance the attention weighting of features at each scale. The CBAM module sequentially applies channel attention weighting and spatial attention weighting to the input feature map. It has 256 input channels and 256 output channels, which are used to enhance the discriminative features of tumor-related regions and suppress irrelevant background information. The feature maps processed by CBAM are denoted as feature map Q3, feature map Q4, and feature map Q5, respectively. On the highest-level feature map Q5, the AIFI-HiLo module is applied to model long-range dependencies. The AIFI-HiLo module is built based on the Transformer coding layer structure, replacing the standard self-attention module MSA in AIFI with the HiLo attention module. The processing flow of the AIFI-HiLo module is as follows: First, the feature map Q5 is transformed into a sequence form through dimensionality transformation and learnable positional encoding is added to explicitly introduce spatial location information, generating query vector Q, key vector K, and value vector V. Then, Q, K, and V are input into the HiLo attention module to simultaneously model local detail information and global contextual relationships. The output features of the HiLo attention module are added to the input feature sequence through residual connections and then subjected to layer normalization. The layer-normalized features are further input into a feedforward neural network for nonlinear transformation. The output of the feedforward neural network is again processed through residual connections and layer normalization to obtain the output feature map R5 of the AIFI-HiLo module, whose spatial size and number of channels are consistent with feature map Q5. After completing the AIFI-HiLo module processing, a multi-scale feature fusion module is built in the encoder to further perform spatial domain feature fusion operations on the multi-scale features, so as to enhance the model's ability to express brain tumor targets of different sizes. The multi-scale feature fusion module adopts a two-way feature fusion approach, which is both top-down and bottom-up. In the top-down fusion process, high-level semantic features are concatenated with adjacent low-level features in the channel dimension through upsampling operations; in the bottom-up fusion process, low-level features are concatenated with adjacent high-level features through downsampling operations to achieve information interaction between features of different scales; at each feature fusion node, a RepC3-DCN feature fusion module is introduced to replace the standard convolutional fusion structure. The RepC3-DCN feature fusion module processing flow is as follows: It adopts a dual-branch feature processing method based on CSP structure, and its input is the feature map after fusion of adjacent scales; the input feature map is processed in parallel into the first feature branch and the second feature branch respectively; in the first feature branch, the input feature map is processed by 1×1 convolution operation, layer normalization processing and SiLU activation function processing in sequence, which is used to perform channel compression and nonlinear mapping on the features; Subsequently, the processed features are input into three cascaded deformable RepVggBlocks. Each deformable RepVggBlock contains a parallel structure of a 3×3 deformable convolution branch and a 1×1 standard convolution branch: the deformable convolution learns through additional offsets, enabling the convolution kernel sampling points to dynamically adapt to the irregular shape of the tumor. Standard convolution preserves the original receptive field, and the outputs of the two branches are added together and then output through an activation function. In the second feature branch, the input feature map is also processed by a 1×1 convolution, layer normalization, and SiLU activation function in sequence to preserve the channel mapping relationship of the original features and serve as a shallow feature propagation path. After completing the parallel processing of the two feature branches, the output features of the first feature branch and the second feature branch are fused by adding them element by element to obtain the output feature map of the RepC3-DCN feature fusion module. Finally, after processing by the multi-scale feature fusion module, the encoder outputs three deeply fused feature maps with geometric adaptability, denoted as feature map F3, feature map F4, and feature map F5, which serve as the input to the decoder.
8. The brain tumor detection method integrating multi-level attention and deformable feature pyramids according to claim 5, characterized in that, In step 2, the decoder is constructed to perform target decoding and detection prediction on the multi-scale feature map output by the encoder. The decoder adopts the original decoder structure in the RT-DETR model, including an IoU-aware query selection module, a decoder, and a detection head. The IoU-aware query selection module is used to filter queries based on the predicted target localization quality. Based on the filtered query, the decoder and detector interact with the multi-scale feature map output by the encoder through a cross-attention mechanism to generate the category confidence of the brain tumor target and the corresponding bounding box location information. The decoder output is used to characterize the final detection result of the brain tumor target in the input brain tumor MRI image.
9. The brain tumor detection method integrating multi-level attention and deformable feature pyramids according to claim 1, characterized in that, In step 3: Throughout the training process, training was conducted on a server equipped with NVIDIA GPUs; key hyperparameter settings were as follows: batch size of 8, initial learning rate of 0.0001, optimizer of Adam, weight decay of 0.0001, and number of training epochs of 150. During model training, the network structure of the Med-DETR network remains unchanged, and the model parameters are optimized and updated by adjusting the form of the loss function.
10. The brain tumor detection method integrating multi-level attention and deformable feature pyramids according to claim 9, characterized in that, In step 3, the specific method for optimizing and updating the model parameters by adjusting the form of the loss function is as follows: During model training, the corresponding focusing weights are calculated based on the IoU value between the predicted bounding box and the ground truth bounding box, and the focusing weights are combined with the EIoU loss function to form the final bounding box regression loss. The specific formula for the adjusted loss function Focaler-EIoU is as follows: In the formula It is the total number of samples. It is a sample The predicted probability is calculated, with the focusing parameter γ set to 2.0, and the EIOU loss function... It is the EIOU loss calculated for each sample.