Pulmonary nodule detection method based on improved YOLOv5x

By improving the YOLOv5x method, two-dimensional slice and cluster segmentation of CT images are performed for lung nodule detection task, combined with the ODConv module and gradient descent optimization, the problem of unreasonable pre-selected boxes and noise interference in the existing technology is solved. Improve detection accuracy and model robustness.

CN119006781AInactive Publication Date: 2024-11-22ANHUI UNIVERSITY OF TECHNOLOGY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411024163.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-29
Publication Date
2024-11-22
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

In the prior art, in the lung nodule detection task, pre-selected boxes are not set for specific tasks, resulting in low inference accuracy and excessive training data noise, affecting the robustness and accuracy of the model.

Method used

Using the improved YOLOv5x method, the lung parenchyma is segmented by two-dimensional slices and KMeans clustering of CT image data, the noise is reduced using corrosion and expansion treatments, and the clustering analysis is obtained to obtain specific pre-selected boxes, and the ODConv module is constructed to enhance feature utilization, and through reverse Propagation and gradient descent optimization model parameters.

Benefits of technology

It improves the accuracy of lung nodule detection and the robustness of the model, reduces noise interference, enhances the model's detection ability of small targets, and improves training speed and generalization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119006781A_ABST
    Figure CN119006781A_ABST
Patent Text Reader

Abstract

The invention discloses a pulmonary nodule detection method based on improved YOLOv5x, relates to the technical field of computer image target detection, and aims to solve the technical problem of low reasoning accuracy caused by presetting a specific candidate box for a pulmonary nodule detection task and insufficient utilization of extracted information. The data quality is ensured; secondly, an ODConv module is added in the YOLOv5x model to replace an existing common convolution module, and the feature extraction capability is enhanced; then, according to the features of the pulmonary nodule detection task, a detection frame adaptive to the current task is constructed as a generation frame of the network, and the detection effect of a small target is improved; and finally, target detection training is carried out by inputting an image into the network, model parameters are dynamically adjusted according to an obtained loss value, and through a series of optimization measures, the accuracy of pulmonary nodule detection is remarkably improved, and powerful support is provided for clinical diagnosis.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of computer image target detection and relates to a target detection technology based on yolov5, and specifically is a lung nodule detection method based on improved YOLOv5x. Background Art

[0002] Computer image target detection technology, as a key technology in the field of computer vision, is widely used in medical imaging, urban security, autonomous driving and other fields. It aims to identify and analyze image content and accurately locate the location of the target in the image. In the task of pulmonary nodule detection, deep learning methods, especially the YOLO series of networks, occupy a dominant position. They can automatically learn high-order feature expressions from raw pixel data and accurately locate the target based on this. However, given the particularity of the target in the task of pulmonary nodule detection, the ordinary pre-selection box size setting is not reasonable, and the noise in the training data will interfere with the training accuracy. In addition, the network should also make use of the learned features as much as possible for prediction in order to process unknown data and cope with various complex scenarios. Therefore, the introduction of the improved YOLOv5x training method can improve the accuracy of recognition and enhance the robustness of the model.

[0003] In the prior art, although the FasterRcnn, yolov3-spp and other methods are used for training, the recognition of the target can be achieved, but the accuracy is relatively low, and the data set is not segmented during the training process, resulting in too much noise in the training data, which leads to poor training results. In the network, the size of the pre-selected box is not adapted for specific tasks, and the extracted features are not fully utilized during network training prediction.

[0004] The present invention provides a lung nodule detection method based on improved YOLOv5x to solve the above technical problems. Summary of the invention

[0005] The present invention aims to at least solve the technical problems existing in the prior art; to this end, the present invention proposes a lung nodule detection method based on improved YOLOv5x, which is used to solve the problem of low reasoning accuracy caused by the prior art not presetting specific candidate boxes for lung nodule detection tasks during training and not making full use of the extracted information.

[0006] To achieve the above object, the present invention provides a lung nodule detection method based on improved YOLOv5x, comprising:

[0007] Step 1: Data preprocessing;

[0008] The original CT image data set is processed into two-dimensional slices, and the sliced ​​images are clustered using the KMeans algorithm to identify and segment the lung parenchyma, and then the images are smoothed using the erosion and dilation methods;

[0009] Step 2: cluster analysis of annotation boxes;

