Pleural effusion grading model training method, pleural effusion grading method and electronic equipment
By combining deep learning segmentation networks with automatic scale recognition technology, a fully automated assessment of pleural effusion ultrasound images, physical depth, and clinical grading was achieved. This solved the problems of reliance on manual readings and poor cross-device adaptability in existing methods, and improved the accuracy and repeatability of measurements.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- THE FIRST MEDICAL CENT CHINESE PLA GENERAL HOSPITAL
- Filing Date
- 2025-12-17
- Publication Date
- 2026-04-10
AI Technical Summary
Existing deep learning-based methods for detecting pleural effusion can only segment or determine the presence of lesions, lacking an effective mechanism to convert the segmentation results into clinically usable quantitative indicators. Furthermore, they rely on manual reading of scale information in terms of ultrasound image calibration, resulting in low measurement efficiency, high subjectivity, poor consistency, and difficulty in adapting to image differences between different devices.
By integrating deep learning segmentation networks with image-embedded scales for automatic recognition, an end-to-end intelligent analysis process is constructed. The process automatically extracts the effusion region mask and combines it with template matching to accurately locate the reference scale, achieving a reliable conversion from pixel length to physical depth. Finally, it outputs clinically meaningful effusion depth values and grading results.
It achieves fully automated assessment from ultrasound images of pleural effusion to physical depth and clinical grading, solving the problems of subjective error and poor cross-device adaptability caused by reliance on manual readings in existing methods, and significantly improving the accuracy and repeatability of measurements.
Smart Images

