CIP lung CT image detection method based on improved YOLOv8

By improving the YOLOv8 network, introducing SPD-Conv, coordinate attention mechanism and step-by-step feature fusion, and combining structural reparameterization technology, the accuracy and efficiency issues of lesion detection in CIP lung CT images were solved, and efficient lesion identification and diagnosis support were achieved.

CN120612573APending Publication Date: 2025-09-09CHINA JILIANG UNIV +1
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202510449340.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-11
Publication Date
2025-09-09

AI Technical Summary

Technical Problem

Existing technologies for lesion detection in CIP lung CT images suffer from low contrast, blurred boundaries, and complex background interference, leading to missed or false detections. They also rely on physician experience and lack accurate automated detection methods.

Method used

Abstract: In order to improve the quality of life of patients with CIP lung CT image detection, an improved YOLOv8 network was used. The SPD-Conv module was used to retain shallow detail information. The coordinate attention mechanism was introduced to enhance the focus on the lesion area. A step-by-step feature fusion strategy was adopted, combined with the structural reparameterization technology for lightweight optimization. A CIP lung CT image detection network was constructed.

Benefits of technology

The accuracy of target detection in CIP lung CT images and the efficiency of model inference are improved, the amount of computation is reduced, the detection capability of small lesions is enhanced, the efficiency of the feature extraction network is optimized, and a lightweight balance between performance and efficiency is achieved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120612573A_ABST
    Figure CN120612573A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of medical image processing and deep learning networks, and discloses an improved YOLOv8-based CIP lung CT image detection method, which comprises the following steps of: collecting a lung CT image, extracting a lung parenchyma image, inputting the lung parenchyma image into a CIP lung CT image detection network which is trained offline, and obtaining an image containing a target detection frame and confidence; in a backbone of the CIP lung CT image detection network, an SPD-Conv module is used for replacing all CBS modules except a first layer, and an RVC2f module is used for replacing C2f modules of the backbone and the neck; a CA module is added behind each RVC2f module of the neck, and multi-scale feature representation is generated by adopting a gradual feature fusion strategy. According to the invention, while the light weight of the network is realized, a gradual feature fusion mode is adopted, and the accuracy of CT image target detection and the model reasoning efficiency are enhanced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of medical image processing and deep learning network technology, and specifically relates to a detection method for CIP lung CT images based on improved YOLOv8. Background Art

[0002] Immune checkpoint inhibitors (ICIs), as a novel immunotherapy strategy, have demonstrated significant efficacy in the treatment of various malignancies, including non-small cell lung cancer and clear cell renal cell carcinoma. However, this type of therapy can lead to overactivation of the immune system, triggering a series of immune-related adverse events (irAEs), primarily affecting the lungs, skin, gastrointestinal tract, liver, and endocrine system. Among these, checkpoint inhibitor pneumonitis (CIP), a severe lung injury that can occur during ICI treatment, has become a focus of clinical attention due to its potential lethality.

[0003] Currently, the initial diagnosis of CIP relies primarily on imaging examinations. Typical manifestations of CIP on computed tomography (CT) images include ground-glass opacities, consolidation, small nodules, and patchy consolidation. However, due to the complexity and diversity of these imaging features, and the significant variability in CT manifestations between patients, accurate identification of CIP is challenging. Furthermore, the interpretation of CIP images is highly dependent on the physician's expertise and clinical experience, and subjective factors may lead to diagnostic uncertainty. Therefore, the introduction of deep learning technology for lesion detection in CT images can not only provide objective analysis results, but also improve the efficiency of early screening and diagnosis of CIP to a certain extent, providing strong support for clinical decision-making.

[0004] There has been considerable research into using deep learning techniques to aid in the diagnosis of CIP. For example, patent publication number CN117668760A, "A Multimodal Immunosuppressant-Associated Pneumonia Classification Method Based on Deep Learning," proposes a classification network based on CT images and electronic medical records, and uses a deep learning model to predict CIP classification results. However, such methods can only provide auxiliary decision support for physicians; the final diagnosis still requires a comprehensive assessment based on clinical data such as CT images. CT images, as an important basis for CIP diagnosis, can intuitively display typical lesion features such as ground-glass opacities and consolidation. Therefore, accurate detection of these lesions is crucial for image analysis, disease assessment, and diagnostic decision-making. However, because lesions in CIP patients' CT images typically have low contrast, blurred boundaries, and small size, and are often accompanied by complex background interference such as the trachea and blood vessels, traditional target detection algorithms are prone to missed or false detections. Therefore, it is necessary to propose a target detection method optimized for lesion features in CIP patients' CT images to improve the accuracy of lesion identification. Summary of the Invention

