A Real-Time Image Recognition System and Method for Early Gastric Cancer Based on Artificial Intelligence

By employing AI-based adaptive region segmentation and gradient direction enhancement in a local binary mode, combined with illumination normalization and contrast enhancement, the problems of missed and misdiagnosed diagnoses in traditional endoscopy have been solved, enabling efficient and accurate diagnosis of early gastric cancer.

CN123120218APending Publication Date: 2026-11-17山东衡昊信息技术有限公司
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511263054.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-09-05
Publication Date
2026-11-17

AI Technical Summary

Technical Problem

Traditional endoscopy relies on physician experience, which carries the risk of missed diagnoses and misdiagnoses. Furthermore, the accuracy and efficiency of endoscopic image diagnosis are insufficient, and the complexity of lighting and texture makes it difficult to accurately identify early gastric cancer lesions.

Method used

An artificial intelligence-based approach is adopted to generate a high-precision binary mask by using adaptive region segmentation and gradient direction enhancement of local binary patterns, combined with illumination normalization and contrast enhancement. The support vector machine model is then used to identify early gastric cancer lesions in real time.

Benefits of technology

It improves the accuracy and efficiency of early gastric cancer diagnosis, reduces false positives and false negatives, and meets the clinical needs for real-time and reliable results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123120218A_ABST
    Figure CN123120218A_ABST
Patent Text Reader

Abstract

This invention relates to the field of real-time endoscopic image recognition for early gastric cancer, and particularly to an artificial intelligence-based real-time endoscopic image recognition system and method for early gastric cancer. The system includes: acquiring original endoscopic images; preprocessing the original endoscopic images to obtain preprocessed endoscopic images; performing adaptive region segmentation; and outputting a binary mask. Based on the preprocessed endoscopic images and the binary mask, the system calculates the local binary pattern feature value of each pixel within a potential lesion region using gradient-direction-enhanced local binary pattern (LDB) analysis; integrates the LDB feature values ​​into a feature vector; and, based on the feature vector, determines in real-time whether a potential lesion region in the endoscopic image is an early gastric cancer lesion. This invention solves the technical problems of uneven lighting in endoscopic images, resulting in some areas being too bright or too dark, thus obscuring lesion features; and the difficulty of capturing the complex and irregular texture features of early gastric cancer lesion regions due to traditional LDB analysis neglecting texture directionality.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of real-time recognition of endoscopic images of early gastric cancer, and more particularly to an artificial intelligence-based system and method for real-time recognition of endoscopic images of early gastric cancer. Background Technology

[0002] Gastric cancer is one of the most common malignant tumors worldwide, with high morbidity and mortality rates. Early gastric cancer (ECG) diagnosis and treatment have significantly improved patient survival rates. Early gastric cancer is usually confined to the gastric mucosa or submucosa, with subtle symptoms, making it difficult to detect through routine examinations. Therefore, endoscopy has become the primary means of early diagnosis. However, traditional endoscopy relies on the experience and subjective judgment of physicians, carrying the risk of missed diagnoses and misdiagnoses, especially in primary healthcare institutions or among less experienced physicians. In recent years, breakthroughs in artificial intelligence (AI) technology, particularly in deep learning and computer vision, have provided new possibilities for the automated analysis and real-time recognition of endoscopic images. Automated image analysis can assist physicians in identifying lesions, improving diagnostic efficiency, and reducing errors caused by human factors. This can significantly improve the diagnostic efficiency and accuracy of early gastric cancer, reducing the diagnostic burden on physicians, and has significant application value, especially in primary healthcare institutions.

[0003] However, the existing real-time endoscopic image recognition systems and methods for early gastric cancer still have technical problems such as insufficient accuracy and efficiency in endoscopic image diagnosis, interference from lighting and texture complexity in image processing, and insufficient sensitivity in extracting early lesion features. Summary of the Invention

