A method, device and medium for predicting esophageal structure, tumor contour and stage

Deep learning technology is used to extract features and construct control points in endoscopic ultrasound images to generate cubic B-spline curves, which solves the problem of low tumor localization and staging accuracy and achieves higher accuracy and interpretability.

CN118212459BActive Publication Date: 2024-10-18广东合德供应链有限责任公司
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410349867.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-03-26
Publication Date
2024-10-18
Estimated Expiration
2044-03-26

AI Technical Summary

Technical Problem

In the current endoscopic ultrasonic image processing, the accuracy of tumor localization and staging results is low and lacks good interpretability, and it fails to effectively use anatomical knowledge for tumor identification and staging.

Method used

A method based on deep learning is used to obtain endoscopic ultrasound images, perform feature extraction and structural splitting, construct the control points of the three-layer esophageal structure and tumor growth contour, use spline interpolation to generate a cubic B-spline curve, and calculate the The relative distance between them can be used to predict tumor staging results.

Benefits of technology

It improves the accuracy of tumor localization and staging results, enhances the interpretability of the results, can more accurately represent the shape of the esophagus and tumor, and expresses the degree of tissue invasion through relative distance, solving the accuracy and interpretability problems in the existing technology. shortcomings.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118212459B_ABST
    Figure CN118212459B_ABST
Patent Text Reader

Abstract

The present invention discloses a method, device and medium for predicting esophageal structure and tumor contour and staging, the method comprising: using a model to extract features from original endoscopic ultrasound images to obtain full-size features; performing structural and node processing on the full-size features to obtain control points of three-layer esophageal structure and tumor growth contour; generating cubic B-spline curves of the esophagus and tumor according to the control points; obtaining tumor staging results by calculating the relative distances between the cubic B-spline curves; and forming a prediction result from the cubic B-spline curves and the tumor staging results. The present invention proposes a method, device and medium for predicting esophageal structure and tumor contour and staging, which can accurately represent the prediction results of esophageal wall structure and tumor contour by generating cubic B-spline curves, and can ensure the interpretability of tumor staging results by calculating the relative distances between curves, and can solve the problem of low accuracy of tumor positioning and staging results.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a method, device and medium for predicting tumor staging probability based on esophageal structure. Background Art

[0002] Gastric cancer, colorectal cancer and esophageal cancer are among the most common cancers in the world. Early detection of the disease is crucial to the cure rate. Ultrasound endoscopic examination has special advantages in distinguishing tumor T1-T4 stages, or more detailed T1a and T1b stages, and is an important method for early detection of digestive tract malignant diseases. At the same time, artificial intelligence technology can help medical staff identify early cancer more accurately; artificial intelligence-assisted endoscopic examination can improve screening efficiency, help medical staff make more accurate diagnoses, solve the problems of early screening and early diagnosis, and create a new situation in the medical field.

[0003] However, artificial intelligence medical technology still has many problems in the processing and diagnosis of ultrasound endoscopic images. On the basis of using the neural network diagnostic model to select and extract the diagnosis-related areas, the convolutional neural network (CNN) is directly used to obtain the classification prediction results, resulting in a lack of good interpretability of the classification prediction results. The imaging quality of ultrasound endoscopic images is unstable, and the existing methods fail to effectively use anatomical knowledge for tumor identification and staging differentiation, resulting in low accuracy of tumor localization and staging results. Summary of the invention

[0004] The present invention provides a method, device and medium for predicting tumor staging probability based on esophageal structure, so as to solve the problem of low accuracy of tumor positioning and staging results.

[0005] In order to solve the above problems, the present invention provides a method for predicting esophageal structure and tumor contour and staging, comprising:

[0006] Obtain original endoscopic ultrasound images;

[0007] Using a preset model to extract features from the original ultrasound endoscopy image to obtain full-size features;

[0008] Use the preset model to perform structural decomposition and node reconstruction on the full-size feature to obtain control points of the three-layer esophageal structure and tumor growth contour;

[0009] Generating cubic B-spline curves of the esophagus and the tumor according to the control points by means of spline interpolation;

[0010] The tumor staging result is obtained by calculating the relative distance between the cubic B-spline curves;

[0011] The cubic B-spline curve and the tumor staging result form a prediction result of the esophageal structure, tumor contour and tumor staging;

[0012] Among them, the preset model is a deep learning model composed of different devices and modules.

[0013] The present invention can remove redundant images by extracting features from original endoscopic ultrasound images, thereby effectively ensuring the data accuracy of endoscopic ultrasound images and reducing the complexity of data processing; by constructing control points of the three-layer esophageal structure and tumor growth contour, the characteristics of tumor growth can be fully acquired, which is conducive to the effective evaluation of the esophageal disease state; by generating a cubic B-spline curve by spline interpolation, discrete point data can be connected into a curve to accurately represent the shape of the esophagus and the tumor; because the relative distance between the curves can represent the degree of tissue invasion between different membrane layers, the tumor staging result can be obtained quickly and conveniently.

[0014] Compared with the prior art, the present invention can improve the accurate positioning of the model on the region of interest by introducing a model for image processing, and provide a cubic B-spline curve that conforms to the anatomical structure through multi-layer polygon generation technology, which can accurately represent the esophageal wall structure contour prediction and tumor contour prediction results, and by calculating the relative distance between the curves, the degree of tissue invasion can be obtained, ensuring the interpretability of the tumor staging results, and can solve the problem of low accuracy of tumor positioning and staging results.

[0015] As a preferred solution, the preset model is used to perform structural decomposition and node reconstruction on the full-size feature to obtain the control points of the three-layer esophageal structure and tumor growth contour, specifically:

[0016] Using the structure detection module of the preset model, the full-size features are dimensionally transformed and split to obtain global feature tokens;

[0017] The global feature token is combined with the preset esophageal and tumor control point features to obtain the control points of the three-layer esophageal structure through coordinate transformation;

[0018] By performing feature mapping on the preset tumor features based on different radii, the control points of the tumor's outward and inward growth contours are obtained.

[0019] This preferred solution predicts the control points of the contour lines in the two dimensions of tumor outward growth and inward growth to obtain the control points of the tumor outward and inward growth contour lines, which can fully obtain the characteristics of tumor growth and is conducive to the effective evaluation of the esophageal disease status.

[0020] As a preferred solution, the structure detection module of the preset model is used to perform dimension transformation and splitting on the full-size features to obtain global feature tokens, specifically:

[0021] Using the structure detection module of the preset model, performing dimension transformation on the full-size feature to obtain a first token;

[0022] constructing a learnable second token according to the number of esophageal structure control points that need to be predicted;

[0023] Concatenate the first token and the second token to obtain a third token;

[0024] The third token is input into the Transformer module of the preset model and token splitting is performed to obtain the global feature token.

[0025] The steps of dimension transformation, token construction, token splicing and token splitting of the full-size features in this preferred solution are the process of organizing and collecting the feature information in the full-size features, so that the obtained global feature tokens have good invariance and intuitive representation while having global features, which helps to provide a solid data foundation for the later esophageal structure and tumor prediction.

[0026] As a preferred solution, the global feature token is combined with the preset esophageal and tumor control point features to obtain the control points of the three-layer esophageal structure through coordinate transformation, specifically:

[0027] Using a first preset formula, calculating the esophagus and tumor control point features according to the global feature tokens;

[0028] Mapping the esophagus and tumor control point features using a linear transformation layer, and converting the mapping results into polar coordinates to obtain node coordinates of the mucosal layer contour line;

[0029] According to the control point features, the relative radii of the submucosal layer and the adventitia layer are calculated using the linear transformation layer, and the actual radii of the submucosal layer and the adventitia layer are calculated according to the node coordinates and the relative radii;

[0030] According to the actual radius and the angle of the node coordinates relative to the center of the esophagus, the control points corresponding to the control point features are converted into a form represented by Cartesian coordinates to obtain the control points of the three-layer esophagus structure.

[0031] The relative radius of the submucosal layer and the adventitia layer calculated by this preferred solution has certain limitations and cannot accurately represent the distance between different mucosal layers. Since the relative radius represents the relative displacement, the actual radius is calculated based on the relative displacement and combined with the node coordinates, thereby accurately representing the displacement of the submucosal layer and the adventitia layer relative to the contour line of the mucosal layer.

[0032] As a preferred solution, by performing feature mapping on the preset tumor features based on different radii, the control points of the tumor's outward and inward growth contours are obtained, specifically:

[0033] define tumor characteristics;

[0034] Mapping the tumor feature on a first radius scale and a second radius scale respectively to obtain a first relative radius and a second relative radius;

[0035] The first relative radius and the second relative radius are used in sequence to calculate with the radius of the node coordinate relative to the center of the esophagus, to obtain the actual radii of the outward and inward growth contours of the tumor respectively;

[0036] According to the actual radius of the tumor's outward and inward growth contours and the angle of the mucosal layer, coordinate transformation of the node position is performed to obtain the control points of the tumor's outward and inward growth contours.

[0037] This preferred solution is the construction process of the control points of the tumor growth contour line. The conversion relationship between Cartesian coordinates and polar coordinates is referenced in the processing of control points. The advantages of Cartesian coordinates in terms of intuitive expression, concise description and accurate description can be utilized to make the calculation method of the tumor growth shape relatively simple, thereby being able to clearly describe the control points of the tumor growth contour line.

[0038] As a preferred solution, a cubic B-spline curve of the esophagus and the tumor is generated according to the control points by spline interpolation, specifically:

[0039] Using a cubic B-spline interpolation method to process the control points of the three-layer esophageal structure and tumor growth contour respectively, to obtain a parameterized esophageal structure contour line and a tumor contour line;

[0040] On the esophageal structure contour line and the tumor contour line, calculating the normal vector of each curve point to obtain a unit vector of the normal line;

[0041] The cubic B-spline curves of the esophagus and the tumor are constructed by the esophagus structure contour line, the tumor contour line, and the unit vector of the normal line.

[0042] This preferred solution connects discrete point data into a curve using control points as basic elements, thereby obtaining a curve with high precision, convergence and accurate fitting as the structural contour line, and by combining the normal vector, a complete cubic B-spline curve is obtained, which can be used to accurately represent the shape of the esophagus and tumors.

[0043] As a preferred solution, the tumor staging result is obtained by calculating the relative distance between the cubic B-spline curves, specifically:

[0044] According to the first contour line of the tumor outward growth and the second contour line of the submucosal layer in the cubic B-spline curve, constructing the Euclidean distance between all points on the curve to obtain a distance matrix;

[0045] By indexing, performing distance calculation and normal vector judgment from the first contour line to the second contour line according to the distance matrix, obtaining the maximum distance from each point on the first contour line to the nearest point on the second contour line, and using the maximum distance as a relative distance value set;

[0046] In the relative distance value set, the tumor staging result is obtained according to the numerical value of the relative distance between the tumor outward growth contour line and the submucosal layer, and the numerical value of the relative distance between the tumor outward growth contour line and the adventitia layer.