[0010] Cluster analysis is performed on the annotated boxes of the segmented and smoothed image dataset to obtain the values ​​of 9 groups of pre-selected boxes in the three-layer PAFPN network;

[0011] Step 3: Build an improved yolov5x network;

[0012] Set the value of the pre-selected box in the PAFPN network, replace the last three C3 modules with ODConv in the head of the yolov5x model, set the network's hyperparameters and create the network;

[0013] Step 4: Model training;

[0014] Input the image dataset into the created network for training, obtain the target detection results, and calculate the loss based on the detection results and the true labels;

[0015] Step 5: Model optimization;

[0016] According to the calculated loss, the error is back-propagated through the back-propagation algorithm, and the model parameters are adjusted using gradient descent. The number of iterations is increased, and the iterative training is repeated and the weight parameters of the model are updated until the set number of iterations is reached or the accuracy no longer increases.

[0017] Preferably, the KMeans algorithm in step 1 segments the lung parenchyma, including:

[0018] Acquire CT images, convert the spatial location information of lung nodules into image coordinates, and obtain slices marked with the center points along the Z axis as images to be processed; when the image is distorted or has abnormal brightness, truncate the CT values ​​of the image, retain the values ​​in the range of [-1000,400], and normalize them to the interval of [0,255]; perform cluster analysis on each pixel in the obtained image matrix and divide it into two categories, namely foreground and background, where the foreground is the lung parenchyma.

[0019] Preferably, in step one, the image of the lung parenchyma after clustering and segmentation has noise points; the specific process of smoothing the image by corrosion and expansion methods is: first, the image is corroded, the original pixel matrix is ​​scanned using the structural element, and all the positions currently scanned are replaced by the corresponding minimum value in the structural element to eliminate the object boundary points; then, the expansion operation is performed, the original pixel matrix is ​​also scanned using the structural element, and all the positions currently scanned are replaced by the corresponding maximum value in the structural element to fill the lung cavities.

[0020] Preferably, the step 2 of clustering the marked boxes to obtain values ​​of 9 groups of pre-selected boxes in the three-layer PAFPN network includes: calculating the aspect ratio according to the marked boxes, observing the relationship between them, and using a clustering algorithm to cluster the width and height to obtain the pre-selected boxes.

[0021] Preferably, in step 3, ODConv is used to replace the last three C3 modules in the head of the yolov5x model;

[0022] The specific operation process is as follows:

[0023] After the processed image is input into the ODConv module, the input is dot-multiplied with channel_attention, and the dot-multiplied result is dot-multiplied with spatial_attention and kernel_attention respectively; the result of the dot-multiplication is dot-multiplied with a weight initialized by Kaiming, and the sum is taken in the dim=1 dimension to get a total weight, which is used as the initial weight of a convolution, and the result after channel_attention is applied to the convolution, and the result obtained by the total weight is dot-multiplied with filter_attention to get the final output.

[0024] Preferably, in step 4, calculating the loss according to the detection result and the true label result includes:

[0025] In the task of lung nodule detection, the calculation loss is obtained by the total loss function L, where the positioning loss L loc and confidence loss L conf The total loss function L is obtained by summing up, that is, the total loss function L is obtained by the following formula:

[0026] L=u1L conf +u2L loc , (1)

[0027] Where u1 and u2 are balance coefficients;

[0028] The positioning loss measures the error between the predicted box and the true box. In the pulmonary nodule detection task, the complete intersection-over-union (CIOU) loss is used. The calculation formula is as follows:

[0029]

[0030]

[0031]

[0032]

[0033] L loc =1-CIOU, (6)

[0034] Where w and h represent the predicted width and height respectively. gt ,h gt denote the true width and height respectively, α is the weight function, v is the consistency of the aspect ratio, M and N denote the areas covered by the two target boxes, M∩N denotes the area of ​​the overlapping part of the two target boxes, M∪N denotes the total area of ​​the areas covered by the two target boxes, b and b gt Represent the center points of the predicted box and the real box respectively, ρ represents the Euclidean distance between the two center points, and c represents the diagonal length of the minimum circumscribed rectangle that can contain both the predicted box and the real box;

[0035] Confidence loss measures the model's ability to detect targets. The binary cross entropy loss used in the lung nodule detection task is calculated as follows:

[0036]

[0037] Where i represents the i-th sample, o i ∈[0,1], represents the CIOU of the predicted target bounding box and the true target bounding box of the i-th sample, c is the predicted value, is the prediction confidence obtained by the Sigmoid function, and N is the number of samples.