[0004] This invention provides an artificial intelligence-based real-time endoscopic image recognition system and method for early gastric cancer, which solves the technical problems of uneven light source in endoscopic images, with some areas being too bright or too dark, thus obscuring lesion features; traditional fixed thresholds are difficult to adapt to the different features in endoscopic images, easily misjudging normal textures as lesions or missing small lesions; and traditional local binary mode ignores texture directionality, making it difficult to capture the complex and irregular texture features of early gastric cancer lesion areas.

[0005] The present invention provides a real-time endoscopic image recognition system and method for early gastric cancer based on artificial intelligence, specifically including the following technical solutions: A real-time image recognition method for early gastric cancer based on artificial intelligence includes the following steps: S1. Acquire the original endoscopic image, perform image preprocessing on the original endoscopic image to obtain the preprocessed endoscopic image, perform adaptive region segmentation on the preprocessed endoscopic image, and output a binary mask. S2. Based on the preprocessed endoscopic image and binary mask, the local binary pattern feature value of each pixel in the potential lesion area is calculated by the local binary pattern based on gradient direction enhancement. The local binary pattern feature values ​​are integrated into a feature vector. Based on the feature vector, it is determined in real time whether the potential lesion area in the endoscopic image is an early gastric cancer lesion.

[0006] Preferably, S1 specifically includes: In the process of implementing adaptive region segmentation on the preprocessed endoscopic image, local statistics are calculated for each pixel of the preprocessed endoscopic image, including the local average gray value and the local gray standard deviation.

[0007] Preferably, S1 specifically includes: In the process of adaptive region segmentation of the preprocessed endoscopic image, the local average gray value is calculated by traversing the pixels within the window to obtain the arithmetic mean of the gray values, reflecting the gray baseline level of the local region; the local gray standard deviation is calculated by calculating the standard deviation of the gray values ​​within the window to quantify the degree of gray change.

[0008] Preferably, S1 specifically includes: In the process of adaptive region segmentation of preprocessed endoscopic images, for each pixel within a local window, the Sobel gradient, the gradient magnitude of the pixel, and the mean of the gradient magnitudes of all pixels within the window are calculated. The average of the squared difference between the pixel gradient magnitude and the mean is then calculated to obtain the local texture variance. Based on the local grayscale standard deviation, the segmentation threshold is calculated.

[0009] Preferably, S1 specifically includes: The segmentation threshold is the product of the local grayscale standard deviation and the adaptive threshold coefficient. The adaptive threshold coefficient is defined by its reciprocal form to control the influence of the local texture variance on the segmentation threshold. For each pixel, the absolute difference between the grayscale value and the local average grayscale value is compared with the segmentation threshold. When the absolute difference between the grayscale value and the local average grayscale value is greater than the segmentation threshold, it represents a potential lesion area; otherwise, it represents a background area. The entire preprocessed endoscopic image is traversed to generate a binary mask.

[0010] Preferably, S2 specifically includes: Feature extraction is performed on pixels with a mask value of 1 to extract features from potential lesion areas. For each pixel with a mask value of 1, the Sobel operator is used to calculate the gradient in the horizontal and vertical directions to obtain two gradient components. The Sobel operator performs edge detection on the preprocessed endoscopic image through a convolution kernel. The ratio of the two gradient components is calculated using the arctangent function to obtain the gradient direction of each neighboring pixel.

[0011] Preferably, S2 specifically includes: The principal gradient direction is calculated within a local window of each pixel as a reference for texture directionality. Each gradient direction corresponds to a direction interval of an orientation histogram. The weight of each direction interval is the gradient magnitude of the corresponding pixel, reflecting the edge strength of the gradient direction. The direction with the largest weight in the orientation histogram is selected as the local principal direction, i.e., the principal gradient direction.

[0012] Preferably, S2 specifically includes: When calculating the local binary pattern feature value, a dynamic orientation weight is introduced, which consists of a distance factor and a orientation factor. The distance factor is calculated based on the distance from the neighboring pixels to the center pixel, and the orientation factor is calculated based on the difference between the gradient direction of the neighboring pixels and the local main direction. A binary pattern is generated by comparing the gray values ​​of the center pixel and the neighboring pixels. The local binary comparison result of each neighboring pixel is multiplied by the dynamic orientation weight and the position weight, and the result is accumulated to obtain the local binary pattern feature value of the pixel.

