A machine learning-based image segmentation and annotation method and system

Through a machine learning-based image segmentation method, combined with data preprocessing, deep learning and dynamic geometric feature analysis, the problems of boundary offset and inaccurate lesion detection in lung CT image segmentation were solved, fast and accurate lesion labeling was achieved, and the efficiency and accuracy of medical image analysis were improved.

CN120339733BActive Publication Date: 2025-09-05SHANGHAI XIAOLING NETWORK TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510815142.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-06-18
Publication Date
2025-09-05
Estimated Expiration
2045-06-18

AI Technical Summary

Technical Problem

Existing technologies in lung CT image segmentation have problems such as boundary offset, over-segmentation or under-segmentation, and inaccurate lesion detection. In particular, it is difficult to meet medical anatomical standards in areas with complex boundaries and overlapping lesions, and traditional methods are time-consuming and labor-intensive.

Method used

Accurate lesion annotations are generated through machine learning-based image segmentation methods, including data preprocessing, deep learning segmentation, dynamic geometric feature analysis, and boundary correction.

Benefits of technology

It achieves fast and accurate lung lesion segmentation and labeling, reduces doctors' workload, and improves segmentation efficiency and accuracy, especially in the processing of complex boundaries and overlapping lesion areas.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120339733B_ABST
    Figure CN120339733B_ABST
Patent Text Reader

Abstract

The present invention provides a machine learning-based image segmentation and annotation method and system, which relates to the field of computer vision technology. The method includes: dynamically selecting three detection points in a key area of ​​the segmentation boundary based on the boundary morphology of the initial segmentation result to construct a dynamic triangular mesh unit; calculating geometric eigenvalues ​​based on the vertex coordinates of the dynamic triangular mesh unit, wherein the geometric eigenvalues ​​include the proportional relationship between the area and the side length of the triangular mesh unit; comparing the geometric eigenvalues ​​with a preset threshold range, and generating boundary coordinate correction parameters if the threshold range is exceeded; adjusting the boundary coordinates of the lung region segmentation result based on the correction parameters to generate a corrected lung region segmentation result. The present invention reduces the workload of doctors through end-to-end operations from image acquisition to lesion annotation. Based on the segmentation results, the lesion annotation unit can accurately locate the lesion position.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer vision technology, and in particular to an image segmentation and annotation method and system based on machine learning. Background Art

[0002] In the field of medical imaging diagnosis, accurate segmentation and lesion labeling of lung CT images are crucial for early screening of lung cancer, preoperative planning, and efficacy evaluation. However, the traditional method of manually outlining boundaries and labeling lesions can be time-consuming and labor-intensive, and the processing time for a single CT image is long, which may not meet the efficiency requirements of large-scale screening.

[0003] With the development of deep learning, models such as U-Net and DeepLab have achieved automated lung contour extraction, reducing segmentation time to seconds. However, existing technologies may still have many problems: complex boundaries such as interlobar fissures and diaphragmatic attachments may cause segmentation model boundary offsets due to low CT image contrast, noise interference or anatomical structure variations, resulting in over-segmentation or under-segmentation rates exceeding 15%, which may affect the integrity of lesion detection; some existing models rely on data-driven learning and may not incorporate geometric priors of normal lung anatomical structures such as lobe edge smoothness, area and aspect ratio. The boundary processing of overlapping areas of lesions such as nodule adhesions to the pleura may deviate from medical common sense, and the segmentation results may not meet clinical anatomical standards; traditional manual lesion detection sometimes has a high missed diagnosis rate, especially for tiny nodules smaller than 5mm. Automated labeling based on rule engines or single deep learning models may lack multimodal fusion of texture, morphology and density features, resulting in an error rate of over 10% in the classification of ambiguous lesions such as inflammation and ground-glass nodules, resulting in an imbalance between efficiency and accuracy. Summary of the Invention

[0004] The technical problem to be solved by the present invention is to provide an image segmentation and annotation method and system based on machine learning. Through end-to-end operations from image acquisition to lesion annotation, the workload of doctors is reduced. Based on the segmentation results, the lesion annotation unit can accurately locate the lesion position.

[0005] In order to solve the above technical problems, the technical solutions of the present invention are as follows:

[0006] In a first aspect, a method for image segmentation and annotation based on machine learning is provided, the method comprising:

[0007] Step S1: Acquire lung CT image data;

[0008] Step S2: preprocessing the lung CT image data to generate an optimized CT image;

[0009] Step S3: Input the optimized CT image into the image segmentation model, and output the initial segmentation result including the coordinates of the lung tissue boundary;

[0010] Step S4: Based on the boundary morphology of the initial segmentation result, three detection points are dynamically selected in the key area of ​​the segmentation boundary to construct a dynamic triangular mesh unit; geometric feature values ​​are calculated based on the vertex coordinates of the dynamic triangular mesh unit, and the geometric feature values ​​include the proportional relationship between the area and the side length of the triangular mesh unit;

[0011] Step S5: Comparing the geometric eigenvalue with a preset dynamic threshold range; when the geometric eigenvalue exceeds the upper threshold limit, calculating the excess amount and converting it into an inward contraction offset according to a preset proportional coefficient; when the geometric eigenvalue is lower than the lower threshold limit, calculating the deficiency amount and converting it into an outward expansion offset according to a preset proportional coefficient; generating boundary coordinate correction parameters in the corresponding direction based on the above-mentioned offset; adjusting the boundary coordinates of the lung region segmentation result according to the correction parameters, and generating a corrected lung region segmentation result;

[0012] Step S6: perform lesion labeling on the corrected lung region segmentation result to generate a final lung image with lesion type labels.

[0013] Furthermore, step S1: obtaining lung CT image data includes:

[0014] Obtaining original lung CT scan data transmitted from medical imaging equipment;

[0015] The original lung CT scan data is parsed and processed to generate lung CT image data in a standard format.

[0016] Furthermore, step S2: preprocessing the lung CT image data to generate an optimized CT image includes:

[0017] Perform noise suppression on lung CT image data to generate a noise-reduced intermediate image;

[0018] The noise-reduced intermediate image is subjected to contrast enhancement processing to generate an optimized CT image.

[0019] Furthermore, step S3: inputting the optimized CT image into the image segmentation model, outputting the initial segmentation result including the coordinates of the lung tissue boundary, including:

[0020] The optimized CT images are encoded with multi-scale features using a pre-trained deep learning segmentation model's feature extraction path to generate a hierarchical feature map. The feature extraction path comprises multiple serially connected feature extraction stages, each of which includes at least one convolutional layer and one downsampling layer. Through the stage-by-stage downsampling operation, a multi-scale hierarchical feature map with decreasing spatial resolution and increasing semantic information is generated.

[0021] Decoding and fusing the multi-scale hierarchical feature maps through a feature reconstruction path of an image segmentation model, wherein the feature reconstruction path comprises multiple serial reconstruction stages, each of which performs upsampling and cross-path feature fusion operations, generating an initial segmentation probability map of the lung tissue through stage-by-stage processing;

[0022] Binarize the initial segmentation probability map to obtain a binary mask image of the lung tissue;

[0023] A contour extraction algorithm is performed on the binary mask image to identify and obtain a sequence of boundary pixel coordinates of the lung tissue, thereby forming an initial segmentation result containing the boundary coordinates of the lung tissue.

[0024] Furthermore, step S4: based on the boundary shape of the initial segmentation result, three detection points are dynamically selected in the key area of ​​the segmentation boundary to construct a dynamic triangular mesh unit; and geometric characteristic values ​​are calculated according to the vertex coordinates of the dynamic triangular mesh unit, wherein the geometric characteristic values ​​include the proportional relationship between the area and the side length of the triangular mesh unit, including:

[0025] Based on the boundary coordinate sequence of the initial segmentation result, key areas within the lung tissue boundary that meet any of the following conditions are identified: suspected lesion areas where the curvature change rate exceeds a preset threshold; fuzzy boundary areas where the difference in grayscale gradient values ​​between adjacent boundary points is lower than a preset threshold; within the key area, three non-collinear detection points are dynamically selected according to the principle of spatial spacing uniformity. The spatial spacing uniformity principle requires that the detection points are evenly distributed within the boundary point sequence of the key area, so that the spatial distances between points are equal and non-collinearity is satisfied.

[0026] Connect the three detection points in spatial adjacent order to construct a dynamic triangular mesh unit, where the coordinates of each vertex are derived from the pixel position of the boundary coordinate sequence;

[0027] Calculate the ratio of the area of ​​a dynamic triangle mesh unit to its longest side length as the geometric eigenvalue.

[0028] Furthermore, the boundary coordinates of the lung region segmentation result are adjusted according to the correction parameters to generate a corrected lung region segmentation result, including:

[0029] Based on the correction parameters, the boundary coordinates of the initial segmentation result are locally translated or shrunk to generate a corrected lung region segmentation result.

[0030] Furthermore, step S6: lesion labeling is performed on the corrected lung region segmentation result to generate a final lung image with lesion type labels, including:

[0031] Based on the corrected lung region segmentation results, all connected domains are extracted as candidate lesion regions;

[0032] Perform bimodal feature analysis on each candidate lesion region, including morphological and imaging features. Based on the pre-trained lesion classification model, the candidate regions are divided into three categories: nodule region, tumor region, and inflammation region, and a lesion region location dataset with spatial coordinates is output.

[0033] Each region in the lesion region location dataset is encoded with a type tag and structured labels are generated. The lesion type label is added to the DICOM image header file, and a text annotation layer containing lesion type statistical information is superimposed in the lower right corner of the image. Finally, the label information is fused with the original CT image to generate a final lung image with lesion type labels.

[0034] In the second aspect, an image segmentation and annotation system based on machine learning includes:

[0035] An acquisition module, used for acquiring lung CT image data;

[0036] A preprocessing module is used to preprocess lung CT image data and generate optimized CT images;

[0037] A segmentation processing module is used to input the optimized CT image into the image segmentation model and output an initial segmentation result including the coordinates of the lung tissue boundary;

[0038] A calculation module is configured to dynamically select three detection points in a key region of the segmentation boundary based on the boundary shape of the initial segmentation result to construct a dynamic triangular mesh unit; and calculate geometric eigenvalues ​​based on vertex coordinates of the dynamic triangular mesh unit, wherein the geometric eigenvalues ​​include a proportional relationship between the area and the side length of the triangular mesh unit;

[0039] A correction module is configured to compare the geometric eigenvalue with a preset dynamic threshold range. When the geometric eigenvalue exceeds the upper threshold limit, the excess is calculated and converted into an inward contraction offset according to a preset proportional coefficient. When the geometric eigenvalue is below the lower threshold limit, the deficiency is calculated and converted into an outward expansion offset according to a preset proportional coefficient. Based on the above-mentioned offset, a boundary coordinate correction parameter in the corresponding direction is generated; the boundary coordinates of the lung region segmentation result are adjusted according to the correction parameter to generate a corrected lung region segmentation result.

[0040] The labeling module is used to label the lesions of the corrected lung area segmentation results and generate a final lung image with lesion type labels.

[0041] According to a third aspect, a computing device includes:

[0042] one or more processors;

[0043] The storage device is used to store one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors implement the method.

[0044] In a fourth aspect, a computer-readable storage medium stores a program, which implements the method when executed by a processor.

[0045] The above solution of the present invention includes at least the following beneficial effects:

[0046] The efficiency and accuracy of medical image analysis are improved through the whole process of standardized data acquisition, preprocessing optimization, deep learning automated segmentation, dynamic geometric feature analysis, intelligent boundary correction and automated lesion labeling: unified data analysis and format eliminate the barriers of equipment differences, and noise suppression and contrast enhancement lay the foundation for accurate segmentation; deep learning achieves fast segmentation and captures multi-scale features, dynamic geometric analysis focuses on key areas with blurred boundaries, and the boundary correction mechanism combined with medical prior thresholds reduces segmentation errors and effectively corrects over-segmentation or under-segmentation problems; automated labeling reduces manual labeling time, and balances efficiency and accuracy through model initial screening and manual review, thereby improving the detection rate of minimal lesions. BRIEF DESCRIPTION OF THE DRAWINGS

[0047] Figure 1 This is a flowchart of an image segmentation and annotation method based on machine learning provided by an embodiment of the present invention.

[0048] Figure 2 This is a schematic diagram of an image segmentation and annotation system based on machine learning provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0049] Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although exemplary embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure may be implemented in various forms and should not be limited by the embodiments set forth herein. Rather, these embodiments are provided to enable a more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.

[0050] like Figure 1 As shown, an embodiment of the present invention proposes an image segmentation and annotation method based on machine learning, the method comprising the following steps:

[0051] Step S1: Acquire lung CT image data;

[0052] Step S2: preprocessing the lung CT image data to generate an optimized CT image;

[0053] Step S3: Input the optimized CT image into the image segmentation model, and output the initial segmentation result including the coordinates of the lung tissue boundary;

[0054] Step S4: Based on the boundary morphology of the initial segmentation result, three detection points are dynamically selected in the key area of ​​the segmentation boundary to construct a dynamic triangular mesh unit; geometric feature values ​​are calculated based on the vertex coordinates of the dynamic triangular mesh unit, and the geometric feature values ​​include the proportional relationship between the area and the side length of the triangular mesh unit;

[0055] Step S5: Comparing the geometric eigenvalue with a preset dynamic threshold range; when the geometric eigenvalue exceeds the upper threshold limit, calculating the excess amount and converting it into an inward contraction offset according to a preset proportional coefficient; when the geometric eigenvalue is lower than the lower threshold limit, calculating the deficiency amount and converting it into an outward expansion offset according to a preset proportional coefficient; generating boundary coordinate correction parameters in the corresponding direction based on the above-mentioned offset; adjusting the boundary coordinates of the lung region segmentation result according to the correction parameters, and generating a corrected lung region segmentation result;

[0056] Step S6: perform lesion labeling on the corrected lung region segmentation result to generate a final lung image with lesion type labels.

[0057] In an embodiment of the present invention, the original lung CT image data is denoised and contrast enhanced through preprocessing, thereby effectively suppressing equipment noise and respiratory artifacts, improving the grayscale contrast between lung tissue and lesion areas, enhancing the ability to identify tiny lesions in low-contrast images, and reducing the risk of missed labels; with the help of a dynamic geometric feature correction mechanism, dynamic detection points are set in key areas of the segmentation boundary to construct triangular mesh units, and by calculating the geometric feature values ​​of the area and side length ratio and comparing them with preset thresholds, intelligent correction of fuzzy and adhered lesion boundaries is achieved, solving the problem of adhesion or fracture in traditional model segmentation; the entire process is automated, from image acquisition to lesion annotation, end-to-end operations are processed to reduce the workload of doctors; based on the high-precision segmentation results, the lesion annotation unit can accurately locate the lesion position.

[0058] In a preferred embodiment of the present invention, the above step S1: acquiring lung CT image data may include:

[0059] Step S11, acquiring original lung CT scan data transmitted from a medical imaging device;

[0060] Step S12: performing data analysis on the original lung CT scan data to generate lung CT image data in a standard format.