[0038] Preferably, in step five, adjusting the model parameters according to the back propagation algorithm and gradient descent includes: inputting the model parameters and the loss value into the back propagation algorithm to obtain the initial gradient according to the chain rule, using a small batch stochastic gradient descent algorithm, randomly selecting a group of images for forward propagation with the help of a random number generator, calculating the loss sum of a group of images by simply adding the loss value of each image, and obtaining the parameter value after a gradient descent update according to the formula, the formula is as follows:

[0039]

[0040] Among them, j represents the number of iterations, α represents the learning rate, and θ j represents the parameter value at the jth iteration, θ j+1 It represents the parameter value after a gradient descent update, that is, the parameter value at the j+1th iteration; calculate the partial derivatives of the current loss with respect to different parameters and update the parameters accordingly, continue to train the updated model, and after each parameter update, judge whether the model has converged by comparing the loss values ​​or evaluation indicators of several consecutive iterations; if the model converges within the set maximum number of iterations, or the loss value and evaluation indicator no longer show significant improvement, stop training.

[0041] Compared with the prior art, the present invention has the following beneficial effects:

[0042] 1. The present invention converts the CT data set into two-dimensional image slices and uses the KMeans algorithm to segment the foreground and background in the image to obtain the lung parenchyma. In order to reduce noise points, the image is processed by corrosion and expansion to make the location of possible lung nodules clearer, which helps to enhance the model's focus on the lung parenchyma and reduce noise interference.

[0043] 2. In view of the particularity of the pulmonary nodule detection task, the target size is mostly small, so a cluster analysis is performed on the annotation box to obtain the size of 9 groups of pre-selected boxes in the three-layer PAFPN network, which helps the model to detect pulmonary nodules better. Due to the small difference in the size of pulmonary nodules, the automatic anchor box calculation in yolov5 is not used, which can reduce the amount of model calculation and improve the training speed.

[0044] 3. The present invention adds full-dimensional dynamic convolution (ODConv) to the network and replaces the last three C3 convolution modules in the HEAD part of yolov5x. Compared with ordinary convolution, full-dimensional dynamic convolution uses four dimensions, channel_attention, filter_attention, spatial_attention, and kernel_attention, to participate in the operation, making full use of the extracted features and strengthening the interaction of information between different dimensions. This enables the convolution to make corresponding changes according to different inputs, increasing the capacity of the model and thus improving the generalization of the model. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0046] Figure 1 It is the work flow chart of the present invention. DETAILED DESCRIPTION

[0047] The technical solution of the present invention will be clearly and completely described below in conjunction with the embodiments. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0048] See also Figure 1 , an embodiment of the present invention provides a lung nodule detection method based on improved YOLOv5x, comprising:

[0049] Step 1: Data preprocessing

[0050] The original CT image data set is processed into two-dimensional slices, and the sliced ​​images are clustered using the KMeans algorithm to identify and segment the lung parenchyma, and then the images are smoothed using the erosion and dilation methods;

[0051] Exemplarily, the LUNA2016 dataset is used to obtain the original CT image data, and the CT coordinates of the extracted lung nodule spatial information in the annotation.csv file are converted into two-dimensional image coordinates. The two-dimensional image corresponding to the image coordinates in the Z-axis direction of the center point of the lung nodule in the image is intercepted as the original image. The ReadImage method in the SimpleITK library is used to read the CT image and convert it into an array form. In order to solve the problems of image distortion and brightness being too dark or too bright, the image is normalized and the CT value is truncated, and only the CT value interval of [-1000,400] is retained, and it is normalized to the range of [0,255]. Image distortion refers to the change that occurs during the acquisition, transmission, processing or storage of the image, which is inconsistent with the original image content, resulting in distortion, deformation or blurring of the image's shape, proportion, edge, line and other features. Brightness abnormality includes two situations: too bright: the overall or local brightness value of the image is too high, resulting in some areas being white or overexposed, and details are lost; too dark: the overall or local brightness value of the image is too low, resulting in some areas being too dark and details cannot be seen clearly. All pixels are clustered using the KMeans clustering method. The average of the two cluster centers of the foreground and background is used as the threshold for foreground and background classification. The value less than the threshold is set to 1 as the foreground, and the value greater than the threshold is set to 0 as the background. The image is corroded and expanded. First, the image is corroded. The original pixel matrix is ​​scanned using the structural element. The corresponding minimum value in the structural element replaces all the positions currently scanned to eliminate the boundary points of the object. Then, the expansion operation is performed. The original pixel matrix is ​​also scanned using the structural element. The corresponding maximum value in the structural element replaces all the positions currently scanned to fill the lung cavities and make the target more connected and complete. After that, the connected areas in the image are marked, and the lung areas are screened out by judging the size of the lung connected domain and a mask is generated. The generated lung mask is applied to the original image to complete the instance segmentation of the lung. Finally, the image after lung parenchyma segmentation is input into the model for training to reduce the interference of other tissues and thus improve the accuracy of the model.