[0013] A real-time endoscopic image recognition system for early gastric cancer based on artificial intelligence includes the following components: Image acquisition module, image preprocessing module, region segmentation module, feature extraction module, lesion classification module; Image acquisition module: Acquires raw endoscopic images using clinical endoscopic equipment and outputs the raw endoscopic images to the image preprocessing module; Image preprocessing module: preprocesses the original endoscopic images from the image acquisition module to obtain preprocessed endoscopic images, and outputs the preprocessed endoscopic images to the region segmentation module and the feature extraction module; Region segmentation module: Performs adaptive region segmentation on the preprocessed endoscopic image from the image preprocessing module, generates a binary mask, and outputs the binary mask to the feature extraction module; Feature extraction module: Based on the preprocessed endoscopic image from the image preprocessing module and the binary mask from the region segmentation module, for pixels marked as potential lesion areas by the mask, calculate local binary pattern feature values ​​based on gradient direction enhancement, integrate them into a feature vector, and output the feature vector to the lesion classification module; Lesion classification module: The support vector machine model is used to classify the feature vectors generated by the feature extraction module and to determine in real time whether the potential lesion area is an early gastric cancer lesion.

[0014] The beneficial effects of the technical solution of the present invention are: 1. By preprocessing the original endoscopic images with illumination normalization and contrast enhancement, the influence of uneven illumination is effectively eliminated, highlighting the subtle features of early gastric cancer lesions, such as texture changes in erosions or ulcers. Combined with an adaptive region segmentation method, the segmentation threshold is dynamically adjusted using local grayscale statistics and texture variance to generate a high-precision binary mask that accurately marks potential lesion areas. This increases the sensitivity to subtle features of early gastric cancer, significantly reduces mislabeling of normal areas and missed detection of lesions, and provides a reliable basis for subsequent analysis, thereby improving the accuracy of early gastric cancer diagnosis.

[0015] 2. By utilizing a gradient-direction-enhanced local binary pattern method, which combines gradient direction information and dynamic direction weights, the traditional local binary pattern significantly improves its ability to represent complex textures. It extracts features only from potential lesion areas marked by binary masks, focusing on key clinical areas and reducing computational load. At the same time, through the weighted design of distance and direction factors, it accurately captures the complex and irregular texture features of early gastric cancer lesion areas, such as the directional changes of erosion edges, improving the discriminative power of feature vectors and providing more robust input data for subsequent classification.

[0016] 3. By integrating the local binary pattern feature values ​​of each pixel into a feature vector and inputting it into a support vector machine model, a rapid judgment on whether a potential lesion area is an early gastric cancer lesion can be achieved. It can provide real-time diagnostic results during endoscopic examination, assist doctors in quickly discovering small lesions, and significantly improve diagnostic efficiency. At the same time, the combination of precise feature extraction and classification model ensures high accuracy of diagnostic results, meeting the dual requirements of clinical real-time and reliability. Attached Figure Description

[0017] Figure 1 This is a structural diagram of an artificial intelligence-based real-time endoscopic image recognition system for early gastric cancer, as described in this invention. Figure 2 This is a flowchart of a method for real-time recognition of endoscopic images of early gastric cancer based on artificial intelligence, as described in this invention. Detailed Implementation

[0018] To further illustrate the technical means and effects adopted by the present invention to achieve its intended purpose, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0019] Unless otherwise defined, 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] The following description, in conjunction with the accompanying drawings, details the specific scheme of the real-time endoscopic image recognition system and method for early gastric cancer based on artificial intelligence provided by the present invention.