[0005] The technical problem to be solved by the present invention is to provide a detection method for CIP lung CT images based on an improved YOLOv8, which is used to fuse the multi-level features extracted by the backbone network in a step-by-step feature fusion manner to enhance the accuracy of CIP lung CT image target detection and the efficiency of model inference, while achieving network lightweighting.

[0006] To solve the above technical problems, the present invention provides a CIP lung CT image detection method based on an improved YOLOv8, which includes the following steps: acquiring a patient's lung CT image, performing preprocessing to extract a lung parenchyma image, then inputting the lung parenchyma image into an offline trained CIP lung CT image detection network to obtain a result map containing a target detection box and a detection confidence score;

[0007] The CIP lung CT image detection network is based on an improved Yolov8 network. In the backbone, the SPD-Conv module replaces all CBS modules except the first layer, and the RV_C2f module replaces the original C2f module. The RV_C2f module replaces the original C2f module in the neck, and a CA module is added after each RV_C2f module in the neck. A step-by-step feature fusion strategy is used to generate multi-scale feature representation. The detection head adopts the detection head of the Yolov8 network.

[0008] As an improvement to the detection method of CIP lung CT images based on improved YOLOv8 of the present invention:

[0009] The RV_C2f module is:

[0010] RepConv is used to replace the bottleneck structure in the original C2f module. In the original C2f module, the bottleneck structure uses multiple convolutional layers to gradually extract features, while repConv uses three parallel branches: 3×3 convolution, 1×1 convolution, and identity mapping to capture feature information during the training phase of the model. During the inference phase of the model, the three parallel branches are equivalent to a 3×3 convolution operation.

[0011] As a further improvement of the detection method of CIP lung CT images based on improved YOLOv8 of the present invention:

[0012] The specific process of generating multi-scale feature representation of the neck is as follows:

[0013] (1) Features P3, P4, and P5 output by the backbone network serve as input to the neck;

[0014] (2) Feature P3 is downsampled using the SPD-Conv module and then fused with feature P4 to obtain feature N4. At the same time, feature P4 is upsampled and fused with feature P3 to obtain feature N3.

[0015] (3) After the features N3, N4 and P5 are processed by the RV_C2f module and the CA module, the features N′3, N′4 and N′5 are obtained respectively;

[0016] (4) Feature N′5 is upsampled twice, feature N′4 is upsampled once, and then fused with feature N′3. After passing through the RV_C2f module and the CA module, feature N″3 is output;

[0017] Perform an upsampling on feature N′5, perform an SPD-Conv operation on feature N′3, perform downsampling, and fuse it with feature N′4. After passing through the RV_C2f module and the CA module, the output feature N″4 is output.

[0018] Perform two SPD-Conv operations on feature N′3 to perform downsampling, perform one SPD-Conv operation on feature N′4 to perform downsampling, and then fuse it with feature N′5. After passing through the RV_C2f module and the CA module, the output feature N″5 is output.

[0019] As a further improvement of the detection method of CIP lung CT images based on improved YOLOv8 of the present invention:

[0020] The pre-processing process is as follows:

[0021] (1) Use the global threshold method to obtain the threshold S end , performing a binarization operation on the lung CT image and dividing it into foreground and background;

[0022] (2) Use the flood filling algorithm to fill the area outside the lung parenchyma and perform the inverse operation;

[0023] (3) De-noising;

[0024] (4) fill any gaps in the lung parenchyma region by morphological closing operations, again applying the flood-fill technique;

[0025] (5) Performing a bitwise AND operation on the processed lung region and the grayscale image of the lung CT image to extract the complete lung parenchyma region and save it as a lung parenchyma image.

[0026] As a further improvement of the detection method of CIP lung CT images based on improved YOLOv8 of the present invention:

[0027] The threshold S end The iterative process is as follows:

[0028] (1) Set the initial value of the threshold S to: S = (G max +G min ) / 2, where G max is the maximum gray value, G min is the minimum gray value G min ;

[0029] (2) Use S as the threshold to perform a binarization operation to divide the image into foreground and background, and calculate the average gray value Gf of the foreground and the average gray value Gf of the background respectively. b , update the threshold S to G f With G b The average value of the threshold value and the absolute value of the difference between the current threshold value and the previous threshold value S sub ;

[0030] (3) If S sub If the value is less than the set parameter S0, then S sub is the threshold S end Otherwise, continue to iterate steps (1) and (2) until the threshold S is found. end .

[0031] As a further improvement of the detection method of CIP lung CT images based on improved YOLOv8 of the present invention:

[0032] The offline training process of the CIP lung CT image detection network is as follows:

[0033] Lung CT images of patients with CIP and those without CIP were collected and desensitized, and the lesion areas were labeled. The dataset was divided into training, validation, and test sets in a ratio of 8:1:1. The training set was input into the CIP lung CT image detection network for training. A learning rate adjustment strategy combining warm-up training and cosine annealing was adopted, and the SGD optimizer was used to update the network parameters. Training ended after reaching a preset number of rounds. The test set was then used to verify the model's evaluation indicators.

[0034] The beneficial effects of the present invention are mainly reflected in:

[0035] 1. The present invention extracts lung parenchyma area images from CT images through preprocessing. Compared with the method of directly using CT images for inference, other structures in the CT images except lung tissue are excluded before model inference. This can not only effectively eliminate interference and improve diagnostic accuracy, but also reduce the amount of calculation in the feature extraction process, optimize the efficiency of the feature extraction network, and speed up model training.

[0036] 2. The present invention introduces SPD-Conv into the backbone network, which maximizes the retention of shallow detail information, effectively reduces the loss of detail information, and improves the network's ability to detect small-sized lesions;

[0037] 3. The present invention introduces the CA attention mechanism in the neck to improve the model's attention to the lesion area and enhance the ability to accurately extract its spatial position information. At the same time, it adopts a gradual feature fusion strategy. Compared with the original neck structure of Yolov8, it can more effectively gradually fuse features of different levels, effectively reducing the semantic differences between features of each layer, so that the final output features of each layer have more consistent semantic expression, thereby better serving the target detection task.

[0038] 4. This paper introduces structural reparameterization technology to the key module C2f of the original YOLOv8 model, and makes lightweight improvements to achieve a better balance between performance and efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] The specific embodiments of the present invention are further described in detail below with reference to the accompanying drawings.

[0040] Figure 1 Schematic diagram of the CT image preprocessing process of the present invention;

[0041] Figure 2 Schematic diagram of the structure of the CIP lung CT image detection network based on improved YOLOv8 of the present invention;

[0042] Figure 3 Schematic diagram of the network structure of SPD-Conv;

[0043] Figure 4 Schematic diagram of the principle of coordinate attention mechanism;

[0044] Figure 5 Schematic diagram of the neck structure of the CIP lung CT image detection network of the present invention;

[0045] Figure 6 It is a structural diagram of the RV_C2f module of the present invention. DETAILED DESCRIPTION

[0046] The present invention is further described below with reference to specific embodiments, but the protection scope of the present invention is not limited thereto:

[0047] Example 1: A CIP lung CT image detection method based on an improved YOLOv8. This method improves and optimizes the existing YOLOv8 object detection network to construct a CIP lung CT image detection network. This method introduces the SPD-Conv module, coordinate attention mechanism, structural reparameterization technology, and a step-by-step feature fusion approach to fuse multi-level features to enhance the accuracy of CIP lung CT image object detection and model inference efficiency. A CT image dataset is then collected from a partner hospital and preprocessed to extract lung parenchyma images. The CIP lung CT image detection network is then trained and tested offline using this preprocessed dataset to obtain the final trained network.

[0048] 1. CT image dataset acquisition and processing

[0049] 1.1 CT image dataset acquisition

[0050] Lung CT images were collected. The lung CT images used in this study were obtained from the imaging systems of partner hospitals. During data collection, all images were desensitized to ensure patient privacy. Lesion areas were annotated by professional physicians. The dataset includes 355 patients with CIP and 293 patients without CIP, totaling 1,446 CT images.

[0051] 1.2 CT image preprocessing

[0052] In addition to lung tissue, CT images also contain other structures such as the trachea, trunk, and scanning equipment. These structures are irrelevant to actual lesion detection and may be mistakenly identified as lesion areas during the detection process. Therefore, removing irrelevant areas and retaining only the lung organs can not only effectively eliminate interference and improve diagnostic accuracy, but also reduce the amount of calculation in the feature extraction process, optimize the efficiency of the feature extraction network, and speed up model training. After comparing different methods, the preprocessing process of the present invention is as follows:

[0053] First, the global threshold method is used to find the final threshold S through continuous iteration. end , using the threshold S end Separate the image into foreground and background:

[0054] (1) Set a global threshold initial value S, generally using the maximum grayscale value G of the CT image max With the minimum gray value G min The average of S = (G max +G min ) / 2.

[0055] (2) Use S as the threshold to perform a binarization operation to divide the image into foreground and background, and calculate the average grayscale value G of the foreground respectively. f The average gray value G of the background b , update the threshold S to G f With G b The average value, that is, S=(G f +G b ) / 2. At the same time, record the absolute value S of the difference between the current threshold and the previous threshold sub .