[0047] This preferred solution can accurately represent the distances between all points on the curve by constructing a distance matrix. By means of indexing, points on different curves can be associated with each other, so as to obtain the maximum value of the distance from each point on the first contour line to the nearest point on the second contour line. Moreover, the relative distances in the relative distance value set can be positive or negative, so by judging the size of the value, the degree of tissue invasion between different membrane layers can be known, thereby obtaining the tumor staging result.

[0048] As a preferred solution, a preset model is used to extract features from the original ultrasound endoscopy image to obtain full-size features, specifically:

[0049] Using the effective area detector of the preset model, identifying and cutting the effective area boundary box of the original ultrasound endoscopy image to obtain a valid ultrasound endoscopy image;

[0050] The feature encoder and feature decoder of the preset model are used to perform feature extraction and upsampling on the effective ultrasound endoscopy image to obtain the full-size feature.

[0051] This preferred solution can remove redundant images by identifying and cropping the effective area boundary box, effectively ensuring the data accuracy of the ultrasound endoscopic image while reducing the complexity of data processing. Through feature extraction and upsampling, tumor-related features can be extracted from the effective ultrasound endoscopic image, so that features such as tumor size, shape and density are included in the full-size features, which can better describe the detailed features of the original ultrasound endoscopic image.

[0052] As a preferred solution, the preset model is a deep learning model composed of different devices and modules, and also includes:

[0053] By measuring the consistency between the segmentation mask predicted by the preset model and the actual segmentation mask, a DICE loss function is obtained;

[0054] By measuring the error between the predicted nodes and the actual nodes of the preset model, a polygon loss function is obtained;

[0055] By quantifying the error between the T stage label predicted by the preset model and the actual T stage label, a classification loss function is obtained;

[0056] Using a preset training set and masks of the tumor and the esophageal wall, the preset model is trained according to the DICE loss function, the polygon loss function and the classification loss function to obtain an optimized preset model.

[0057] In this preferred solution, the DICE loss function can enhance the accuracy of recognition and positioning of specific targets, the polygonal loss function can improve the prediction accuracy of esophageal and tumor contour nodes, and the classification loss function can improve the prediction accuracy of tumor staging results. Therefore, the loss functions established from different dimensions can significantly improve the optimization of the model and enhance the prediction accuracy of the preset model.

[0058] As a preferred solution, the training set is specifically:

[0059] Obtain training data from esophageal cancer tumor cases;

[0060] Transforming the polygonal contour points of the mucosal layer, the submucosal layer and the adventitia layer in the training data to obtain first transition data;

[0061] generating second transition data including contour point data, a segmentation bitmap mask and a staging label of the ultrasound endoscopy image according to the first transition data;

[0062] Data enhancement is performed on the second transition data to obtain the training set.

[0063] The present invention also provides a prediction device for esophageal structure and tumor contour and staging, comprising a data module, a feature module, a node module, a curve module, a staging module and an integration module;

[0064] Wherein, the data module is used to obtain the original ultrasound endoscopy image;

[0065] The feature module is used to extract features from the original ultrasound endoscopy image using a preset model to obtain full-size features;

[0066] The node module is used to perform structural decomposition and node reconstruction on the full-size feature using the preset model to obtain control points of the three-layer esophageal structure and tumor growth contour;

[0067] The curve module is used to generate a cubic B-spline curve of the esophagus and the tumor according to the control points by means of spline interpolation;

[0068] The staging module is used to obtain a tumor staging result by calculating the relative distance between the cubic B-spline curves;

[0069] The integrated module is used to construct the prediction results of esophageal structure, tumor contour and tumor staging based on the cubic B-spline curve and the tumor staging result;

[0070] Among them, the preset model is a deep learning model composed of different devices and modules.

[0071] As a preferred solution, the node module includes a global unit, a transformation unit and a mapping unit;

[0072] The global unit is used to use the structure detection module of the preset model to perform dimension transformation and splitting on the full-size feature to obtain a global feature token;

[0073] The transformation unit is used to combine the global feature token with the preset esophageal and tumor control point features to obtain the control points of the three-layer esophageal structure through coordinate transformation;

[0074] The mapping unit is used to perform feature mapping on preset tumor features based on different radii. As a preferred solution, the global unit includes a dimension subunit, a construction subunit, a splicing subunit and a splitting subunit;

[0075] The dimension subunit is used to perform dimension transformation on the full-size feature using the structure detection module of the preset model to obtain a first token;

[0076] The construction subunit is used to construct a learnable second token according to the number of esophageal structure control points that need to be predicted;

[0077] The splicing subunit is used to splice the first token and the second token to obtain a third token;

[0078] The splitting subunit is used to input the third token into the Transformer module of the preset model and perform token splitting to obtain the global feature token.

[0079] As a preferred solution, the transformation unit includes a feature subunit, a coordinate subunit, a radius subunit and a control subunit;

[0080] Wherein, the feature subunit is used to calculate the esophageal and tumor control point features according to the global feature token using a first preset formula;

[0081] The coordinate subunit is used to map the esophagus and tumor control point features using a linear transformation layer, and convert the mapping results into polar coordinates to obtain node coordinates of the mucosal layer contour line;

[0082] The radius subunit is used to calculate the relative radius of the submucosal layer and the adventitia layer respectively according to the control point features using the linear transformation layer, and calculate the actual radius of the submucosal layer and the adventitia layer according to the node coordinates and the relative radius;

[0083] The control subunit is used to convert the control points corresponding to the control point features into a form of Cartesian coordinates according to the actual radius and the angle of the node coordinates relative to the center of the esophagus, so as to obtain the control points of the three-layer esophageal structure.

[0084] As a preferred solution, the mapping unit includes a definition subunit, a scale subunit, a growth subunit and a transformation subunit;

[0085] Wherein, the definition subunit is used to define tumor characteristics;

[0086] The scale subunit is used to map the tumor feature on the first radius scale and the second radius scale respectively to obtain a first relative radius and a second relative radius;

[0087] The growth subunit is used to sequentially use the first relative radius and the second relative radius to calculate with the radius of the node coordinate relative to the center of the esophagus, to obtain the actual radius of the tumor's outward and inward growth contour lines respectively;

[0088] The conversion subunit is used to perform coordinate conversion of the node position according to the actual radius of the tumor's outward and inward growth contour line and the angle of the mucosal layer to obtain the control points of the tumor's outward and inward growth contour line.

[0089] As a preferred solution, the curve module includes a parameter unit, a vector unit and an integration unit;

[0090] The parameter unit is used to process the control points of the three-layer esophageal structure and tumor growth contour respectively using a cubic B-spline interpolation method to obtain a parameterized esophageal structure contour line and a tumor contour line;

[0091] The vector unit is used to calculate the normal vector of each curve point on the esophageal structure contour line and the tumor contour line to obtain the unit vector of the normal line;

[0092] The integration unit is used to construct a cubic B-spline curve of the esophagus and the tumor using the esophageal structure contour line and the tumor contour line, and the unit vector of the normal line.

[0093] As a preferred solution, the staging module includes a distance unit, an index unit and a comparison unit;

[0094] The distance unit is used to construct the Euclidean distances between all points on the curve according to the first contour line of the tumor growing outward and the second contour line of the submucosal layer in the cubic B-spline curve to obtain a distance matrix;

[0095] The index unit is used to perform distance calculation and normal vector judgment from the first contour line to the second contour line according to the distance matrix by means of index, to obtain the maximum distance from each point on the first contour line to the nearest point on the second contour line, and to use the maximum distance as a relative distance value set;

[0096] The comparison unit is used to obtain the tumor staging result according to the numerical value of the relative distance between the tumor's outward growth contour and the submucosal layer, and the numerical value of the relative distance between the tumor's outward growth contour and the outer membrane layer in the relative distance value set.

[0097] As a preferred solution, the feature module includes a recognition unit and an extraction unit;

[0098] Wherein, the recognition unit is used to use the effective area detector of the preset model to recognize and cut the effective area boundary box of the original ultrasound endoscopy image to obtain a valid ultrasound endoscopy image;

[0099] The extraction unit is used to extract and upsample the effective ultrasonic endoscopy image using the feature encoder and feature decoder of the preset model to obtain the full-size feature.

[0100] As a preferred solution, the integrated module further includes a DICE loss unit, a polygon loss unit, a classification loss unit and a training unit;

[0101] The DICE loss unit is used to obtain a DICE loss function by measuring the consistency between the segmentation mask predicted by the preset model and the actual segmentation mask;

[0102] The polygon loss unit is used to obtain a polygon loss function by measuring the error between the predicted node and the actual node of the preset model;

[0103] The classification loss unit is used to obtain a classification loss function by quantifying the error between the T staging label predicted by the preset model and the actual T staging label;

[0104] The training unit is used to use a preset training set and a mask of the tumor and the esophageal wall to train the preset model according to the DICE loss function, the polygon loss function and the classification loss function to obtain an optimized preset model.

[0105] As a preferred solution, the training set is specifically:

[0106] Obtain training data from esophageal cancer tumor cases;

[0107] Transforming the polygonal contour points of the mucosal layer, the submucosal layer and the adventitia layer in the training data to obtain first transition data;

[0108] generating second transition data including contour point data, a segmentation bitmap mask and a staging label of the ultrasound endoscopy image according to the first transition data;

[0109] Data enhancement is performed on the second transition data to obtain the training set.

[0110] The present invention also provides a storage medium having a computer program stored thereon. The computer program is called and executed by a computer to implement the above-mentioned method for predicting esophageal structure, tumor contour and staging. BRIEF DESCRIPTION OF THE DRAWINGS

[0111] Figure 1 It is a flowchart of a method for predicting esophageal structure, tumor contour and stage provided by an embodiment of the present invention;

[0112] Figure 2 is an anatomical structure diagram of the esophagus provided by an embodiment of the present invention;

[0113] Figure 3 is a T staging structure diagram of esophageal cancer provided by an embodiment of the present invention;

[0114] Figure 4 is a schematic diagram of a unit normal vector provided by an embodiment of the present invention;

[0115] Figure 5 is a schematic diagram of a prediction process provided by an embodiment of the present invention;

[0116] Figure 6 It is a schematic diagram of the structure of a device for predicting esophageal structure, tumor contour and staging provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0117] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0118] In the description of the present application, it should be understood that the terms "first", "second" and "third" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first", "second" and "third" may explicitly or implicitly include one or more of the features. In the description of the present application, unless otherwise specified, "several" means two or more.

[0119] In the description of this application, it should be noted that mask means mask; yolo is the abbreviation of You Only Look Once, which means an object detection algorithm based on deep neural network; mask rcnn is the abbreviation of Mask Region-based Convolutional Neural Network, which means an instance segmentation algorithm.

[0120] The method for predicting esophageal structure, tumor contour and staging described in the embodiment of the present invention is mainly used in situations where it is necessary to predict esophageal structure and tumor contour, as well as tumor staging, based on ultrasonic endoscopic images.

[0121] Embodiment 1:

[0122] See also Figure 1 The embodiment of the present invention provides a method for predicting esophageal structure, tumor contour and stage, including S1 to S6, and the specific implementation steps are as follows:

[0123] S1. Obtain the original endoscopic ultrasound image.

[0124] Step S1 of the embodiment of the present invention is specifically:

[0125] An original endoscopic ultrasound image I is obtained; wherein the original endoscopic ultrasound image I refers to an image obtained by combining endoscopy and ultrasound to examine the digestive tract.

[0126] To apply the embodiments of the present invention, please refer to Figure 2 and Figure 3 , Figure 2 It is an anatomical structure diagram of the esophagus provided in an embodiment of the present invention, which shows the structure of the esophagus observable under ultrasonic endoscopy, which can be simplified into a three-layer tubular cavity structure composed of a mucosal layer, a submucosal layer and an adventitia layer, which are nested layer by layer; the formation of tumors usually starts in the esophageal mucosal layer and can grow in the cavity and outside the cavity.

[0127] Figure 3 This is a T staging structure diagram of esophageal cancer provided by an embodiment of the present invention, which shows the T staging division method of esophageal cancer. The T staging of a tumor is mainly determined according to the degree of its growth outside the cavity. For example, a T1a-level tumor is located between the mucosal layer and the submucosal layer, a T1b-level tumor has broken through the submucosal layer and grown outward, a T2-level tumor further extends to the deep layer of the esophageal wall, a T3-level tumor penetrates the outer membrane layer, and a T4-level tumor has penetrated the outer membrane layer and invaded external organs. Using an ultrasonic endoscope, the T1a, T1b, and T2 stages of a tumor and whether it is greater than or equal to the T3 stage can be identified.

[0128] S2. Use the preset model to extract features from the original ultrasound endoscopy image to obtain full-size features.

[0129] In step S2 of the embodiment of the present invention, S2 includes S2.1 to S2.2; wherein S2.1 is to obtain an effective ultrasound endoscopic image I valid S2.2 is the process of constructing full-size features, specifically:

[0130] S2.1. Inputting the original ultrasound endoscopy image I into the effective area detector of the preset model to identify the effective area bounding box, thereby obtaining the bounding box of the effective area;

[0131] The bounding box of the effective area is clipped to obtain the effective ultrasound endoscopy image I valid .

[0132] Among them, the effective area detector can be implemented using target detection algorithms such as yolo or mask rcnn.

[0133] In this embodiment S2.1, by identifying and clipping the effective area boundary box, redundant images can be removed, effectively ensuring the data accuracy of the ultrasound endoscopic image while reducing the complexity of data processing. Through feature extraction and upsampling, tumor-related features can be extracted from the effective ultrasound endoscopic image, so that features such as the size, shape, and density of the tumor are included in the full-size features, which can better describe the detailed features of the original ultrasound endoscopic image.

[0134] S2.2. First, the effective ultrasound endoscopic image I valid Input the feature encoder of the preset model for feature extraction, and the input matrix is ​​[B, C, H, W]; where [B, C, H, W] can take C = 3, H = W = 256;

[0135] Then, the feature decoder of the preset model is used to upsample the extracted features to obtain the full-size features of [B, h, H, W]; wherein [B, h, H, W] can take h = 64.

[0136] In addition, the feature encoder and feature decoder constitute the backbone network using the U-net network structure; the feature encoder can choose convolutional neural network CNN or Transformer as the feature extractor, and the feature decoder adopts the U-Net structure.

[0137] It should be noted that the preset model is a deep learning model composed of an effective area detector, a feature encoder, a feature decoder and a structure detection module.

[0138] S3. Use the preset model to perform structural decomposition and node reconstruction on the full-size features to obtain the control points of the three-layer esophageal structure and tumor growth contour.

[0139] In step S3 of the embodiment of the present invention, S3 includes S3.1 to S3.4; wherein S3.1 is a process of constructing a global feature token, S3.2 is a process of defining the features of the esophagus and the tumor control points, S3.3 is a process of constructing the control points of the three-layer esophagus structure, and S3.4 is a process of constructing the control points of the outward and inward growth contours of the tumor, specifically:

[0140] S3.1. Use the structure detection module of the preset model to transform the full-size features of [B, h, H, W] into features of dimensions [B, HW, h]. Get the first token And for the first token Embed the corresponding coordinate position into positional embedding, where B represents the batch size, h represents the feature dimension, and H and W represent the height and width of the source matrix.

[0141] Construct a learnable second token based on the number of esophageal structure control points that need to be predicted in, The dimension is [B, n s ,h],n s Indicates the number of esophageal structure control points that need to be predicted;

[0142] Concatenate the first token and the second token to get the third token {0} ; Among them, the third token {0} The dimension is [B, n s +HW,h];

[0143] The third token {0} Input the L-layer Transformer module in the preset model to get the token {L} , and token {L} Re-split to obtain the global feature token ( and );in, The dimension is [B, n s ,h], indicating that the model will output ns esophageal / tumor control point features.

[0144] The steps of dimension transformation, token construction, token splicing and token splitting of the full-size features in S3.1 of this embodiment are the process of organizing and collecting the feature information in the full-size features, so that the obtained global feature tokens have good invariance and intuitive representation while having global features, which helps to provide a solid data foundation for the later esophageal structure and tumor prediction.

[0145] In addition, this embodiment 1 introduces a Transformer-based multi-layer polygon generation technology to explicitly represent organs that conform to the anatomical structure. Through this representation method, the polygonal curves of the esophageal wall and tumor area are more consistent with the anatomical structure, which can effectively improve the structural accuracy and interpretability of the segmentation results, and provide medical staff with a more reliable basis for interpreting image data.

[0146] S3.2. Order Using the first preset formula, the esophageal and tumor control point features F are calculated based on the global feature tokens. structure ; Among them, F structure The dimension is [B, n s , h];

[0147] Among them, the characteristics of esophagus and tumor control points are:

[0148] F structure =softmax(Q s ×Kf T )×V f

[0149] S3.3. For the mucosal layer, submucosal layer and adventitia layer of the esophageal lumen, it is necessary to predict several nodes (control points) at their respective levels. These nodes will determine the shape of the cubic B-spline curve, thereby describing the contour of the esophageal structure. Therefore, for each esophageal control point, it is necessary to predict the node coordinates of the mucosal layer (expressed in Cartesian coordinates), the relative radius of the submucosal layer and the adventitia layer (the radius difference between the membrane layer distances). The specific steps are as follows:

[0150] Assume that the current esophageal structure is characterized by F structure , the dimension is [B, n s , h], where B is the batch size, n s is the number of esophageal structure control points that need to be predicted, and h is the feature dimension;

[0151] Use a linear transformation layer to transform n s The control point features of the esophagus and tumor control nodes F structure Mapped to two dimensions (2D), that is, P mucosa =W p *F structure ; and convert the mapping result into polar coordinates to obtain the node coordinates of the mucosal layer contour line (r mucosa ,θ mucosa ), where W p is a weight matrix of dimension [2, h], P mucosa The corresponding dimension is [B, n s , 2], represents n s The 2D coordinates of the control points of the mucosal layer contour; and mucosa and θ mucosa represent the radius and angle of the node relative to the center of the esophagus, respectively;

[0152] According to the control point features, two linear transformation layers are used to calculate the relative radius dR of the submucosal layer. submucosa and the relative radius dR of the outer membrane layer out , that is, dR submucosa = relu(W dR1 *F structure ) and dR out = relu(W dR2 *F structure ), and use the relu activation function to ensure that the predicted radius is a positive number, where W dR1 and W dR2 is a weight matrix of dimension [1, h], dR submucosa and dR outThe corresponding dimension is [B, n s , 1], indicating that n s The relative radius of the submucosal layer and adventitia corresponding to each control node;

[0153] The actual radius R of the submucosal layer is calculated based on the node coordinates and relative radius. submucosa and the actual radius R of the outer membrane layer out , that is, R submucosa =r mucosa +dR submucosa and R out =R submucosa +dR out ;

[0154] According to the actual radius and the angle of the node coordinates relative to the esophageal center, the control points corresponding to the control point features are converted from polar coordinates to Cartesian coordinates to obtain the control points of the three-layer esophageal structure (P mucosa , P submucosa and P out ).

[0155] The relative radius of the submucosal layer and the adventitia layer calculated in this embodiment has certain limitations and cannot accurately represent the distance between different layers of the mucosa. Therefore, on the basis of the relative radius, the actual radius is calculated in combination with the node coordinates, so that the degree of displacement of the contour line of the submucosal layer and the adventitia layer relative to the mucosal layer can be accurately represented.

[0156] S3.4. In order to simulate the growth of the tumor, it is necessary to predict the outward and inward growth of the tumor in the esophageal mucosal layer, that is, it is necessary to obtain the contour lines of the tumor in all directions, including S3.41 to S3.44, specifically:

[0157] S3.41. Define tumor characteristics F tumor =F structure ;

[0158] S3.42. Predict the radius difference of the tumor's outward growth contour relative to the mucosal layer, i.e. the relative radius of outward growth Specifically:

[0159] Through a linear transformation layer, F tumor The characteristics of are mapped to the relative radius (the first relative radius), that is, And the relu activation function is used to ensure the non-negativity of the relative radius; is a weight matrix with dimension [1, h];

[0160] Use the first relative radius and the radius r of the node coordinate relative to the center of the esophagus mucosa , calculate the actual radius of the tumor's outward growth contour Right now Furthermore, the angle corresponding to the actual radius of the tumor's outward growth contour is equal to the angle θ of the mucosal layer. mucosa ,Right now

[0161] S3.43. To ensure that the contour of the tumor's inward growth is always inside the mucosal layer, it is necessary to calculate the relative radius of the tumor inside. Right now:

[0162] Through a linear transformation layer, F tumor The characteristics of are mapped to the basic radius (the second relative radius), that is, And the relu activation function is used to ensure the non-negativity of the relative radius; is a weight matrix with dimension [1, h];

[0163] Use the second relative radius and the node coordinates relative to the radius T of the esophagus center mucosa , calculate the actual radius of the tumor's outward growth contour Right now Furthermore, ensure that the actual radius is greater than 0 and that the angle corresponding to the actual radius of the tumor's outward growth contour is equal to the angle θ of the mucosal layer. mucosa ,Right now

[0164] S3.44. According to the actual radius of the tumor's outward and inward growth contours and the angle of the mucosal layer, the coordinates of the node positions are transformed to obtain the control points of the tumor's outward and inward growth contours ( and ).

[0165] This embodiment S3.4 is the construction process of the control points of the tumor growth contour line. The conversion relationship between Cartesian coordinates and polar coordinates is referenced in the processing of control points. The advantages of Cartesian coordinates in terms of intuitive expression, concise description and accurate description can be utilized to make the calculation method of the tumor growth shape relatively simple, thereby being able to clearly describe the control points of the tumor growth contour line.

[0166] From an overall perspective, in this embodiment S3, by predicting the control points of the contour lines in the two dimensions of tumor outward growth and inward growth, the control points of the tumor outward and inward growth contour lines are obtained, which can fully obtain the characteristics of tumor growth and is conducive to the effective evaluation of the esophageal disease status.

[0167] S4. Generate cubic B-spline curves of the esophagus and the tumor according to the control points by means of spline interpolation.

[0168] In step S4 of the embodiment of the present invention, S4 includes S4.1 to S4.3; wherein S4.1 is a process of constructing the esophageal structure contour line, S4.2 is a process of constructing the tumor contour line, and S4.3 is a process of constructing a cubic B-spline curve, specifically:

