A method and system for detecting pleural line and B-line status of lung ultrasound in a noisy environment
By using a deep learning model and attention module with an encoder-decoder structure in lung ultrasound image processing, the problem of difficulty in extracting the pleural line and B line state in noise environments is solved, and high-precision detection and diagnostic efficiency are improved.
Patent Information
- Application Number
- CN202510142724.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-10
- Publication Date
- 2025-04-11
- Estimated Expiration
- 2045-02-10
AI Technical Summary
In noisy environments, traditional ultrasound image processing methods are difficult to effectively extract important features in lung ultrasound images, such as the status of the pleural line and B line, resulting in the impact of the accuracy and efficiency of the diagnosis.
The deep learning model with encoder-decoder structure is adopted, combined with attention module, detection head module and efficient image preprocessing technology, a lung ultrasound network adapted to a dense noise environment is built to achieve high-precision detection of the pleural line and B line states.
High-precision detection in a noisy environment is realized, the dependence on manual experience is reduced, the objectivity and stability of detection is improved, and the efficiency and accuracy of diagnosis is enhanced.
Smart Images

Figure CN119600025B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of ultrasonic image processing, and in particular to a method and system for detecting the states of pleural lines and B lines of lung ultrasound in a noisy environment. Background Art
[0002] In the field of clinical diagnosis of lung diseases, lung ultrasound (LUS) has become an important tool for screening and monitoring lung diseases due to its advantages such as no radiation, high portability and easy operation. However, lung ultrasound images usually have dense noise and artifacts, especially in videos acquired in complex clinical environments, where the noise is more significant. These noises not only interfere with the extraction of key structural features, such as the status recognition of the pleural line and B line, but also seriously affect the accuracy of diagnosis.
[0003] The pleural line and B line are important characteristic structures in lung ultrasound images. The pleural line is a strong echo reflection formed by the difference in acoustic impedance between the pleura and the lung surface interface, which can form a smooth, clear and regular linear strong echo under ultrasound. The clarity and continuity of the linear strong echo are crucial for judging the state of the lungs. The B line is a vertical linear highlight artifact, and its number, shape and distribution are closely related to a variety of lung lesions. Therefore, accurate detection of the state of the pleural line and B line is of great significance for the early diagnosis of lung diseases, disease assessment and efficacy monitoring.
[0004] However, traditional ultrasound image processing methods have difficulty in effectively extracting these features in dense noise environments. These methods often rely on specific image preprocessing steps and feature extraction algorithms. However, under noise interference, the performance of the algorithm will drop significantly and features cannot be effectively extracted. In addition, traditional ultrasound image analysis also relies on the experience and subjective judgment of ultrasound physicians, which not only leads to strong subjectivity and poor consistency in the diagnostic results, but also greatly reduces the diagnostic efficiency.
[0005] In recent years, artificial intelligence technology, especially neural network methods in deep learning, has shown great potential in medical image analysis. Efficient and learnable neural networks can automatically learn complex feature representations from large amounts of data, and have the characteristics of strong robustness and high generalization ability. However, existing research has mostly focused on image recognition in clear environments, and there is still a lack of effective methods for detecting the pleural line and B-line status of lung ultrasound videos in dense noise environments. Summary of the invention
[0006] In response to the problems mentioned in the prior art, the present invention proposes a method and system for detecting the status of the pleural line and B-line in lung ultrasound in a noisy environment. The method constructs a deep learning model that adapts to dense noise environments and combines efficient image preprocessing and feature extraction technology to achieve high-precision detection of the pleural line and B-line in lung ultrasound videos. This method can be applied to simple clinical environments to assist medical personnel in completing diagnostic tasks quickly and accurately, improve the objectivity and stability of the diagnosis, and has important clinical application value and promotion prospects.
[0007] In order to achieve the above object, the present invention adopts the following technical solution:
[0008] In a first aspect, the present invention provides a method for detecting the status of a lung ultrasound pleural line and a B line in a noisy environment, comprising the following steps:
[0009] S1. Constructing a lung ultrasound network, using an encoder-decoder to construct the lung ultrasound network, wherein the encoder is composed of a pre-trained Resnet series model, and the decoder includes an attention module, a first detection head module, and a second detection head module;
[0010] A feature vector of a fixed length after encoding by the encoder is pre-set, an attention module in the decoder receives the feature vector and generates a weighted feature vector, a first detection head module receives the weighted feature vector and outputs a pleural line state prediction, and a second detection head module receives the weighted feature vector and outputs a B-line state prediction;
[0011] S2, collecting lung ultrasound video data, classifying and processing the lung ultrasound video data to obtain a training set;
[0012] S3, using the training set obtained in S2, training the lung ultrasound network to obtain a trained lung ultrasound detection model;
[0013] S4. Input the unknown lung ultrasound video into the lung ultrasound detection model to obtain the pleural line and B-line status detection results of the unknown lung ultrasound video.
[0014] As a further improvement of the present invention, the specific process of S2 is:
[0015] Acquire L lung ultrasound videos from a patient, wherein the total number of frames of each lung ultrasound video is set to N frames and each lung ultrasound video is numbered;
[0016] Each lung ultrasound video includes the pleural line status results and the B-line status results. The pleural line status results are mapped to the vector after one-hot encoding. In the example, the B line status result is mapped to the vector after one-hot encoding. In the vector With vector as the true value label;
[0017] The lung ultrasound video is processed into a format that matches the lung ultrasound network and corresponds to the mapped true value label vector.
[0018] As a further improvement of the present invention, the pleural line status result includes four states, namely normal, rough, irregular and fragmented;
[0019] The B-line status results include four states, namely normal, less than four lines, four to six lines, and more than six lines.
[0020] As a further improvement of the present invention, the specific process of S3 is:
[0021] S31. Preprocess any group of lung ultrasound videos, each group of lung ultrasound videos contains videos, the preprocessed video data is represented as ;
[0022] Where: is the number of video frames; is the number of video channels; For the video's height; is the width of the video;
[0023] Then, the encoder encodes all the video frames of each group of videos to be tested to obtain a series of encoding vectors , where the dimension of each encoding vector is D;
[0024] Where: L is the number of lung ultrasound videos; N is the number of frames of the video; is an algebraic variable; is the total number of encoded vectors;
[0025] S32. Reshape a series of encoding vectors to obtain the reshaped result expressed as ;
[0026] Where: Indicates the number of heads of multi-head attention; Represents the spatial dimension of each attention head;
[0027] S33, using the reshaping result of step S32 to initialize the feature matrix , presuppose a dimension of The attention vector and a scaling factor are calculated according to the following formula to get a fixed dimension of The attention score matrix , the formula is as follows:
[0028]
[0029] Where: represents the sum operation in the last dimension; Represents element-by-element multiplication of matrices; represents the scaling factor; represents the attention vector;
[0030] S34. Attention score matrix Apply the Sigmoid activation function along the video frame number Align and normalize to get the attention weight matrix Attn , where the attention weight matrix Attn The shape is represented by ;
[0031] S35. Using the attention weight matrix Attn For the feature matrix Perform weighted summation to achieve frame fusion and get the dimension The attention result matrix ;
[0032] S36, using the first detection head module and the second detection head module to convert the attention result matrix Mapped to two result spaces, the diagnostic results of pleural line status detection are obtained respectively Diagnostic results of B-line status detection ;
[0033] S37, the true value label in S2 and Get the prediction result with S36 and The data is input into the cross entropy loss function, and the lung ultrasound network is trained using the back propagation algorithm to obtain a trained lung ultrasound detection model.
[0034] As a further improvement of the present invention, the cross entropy loss function in step S37 is shown as follows:
[0035]
[0036] Where: Indicates the total number of categories; The one-hot encoding of the true value label The value of the categories; The model predicts the The probability value of each category; represents the cross entropy loss; Indicates the index of the category, ranging from 1 to n.
[0037] In a second aspect, the present invention provides a lung ultrasound pleural line and B-line status detection system in a noisy environment, comprising: a construction module for constructing a lung ultrasound network, using an encoder-decoder to construct the lung ultrasound network, the encoder being composed of a pre-trained Resnet series model, the decoder comprising an attention module, a first detection head module, and a second detection head module;
[0038] A feature vector of a fixed length after encoding by the encoder is pre-set, an attention module in the decoder receives the feature vector and generates a weighted feature vector, a first detection head module receives the weighted feature vector and outputs a pleural line state prediction, and a second detection head module receives the weighted feature vector and outputs a B-line state prediction;
[0039] An acquisition module is used to acquire lung ultrasound video data, classify and process the lung ultrasound video data, and obtain a training set;
[0040] The training module is used to train the lung ultrasound network using the training set obtained in the acquisition module to obtain a trained lung ultrasound detection model.
[0041] In a third aspect, the present invention provides a lung ultrasound pleural line and B-line status detection device in a noisy environment, comprising a processor and a memory, wherein the processor implements the lung ultrasound pleural line and B-line status detection method in a noisy environment as described above when executing a computer program stored in the memory.
[0042] In a fourth aspect, the present invention provides a computer-readable storage medium for storing a computer program, wherein the computer program, when executed by a processor, implements the method for detecting the status of the lung ultrasound pleural line and B line in a noisy environment as described above.
[0043] Compared with the prior art, the present invention has achieved the following technical effects:
[0044] The method for detecting the pleural line and B-line status of lung ultrasound in a noisy environment proposed in the present invention is based on lung ultrasound images with dense noise, and uses an efficient and learnable neural network to realize the detection of the pleural line and B-line; the method proposed in the present invention not only reduces the dependence on manual experience, but also realizes the objective and stable automatic detection of the pleural line and B-line status, and improves the detection accuracy and efficiency; traditional image processing methods are difficult to effectively extract pleural line and B-line features in a dense noise environment, and may introduce additional noise and distortion, while the method of the present invention avoids these problems by combining high image preprocessing technology and a neural network model, and maintains high-precision recognition performance; at the same time, the neural network model proposed in the present invention also has the characteristics of end-to-end training. Compared with traditional classification methods, the method of the present invention has higher accuracy and robustness, is suitable for lung ultrasound pleural line and B-line status detection tasks in simple clinical environments, and has broader application prospects.
[0045] The present invention uses image preprocessing technology to reduce the noise of the original ultrasound image, enhances the significance of key features, and retains the effective information of the original data; the present invention designs a neural network model that adapts to dense noise environments, which can automatically extract effective feature representations from complex noise backgrounds and achieve accurate detection of the pleural line and B-line status. By combining image preprocessing with the neural network model, the proposed method successfully solves the influence of dense noise on feature extraction and recognition, so that the neural network can be used to process lung ultrasound videos with a lot of noise. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] Figure 1 It is a schematic diagram of the overall process of the method of the present invention;
[0047] Figure 2 This is a flow chart of the training and use of the lung ultrasound detection model of the present invention;
[0048] Figure 3 This is a schematic diagram of the pleural line status results according to an embodiment of the present invention. DETAILED DESCRIPTION
[0049] The present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the present invention, rather than to limit the present invention. It should also be noted that, for ease of description, only parts related to the present invention, rather than all structures, are shown in the accompanying drawings.
[0050] like Figure 1 As shown, the present invention proposes a method for detecting the status of lung ultrasound pleural line and B line in a noisy environment, comprising the following steps:
[0051] S1. Constructing a lung ultrasound network. The present invention constructs a lung ultrasound network through an encoder-decoder structure. The lung ultrasound network can accurately segment different areas in a lung ultrasound image, thereby improving segmentation accuracy. At the same time, the lung ultrasound network can reduce resource consumption during training.
[0052] S2. Collect lung ultrasound video data, classify and process the lung ultrasound video data to obtain a training set; the feature extraction of the present invention and classify and process the data into a training set can improve the recognition accuracy of the model. The lung ultrasound video data covers a variety of lung conditions, so that the model can learn more comprehensive features during the training process, thereby showing higher accuracy and generalization ability in subsequent diagnosis.
[0053] S3. Use the training set obtained in S2 to train the lung ultrasound network to obtain a trained lung ultrasound detection model. The trained lung ultrasound detection model can accurately detect abnormal areas in lung ultrasound images, provide strong support for clinical diagnosis, and significantly improve diagnostic efficiency and accuracy.
[0054] S4. Input the unknown lung ultrasound video into the lung ultrasound detection model to obtain the pleural line and B-line status detection results of the unknown lung ultrasound video.
[0055] The present invention will be further explained below with reference to the accompanying drawings and specific embodiments:
[0056] like Figure 2 As shown, the computer hardware conditions used for implementation in this embodiment are: Intel Core i9-13900K @5.8GHz 12-core CPU processor, 64GB memory, equipped with GeForce RTX 4090 GPU. The running software environment is: Linux20.04 64-bit operating system. This embodiment uses Python3.8.19, opencv-python4.10.0.84 and Pytorch1.10.1 software to implement the method proposed in this embodiment.
[0057] Step 1: Construct a lung ultrasound network and initialize the parameters. First, read the ResNet50 (ResidualNetwork50) backbone model as the encoder. ResNet50 is pre-trained, and its encoded feature hidden layer dimension is a fixed value of 2048; the attention module, the first detection head module parameters and the second detection head module parameters in the decoder are randomly initialized. In the embodiment, the first detection head module parameters and the second detection head module both include a Dropout layer and a linear fully connected layer, wherein the Dropout layer is used to prevent overfitting, and the linear fully connected layer is used to map the weighted feature vector to the prediction result. The parameter of the Dropout (regularization method) layer is set to 0.5.
[0058] Step 2: Collect training data. Collect L lung ultrasound videos from multiple patients. The total number of frames in each video is fixed at 90. Each lung ultrasound video corresponds to a number. Each lung ultrasound video is accompanied by pleural line status results and B-line status results. The pleural line status results include four states: normal, rough, irregular, and fragmented. Figure 3 The diagram shows four states. Roughness indicates that the edge of the pleural line is not smooth. Irregularity indicates irregular thickening, with some places thick and some places relatively thin. Fragmentation indicates that the pleural line is discontinuous. The B-line state results include four states, namely normal, less than four, four to six, and more than six. After the pleural line state results and the B-line state results are encoded by one-hot encoding, the membrane line state results are mapped to the vector In the example, the B line status result is mapped to the vector In the vector With vector As the true value label, the vector The dimension is fixed to 4, the vector The dimension is fixed to 4.
[0059] It should be noted that the above training data comes from self-sampled and pre-processed clinical observation data of patients with lung diseases. For ethical considerations, the data only retains lung ultrasound image information and related pleural line and B-line doctor diagnosis information, and does not include other patient information.
[0060] Step 3: Train the lung ultrasound network. In this embodiment, the network parameters are trained on the Pytorch platform. The optimizer used in this embodiment is the Adam optimizer proposed by Diederik P. Kingma et al. in Adam: A method for stochastic optimization in 2014. The values of various parameters are set as follows: initial learning rate 0.0001, number of iterations , regularization coefficient , weight attenuation coefficient .
[0061] Given a set of lung ultrasound videos to be detected, each set contains The video data after preprocessing and frequency enhancement is 90×3×224×224, where 90 is the number of video frames, 3, 224 and 224 are the number of channels, height and width of the video respectively. For all video frame data, two-dimensional discrete cosine transform is first performed along the channel direction to convert the ultrasound data into the frequency domain, and then convolution operations are performed in the original spatial domain and the frequency domain respectively. Finally, the frequency domain is inversely transformed back to the spatial domain and the convolution results are added with the original spatial domain to obtain the frequency enhanced video frame data, and their shape is still 90×3×224×224.
[0062] Then, all video frames of each group of lung ultrasound videos to be detected are encoded by the encoder to obtain a series of encoding vectors , the dimension of each encoding vector is 2048. It is The encoding vector of the frame, The range is [1, ].
[0063] In order to meet the needs of the multi-head attention mechanism, this embodiment encodes the series of video frame feature vectors Reshape, the result is , where 16 represents the number of multi-head attention heads and 128 represents the spatial dimension of each attention head.
[0064] Use the reshape result of the above step to initialize the feature matrix , and preset a dimension The learnable attention vector , the attention vector The dimension is , set a scaling factor , scaling factor With the attention vector The size of the last dimension of .
[0065] According to the following formula, a dimension is fixed as The attention score matrix ;
[0066]
[0067] Where: represents the sum operation in the last dimension; Represents element-by-element multiplication of matrices; represents the scaling factor; represents the attention vector.
[0068] Using attention weights Attn For the feature matrix Perform weighted summation to achieve frame fusion and get the dimension The attention result matrix .
[0069] The attention result matrix is obtained by the first detection head module and the second detection head module. Mapped to two result spaces, the diagnostic results of pleural line status detection are obtained respectively Diagnostic results of B-line status detection , where the diagnostic results of pleural line status detection Diagnostic results of B-line status detection The dimensions of .
[0070] Use the cross entropy loss function to convert the true value label obtained in step 2 and And the prediction results and Input into the cross entropy loss function and use the back propagation algorithm to train the neural network. The cross entropy loss function is shown as follows:
[0071]
[0072] Where: Indicates the total number of categories; The one-hot encoding of the true value label The value of the category, It takes 0 or 1. When it takes 1, it means that the sample belongs to categories, 0 means not belonging to; The model predicts the The probability value of each category; Represents the cross entropy loss, which measures the probability distribution predicted by the model With the true distribution When the model predicts the probability Close to the true label When , the loss value is small; otherwise, the loss value is large; Indicates the index of the category, ranging from 1 to n.
[0073] Repeat step 3 until the preset number of iterations is met, then stop training and proceed to the verification process in step 4.
[0074] Step 4: Verify the trained model.
[0075] Analyze and process any lung ultrasound video with dimensions of Output video frame data of ; Use the lung ultrasound detection model trained in step 3 to The frame video data is frequency enhanced and encoded to obtain a series of feature vectors , the dimension of each feature vector is .
[0076] All the encoded video frame feature vectors Reshape, the result is .
[0077] Through the following formula
[0078] Get a dimension fixed to The attention score matrix ; Where: represents the sum operation in the last dimension; Represents element-by-element multiplication of matrices; represents the scaling factor; represents the attention vector.
[0079] Attention score Apply the Sigmoid activation function along the video frame number Align and normalize to get the normalized attention weight matrix Attn , the shape is .
[0080] Attn right Perform weighted summation to achieve frame fusion and get the dimension Attention Result Matrix .
[0081] The obtained attention result matrix Input into the first detection head module and the second detection head module to obtain the pleural line and B line status detection results and , the dimensions are .
[0082] Through five training and testing cycles using the 5-fold cross-validation method mentioned in “A Review of Cross-Validation Methods in Model Selection” published by Fan Yongdong et al. in 2013, the method proposed in the present invention can achieve an accuracy of 88.33±2.49% for pleural line detection and 91.22±2.69% for B-line detection.
[0083] Based on the same inventive concept, an embodiment of the present invention further provides a lung ultrasound pleural line and B-line status detection system in a noisy environment. Since the principle of solving the problem by the lung ultrasound pleural line and B-line status detection system in a noisy environment is similar to the aforementioned lung ultrasound pleural line and B-line status detection method in a noisy environment, the implementation of the lung ultrasound pleural line and B-line status detection system in a noisy environment can refer to the implementation of the lung ultrasound pleural line and B-line status detection method in a noisy environment, and the repeated parts will not be repeated.
[0084] In specific implementation, the lung ultrasound pleural line and B-line status detection system in a noisy environment provided by the embodiment of the present invention specifically includes:
[0085] A construction module is used to construct a lung ultrasound network, and an encoder-decoder is used to construct the lung ultrasound network, wherein the encoder is composed of a pre-trained Resnet series model, and the decoder includes an attention module, a first detection head module, and a second detection head module;
[0086] A feature vector of a fixed length after encoding by the encoder is pre-set, an attention module in the decoder receives the feature vector and generates a weighted feature vector, a first detection head module receives the weighted feature vector and outputs a pleural line state prediction, and a second detection head module receives the weighted feature vector and outputs a B-line state prediction;
[0087] An acquisition module is used to acquire lung ultrasound video data, classify and process the lung ultrasound video data, and obtain a training set;
[0088] The training module is used to train the lung ultrasound network using the training set obtained in the acquisition module to obtain a trained lung ultrasound detection model.
[0089] Correspondingly, an embodiment of the present invention further provides a lung ultrasound pleural line and B-line status detection device in a noisy environment, comprising a processor and a memory, wherein the processor implements a lung ultrasound pleural line and B-line status detection method in a noisy environment as provided in an embodiment of the present invention when executing a computer program stored in the memory.
[0090] For more specific processes of the above method, please refer to the corresponding contents disclosed in the aforementioned embodiments, which will not be repeated here.
[0091] Accordingly, an embodiment of the present invention further provides a computer-readable storage medium for storing a computer program, wherein when the computer program is executed by a processor, the method for detecting the status of the lung ultrasound pleural line and B line in a noisy environment as provided in the embodiment of the present invention is implemented.
[0092] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the systems, devices, and storage media disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the description is relatively simple, and the relevant parts can be referred to the method part.
[0093] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0094] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM Read-Only Memory), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM (Compact Disc Read-Only Memory), or any other form of storage medium known in the technical field.
[0095] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "comprise", "include" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0096] The above describes in detail the lung ultrasound pleural line and B-line status detection method, system, device and storage medium in a noisy environment provided by the present invention. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea; at the same time, for those skilled in the art, according to the idea of the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as limiting the present invention.
Claims
1. A method for detecting the status of pleural line and B line of lung ultrasound in a noisy environment, characterized in that: The following steps are involved: S1. Constructing a lung ultrasound network, using an encoder-decoder to construct the lung ultrasound network, wherein the encoder is composed of a pre-trained Resnet series model, and the decoder includes an attention module, a first detection head module, and a second detection head module; A feature vector of a fixed length after encoding by the encoder is pre-set, an attention module in the decoder receives the feature vector and generates a weighted feature vector, a first detection head module receives the weighted feature vector and outputs a pleural line state prediction, and a second detection head module receives the weighted feature vector and outputs a B-line state prediction; S2, collecting lung ultrasound video data, classifying and processing the lung ultrasound video data to obtain a training set; S3. Use the training set obtained in S2 to train the lung ultrasound network to obtain a trained lung ultrasound detection model. The specific process is: S31. Preprocess any group of lung ultrasound videos, each group of lung ultrasound videos contains videos, the preprocessed video data is represented as ; Where: is the number of video frames; is the number of video channels; For the video's height; is the width of the video; Then, the encoder encodes all the video frames of each group of videos to be tested to obtain a series of encoding vectors , where the dimension of each encoding vector is D; Where: L is the number of lung ultrasound videos; N is the number of frames of the video; is an algebraic variable; is the total number of encoded vectors; S32. Reshape a series of encoding vectors to obtain the reshaped result expressed as ; Where: Indicates the number of heads of multi-head attention; Represents the spatial dimension of each attention head; S33, using the reshaping result of step S32 to initialize the feature matrix , presuppose a dimension of The attention vector and a scaling factor are calculated according to the following formula to get a fixed dimension of The attention score matrix , the formula is as follows: Where: represents the sum operation in the last dimension; Represents element-by-element multiplication of matrices; represents the scaling factor; represents the attention vector; S34. Attention score matrix Apply the Sigmoid activation function along the video frame number Align and normalize to get the attention weight matrix Attn , where the attention weight matrix Attn The shape is represented by ; S35. Using the attention weight matrix Attn For the feature matrix Perform weighted summation to achieve frame fusion and get the dimension The attention result matrix ; S36, using the first detection head module and the second detection head module to convert the attention result matrix Mapped to two result spaces, the diagnostic results of pleural line status detection are obtained respectively Diagnostic results of B-line status detection ; S37, the true value label in S2 and Get the prediction result with S36 and Input into the cross entropy loss function, use the back propagation algorithm to train the lung ultrasound network, and obtain a trained lung ultrasound detection model; The cross entropy loss function is as follows: Where: Indicates the total number of categories; The one-hot encoding of the true value label The value of the categories; The model predicts the The probability value of each category; represents the cross entropy loss; Indicates the index of the category, with a value range of 1 to n; S4. Input the unknown lung ultrasound video into the lung ultrasound detection model to obtain the pleural line and B-line status detection results of the unknown lung ultrasound video.
2. According to the method for detecting the status of pleural line and B line of lung ultrasound in a noisy environment in claim 1, it is characterized in that: The specific process of S2 is: Acquire L lung ultrasound videos from a patient, wherein the total number of frames of each lung ultrasound video is set to N frames and each lung ultrasound video is numbered; Each lung ultrasound video includes the pleural line status results and the B-line status results. The pleural line status results are mapped to the vector after one-hot encoding. In the example, the B line status result is mapped to the vector after one-hot encoding. In the vector With vector as the true value label; The lung ultrasound video is processed into a format that matches the lung ultrasound network and corresponds to the mapped true value label vector.
3. According to the method for detecting the status of pleural line and B line of lung ultrasound in a noisy environment in claim 2, it is characterized in that: The pleural line status results include four states, namely normal, rough, irregular and fragmented; The B-line status results include four states, namely normal, less than four lines, four to six lines, and more than six lines.
4. A lung ultrasound pleural line and B-line status detection system in a noisy environment, characterized in that: include: A construction module is used to construct a lung ultrasound network, and an encoder-decoder is used to construct the lung ultrasound network, wherein the encoder is composed of a pre-trained Resnet series model, and the decoder includes an attention module, a first detection head module, and a second detection head module; A feature vector of a fixed length after encoding by the encoder is pre-set, an attention module in the decoder receives the feature vector and generates a weighted feature vector, a first detection head module receives the weighted feature vector and outputs a pleural line state prediction, and a second detection head module receives the weighted feature vector and outputs a B-line state prediction; An acquisition module is used to acquire lung ultrasound video data, classify and process the lung ultrasound video data, and obtain a training set; The training module is used to train the lung ultrasound network using the training set obtained in the acquisition module to obtain a trained lung ultrasound detection model. The specific process is: Preprocess any set of lung ultrasound videos, each set of lung ultrasound videos contains videos, the preprocessed video data is represented as ; Where: is the number of video frames; is the number of video channels; For the video's height; is the width of the video; Then, the encoder encodes all the video frames of each group of videos to be tested to obtain a series of encoding vectors , where the dimension of each encoding vector is D; Where: L is the number of lung ultrasound videos; N is the number of frames of the video; is an algebraic variable; is the total number of encoded vectors; Reshape a series of encoded vectors, and the reshaped result is expressed as ; Where: Indicates the number of heads of multi-head attention; Represents the spatial dimension of each attention head; Use the reshape result to initialize the feature matrix , presuppose a dimension of The attention vector and a scaling factor are calculated according to the following formula to get a fixed dimension of The attention score matrix , the formula is as follows: Where: represents the sum operation in the last dimension; Represents element-by-element multiplication of matrices; represents the scaling factor; represents the attention vector; Attention score matrix Apply the Sigmoid activation function along the video frame number Align and normalize to get the attention weight matrix Attn , where the attention weight matrix Attn The shape is represented by ; Using the attention weight matrix Attn For the feature matrix Perform weighted summation to achieve frame fusion and get the dimension The attention result matrix ; The attention result matrix is obtained by the first detection head module and the second detection head module. Mapped to two result spaces, the diagnostic results of pleural line status detection are obtained respectively Diagnostic results of B-line status detection ; The true value label in the acquisition module and And get the prediction results and Input into the cross entropy loss function, use the back propagation algorithm to train the lung ultrasound network, and obtain a trained lung ultrasound detection model; The cross entropy loss function is as follows: Where: Indicates the total number of categories; The one-hot encoding of the true value label The value of the categories; The model predicts the The probability value of each category; represents the cross entropy loss; Indicates the index of the category, ranging from 1 to n.
5. A lung ultrasound pleural line and B-line status detection device in a noisy environment, characterized in that: The method comprises a processor and a memory, wherein when the processor executes the computer program stored in the memory, the method for detecting the status of the pleural line and the B line of lung ultrasound in a noisy environment as claimed in any one of claims 1 to 3 is implemented.
6. A computer-readable storage medium, characterized in that: Used to store a computer program, wherein when the computer program is executed by a processor, the method for detecting the status of the lung ultrasound pleural line and B line in a noisy environment according to any one of claims 1 to 3 is implemented.
Citation Information
Patent Citations
Automatic pneumothorax detection system based on A-mode ultrasound and A-mode ultrasound image classification method
CN112801954A
Ultrasonic image-based pneumonia identification method and device and computer equipment
CN114693643A