[0056] (3) If S sub If it is less than the set parameter S0, the final threshold S is found. end , that is, S sub is the threshold S end Otherwise, continue to iterate steps (1) and (2) until the final threshold S is found. end .

[0057] After obtaining the final threshold S end After that, the CT image is binarized and divided into foreground and background. Subsequently, the flood filling algorithm is used to fill the area outside the lung parenchyma, and the image is inverted after the filling is completed. Next, the image is denoised, and the gaps that may exist in the lung parenchyma area are filled by morphological closing operations. After the morphological processing is completed, in order to ensure that all unfilled small areas are covered, the flood filling technique is applied again. Finally, the processed lung area is bitwise ANDed with the original grayscale image to extract the complete lung parenchyma area, and the processing result (lung parenchyma image) is saved. The entire lung parenchyma extraction process is as follows: Figure 1 shown.

[0058] Considering that the amount of original data is not large, which may lead to underfitting of the model, the present invention uses a variety of data augmentation techniques to expand the training samples and improve the generalization ability, including horizontal and vertical flipping of the CT image after lung parenchyma extraction, randomly selecting different angles to rotate the CT image, and randomly cropping the image while ensuring that the lesion area is fully labeled.

[0059] 2. Build a CIP lung CT image detection network based on improved YOLOv8

[0060] The CIP lung CT image detection network is improved based on YOLOv8. The overall architecture consists of three parts: the backbone network (Backbone), the feature processing module (Neck), and the prediction head (Head). In the backbone network of the CIP lung CT image detection network, the present invention uses the SPD-Conv module to replace all CBS modules except the first layer, and uses the RV_C2f module to replace the original C2f module. That is, the backbone network includes a CBS module, a hierarchical structure of four consecutive layers of SPD-Conv modules + RV_C2f modules, and an SPPF module to perform multi-scale feature extraction on the input image and output two shallow features of different scales (features P3 and P4) and one deep feature (feature P5); the neck uses the RV_C2f module to replace the original C2f module, and a CA attention module is added after each RV_C2f module in the neck. The multi-scale feature map generated by the backbone network is fused using a step-by-step feature fusion strategy, thereby enhancing the model's detection ability for targets of different sizes; finally, the Head module uses the fused features to predict the target category and position. The overall architecture is as follows Figure 2 The specific improvement work will be introduced next.

[0061] 2.1 Network Optimization Based on SPD-Conv

[0062] In the CT images of CIP patients, lesions often show characteristics such as small size, low contrast and blurred boundaries, which makes it easy for traditional convolutional neural network structures to miss or misdetect lesions during lesion detection. In order to solve this problem, the present invention introduces SPD-Conv to replace the traditional CBS module on the basis of the YOLOv8 framework to reduce the loss of detail information and enhance the network's detection ability for small-sized lesions. SPD-Conv consists of a space-to-depth layer (Space-to-Depth, SPD) and a non-strided convolution layer (Non-Strided Convolution, Conv). It is an efficient convolution module that takes into account both feature downsampling and detail information retention. Its core idea is to retain local information to the maximum extent while reducing the spatial resolution of the feature map, avoiding the pixel loss problem caused by traditional downsampling operations.

[0063] The network structure of SPD-Conv is as follows Figure 3 As shown, it is assumed that the SPD-Conv module takes a feature map V of size A×A×C1 as input and divides it by a preset scale parameter q to generate a series of sub-feature maps. The mathematical expression of this process is shown in formula (2.1):

[0064]

[0065] In practical applications, the SPD-Conv module usually sets the scale parameter q=2, that is, in the feature division stage, each input feature map V is decomposed into 4 sub-feature maps of size A / 2×A / 2×C1. Subsequently, these sub-feature maps are spliced ​​along the channel dimension to form an intermediate feature map V′, whose spatial size is reduced to half of the original, while the number of channels is expanded to 4 times. In order to further optimize the feature representation, SPD-Conv uses a strideless convolution layer to process the intermediate feature map V′ and convert it into a final feature map V″ of size A / 2×A / 2×C2, where C2<4*C1. The core goal of this strideless convolution design is to suppress redundant information, while reducing the number of channels, while retaining key feature information to the maximum extent, and avoiding information dispersion or aliasing problems caused by channel amplification.

[0066] In summary, SPD-Conv uses the SPD layer to perform a "decomposition-recombination" operation on features, and then integrates the feature maps using a strideless convolutional layer, maximizing the preservation of shallow-level details. By introducing SPD-Conv into the network, it can effectively reduce the loss of detailed information and improve the network's ability to detect small lesions.

