Method and system for classifying gastrointestinal metaplasia based on uncertainty and site semantic constraints
Patent Information
- Application Number
- CN202611136479.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-29
- Publication Date
- 2026-10-13
AI Technical Summary
[0004]本发明为了解决上述问题,提出了一种基于不确定性与部位语义约束的胃肠化生分级方法及系统,通过联合构建帧级置信度评估、解剖部位语义约束及时序一致性建模机制,有效解决胃镜视频中低质量帧干扰、非目标区域混杂以及帧间预测波动等问题,从而提高复杂临床场景下GIM分级结果的准确性和一致性
本发明通过获取待处理胃部内窥镜数据,并对其中的视频帧进行预测不确定性建模与特征分布偏移分析,生成帧置信度,能够从预测可靠性和特征分布一致性两个方面评价视频帧的可信程度,降低低质量帧或异常分布帧对后续处理结果的干扰;同时,通过构建针对胃部的解剖部位语义原型,并根据视频帧与各解剖部位语义原型之间的语义相似度计算语义相关性权重,能够筛选出与目标解剖部位相关的关键部位帧,减少非目标解剖区域帧对胃肠化生分级判断的影响;进一步地,基于帧置信度和语义相关性权重对关键诊断部位帧的邻域视频帧预测结果进行时序融合,能够综合利用相邻视频帧之间的连续性信息,降低单帧预测误差和短时预测波动;并结合胃部解剖拓扑结构对异常类别跳变进行修正,使每一视频帧的帧级预测类别更加符合胃部解剖部位之间的空间连续关系;最后,基于每一视频帧的帧级预测类别结果,对多个关键解剖部位对应的关键部位帧进行分组统计与加权融合处理,能够将分散的帧级预测结果转化为稳定的胃肠化生分级结果,从而提高胃肠化生分级的准确性、鲁棒性和时序一致性。
Smart Images