[0169] S4.1. For each layer of the esophageal structure (including the mucosal layer, submucosal layer, and adventitia layer), there are corresponding control point coordinates. That is, the control points of the three-layer esophageal structure and the control points of the tumor's outward and inward growth contours; i =(x i ,y i ), (i=1,2,...,n s ) represents the Cartesian coordinates of the i-th control point;

[0170] The control points of the three-layer esophageal structure are processed using the cubic B-spline interpolation method to obtain the parameterized esophageal structure contour line S(t) = [x(t), y(t)]; the function S(t) represents the continuous contour line generated by the control points. If t is uniformly sampled with s points in [0,1], the number of nodes of each cubic B-spline curve is n spline =n s *s; thus we get the cubic B-spline curve S mucosa , S submucosa and S out , i.e. the outline of the esophageal structure;

[0171] Among them, the cubic B-spline curve is a piecewise function defined by a set of control points. Let A i (i=1, 2, 3, 4) are four basis functions of cubic B-spline, which are used for interpolation and fitting curves. Then the mathematical definition of curve S(t) is:

[0172] S(t)=A1P1+A2P2+A3P3+A4P4

[0173] For parameters A1, A2, A3 and A4:

[0174]

[0175]

[0176]

[0177]

[0178] Among them, S(t) is the point on the curve with parameter t∈[0,1], and P1, P2, P3 and P4 are the control points of the cubic B-spline.

[0179] S4.2. As described in S4.1, the control points of the tumor growth contour are processed using the cubic B-spline interpolation method (including outward growth and inward growth) to obtain a cubic B-spline curve. and That is, the tumor outline.

[0180] S4.3. Calculate the normal vector of each curve point on the esophageal structure contour line and the tumor contour line to obtain the unit vector of the normal line;

[0181] The cubic B-spline curves of the esophagus and the tumor are constructed by the esophageal structure contour line, the tumor contour line, and the unit vector of the normal line.

[0182] The specific process of obtaining the unit vector of the normal is as follows:

[0183] The tangent vector can be derived from the first derivative of the curve, that is, V = dy / dx;

[0184] The unit normal vector of a curve can be calculated by rotating the tangent vector 90 degrees counterclockwise; that is, in two dimensions, by flipping the x and y coordinates of the vector and changing the sign of one of the components, i.e.:

[0185]

[0186] For parameters and have:

[0187]

[0188]

[0189] Therefore, the normal vector is normalized based on the L2 norm to obtain the unit vector of the normal line.

[0190] To apply the embodiments of the present invention, please refer to Figure 4 , Figure 4 is a schematic diagram of a unit normal vector provided by an embodiment of the present invention, which shows the relationship between the unit vector of the normal line and the anatomical structure of the esophagus.

[0191] In this embodiment S4, by using control points as basic elements, discrete point data are connected into a curve, thereby obtaining a curve with high precision, convergence and accurate fitting as a structural contour line, and by combining normal vectors, a complete cubic B-spline curve is obtained, which can be used to accurately represent the shape of the esophagus and tumors.

[0192] S5. The tumor staging result is obtained by calculating the relative distance between the cubic B-spline curves.

[0193] In step S5 of the embodiment of the present invention, S5 includes S5.1 to S5.2; S5.1 is a process of constructing a tumor staging result, and S5.2 is a process of returning model data, specifically:

[0194] S5.1. The T stage of esophageal cancer is inferred based on the tissue structure invaded by the tumor. Therefore, the outward growth contour of the tumor can be calculated. Submucosa (S submucosa ) and the outer membrane layer (S out ) The relative distance D between the contour lines submucosa and D out To determine T stage Includes S5.11 to S5.18, specifically:

[0195] S5.11. Calculate the Euclidean distances between all points on curve A (the first contour line of tumor outward growth) and curve B (the second contour line of the submucosal layer) in the cubic B-spline curve to obtain a distance matrix;

[0196] S5.12. Find the distance and index of each point on curve A to the nearest point on curve B;

[0197] S5.13, according to the index of the nearest point, take the corresponding point from curve B and treat it as the point corresponding to the corresponding point in curve A;

[0198] S5.14, obtaining the normal vector of curve B at the nearest point;

[0199] S5.15. Calculate the direction vector from each point on curve A to the nearest point on curve B, and determine whether it is consistent with the normal vector at the nearest point on curve B;

[0200] S5.16. If it is determined that the point of curve A is inside curve B, the distance is taken as a negative number.

[0201] S5.17. Take the maximum value of the distance from each point on curve A to the nearest point on curve B as the measure of relative distance, and obtain a relative distance value set.

[0202] S5.18. In the relative distance value set, the relative distance between the tumor's outward growth contour and the submucosal layer is recorded as d1, and the relative distance between the tumor's outward growth contour and the adventitia layer is recorded as d2;

[0203] According to the numerical value of the relative distance between the outward growth contour of the tumor and the submucosal layer, and the numerical value of the relative distance between the outward growth contour of the tumor and the outer membrane layer, the tumor staging result, that is, the T stage of esophageal cancer, is obtained, which is specifically:

[0204] 1) If d1 < 0, the T stage is T1a, which means that when the tumor's outward growth contour is inside the mucosal layer, esophageal cancer is diagnosed as T1a.

[0205] 2) If d1 ≥ 0, and d2 < 0, and (|d1|) / (|d1|+|d2|) < threshold_ratio, the T stage is T1b, which means that when the tumor's outward growth contour is inside the submucosal layer but has broken through the mucosal layer, esophageal cancer is diagnosed as T1b.

[0206] 3) If d1≥0, and d2<0, and (|d1|) / (|d1|+|d2|)≥threshold_ratio, the T stage is T2, indicating that the tumor's outward growth outline has broken through the esophageal muscle layer but has not yet spread to adjacent lymph nodes or other structures. Esophageal cancer is diagnosed as T2.

[0207] 4) If d2 ≥ 0, the T stage is T3 or T4, which means that when the outward growth contour of the tumor has broken through the outer membrane layer, esophageal cancer is diagnosed as T3\4.

[0208] Among them, threshold_ratio represents the thickness of the submucosal layer, and the empirical value range is 0.05 to 0.2.

[0209] This embodiment S5.1 can accurately represent the distances between all points on the curve by constructing a distance matrix. By means of indexing, points on different curves can be associated with each other, so as to obtain the maximum distance from each point on the first contour line to the nearest point on the second contour line. Moreover, the relative distances in the relative distance value set can be positive or negative, so by judging the size of the value, the degree of tissue invasion between different membrane layers can be known, thereby obtaining the tumor staging result.

[0210] S5.2. After the above calculations, the model returns the cubic B-spline curve S of all structures. mucosa , S submucosa , S out , and Returns the differentiable mask Y of each structure diff-mask ; Return the relative distance D between the tumor and the submucosal layer and adventitia layer submucosa and D out , and T stage classification results

[0211] To apply the embodiments of the present invention, please refer to Figure 5 , Figure 5 This is a schematic diagram of the prediction process, which shows the general process of data prediction in this embodiment, specifically:

[0212] 1. Ultrasound endoscopic image: obtain the original ultrasound endoscopic image I.

[0213] 2. Effective area detection: Use the effective area detector to perform effective area detection on the original ultrasound endoscopy image I to obtain the effective ultrasound endoscopy image I valid .

[0214] 3. Backbone network: Use the backbone network composed of feature encoder and feature decoder to analyze the ultrasound endoscopy image I valid Processing is performed to obtain full-size features.

[0215] 4. Structural detection module: The structural detection module is used to process the full-size features to obtain the esophageal structure and tumor contour, that is, the cubic B-spline curve of the esophagus and the tumor.

[0216] 6. Rule-based T staging discrimination module: Use the structure detection module to process the cubic B-spline curve to obtain the T staging prediction result, that is, the tumor staging result.

[0217] In this embodiment S5, the traditional deep learning segmentation model cannot directly obtain the contour lines of each tissue structure, and requires a lot of post-processing and large amount of calculation; or chooses to use a deep learning classification model, which lacks interpretability. After obtaining the contour lines of each tissue structure, this embodiment S5 only needs rules to determine the T stage, and has strong clinical interpretability.

[0218] S6, the prediction results of esophageal structure, tumor contour and tumor stage are constructed by cubic B-spline curve and tumor stage results;

[0219] Among them, the preset model is a deep learning model composed of different devices and modules.

[0220] In step S6 of the embodiment of the present invention, S6 includes S6.1 to S6.5; wherein S6.1 is a process of constructing a prediction result, S6.2 is a process of constructing a mask of a tumor and an esophageal wall, S6.3 is a process of constructing a training set, S6.4 is a process of constructing a loss function, and S6.5 is a process of model training, specifically:

[0221] S6.1. The prediction results of esophageal structure, tumor contour and tumor stage are constructed by cubic B-spline curve and tumor stage results.

[0222] This embodiment S6.1 can achieve multi-task output within one training, including prediction of esophageal structure, tumor area and tumor T stage; this comprehensive technological innovation provides medical staff with more comprehensive and integrated diagnostic information, greatly improving the efficiency of ultrasound endoscopic image processing and diagnosis.

[0223] S6.2. First, create a blank differentiable image in the diffvg library Set the width to W, the height to H, and initialize all pixel values ​​to 0;

[0224] Then, a function y=M(S) is defined to generate a corresponding mask image; wherein S represents a closed cubic B-spline curve, and y represents a mask of a two-dimensional plane bitmap obtained after drawing a polygon;

[0225] Secondly, draw the mask of the tumor and esophageal wall, including S6.21 to S6.24, specifically:

[0226] S6.21. Tumor mask: using cubic B-spline contour of the tumor and Generate tumor mask Y tumor ,Right now

[0227] S6.22. Esophageal mucosal layer mask: Use the cubic B-spline contour of the esophageal mucosal layer to generate the esophageal mucosal layer mask Y mucosa , that is, Y mucosa =M(S mucosa ).

[0228] S6.23. Esophageal submucosal mask: The esophageal mucosal layer and the submucosal layer are used to generate the esophageal submucosal mask Y. submucosa , that is, Y submucosa =M(P submucosa )\M(S mucosa ).

[0229] S6.24, esophageal submucosal layer mask: Generate the esophageal exometrial layer mask Y according to the cubic B-spline contours of the esophageal exometrial layer and the submucosal layer. out , that is, Y out =M(S out )\M(S submucosa )\M(S mucosa ).

[0230] Among them, "\" represents the difference of sets, that is,

[0231] Finally, the four masks in S6.21 to S6.24 are combined to generate a 4-channel bitmap mask: Y diff-mask =[Y tumor , Y mucosa , Y submucosa , Y out ], that is, a mask of the tumor and the esophageal wall is obtained.

[0232] All operations in S6.2 of this embodiment are differential operations and can generate differential images.

[0233] S6.3, obtaining training data from esophageal cancer tumor cases;

[0234] Using the shapely library of python, the polygonal contour points of the mucosa layer, the submucosal layer and the adventitia layer are converted into shapely.geometry.polygon.LinearRing objects, and the tumor area is converted into a shapely.geometry.polygon.Polygon object to obtain the first transition data; and in the process of conversion, the legitimacy of the contour nodes is checked using the function of the shapely library, and the required number of nodes is calculated using the interpolate function of the shapely library;