[0067] 2.2 Network Optimization Based on Coordinate Attention Mechanism

[0068] In the task of lesion detection in CT images, it is crucial to accurately distinguish lesions from normal lung tissue. However, since most lesions usually have low contrast and blurred boundaries, the difference between them and the surrounding normal tissue is relatively weak, which increases the difficulty of detection. In addition, there may be a lot of complex background information in CT images, such as blood vessels, airways and other tissue structures. These factors will interfere with the identification of lesions. Therefore, introducing an attention mechanism in the lesion detection task can effectively enhance the model's attention to the lesion area, allowing it to focus more accurately on the edge contours, texture features and morphological changes of the lesions, while suppressing the interference of complex background information and improving detection accuracy.

[0069] The Coordinate Attention (CA) mechanism introduces spatial information encoding, not only focusing on channel information, but also performing feature encoding in the horizontal and vertical directions, thereby retaining rich spatial structural information during the feature extraction process. This approach enables the model to focus more accurately on the edge features and spatial distribution of lesions when processing CT images, thereby improving the ability to locate the target area. In addition, because the coordinate attention mechanism maintains the integrity of spatial information while extracting features, the model can better understand the morphology and position of the lesion within the overall field of view, thereby enhancing its adaptability to complex backgrounds and improving detection accuracy. The principle of the coordinate attention mechanism is as follows Figure 4 shown.

[0070] Assume that the input feature map X = [x1, x2, x3, ..., x c ], the dimension of X is H×W×C, where H, W and C are the height, width and number of channels of the feature map respectively. First, one-dimensional global average pooling is performed on the feature map X along the horizontal and vertical directions to obtain s h With s w This operation not only allows the pooled feature map to maintain accurate position information in one direction, but also establishes a long-distance dependency relationship in the other direction. The output of the cth channel of the feature map at height h With the output on width w The calculation process is shown in formulas (2.2)-(2.3).

[0071]

[0072] In order to integrate the spatial features in the horizontal and vertical directions, the feature maps s generated by the two dimensions are h With s w The concatenation is then performed, followed by channel compression through a 1×1 convolution V1, and then processed by the activation function δ. The intermediate feature map O generated by this process effectively encodes bidirectional spatial information, and its calculation process is shown in Equation (2.4).

[0073] O=δ(V1([s h ,s w ])) (2.4)

[0074] Among them, [s h ,s w ] indicates s h With s w After concatenation, the size of the feature map O is H×W×C / r, where r is the compression ratio of the feature channel. Then, the feature map O is decoupled into the horizontal and vertical feature representations o in the spatial dimension. h and o w. Then, through the convolution V of size 1×1 h and V w The features in these two directions are channel-expanded to make their dimensions match the input feature map. Then these two features are passed through the Sigmoid function to obtain the generated attention f h and f w , and finally, the generated attention f h and f w Acting on the input feature map X yields the output feature map. h and f w The specific calculation process is shown in (2.5)-(2.6):

[0075] f h =Sigmoid(V h (o h )) (2.5)

[0076] f w =Sigmoid(V w (o w )) (2.6)

[0077] In summary, in order to improve the model's attention to the lesion area and enhance the ability to accurately extract its spatial location information, the present invention improves the neck network (Neck) structure during the optimization process of the YOLOv8 algorithm. In the feature fusion stage, the coordinate attention mechanism is introduced after the RV_C2f module to enhance the network's ability to characterize the lesion. This optimization strategy not only helps the model focus on the lesion area more accurately in a complex background, but also effectively improves the robustness and accuracy of target detection, thereby improving the overall detection performance.

[0078] 2.3 Network Optimization Based on Stepwise Feature Fusion Strategy

[0079] In the original design of YOLOv8, the Neck layer uses a PAN structure to achieve feature fusion. However, since PAN mainly focuses on the fusion of features from adjacent layers, it may lead to large semantic differences between the multi-scale features finally obtained.