[0052] Step 2: Cluster analysis of annotation boxes

[0053] Cluster analysis is performed on the annotated boxes of the segmented and smoothed image dataset to obtain the values ​​of the pre-selected boxes of the three-layer PAFPN network;

[0054] For example, we first analyze the annotation boxes of the training data and observe the aspect ratio of the image. In the current data set, we find that the aspect ratio of the annotation box is Y=X. The width and height of the image are input into the KMeans algorithm for analysis, thereby obtaining 9 sets of pre-selected box sizes. The sizes obtained in this data set are as follows:

[0055] Table 1:

[0056] 6,6 7,7 9,9 10,10 12,12 15,15 19,19 25,25 32,32

[0057] Step 3: Build an improved yolov5x network

[0058] For example, replace the 17th, 20th, and 23rd layers in the yolov5x network structure diagram with ODConv for training. In ODConv, the input is subjected to four 1*1 convolutions respectively, and the output of each stage corresponds to the four dimensions of channel_attention, filter_attention, spatial_attention, and kernel_attention, and finally four weights are obtained after the Sigmoid function. When the image is input into the ODConv module, the following operations will be performed: after the processed image is input into the ODConv module, the input is dot-multiplied with channel_attention, and the dot-multiplied result is dot-multiplied with spatial_attention and kernel_attention respectively; the result of the dot-multiplication is dot-multiplied with a weight initialized by Kaiming, and the sum is obtained in the dim=1 dimension to obtain a total weight, and the total weight is used as the initial weight of a convolution, and the result after channel_attention is applied to the convolution, and the result obtained is dot-multiplied with filter_attention through the total weight to obtain the final output.

[0059] Step 4: Model training

[0060] Input the image dataset into the network for training, obtain the target detection results, and calculate the loss based on the detection results and the true labels;

[0061] For example, the processed data set is converted into the yolo format and set in the yaml file, and the data parameters of the network model are modified for training. During the training process, the input is first subjected to a series of convolution, BN, and SiLU modules for feature extraction, and then the features obtained between different levels are added or concat spliced, and finally the target position is predicted through convolution to obtain the result.

[0062] In the task of lung nodule detection, the calculation loss is obtained by the total loss function L, where the positioning loss L loc and confidence loss L conf The total loss function L is obtained by summing up, that is, the total loss function L is obtained by the following formula:

[0063] L=u1L conf +u2L loc, (1)

[0064] Where u1 and u2 are balance coefficients;

[0065] The positioning loss measures the error between the predicted box and the true box. In the pulmonary nodule detection task, the complete intersection-over-union (CIOU) loss is used. The calculation formula is as follows:

[0066]

[0067]

[0068]

[0069]

[0070] L loc =1-CIOU, (6)

[0071] Where w and h represent the predicted width and height respectively. gt ,h gt denote the true width and height respectively, α is the weight function, v is the consistency of the aspect ratio, M and N denote the areas covered by the two target boxes, M∩N denotes the area of ​​the overlapping part of the two target boxes, M∪N denotes the total area of ​​the areas covered by the two target boxes, b and b gt Represent the center points of the predicted box and the real box respectively, ρ represents the Euclidean distance between the two center points, and c represents the diagonal length of the minimum circumscribed rectangle that can contain both the predicted box and the real box;

[0072] Confidence loss measures the model's ability to detect targets. The binary cross entropy loss used in the lung nodule detection task is calculated as follows:

[0073]

[0074] Where i represents the i-th sample, o i ∈[0,1], represents the CIOU of the predicted target bounding box and the true target bounding box of the i-th sample, c is the predicted value, is the prediction confidence obtained by the Sigmoid function, and N is the number of samples.