[0235] Generates the contour point data S based on the first transition data contour , segmentation bitmap mask Y mask and staging label Y for endoscopic ultrasound images label The second transition data included;

[0236] The second transition data is subjected to data enhancement operations such as brightness contrast enhancement, rotation, horizontal flipping, vertical flipping, and zooming in and out to obtain a training set; wherein, when performing data enhancement operations such as rotation and other geometric deformations, it is necessary to perform Y contour and Y mask Perform synchronization operations to maintain data consistency;

[0237] The second transition data specifically includes:

[0238] 1) Contour point data: Contour point data S contour is the polygon object that has passed the validity check and recalculated using the interpolate function, that is, S contour ={S tumor , S structure}.

[0239] 2) Segmentation bitmap mask: Use the opencv library to convert the four contours into a 4-channel bitmap. The conversion logic is consistent with the above "Use the diffvg library to generate a differentiable mask" and use it as Y mask save.

[0240] 3) T stage label: The T stage label of each endoscopic ultrasound image is Y label , including four staging labels: T1a, T1b, T2 and T3\4.

[0241] S6.4. Calculate three loss functions, including S6.41 to S6.43, specifically:

[0242] S6.41. Use dice loss to measure the consistency between the segmentation mask predicted by the preset model and the actual segmentation mask. Perform dice loss calculation on the masks of the four channels to obtain the DICE loss function. The dice coefficient is a commonly used indicator to measure the similarity between two samples. Suppose the predicted segmentation mask is The actual segmentation mask is Y and the dice coefficient is:

[0243]

[0244] The closer the dice value is to 1, the more consistent the prediction is with the actual result. Therefore, the goal is to minimize 1-dice, that is, diceloss is defined as:

[0245] dice loss =1-dice

[0246] In this embodiment S6.41, Dice Loss can well reflect the matching degree between the predicted contour mask and the true contour mask.

[0247] S6.42. Use polygon loss poly loss to measure the error between the predicted node (the contour line is obtained by cubic B-spline interpolation) and the actual node, and obtain the polygon loss function; the polygon loss function is a loss function based on the mean square error (MSE).

[0248] Assume the predicted node is The actual contour node is S, and the poly loss is defined as:

[0249]

[0250] Among them, n spline represents the number of nodes of the cubic B-spline curve of the esophageal structure to be predicted, S i and are the coordinates of the i-th actual node and predicted node respectively.

[0251] S6.43. Use the class loss function based on the T stage label of esophageal cancer tumors to handle the four-classification problem, that is, the T stage label of esophageal cancer can be one of T1a, T1b, T2 and T3\4; define a multi-classification version of the distance margin loss to quantify the error between the T stage label predicted by the model and the actual T stage label, and set the goal to find the model parameters that minimize the Loss loss function to obtain the classification loss function;

[0252] Among them, threshold is a given margin value, specifically:

[0253]

[0254] The loss function is:

[0255] Loss = α1*dice loss +α2*poly loss +α3*class-loss

[0256] Among them, α1, α2 and α3 are the weight coefficients of dice loss, poly loss and class loss respectively.

[0257] In this embodiment S6.4, the DICE loss function can enhance the accuracy of recognition and positioning of specific targets, the polygon loss function can improve the prediction accuracy of esophageal and tumor contour nodes, and the classification loss function can improve the prediction accuracy of tumor staging results. Therefore, the loss functions established from different dimensions can significantly improve the optimization of the model and enhance the prediction accuracy of the preset model.

[0258] S6.5, set the batch size to 32, the epoch to 300, the initial learning rate to 10^-4, and reduce it to 1 / 10 every 100 epochs;

[0259] By optimizing the DICE loss function, polygon loss function, and classification loss function, a graphics processing unit (GPU) is used to update the parameters of the preset model according to the training set and the mask of the tumor and the esophageal wall to obtain an optimized preset model;

[0260] Moreover, the average dice of all masks obtained in the end is 0.76, and the average classification accuracy is 0.87.

[0261] In this embodiment S6.5, dice loss is used to optimize the contour line through differentiable rendering technology; compared with the traditional method of using only L2 loss or L1 loss for node optimization, the combination of L2 loss and dice loss can obtain a more accurate contour line, thereby improving the prediction ability of the preset model, so as to obtain more accurate prediction results of esophageal structure, tumor contour and stage in the future;

[0262] In addition, in the traditional mask conversion process, the open source computer vision library OpenCV is used to convert the node into a mask, but this conversion method does not have a gradient. Since the gradient is an important indicator for parameter evaluation and update, it can represent the direction and rate of change of the target function at a certain point. Therefore, the results obtained by the traditional mask conversion method cannot be used for neural network training; while the first embodiment of this invention generates a differentiable mask through the diffvg library, which can be used for neural network training, and uses dice loss as the loss function, which can make the similarity between the predicted segmentation result and the actual segmentation result higher and higher, so the preset model will be effectively trained to make the prediction results of the esophageal structure, tumor contour and staging more accurate.

[0263] Overall, this embodiment has the following beneficial effects:

[0264] This embodiment can remove redundant images by extracting features from the original ultrasound endoscopy images, thereby effectively ensuring the data accuracy of the ultrasound endoscopy images and reducing the complexity of data processing; by constructing control points of the three-layer esophageal structure and the tumor growth contour, the characteristics of tumor growth can be fully obtained, which is conducive to the effective evaluation of the esophageal disease state; by generating a cubic B-spline curve by spline interpolation, discrete point data can be connected into a curve to accurately represent the shape of the esophagus and the tumor; because the relative distance between the curves can represent the degree of tissue invasion between different membrane layers, the tumor staging result can be obtained quickly and conveniently.

[0265] Moreover, this embodiment successfully improves the accurate positioning of the model for the region of interest by introducing a positioning model for effective region detection, and overcomes the problem of relatively poor quality of the original data image. Secondly, based on the multi-layer polygon generation technology of Transformer, the organ structure is explicitly modeled and the anatomical prior knowledge is injected, so that this embodiment can generate esophageal wall structure contour prediction and tumor contour prediction results that are more in line with the anatomical structure, effectively solving the shortcomings of the existing technology in terms of structural accuracy and interpretability. In addition, the introduction of differentiable rendering technology successfully converts polygonal curves into bitmap masks with gradients, and the accuracy of the contours can be further improved by using dice loss while using L2 for node distance constraints. At the same time, due to the use of explicit cubic B-spline curves, while being able to accurately describe the esophageal and tumor structures, the T staging conclusion can be drawn based on their relative distance and simple rules. Such rules are also in line with the understanding of the diagnostic process by clinical medical staff, and can comprehensively improve the accurate segmentation and classification performance of ultrasound endoscopic images, providing a more reliable and interpretable basis for tumor localization and staging.

[0266] Embodiment 2:

[0267] See also Figure 6 , an embodiment of the present invention provides a prediction device for esophageal structure and tumor contour and staging, including a data module 10, a feature module 20, a node module 30, a curve module 40, a staging module 50 and an integration module 60;

[0268] Wherein, the data module 10 is used to obtain the original ultrasound endoscopy image;

[0269] A feature module 20 is used to extract features from the original ultrasound endoscopy image using a preset model to obtain full-size features;

[0270] A node module 30 is used to perform structural decomposition and node reconstruction on the full-size features using a preset model to obtain control points of the three-layer esophageal structure and tumor growth contour;

[0271] A curve module 40, for generating a cubic B-spline curve of the esophagus and the tumor according to the control points by means of spline interpolation;

[0272] The staging module 50 is used to obtain the tumor staging result by calculating the relative distance between the cubic B-spline curves;

[0273] An integration module 60, for forming a prediction result of esophageal structure, tumor contour and tumor stage from a cubic B-spline curve and the tumor stage result;

[0274] Among them, the preset model is a deep learning model composed of different devices and modules.

[0275] In one embodiment, the data module 10 is specifically:

[0276] An original endoscopic ultrasound image I is obtained; wherein the original endoscopic ultrasound image I refers to an image obtained by combining endoscopy and ultrasound to examine the digestive tract.

[0277] To apply the embodiments of the present invention, please refer to Figure 2 and Figure 3 , Figure 2 It is an anatomical structure diagram of the esophagus provided in an embodiment of the present invention, which shows the structure of the esophagus observable under ultrasonic endoscopy, which can be simplified into a three-layer tubular cavity structure composed of a mucosal layer, a submucosal layer and an adventitia layer, which are nested layer by layer; the formation of tumors usually starts in the esophageal mucosal layer and can grow in the cavity and outside the cavity.

[0278] Figure 3 This is a T staging structure diagram of esophageal cancer provided by an embodiment of the present invention, which shows the T staging division method of esophageal cancer. The T staging of a tumor is mainly determined according to the degree of its growth outside the cavity. For example, a T1a-level tumor is located between the mucosal layer and the submucosal layer, a T1b-level tumor has broken through the submucosal layer and grown outward, a T2-level tumor further extends to the deep layer of the esophageal wall, a T3-level tumor penetrates the outer membrane layer, and a T4-level tumor has penetrated the outer membrane layer and invaded external organs. Using an ultrasonic endoscope, the T1a, T1b, and T2 stages of a tumor and whether it is greater than or equal to the T3 stage can be identified.

[0279] In one embodiment, the feature module 20 includes a recognition unit and an extraction unit; wherein the recognition unit is used to obtain the effective ultrasound endoscopy image I valid The extraction unit is the process of constructing full-size features, specifically:

[0280] The recognition unit is used to input the original ultrasound endoscopy image I into the effective area detector of the preset model to identify the effective area boundary box, so as to obtain the bounding box of the effective area;

[0281] The recognition unit is also used to clip the bounding box of the effective area to obtain a valid ultrasound endoscopic image I valid .

[0282] Among them, the effective area detector can be implemented using target detection algorithms such as yolo or mask rcnn.

[0283] The recognition unit of this embodiment can remove redundant images by identifying and clipping the effective area boundary box, effectively ensuring the data accuracy of the ultrasound endoscopic image while reducing the complexity of data processing. Through feature extraction and upsampling, tumor-related features can be extracted from the effective ultrasound endoscopic image, so that features such as the size, shape and density of the tumor are included in the full-size features, which can better describe the detailed features of the original ultrasound endoscopic image.

[0284] The extraction unit is used to first extract the effective ultrasound endoscopy image I valid Input the feature encoder of the preset model for feature extraction, and the input matrix is ​​[B, C, H, W]; where [B, C, H, W] can take C = 3, H = W = 256;

[0285] Then, the feature decoder of the preset model is used to upsample the extracted features to obtain the full-size features of [B, h, H, W]; wherein [B, h, H, W] can take h = 64.

[0286] In addition, the feature encoder and feature decoder constitute the backbone network using the U-net network structure; the feature encoder can choose convolutional neural network CNN or Transformer as the feature extractor, and the feature decoder adopts the U-Net structure.

[0287] It should be noted that the preset model is a deep learning model composed of an effective area detector, a feature encoder, a feature decoder and a structure detection module.