[0061] In this embodiment of the present invention, raw data transmitted by medical imaging devices is acquired to ensure the authority and integrity of the data source, while also being compatible with different device output formats to avoid data transmission loss or damage. Through data parsing and processing, the raw data is converted into a standard format, breaking down data barriers between devices, enabling efficient cross-platform interaction, and improving data flow efficiency. Furthermore, standardization unifies image parameters such as pixel spacing and grayscale value range, eliminating data deviations caused by device differences and helping the algorithm focus on lung tissue characteristics, improving segmentation accuracy and analytical accuracy.

[0062] In the embodiments of the present invention, when applied specifically, it can be achieved through the following technical solutions, for example:

[0063] In the above step S11, a network connection is established with devices such as a CT scanner and a PACS (Picture Archiving and Communication System) via the DICOM (Digital Imaging and Communications in Medicine) protocol, and data transmission requests are monitored in real time.

[0064] Receives raw scan data in DICOM standard format, including image pixel matrix, patient information, and scan parameters (slice thickness, window width and window position, etc.). During the process, data integrity is automatically verified, such as checking the file header identifier and data block checksum to ensure no packet loss or byte errors.

[0065] If multiple sequence scan data such as plain scan and enhanced scan are received simultaneously, sequence matching is performed based on metadata such as timestamp and examination number to ensure accurate association of multiple sets of data from the same patient.

[0066] In the above-mentioned step S12, the pixel data field in the DICOM file is parsed, and the original grayscale value with a depth of 12 or 16 bits is converted into a standard floating-point value (such as a normalized value in the range of 0-1), and spatial parameters such as image size (number of rows and columns) and inter-slice spacing are extracted at the same time; according to the image positioning matrix (ImagePositionPatient, ImageOrientationPatient) in the DICOM header file, the spatial coordinates of each slice are uniformly converted into standardized coordinates based on the patient's body coordinate system to ensure the spatial position accuracy during multi-slice three-dimensional reconstruction; the decoded pixel data and standardized metadata are encapsulated into a standard format recognizable by the system (such as NIfTI, NPY or pre-processed PNG sequence), and indexed and stored according to the patient ID and examination time to facilitate subsequent batch calls.

[0067] In a preferred embodiment of the present invention, the above step S2: preprocessing the lung CT image data to generate an optimized CT image may include:

[0068] Step S21, performing noise suppression processing on the lung CT image data to generate a noise-reduced intermediate image;

[0069] Step S22: performing contrast enhancement processing on the intermediate image after noise reduction to generate an optimized CT image.

[0070] In an embodiment of the present invention, noise suppression processing is used to effectively eliminate scanning equipment noise and patient respiratory motion artifacts, construct a pure image base, make the edges of fine structures such as lung blood vessels and nodules clearer, and avoid boundary misjudgment caused by noise; at the same time, with the help of adaptive filtering algorithm selection and parameter adjustment, the edge gradient information of the lung parenchyma and the lesion area is retained to the maximum extent during the noise reduction process; through local contrast enhancement processing, the edges and internal textures of low-contrast lesions such as ground glass nodules and interlobular septal thickening are made explicit.

[0071] In the embodiments of the present invention, when applied specifically, it can be achieved through the following technical solutions, for example:

[0072] In step S21 , the noise type (such as Gaussian noise, salt and pepper noise, electronic noise, etc.) is automatically determined by analyzing the local grayscale fluctuation characteristics of the image (such as the grayscale difference between adjacent pixels and the regional variance).

[0073] If salt and pepper noise is detected, a median filter algorithm is used to define a 3×3 or 5×5 rectangular neighborhood centered on the current pixel. The current pixel value is replaced with the median grayscale value of the pixels in the neighborhood, eliminating isolated noise points while preserving edge details. If Gaussian noise is present, Gaussian filtering or bilateral filtering is selected. The filter kernel size and weight distribution are dynamically adjusted according to the noise standard deviation, and the grayscale of the neighborhood pixels is weighted averaged to suppress high-frequency noise while avoiding excessive blurring of tissue boundaries. For quantum noise common in CT images, non-local mean filtering (NLM) can be combined to search for similar local blocks in the image and perform weighted averaging to achieve noise attenuation on a global scale.

[0074] The filtered image is subjected to secondary detection to compare the noise power spectral density or peak signal-to-noise ratio (PSNR) before and after preprocessing to ensure that the noise level is reduced to below the preset threshold.

[0075] In step S22, based on a preliminary lung segmentation mask (which can be obtained through simple threshold segmentation or morphological operations), the lung parenchyma area is automatically identified to eliminate interference from background tissues such as the chest wall and bones in contrast calculation. The grayscale distribution of the lung parenchyma area is adjusted using a histogram equalization (HE) or a CLAHE algorithm. CLAHE divides the image into multiple sub-blocks and performs local histogram equalization on each sub-block to avoid the over-enhancement noise problem that occurs at the junction of the lung field (low grayscale area) and the mediastinum (high grayscale area) in traditional global equalization. In combination with the window width and window position characteristics of the CT image, the grayscale values ​​within the lung window range are mapped to a display range of 0-255 through a grayscale linear transformation function (such as piecewise linear stretching), thereby highlighting the grayscale difference between lung lesions (such as nodules and infiltration foci) and normal lung tissue.

[0076] Calculate the contrast index (such as the mean grayscale difference between adjacent regions) or the structural similarity index (SSIM) of the enhanced image to ensure that the grayscale contrast of subtle lesions in the lungs (such as ground-glass opacity) is improved by more than 30% compared with the original image.

[0077] In a preferred embodiment of the present invention, the above step S3: inputting the optimized CT image into the image segmentation model and outputting the initial segmentation result including the coordinates of the lung tissue boundary may include:

[0078] Step S31: Perform multi-scale feature encoding on the optimized CT image through a feature extraction path of a pre-trained deep learning segmentation model to generate a hierarchical feature map; wherein the feature extraction path comprises multiple serial feature extraction stages, each stage comprising at least one convolutional layer and one downsampling layer; through the stage-by-stage downsampling operation, a multi-scale hierarchical feature map with decreasing spatial resolution and increasing semantic information is generated;

[0079] Step S32: decoding and fusing the multi-scale hierarchical feature maps through a feature reconstruction path of an image segmentation model, wherein the feature reconstruction path comprises a plurality of serially connected reconstruction stages, each of which performs an upsampling operation and a cross-path feature fusion operation, and generates an initial segmentation probability map of the lung tissue through stage-by-stage processing;

[0080] Step S33, performing binarization processing on the initial segmentation probability map to obtain a binary mask image of the lung tissue;

[0081] Step S34 , executing a contour extraction algorithm on the binary mask image, identifying and acquiring a sequence of boundary pixel coordinates of the lung tissue, and forming an initial segmentation result including the boundary coordinates of the lung tissue.

[0082] In an embodiment of the present invention, through the multi-stage convolution and downsampling operations of the pre-trained deep learning model, the feature expression ability can be enhanced and the semantic information integrity can be improved, so that the model can take into account the detailed texture and overall contour of the lung tissue, and reduce the segmentation error caused by semantic confusion; in the decoding fusion stage, upsampling and cross-path feature fusion are used to accurately restore spatial details and optimize the quality of the segmentation probability map, ensuring that the boundary segmentation is more in line with the actual situation; binarization and contour extraction further simplify the results, accurately obtain boundary coordinates, and output structured data for clinical applications.

[0083] In the embodiments of the present invention, when applied specifically, it can be achieved through the following technical solutions, for example:

[0084] In step S31 above, the deep learning image segmentation model is constructed based on the encoder-decoder architecture, combining multi-scale feature fusion and pre-training transfer learning strategy:

[0085] Using backbone networks such as ResNet or UNet++, convolutional layers are used to gradually extract multi-scale features from shallow to deep layers. The decoder path (feature reconstruction) uses deconvolution and skip connections to fuse deep semantic features with shallow detail features, gradually restore spatial resolution, and generate the final segmentation map. Pre-training strategy: The model weights are pre-trained on public medical imaging datasets (such as LIDC-IDRI), and then fine-tuned for specific tasks (such as lung boundary segmentation) to improve the model's generalization ability.

[0086] The optimized CT images (usually 512×512×N layers) are uniformly resized to the model input size (e.g., 512×512) to ensure consistency with the training data format.

[0087] The CT value (HU) is mapped to the range of 0-1 to eliminate the differences in scanning parameters between different devices; for example, the lung region of interest (usually -1000~+1000HU) is linearly scaled to the interval of 0-1; bones (greater than 400HU) and air (less than -1000HU) that are out of range are clipped to fixed values.

[0088] Shallow feature extraction (first convolution layer) uses a 3×3 convolution kernel to scan the input image and extract underlying features such as edges and textures. The generated feature map retains high resolution (512×512) and contains detailed information such as the lung wall contour and large blood vessels.

[0089] Mid-level feature encoding (middle convolutional layer) gradually extracts mid-level structural features such as the lung lobe interface and segmental bronchus through multiple sets of convolution-BN-ReLU modules; a 2×2 maximum pooling layer is used to reduce the resolution (e.g., 512→256→128) to expand the receptive field and capture regional-level structural relationships.

[0090] Deep semantic coding (ResNet residual block / Transformer) uses residual connections or attention mechanisms to extract high-level features such as the overall morphology of the lung parenchyma and the semantic differences between lesions and normal tissues, generating low-resolution (e.g., 32×32) but high-semantic feature maps that contain global information about the overall lung contour and lesion location.

[0091] The feature maps of different levels (such as shallow 512×512, middle 128×128, deep 32×32) are stored in descending order of spatial resolution; each layer of feature map retains unique semantic information: the shallow layer focuses on details, and the deep layer focuses on the overall picture.

[0092] In step S32, starting from the deep low-resolution feature map, upsampling is performed (e.g., from 32×32 to 64×64) through deconvolution (e.g., transposed convolution) or interpolation (e.g., bilinear interpolation). In each upsampling step, the encoder features and decoder features of the same scale are fused through skip connections (SkipConnection); for example, the upsampled 128×128 feature map of the decoder is added element-by-element to the 128×128 feature map of the corresponding level of the encoder to preserve edge details.

[0093] The fused feature map contains both high-level semantic information (such as the overall judgment of the "lung area") and low-level detail information (such as the precise location of the tissue edge) to ensure the accuracy of the segmentation boundary; the fused feature map is mapped into a binary probability map (lung tissue / background) through a 1×1 convolution layer; the output value is compressed to the range of 0-1 using the Sigmoid activation function, and each pixel value represents the probability of belonging to lung tissue; a special boundary loss function (such as BoundaryLoss) or attention mechanism (such as the edge attention module) is introduced to enhance the model's sensitivity to boundary areas and optimize boundary segmentation accuracy.

[0094] In step S33, a threshold is selected based on the characteristics of the probability heat map. A fixed threshold method (e.g., 0.5) or an adaptive threshold method (e.g., determining the optimal threshold by maximizing the inter-class variance through the Otsu algorithm, or adapting to regional contrast differences through a local threshold method using block calculation) can be used. Each pixel value is compared with the threshold. Pixels greater than or equal to the threshold are determined to be lung tissue (assigned a value of 1), and pixels less than the threshold are determined to be background (assigned a value of 0). GPU acceleration or multithreading is used to improve the processing efficiency of large-scale images. After pixel-level determination is completed, morphological post-processing is performed. An opening operation (erosion followed by expansion) is used to eliminate isolated noise points and separate adhered non-target areas. A closing operation (expansion followed by corrosion) is used to fill small holes and enhance lung tissue connectivity. Structural elements of small sizes such as 3×3 (to retain fine boundaries) or large sizes such as 5×5 (to handle significant noise) are selected based on the noise level.

[0095] After identifying all connected regions, only the largest area is retained as valid lung tissue, and residual noise areas with an area smaller than a preset threshold are eliminated. To optimize the boundary, Gaussian filtering can be performed on the probability map before binarization to reduce aliasing, and median filtering can be applied to the mask image after binarization to eliminate salt and pepper noise. Quality verification is also carried out to calculate the mask area and compare it with the expected range. Abnormalities trigger re-segmentation or manual intervention, detect the closure of the outer contour, and repair the breaks through morphological operations or interpolation algorithms. A multi-scale strategy of coarse segmentation combined with fine refinement is used to balance efficiency and accuracy, supplemented by the region growing method to optimize boundary fit from known areas such as the hilum of the lung. For specific clinical scenarios, extremely low-density areas of pneumothorax are separately marked, and the boundaries of pleural effusions are distinguished through grayscale morphology or edge detection. Finally, the binary mask is visualized through pseudo-color mapping for physician evaluation, and stored in standardized DICOM or NIFTI format and associated with the original CT image.

[0096] In step S34, the closed contour of the lung tissue in the binary image is identified by using a contour detection algorithm (such as Canny edge detection or contour extraction based on connected domains); pixel coordinates on the contour are extracted to generate an ordered sequence of boundary coordinates (such as (x1, y1), (x2, y2), ..., (x n ,y n )), forming an initial segmentation result containing the coordinates of the lung tissue boundary.

[0097] In a preferred embodiment of the present invention, step S4: based on the boundary morphology of the initial segmentation result, dynamically selecting three detection points in the key area of ​​the segmentation boundary to construct a dynamic triangular mesh unit; and calculating a geometric characteristic value based on the vertex coordinates of the dynamic triangular mesh unit, wherein the geometric characteristic value includes a proportional relationship between the area and the side length of the triangular mesh unit, and may include:

[0098] Step S41: Based on the boundary coordinate sequence of the initial segmentation result, identify key areas within the lung tissue boundary that meet any of the following conditions: suspected lesion areas where the curvature change rate exceeds a preset threshold; fuzzy boundary areas where the difference in grayscale gradient values ​​between adjacent boundary points is lower than a preset threshold; within the key area, dynamically select three non-collinear detection points based on the principle of spatial spacing uniformity. The spatial spacing uniformity principle requires that the detection points be evenly distributed within the boundary point sequence of the key area, so that the spatial distances between points are equal and non-collinearity is satisfied.

[0099] Step S42: Connect the three detection points in spatially adjacent order to construct a dynamic triangular mesh unit, where the coordinates of each vertex are derived from the pixel position of the boundary coordinate sequence;

[0100] Step S43 : Calculate the ratio of the area of ​​the dynamic triangular mesh unit to the longest side length as the geometric characteristic value.

[0101] In an embodiment of the present invention, the suspected lesion area and the fuzzy boundary area of ​​the lung boundary are dynamically identified by the curvature change rate and the grayscale gradient difference, and three non-collinear detection points are selected in the key area according to the principle of spatial interval uniformity. While accurately locating the local features of morphological abnormalities, the individual differences of the boundaries of different patients are adaptively adjusted. The detection points are connected in sequence to construct dynamic triangular mesh units, and the abstract boundary morphology is converted into a structured geometric model to quantitatively analyze features such as concavity and convexity and irregularity. Local modeling can reduce computational complexity compared to global contour analysis, and balance efficiency and accuracy. Furthermore, the ratio of the area of ​​the triangular mesh unit to the longest side length is calculated as the geometric feature value, which can sensitively reflect the abnormal boundary morphology.

[0102] In the embodiments of the present invention, when applied specifically, it can be achieved through the following technical solutions, for example:

[0103] In step S41, the curvature of the boundary pixels of the initial segmentation result is calculated, that is, the local curvature value is estimated by the angle between the normal vectors of adjacent points or the second-order derivative; areas with curvature values ​​exceeding a preset threshold (such as 1.5 times the standard deviation) are screened to locate areas where the boundary concavity and convexity change dramatically (such as the edge of a lobulated tumor); the gradient change rate of the boundary area is calculated based on the grayscale information of the CT image, and the lower the gradient value, the more blurred the boundary (such as the transition zone between inflammatory lesions and normal lung tissue); areas with grayscale gradient values ​​below a threshold (such as 50 HU / mm) are identified and marked as blurred boundary areas (such as the junction of ground-glass nodules and surrounding lung parenchyma).

[0104] In each key area, three non-collinear detection points are selected according to the following rules: point A is the point with maximum curvature (representing the most prominent feature of the boundary, such as the tip of a tumor lobe); point B is the boundary point farthest from point A (expanding the coverage of the triangular mesh unit); point C is the middle point between points A and B, and its curvature direction is the largest perpendicular component to the line AB (enhancing the sensitivity of the triangular mesh unit to local morphology).

[0105] In step S42, the two-dimensional pixel coordinates (x1, y1), (x2, y2), and (x3, y3) of the three detection points, as well as the slice thickness (slice thickness) and pixel spacing (pixelspacing, i.e., the physical size of a single pixel in the horizontal / vertical direction, usually in mm) of the CT image are obtained and converted into three-dimensional physical coordinates.

[0106] Assuming that the three points are located at the same level of the CT sequence (i.e., the z coordinate is the same), the three-dimensional coordinates of each point are: (x i × pixel pitch, y i× pixel spacing, slice thickness × number of slices), where the number of slices is determined by the index of the CT sequence, and the product of the slice thickness and the number of slices is the z-axis physical coordinate; if the three points are distributed in different layers (such as cross-layer lesions), their respective z coordinates are calculated according to the layer number.

[0107] For three points in three-dimensional space (X1, Y1, Z1), (X2, Y2, Z2), and (X3, Y3, Z3), the least squares method is used to fit the optimal plane where they are located. The general equation of the plane is ax+by+cz+d=0. The goal of fitting is to find a set of coefficients a, b, c, and d so that the sum of the squares of the distances from these three points to the plane is minimized.

[0108] The three-dimensional coordinates of each point are vertically projected onto the fitted plane to obtain the two-dimensional coordinates in the plane (u i , v i ) to eliminate redundant information in the z-axis direction; based on the projected 2D coordinates, determine the order of the points through the vector cross product to ensure that the three points are connected in a clockwise or counterclockwise direction to form a closed triangular mesh unit; for example, calculate the cross product of the vectors (X2−X1, Y2−Y1) and (X3−X1, Y3−Y1); if the result is positive, the three points are arranged counterclockwise, otherwise they are arranged clockwise; check whether the first and last points are connected to ensure that there are no gaps in the triangular mesh unit and form a complete triangular mesh unit area.

[0109] The three internal angles θ1, θ2, and θ3 of a triangular mesh element are calculated using the vector dot product formula. For each vertex i, take the two edge vectors that share that vertex as their common endpoint, divide the dot product of these two vectors by the product of their moduli, and the result is the cosine of the angle θᵢ, which can be used to determine the size of the internal angle.

[0110] If the internal angle is too small (such as less than 30°) or too large (such as greater than 150°), it indicates that the triangular mesh unit is morphologically deformed (such as sharp or flat), which may affect the accuracy of subsequent geometric feature calculations; fine-tune the position of point C: select the vertex with the abnormal angle (assuming it is point C), move it a small distance (such as the physical size of 1-3 pixels) along the curvature direction of the boundary where it is located (determined by local gradient or edge direction), and recalculate the new triangular mesh unit internal angle until all angles are within a reasonable range (such as 30°~150°); determine the curvature direction: determine the convexity of the boundary by detecting the gradient direction of the boundary pixels near point C, and ensure that the movement direction conforms to the morphological trend of the real lung structure (such as smooth movement toward the inside or outside of the lung parenchyma).

[0111] In step S43, a triangular mesh unit is constructed in the fitting plane using the projected two-dimensional coordinates, and its area is calculated using the vector cross product method. The specific steps are as follows:

[0112] Select any two points (such as point A and point B) to form vector AB=(u2-u1, v2-v1), and then select another point (such as point C) to form vector AC=(u3-u1, v3-v1); the modulus of the cross product of vectors AB and AC is equal to the area of ​​the parallelogram formed by the two vectors, and its calculation formula can be simplified to the absolute value of the difference between the product of the horizontal coordinate difference and the vertical coordinate difference; the area of ​​the triangular mesh unit formed by the three non-collinear detection points is half the area of ​​the parallelogram, so the true area value of the triangular mesh unit can be obtained by half of the cross product modulus.

[0113] Calculate the Euclidean distance (i.e., the straight-line distance between two points) of the three edges of the triangular mesh element to determine the longest edge. Compare the distance values ​​of the three edges and take the largest value as the longest edge. For example, if AB = 5 mm, BC = 7 mm, and CA = 6 mm, then the longest edge is BC = 7 mm.

[0114] The calculated triangular mesh unit area is divided by the longest side length to obtain the area-side length ratio (ALSR), which is used as a geometric characteristic value to quantify the abnormality of the boundary morphology.

[0115] In a preferred embodiment of the present invention, adjusting the boundary coordinates of the lung region segmentation result according to the correction parameter to generate a corrected lung region segmentation result may include:

[0116] Based on the correction parameters, the boundary coordinates of the initial segmentation result are locally translated or shrunk to generate a corrected lung region segmentation result.

[0117] In an embodiment of the present invention, by comparing the geometric feature values ​​with the preset threshold range, the areas in the segmentation results that do not conform to the normal lung morphology are quickly located, providing a basis for subsequent correction; the correction parameters are dynamically generated based on the degree of deviation, which can not only effectively correct the abnormal areas, but also maintain the stability of the normal areas, avoiding anatomical structure distortion caused by excessive correction; through local fine adjustment, the accuracy of the segmentation results is improved, especially for adhesion areas and areas with blurred boundaries, while maintaining the natural morphological characteristics of the lungs.

[0118] In an embodiment of the present invention, when applied in a specific application, the above step S5 can be implemented by the following technical solutions, for example:

[0119] Step S51 sets a reasonable range of geometric features based on the anatomical characteristics of the normal lung. For example, the area ratio is the ratio of the lung area to the total chest area, which is usually between 0.65 and 0.85 for normal adults (slightly different due to body size differences); the aspect ratio is the ratio of the left-right diameter to the upper-lower diameter of the lung, which is normally between 1.2 and 1.5 (upright CT scan). The threshold range is adjusted according to the characteristics of specific diseases (such as emphysema and pulmonary fibrosis). For example, the lung area ratio of patients with emphysema may be significantly increased (greater than 0.9) and the aspect ratio is reduced (less than 1.0); different thresholds are set according to different stages of CT scanning (such as inspiratory phase and expiratory phase). For example, the threshold range of lung area ratio in the inspiratory phase is [0.7, 0.85], and in the expiratory phase is [0.6, 0.75]; the lungs are divided into upper lobe, lower lobe and other regions, and independent thresholds are set for each region. For example, the aspect ratio threshold of the right upper lobe may be [1.1, 1.4], while that of the lower lobe is [1.3, 1.6].