[0021] See attached document Figure 1 The diagram illustrates a real-time endoscopic image recognition system for early gastric cancer based on artificial intelligence, according to an embodiment of the present invention. The system includes the following components: Image acquisition module, image preprocessing module, region segmentation module, feature extraction module, lesion classification module; Image acquisition module: Acquires raw endoscopic images using clinical endoscopic equipment and outputs the raw endoscopic images to the image preprocessing module; Image preprocessing module: preprocesses the original endoscopic images from the image acquisition module to obtain preprocessed endoscopic images, and outputs the preprocessed endoscopic images to the region segmentation module and the feature extraction module; Region segmentation module: Performs adaptive region segmentation on the preprocessed endoscopic image from the image preprocessing module, generates a binary mask, and outputs the binary mask to the feature extraction module; Feature extraction module: Based on the preprocessed endoscopic image from the image preprocessing module and the binary mask from the region segmentation module, for pixels marked as potential lesion areas by the mask, calculate local binary pattern feature values ​​based on gradient direction enhancement, integrate them into a feature vector, and output the feature vector to the lesion classification module; Lesion classification module: The support vector machine model is used to classify the feature vectors generated by the feature extraction module and to determine in real time whether the potential lesion area is an early gastric cancer lesion.

[0022] See attached document Figure 2 The diagram illustrates a flowchart of a real-time endoscopic image recognition method for early gastric cancer based on artificial intelligence, according to an embodiment of the present invention. The method includes the following steps: S1. Acquire the original endoscope image, perform image preprocessing on the original endoscope image to obtain the preprocessed endoscope image, perform adaptive region segmentation on the preprocessed endoscope image, and output a binary mask. Original endoscopic images are acquired by clinical endoscopic equipment. Image preprocessing is performed on the original endoscopic images to obtain preprocessed endoscopic images. The image preprocessing process includes illumination normalization and contrast enhancement, which are well known to those skilled in the art and will not be described in detail here. Image preprocessing ensures that the influence of uneven illumination is eliminated, while highlighting the subtle features of the lesion area. Adaptive region segmentation is performed on the preprocessed endoscopic image, and a binary mask is output to mark potential lesion areas; Specifically, for each pixel in the preprocessed endoscopic image, local statistics are calculated within a 5×5 local window centered on the pixel, including the local average gray value and the local gray standard deviation. The local average gray value is calculated by traversing 25 pixels within the window to obtain the arithmetic mean of the gray values, reflecting the gray baseline level of the local area and used to compare the gray deviation of pixels. The local gray standard deviation is calculated by measuring the standard deviation of gray values ​​within the window to quantify the severity of gray change. A higher standard deviation indicates that the area is more likely to contain abnormal textures of early gastric cancer, such as erosions or ulcers. To achieve adaptive thresholding, the local texture variance is further calculated to quantify the irregularity of the texture. Specifically, for each pixel within the local window, the Sobel gradient, the gradient magnitude of the pixel, and the mean of the gradient magnitudes of all pixels within the window are calculated and combined. The average of the squared differences between the pixel gradient magnitude and the mean is then calculated to obtain the local texture variance. A higher local texture variance indicates that the region has more complex texture features, such as the erosive edge of early gastric cancer. Furthermore, a segmentation threshold is calculated, which is the product of the local grayscale standard deviation and the adaptive threshold coefficient. The adaptive threshold coefficient is defined by its reciprocal form and is used to control the influence of the local texture variance on the segmentation threshold. The higher the local texture variance, the larger the denominator and the smaller the adaptive threshold coefficient, thereby reducing the segmentation threshold and making pixels more likely to be marked as potential lesion areas. The lower the local texture variance, the closer the denominator is to 1 and the closer the adaptive threshold coefficient is to 1.0, reducing the mislabeling of normal areas. For each pixel, the absolute difference between the gray value and the local average gray value is compared with a segmentation threshold. If the absolute difference between the gray value and the local average gray value is greater than the segmentation threshold, the pixel is marked as 1, representing a potential lesion area; otherwise, the pixel is marked as 0, representing a background area. This process is repeated for the entire preprocessed endoscopic image to generate a binary mask, expressed by the following formula: , in, This represents a binary mask used to represent pixels. A binary marker indicating whether it belongs to a potential lesion area; This indicates the preprocessed endoscopic image in pixels. grayscale value; Represented in pixels The mean gray value within a 5×5 local window centered on the center, i.e., the local average gray value; Represented in pixels The standard deviation of gray values ​​within a 5×5 local window centered on the center is the local gray standard deviation. Indicates the segmentation threshold; The adaptive threshold coefficient is represented by the following formula: , in, This represents the base threshold, setting the benchmark for adjusting the segmentation threshold. ; This represents the texture variance adjustment factor, used to control the weight of the influence of local texture variance on the segmentation threshold, and its value ranges from [value range missing]. ; Representing local texture variance, in pixels The variance of the gradient magnitude within a 5×5 local window centered on the texture is used to quantize texture complexity, and the calculation formula is as follows: , in, Represents a local window, in pixels A 5x5 local window centered on the target; Indicates the number of pixels in a local window; Represents pixels Sobel gradient; Represents pixels The square of the gradient magnitude reflects the local texture intensity; This represents the mean of the gradient magnitudes within a local window; By dynamically adjusting the segmentation threshold using local texture variance, the sensitivity to subtle features of early gastric cancer is increased, reducing missed and false detections, and accurately diagnosing early gastric cancer. This helps doctors detect minute lesions and improves diagnostic efficiency and accuracy. S2. Based on the preprocessed endoscopic image and binary mask, the local binary pattern feature value of each pixel in the potential lesion area is calculated by the local binary pattern based on gradient direction enhancement. The local binary pattern feature values ​​are integrated into a feature vector. Based on the feature vector, it is determined in real time whether the potential lesion area in the endoscopic image is an early gastric cancer lesion. Based on the preprocessed endoscopic image and binary mask, the local binary pattern feature value of each pixel in the potential lesion area is calculated by the local binary pattern based on gradient direction enhancement. The gradient-direction-enhanced local binary pattern enhances the texture representation capability of the traditional local binary pattern by combining gradient direction information. To reduce computational load, feature extraction is performed only on pixels with a mask value of 1, i.e., feature extraction is performed on potential lesion areas, focusing on key clinical regions. For each pixel with a mask value of 1, the gradient direction of neighboring pixels is calculated to capture the directional features of the texture. Specifically, the Sobel operator is used to calculate the gradient in both the horizontal and vertical directions, resulting in two gradient components. The Sobel operator performs edge detection on the preprocessed endoscopic image using a 3×3 convolution kernel. The ratio of the two gradient components is calculated using the arctangent function to obtain the gradient direction of each neighboring pixel, quantized to 8 discrete directions (0°, 45°, 90°, ..., 315°). Simultaneously, the principal gradient direction is calculated within the local window of each pixel as a reference for texture directionality. The gradient direction is quantized into 8 discrete directions (0°, 45°, 90°, 135°, 180°, 225°, 270°, 315°). Each gradient direction corresponds to a direction interval of an orientation histogram. The weight of each direction interval is the gradient magnitude of the corresponding pixel, reflecting the edge strength of the gradient direction. The direction with the largest weight in the orientation histogram is selected as the local principal direction, i.e., the principal gradient direction. When calculating the feature values ​​of local binary patterns, a dynamic orientation weight is introduced. The dynamic orientation weight consists of two parts: a distance factor and a orientation factor. The distance factor is calculated based on the distance from neighboring pixels to the center pixel. The greater the distance, the smaller the dynamic orientation weight, reflecting the lower contribution of distant pixels to the texture. The orientation factor is calculated based on the difference between the gradient direction of neighboring pixels and the local main direction. The smaller the difference, the smaller the dynamic orientation weight, emphasizing textures with inconsistent orientations, which is suitable for the complex and irregular characteristics of early gastric cancer lesion areas. For each pixel with a mask value of 1, eight neighboring pixels are selected centered on this pixel to form a neighborhood structure for a traditional local binary pattern. A binary pattern is generated by comparing the gray values ​​of the center pixel and its neighbors: if the gray value of a neighboring pixel is greater than or equal to the gray value of the center pixel, it is recorded as 1; otherwise, it is recorded as 0. Furthermore, the local binary comparison result (0 or 1) of each neighboring pixel is multiplied by a dynamic direction weight and a position weight, and the results are accumulated to obtain the local binary pattern feature value of the pixel, reflecting the texture intensity. The calculation formula is as follows: , in, Represents pixels Local binary pattern eigenvalues; This represents summing the weighted features of 8 neighboring pixels to integrate the texture information of the neighboring pixels; Indicates the number of neighboring pixels. ; This represents a grayscale comparison function that compares the grayscale values ​​of neighboring pixels with the center pixel. , ,otherwise ; Indicates the first The grayscale value of each neighboring pixel; The grayscale value of the center pixel, i.e., the pixel value. grayscale value; The binary weights of neighboring pixels, i.e., bit weights; The dynamic directional weight is calculated using the following formula: , in, This represents the analysis radius of the neighborhood, used to control the scale of feature extraction; Represents the distance factor; Indicates the direction factor; Indicates the first The gradient direction of each neighboring pixel; The local principal direction is represented by the following formula: , Select the local main direction. This represents the summation of all pixels within a local window. This indicates the preprocessed endoscopic image in pixels. gradient magnitude at that point This represents the direction indicator function, when the pixel... gradient direction Falling into the quantitative direction Direction range If the condition is met, return 1; otherwise, return 0. Indicates the half-width of the quantization interval; This represents the standard deviation of the directional weights, and it is recommended to fix it at a fixed value. ; The local binary pattern feature values ​​of each pixel are integrated into a feature vector and input into a support vector machine model. The support vector machine model determines in real time whether the potential lesion area in the preprocessed endoscopic image is an early gastric cancer lesion, providing endoscopists with fast and accurate auxiliary diagnostic results and meeting the real-time clinical needs. The support vector machine model is a technical means well known to those skilled in the art and will not be described in detail here.