[0288] In one embodiment, the node module 30 includes a dimension subunit, a construction subunit, a splicing subunit, a splitting subunit, a feature subunit, a coordinate and radius subunit, a control subunit, and a synthesis unit;

[0289] Among them, the dimension subunit, construction subunit, splicing subunit and splitting subunit are the processes of constructing global feature tokens, the feature subunit is the process of defining the features of the esophagus and tumor control points, the coordinate and radius subunit and the control subunit are the processes of constructing the control points of the three-layer esophageal structure, and the comprehensive unit is the process of constructing the control points of the tumor's outward and inward growth contours, specifically:

[0290] The dimension subunit is used to transform the full-size features of [B, h, H, W] into the dimensions of [B, HW, h] using the structure detection module of the preset model. Get the first token And for the first token Embed the corresponding coordinate position into positional embedding, where B represents the batch size, h represents the feature dimension, and H and W represent the height and width of the source matrix.

[0291] A construction subunit is used to construct a learnable second token according to the number of esophageal structure control points that need to be predicted in, The dimension is [B, n s ,h],n s Indicates the number of esophageal structure control points that need to be predicted;

[0292] The concatenation subunit is used to concatenate the first token and the second token to obtain a third token token. {0} ; Among them, the third token {0} The dimension is [B, n s +HW,h];

[0293] Split sub-unit, used to convert the third token {0} Input the L-layer Transformer module in the preset model to get the token {L} , and token {L} Re-split to obtain the global feature token ( and );in, The dimension is [B, n s ,h], indicating that the model will output n s esophageal / tumor control point features.

[0294] In this embodiment, the steps of dimension subunit, construction subunit, splicing subunit and splitting subunit performing dimension transformation, token construction, token splicing and token splitting on the full-size feature are the process of organizing and collecting the feature information in the full-size feature, so that the obtained global feature token has good invariance and intuitive representation while having global features, which helps to provide a solid data foundation for the later esophageal structure and tumor prediction.

[0295] In addition, this second embodiment introduces a Transformer-based multi-layer polygon generation technology to explicitly represent organs that conform to the anatomical structure. Through this representation method, the polygonal curves of the esophageal wall and tumor area are more consistent with the anatomical structure, which can effectively improve the structural accuracy and interpretability of the segmentation results, and provide medical staff with a more reliable basis for interpreting image data.

[0296] Characteristic subunit, used to make Using the first preset formula, the esophageal and tumor control point features F are calculated based on the global feature tokens. structure ; Among them, F structure The dimension is [B, n s , h];

[0297] Among them, the characteristics of esophagus and tumor control points are:

[0298] F structure =softmax(Q s ×K f T )×V f

[0299] The coordinate and radius subunit is used for the mucosal layer, submucosal layer and adventitia layer of the esophageal lumen. It is necessary to predict several nodes (control points) at their respective levels. These nodes will determine the shape of the cubic B-spline curve, thereby describing the contour of the esophageal structure. Therefore, for each esophageal control point, it is necessary to predict the node coordinates of the mucosal layer (expressed in Cartesian coordinates), the relative radius of the submucosal layer and the adventitia layer (the radius difference between the membrane layer distances). The specific steps are as follows:

[0300] Assume that the current esophageal structure is characterized by F structure , the dimension is [B, n s , h], where B is the batch size, n s is the number of esophageal structure control points that need to be predicted, and h is the feature dimension;

[0301] Use a linear transformation layer to transform n s The control point features of the esophagus and tumor control nodes F structure Mapped to two dimensions (2D), that is, P mucosa =W p *F structure ; and convert the mapping result into polar coordinates to obtain the node coordinates of the mucosal layer contour line (r mucosa ,θ mucosa ), where W p is a weight matrix of dimension [2, h], P mucosa The corresponding dimension is [B, n s , 2], represents n s The 2D coordinates of the control points of the mucosal layer contour; and mucosa and θ mucosa represent the radius and angle of the node relative to the center of the esophagus, respectively;

[0302] According to the control point features, two linear transformation layers are used to calculate the relative radius dR of the submucosal layer. submucosa and the relative radius dR of the outer membrane layer out , that is, dR submucosa = relu(W dR1 *F structure ) and dR out = relu(W dR2 *F structure), and use the relu activation function to ensure that the predicted radius is a positive number, where W dR1 and W dR2 is a weight matrix of dimension [1, h], dR submucosa and dR out The corresponding dimension is [B, n s , 1], indicating that n s The relative radius of the submucosal layer and adventitia corresponding to each control node;

[0303] The actual radius R of the submucosal layer is calculated based on the node coordinates and relative radius. submucosa and the actual radius R of the outer membrane layer out , that is, R submucosa =r mucosa +dR submucosa and R out =R submucosa +dR out ;

[0304] The control subunit is used to convert the control points corresponding to the control point features from polar coordinates to Cartesian coordinates according to the actual radius and the angle of the node coordinates relative to the esophageal center, and obtain the control points of the three-layer esophageal structure (P mucosa , P submucosa and P out ).

[0305] The relative radius of the submucosal layer and the adventitia layer calculated in this embodiment has certain limitations and cannot accurately represent the distance between different layers of the mucosa. Therefore, on the basis of the relative radius, the actual radius is calculated in combination with the node coordinates, so that the degree of displacement of the contour line of the submucosal layer and the adventitia layer relative to the mucosal layer can be accurately represented.

[0306] The comprehensive unit is used to simulate the growth of the tumor. It is necessary to predict the outward and inward growth of the tumor in the esophageal mucosa layer, that is, it is necessary to obtain the contour lines of the tumor in all directions; the comprehensive unit includes a definition subunit, a scale subunit, a growth subunit and a transformation subunit, specifically:

[0307] Define subunits and also define tumor features F tumor =F structure ;

[0308] The scale subunit is used to predict the radius difference of the tumor's outward growth contour relative to the mucosal layer, that is, the relative radius of outward growth Specifically:

[0309] Through a linear transformation layer, F tumor The characteristics of are mapped to the relative radius (the first relative radius), that is, And the relu activation function is used to ensure the non-negativity of the relative radius; is a weight matrix with dimension [1, h];

[0310] Use the first relative radius and the radius r of the node coordinate relative to the center of the esophagus mucosa , calculate the actual radius of the tumor's outward growth contour Right now Furthermore, the angle corresponding to the actual radius of the tumor's outward growth contour is equal to the angle θ of the mucosal layer. mucosa ,Right now

[0311] The growth subunit is used to ensure that the contour of the tumor's inward growth is always inside the mucosal layer. The relative radius of the tumor inside needs to be calculated. Right now:

[0312] Through a linear transformation layer, F tumor The characteristics of are mapped to the basic radius (the second relative radius), that is, And the relu activation function is used to ensure the non-negativity of the relative radius; is a weight matrix with dimension [1, h];

[0313] Use the second relative radius and the radius r of the node coordinate relative to the center of the esophagus mucosa , calculate the actual radius of the tumor's outward growth contour Right now Furthermore, ensure that the actual radius is greater than 0 and that the angle corresponding to the actual radius of the tumor's outward growth contour is equal to the angle θ of the mucosal layer. mucosa ,Right now

[0314] The conversion subunit is used to convert the coordinates of the node position according to the actual radius of the tumor's outward and inward growth contours and the angle of the mucosal layer to obtain the control points of the tumor's outward and inward growth contours ( and ).

[0315] The comprehensive unit of this embodiment is the construction process of the control points of the tumor growth contour. The conversion relationship between Cartesian coordinates and polar coordinates is referenced in the processing of control points. The advantages of Cartesian coordinates in terms of intuitive expression, concise description and accurate description can be utilized to make the calculation method of the tumor growth shape relatively simple, thereby being able to clearly describe the control points of the tumor growth contour.

[0316] From an overall perspective, the node module 30 of this embodiment predicts the control points of the contour lines in the two dimensions of tumor outward growth and inward growth, and obtains the control points of the tumor outward and inward growth contour lines, which can fully obtain the characteristics of tumor growth and is conducive to the effective evaluation of the esophageal disease status.

[0317] In one embodiment, the curve module 40 includes a parameter unit, a parameter deformation unit, a vector unit and an integration unit; wherein the parameter unit is a process of constructing the esophageal structure contour line, the parameter deformation unit is a process of constructing the tumor contour line, and the vector unit and the integration unit are processes of constructing a cubic B-spline curve, specifically:

[0318] Parameter unit, used for each layer of the esophageal structure (including mucosal layer, submucosal layer and adventitia layer), there are corresponding control point coordinates That is, the control points of the three-layer esophageal structure and the control points of the tumor's outward and inward growth contours; i =(x i ,y i ), (i=1,2,...,n s ) represents the Cartesian coordinates of the i-th control point;

[0319] The parameter unit is also used to process the control points of the three-layer esophageal structure using the cubic B-spline interpolation method to obtain a parameterized esophageal structure contour line S(t) = [x(t), y(t)]; the function S(t) represents a continuous contour line generated by the control points. If t is uniformly sampled with s points in [0, 1], the number of nodes of each cubic B-spline curve is n splie =n s *s; thus we get the cubic B-spline curve S mucosa , S submucosa and S out , i.e. the outline of the esophageal structure;

[0320] Among them, the cubic B-spline curve is a piecewise function defined by a set of control points. Let A i (i=1, 2, 3, 4) are four basis functions of cubic B-spline, which are used for interpolation and fitting curves. Then the mathematical definition of curve S(t) is:

[0321] S(t)=A1P1+A2P2+A3P3+A4P4

[0322] For parameters A1, A2, A3 and A4:

[0323]

[0324]

[0325]

[0326]

[0327] Among them, S(t) is the point on the curve with parameter t∈[0,1], and P1, P2, P3 and P4 are the control points of the cubic B-spline.

[0328] A parameter deformation unit is used to process the control points of the tumor growth contour (including outward growth and inward growth) using a cubic B-spline interpolation method as described in the parameter unit to obtain a cubic B-spline curve and That is, the tumor outline.

[0329] A vector unit is used to calculate the normal vector of each curve point on the esophageal structure contour line and the tumor contour line to obtain the unit vector of the normal line;

[0330] An integrated unit is used to construct cubic B-spline curves of the esophagus and the tumor from the esophageal structure contour and the tumor contour, as well as the unit vectors of the normal line.

[0331] The specific process of obtaining the unit vector of the normal is as follows:

[0332] The tangent vector can be derived from the first derivative of the curve, that is, V = dy / dx;

[0333] The unit normal vector of a curve can be calculated by rotating the tangent vector 90 degrees counterclockwise; that is, in two dimensions, by flipping the x and y coordinates of the vector and changing the sign of one of the components, i.e.:

[0334]

[0335] For parameters and have:

[0336]

[0337]

[0338] Therefore, the normal vector is normalized based on the L2 norm to obtain the unit vector of the normal line.

[0339] To apply the embodiments of the present invention, please refer to Figure 4 , Figure 4 is a schematic diagram of a unit normal vector provided by an embodiment of the present invention, which shows the relationship between the unit vector of the normal line and the anatomical structure of the esophagus.