[0080] To solve this problem, the present invention adopts a gradual feature fusion strategy. This strategy effectively reduces the semantic differences between features at each layer by gradually fusing features at different levels, so that the features at each layer of the final output have more consistent semantic expressions, thereby better serving the target detection task. Figure 5As shown in the figure, the feature fusion network designed in this paper first fuses features P3 and P4 from the feature extractor (backbone network): feature P3 is downsampled using the SPD-Conv module and then fused with feature P4 to obtain feature N4. At the same time, feature P4 is upsampled using the nearest neighbor interpolation method and then fused with feature P3 to obtain feature N3. To enhance the network's adaptability, this paper introduces learnable weight parameters in the feature map splicing process. These parameters are normalized and used as fusion coefficients for features at different layers, which are multiplied with the corresponding feature maps. In this way, the network can automatically learn the optimal feature fusion strategy. After completing the initial fusion of P3 and P4, feature P5, which contains rich semantic information, is further introduced. The specific steps are as follows: feature N3, feature N4 and feature P5 are respectively passed through the RV_C2f module and the CA module to obtain feature N′3, feature N′4 and feature N′5 respectively; feature N′5 is upsampled twice, feature N′4 is upsampled once, and then fused with feature N′3, and then passed through the RV_C2f module and the CA module to obtain feature N″3; feature N′5 is upsampled once, feature N′3 is downsampled once by an SPD-Conv operation, and then fused with feature N′4, and then passed through the RV_C2f module and the CA module to obtain feature N′′4; feature N′3 is downsampled twice by an SPD-Conv operation, feature N′4 is downsampled once by an SPD-Conv operation, and then fused with feature N′5, and then passed through the RV_C2f module and the CA module to obtain feature N″5. By deeply fusing the three layers of features in this way, we ultimately generate and output multi-scale feature representations for object detection: features N″3, N″4, and N″5. This gradual feature fusion scheme not only maintains the diversity of features at different scales, but also significantly enhances the semantic consistency between features, laying the foundation for improving object detection performance.

[0081] 2.4 Network Optimization Based on Structural Reparameterization

[0082] In S201-S203, the present invention proposes several improved modules, which effectively enhance the model's detection performance in complex scenarios. However, these improvements inevitably increase the model's structural complexity and computational overhead, potentially adversely affecting inference speed. To address this issue, this study, inspired by the lightweight model RepVGG, introduces a structural reparameterization technique to lightweight the key module C2f in the YOLOv8 model, achieving a better balance between performance and efficiency.

[0083] Structural reparameterization is a method that uses different network structures during training and inference. Specifically, during training, complex structures such as multi-branch and multi-scale feature fusion can be used to improve the model's learning ability and robustness. During inference, these complex structures are compressed into a single standard convolutional structure through equivalent transformations, significantly reducing computational complexity and memory usage. RepVGG is a typical example. During training, it introduces multiple parallel convolutional branches (such as 3×3 convolutions, 1×1 convolutions, and identity branches). These branches can capture feature information at different scales to enrich feature expression capabilities. During inference, these branches are merged into a single 3×3 convolution kernel through equivalent transformations, simplifying the complex network structure into a standard convolution operation. This structural reparameterization technique not only significantly reduces computational complexity but also reduces memory usage, significantly speeding up the model during inference while maintaining the high performance characteristics of the training phase.

[0084] As a key component in YOLOv8, the C2f module is mainly responsible for efficient feature fusion and information transmission. Its internal structure consists of multiple BottleNeck blocks. These modules not only use depthwise separable convolution, but also achieve efficient information flow through cross-layer connections. The present invention uses structural reparameterization technology to improve the C2f module as follows: (1) Multi-branch design and fusion. During the training phase, a multi-branch structure is designed for the BottleNeck block in the C2f module. This structure not only retains the original convolution operation, but also adds auxiliary branches such as 1×1 convolution and identity mapping. Through parallel computing, these branches can capture rich feature information at different scales and levels, thereby enhancing the model's expressive power and learning efficiency during the training phase; (2) Equivalent transformation simplifies the network. During the inference phase, in order to reduce computational complexity, this study uses the principle of structural reparameterization to perform equivalent transformation on the multi-branch structure. Specifically, by mathematically merging the convolution kernels and bias terms of each branch in the training phase, the original complex multi-path calculation is converted into a single 3×3 convolution operation. This not only greatly reduces the amount of computation, but also reduces memory usage, achieving efficient reasoning. After the above re-parameterization improvements, the optimized C2f module is named RV_C2f module, and its specific structure is as follows Figure 6 shown.

[0085] 3. Training the model

[0086] 3.1 Training Configuration

[0087] Training is performed on a CentOS operating system server. The development environment is based on the Pytorch deep learning framework. The specific software and hardware configurations are shown in Table 1:

[0088] Table 1

[0089] name Environment Configuration operating system CentOS 7.3.1611 processor Intel(R) Xeon(R) CPU E5-2609v3@1.9GHz 12 cores Graphics card NVIDIA Telsla P4 16GB Memory 256GB Development Environment Python 3.8 + PyTorch 1.13

[0090] 3.2 Training Process