[0023] In summary, a real-time endoscopic image recognition system and method for early gastric cancer based on artificial intelligence has been developed.

[0024] The order of the embodiments is for illustrative purposes only and does not represent the superiority or inferiority of the embodiments. The processes depicted in the drawings do not necessarily require a specific or sequential order to achieve the desired result. In some embodiments, multitasking and parallel processing are possible or may be advantageous.

[0025] The various embodiments in this specification are described in a progressive manner. The same or similar parts between the various embodiments can be referred to each other. Each embodiment focuses on describing the differences from other embodiments.

[0026] The above embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included within the protection scope of the present invention.

Claims

1. A real-time image recognition method for early gastric cancer based on artificial intelligence, characterized in that, Includes the following steps: S1. Acquire the original endoscopic image, perform image preprocessing on the original endoscopic image to obtain the preprocessed endoscopic image, perform adaptive region segmentation on the preprocessed endoscopic image, and output a binary mask. S2. Based on the preprocessed endoscopic image and binary mask, the local binary pattern feature value of each pixel in the potential lesion area is calculated by the local binary pattern based on gradient direction enhancement. The local binary pattern feature values ​​are integrated into a feature vector. Based on the feature vector, it is determined in real time whether the potential lesion area in the endoscopic image is an early gastric cancer lesion.