[0120] Collect lung CT data from a large number of healthy individuals and calculate the distribution of each geometric feature (such as mean ± standard deviation). For example, calculate the area ratio of 1000 healthy samples and obtain a mean μ = 0.75 and a standard deviation σ = 0.05. Then, the threshold range can be set to [μ - 2σ, μ + 2σ] = [0.65, 0.85]. Use methods such as box plots to identify and eliminate extreme outliers to ensure that the threshold range reflects the true physiological characteristics.

[0121] Considering the correlation between multiple geometric features, a multidimensional threshold space is constructed. For example, when the area ratio is greater than 0.8, the aspect ratio must also be greater than 1.2, otherwise it is judged as abnormal. The threshold is dynamically adjusted according to the values ​​of other features. For example, when the lung field density is lower than a certain threshold, the upper limit of the area ratio is appropriately relaxed (allowing abnormal enlargement in patients with emphysema).

[0122] Based on the healthy population database, the mean (μ) and standard deviation (σ) of each geometric feature are calculated. For example, the area ratios of 1,000 healthy samples are counted, and the mean μ=0.75 and the standard deviation σ=0.05 are obtained. For each original eigenvalue (x), the formula "(original value - mean) ÷ standard deviation" is used to convert it to obtain the standardized value (x'). For example, if the original value of the area ratio of a sample is 0.85, the standardized value is (0.85-0.75) ÷ 0.05 = 2.

[0123] Determine the minimum value (min(x)) and maximum value (max(x)) of each feature in the healthy sample. For example, the minimum value of a feature in the healthy sample is 0.6, and the maximum value is 0.9. For each original feature value (x), use the formula "(original value - minimum value) ÷ (maximum value - minimum value)" to convert the feature value to the interval [0, 1]. For example, if the original value of a feature of a sample is 0.75, the standardized value is (0.75-0.6) ÷ (0.9-0.6) = 0.5.

[0124] The purpose of threshold interval mapping is to align the preset threshold range (based on medical knowledge or statistical analysis) with the standardized feature value to facilitate the judgment of the degree of deviation.

[0125] According to the normalization method (such as Z-score or Min-Max), the preset original threshold range is converted into a normalized interval. For example, if the preset area ratio threshold is [0.65, 0.85] and Z-score normalization (μ=0.75, σ=0.05) is used, the corresponding normalized interval is [-2, 2].

[0126] The normalized eigenvalues ​​(x') are further mapped to the interval [0, 1] according to the following rules:

[0127] If x'≤the lower limit of the normalized threshold, the mapping value is 0 (indicating that it is completely below the normal range);

[0128] If x' ≥ the upper limit of the normalized threshold, the mapping value is 1 (indicating that it is completely above the normal range);

[0129] If x' is between the upper and lower limits, the mapping value is "(x' - normalized lower limit) ÷ (normalized upper limit - normalized lower limit)", reflecting the relative position of the eigenvalue within the normal range.

[0130] For example, if the normalized area ratio is 1.5 (within the interval [-2, 2]), the mapping value is (1.5-(-2)) ÷ (2-(-2)) = 3.5 ÷ 4 = 0.875.

[0131] The purpose of deviation calculation is to quantify the degree to which the eigenvalue deviates from the preset threshold range and provide a basis for boundary correction. When the standardized eigenvalue (x') exceeds the upper limit of the standardized threshold, the excess ratio is calculated: (x'-standardized upper limit) ÷ standardized upper limit, and converted into an inward contraction offset according to the preset proportional coefficient (such as 0.1). For example, if the standardized area ratio is 2.5 (the upper limit is 2), the excess ratio is (2.5-2) ÷ 2 = 0.25 (i.e., 25% above the upper limit). When the standardized eigenvalue (x') is lower than the lower limit of the standardized threshold, the deficiency ratio is calculated: (standardized lower limit - x') ÷ standardized lower limit, and converted into an outward expansion offset. For example, if the standardized aspect ratio is 0.8 (the lower limit is 1), the deficiency ratio is (1-0.8) ÷ 1 = 0.2 (i.e., 20% below the lower limit).

[0132] Based on the calculated deviation, the deviation is converted into a specific offset value through a preset mapping function (such as a linear function or a nonlinear function); the correction direction is determined according to the deviation direction of the characteristic value (greater than the upper limit or less than the lower limit). For example, when the area ratio is too large, the correction direction is inward contraction; when the area ratio is too small, the correction direction is outward expansion.

[0133] Combining the offset and correction direction, the correction parameters of the boundary coordinates are generated. The parameters can be in the form of coordinate offset (Δx, Δy) or scaling factor (such as a contraction coefficient of 0.95 or an expansion coefficient of 1.05); targeted correction parameters are generated based on the characteristic deviation of local areas of the lung boundary (such as high curvature areas and fuzzy areas).

[0134] In step S52, a local adjustment strategy is selected according to the correction requirements. If the overall size is abnormal, an overall offset correction is used, and the offset (Δx, Δy) is directly superimposed on the coordinates of the boundary points. If the proportion is unbalanced, a radial scaling correction is performed based on the centroid of the lung parenchyma, and the distance is adjusted by multiplying the vector direction from the boundary point to the centroid by the scaling factor. The boundary is divided into multiple local areas based on the curvature distribution or anatomical structure (such as the interlobar fissure and the hilar area), and exclusive correction parameters are applied to different areas. For example, a smaller scaling factor is used to retain details in the high curvature lesion area.

[0135] During the coordinate adjustment phase, the boundary coordinate sequence is traversed, and translation or scaling operations are performed point by point according to the correction parameters of the corresponding region. If cross-layer boundaries are involved, the z-axis component of the three-dimensional coordinates is synchronously adjusted in combination with the CT layer thickness and pixel spacing. After adjustment, local discontinuities are repaired through B-spline curve fitting to eliminate aliasing or mutations. Gaussian filtering is then applied to the boundary coordinate sequence to balance detail preservation and smoothing effects to avoid excessive blurring of the true anatomical structure.

[0136] In a preferred embodiment of the present invention, the above step S6: labeling the lesions on the corrected lung region segmentation result to generate a final lung image with lesion type labels may include:

[0137] Step S61, based on the corrected lung region segmentation result, extract all connected domains as candidate lesion regions;

[0138] Step S62: Perform bimodal feature analysis on each candidate lesion region, including morphological features and imaging features; based on the pre-trained lesion classification model, classify the candidate regions into three categories: nodule region, tumor region, and inflammation region, and output a lesion region location dataset with spatial coordinates;

[0139] In step S63, each area in the lesion area location dataset is encoded with a type tag, and a structured label is generated at the same time. The lesion type label is added to the DICOM image header file, and a text annotation layer containing lesion type statistical information is superimposed in the lower right corner of the image. Finally, the tag information is fused with the original CT image to generate a final lung image with a lesion type label.

[0140] In an embodiment of the present invention, by extracting all connected domains in the corrected segmentation results as candidate lesion areas, potential lesions of different sizes and shapes in the lungs can be captured, preventing missed detections caused by manual screening, and laying the foundation for accurate diagnosis; each candidate area is subjected to morphological and imaging bimodal feature analysis, and is divided into three categories: nodules, tumors, and inflammation using a pre-trained lesion classification model, and a position data set with spatial coordinates is output to achieve multi-dimensional lesion characterization while improving the accuracy of automated classification through model generalization capabilities; the lesion area is type-labeled and encoded, and a structured label is generated and embedded in the DICOM image header file, combined with the lesion type statistical information annotation layer in the lower right corner of the image, to achieve standardized data storage and cross-device sharing, and through the fusion of the labeled information with the original CT image, the lesion location, type and anatomical structure are intuitively corresponded, reducing the doctor's image reading time and providing a visual basis for the formulation of treatment plans.

[0141] In the embodiments of the present invention, when applied specifically, it can be achieved through the following technical solutions, for example:

[0142] In step S61, the density characteristics (e.g., HU value range) of the corrected lung CT image are analyzed to identify abnormal density areas (e.g., high-density nodules and ground-glass opacities of inflammation). High-density areas with HU values ​​greater than 300 are marked (suspected nodules or calcifications), and ground-glass opacities between -300 and -100 are marked (suspected inflammation). Morphological characteristics (e.g., circularity greater than 0.5 and edge smoothness) are combined to distinguish between nodules and vascular shadows, which are mostly long and have low circularity.

[0143] A four-neighborhood search is performed on the binary mask image, and all connected domains are extracted. Regions with an area greater than 3 pixels² are retained. The region is expanded using the region growing algorithm with suspected lesion points (e.g., HU greater than 300 pixels) as seeds, combined with the Otsu adaptive threshold.

[0144] Use a pre-trained object detection model (such as Faster R-CNN or YOLO) to scan the lung area and output a bounding box or mask for the candidate lesion area. The model input is the corrected segmented image, and spatial features are extracted through a convolutional layer. An anchor mechanism is used to match lesions of different sizes (such as small nodules and large tumors). Suspected lesions (such as pixels with a HU value greater than 300) are used as seeds, and the connected regions are expanded using a region growing algorithm. Lesions are then segmented using an adaptive threshold (such as the Otsu algorithm). Areas that are too small (such as less than 3 pixels²) are excluded to reduce noise interference.

[0145] The pixel coordinates of the lesion area are converted to coordinates in the global coordinate system of the image, and the coordinates of the upper left and lower right corners (x1, y1, x2, y2) or the coordinates of the vertices of the triangular mesh unit are recorded. Metadata is added to each lesion area, including: the corresponding lung lobe (such as the right upper lobe), the distance from the pleura, etc.; the morphological parameters are area, perimeter, and longest diameter; the density features are the average HU value and density uniformity; the rule engine is used to exclude logically contradictory areas (for example, areas with an area greater than 30% of the total lung area are considered invalid), and the detection results with a confidence level greater than 0.8 are retained.

[0146] In step S62, the area, perimeter, major axis / minor axis ratio, circularity, edge roughness (e.g., lobulation, burrs), and solidity of the candidate region are calculated. The mean, standard deviation, and density uniformity of the CT values ​​within the region are calculated, and features such as ground glass density and calcifications are marked. The HU value range [-1000, 400] is extracted and mapped to [0, 1]. Lesion ROIs of different sizes are uniformly resized to 224×224 pixels, and bilinear interpolation is used. Random rotation (±15°), flipping, scaling (0.9–1.1 times), and Gaussian noise are added to enhance sample diversity.

[0147] It adopts a residual block structure and alleviates the gradient vanishing problem through skip connections, which is suitable for processing deep networks (such as ResNet50 / 101). The feature maps are densely connected between layers, which enhances feature reuse, reduces the number of parameters, and is more friendly to small sample data.

[0148] The network is initialized using model parameters pre-trained on large-scale datasets such as ImageNet, retaining the ability to extract low-level visual features (such as edges and textures); based on the characteristics of medical images, the convolutional layer parameters are fine-tuned to adapt to the characteristics of lung lesions (such as adjusting the statistics of the BatchNormalization layer).

[0149] The lesion region ROI (various sizes) was uniformly resized to 224×224 pixels, and bilinear interpolation was used to avoid image distortion. The HU value range [-1000, 400] was truncated and linearly mapped to the interval [0, 1] to enhance contrast. Random rotation (±15°), flipping (horizontally / vertically), and scaling (0.9-1.1 times) were performed to increase sample diversity. Gaussian noise (σ = 0.01) was added to the CT images to simulate the noise characteristics of different scanning devices.

[0150] The ROI image is sequentially passed through the convolutional layers of a pretrained network (e.g., the five stages of ResNet) to extract multi-scale features. Shallow features (e.g., the first convolutional layer) capture low-level information such as edges and textures, while deeper features (e.g., the last residual block) abstract the morphological and structural characteristics of the lesion. Global average pooling is used to compress the feature map into a fixed-length feature vector (e.g., 2048 dimensions). The feature vector is then passed through two or three fully connected layers (e.g., 2048→512→3), with dropout (p=0.5) introduced to prevent overfitting. The output layer uses the softmax function to convert the raw scores into class probability distributions (e.g., [nodule 0.92, tumor 0.03, inflammation 0.05]), retaining results with a confidence level >0.8.

[0151] Freeze the first few layers of the pre-trained network (e.g., the first three stages), train only the subsequent layers and the classification head, and gradually unfreeze the shallow layers to avoid catastrophic forgetting; use weighted cross-entropy loss to handle class imbalance (e.g., reduce the weight of nodule samples when they account for a high proportion); use the Adam optimizer (with an initial learning rate of 1e-4), and decay the learning rate by 0.1 every 10 epochs; terminate training if the validation set accuracy does not improve for five consecutive rounds, and save the optimal model.

[0152] In step S63, each lesion area is assigned a unique identifier (e.g., Lesion_001), marked with a type (nodule / tumor / inflammation), and morphological parameters (area, longest diameter), density characteristics (mean HU value), and spatial location metadata are recorded. Following the DICOM standard, lesion information, including type, coordinates, and characteristic parameters, is embedded in the private tag segment (0x7000-0x7FFF) of the image header file to ensure compatibility with PACS systems.

[0153] On the original lung image, mark the lesion area with a bounding box or mask of different colors:

[0154] Nodule: red frame, labeled “Nodule + diameter + confidence level”;

[0155] Tumor: blue mask, labeled “Tumor”;

[0156] Inflammation: green dotted box, labeled “Inflammation”.

[0157] Statistics: A semi-transparent text layer is generated in the lower right corner of the image, summarizing the number of lesion types (e.g., "nodule × 2, tumor × 1"), with the font color corresponding to the category (red tumor, blue nodule, green inflammation).

[0158] Generate a global view of the distribution of lung lesions and a local magnified view of a single lesion, ensuring that the labeling information is aligned with the anatomical structure and avoiding occlusion of key areas; output DICOM format images (including structured labels) and PNG / JPEG format visualization images, and simultaneously save the lesion location dataset in JSON / CSV format, including all metadata and classification results.

[0159] like Figure 2 As shown, an embodiment of the present invention further provides an image segmentation and annotation system based on machine learning, comprising:

[0160] An acquisition module, used for acquiring lung CT image data;

[0161] A preprocessing module is used to preprocess lung CT image data and generate optimized CT images;

[0162] A segmentation processing module is used to input the optimized CT image into the image segmentation model and output an initial segmentation result including the coordinates of the lung tissue boundary;

[0163] A calculation module is configured to dynamically select three detection points in a key region of the segmentation boundary based on the boundary shape of the initial segmentation result to construct a dynamic triangular mesh unit; and calculate geometric eigenvalues ​​based on vertex coordinates of the dynamic triangular mesh unit, wherein the geometric eigenvalues ​​include a proportional relationship between the area and the side length of the triangular mesh unit;

[0164] A correction module is configured to compare the geometric eigenvalue with a preset dynamic threshold range. When the geometric eigenvalue exceeds the upper threshold limit, the excess is calculated and converted into an inward contraction offset according to a preset proportional coefficient. When the geometric eigenvalue is below the lower threshold limit, the deficiency is calculated and converted into an outward expansion offset according to a preset proportional coefficient. Based on the above-mentioned offset, a boundary coordinate correction parameter in the corresponding direction is generated; the boundary coordinates of the lung region segmentation result are adjusted according to the correction parameter to generate a corrected lung region segmentation result.

[0165] The labeling module is used to label the lesions of the corrected lung area segmentation results and generate a final lung image with lesion type labels.

[0166] It should be noted that this system is a system corresponding to the above method, and all implementation methods in the above method embodiment are applicable to this embodiment and can achieve the same technical effects.

[0167] An embodiment of the present invention further provides a computing device comprising: a processor and a memory storing a computer program, wherein the computer program, when executed by the processor, performs the above-described method. All implementations in the above-described method embodiments are applicable to this embodiment and can achieve the same technical effects.

[0168] The embodiment of the present invention further provides a computer-readable storage medium storing instructions, which, when executed on a computer, causes the computer to execute the above-described method. All implementations in the above-described method embodiment are applicable to this embodiment and can achieve the same technical effects.

[0169] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present invention.

[0170] The above is a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.

Claims

1. A machine learning-based image segmentation and annotation method, characterized in that: The method comprises: Step S1: Acquire lung CT image data; Step S2: preprocessing the lung CT image data to generate an optimized CT image; Step S3: Input the optimized CT image into the image segmentation model, and output the initial segmentation result including the coordinates of the lung tissue boundary; Step S4: Based on the boundary morphology of the initial segmentation result, three detection points are dynamically selected in the key area of ​​the segmentation boundary to construct a dynamic triangular mesh unit; geometric feature values ​​are calculated based on the vertex coordinates of the dynamic triangular mesh unit, and the geometric feature values ​​include the proportional relationship between the area and the side length of the triangular mesh unit; Step S5: Comparing the geometric eigenvalue with a preset dynamic threshold range; when the geometric eigenvalue exceeds the upper threshold limit, calculating the excess amount and converting it into an inward contraction offset according to a preset proportional coefficient; when the geometric eigenvalue is lower than the lower threshold limit, calculating the deficiency amount and converting it into an outward expansion offset according to a preset proportional coefficient; generating boundary coordinate correction parameters in the corresponding direction based on the above-mentioned offset; adjusting the boundary coordinates of the lung region segmentation result according to the correction parameters, and generating a corrected lung region segmentation result; Step S6: perform lesion labeling on the corrected lung region segmentation result to generate a final lung image with lesion type labels.

2. The image segmentation and annotation method based on machine learning according to claim 1, characterized in that: Step S2: Preprocessing the lung CT image data to generate an optimized CT image, including: Perform noise suppression on lung CT image data to generate a noise-reduced intermediate image; The noise-reduced intermediate image is subjected to contrast enhancement processing to generate an optimized CT image.

3. The image segmentation and annotation method based on machine learning according to claim 2, characterized in that: Step S3: Input the optimized CT image into the image segmentation model, and output the initial segmentation result containing the coordinates of the lung tissue boundary, including: The optimized CT images are encoded with multi-scale features using a pre-trained deep learning segmentation model's feature extraction path to generate a hierarchical feature map. The feature extraction path comprises multiple serially connected feature extraction stages, each of which includes at least one convolutional layer and one downsampling layer. Through the stage-by-stage downsampling operation, a multi-scale hierarchical feature map with decreasing spatial resolution and increasing semantic information is generated. Decoding and fusing the multi-scale hierarchical feature maps through a feature reconstruction path of an image segmentation model, wherein the feature reconstruction path comprises multiple serial reconstruction stages, each of which performs upsampling and cross-path feature fusion operations, generating an initial segmentation probability map of the lung tissue through stage-by-stage processing; Binarize the initial segmentation probability map to obtain a binary mask image of the lung tissue; A contour extraction algorithm is performed on the binary mask image to identify and obtain a sequence of boundary pixel coordinates of the lung tissue, thereby forming an initial segmentation result containing the boundary coordinates of the lung tissue.

4. The image segmentation and annotation method based on machine learning according to claim 3, characterized in that: Step S4: Based on the boundary shape of the initial segmentation result, three detection points are dynamically selected in the key area of ​​the segmentation boundary to construct a dynamic triangular mesh unit; Calculating geometric eigenvalues ​​based on vertex coordinates of the dynamic triangular mesh unit, wherein the geometric eigenvalues ​​include a proportional relationship between the area and the side length of the triangular mesh unit, including: Based on the boundary coordinate sequence of the initial segmentation results, key areas within the lung tissue boundary that meet any of the following conditions are identified: suspected lesion areas where the curvature change rate exceeds a preset threshold; fuzzy boundary areas where the difference in grayscale gradient values ​​between adjacent boundary points is lower than a preset threshold. Within the key area, three non-collinear detection points are dynamically selected according to the principle of spatial spacing uniformity. The spatial spacing uniformity principle requires that the detection points are evenly distributed within the boundary point sequence of the key area so that the spatial distances between points are equal and non-collinearity is satisfied. Connect the three detection points in spatial adjacent order to construct a dynamic triangular mesh unit, where the coordinates of each vertex are derived from the pixel position of the boundary coordinate sequence; Calculate the ratio of the area of ​​a dynamic triangle mesh unit to its longest side length as the geometric eigenvalue.

5. The image segmentation and annotation method based on machine learning according to claim 4, characterized in that: The boundary coordinates of the lung region segmentation result are adjusted according to the correction parameters to generate a corrected lung region segmentation result, including: Based on the correction parameters, the boundary coordinates of the initial segmentation result are locally translated or shrunk to generate a corrected lung region segmentation result.

6. The image segmentation and annotation method based on machine learning according to claim 5, characterized in that: Step S6: lesion labeling is performed on the corrected lung region segmentation result to generate a final lung image with lesion type labels, including: Based on the corrected lung region segmentation results, all connected domains are extracted as candidate lesion regions; Perform bimodal feature analysis on each candidate lesion region, including morphological and imaging features. Based on the pre-trained lesion classification model, the candidate regions are divided into three categories: nodule region, tumor region, and inflammation region, and a lesion region location dataset with spatial coordinates is output. Each region in the lesion region location dataset is encoded with a type tag and structured labels are generated. The lesion type label is added to the DICOM image header file, and a text annotation layer containing lesion type statistical information is superimposed in the lower right corner of the image. Finally, the label information is fused with the original CT image to generate a final lung image with lesion type labels.

7. A machine learning-based image segmentation and annotation system, which implements the method according to any one of claims 1 to 6, characterized in that: include: An acquisition module, used for acquiring lung CT image data; A preprocessing module is used to preprocess lung CT image data and generate optimized CT images; A segmentation processing module is used to input the optimized CT image into the image segmentation model and output an initial segmentation result including the coordinates of the lung tissue boundary; A calculation module is used to dynamically select three detection points in a key area of ​​the segmentation boundary based on the boundary shape of the initial segmentation result and construct a dynamic triangular mesh unit; Calculating geometric eigenvalues ​​based on vertex coordinates of the dynamic triangular mesh unit, wherein the geometric eigenvalues ​​include a proportional relationship between the area and the side length of the triangular mesh unit; A correction module is used to compare the geometric feature value with a preset dynamic threshold range. When the geometric feature value exceeds the upper threshold, the excess amount is calculated and converted into an inward contraction offset according to a preset proportional coefficient; When the geometric feature value is lower than the lower threshold, the deficiency is calculated and converted into an outward expansion offset according to a preset proportional coefficient; a boundary coordinate correction parameter of the corresponding direction is generated based on the above offset; the boundary coordinates of the lung region segmentation result are adjusted according to the correction parameter to generate a corrected lung region segmentation result; The labeling module is used to label the lesions of the corrected lung area segmentation results and generate a final lung image with lesion type labels.

8. A computing device, characterized in that include: one or more processors; A storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a program, which, when executed by a processor, implements the method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Automatic labeling method and device and storage medium

    CN114092689A

  • Lung medical image processing method and device, equipment and storage medium

    CN115409856A