[0091] The dataset was first split into a training set, a test set, and a validation set in a ratio of 8:1:1. The training set was then input into the network constructed in step S2 for training. The network of the present invention employed a learning rate adjustment strategy that combined warm-up training with cosine annealing. Considering that model weights were randomly initialized in the early stages of training, directly using a higher learning rate could result in excessive gradient updates, causing model oscillation or training instability. Therefore, during the warm-up training phase, the learning rate was gradually increased from 0 to 0.01. After the warm-up phase, the cosine annealing algorithm was used to dynamically adjust the learning rate, and the SGD optimizer was used to update the network parameters. The overall parameter settings were as follows: the number of training rounds was set to 100, the batch size was 32, the initial learning rate was 0.01, the momentum parameter was 0.9, and the weight decay coefficient was 0.0005. Training was terminated after reaching the preset number of rounds. The model evaluation metrics were then calculated using the test set, with the accuracy reaching 0.8635 and the mAP@0.5 reaching 0.8978.

[0092] 4. Online use

[0093] First, a lung CT image of the patient is obtained and preprocessed as in step 1 to extract the lung parenchyma image. The preprocessed CT image is then fed into the offline-trained CIP lung CT image detection network to generate a result map containing target detection boxes and detection confidence levels, providing auxiliary analysis support for doctors.

[0094] experiment:

[0095] 1. RV_C2f module effectiveness analysis experiment

[0096] This paper uses structural reparameterization to optimize the C2f module of YOLOv8 and proposes the RV_C2f structure. This structure aims to balance model performance and computational overhead while mitigating the model parameter inflation problem caused by other improved modules. Table 2 shows the performance comparison data before and after the improvement.

[0097] Table 2

[0098]

[0099] YOLOv8-C2f represents the basic Yolov8 network using the C2f module, and YOLOv8-RV_C2f represents the comparison network constructed by replacing the C2f module in the basic Yolov8 network with the RV_C2f module of the present invention. Analysis of Table 2 shows that the lightweight improvement only slightly reduces the overall detection performance indicators, but analysis of Table 3 shows that it significantly improves the lightweightness of the model.

[0100] Table 3

[0101]

[0102] Experimental results show that by introducing structural reparameterization technology to improve the C2f module in YOLOv8, while sacrificing only 0.3% detection accuracy, the model parameters were reduced by 17.9%, the computational complexity decreased by 16.5%, the average inference time decreased by 14.3%, and the number of network layers was reduced by 29, effectively balancing overall model performance and computational resource consumption. This design not only enables the model to achieve faster inference speed while maintaining high detection accuracy, but also alleviates the parameter inflation problem introduced by other improved modules.

[0103] 2: Model comparison and analysis experiment.

[0104] To verify the effectiveness of the improved YOLOv8 proposed in the present invention in the task of detecting lesions in CT images of CIP patients, this experiment selected a mainstream algorithm in the field of target detection and reproduced it on the dataset of Example 1. The algorithm was then compared and analyzed with the algorithm proposed in the present invention. The experimental results are shown in Table 4.

[0105] Table 4

[0106] Model Accuracy Recall mAP@0.5 mAP@0.5:0.95 Faster R-CNN 0.7680 0.6983 0.7745 0.5521 YOLOv5s 0.8045 0.7286 0.8310 0.6028 RT-DETR-L 0.8240 0.7520 0.8521 0.6253 ViDT 0.8307 0.7613 0.8635 0.6402 The present invention 0.8635 0.7893 0.8978 0.6703

[0107] The experimental results in Table 3 show that the model proposed in the present invention for the lesion features of CIP patient CT images performs better in terms of precision, recall and mAP evaluation indicators, proving the adaptability and effectiveness of this method on the CIP patient CT image dataset in this paper. Faster R-CNN, as a two-stage detection model, is computationally complex and has difficulty in effectively capturing subtle lesions in lung CT images. Although YOLOv5s is a lightweight model, its backbone network still has problems such as high computational complexity and easy loss of shallow details. Although RT-DETR-L performs well in general target detection tasks, it lacks optimization for medical images and its detection performance is inferior to the algorithm of the present invention. ViDT uses the deformable attention mechanism of Transformer to enhance the ability to capture local features, but it has high computational complexity, is easily interfered by background noise, and has difficulty balancing inference efficiency and lesion sensitivity. In contrast, the algorithm of the present invention is optimized for the characteristics of medical images, achieving better shallow feature retention, lesion detection effect and computational efficiency.

[0108] Finally, it should be noted that the above examples are merely specific embodiments of the present invention. Obviously, the present invention is not limited to the above examples and is subject to numerous variations. All variations that can be directly derived or conceived by a person of ordinary skill in the art from the disclosure of the present invention are considered to be within the scope of protection of the present invention.