[0340] In this embodiment S4, by using control points as basic elements, discrete point data are connected into a curve, thereby obtaining a curve with high precision, convergence and accurate fitting as a structural contour line, and by combining normal vectors, a complete cubic B-spline curve is obtained, which can be used to accurately represent the shape of the esophagus and tumors.

[0341] In one embodiment, the staging module 50 includes a staging unit and a return unit; the staging unit is a process of constructing tumor staging results, and the return unit is a process of returning model data, specifically:

[0342] The T stage for esophageal cancer is based on the tissue structure invaded by the tumor, so the tumor can be calculated by calculating the outward growth contour of the tumor. Submucosa (S submucosa ) and the outer membrane layer (S out ) The relative distance D between the contour lines submucosa and D out To determine T stage Specifically:

[0343] 1. Calculate the Euclidean distance between all points on curve A (the first contour line of tumor outward growth) and curve B (the second contour line of the submucosal layer) in the cubic B-spline curve to obtain a distance matrix;

[0344] 2. Find the distance and index of each point on curve A to the nearest point on curve B;

[0345] 3. According to the index of the nearest point, take the corresponding point from curve B and treat it as the point corresponding to the corresponding point in curve A;

[0346] 4. Get the normal vector of curve B at the nearest point;

[0347] 5. Calculate the direction vector from each point on curve A to the nearest point on curve B, and determine whether it is consistent with the normal vector at the nearest point on curve B:

[0348] 6. If the point of curve A is judged to be inside curve B, then the distance is taken as a negative number.

[0349] 7. Take the maximum value of the distance from each point on curve A to the nearest point on curve B as the measure of relative distance to obtain a relative distance value set.

[0350] 8. In the relative distance value set, the relative distance between the tumor's outward growth contour and the submucosal layer is recorded as d1, and the relative distance between the tumor's outward growth contour and the adventitia layer is recorded as d2;

[0351] 9. According to the numerical value of the relative distance between the outward growth contour of the tumor and the submucosal layer, and the numerical value of the relative distance between the outward growth contour of the tumor and the outer membrane layer, the tumor staging result, that is, the T stage of esophageal cancer, is obtained, which is specifically:

[0352] 1) If d1 < 0, the T stage is T1a, which means that when the tumor's outward growth contour is inside the mucosal layer, esophageal cancer is diagnosed as T1a.

[0353] 2) If d1 ≥ 0, and d2 < 0, and (|d1|) / (|d1|+|d2|) < threshold_ratio, the T stage is T1b, which means that when the tumor's outward growth contour is inside the submucosal layer but has broken through the mucosal layer, esophageal cancer is diagnosed as T1b.

[0354] 3) If d1≥0, and d2<0, and (|d1|) / (|d1|+|d2|)≥threshold_ratio, the T stage is T2, indicating that the tumor's outward growth outline has broken through the esophageal muscle layer but has not yet spread to adjacent lymph nodes or other structures. Esophageal cancer is diagnosed as T2.

[0355] 4) If d2 ≥ 0, the T stage is T3 or T4, which means that when the outward growth contour of the tumor has broken through the outer membrane layer, esophageal cancer is diagnosed as T3\4.

[0356] Among them, threshold_ratio represents the thickness of the submucosal layer, and the empirical value range is 0.05 to 0.2.

[0357] The staging unit of this embodiment can accurately represent the distances between all points on the curve by constructing a distance matrix. By means of indexing, points on different curves can be associated with each other, so as to obtain the maximum value of the distance from each point on the first contour line to the nearest point on the second contour line. Moreover, the relative distances in the relative distance value set can be positive or negative, so by judging the size of the value, the degree of tissue invasion between different membrane layers can be known, thereby obtaining the tumor staging result.

[0358] The return unit is used to make the model return the cubic B-spline curve S of all structures after the above calculation. mucosa , S submucosa , S out , and Returns the differentiable mask Y of each structure diff-mask ; Return the relative distance D between the tumor and the submucosal layer and adventitia layer submucosa and D out , and T stage classification results

[0359] To apply the embodiments of the present invention, please refer to Figure 5 , Figure 5 This is a schematic diagram of the prediction process, which shows the general process of data prediction in this embodiment, specifically:

[0360] 1. Ultrasound endoscopic image: obtain the original ultrasound endoscopic image I.

[0361] 2. Effective area detection: Use the effective area detector to perform effective area detection on the original ultrasound endoscopy image I to obtain the effective ultrasound endoscopy image I valid .

[0362] 3. Backbone network: Use the backbone network composed of feature encoder and feature decoder to analyze the ultrasound endoscopy image I valid Processing is performed to obtain full-size features.

[0363] 4. Structural detection module: The structural detection module is used to process the full-size features to obtain the esophageal structure and tumor contour, that is, the cubic B-spline curve of the esophagus and the tumor.

[0364] 6. Rule-based T staging discrimination module: Use the structure detection module to process the cubic B-spline curve to obtain the T staging prediction result, that is, the tumor staging result.

[0365] In the staging module 50 of the present embodiment, the traditional deep learning segmentation model cannot directly obtain the contours of each tissue structure, and requires a lot of post-processing and high computational complexity; or the deep learning classification model is used, which lacks interpretability. The staging module 50 of the present embodiment only needs rules to determine the T stage after obtaining the contours of each tissue structure, and has strong clinical interpretability.

[0366] In one embodiment, the integration module 60 includes S6.1 to S6.3; wherein the combination unit is a process of constructing a prediction result, the mask unit is a process of constructing a mask of a tumor and an esophageal wall, the training set unit is a process of constructing a training set, the calculation unit is a process of constructing a loss function, and the model training unit is a process of model training, specifically:

[0367] The combined unit is used to construct the prediction results of esophageal structure, tumor contour and tumor stage from the cubic B-spline curve and the tumor stage result.

[0368] The combined unit of this embodiment can achieve multi-task output within one training, including prediction of esophageal structure, tumor area and tumor T stage; this comprehensive technical innovation provides medical staff with more comprehensive and integrated diagnostic information, greatly improving the efficiency of ultrasound endoscopic image processing and diagnosis.

[0369] The mask unit is used to first create a blank differentiable image in the diffvg library Set the width to W, the height to H, and initialize all pixel values ​​to 0;

[0370] Then, a function y=M(S) is defined to generate a corresponding mask image; wherein S represents a closed cubic B-spline curve, and y represents a mask of a two-dimensional plane bitmap obtained after drawing a polygon;

[0371] Secondly, draw the mask of the tumor and the esophageal wall, including the first unit, the second unit, the third unit and the fourth unit, specifically:

[0372] Unit 1, for tumor masking: using cubic B-spline contours of the tumor and Generate tumor mask Y tumor ,Right now

[0373] The second unit is used for the esophageal mucosal layer mask: using the cubic B-spline contour of the esophageal mucosal layer, the esophageal mucosal layer mask Y is generated. mucosa , that is, Y mucosa =M(S mucosa ).

[0374] Unit 3, for esophageal submucosal mask: Generate esophageal submucosal mask Y using cubic B-spline contours of esophageal mucosal layer and submucosal layer submucosa , that is, Y submucosa =M(P submucosa )\M(S mucosa ).

[0375] Unit 4, for esophageal submucosal layer mask: Generate esophageal exometrial layer mask Y according to the cubic B-spline contours of the esophageal exometrial layer and submucosal layer out , that is, Y out =M(S out )\M(S submucosa )\M(S mucosa ).

[0376] Among them, "\" represents the difference of sets, that is,

[0377] Finally, the four masks in S6.21 to S6.24 are combined to generate a 4-channel bitmap mask: Y diff-mask =[Y tumor , Y mucosa , Y submucosa , Y out ], that is, a mask of the tumor and the esophageal wall is obtained.

[0378] All operations of the mask unit in this embodiment are differential operations, and can generate differential images.

[0379] A training set unit, used for obtaining training data from esophageal cancer tumor cases;

[0380] The training set unit is also used to use the shapely library of python to convert the polygonal contour points of the mucosa layer, the submucosal layer and the adventitia layer into shapely.geometry.polygon.LinearRing objects, and convert the tumor area into a shapely.geometry.polygon.Polygon object to obtain the first transition data; and, during the conversion process, the function of the shapely library is used to check the legitimacy of the contour nodes, and the interpolate function of the shapely library is used to calculate the required number of nodes;

[0381] The training set unit is further used to generate contour point data S according to the first transition data contour , segmentation bitmap mask Y mask and staging label Y for endoscopic ultrasound images label The second transition data included;

[0382] The training set unit is also used to perform data enhancement operations such as brightness contrast enhancement, rotation, horizontal flipping, vertical flipping, and zooming in and out on the second transition data to obtain a training set; wherein, when performing data enhancement operations such as rotation and other geometric deformations, it is necessary to perform Y contour and Y mask Perform synchronization operations to maintain data consistency;

[0383] The second transition data specifically includes:

[0384] 1) Contour point data: Contour point data S contour is the polygon object that has passed the validity check and recalculated using the interpolate function, that is, S contour ={S tumor , S structure}.

[0385] 2) Segmentation bitmap mask: Use the opencv library to convert the four contours into a 4-channel bitmap. The conversion logic is consistent with the above "Use the diffvg library to generate a differentiable mask" and use it as Y mask save.

[0386] 3) T stage label: The T stage label of each endoscopic ultrasound image is Y label , including four staging labels: T1a, T1b, T2 and T3\4.

[0387] The calculation unit is used to calculate three loss functions, including DICE loss unit, polygon loss unit and classification loss unit, specifically:

[0388] The DICE loss unit is used to use dice loss to measure the consistency between the segmentation mask predicted by the preset model and the actual segmentation mask. The dice loss is calculated for the masks of the four channels to obtain the DICE loss function. The dice coefficient is a commonly used indicator to measure the similarity between two samples. Suppose the predicted segmentation mask is The actual segmentation mask is Y and the dice coefficient is:

[0389]

[0390] The closer the dice value is to 1, the more consistent the prediction is with the actual result. Therefore, the goal is to minimize 1-dice, that is, diceloss is defined as:

[0391] dice loss =1-dice

[0392] In the DICE loss unit of this embodiment, Dice Loss can well reflect the matching degree between the predicted contour mask and the real contour mask.

[0393] The polygon loss unit is used to measure the error between the predicted node (the contour line is obtained by cubic B-spline interpolation) and the actual node using polygon loss poly loss to obtain a polygon loss function; wherein the polygon loss function is a loss function based on the mean square error (MSE).

[0394] Assume the predicted node is The actual contour node is S, and the poly loss is defined as:

[0395]

[0396] Among them, n spline represents the number of nodes of the cubic B-spline curve of the esophageal structure to be predicted, S i and are the coordinates of the i-th actual node and predicted node respectively.

[0397] The classification loss unit is used to process the four-classification problem using a class loss function based on the T stage label of esophageal cancer tumors, that is, the T stage label of esophageal cancer can be one of T1a, T1b, T2 and T3\4; the error between the T stage label predicted by the model and the actual T stage label is quantified by defining a multi-classification version of the distance margin loss, and the goal is set to find the model parameters that minimize the Loss loss function to obtain the classification loss function;

[0398] Among them, threshold is a given margin value, specifically:

[0399]