[0075] In the first round of training, the losses of the two are L loc =0.1457 and L conf =0.01198. On the validation set, the average precision mAP_0.5 with an intersection-over-union threshold of 0.5 has an accuracy of 1.42E-05.

[0076] Step 5: Model optimization

[0077] Adjust the model parameters according to the back propagation algorithm and gradient descent, including: input the model parameters and loss values ​​into the back propagation algorithm to obtain the initial gradient according to the chain rule, use the small batch stochastic gradient descent algorithm, randomly select a group of images for forward propagation each time with the help of a random number generator, and then calculate the loss sum of this group of images by simply adding the loss values ​​of each image, according to the formula:

[0078]

[0079] Among them, j represents the number of iterations, α represents the learning rate, and θ j represents the parameter value at the jth iteration, θ j+1 It represents the parameter value after a gradient descent update, that is, the parameter value at the j+1th iteration; calculate the partial derivatives of the current loss with respect to different parameters and update the parameters accordingly, and continue to train the updated model. After each parameter update, the model is judged to be converged by comparing the loss values ​​or evaluation indicators of several consecutive iterations; if the model converges within the set maximum number of iterations, or the loss value and evaluation indicator no longer show significant improvement, the training is stopped.

[0080] Working principle of the present invention:

[0081] First, the original CT data set is converted into a two-dimensional image slice along the center of the Z axis according to the annotation information, and then the CT value of the image is truncated and normalized to the range of [0,255]. The KMeans algorithm is used to perform cluster analysis on each pixel in the image matrix to achieve lung parenchyma segmentation and obtain a training image. The size of the model pre-selection box is calculated according to the annotation box of the training data, the pre-selection box is set for the model, and the ODConv module is added to the network structure to create a network model. The preprocessed image is input into the network, and after a series of convolutional layers for feature extraction, feature maps after downsampling 8 times, 16 times, and 32 times are obtained respectively. After these three feature maps are input into the ODConv module, the prediction box is finally generated. For the obtained prediction box, the confidence loss and positioning loss are calculated respectively. Since it is a single target detection task, there is no classification loss. The Mini-Batch SGD optimizer is used to obtain the mean of the loss of a small batch. Then the back-propagation algorithm is used to obtain the partial derivative of each parameter in the network and update it using the loss, so that the loss of the network tends to decrease. Finally, the training is stopped when the set number of iterations is reached or the model can no longer be optimized.

[0082] The above embodiments are only used to illustrate the technical method of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical method of the present invention may be modified or replaced by equivalents without departing from the spirit and scope of the technical method of the present invention.

Claims

1. A lung nodule detection method based on improved YOLOv5x, It is characterized in that include: Step 1: Data preprocessing; The original CT image data set is processed into two-dimensional slices, and the sliced ​​images are clustered using the KMeans algorithm to identify and segment the lung parenchyma, and then the images are smoothed using the erosion and dilation methods; Step 2: cluster analysis of annotation boxes; Cluster analysis is performed on the annotated boxes of the segmented and smoothed image dataset to obtain the values ​​of 9 groups of pre-selected boxes in the three-layer PAFPN network; Step 3: Build an improved yolov5x network; Set the value of the pre-selected box in the PAFPN network, replace the last three C3 modules with ODConv in the head of the yolov5x model, set the network's hyperparameters and create the network; Step 4: Model training; Input the image dataset into the created network for training, obtain the target detection results, and calculate the loss based on the detection results and the true labels; Step 5: Model optimization; According to the calculated loss, the error is back-propagated through the back-propagation algorithm, and the model parameters are adjusted using gradient descent. The number of iterations is increased, and the iterative training is repeated and the weight parameters of the model are updated until the set number of iterations is reached or the accuracy no longer increases.

2. A pulmonary nodule detection method based on improved YOLOv5x according to claim 1, It is characterized in that The KMeans algorithm in step 1 segments the lung parenchyma, including: Acquire CT images, convert the spatial location information of lung nodules into image coordinates, and obtain slices marked with the center points along the Z axis as images to be processed; when the image is distorted or has abnormal brightness, truncate the CT values ​​of the image, retain the values ​​in the range of [-1000,400], and normalize them to the interval of [0,255]; perform cluster analysis on each pixel in the obtained image matrix and divide it into two categories, namely foreground and background, where the foreground is the lung parenchyma.