Claims

1. A CIP lung CT image detection method based on an improved YOLOv8 is characterized by: The process includes collecting the patient's lung CT image and preprocessing it to extract the lung parenchyma image. Then, the lung parenchyma image is input into the CIP lung CT image detection network that has been trained offline to obtain the result map containing the target detection box and the detection confidence. The CIP lung CT image detection network is based on an improved Yolov8 network. In the backbone, the SPD-Conv module replaces all CBS modules except the first layer, and the RV_C2f module replaces the original C2f module. The RV_C2f module replaces the original C2f module in the neck, and a CA module is added after each RV_C2f module in the neck. A step-by-step feature fusion strategy is used to generate multi-scale feature representation. The detection head adopts the detection head of the Yolov8 network.

2. The method for detecting CIP lung CT images based on improved YOLOv8 according to claim 1, characterized in that: The RV_C2f module is: RepConv is used to replace the bottleneck structure in the original C2f module. In the original C2f module, the bottleneck structure uses multiple convolutional layers to gradually extract features, while repConv uses three parallel branches: 3×3 convolution, 1×1 convolution, and identity mapping to capture feature information during the training phase of the model. During the inference phase of the model, the three parallel branches are equivalent to a 3×3 convolution operation.

3. The method for detecting CIP lung CT images based on improved YOLOv8 according to claim 2, characterized in that: The specific process of generating multi-scale feature representation of the neck is as follows: (1) Features P3, P4, and P5 output by the backbone network serve as input to the neck; (2) Feature P3 is downsampled using the SPD-Conv module and then fused with feature P4 to obtain feature N4. At the same time, feature P4 is upsampled and fused with feature P3 to obtain feature N3. (3) After the features N3, N4 and P5 are processed by the RV_C2f module and the CA module, the features N′3, N′4 and N′5 are obtained respectively; (4) Feature N′5 is upsampled twice, feature N′4 is upsampled once, and then fused with feature N′3. After passing through the RV_C2f module and the CA module, feature N′′3 is output; Perform an upsampling on feature N′5, perform an SPD-Conv operation on feature N′3, perform downsampling, and then fuse it with feature N′4. After passing through the RV_C2f module and the CA module, the output feature N′′4 is output. Perform two SPD-Conv operations on feature N′3 to perform downsampling, perform one SPD-Conv operation on feature N′4 to perform downsampling, and then fuse it with feature N′5. After passing through the RV_C2f module and the CA module, the output feature N′′5 is output.

4. The method for detecting CIP lung CT images based on improved YOLOv8 according to claim 3, characterized in that: The process of the pretreatment is: (1) Use the global threshold method to obtain the threshold S end , performing a binarization operation on the lung CT image and dividing it into foreground and background; (2) Use the flood filling algorithm to fill the area outside the lung parenchyma and perform the inverse operation; (3) De-noising; (4) fill any gaps in the lung parenchyma region by morphological closing operations, again applying the flood-fill technique; (5) Performing a bitwise AND operation on the processed lung region and the grayscale image of the lung CT image to extract the complete lung parenchyma region and save it as a lung parenchyma image.

5. The method for detecting CIP lung CT images based on improved YOLOv8 according to claim 4, characterized in that: The threshold N end The iterative process is as follows: (1) Set the initial value of the threshold S to: S = (G max +G min ) / 2, where G max is the maximum gray value, G min is the minimum gray value G min ; (2) Use S as the threshold to perform a binarization operation to divide the image into foreground and background, and calculate the average grayscale value G of the foreground respectively. f The average gray value G of the background b , update the threshold S to G f With G b The average value of the threshold value and the absolute value of the difference between the current threshold value and the previous threshold value S sub ; (3) If S sub If the value is less than the set parameter S0, then S sub is the threshold S end Otherwise, continue to iterate steps (1) and (2) until the threshold S is found. end .

6. The method for detecting CIP lung CT images based on improved YOLOv8 according to claim 5, characterized in that: The offline training process of the CIP lung CT image detection network is as follows: Lung CT images of patients with CIP and those without CIP were collected and desensitized, and the lesion areas were labeled. The dataset was divided into training, validation, and test sets in a ratio of 8:1:

1. The training set was input into the CIP lung CT image detection network for training. A learning rate adjustment strategy combining warm-up training and cosine annealing was adopted, and the SGD optimizer was used to update the network parameters. Training ended after reaching a preset number of rounds. The test set was then used to verify the model's evaluation indicators.

Citation Information

Patent Citations

  • Multi-mode deep learning classification method suitable for immunosuppressor-related pneumonia

    CN117668760A