2. The method for real-time recognition of endoscopic images of early gastric cancer based on artificial intelligence according to claim 1, characterized in that, S1 specifically includes: In the process of implementing adaptive region segmentation on the preprocessed endoscopic image, local statistics are calculated for each pixel of the preprocessed endoscopic image, including the local average gray value and the local gray standard deviation.

3. The method for real-time recognition of endoscopic images of early gastric cancer based on artificial intelligence according to claim 2, characterized in that, S1 specifically includes: In the process of adaptive region segmentation of the preprocessed endoscopic image, the local average gray value is calculated by traversing the pixels within the window to obtain the arithmetic mean of the gray values, reflecting the gray baseline level of the local region; the local gray standard deviation is calculated by calculating the standard deviation of the gray values ​​within the window to quantify the degree of gray change.

4. The method for real-time recognition of endoscopic images of early gastric cancer based on artificial intelligence according to claim 1, characterized in that, S1 specifically includes: In the process of adaptive region segmentation of preprocessed endoscopic images, for each pixel within a local window, the Sobel gradient, the gradient magnitude of the pixel, and the mean of the gradient magnitudes of all pixels within the window are calculated. The average of the squared difference between the pixel gradient magnitude and the mean is then calculated to obtain the local texture variance. Based on the local grayscale standard deviation, the segmentation threshold is calculated.