Figure CN122906457A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of medical image processing technology, specifically to a method and system for classifying gastrointestinal metaplasia based on uncertainty and semantic constraints of location. Background Technology
[0002] Gastrointestinal metaplasia (GIM) is an important precancerous lesion in the development of gastric cancer, and its grading results are of great significance for early gastric cancer risk assessment, clinical follow-up, and intervention strategy formulation. Endoscopic data from the stomach can provide information on gastric mucosal microstructure, microvascular morphology, lesion distribution, and anatomical changes, providing a data foundation for the automated grading of GIM.
[0003] Existing deep learning methods for classifying gastrointestinal metaplasia based on endoscopy videos typically extract features and predict classifications from video frames, then aggregate the prediction results from multiple video frames to obtain a video-level classification result. However, during actual endoscopy examinations, factors such as endoscope movement, changes in viewing angle, reflection, blurring, occlusion, and fluctuations in imaging conditions can lead to low prediction reliability or abnormal feature distribution in some video frames. Low-quality or abnormally distributed frames can easily interfere with subsequent classification results. Furthermore, since endoscopy videos cover multiple anatomical regions, using all video frames for classification analysis of gastrointestinal metaplasia can easily introduce irrelevant information from non-target anatomical regions, weakening key features related to GIM classification and thus interfering with classification judgment. In addition, although there is a certain temporal correlation between adjacent video frames, independent prediction of a single frame is easily affected by image quality fluctuations and local visual interference, leading to unstable changes in prediction results between adjacent frames, and even abnormal category jumps that do not conform to the spatial continuity of gastric anatomical locations, resulting in a lack of consistent expression in the prediction sequence. Summary of the Invention
[0004] To address the aforementioned issues, this invention proposes a gastrointestinal metaplasia grading method and system based on uncertainty and site semantic constraints. By jointly constructing frame-level confidence assessment, anatomical site semantic constraints, and time-series consistency modeling mechanisms, it effectively solves problems such as low-quality frame interference, non-target region clutter, and inter-frame prediction fluctuations in gastroscopy videos, thereby improving the accuracy and consistency of GIM grading results in complex clinical scenarios.
[0005] To achieve the above objectives, the present invention adopts the following technical solution: The first aspect of this invention provides a method for grading gastrointestinal metaplasia based on uncertainty and site semantic constraints, comprising the following steps: Acquire gastrointestinal endoscopic data to be processed; Uncertainty modeling and feature distribution shift analysis are performed on video frames in the acquired gastrointestinal endoscopy data to generate frame confidence scores; Construct semantic prototypes of anatomical parts for the stomach, calculate semantic relevance weights based on semantic similarity between video frames and semantic prototypes of each anatomical part, and filter key part frames related to the target anatomical part. Based on frame confidence and semantic relevance weights, the prediction results of neighboring video frames of key diagnostic sites are temporally fused, and the abnormal category jumps are corrected by combining the gastric anatomical topology to obtain the frame-level predicted category of each video frame. Based on the frame-level prediction category results of each video frame, the frame-level prediction category results of key site frames corresponding to multiple key anatomical sites are grouped, statistically analyzed, and weighted and fused to generate the gastrointestinal metaplasia grading results.
[0006] A further technical solution involves performing prediction uncertainty modeling and feature distribution shift analysis on the video frames in the acquired gastrointestinal endoscopy data to generate frame confidence scores, including the following steps: Based on Dirichlet evidence theory, nonlinear evidence mapping processing is performed on video frames to construct a Dirichlet distribution, and the uncertainty index of the video frame is calculated according to the total amount of evidence corresponding to the Dirichlet distribution. Based on the feature representation of video frames, a local distribution reference center within a batch is constructed, and the feature outlier of the video frame is calculated according to the degree of offset between the features of a single frame and the local distribution reference center within the batch. The uncertainty index of a video frame is fused with the outlier of the feature to obtain the frame confidence of the video frame.
[0007] A further technical solution involves performing nonlinear evidence mapping on video frames based on Dirichlet evidence theory, constructing a Dirichlet distribution, and calculating the uncertainty index of the video frames based on the total amount of evidence corresponding to the Dirichlet distribution, including: For the t-th frame of the input image The corresponding logits vector Nonlinear evidence mapping is performed to obtain the evidence values corresponding to each category. ; Based on the evidence values corresponding to each category Construct the concentration parameters of the Dirichlet distribution. , obtain the input image of frame t The corresponding Dirichlet distribution; For the t-th frame of the input image Concentration parameters of each category in the corresponding Dirichlet distribution Summation is performed to obtain the input image of frame t. Corresponding total amount of evidence ; Based on the input image of frame t Corresponding total amount of evidence Calculate the input image of frame t. Uncertainty indicators .
[0008] A further technical solution involves constructing intra-batch local distribution reference centers based on the feature representations of video frames, and calculating the feature outlier of the video frame according to the offset between the features of a single frame and the intra-batch local distribution reference centers, including: For the acquired small batch of video frames, a feature extractor is used to extract features and construct a set of feature representations. The mean value of features within a batch is calculated based on the feature representation set and used as a reference center for the local distribution within the batch. Calculate the distance between the feature vector of a single frame and the local distribution reference center within the batch to obtain the feature offset of the corresponding video frame; The feature offset is normalized to obtain the feature outlier of the video frame.
[0009] A further technical solution involves constructing semantic prototypes of anatomical sites and, based on the semantic similarity between video frames and these prototypes, filtering key site frames related to the target anatomical site, including: The mean of the sample features corresponding to each anatomical part category is aggregated to construct the semantic prototype of each anatomical part category. Extract feature representations of each video frame from the gastroscopy video data to be processed, and calculate the semantic similarity between the feature representations of each video frame and the semantic prototypes of each anatomical site category; For the current video frame, the maximum semantic similarity value is selected as the maximum semantic response value. Based on a preset threshold, it is determined whether the current video frame belongs to the target anatomical part. Frames of the target anatomical part are assigned semantic relevance weights, while frames of non-target regions are assigned zero weights. In this way, key part frames related to the target anatomical part are selected.
[0010] A further technical solution involves temporally fusing the prediction results of neighboring video frames of key diagnostic sites based on frame confidence and semantic relevance weights, and correcting for abnormal category jumps by incorporating the gastric anatomical topology. The resulting frame-level predicted category for each video frame includes the following steps: The frame confidence weight and semantic relevance weight are combined to form a unified frame-level fusion weight. A temporal neighborhood window is constructed centered on each key diagnostic site video frame. Based on the temporal distance between the neighboring frames and the current frame and the corresponding frame-level fusion weights, contribution weights are assigned to each neighboring frame. Based on the contribution weights, the classification probabilities of each video frame in the neighborhood are weighted and fused to generate the temporal augmentation classification probability of the current video frame, thereby obtaining the initial temporal prediction category. Based on the temporal augmentation classification probability and the initial temporal predicted category, and combined with the anatomical topological relationship between typical anatomical parts of the stomach, the abnormal category transfer that does not conform to anatomical continuity between adjacent video frames is corrected to obtain the corrected frame-level predicted category.
[0011] A further technical solution, based on temporal augmentation classification probability and initial temporal predicted category, combined with the anatomical topological relationship between typical anatomical parts of the stomach, corrects abnormal category transfers that do not conform to anatomical continuity between adjacent video frames, resulting in corrected frame-level predicted categories. The specific implementation process is as follows: Pre-construct a set of invalid transfer relationships between typical anatomical sites of the stomach; Determine if there is an invalid transition between the predicted categories of adjacent video frames; when an invalid transition is detected and the prediction confidence of the current video frame is lower than a preset threshold, correct the prediction category of the current video frame to the prediction category of the previous video frame; otherwise, retain the current prediction result and obtain the frame-level prediction category result for each video frame.
[0012] A second aspect of the present invention provides a grading system for gastrointestinal metaplasia based on uncertainty and site semantic constraints, comprising: The data acquisition module is configured to acquire gastrointestinal endoscopy data to be processed; The frame confidence calculation module based on uncertainty perception is configured to perform prediction uncertainty modeling and feature distribution shift analysis on video frames in the acquired gastrointestinal endoscopy data to generate frame confidence. The semantic constraint module based on anatomical location priors is configured to construct anatomical location semantic prototypes for the stomach, calculate semantic relevance weights based on the semantic similarity between video frames and each anatomical location semantic prototype, and filter key location frames related to the target anatomical location. The anatomical structure constraint module based on temporal consistency is configured to perform temporal fusion of the prediction results of neighboring video frames of key diagnostic site frames based on frame confidence and semantic relevance weights, and to correct abnormal category jumps by combining the gastric anatomical topology to obtain the frame-level predicted category of each video frame. The risk assessment module is configured to perform grouped statistical and weighted fusion processing on the frame-level prediction category results of key site frames corresponding to multiple key anatomical sites based on the frame-level prediction category results of each video frame, and generate gastrointestinal metaplasia grading results.
[0013] A further technical solution, a frame confidence calculation module based on uncertainty awareness, is configured to perform the following process: Based on Dirichlet evidence theory, nonlinear evidence mapping processing is performed on video frames to construct a Dirichlet distribution, and the uncertainty index of the video frame is calculated according to the total amount of evidence corresponding to the Dirichlet distribution. Based on the feature representation of video frames, a local distribution reference center within a batch is constructed, and the feature outlier of the video frame is calculated according to the degree of offset between the features of a single frame and the local distribution reference center within the batch. The uncertainty index of a video frame is fused with the outlier of the feature to obtain the frame confidence of the video frame.
[0014] A further technical solution, based on a semantic constraint module with prior knowledge of anatomical locations, is configured to perform the following process: The mean of the sample features corresponding to each anatomical part category is aggregated to construct the semantic prototype of each anatomical part category. Extract feature representations of each video frame from the gastroscopy video data to be processed, and calculate the semantic similarity between the feature representations of each video frame and the semantic prototypes of each anatomical site category; For the current video frame, the maximum semantic similarity value is selected as the maximum semantic response value. Based on the preset threshold, it is determined whether the current video frame belongs to the target anatomical part. Frames of the target anatomical part are assigned semantic relevance weights, while frames of non-target regions are assigned zero weights, thereby filtering out key part frames related to the target anatomical part. The anatomical constraint module based on temporal consistency is configured to execute the following process: The frame confidence weight and semantic relevance weight are combined to form a unified frame-level fusion weight. A temporal neighborhood window is constructed centered on each key diagnostic site video frame. Based on the temporal distance between the neighboring frames and the current frame and the corresponding frame-level fusion weights, contribution weights are assigned to each neighboring frame. Based on the contribution weights, the classification probabilities of each video frame in the neighborhood are weighted and fused to generate the temporal augmentation classification probability of the current video frame, thereby obtaining the initial temporal prediction category. Based on the temporal augmentation classification probability and the initial temporal predicted category, and combined with the anatomical topological relationship between typical anatomical parts of the stomach, the abnormal category transfer that does not conform to anatomical continuity between adjacent video frames is corrected to obtain the corrected frame-level predicted category.
[0015] Compared with the prior art, the beneficial effects of the present invention are as follows: This invention acquires gastric endoscopy data to be processed and performs prediction uncertainty modeling and feature distribution shift analysis on the video frames to generate frame confidence. This allows for the evaluation of the credibility of video frames from two aspects: prediction reliability and feature distribution consistency, reducing the interference of low-quality or abnormally distributed frames on subsequent processing results. Simultaneously, by constructing semantic prototypes for anatomical locations of the stomach and calculating semantic relevance weights based on the semantic similarity between video frames and these prototypes, key frames related to the target anatomical location can be selected, reducing the impact of non-target anatomical region frames on the determination of gastrointestinal metaplasia grading. Furthermore, based on frame confidence and semantic relevance... The method employs temporal fusion of prediction results for neighboring video frames of key diagnostic sites using weighted methods. This approach comprehensively utilizes the continuity information between adjacent video frames, reducing single-frame prediction errors and short-term prediction fluctuations. Furthermore, it incorporates the gastric anatomical topology to correct abnormal category jumps, ensuring that the frame-level prediction category of each video frame better aligns with the spatial continuity between gastric anatomical sites. Finally, based on the frame-level prediction category results of each video frame, the method performs grouped statistical and weighted fusion processing on key site frames corresponding to multiple key anatomical sites. This transforms scattered frame-level prediction results into stable gastrointestinal metaplasia grading results, thereby improving the accuracy, robustness, and temporal consistency of gastrointestinal metaplasia grading.
[0016] The advantages of the present invention, as well as its additional advantages, will be described in detail in the following specific embodiments. Attached Figure Description
[0017] The accompanying drawings, which form part of this invention, are used to provide a further understanding of the invention. The illustrative embodiments of the invention and their descriptions are used to explain the invention and do not constitute a limitation thereof.
[0018] Figure 1 This is a flowchart of the gastrointestinal metaplasia grading method based on uncertainty and site semantic constraints according to Embodiment 1 of the present invention; Figure 2 This is a schematic diagram of the model structure of the GIM hierarchical model in Embodiment 1 of the present invention; Detailed Implementation The present invention will be further described below with reference to the accompanying drawings and embodiments.
[0019] It should be noted that the following detailed descriptions are exemplary and intended to provide further illustration of the invention. Unless otherwise specified, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains.
[0020] It should be noted that the terminology used herein is for describing particular embodiments only and is not intended to limit the exemplary embodiments of the present invention. As used herein, the singular form is intended to include the plural form as well, unless the context clearly indicates otherwise. Furthermore, it should be understood that when the terms "comprising" and / or "including" are used in this specification, they indicate the presence of features, steps, operations, devices, components, and / or combinations thereof. It should be noted that, without conflict, the various embodiments and features within those embodiments can be combined with each other. The embodiments will now be described in detail with reference to the accompanying drawings.
[0021] Example 1 In one or more of the technical solutions disclosed in the embodiments, such as Figures 1 to 2 As shown, a method for grading gastrointestinal metaplasia based on uncertainty and semantic constraints of location includes the following steps: Step S1, Data Acquisition: Acquire the gastrointestinal endoscopic data to be processed; Specifically, gastrointestinal endoscopy data can include gastrointestinal endoscopy image data and gastroscopy video data; Step S2, Frame confidence calculation based on uncertainty perception: Perform prediction uncertainty modeling and feature distribution shift analysis on the video frames in the acquired gastrointestinal endoscopy data to generate frame confidence; Step S3: Semantic constraints based on prior knowledge of anatomical locations: Construct semantic prototypes of anatomical locations for the stomach, calculate semantic relevance weights based on the semantic similarity between video frames and semantic prototypes of each anatomical location, and filter key location frames related to the target anatomical location. Step S4: Anatomical structure constraint based on temporal consistency: Based on frame confidence and semantic relevance weight, temporal fusion is performed on the prediction results of neighboring video frames of key diagnostic site frames, and the abnormal category jump is corrected by combining the gastric anatomical topology to obtain the frame-level prediction category of each video frame. Step S5: Based on the frame-level prediction category results of each video frame, perform grouping, statistical and weighted fusion processing on the frame-level prediction category results of key site frames corresponding to multiple key anatomical sites to generate gastrointestinal metaplasia grading results. This embodiment's method acquires gastric endoscopy data to be processed and performs prediction uncertainty modeling and feature distribution offset analysis on the video frames to generate frame confidence. This allows for the evaluation of video frame reliability from both prediction reliability and feature distribution consistency perspectives, reducing the interference of low-quality or abnormally distributed frames on subsequent processing results. Simultaneously, by constructing semantic prototypes for anatomical locations of the stomach and calculating semantic relevance weights based on the semantic similarity between video frames and these prototypes, key frames related to the target anatomical location can be selected, reducing the impact of non-target anatomical region frames on the grading of gastrointestinal metaplasia. Furthermore, based on frame confidence and... Semantic relevance weighting is used to temporally fuse the prediction results of neighboring video frames for key diagnostic sites. This approach comprehensively utilizes the continuity information between adjacent video frames, reducing single-frame prediction errors and short-term prediction fluctuations. Furthermore, it incorporates the gastric anatomical topology to correct abnormal category jumps, making the frame-level prediction category of each video frame more consistent with the spatial continuity between gastric anatomical sites. Finally, based on the frame-level prediction category results of each video frame, key site frames corresponding to multiple key anatomical sites are grouped, statistically analyzed, and weighted to transform scattered frame-level prediction results into stable gastrointestinal metaplasia grading results, thereby improving the accuracy and temporal consistency of gastrointestinal metaplasia grading.
[0022] The above steps are achieved through the constructed GIM grading model, which can be abbreviated as UAPT-Net (Temporal Gastric Intestinal Metaplasia Grading Based on Uncertainty-Aware and Anatomical Region Prior Semantic), and its structure is as follows. Figure 2 As shown, it includes a feature extractor, a frame confidence calculation module based on uncertainty awareness, a semantic constraint module based on anatomical site priors, an anatomical structure constraint module based on temporal consistency, and a risk assessment module. The feature extractor is used to extract features from the input image and video frames to obtain the feature representation of the current video frame. Optionally, the feature extractor can be a convolutional neural network (CNN). The frame confidence calculation module based on uncertainty perception is configured to perform prediction uncertainty modeling and feature distribution shift analysis on video frames in the acquired gastrointestinal endoscopy data to generate frame confidence. The semantic constraint module based on anatomical location priors is configured to construct anatomical location semantic prototypes for the stomach, calculate semantic relevance weights based on the semantic similarity between video frames and each anatomical location semantic prototype, and filter key location frames related to the target anatomical location. The anatomical structure constraint module based on temporal consistency is configured to perform temporal fusion of the prediction results of neighboring video frames of key diagnostic site frames based on frame confidence and semantic relevance weights, and to correct abnormal category jumps by combining the gastric anatomical topology to obtain the frame-level predicted category of each video frame. The risk assessment module is configured to perform grouped statistical and weighted fusion processing on the frame-level prediction category results of key parts frames corresponding to multiple key anatomical parts based on the frame-level prediction category results of each video frame, and generate gastrointestinal metaplasia grading results. In step S1, the gastrointestinal endoscopy data may include gastrointestinal endoscopy image data and gastroscopy video data, which can be obtained through endoscopy in the prediction of actual scenarios. The gastroscopy data used in the training process are all derived from publicly available medical imaging data resources, and do not involve any patient personal information or privacy data. They are suitable for non-clinical diagnostic purposes such as scientific research, algorithm training, and model validation. Specifically, the gastroscopy image data comes from publicly released static image datasets of gastrointestinal endoscopy. These datasets are constructed and made publicly available by research institutions or academic organizations. The image data has been anonymized and desensitized, and its collection, annotation, and release processes comply with public data usage guidelines. It can be used for pre-training and feature learning of computer vision models. The gastroscopy video data comes from publicly released gastrointestinal endoscopy video datasets or multi-center clinical imaging data resources. This type of data typically consists of continuous video frames, covering the entire gastroscopy examination process, including multiple typical anatomical locations such as the gastric antrum, gastric angle, and gastric body, and reflecting imaging changes and operational processes in a real clinical environment. It is used to model video-level temporal features and anatomical structural changes.
[0023] Optionally, the selected dataset of gastric endoscopy image data can include multiple categories of color static images, covering normal gastric mucosal structures and various common pathological manifestations. These categories include, but are not limited to, gastric anatomical landmarks, inflammatory lesions, polypoid lesions, ulcerative lesions, and images related to endoscopic procedures. The number of images in each category is kept relatively or nearly balanced after preprocessing, and the image resolution covers a range from medium to high resolution to adapt to the input requirements of different deep learning model structures. Image labels are annotated or reviewed by professionals with medical backgrounds to ensure consistency and reliability of annotation.
[0024] Optionally, the selected dataset of gastroscopy video data includes large-scale continuous endoscopic video sequences and corresponding frame-level or weak label information. This type of data usually contains both labeled and unlabeled samples. The labeled data can be used for supervised learning training, while the unlabeled data can be used for model generalization ability evaluation or adaptive feature learning. The video data covers multiple anatomical sites and various pathological states, and has significant class imbalance features and imaging quality differences, which is closer to the real clinical gastroscopy examination environment.
[0025] In one alternative implementation, gastrointestinal endoscopy data can be obtained from data resources collected jointly by multiple medical institutions. The data acquisition equipment and operating environment vary, including different models of endoscopes, different lighting conditions, and different operator habits, resulting in a highly diverse and complex data distribution. This type of data is suitable for evaluating the robustness, generalization ability, and cross-domain adaptability of the model in complex clinical scenarios.
[0026] The gastroscopy image data and gastroscopy video data obtained through the above methods can be used as input data sources for pre-training and video-level modeling in this embodiment, respectively. It should be noted that while both image data and video data in this embodiment originate from gastroscopy videos, they are clearly distinguished in terms of data organization and modeling purpose. Specifically, image data refers to a collection of non-continuous static images selected from video data; this data is used for frame-level feature representation learning, uncertainty analysis, and anatomical semantic constraint modeling. Video data, on the other hand, refers to the original gastroscopy video sequence, which, after decoding, yields a temporally continuous frame sequence used for temporal feature modeling and video-level GIM hierarchical decision-making.
[0027] Step S2 is the frame confidence calculation module based on uncertainty perception. Based on Dirichlet evidence theory and feature distribution shift modeling, it performs prediction uncertainty modeling and feature distribution shift analysis on the video frames in the acquired gastrointestinal endoscopy data to generate frame confidence, thereby reducing the impact of low-quality frames on subsequent semantic modeling and temporal analysis. It includes the following steps: Step S21, Dirichlet Uncertainty Modeling: Based on Dirichlet evidence theory, nonlinear evidence mapping is performed on video frames to construct a Dirichlet distribution. The uncertainty index of the video frames is then calculated based on the total amount of evidence corresponding to the Dirichlet distribution, including: Step S211: Input image for frame t The corresponding logits vector Nonlinear evidence mapping is performed to obtain the evidence values corresponding to each category. ; Among them, each category refers to the model's preset output category related to the gastrointestinal metaplasia (GIM) classification task, i.e., the GIM classification category.
[0028] Specifically, for the first Frame input The corresponding logits vector is: ; in, This represents the total number of gastrointestinal metaplasia grading categories; logits refer to the original predicted scores for each category output by the model before probability normalization. A non-linear mapping is performed on the logits to convert them into evidence, which characterizes the degree of support for each category. (1); in, Indicates the first The strength of support for each category, i.e., the evidence value; Through the above processing, the evidence values can be kept non-negative while preserving the relative magnitude relationship of the original logits vector, thus providing evidence input that meets the value requirements for subsequent Dirichlet distribution modeling.
[0029] Step S212: Based on the evidence values corresponding to each category Construct the concentration parameters of the Dirichlet distribution. , obtain the input image of frame t The corresponding Dirichlet distribution: (2); in, Indicates the first The concentration parameters corresponding to each category. Therefore, the input image in frame t. The frame-level prediction result is represented by the parameter as The Dirichlet distribution.
[0030] Step S213: Input image for frame t Concentration parameters of each category in the corresponding Dirichlet distribution Summation is performed to obtain the input image of frame t. Corresponding total amount of evidence : (3); , The total amount of evidence reflects the overall support level of the current frame across all categories.
[0031] Through the above processing, the strength of evidence from various categories can be aggregated into a unified frame-level evidence index. When When the value is large, it indicates that sufficient discriminative evidence has been accumulated for the current frame, and the prediction result is relatively reliable; when... When the value is small, it indicates a lack of effective discriminative information, and the uncertainty of the prediction result for the current frame is high.
[0032] Step S214: Input image based on frame t Corresponding total amount of evidence Calculate the input image of frame t. Uncertainty indicators ; (4); in, This represents the prediction uncertainty index for the t-th video frame. To prevent tiny constants with a denominator of zero.
[0033] Through the above processing, the uncertainty index is reduced. With total amount of evidence They are inversely proportional; when there is strong consistency in the current frame and a lot of evidence has accumulated, A smaller value indicates that the prediction for the current frame is more reliable; if the current frame has interference factors such as blurriness, reflection, occlusion, or distribution shift, the model may have difficulty forming a stable judgment. reduce, This increases the size, thus enabling the identification of low-confidence video frames.
[0034] Step S22, Feature Distribution Misalignment Modeling: Construct intra-batch local distribution reference centers based on the feature representations of video frames, and calculate the feature outlier degree of video frames according to the degree of misalignment between the features of a single frame and the intra-batch local distribution reference centers, including: Step S221: For the acquired small batch of video frames, perform feature extraction using a feature extractor to construct a feature representation set; Specifically, during model training or inference, input video frames are fed into the network in mini-batches, each mini-batch consisting of B video frame samples, and the corresponding feature representation set is denoted as . ,in, Indicates the batch size. Indicates the first The feature vector of each sample; since most samples in the same batch usually follow the current data distribution, the overall clustering property of the features within the batch can be used to construct a local distribution reference center.
[0035] Step S222: Calculate the mean of features within the batch based on the feature representation set, and use it as the local distribution reference center within the batch; The feature vectors of all video frame samples in the current mini-batch Perform mean calculation to obtain the mean center of all features within the current batch: (5); in, This represents the mean of features within a batch, used to characterize the distribution of mainstream data. This indicates the number of video frame samples.
[0036] Through the above processing, a local distribution reference center can be established by utilizing the overall aggregation characteristics of most samples in the same batch, thereby providing a reference benchmark for calculating the degree of feature offset in a single frame.
[0037] Step S223: Calculate the distance between the single-frame feature vector and the local distribution reference center within the batch to obtain the feature offset of the corresponding video frame; Specifically, this is achieved by calculating the offset between the features of a single frame and the center. To measure its outlierness: (6); in, This represents the degree of offset of the t-th video frame sample in the feature space relative to the local distribution reference center within the batch; Through the above processing, it is possible to quantify the degree of deviation of a single video frame from the mainstream data distribution in the feature space; The larger the value, the more likely the video frame is to be an abnormal frame, a low-quality frame, or a frame with a distribution offset.
[0038] Step S224: Normalize the feature offset to obtain the feature outlier of the video frame. : (7); in, and These represent the offset levels of all items within the current batch. The minimum and maximum values, is a preset constant, and is a numerically stable term. This definition allows frames with more significant feature deviations to have higher outlier scores, thus reflecting their potential anomalies.
[0039] The above processing eliminates the influence of feature offset scale differences between different mini-batches, ensuring a uniform numerical range for feature outliers; feature outliers of video frames. The larger the value, the more significant the feature distribution shift of the video frame, and the higher its potential anomaly level.
[0040] S23. Fusion Frame Confidence: The uncertainty index of a video frame is fused with the feature outlier to obtain the frame confidence of the video frame. Specifically, define the first The frame confidence level of the frame is ∈[0,1]: (8); in, The predictive uncertainty index represents the video frame t. This represents the outlier of the features of the t-th video frame, i.e., the degree of deviation of the feature distribution of the t-th video frame.
[0041] Through the above processing, the influence of high-uncertainty frames and high-outlier sample frames can be suppressed simultaneously. Lower bound constraints are used to prevent frame confidence weights from degenerating to zero, thus ensuring that the model retains a certain information contribution from each video frame throughout training and inference. Furthermore, by jointly modeling the consistency between prediction uncertainty and feature distribution, continuous frame confidence is assigned to each video frame. That is, the frame confidence weight. The larger the value, the more reliable the video frame is in terms of both image quality and discrimination credibility, thus providing reliable input for subsequent semantic constraints and temporal modeling.
[0042] In the above steps, the uncertainty information of the output layer and the distribution offset information of the feature representation layer can be jointly modeled, so that video frames with high prediction uncertainty or high feature outlier degree can obtain lower frame confidence, while video frames with stable prediction and consistent feature distribution can obtain higher frame confidence, thereby reducing the impact of low-quality video frames such as blur, reflection, occlusion or distribution offset on subsequent semantic modeling and temporal analysis.
[0043] Step S3 involves a semantic constraint module based on prior knowledge of anatomical locations. This module constructs semantic prototypes of anatomical locations and, based on the semantic similarity between video frames and these prototypes, filters key component frames related to the target anatomical location. These frames include: S31. Construct semantic prototypes for anatomical site categories: Aggregate the mean values of the sample features corresponding to each anatomical site category of the stomach to construct semantic prototypes for each anatomical site category. Among them, the anatomical parts of the stomach are categorized as follows: greater curvature of the antrum, lesser curvature of the antrum, gastric angle, greater curvature of the body, and lesser curvature of the body. For each anatomical region category The image data of the corresponding part is obtained, and feature extraction is performed based on the image data to obtain the corresponding feature set. By aggregating the mean of all sample features for this category, an initial category prototype is obtained: (9); in, Indicates the first Number of class samples Indicates the first The central position of a class in the feature space, i.e., the class prototype vector; This represents the feature vector corresponding to the i-th sample; Considering that differences in feature scales across different dimensions may interfere with similarity calculations, further adjustments are made to the category prototype vectors. Normalization is performed: (10); This yields the initial category prototype for normalization. , used to characterize the core semantic distribution of this anatomical site; Through the above processing, a stable semantic reference center can be established by utilizing the overall features of samples from each anatomical part category, reducing the impact of noise from individual samples, and providing a unified semantic benchmark for semantic matching between subsequent video frames and anatomical parts.
[0044] Step S32, Semantic relevance measurement: Extract the feature representation of each video frame of the gastroscopy video data to be processed, and calculate the semantic similarity between the feature representation of each video frame and the semantic prototype of each anatomical part category; Optionally, semantic similarity is calculated using cosine similarity to quantify the degree of semantic matching between the current video frame to be processed and each anatomical part; Specifically, for the first in the input video Frame Image Through feature extractor Its feature representation is obtained: (11); in, Indicates the first The feature representation of a frame image resides in the same feature space as the category prototype; Subsequently, cosine similarity is used to measure the semantic closeness between the current frame features and the prototypes of each category. The formula for calculating cosine similarity is: (12); in, Indicates the first Frame image and the first The matching strength between semantic prototypes of anatomical site categories; the higher the value, the closer the image frame is to the feature distribution of the corresponding anatomical site.
[0045] Step S33, Semantic relevance weight calculation: For the current video frame, select the largest semantic similarity value as the maximum semantic response value, determine whether the current video frame belongs to the target anatomical part based on the preset threshold, assign semantic relevance weight to the target anatomical part frame, and assign zero weight to non-target area frames, thereby filtering out key part frames related to the target anatomical part. Specifically, to obtain the optimal matching degree of the current frame for the anatomical parts of all target categories, a maximum semantic response value is defined. for: (13); This indicator reflects the strongest confidence in the current frame's attribution among the five candidate sites, serving as an important basis for target region identification. Through the above processing, the semantic proximity between video frames and typical gastric anatomical sites can be quantified, and the maximum semantic response value can be used to characterize the most likely anatomical site corresponding to the current video frame, providing a semantic basis for identifying key diagnostic sites. After obtaining the maximum semantic similarity, a threshold-based semantic confidence mechanism is used to distinguish target region frames from non-target frames. Specifically, semantic relevance weights are defined. for: (14); in, The preset semantic discrimination threshold; when If the threshold is exceeded, it indicates that the video frame has a high semantic consistency with a certain anatomical part, and its weight is adaptively assigned by the matching strength; otherwise, it is considered that the frame is more likely to come from other non-target parts, and its weight is set to zero, thereby suppressing it in the subsequent decision-making process.
[0046] A further technical solution involves treating samples from the target anatomical region as positive samples and samples from non-target regions as negative samples. The true positive rate (TPR) and false positive rate (FPR) are calculated at different candidate thresholds to construct an evaluation function. The candidate threshold corresponding to the maximum value of the evaluation function is then selected as the optimal semantic discrimination threshold. ; Specifically, to improve the objectivity and robustness of threshold selection, optimization was performed based on validation set data. Samples from each anatomical location were designated as the positive class (…). Samples from other regions are denoted as negative class. ), and statistically analyze different candidate thresholds. The following is based on the maximum semantic response value The corresponding true positive rate (TPR) and false positive rate (FPR) are used to construct ROC curves; based on this, an evaluation function is defined. ,as follows: (15); Finally, the threshold that maximizes the evaluation function is selected as the optimal discrimination boundary: (16); Through the above processing, the target anatomical region frames can be adaptively selected based on the semantic consistency between video frames and typical gastric anatomical regions. Target anatomical region frames are assigned semantic relevance weights, while non-target region frames are assigned zero weights. This suppresses the interference of non-target regions on the grading of gastrointestinal metaplasia and improves the accuracy and robustness of the grading results.
[0047] This embodiment, through the aforementioned semantic constraint module, can perform semantic screening of gastroscopy video frames based on prior knowledge of gastric anatomical locations. This ensures that frames of key anatomical locations highly correlated with the grading of gastrointestinal metaplasia receive a high semantic response, while suppressing frames in non-target regions, thereby reducing the interference of irrelevant frames on subsequent grading judgments. By constructing standardized anatomical semantic prototypes, typical gastric anatomical structures are transformed into stable semantic reference centers in the feature space. This allows video frame screening to not only rely on image clarity but also incorporate anatomical relevance, improving the accuracy of key diagnostic frame screening. Furthermore, by using semantic prototypes as semantic anchors to calculate the similarity between video frames and each semantic prototype, frame-level semantic relevance modeling is achieved. This enables the system to accurately identify target frames with clinical diagnostic value in gastroscopy videos with multiple anatomical regions, thus providing more reliable input for subsequent structural constraints, temporal modeling, and GIM grading.
[0048] Step S4 involves constructing anatomical structure constraints based on temporal consistency, performing temporal fusion on the prediction results of neighboring video frames, and constraining the jumps in anomaly categories by combining the anatomical topology.
[0049] In step S4, based on frame confidence and semantic relevance weights, the prediction results of neighboring video frames of key diagnostic sites are temporally fused, and the abnormal category jumps are corrected by combining the gastric anatomical topology to obtain the frame-level predicted category of each video frame. The temporally consistent frame-level prediction results include the following steps: Step S41: Combine the frame confidence weight and the semantic relevance weight to form a unified frame-level fusion weight; The frame confidence score calculated based on uncertainty awareness in step S2. And the semantic relevance weights obtained in step S3 based on the semantic constraints of prior anatomical locations. Construct a unified frame-level fusion weight The formula is: (17); This joint weight simultaneously characterizes the image quality and semantic validity of a frame. Among them, Used to suppress uncertainty interference caused by low-quality frames such as blurriness and reflections, This is used to filter out invalid frames that are not from the target anatomical region. Therefore, the joint weights can only maintain a large value when the frame has both high imaging quality and a clear semantic attribution, thus providing a reliable input basis for subsequent multi-frame fusion; Step S42, Temporal Information Fusion: Construct a temporal neighborhood window centered on each key diagnostic site video frame. Assign contribution weights to each neighboring frame based on the temporal distance between the neighboring frame and the current frame and the corresponding frame-level fusion weights. Based on the contribution weights, perform weighted fusion on the classification probabilities of each video frame within the neighborhood to generate the temporal enhanced classification probability of the current video frame, thereby obtaining the initial temporal prediction category. Specifically, based on the aforementioned frame-level fusion weights This involves modeling complementary information between neighboring frames in the time dimension. Considering the continuous sampling characteristics of gastroscopy videos, adjacent frames typically have strong content correlation; therefore, single-frame prediction can be enhanced using information from neighboring frames.
[0050] For the A frame defines its temporal neighborhood. for: (18); in, This represents the temporal neighborhood radius, and the temporal neighborhood window length is... .
[0051] In the time neighborhood within, no. The frame-level fusion weights corresponding to the frames are denoted as: The frame-level fusion weights are calculated using the unified definition in equation (17). Further, the frame-level fusion weights are combined with the temporal distance... Calculate the contribution weight of the j-th video frame to the t-th video frame. : (19); in, Indicates the first The contribution weight of a frame to the current frame. The time decay factor is controlled. This design allows high-quality neighboring samples that are temporally closer to the current frame to contribute more.
[0052] Based on contribution weight The classification probability of each frame within the window Weighted aggregation is performed to obtain category-level evidence. : (20); in, Indicates the first The image belongs to the first The probability of class category; Category-level evidence Normalization is performed to obtain the temporal augmentation classification probability. : (twenty one); The initial temporal prediction category of the t-th video frame is determined based on the temporal augmentation classification probability: (twenty two); In this step, the continuity and complementary information between neighboring video frames can be used to enhance the prediction result of the current frame, so that video frames that are closer in time, have higher image quality and stronger semantic relevance can make a greater contribution to the current frame, thereby reducing the impact of single-frame prediction noise and short-term fluctuations on the classification result.
[0053] The temporal evidence fusion in step S42 can reduce misclassification, but in cases where some categories have similar appearances or severe image degradation, the model may still produce short-term abrupt predictions, i.e., the category label jumps between adjacent frames that do not conform to the actual examination path. After obtaining the initial temporal predicted categories after temporal fusion, step S43 further introduces a transition constraint based on the gastric anatomical topology to perform posterior correction on the predicted sequence. This constraint originates from the actual operational characteristics of gastroscopy. The movement of the endoscope within the gastric cavity is continuous and local, and its field of view changes follow the spatial adjacency relationship of the anatomical structure. Therefore, adjacent frames usually only transition between spatially adjacent parts and do not experience instantaneous jumps across regions.
[0054] Since gastroscopy videos contain image frames from multiple different anatomical sites, and GIM grading mainly relies on diagnostic information from specific key anatomical sites, and some image frames from non-target anatomical sites, although clear, do not have relevant diagnostic value, non-target region frames are prone to participate in subsequent grading judgments without semantic constraints on the anatomical sites of the video frames. This introduces irrelevant regional information interference, reducing the accuracy and stability of GIM grading results.
[0055] Step S43, Correction of Abnormal Jumps Based on Anatomical Topology: Based on the temporal enhanced classification probability and initial temporal predicted category obtained in step S42, and combined with the anatomical topological relationship between typical anatomical parts of the stomach, the abnormal category transfers that do not conform to anatomical continuity between adjacent video frames are corrected to obtain the corrected frame-level predicted category. The specific implementation process is as follows: Step S431: Pre-construct a set of invalid transfer relationships between typical anatomical locations of the stomach; The five typical regions of the stomach have clear topological relationships in their anatomical structures. For example, the antrum and body regions are connected by the gastric angle, so a direct jump from the greater curvature of the antrum to the lesser curvature of the body, or vice versa, usually does not occur in adjacent frames during actual examinations. These cross-regional jumps often stem from misjudgments in a single frame rather than actual changes in anatomical structure.
[0056] Let the five parts be categorized as follows: ,in, Indicates the greater curvature of the gastric antrum. Indicates the lesser curvature of the gastric antrum. Indicates the angle of the stomach. Indicates the greater curvature of the stomach. Representing the lesser curvature of the stomach body, define the set of invalid transfers: (twenty three); It is used to characterize instantaneous cross-regional jumps that are impossible to occur during gastroscopy.
[0057] Step S432: Determine whether there is an invalid transition between the predicted categories of adjacent video frames; when an invalid transition is detected and the prediction confidence of the current video frame is lower than a preset threshold, correct the predicted category of the current video frame to the predicted category of the previous video frame; otherwise, retain the current prediction result and obtain the frame-level prediction category result for each video frame. Specifically, based on the set of invalid anatomical metastasis relationships Determine the predicted category of the previous video frame. Initial temporal prediction category of the current video frame To determine if there are any invalid anatomical metastases, and to construct an indicator function for invalid metastases. : (twenty four); when If the maximum temporal augmentation classification probability of the current video frame is lower than the preset confidence threshold η, the initial temporal prediction category of the current video frame is determined to be more likely caused by single-frame misclassification, local reflection, blurring, or occlusion, and the prediction category of the current video frame is corrected to the corrected prediction category of the previous video frame; otherwise, the initial temporal prediction category of the current video frame is retained, and the corrected prediction category of the t-th video frame is obtained. : (25); in, The set confidence threshold can be set to be greater than 0.9. This strategy effectively suppresses structurally unreasonable mutations while ensuring high-confidence predictive expression capabilities, thereby improving overall temporal consistency.
[0058] Through the above processing, based on the temporal information fusion completed in step S42, the topological continuity constraints between anatomical sites of the stomach can be used to predict sequences, suppress abnormal category jumps between adjacent video frames that do not conform to the actual gastroscopy examination path, and retain the high-confidence initial temporal prediction results, thereby improving the structural rationality and temporal stability of the frame-level prediction results.
[0059] Because there is strong temporal correlation between adjacent frames in gastroscopy videos, short-term category jumps may still occur during actual model prediction due to local visual interference or single-frame misclassification. These prediction results, which do not conform to the anatomical movement patterns of the stomach, will disrupt the consistency of video-level classification. Therefore, this embodiment introduces an anatomical structure constraint module based on temporal consistency. By fusing local temporal evidence with anatomical topological constraints, posterior correction is performed on frame-level prediction results, thereby generating temporally consistent differentiated pseudo-labels for video-level classification decisions.
[0060] Step S5: Based on the frame-level prediction category results of each video frame obtained in step S4, perform grouping, statistical and weighted fusion processing on the frame-level prediction category results of key parts frames corresponding to multiple key anatomical parts to generate gastrointestinal metaplasia grading results. Specifically, key component frames are grouped according to their corresponding key anatomical locations, and then combined with the frame-level fusion weights of each video frame. The frame-level prediction category results of all video frames for each anatomical site are weighted and summarized to obtain the comprehensive classification result corresponding to each anatomical site. Among them, key anatomical sites, such as the antrum, body, and angle of the stomach; For each key anatomical site, the intestinal metaplasia level prediction results or classification probabilities of multiple video frames within that site are weighted and statistically analyzed in conjunction with the frame-level fusion weights of the corresponding video frames to obtain the comprehensive prediction result for that key anatomical site. Based on this, the degree of intestinal metaplasia in each anatomical location was quantified and assigned values according to the EGGIM scoring system. The predicted results of different severity levels were mapped to standardized scores, and the scores of all anatomical locations were accumulated to obtain a video-level EGGIM total score. This score can reflect the overall distribution and severity of intestinal metaplasia in the patient's gastric mucosa.
[0061] Furthermore, based on the correspondence between the total EGGIM score and the preset risk stratification threshold, the risk of early gastric cancer is graded and determined, outputting different risk levels such as low risk, medium risk, or high risk, thereby achieving auxiliary assessment of the potential risk of early gastric cancer. Through the above-mentioned video-level aggregation and scoring mechanism, the method in this embodiment realizes a unified modeling process from frame-level prediction to site-level analysis and then to video-level decision-making, providing clinicians with structured and interpretable GIM grading and early gastric cancer risk assessment results.
[0062] Through the above processing, structured gastrointestinal metaplasia grading results and early gastric cancer risk assessment results can be automatically generated based on gastroscopy videos. This enables continuous modeling from frame-level prediction and site-level aggregation to video-level risk decision-making, providing a reference for clinical follow-up planning, intervention strategy selection, and auxiliary risk assessment of early gastric cancer.
[0063] Example 2 Based on Example 1, this example provides a gastrointestinal metaplasia grading system based on uncertainty and site semantic constraints, including: The data acquisition module is configured to acquire gastrointestinal endoscopy data to be processed; The frame confidence calculation module based on uncertainty perception is configured to perform prediction uncertainty modeling and feature distribution shift analysis on video frames in the acquired gastrointestinal endoscopy data to generate frame confidence. The semantic constraint module based on anatomical location priors is configured to construct anatomical location semantic prototypes for the stomach, calculate semantic relevance weights based on the semantic similarity between video frames and each anatomical location semantic prototype, and filter key location frames related to the target anatomical location. The anatomical structure constraint module based on temporal consistency is configured to perform temporal fusion of the prediction results of neighboring video frames of key diagnostic site frames based on frame confidence and semantic relevance weights, and to correct abnormal category jumps by combining the gastric anatomical topology to obtain the frame-level predicted category of each video frame. The risk assessment module is configured to perform grouped statistical and weighted fusion processing on the frame-level prediction category results of key site frames corresponding to multiple key anatomical sites based on the frame-level prediction category results of each video frame, and generate gastrointestinal metaplasia grading results.
[0064] Furthermore, the uncertainty-aware frame confidence calculation module is configured to perform the following process: Based on Dirichlet evidence theory, nonlinear evidence mapping processing is performed on video frames to construct a Dirichlet distribution, and the uncertainty index of the video frame is calculated according to the total amount of evidence corresponding to the Dirichlet distribution. Based on the feature representation of video frames, a local distribution reference center within a batch is constructed, and the feature outlier of the video frame is calculated according to the degree of offset between the features of a single frame and the local distribution reference center within the batch. The uncertainty index of a video frame is fused with the outlier of the feature to obtain the frame confidence of the video frame.
[0065] Furthermore, the semantic constraint module based on prior knowledge of anatomical locations is configured to perform the following process: The mean of the sample features corresponding to each anatomical part category is aggregated to construct the semantic prototype of each anatomical part category. Extract feature representations of each video frame from the gastroscopy video data to be processed, and determine the semantic similarity between the feature representations of each video frame and the semantic prototypes of each anatomical site category; For the current video frame, the maximum semantic similarity value is selected as the maximum semantic response value. Based on the preset threshold, it is determined whether the current video frame belongs to the target anatomical part. Frames of the target anatomical part are assigned semantic relevance weights, while frames of non-target regions are assigned zero weights, thereby filtering out key part frames related to the target anatomical part. The anatomical constraint module based on temporal consistency is configured to execute the following process: The frame confidence weight and semantic relevance weight are combined to form a unified frame-level fusion weight. A temporal neighborhood window is constructed centered on each key diagnostic site video frame. Based on the temporal distance between the neighboring frames and the current frame and the corresponding frame-level fusion weights, contribution weights are assigned to each neighboring frame. Based on the contribution weights, the classification probabilities of each video frame in the neighborhood are weighted and fused to generate the temporal augmentation classification probability of the current video frame, thereby obtaining the initial temporal prediction category. Based on the temporal augmentation classification probability and the initial temporal predicted category, and combined with the anatomical topological relationship between typical anatomical parts of the stomach, the abnormal category transfer that does not conform to anatomical continuity between adjacent video frames is corrected to obtain the corrected frame-level predicted category.
[0066] It should be noted that each module in this embodiment corresponds one-to-one with each step in embodiment 1, and their specific implementation process is the same, so it will not be repeated here.
[0067] The above description is merely a preferred embodiment of the present invention and is not intended to limit the invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
[0068] While the specific embodiments of the present invention have been described above in conjunction with the accompanying drawings, this is not intended to limit the scope of protection of the present invention. Those skilled in the art should understand that various modifications or variations that can be made by those skilled in the art without creative effort based on the technical solutions of the present invention are still within the scope of protection of the present invention.
Claims
1. A method for grading gastrointestinal metaplasia based on uncertainty and semantic constraints of location, characterized in that, Includes the following steps: Acquire gastrointestinal endoscopic data to be processed; Uncertainty modeling and feature distribution shift analysis are performed on video frames in the acquired gastrointestinal endoscopy data to generate frame confidence scores; Construct semantic prototypes of anatomical parts for the stomach, calculate semantic relevance weights based on semantic similarity between video frames and semantic prototypes of each anatomical part, and filter key part frames related to the target anatomical part. Based on frame confidence and semantic relevance weights, the prediction results of neighboring video frames of key diagnostic sites are temporally fused, and the abnormal category jumps are corrected by combining the gastric anatomical topology to obtain the frame-level predicted category of each video frame. Based on the frame-level prediction category results of each video frame, the frame-level prediction category results of key site frames corresponding to multiple key anatomical sites are grouped, statistically analyzed, and weighted and fused to generate the grading results of gastrointestinal metaplasia.
2. The gastrointestinal metaplasia grading method based on uncertainty and site semantic constraints as described in claim 1, characterized in that, The uncertainty modeling and feature distribution shift analysis of the video frames in the acquired gastrointestinal endoscopy data are performed to generate frame confidence scores, including the following steps: Based on Dirichlet evidence theory, nonlinear evidence mapping processing is performed on video frames to construct a Dirichlet distribution, and the uncertainty index of the video frame is calculated according to the total amount of evidence corresponding to the Dirichlet distribution. Based on the feature representation of video frames, a local distribution reference center within a batch is constructed, and the feature outlier of the video frame is calculated according to the degree of offset between the features of a single frame and the local distribution reference center within the batch. The uncertainty index of a video frame is fused with the outlier of the feature to obtain the frame confidence of the video frame.
3. The gastrointestinal metaplasia grading method based on uncertainty and site semantic constraints as described in claim 2, characterized in that, Based on Dirichlet evidence theory, nonlinear evidence mapping is performed on video frames to construct a Dirichlet distribution. Then, the uncertainty index of the video frame is calculated based on the total amount of evidence corresponding to the Dirichlet distribution, including: For the t-th frame of the input image The corresponding logits vector Nonlinear evidence mapping is performed to obtain the evidence values corresponding to each category. ; Based on the evidence values corresponding to each category Construct the concentration parameters of the Dirichlet distribution. , obtain the input image of frame t The corresponding Dirichlet distribution; For the t-th frame input image Concentration parameters of each category in the corresponding Dirichlet distribution Summation is performed to obtain the input image of frame t. Corresponding total amount of evidence ; Based on the input image of frame t Corresponding total amount of evidence Calculate the input image of frame t. Uncertainty indicators .
4. The gastrointestinal metaplasia grading method based on uncertainty and location semantic constraints as described in claim 2, characterized in that, Based on the feature representation of video frames, a local distribution reference center within the batch is constructed. Then, based on the offset between the features of a single frame and the local distribution reference center within the batch, the feature outlier of the video frame is calculated, including: For the acquired small batch of video frames, a feature extractor is used to extract features and construct a set of feature representations. The mean value of features within a batch is calculated based on the feature representation set and used as a reference center for the local distribution within the batch. Calculate the distance between the feature vector of a single frame and the local distribution reference center within the batch to obtain the feature offset of the corresponding video frame; The feature offset is normalized to obtain the feature outlier of the video frame.
5. The gastrointestinal metaplasia grading method based on uncertainty and site semantic constraints as described in claim 1, characterized in that, Construct semantic prototypes of anatomical locations, and based on the semantic similarity between video frames and the semantic prototypes of each anatomical location, filter key location frames related to the target anatomical location, including: The mean of the sample features corresponding to each anatomical part category is aggregated to construct the semantic prototype of each anatomical part category. Extract feature representations of each video frame from the gastroscopy video data to be processed, and determine the semantic similarity between the feature representations of each video frame and the semantic prototypes of each anatomical site category; For the current video frame, the maximum semantic similarity value is selected as the maximum semantic response value. Based on a preset threshold, it is determined whether the current video frame belongs to the target anatomical part. Frames of the target anatomical part are assigned semantic relevance weights, while frames of non-target regions are assigned zero weights. In this way, key part frames related to the target anatomical part are selected.
6. The gastrointestinal metaplasia grading method based on uncertainty and site semantic constraints as described in claim 1, characterized in that, Based on frame confidence and semantic relevance weights, the prediction results of neighboring video frames of key diagnostic sites are temporally fused, and the abnormal category jumps are corrected by combining the gastric anatomical topology. The frame-level predicted category of each video frame is obtained through the following steps: The frame confidence weight and semantic relevance weight are combined to form a unified frame-level fusion weight. A temporal neighborhood window is constructed centered on each key diagnostic site video frame. Contribution weights are assigned to each neighboring frame based on the temporal distance between the neighboring frame and the current frame and the corresponding frame-level fusion weights. Based on the contribution weight, the classification probabilities of each video frame in the neighborhood are weighted and fused to generate the temporal augmentation classification probability of the current video frame, thereby obtaining the initial temporal prediction category. Based on the temporal augmentation classification probability and the initial temporal predicted category, and combined with the anatomical topological relationship between typical anatomical parts of the stomach, the abnormal category transfer that does not conform to anatomical continuity between adjacent video frames is corrected to obtain the corrected frame-level predicted category.
7. The gastrointestinal metaplasia grading method based on uncertainty and site semantic constraints as described in claim 1, characterized in that, Based on temporal augmentation classification probabilities and initial temporal predicted categories, and combined with the anatomical topological relationships between typical anatomical sites of the stomach, abnormal category transfers that do not conform to anatomical continuity between adjacent video frames are corrected to obtain corrected frame-level predicted categories. The specific implementation process is as follows: Pre-construct a set of invalid transfer relationships between typical anatomical sites of the stomach; Determine whether there is an invalid transition between the predicted categories of adjacent video frames; when an invalid transition is detected and the prediction confidence of the current video frame is lower than a preset threshold, correct the prediction category of the current video frame to the prediction category of the previous video frame; Otherwise, retain the current prediction result and obtain the frame-level prediction category result for each frame of the video.
8. A grading system for gastrointestinal metaplasia based on uncertainty and semantic constraints of location, characterized in that, include: The data acquisition module is configured to acquire gastrointestinal endoscopy data to be processed; The frame confidence calculation module based on uncertainty perception is configured to perform prediction uncertainty modeling and feature distribution shift analysis on video frames in the acquired gastrointestinal endoscopy data to generate frame confidence. The semantic constraint module based on anatomical location priors is configured to construct anatomical location semantic prototypes for the stomach, calculate semantic relevance weights based on the semantic similarity between video frames and each anatomical location semantic prototype, and filter key location frames related to the target anatomical location. The anatomical structure constraint module based on temporal consistency is configured to perform temporal fusion of the prediction results of neighboring video frames of key diagnostic site frames based on frame confidence and semantic relevance weights, and to correct abnormal category jumps by combining the gastric anatomical topology to obtain the frame-level predicted category of each video frame. The risk assessment module is configured to perform grouped statistical and weighted fusion processing on the frame-level prediction category results of key site frames corresponding to multiple key anatomical sites based on the frame-level prediction category results of each video frame, and generate gastrointestinal metaplasia grading results.
9. The gastrointestinal metaplasia grading system based on uncertainty and location semantic constraints as described in claim 8, characterized in that, The uncertainty-aware frame confidence calculation module is configured to perform the following process: Based on Dirichlet evidence theory, nonlinear evidence mapping processing is performed on video frames to construct a Dirichlet distribution, and the uncertainty index of the video frame is calculated according to the total amount of evidence corresponding to the Dirichlet distribution. Based on the feature representation of video frames, a local distribution reference center within a batch is constructed, and the feature outlier of the video frame is calculated according to the degree of offset between the features of a single frame and the local distribution reference center within the batch. The uncertainty index of a video frame is fused with the outlier of the feature to obtain the frame confidence of the video frame.
10. The gastrointestinal metaplasia grading system based on uncertainty and location semantic constraints as described in claim 8, characterized in that, The semantic constraint module based on anatomical location priors is configured to perform the following process: The mean of the sample features corresponding to each anatomical part category is aggregated to construct the semantic prototype of each anatomical part category. Extract feature representations of each video frame from the gastroscopy video data to be processed, and determine the semantic similarity between the feature representations of each video frame and the semantic prototypes of each anatomical site category; For the current video frame, the maximum semantic similarity value is selected as the maximum semantic response value. Based on the preset threshold, it is determined whether the current video frame belongs to the target anatomical part. Frames of the target anatomical part are assigned semantic relevance weights, while frames of non-target regions are assigned zero weights, thereby filtering out key part frames related to the target anatomical part. The anatomical constraint module based on temporal consistency is configured to execute the following process: The frame confidence weight and semantic relevance weight are combined to form a unified frame-level fusion weight. A temporal neighborhood window is constructed centered on each key diagnostic site video frame. Contribution weights are assigned to each neighboring frame based on the temporal distance between the neighboring frame and the current frame and the corresponding frame-level fusion weights. Based on the contribution weight, the classification probabilities of each video frame in the neighborhood are weighted and fused to generate the temporal augmentation classification probability of the current video frame, thereby obtaining the initial temporal prediction category. Based on the temporal augmentation classification probability and the initial temporal predicted category, and combined with the anatomical topological relationship between typical anatomical parts of the stomach, the abnormal category transfer that does not conform to anatomical continuity between adjacent video frames is corrected to obtain the corrected frame-level predicted category.