3. A pulmonary nodule detection method based on improved YOLOv5x according to claim 1, It is characterized in that In the step 1, the image of the lung parenchyma after clustering and segmentation has noise points; the specific process of smoothing the image by corrosion and expansion method is: firstly, the image is corroded, the original pixel matrix is ​​scanned using the structural element, and all the positions of the current scan are replaced by the corresponding minimum value in the structural element to eliminate the boundary points of the object; Then, the expansion operation is performed, and the original pixel matrix is ​​scanned using the structural element. The corresponding maximum value in the structural element replaces all the positions currently scanned to fill the lung cavities.

4. A pulmonary nodule detection method based on improved YOLOv5x according to claim 1, It is characterized in that After clustering analysis of the marked boxes in step 2, a total of 9 groups of pre-selected box values ​​of the three-layer PAFPN network are obtained, including: calculating the aspect ratio according to the marked boxes, observing the relationship between them, and using a clustering algorithm to perform cluster analysis on the width and height to obtain the pre-selected boxes.

5. A pulmonary nodule detection method based on improved YOLOv5x according to claim 1, It is characterized in that In step 3, ODConv is used to replace the last three C3 modules in the head of the yolov5x model; The specific operation process is as follows: After the processed image is input into the ODConv module, the input is dot-multiplied with channel_attention, and the dot-multiplied result is dot-multiplied with spatial_attention and kernel_attention respectively; the result of the dot-multiplication is dot-multiplied with a weight initialized by Kaiming, and the sum is taken in the dim=1 dimension to get a total weight, which is used as the initial weight of a convolution, and the result after channel_attention is applied to the convolution, and the result obtained by the total weight is dot-multiplied with filter_attention to get the final output.

6. A lung nodule detection method based on improved YOLOv5x according to claim 1, It is characterized in that In step 4, the loss is calculated based on the detection result and the true label result, including: In the task of lung nodule detection, the calculation loss is obtained by the total loss function L, where the positioning loss L loc and confidence loss L conf The total loss function L is obtained by summing up, that is, the total loss function L is obtained by the following formula: L=u 1 L conf +and 2 L loc , (1) where u 1 and u 2 is the balance coefficient; The positioning loss measures the error between the predicted box and the true box. In the pulmonary nodule detection task, the complete intersection-over-union (CIOU) loss is used. The calculation formula is as follows: L loc =1-CIOU, (6) Where w and h represent the predicted width and height respectively. gt ,h gt denote the true width and height respectively, α is the weight function, v is the consistency of the aspect ratio, M and N denote the areas covered by the two target boxes, M∩N denotes the area of ​​the overlapping part of the two target boxes, M∪N denotes the total area of ​​the areas covered by the two target boxes, b and b gt Represent the center points of the predicted box and the real box respectively, ρ represents the Euclidean distance between the two center points, and c represents the diagonal length of the minimum circumscribed rectangle that can contain both the predicted box and the real box; Confidence loss measures the model's ability to detect targets. The binary cross entropy loss used in the lung nodule detection task is calculated as follows: Where i represents the i-th sample, o i ∈[0,1], represents the CIOU of the predicted target bounding box and the true target bounding box of the i-th sample, c is the predicted value, is the prediction confidence obtained by the Sigmoid function, and N is the number of samples.

7. A lung nodule detection method based on improved YOLOv5x according to claim 1, It is characterized in that In step 5, the model parameters are adjusted according to the back propagation algorithm and gradient descent, including: inputting the model parameters and the loss value into the back propagation algorithm to obtain the initial gradient according to the chain rule, using a small batch stochastic gradient descent algorithm, randomly selecting a group of images for forward propagation with the help of a random number generator, and calculating the loss sum of a group of images by simply adding the loss value of each image, and obtaining the parameter value after a gradient descent update according to the formula, which is as follows: Among them, j represents the number of iterations, α represents the learning rate, and θ j represents the parameter value at the jth iteration, θ j+1 It represents the parameter value after a gradient descent update, that is, the parameter value at the j+1th iteration; calculate the partial derivatives of the current loss with respect to different parameters and update the parameters accordingly, continue to train the updated model, and after each parameter update, judge whether the model has converged by comparing the loss values ​​or evaluation indicators of several consecutive iterations; if the model converges within the set maximum number of iterations, or the loss value and evaluation indicator no longer show significant improvement, stop training.