5. The method for real-time recognition of endoscopic images of early gastric cancer based on artificial intelligence according to claim 4, characterized in that, S1 specifically includes: The segmentation threshold is the product of the local grayscale standard deviation and the adaptive threshold coefficient. The adaptive threshold coefficient is defined by its reciprocal form to control the influence of the local texture variance on the segmentation threshold. For each pixel, the absolute difference between the grayscale value and the local average grayscale value is compared with the segmentation threshold. When the absolute difference between the grayscale value and the local average grayscale value is greater than the segmentation threshold, it represents a potential lesion area; otherwise, it represents a background area. The entire preprocessed endoscopic image is traversed to generate a binary mask.

6. The method for real-time recognition of endoscopic images of early gastric cancer based on artificial intelligence according to claim 1, characterized in that, S2 specifically includes: Feature extraction is performed on pixels with a mask value of 1 to extract features from potential lesion areas. For each pixel with a mask value of 1, the Sobel operator is used to calculate the gradient in the horizontal and vertical directions to obtain two gradient components. The Sobel operator performs edge detection on the preprocessed endoscopic image through a convolution kernel. The ratio of the two gradient components is calculated using the arctangent function to obtain the gradient direction of each neighboring pixel.

7. The method for real-time recognition of endoscopic images of early gastric cancer based on artificial intelligence according to claim 6, characterized in that, S2 specifically includes: The principal gradient direction is calculated within a local window of each pixel as a reference for texture directionality. Each gradient direction corresponds to a direction interval of an orientation histogram. The weight of each direction interval is the gradient magnitude of the corresponding pixel, reflecting the edge strength of the gradient direction. The direction with the largest weight in the orientation histogram is selected as the local principal direction, i.e., the principal gradient direction.

8. The method for real-time recognition of endoscopic images of early gastric cancer based on artificial intelligence according to claim 7, characterized in that, S2 specifically includes: When calculating the local binary pattern feature value, a dynamic orientation weight is introduced, which consists of a distance factor and a orientation factor. The distance factor is calculated based on the distance from the neighboring pixels to the center pixel, and the orientation factor is calculated based on the difference between the gradient direction of the neighboring pixels and the local main direction. A binary pattern is generated by comparing the gray values ​​of the center pixel and the neighboring pixels. The local binary comparison result of each neighboring pixel is multiplied by the dynamic orientation weight and the position weight, and the result is accumulated to obtain the local binary pattern feature value of the pixel.

9. A real-time endoscopic image recognition system for early gastric cancer based on artificial intelligence, applied to the real-time endoscopic image recognition method for early gastric cancer based on artificial intelligence as described in claim 1, characterized in that, Includes the following parts: Image acquisition module, image preprocessing module, region segmentation module, feature extraction module, lesion classification module; Image acquisition module: Acquires raw endoscopic images using clinical endoscopic equipment and outputs the raw endoscopic images to the image preprocessing module; Image preprocessing module: preprocesses the original endoscopic images from the image acquisition module to obtain preprocessed endoscopic images, and outputs the preprocessed endoscopic images to the region segmentation module and the feature extraction module; Region segmentation module: Performs adaptive region segmentation on the preprocessed endoscopic image from the image preprocessing module, generates a binary mask, and outputs the binary mask to the feature extraction module; Feature extraction module: Based on the preprocessed endoscopic image from the image preprocessing module and the binary mask from the region segmentation module, for pixels marked as potential lesion areas by the mask, calculate local binary pattern feature values ​​based on gradient direction enhancement, integrate them into a feature vector, and output the feature vector to the lesion classification module; Lesion classification module: The support vector machine model is used to classify the feature vectors generated by the feature extraction module and to determine in real time whether the potential lesion area is an early gastric cancer lesion.