Figure CN121837162A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image processing technology, and more specifically, to a training method for a pleural effusion grading model, a pleural effusion grading method, and an electronic device. Background Technology
[0002] Bedside ultrasound has become an important tool for the initial screening and dynamic follow-up of pleural effusion due to its advantages such as not requiring patient movement, no radiation, and real-time imaging. In recent years, image segmentation methods based on convolutional neural networks have made significant progress in medical image analysis, especially in lung ultrasound images, where they can now automatically identify and segment pleural lines, B-lines, and hypoechoic areas, outputting pixel-level lesion masks or presence determinations.
[0003] However, current deep learning-based techniques for pleural effusion detection and segmentation still have significant limitations. Existing methods only generate binary segmentation masks or classify "presence / absence" of effusion, lacking an effective mechanism to further transform the segmentation results into clinically usable quantitative indicators. Although the models can accurately delineate the effusion area, a conversion path from the segmentation mask to the physical depth of the effusion has not yet been established, making it difficult to directly serve clinical grading decisions. Summary of the Invention
[0004] In view of this, the purpose of this invention is to provide a training method for a pleural effusion grading model, a pleural effusion grading method, and an electronic device to at least partially improve the above-mentioned problems.
[0005] To achieve the above objectives, the technical solutions adopted in the embodiments of the present invention are as follows: In a first aspect, embodiments of the present invention provide a method for grading pleural effusion, comprising: Acquire ultrasound images of pleural effusion; The ultrasound image of the pleural effusion is input into a pre-trained pleural effusion grading model to obtain a binary mask of the effusion. Template matching is performed on the ultrasound image of the pleural effusion to identify at least two reference scale marks with a known physical distance on the scale in the image, and the pixel coordinates of each reference scale mark in the image are determined. Perform connected component analysis on the binary mask and extract the connected component with the largest longitudinal extension length as the target liquid accumulation region; Calculate the maximum pixel length of the target fluid accumulation region along the vertical axis of the image; The physical depth of pleural effusion is calculated based on the physical spacing, the two pixel coordinates, and the maximum pixel length. Pleural effusion is clinically graded based on the physical depth described.
[0006] Optionally, the pleural effusion grading model includes a spatial coordinate enhancement module, a convolutional backbone module, an encoder module, a multi-scale context-aware module, a decoder module, and an output module; the step of inputting the pleural effusion ultrasound image into the pre-trained pleural effusion grading model to obtain a binary mask for the effusion includes: The ultrasound image of the pleural effusion is input into the spatial coordinate enhancement module, and the horizontal and vertical coordinate channels are stitched on the ultrasound image to obtain a three-channel input tensor containing prior location information. The three-channel input tensor is input into the convolutional backbone module for preliminary feature extraction to obtain an initial feature map. The initial feature map is input into the encoder module, and after multi-level coding blocks, feature abstraction and spatial downsampling are performed. The feature map output by each level is saved as the corresponding skip connection feature, and finally the bottleneck feature is output. The bottleneck features are input into the multi-scale context awareness module, which captures multi-scale context information through parallel dilated convolution and global pooling operations, and outputs context-enhanced features. The context enhancement features are input into the decoder module, and the spatial resolution is gradually restored through multi-level upsampling. After each level of upsampling, the attention gate mechanism is used to adaptively weight and fuse the skip connection features from the corresponding level of the encoder to obtain the boundary-refined decoding features. The decoded features are input into the output module, and the liquid accumulation binary mask is generated through convolution mapping and activation.
[0007] Optionally, the step of inputting the ultrasound image of the pleural effusion into the spatial coordinate enhancement module, and stitching the horizontal and vertical coordinate channels onto the ultrasound image to obtain a three-channel input tensor containing prior location information, includes: The ultrasound image of the pleural effusion was normalized to obtain a normalized grayscale image; Construct a row index matrix and a column index matrix with the same size as the ultrasound image of the pleural effusion; wherein each element in the row index matrix and the column index matrix represents the ordinate and abscissa of the corresponding pixel in the ultrasound image of the pleural effusion, respectively; Normalize the row index matrix and the column index matrix respectively to obtain the ordinate channel and the abscissa channel; The grayscale image, the vertical axis channel, and the horizontal axis channel are concatenated along the channel dimension to obtain a three-channel input tensor.
[0008] Optionally, the initial feature map is input into the encoder module, and after feature abstraction and spatial downsampling through multiple levels of coding blocks, the feature map output from each level is saved as the corresponding skip connection feature, and the final output bottleneck feature includes: The initial feature map is input into an encoder module consisting of multiple sequentially connected coding blocks; For each coding block in the encoder module, an input feature map from the previous coding block is received; The input feature map is fed into a residual unit, and two 3×3 convolution operations are performed. After each convolution, a GELU activation function is applied. The output after the second convolution activation is added element-wise to the input feature map; The summation result is activated by GELU, the residual feature of the coding block is output, and the residual feature is saved as the skip connection feature of the corresponding level; The residual features are processed through a downsampling convolutional layer to reduce their spatial resolution and increase their number of channels, and the output is used as the input feature map for the next coding block. The feature map output by the last coding block is the bottleneck feature.
[0009] Optionally, the step of inputting the bottleneck features into the multi-scale context-aware module, capturing multi-scale context information through parallel dilated convolution and global pooling operations, and outputting context-enhanced features includes: The bottleneck features are input into five parallel branches respectively, and the outputs of the five parallel branches are concatenated in the channel dimension to obtain multi-scale fusion features; wherein, the five parallel branches include a 1×1 convolution branch, a 3×3 dilated convolution branch with an inflation rate of 2, a 3×3 dilated convolution branch with an inflation rate of 4, a 3×3 dilated convolution branch with an inflation rate of 8, and a global average pooling branch. Global average pooling is performed on the multi-scale fusion features to compress the spatial information of each channel into a scalar, resulting in a channel-level statistical description vector; The description vector is input into a gated network consisting of two fully connected layers, and a weight vector representing the importance of each channel is generated by passing the Sigmoid activation function. The weight vector is multiplied element-wise with the multi-scale fusion feature to obtain the context-enhanced feature.
[0010] Optionally, the decoder module includes multi-level decoding blocks. The context enhancement features are input into the decoder module, and spatial resolution is gradually restored through multi-level upsampling. After each upsampling level, an attention gate mechanism is used to adaptively weight and fuse the skip connection features from the corresponding level of the encoder to obtain boundary-refined decoding features, including: For each level of the decoding block, the decoding features input to that level are upsampled to obtain upsampled features; Linear transformations are performed on the upsampled features and the skip connection features of the corresponding level of the encoder, respectively, and the transformation results are added together to obtain the gated fusion features; The gated fusion features are processed by an activation function, then by convolution and a sigmoid activation function to generate a spatial attention map. The skip connection features are spatially weighted using the spatial attention map to obtain weighted skip connection features. The upsampled features and the weighted skip connection features are concatenated along the channel dimension, and at least one convolution operation is performed on the concatenated features to output the decoding features of the decoding block at this level. The input to the first-level decoding operation is the context enhancement feature, and the output of the last-level decoding operation is the boundary-refined decoding feature.
[0011] Optionally, the step of performing template matching on the ultrasound image of the pleural effusion, identifying at least two reference scale marks with a known physical distance on a scale in the image, and determining the pixel coordinates of each reference scale mark in the image, includes: Obtain a preset reference scale mark template image; the reference scale mark template image contains at least two scale marks with a known physical distance; The template matching algorithm is used to search for regions in the ultrasound image of the pleural effusion that match the reference scale marker template image. The pixel coordinates of each of the reference scale marks in the ultrasound image of the pleural effusion are determined based on the matching results.
[0012] Optionally, the step of performing connected component analysis on the binary mask and extracting the connected component with the largest longitudinal extension length as the target liquid accumulation region includes: Connectivity component marking is performed on the binary mask to obtain multiple independent connected regions; For each connected region, calculate the height of its minimum bounding rectangle, which is used as the longitudinal extension length of the connected region; The connected region with the longest longitudinal extension is selected as the target liquid accumulation region.
[0013] Secondly, embodiments of the present invention provide a method for training a pleural effusion grading model, including: Obtain a training sample set; where each training sample includes an ultrasound image of pleural effusion and a ground truth mask of the pleural effusion region; The ultrasound image of the pleural effusion is input into the pleural effusion grading model to be trained, and a forward propagation process is performed according to the pleural effusion grading method described in any of the first aspects to obtain a binary mask for predicting effusion. Based on a preset composite loss function, loss information is calculated according to the predicted effusion binary mask and the true value mask of the pleural effusion region; Based on the loss information, the parameters of the pleural effusion grading model to be trained are optimized using the backpropagation algorithm.
[0014] Thirdly, embodiments of the present invention provide an electronic device, including a memory, a processor, and a computer program stored in the memory and running on the processor, wherein the processor executes the computer program to implement the method described in any of the above-mentioned embodiments.
[0015] This invention provides a training method for a pleural effusion grading model, a pleural effusion grading method, and an electronic device. By combining deep learning segmentation results with automatic scale recognition based on template matching, it achieves a fully automated assessment process from ultrasound images of pleural effusion to physical depth and clinical grading. Compared to existing technologies, this method not only overcomes the limitations of traditional models that only rely on segmentation masks or presence / absence judgments, but also effectively solves the problems of pixel-to-physical scale conversion relying on manual reading, resulting in poor consistency and weak cross-device generalization ability. By automatically extracting the reference scale of the scale in the image and calculating the pixel-to-physical ratio, combined with connected component analysis, the maximum effusion depth is accurately located, significantly improving the objectivity, repeatability, and clinical applicability of the measurement. It can achieve rapid and accurate bedside effusion grading without manual intervention.
[0016] To make the above-mentioned objectives, features and advantages of this application more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description
[0017] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of the present invention and should not be regarded as a limitation on the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0018] Figure 1 A schematic structural block diagram of an electronic device provided in an embodiment of the present invention; Figure 2 A schematic flowchart of a pleural effusion grading method provided in an embodiment of the present invention; Figure 3 A schematic structural block diagram of a pleural effusion grading model provided in an embodiment of the present invention; Figure 4 A flowchart illustrating step S220 provided in an embodiment of the present invention; Figure 5This is a schematic diagram of an ultrasound image segmentation process provided in an embodiment of the present invention; Figure 6 This is a flowchart illustrating a training method for a pleural effusion grading model provided in an embodiment of the present invention.
[0019] Icons: 100 - Electronic device; 101 - Memory; 102 - Communication interface; 103 - Processor; 104 - Communication bus; 300 - Pleural effusion grading model; 310 - Spatial coordinate enhancement module; 320 - Convolutional backbone module; 330 - Encoder module; 340 - Multi-scale context-aware module; 350 - Decoder module; 360 - Output module. Detailed Implementation
[0020] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. The components of the embodiments of the present invention described and shown in the accompanying drawings can generally be arranged and designed in various different configurations.
[0021] Therefore, the following detailed description of the embodiments of the invention provided in the accompanying drawings is not intended to limit the scope of the claimed invention, but merely to illustrate selected embodiments of the invention. All other embodiments obtained by those skilled in the art based on the embodiments of the invention without inventive effort are within the scope of protection of the invention.
[0022] It should be noted that similar reference numerals and letters in the following figures indicate similar items; therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures. Furthermore, in the description of this invention, terms such as "first," "second," etc., are used only to distinguish descriptions and should not be construed as indicating or implying relative importance.
[0023] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0024] In existing technologies, most deep learning-based methods for detecting pleural effusion can only segment or determine the presence of lesions, lacking an effective mechanism to convert the segmentation results into clinically usable quantitative indicators. At the same time, in terms of scale calibration of ultrasound images, they generally rely on manual reading of scale information or device metadata, resulting in low measurement efficiency, high subjectivity, poor consistency, and difficulty in adapting to image differences between different devices.
[0025] Based on the above, this invention provides a method for training a pleural effusion grading model, a pleural effusion grading method, and an electronic device, aiming to construct an end-to-end intelligent analysis workflow. This method, by integrating a deep learning segmentation network with automatic recognition technology using embedded image scales, can automatically extract the effusion region mask from two-dimensional pleural ultrasound images. Combined with template matching, it accurately locates the reference scale, achieving a reliable conversion from pixel length to physical depth, and ultimately outputting clinically significant effusion depth values and grading results.
[0026] To implement the process steps and functions of the various examples of this invention, please refer to [link / reference]. Figure 1 , Figure 1 This is a schematic structural block diagram of an electronic device provided in an embodiment of the present invention. The electronic device 100 includes a memory 101 and a processor 103, which are electrically connected directly or indirectly to each other to achieve data transmission or interaction. For example, these components can be electrically connected to each other through one or more communication buses 104 or signal lines. The memory 101 can be used to store software programs and modules, and the processor 103 executes the software programs and modules stored in the memory 101, thereby performing various functional applications and data processing.
[0027] Electronic device 100 can be, but is not limited to, a personal computer (PC), a server, a distributed computer, etc. It is understood that electronic device 100 is not limited to a physical server, but can also be a virtual machine on a physical server, a virtual machine built on a cloud platform, or any other computer that can provide the same functionality as the server or virtual machine. The operating system of electronic device 100 can be, but is not limited to, Windows, Linux, etc.
[0028] The memory 101 may be, but is not limited to, random access memory (RAM), read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), etc.
[0029] The communication connection between the electronic device 100 and external devices is achieved through at least one communication interface 102 (which can be wired or wireless).
[0030] Processor 103 may be an integrated circuit chip with signal processing capabilities. In implementation, the steps of this embodiment can be completed by integrated logic circuits in the hardware of processor 103 or by instructions in software form. Processor 103 may be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc.; it may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
[0031] Understandable. Figure 1 The structure shown is for illustrative purposes only; the electronic device 100 may also include components that are more advanced than those shown. Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown. Figure 1 The components shown can be implemented using hardware, software, or a combination thereof.
[0032] The following is an exemplary description of the pleural effusion grading method provided by the present invention. See [link to documentation]. Figure 2 The subject executing this method can be one of the above. Figure 1 The electronic device 100 shown, the method includes as follows Figure 2 The following steps are described: S210: Acquire ultrasound images of pleural effusion.
[0033] S220: Input the ultrasound image of pleural effusion into the pre-trained pleural effusion grading model to obtain a binary mask of the effusion.
[0034] S230: Perform template matching on ultrasound images of pleural effusion, identify at least two reference scale marks with known physical distance on the scale in the image, and determine the pixel coordinates of each reference scale mark in the image.
[0035] S240: Perform connected component analysis on the binary mask and extract the connected component with the largest longitudinal extension length as the target liquid accumulation region.
[0036] S250: Calculate the maximum pixel length of the target fluid accumulation region along the vertical axis of the image.
[0037] S260: Calculate the physical depth of pleural effusion based on the physical spacing, two pixel coordinates, and the maximum pixel length.
[0038] S270: Clinical grading of pleural effusion based on physical depth.
[0039] In this embodiment of the invention, a two-dimensional ultrasound image of the patient's pleural cavity is first acquired using an ultrasound imaging device. The ultrasound image of pleural effusion is a standard parasagittal section image including the intercostal spaces, pleural rim, and potential hypoechoic effusion area, typically obtained from a bedside ultrasound examination. This image can be transmitted to the electronic device 100 via wired or wireless means, or acquired in real time directly on an integrated smart terminal.
[0040] The images are stored in digital formats, such as DICOM or JPEG / PNG, and have visual scale information (usually located on the side of the image, marked with physical scales such as "5cm", "10cm").
[0041] The acquired ultrasound images of pleural effusion are input into a pre-trained pleural effusion grading model. This model is built on a deep learning architecture and has been trained on a large amount of labeled data, enabling it to automatically identify effusion areas in the images.
[0042] The model outputs a binary mask of effusion with the same size as the input image. A pixel value of 1 indicates a region identified as effusion, while a pixel value of 0 indicates a non-effusion region. This mask accurately outlines the contours of all low-echo areas in the image, serving as the basis for subsequent quantitative analysis.
[0043] To achieve the conversion from pixel scale to physical scale, the scale information embedded in the image needs to be extracted. Template matching is used to automatically identify the reference scale markings in the image. For example, the system has one or more built-in standard scale template images (such as grayscale templates containing the characters "5cm" and "10cm"). Using normalized cross-correlation (NCC) or other similarity measurement algorithms, the system slides through the original ultrasound image to search for the region that best matches the template. After a successful match, the pixel coordinates of the center point of the corresponding scale character are obtained.
[0044] This process does not rely on device model or scale parameters in DICOM metadata; it is completed entirely based on image visual content, thus improving the system's versatility and cross-device adaptability.
[0045] Since the segmentation model may output multiple isolated hypoechoic areas (such as artifacts, small vesicles, or noise false detections), it is necessary to screen out the main effusion area that is most clinically significant.
[0046] Connectivity analysis is performed on the binary mask generated in step S220. Multiple independent connected components are identified by clustering pixels connected in 8-neighborhoods or 4-neighborhoods.
[0047] For each connected region, the height of its minimum bounding rectangle (i.e., the span along the vertical axis of the image) is calculated, and the region with the largest height is identified as the target pleural effusion area. This strategy is based on prior medical knowledge: true pleural effusions are mostly distributed vertically along the direction of gravity, with the most significant longitudinal extension.
[0048] Ultimately, the connected component is retained, while the remaining regions are discarded to reduce interference and improve measurement accuracy.
[0049] After identifying the target fluid accumulation region, its maximum extension length along the vertical axis of the image is further extracted. This can be done in the following ways: taking the height of the smallest bounding rectangle of the connected region; or extracting the skeleton of the region and measuring the number of pixels along its longest path; or counting its projection height on each column and taking the maximum value as the maximum vertical pixel length L1.
[0050] This value represents the deepest pixel span of the fluid accumulation in the image and is a key input for subsequent calculation of physical depth.
[0051] Using the physical distance D (unit: cm) between the two reference scales identified in step S230 and their pixel coordinates, the pixel distance L2 between them is calculated, and then the pixel-physical conversion factor (unit: cm / pixel) is obtained: .
[0052] Then, substituting the maximum pixel length L1 obtained in step S250 into the formula, the actual physical depth d is calculated: .
[0053] This yields a numerical value for the fluid accumulation depth in centimeters, completing the conversion from image pixels to a clinically usable indicator.
[0054] This process achieves fully automated dimensional calibration, avoiding subjective errors caused by manual readings, and is applicable to ultrasound equipment of different brands, models, and resolutions.
[0055] Finally, based on the calculated physical depth d, the fluid is graded according to clinically recognized standards. In an exemplary grading system: microeffusion: d < 3 cm; small effusion: 3 ≤ d < 5 cm; moderate effusion: 5 ≤ d ≤ 7 cm; large effusion: d > 7 cm.
[0056] This method integrates deep learning segmentation and automatic scale recognition technology to achieve end-to-end automated assessment of pleural effusion ultrasound images, physical depth, and clinical grading. It effectively solves the technical problems of existing methods that rely on manual reading, cannot provide quantitative output, and have poor generalization ability, thus significantly improving the accuracy of measurement.
[0057] Pleural effusion grading models can employ conventional segmentation networks such as U-Net. To achieve better segmentation of pleural effusion ultrasound images, this invention proposes a pleural effusion grading model architecture, see [link to relevant documentation]. Figure 3 The pleural effusion grading model 300 includes a spatial coordinate enhancement module 310, a convolutional backbone module 320, an encoder module 330, a multi-scale context-aware module 340, a decoder module 350, and an output module 360. See also... Figure 4 Step S220 may include the following steps: S221: Input the ultrasound image of pleural effusion into the spatial coordinate enhancement module, and stitch the horizontal and vertical coordinate channels on the ultrasound image to obtain a three-channel input tensor containing prior location information.
[0058] To enhance the model's spatial perception of anatomical structures, this embodiment of the invention incorporates a spatial coordinate enhancement module at the input end, used to explicitly inject prior information about the two-dimensional coordinates of pixels. In an optional implementation, step S221 may include the following sub-steps: S2211: Normalize the ultrasound image of pleural effusion to obtain a normalized grayscale image.
[0059] S2212: Construct a row index matrix and a column index matrix with the same size as the ultrasound image of pleural effusion; where each element in the row index matrix and the column index matrix represents the ordinate and abscissa of the corresponding pixel in the ultrasound image of pleural effusion, respectively.
[0060] S2213: Normalize the row index matrix and column index matrix respectively to obtain the ordinate channel and the abscissa channel.
[0061] S2214: Concatenate the grayscale image, the vertical axis channel, and the horizontal axis channel along the channel dimension to obtain a three-channel input tensor.
[0062] The original ultrasound image of pleural effusion (e.g., 512×512) is normalized to [0, 1] to obtain a normalized grayscale image. .
[0063] To incorporate explicit spatial coordinate information, two index matrices with the same size as the input image are constructed: Row index matrix X, where each element , where i represents the i-th row, and represents the ordinate of that position in the image.
[0064] Column index matrix Y, where each element , indicating the j-th column.
[0065] These two matrices encode the absolute spatial location of each pixel in the entire image, which helps the model learn the medical prior knowledge that "fluid accumulation is mostly concentrated in the lower half of the costophrenic angle".
[0066] To avoid the coordinate values and image grayscale values differing too much in magnitude and affecting training convergence, the above row and column index matrices are normalized to obtain normalized ordinate and abscissa channels.
[0067] This operation ensures that the numerical ranges of the three channels (grayscale, horizontal axis, and vertical axis) are consistent, which facilitates fair weighted fusion in subsequent convolutional layers.
[0068] The three components are concatenated along the channel dimension to form a three-channel input tensor. .
[0069] The three-channel input tensor serves as the initial input to the entire deep learning model, enabling the network to perceive the spatial distribution of each pixel in the first layer, enhancing the perception of the pleural line and effusion location, thereby accelerating convergence and improving segmentation accuracy.
[0070] S222: Perform preliminary feature extraction on the three-channel input tensor input convolution backbone module to obtain the initial feature map.
[0071] The three-channel input tensors are input into the convolutional backbone module (ConvStem) to perform preliminary feature extraction.
[0072] This module can be composed of two consecutive 3×3 convolutions with a stride of 1 and padding of 1, followed by a GELU activation function after each convolution. The first convolution maps the channels from 3 to 64, while the second convolution maintains 64 channels. The ConvStem output is denoted as... .
[0073] This process preserves high-resolution details and generates an initial feature map. It serves as the input to the first stage of the encoder and also as the source of the jump connections in the last stage.
[0074] S223: Input the initial feature map into the encoder module, perform feature abstraction and spatial downsampling through multiple levels of coding blocks, save the feature map output by each level as the corresponding skip connection feature, and finally output the bottleneck feature.
[0075] The initial feature map is input into the encoder module, and hierarchical feature extraction using the residual structure yields the skip connection features and the final bottleneck features output from each coding block. In an optional implementation, step S223 may include the following sub-steps: S2231: Input the initial feature map into the encoder module, which consists of multiple sequentially connected coding blocks.
[0076] The initial feature map from the convolutional backbone module is input into the encoder module, which consists of multiple sequentially connected coding blocks.
[0077] S2232: For each coding block in the encoder module, receive the input feature map from the previous coding block.
[0078] Each level of coding block receives the output feature map from the previous level as input. The first level... Each subsequent stage receives the output after downsampling from the previous stage in sequence.
[0079] S2233: Input the input feature map into a residual unit and perform two 3×3 convolution operations, followed by the GELU activation function after each convolution.
[0080] Each level of the coded block contains a residual unit, whose main operations are as follows: Received input feature map The first 3×3 convolution operation is performed with a stride of 1 and padding of 1, maintaining the same spatial dimensions, followed by GELU activation. A second 3×3 convolution plus GELU operation is then performed to obtain the transformed features. .
[0081] S2234: Add the output after the second convolution activation to the input feature map element by element.
[0082] The output after the second convolution activation With the original input By performing element-wise addition to achieve identity mapping, this design effectively alleviates the gradient vanishing problem in deep networks and promotes feature flow and optimization convergence.
[0083] S2235: Perform GELU activation on the summation result, output the residual feature of the coding block, and save the residual feature as the skip connection feature of the corresponding level.
[0084] Apply the GELU activation function again to the summation result to generate the residual features for this level. The feature map is then saved as a skip connection feature at the corresponding level for use in the decoder stage.
[0085] S2236: The residual features are processed through a downsampling convolutional layer to reduce their spatial resolution and increase their number of channels, and the output is used as the input feature map for the next coding block.
[0086] The feature map output by the last coding block is the bottleneck feature.
[0087] residual features Input a downsampling convolutional layer with a 3×3 kernel, a stride of 2, and padding of 1 to halve the spatial dimension while doubling the number of channels.
[0088] The output is used as the input feature map for the next coding block, continuing to the next level of abstraction.
[0089] Finally, the feature map output by the last-level coding block becomes the bottleneck feature and enters the multi-scale context-aware module.
[0090] S224: Input the bottleneck features into the multi-scale context-aware module, capture multi-scale context information through parallel dilated convolution and global pooling operations, and output context-enhanced features.
[0091] To effectively handle fluid accumulation regions of varying sizes (e.g., small amounts of fluid appear as dots, while large amounts appear as large areas of low echo), this embodiment of the invention introduces an improved ASPP module at the encoder end, forming a "multi-scale context-aware module." This module receives bottleneck features and extracts multi-scale context information through parallel branches. In one optional implementation, the multi-scale context-aware module includes five parallel branches. These five parallel branches include a 1×1 convolution branch, a 3×3 dilated convolution branch with a dilation rate of 2, a 3×3 dilated convolution branch with a dilation rate of 4, a 3×3 dilated convolution branch with a dilation rate of 8, and a global average pooling branch. Step S224 may include the following sub-steps: S2241: Input the bottleneck features into five parallel branches respectively, and concatenate the outputs of the five parallel branches in the channel dimension to obtain multi-scale fusion features.
[0092] The bottleneck features output by the encoder are simultaneously input into five parallel branches to extract contextual information under different receptive fields: a 1×1 convolution branch is used to capture local neighborhood relationships; a 3×3 dilated convolution branch with a dilation rate of 2 expands the receptive field without losing resolution, adapting to medium-sized effusions; a 3×3 dilated convolution branch with a dilation rate of 4 further expands the field of view, covering a larger area of low echogenicity; a 3×3 dilated convolution branch with a dilation rate of 8 perceives the global structure, preventing the missed detection of large areas of effusion; and a global average pooling branch performs global average pooling on the input, reduces the dimensionality by 1×1 convolution, and then restores it to the original size by bilinear interpolation, introducing image-level semantic information.
[0093] The outputs of the five branches are concatenated along the channel dimension to obtain multi-scale fused features.
[0094] This structure can effectively address the challenges of diverse liquid morphology and scale variations without increasing computational complexity.
[0095] S2242: Perform global average pooling on the multi-scale fusion features to compress the spatial information of each channel into a scalar, resulting in a channel-level statistical description vector.
[0096] Global average pooling is performed again on the multi-scale fused features to compress the spatial information of each channel into a scalar, resulting in a channel-level statistical description vector that reflects the average level of response intensity of each channel in the entire feature map.
[0097] S2243: Input the description vector into a gated network consisting of two fully connected layers, and generate a weight vector representing the importance of each channel through the Sigmoid activation function.
[0098] The description vector is input into a lightweight gated network consisting of two fully connected layers. For example, the first fully connected layer compresses the dimension from 512 to 128, and the activation function can be ReLU. The second fully connected layer restores the dimension to 512, and the output is activated by the Sigmoid function to generate a weight vector s representing the importance of each channel. This process can be represented by the following formula:
[0099] in, To describe a vector, It is the first fully connected layer. It is the second fully connected layer. This is the Sigmoid function.
[0100] This weight vector reflects the model's preference for different feature channels, such as enhancing low-frequency background information or suppressing noise channels.
[0101] S2244: Multiply the weight vector element-wise with the multi-scale fused features to obtain context-enhanced features.
[0102] The multi-scale fusion features are weighted channel by channel using the weight vector s, and the final output is a context-enhanced feature, in which key channels are adaptively enhanced and irrelevant channels are suppressed, thereby improving the feature discriminative power.
[0103] S225: Input the context enhancement features into the decoder module, and gradually restore the spatial resolution through multi-level upsampling. After each level of upsampling, use the attention gate mechanism to adaptively weight and fuse the skip connection features from the corresponding level of the encoder to obtain the decoded features with refined boundaries.
[0104] The decoder module employs a multi-level upsampling structure to gradually restore spatial resolution and fuses skip connection features from the encoder at each level to reconstruct fine boundaries.
[0105] In an alternative implementation, the decoder module includes multi-level decoding blocks, and step S225 may include the following sub-steps: S2251: For each level of decoding block, the decoding features input to that level are upsampled to obtain upsampled features.
[0106] S2252: Perform linear transformations on the upsampled features and the skip connection features of the corresponding level of the encoder respectively, and add the transformation results to obtain the gated fusion features.
[0107] S2253: The gated fusion features are processed by an activation function, then by convolution and a sigmoid activation function to generate a spatial attention map.
[0108] S2254: Spatial weighting of skip connection features is performed using spatial attention maps to obtain weighted skip connection features.
[0109] S2255: Concatenate the upsampled features and the weighted skip connection features along the channel dimension, perform at least one convolution operation on the concatenated features, and output the decoding features of the decoding block at this level.
[0110] The first-level decoding operation takes context-enhanced features as input, while the last-level decoding operation outputs boundary-refined decoding features.
[0111] For each decoding block, the input decoding features (initially context-enhanced features) are first upsampled. For example, bilinear interpolation is used to double the spatial resolution of the feature map to obtain upsampled features.
[0112] Linear transformations are performed on the upsampled features and the skip connection features from the corresponding level of the encoder to align the channel dimensions or extract the preliminary mapping. The two are then added together to obtain the gated fusion features.
[0113] The gated fusion features are processed by the ReLU activation function, then input into a 1×1 convolutional layer to map them into a single-channel feature map, and finally a spatial attention map is generated by the Sigmoid activation function.
[0114] The original skip connection features are weighted element-wise using spatial attention maps. After weighting, only local features related to the current decoding path (such as real fluid boundaries) are retained, while the influence of irrelevant regions (such as artifacts and B-line interference) is suppressed.
[0115] The above process can be represented by the following formula:
[0116] in, This is a skip connection feature. This is a spatial attention map. It is the Sigmoid activation function. For upsampling features, for Convolution operation, for Convolution operation, For bias, It is a 1×1 convolutional layer.
[0117] The upsampled features and the weighted skip features are concatenated along the channel dimension. At least one 3×3 convolution operation is performed on the concatenated features to output the final feature map of the decoding block at this level.
[0118] This process is repeated at each stage of decoding, gradually restoring the original resolution, and finally outputting the decoded features with refined boundaries.
[0119] S226: Input the decoded features into the output module and generate a liquid binary mask through convolution mapping and activation.
[0120] The final decoded features are input into the output module to complete the final classification task.
[0121] In one alternative embodiment, the encoder module includes four levels of encoding blocks, and the decoder module includes four levels of decoding blocks. See also Figure 5 A single-channel ultrasound image with a size of 512×512 is preprocessed and a coordinate channel is added to obtain a three-channel input tensor. The three-channel input tensor is input into the convolutional backbone module for preliminary feature extraction to obtain an initial feature map. .Will Input the first-level encoded block to obtain the skip features. First-level coding features ,Will Input the second-level encoded block to obtain the skip features. Second-level coding features Finally, the fourth-level coded block is output. ,Will Input the ASPP parallel branch to extract multi-scale contextual information, and obtain ,Will and Input the first-level decoding block, and get This is processed in each decoding block accordingly, ultimately yielding... ,Will The input / output module generates a binary mask for the accumulated liquid. .
[0122] In one possible implementation, to achieve pixel-to-physical scale conversion without manual intervention, the system pre-configures a set of reference scale marker template images for locating known physical distance points on the scale from the original ultrasound image. Step S230 may include the following steps: S231: Obtain a preset reference scale mark template image; the reference scale mark template image contains at least two scale marks with known physical spacing.
[0123] S232: Search for regions in the ultrasound images of pleural effusion that match the reference scale marker template image using a template matching algorithm.
[0124] S233: Determine the pixel coordinates of each reference scale mark in the ultrasound image of pleural effusion based on the matching results.
[0125] The reference scale marker template image is a grayscale image containing at least two scale markers with known physical spacing. For example, in the display interface of a common bedside ultrasound device, a linear scale is usually displayed on the right or bottom, with numbers marked every 5mm or 1cm (such as "5cm", "10cm"). In this embodiment, a local area containing the characters "5cm" and "10cm" and their adjacent scale lines is selected as the template image to construct a template library.
[0126] The input ultrasound images of pleural effusion are matched one by one with the template images. A normalized cross-correlation algorithm is used as the matching criterion. Based on the matching and localization results, the pixel coordinates of the two marker center points, "5cm" and "10cm", are extracted and denoted as P_1(x_1, y_1) and P_2(x_2, y_2), respectively. The Euclidean distance L_2 = |P_1 - P_2| between the two points is calculated, which represents the pixel length corresponding to the 5cm physical distance. The pixel-to-physical scale conversion factor can then be calculated.
[0127] Because ultrasound images may contain multiple hypoechoic regions (such as intestinal gas, artifacts, or other nonspecific dark areas), the binary mask output by the segmentation network may contain multiple independent connected components. Therefore, it is necessary to identify the main region most likely representing the actual pleural effusion. In one possible implementation, step S240 may include: S241: Perform connected component marking on the binary mask to obtain multiple independent connected regions.
[0128] S242: For each connected region, calculate the height of its minimum bounding rectangle, which is used as the longitudinal extension length of the connected region.
[0129] S243: Select the connected region with the longest longitudinal extension as the target liquid accumulation region.
[0130] Connectivity analysis is performed on the thresholded binary mask using four-neighbor or eight-neighbor connectivity criteria. Each maximum connected set composed of foreground pixels is assigned a unique label, forming multiple independent connected regions R_1, R_2, ..., R_n.
[0131] For each connected region, calculate its minimum area bounding rectangle or axial bounding box, and take its height h_k in the vertical direction of the image as the "vertical extension length".
[0132] Compare all h_k values and select the connected region with the largest vertical extension length as the final target liquid accumulation region.
[0133] Furthermore, this embodiment of the invention also provides a training method for a pleural effusion grading model, wherein the references are... Figure 6 The method includes: S310: Obtain the training sample set; wherein each training sample includes an ultrasound image of pleural effusion and a ground truth mask of the pleural effusion region.
[0134] S320: Input the ultrasound image of pleural effusion into the pleural effusion grading model to be trained, and perform the forward propagation process according to the pleural effusion grading method to obtain the predicted effusion binary mask.
[0135] S330: Based on the preset composite loss function, the loss information is calculated according to the predicted effusion binary mask and the true value mask of the pleural effusion area.
[0136] S340: Based on the loss information, optimize the parameters of the pleural effusion grading model to be trained using the backpropagation algorithm.
[0137] First, a high-quality dataset of labeled ultrasound images of pleural effusion is constructed as the training sample set. Each training sample consists of two parts: input data: a two-dimensional ultrasound image of pleural effusion; and label data: a ground truth mask of the corresponding pleural effusion region. Optionally, the training sample set is divided into a training set (70%), a validation set (15%), and an independent test set (15%).
[0138] The preprocessed ultrasound images of pleural effusion are input into the pleural effusion grading model to be trained, and the complete forward propagation process is performed to obtain the predicted output.
[0139] To optimize model performance more comprehensively, this embodiment uses a preset composite loss function that takes into account pixel-level classification error, region overlap rate, and false positive / false negative balance.
[0140] The composite loss function is defined as a weighted sum of three terms:
[0141] in: We use binary cross-entropy loss to focus on pixel-level classification accuracy.
[0142] The Soft-Dice loss measures the degree of regional overlap between the predicted mask and the ground truth.
[0143] The Tversky loss is an adjustable parameter to control the relative weights of false positives and false negatives.
[0144] The initial hyperparameters are And fine-tune it on the validation set.
[0145] The specific forms of each sub-loss item are as follows:
[0146] in, The true pixel value. This corresponds to the predicted probability.
[0147]
[0148] in, To smooth out terms and prevent the denominator from being zero.
[0149]
[0150] Tversky loss emphasizes reducing the false negative rate (i.e., avoiding missed detection of fluid accumulation areas) and is applicable to medical diagnostic tasks.
[0151] Based on the calculated total loss, the backpropagation algorithm is used to calculate the gradient of the loss with respect to the parameters of each layer of the model, and the optimizer is used to update the network weights to minimize the loss function.
[0152] In summary, the pleural effusion grading model training method, pleural effusion grading method, and electronic device provided in this invention achieve end-to-end intelligent analysis from ultrasound image input to clinical grading output. It improves segmentation accuracy through spatial coordinate enhancement and an improved U-Net architecture; enhances model robustness through multi-scale perception and attention mechanisms; achieves cross-device universal automatic scale recognition using template matching; and combines medical prior knowledge to guide connected component selection and depth calculation. These technologies work synergistically to address the core pain points of existing methods, such as "heavy segmentation, lightweight approach," "reliance on manual reading," and "poor generalization ability," significantly improving the objectivity, repeatability, and clinical applicability of pleural effusion assessment.
[0153] In the embodiments provided by this invention, it should be understood that the disclosed apparatus and methods can also be implemented in other ways. The apparatus embodiments described above are merely illustrative; for example, the flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code, which contains one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than those marked in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram and / or flowchart, and combinations of blocks in block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.
[0154] In addition, the functional modules in the various embodiments of the present invention can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part.
[0155] If the functionality is implemented as a software module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a computer-readable storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0156] The above are merely preferred embodiments of the present invention and are not intended to limit the present invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
[0157] It will be apparent to those skilled in the art that the present invention is not limited to the details of the exemplary embodiments described above, and that the invention can be implemented in other specific forms without departing from its spirit or essential characteristics. Therefore, the embodiments should be considered in all respects as exemplary and non-limiting, and the scope of the invention is defined by the appended claims rather than the foregoing description. Thus, all variations falling within the meaning and scope of equivalents of the claims are intended to be included within the present invention. No reference numerals in the claims should be construed as limiting the scope of the claims.
Claims
1. A method for grading pleural effusion, characterized in that, include: Acquire ultrasound images of pleural effusion; The ultrasound image of the pleural effusion is input into a pre-trained pleural effusion grading model to obtain a binary mask of the effusion. Template matching is performed on the ultrasound image of the pleural effusion to identify at least two reference scale marks with a known physical distance on the scale in the image, and the pixel coordinates of each reference scale mark in the image are determined. Perform connected component analysis on the binary mask and extract the connected component with the largest longitudinal extension length as the target liquid accumulation region; Calculate the maximum pixel length of the target fluid accumulation region along the vertical axis of the image; The physical depth of pleural effusion is calculated based on the physical spacing, the two pixel coordinates, and the maximum pixel length. Pleural effusion is clinically graded based on the physical depth described.
2. The method according to claim 1, characterized in that, The pleural effusion grading model includes a spatial coordinate enhancement module, a convolutional backbone module, an encoder module, a multi-scale context-aware module, a decoder module, and an output module; the step of inputting the pleural effusion ultrasound image into the pre-trained pleural effusion grading model to obtain a binary mask for the effusion includes: The ultrasound image of the pleural effusion is input into the spatial coordinate enhancement module, and the horizontal and vertical coordinate channels are stitched on the ultrasound image to obtain a three-channel input tensor containing prior location information. The three-channel input tensor is input into the convolutional backbone module for preliminary feature extraction to obtain an initial feature map. The initial feature map is input into the encoder module, and after multi-level coding blocks, feature abstraction and spatial downsampling are performed. The feature map output by each level is saved as the corresponding skip connection feature, and finally the bottleneck feature is output. The bottleneck features are input into the multi-scale context awareness module, which captures multi-scale context information through parallel dilated convolution and global pooling operations, and outputs context-enhanced features. The context enhancement features are input into the decoder module, and the spatial resolution is gradually restored through multi-level upsampling. After each level of upsampling, the attention gate mechanism is used to adaptively weight and fuse the skip connection features from the corresponding level of the encoder to obtain the boundary-refined decoding features. The decoded features are input into the output module, and the liquid accumulation binary mask is generated through convolution mapping and activation.
3. The method according to claim 2, characterized in that, The process involves inputting the ultrasound image of the pleural effusion into the spatial coordinate enhancement module, and stitching the horizontal and vertical coordinate channels onto the ultrasound image to obtain a three-channel input tensor containing prior location information, including: The ultrasound image of the pleural effusion was normalized to obtain a normalized grayscale image; Construct a row index matrix and a column index matrix with the same size as the ultrasound image of the pleural effusion; wherein each element in the row index matrix and the column index matrix represents the ordinate and abscissa of the corresponding pixel in the ultrasound image of the pleural effusion, respectively; Normalize the row index matrix and the column index matrix respectively to obtain the ordinate channel and the abscissa channel; The grayscale image, the vertical axis channel, and the horizontal axis channel are concatenated along the channel dimension to obtain a three-channel input tensor.
4. The method according to claim 2, characterized in that, The initial feature map is input into the encoder module, and after feature abstraction and spatial downsampling through multiple levels of coding blocks, the feature map output from each level is saved as the corresponding skip connection feature, and the final output bottleneck feature includes: The initial feature map is input into an encoder module consisting of multiple sequentially connected coding blocks; For each coding block in the encoder module, an input feature map from the previous coding block is received; The input feature map is fed into a residual unit, and two 3×3 convolution operations are performed. After each convolution, a GELU activation function is applied. The output after the second convolution activation is added element-wise to the input feature map; The summation result is activated by GELU, the residual feature of the coding block is output, and the residual feature is saved as the skip connection feature of the corresponding level; The residual features are processed through a downsampling convolutional layer to reduce their spatial resolution and increase their number of channels, and the output is used as the input feature map for the next coding block. The feature map output by the last coding block is the bottleneck feature.
5. The method according to claim 2, characterized in that, The bottleneck features are input into the multi-scale context-aware module, which captures multi-scale context information through parallel dilated convolution and global pooling operations, and outputs context-enhanced features, including: The bottleneck features are input into five parallel branches respectively, and the outputs of the five parallel branches are concatenated in the channel dimension to obtain multi-scale fusion features; wherein, the five parallel branches include a 1×1 convolution branch, a 3×3 dilated convolution branch with an inflation rate of 2, a 3×3 dilated convolution branch with an inflation rate of 4, a 3×3 dilated convolution branch with an inflation rate of 8, and a global average pooling branch. Global average pooling is performed on the multi-scale fusion features to compress the spatial information of each channel into a scalar, resulting in a channel-level statistical description vector; The description vector is input into a gated network consisting of two fully connected layers, and a weight vector representing the importance of each channel is generated by passing the Sigmoid activation function. The weight vector is multiplied element-wise with the multi-scale fusion feature to obtain the context-enhanced feature.
6. The method according to claim 2, characterized in that, The decoder module includes multi-level decoding blocks. The context enhancement features are input into the decoder module, and spatial resolution is gradually restored through multi-level upsampling. After each upsampling level, an attention gate mechanism is used to adaptively weight and fuse the skip connection features from the corresponding level of the encoder to obtain boundary-refined decoding features, including: For each level of the decoding block, the decoding features input to that level are upsampled to obtain upsampled features; Linear transformations are performed on the upsampled features and the skip connection features of the corresponding level of the encoder, respectively, and the transformation results are added together to obtain the gated fusion features; The gated fusion features are processed by an activation function, then by convolution and a sigmoid activation function to generate a spatial attention map. The skip connection features are spatially weighted using the spatial attention map to obtain weighted skip connection features. The upsampled features and the weighted skip connection features are concatenated along the channel dimension, and at least one convolution operation is performed on the concatenated features to output the decoding features of the decoding block at this level. The input to the first-level decoding operation is the context enhancement feature, and the output of the last-level decoding operation is the boundary-refined decoding feature.
7. The method according to claim 1, characterized in that, The step of performing template matching on the ultrasound image of the pleural effusion, identifying at least two reference scale marks with a known physical distance on the scale in the image, and determining the pixel coordinates of each reference scale mark in the image includes: Obtain a preset reference scale mark template image; the reference scale mark template image contains at least two scale marks with a known physical distance; The template matching algorithm is used to search for regions in the ultrasound image of the pleural effusion that match the reference scale marker template image. The pixel coordinates of each of the reference scale marks in the ultrasound image of the pleural effusion are determined based on the matching results.
8. The method according to claim 1, characterized in that, The process of performing connected component analysis on the binary mask and extracting the connected component with the largest vertical extension length as the target liquid accumulation region includes: Connectivity component marking is performed on the binary mask to obtain multiple independent connected regions; For each connected region, calculate the height of its minimum bounding rectangle, which is used as the longitudinal extension length of the connected region; The connected region with the longest longitudinal extension is selected as the target liquid accumulation region.
9. A training method for a pleural effusion grading model, characterized in that, include: Obtain a training sample set; where each training sample includes an ultrasound image of pleural effusion and a ground truth mask of the pleural effusion region; The ultrasound image of the pleural effusion is input into the pleural effusion grading model to be trained, and a forward propagation process is performed according to the pleural effusion grading method according to any one of claims 1 to 8 to obtain a binary mask for predicting effusion. Based on a preset composite loss function, loss information is calculated according to the predicted effusion binary mask and the true value mask of the pleural effusion region; Based on the loss information, the parameters of the pleural effusion grading model to be trained are optimized using the backpropagation algorithm.
10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that, When the processor executes the computer program, it implements the method according to any one of claims 1 to 9.