[0400] The loss function is:

[0401] Loss = α1*dice loss +α2*poly loss +α3*class_loss

[0402] Among them, α1, α2 and α3 are the weight coefficients of dice loss, poly loss and class loss respectively.

[0403] In the calculation unit of this embodiment, the DICE loss function can enhance the accuracy of recognition and positioning of specific targets, the polygonal loss function can improve the prediction accuracy of esophageal and tumor contour nodes, and the classification loss function can improve the prediction accuracy of tumor staging results. Therefore, the loss functions established from different dimensions can significantly improve the optimization of the model and enhance the prediction accuracy of the preset model.

[0404] Model training unit, used to set batch size to 32, epoch to 300, initial learning rate to 10^-4, and reduce it to 1 / 10 every 100 epochs;

[0405] The model training unit is further used to update the parameters of the preset model according to the training set and the mask of the tumor and the esophageal wall by optimizing the DICE loss function, the polygon loss function and the classification loss function, thereby obtaining an optimized preset model;

[0406] Moreover, the average dice of all masks obtained in the end is 0.76, and the average classification accuracy is 0.87.

[0407] The model training unit of this embodiment uses dice loss to optimize the contour line through differentiable rendering technology; compared with the traditional method of using only L2 loss or L1 loss for node optimization, the combination of L2 loss and dice loss can obtain more accurate contour lines, thereby improving the prediction ability of the preset model, so as to obtain more accurate prediction results of esophageal structure, tumor contour and stage in the future;

[0408] In addition, in the traditional mask conversion process, the open source computer vision library OpenCV is used to convert the node into a mask, but this conversion method does not have a gradient. Since the gradient is an important indicator for parameter evaluation and update, it can represent the direction and rate of change of the target function at a certain point. Therefore, the results obtained by the traditional mask conversion method cannot be used for neural network training; while the second embodiment of this invention generates a differentiable mask through the diffvg library, which can be used for neural network training, and uses dice loss as the loss function, which can make the similarity between the predicted segmentation result and the actual segmentation result higher and higher, so the preset model will be effectively trained to make the prediction results of the esophageal structure, tumor contour and staging more accurate.

[0409] Overall, this embodiment has the following beneficial effects:

[0410] This embodiment can remove redundant images by extracting features from the original ultrasound endoscopy images, thereby effectively ensuring the data accuracy of the ultrasound endoscopy images and reducing the complexity of data processing; by constructing control points of the three-layer esophageal structure and the tumor growth contour, the characteristics of tumor growth can be fully obtained, which is conducive to the effective evaluation of the esophageal disease state; by generating a cubic B-spline curve by spline interpolation, discrete point data can be connected into a curve to accurately represent the shape of the esophagus and the tumor; because the relative distance between the curves can represent the degree of tissue invasion between different membrane layers, the tumor staging result can be obtained quickly and conveniently.

[0411] Moreover, this embodiment successfully improves the accurate positioning of the model for the region of interest by introducing a positioning model for effective region detection, and overcomes the problem of relatively poor quality of the original data image. Secondly, based on the multi-layer polygon generation technology of Transformer, the organ structure is explicitly modeled and the anatomical prior knowledge is injected, so that this embodiment can generate esophageal wall structure contour prediction and tumor contour prediction results that are more in line with the anatomical structure, effectively solving the shortcomings of the existing technology in terms of structural accuracy and interpretability. In addition, the introduction of differentiable rendering technology successfully converts polygonal curves into bitmap masks with gradients, and the accuracy of the contours can be further improved by using dice loss while using L2 for node distance constraints. At the same time, due to the use of explicit cubic B-spline curves, while being able to accurately describe the esophageal and tumor structures, the T staging conclusion can be drawn based on their relative distance and simple rules. Such rules are also in line with the understanding of the diagnostic process by clinical medical staff, and can comprehensively improve the accurate segmentation and classification performance of ultrasound endoscopic images, providing a more reliable and interpretable basis for tumor localization and staging.

[0412] Embodiment three:

[0413] An embodiment of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium includes a stored computer program, wherein when the computer program is executed, the device where the computer-readable storage medium is located is controlled to execute the method for predicting the esophageal structure, tumor contour and stage;

[0414] Wherein, the method for predicting esophageal structure and tumor contour and staging, if implemented in the form of a software functional unit and used as an independent product, can be stored in a computer-readable storage medium. Based on such an understanding, the present invention implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Wherein, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, U disk, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electrical carrier signal, telecommunication signal and software distribution medium, etc.

[0415] The above are preferred embodiments 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 are also considered to be within the scope of protection of the present invention.

Claims

1. A method for predicting esophageal structure and tumor contour and staging, characterized in that: include: Obtain original endoscopic ultrasound images; Using a preset model to extract features from the original ultrasound endoscopy image to obtain full-size features; Use the preset model to perform structural decomposition and node reconstruction on the full-size feature to obtain control points of the three-layer esophageal structure and tumor growth contour; Generating cubic B-spline curves of the esophagus and the tumor according to the control points by means of spline interpolation; The tumor staging result is obtained by calculating the relative distance between the cubic B-spline curves; The cubic B-spline curve and the tumor staging result form a prediction result of the esophageal structure, tumor contour and tumor staging; Among them, the preset model is a deep learning model composed of different devices and modules.

2. A method for predicting esophageal structure, tumor contour and stage according to claim 1, characterized in that: The preset model is used to perform structural decomposition and node reconstruction on the full-size feature to obtain the control points of the three-layer esophageal structure and tumor growth contour, specifically: Using the structure detection module of the preset model, the full-size features are dimensionally transformed and split to obtain global feature tokens; The global feature token is combined with the preset esophageal and tumor control point features to obtain the control points of the three-layer esophageal structure through coordinate transformation; By performing feature mapping on the preset tumor features based on different radii, the control points of the tumor's outward and inward growth contours are obtained.

3. A method for predicting esophageal structure, tumor contour and stage according to claim 2, characterized in that: The global feature token is combined with the preset esophageal and tumor control point features to obtain the control points of the three-layer esophageal structure through coordinate transformation, specifically: Using a first preset formula, calculating the esophagus and tumor control point features according to the global feature tokens; Mapping the esophagus and tumor control point features using a linear transformation layer, and converting the mapping results into polar coordinates to obtain node coordinates of the mucosal layer contour line; According to the control point features, the relative radii of the submucosal layer and the adventitia layer are calculated using the linear transformation layer, and the actual radii of the submucosal layer and the adventitia layer are calculated according to the node coordinates and the relative radii; According to the actual radius and the angle of the node coordinates relative to the center of the esophagus, the control points corresponding to the control point features are converted into a form represented by Cartesian coordinates to obtain the control points of the three-layer esophagus structure.

4. A method for predicting esophageal structure, tumor contour and stage according to claim 3, characterized in that: By mapping the preset tumor features based on different radii, the control points of the tumor's outward and inward growth contours are obtained, specifically: define tumor characteristics; Mapping the tumor feature on a first radius scale and a second radius scale respectively to obtain a first relative radius and a second relative radius; The first relative radius and the second relative radius are used in sequence to calculate with the radius of the node coordinate relative to the center of the esophagus, to obtain the actual radii of the outward and inward growth contours of the tumor respectively; According to the actual radius of the tumor's outward and inward growth contours and the angle of the mucosal layer, coordinate transformation of the node position is performed to obtain the control points of the tumor's outward and inward growth contours.

5. The method for predicting esophageal structure, tumor contour and stage according to claim 1, characterized in that: By means of spline interpolation, cubic B-spline curves of the esophagus and the tumor are generated according to the control points, specifically: Using a cubic B-spline interpolation method to process the control points of the three-layer esophageal structure and tumor growth contour respectively, to obtain a parameterized esophageal structure contour line and a tumor contour line; On the esophageal structure contour line and the tumor contour line, calculating the normal vector of each curve point to obtain a unit vector of the normal line; The cubic B-spline curves of the esophagus and the tumor are constructed by the esophagus structure contour line, the tumor contour line, and the unit vector of the normal line.

6. A method for predicting esophageal structure, tumor contour and stage according to claim 1, characterized in that: The tumor staging result is obtained by calculating the relative distance between the cubic B-spline curves, specifically: According to the first contour line of the tumor outward growth and the second contour line of the submucosal layer in the cubic B-spline curve, constructing the Euclidean distance between all points on the curve to obtain a distance matrix; By indexing, performing distance calculation and normal vector judgment from the first contour line to the second contour line according to the distance matrix, obtaining the maximum distance from each point on the first contour line to the nearest point on the second contour line, and using the maximum distance as a relative distance value set; In the relative distance value set, the tumor staging result is obtained according to the numerical value of the relative distance between the tumor outward growth contour line and the submucosal layer, and the numerical value of the relative distance between the tumor outward growth contour line and the adventitia layer.

7. A method for predicting esophageal structure, tumor contour and stage according to claim 1, characterized in that: The preset model is used to extract features from the original ultrasound endoscopy image to obtain full-size features, specifically: Using the effective area detector of the preset model, identifying and cutting the effective area boundary box of the original ultrasound endoscopy image to obtain a valid ultrasound endoscopy image; The feature encoder and feature decoder of the preset model are used to perform feature extraction and upsampling on the effective ultrasound endoscopy image to obtain the full-size feature.

8. The method for predicting esophageal structure, tumor contour and stage according to claim 1, characterized in that: The preset model is a deep learning model composed of different devices and modules, and also includes: By measuring the consistency between the segmentation mask predicted by the preset model and the actual segmentation mask, a DICE loss function is obtained; By measuring the error between the predicted nodes and the actual nodes of the preset model, a polygon loss function is obtained; A classification loss function is obtained by quantifying the error between the T stage label predicted by the preset model and the actual T stage label; Using a preset training set and masks of the tumor and the esophageal wall, the preset model is trained according to the DICE loss function, the polygon loss function and the classification loss function to obtain an optimized preset model.

9. A prediction device for esophageal structure, tumor contour and staging, characterized in that: Including data module, feature module, node module, curve module, installment module and integration module; Wherein, the data module is used to obtain the original ultrasound endoscopy image; The feature module is used to extract features from the original ultrasound endoscopy image using a preset model to obtain full-size features; The node module is used to perform structural decomposition and node reconstruction on the full-size feature using the preset model to obtain control points of the three-layer esophageal structure and tumor growth contour; The curve module is used to generate a cubic B-spline curve of the esophagus and the tumor according to the control points by means of spline interpolation; The staging module is used to obtain a tumor staging result by calculating the relative distance between the cubic B-spline curves; The integrated module is used to construct the prediction results of esophageal structure, tumor contour and tumor staging based on the cubic B-spline curve and the tumor staging result; Among them, the preset model is a deep learning model composed of different devices and modules.

10. A storage medium, characterized in that: The storage medium stores a computer program, which is called and executed by a computer to implement the method for predicting esophageal structure, tumor contour and staging as described in any one of claims 1 to 8 above.

Citation Information

Patent Citations

  • Method and device for identifying esophageal endoscope image

    CN115311268A

  • Tumor radiotherapy target region identification method, system and equipment based on energy spectrum CT (Computed Tomography)

    CN117427286A