Gastric cancer gastroscope image intelligent segmentation method and chip based on multi-scale convolutional network
Patent Information
- Application Number
- CN202611225161.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-13
- Publication Date
- 2026-10-09
AI Technical Summary
[0005]本发明提供了基于多尺度卷积网络的胃癌胃镜影像智能分割方法及芯片,用于解决胃镜影像中因表层干扰和中层纹理特征利用不足导致分割精度降低的问题
本发明的技术方案首先对原始胃镜影像进行尺寸归一化和色彩校正,使不同批次、不同条件下获取的胃镜影像具有统一的尺寸规格和稳定的色彩分布,为后续分割网络提供标准化的输入数据,有效避免因尺寸不一致和色彩差异导致的分割精度下降。
Smart Images

Figure CN122888249A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of intelligent chip technology, specifically to an intelligent segmentation method and chip for gastric cancer endoscopic images based on multi-scale convolutional networks. Background Technology
[0002] Gastroscopy image analysis is an important means of gastric cancer screening. In actual clinical gastroscopy images, reflective areas and air bubbles are commonly found. At the same time, abnormal areas related to gastric cancer often appear as tiny breaks in the continuous texture of normal gastric mucosa, and lack clear boundaries with normal mucosal areas.
[0003] In existing technologies, traditional preprocessing methods, when removing reflections and air bubble interference, blur the details of normal gastric mucosal texture around the interference area, leading to the loss of crucial local texture information during subsequent segmentation. Segmentation methods based on single-scale convolutional networks, limited by a fixed receptive field size, struggle to effectively capture local texture anomalies such as minute fractures while simultaneously learning the morphology of a large area of the gastric mucosa. Conventional segmentation networks exhibit uncertainty in pixel classification for blurred-boundary areas during image resolution decoding, easily resulting in jagged segments or misclassifications.
[0004] Therefore, the aforementioned problems make it difficult for the segmentation accuracy of abnormal areas related to gastric cancer in gastroscopy images to meet the requirements of clinical auxiliary diagnosis. Summary of the Invention
[0005] This invention provides an intelligent segmentation method and chip for gastric cancer endoscopic images based on multi-scale convolutional networks, which solves the problem of reduced segmentation accuracy in gastroscopic images due to surface interference and insufficient utilization of mid-layer texture features.
[0006] In a first aspect, the present invention provides an intelligent segmentation method for gastric cancer endoscopic images based on multi-scale convolutional networks, comprising: The original gastroscopy images were sequentially subjected to size normalization and color correction to obtain preprocessed gastroscopy images. The preprocessed gastroscopy images are input into a pre-trained multi-scale convolutional segmentation network. The multi-scale convolutional segmentation network includes a segmentation main branch, a surface interference suppression auxiliary branch, and a mid-level texture perception auxiliary branch. Multi-scale image features are extracted by the segmentation main branch, and auxiliary features are extracted by the surface interference suppression auxiliary branch and the mid-level texture perception auxiliary branch, respectively. The auxiliary features are used to perform weighted regulation and cross-scale fusion on the multi-scale image features, and a fused feature map is output. The fused feature map is decoded and restored to output a pixel-level segmentation mask image corresponding to the original gastroscopy image.
[0007] Secondly, this invention provides an intelligent segmentation chip for gastric cancer endoscopic images based on a multi-scale convolutional network, comprising: The image preprocessing unit is used to perform size normalization and color correction on the original gastroscopy images in sequence to obtain preprocessed gastroscopy images. A multi-scale feature extraction and fusion unit is used to input the preprocessed gastroscopy image into a pre-trained multi-scale convolutional segmentation network. The multi-scale convolutional segmentation network includes a segmentation main branch, a surface interference suppression auxiliary branch, and a mid-layer texture perception auxiliary branch. The segmentation main branch extracts multi-scale image features, and the surface interference suppression auxiliary branch and the mid-layer texture perception auxiliary branch extract auxiliary features respectively. The auxiliary features are used to perform weighted regulation and cross-scale fusion of the multi-scale image features, and output a fused feature map. The decoding and restoration unit is used to decode and restore the fused feature map and output a pixel-level segmentation mask image corresponding to the original gastroscopy image.
[0008] One or more technical solutions provided in this invention have at least the following technical effects or advantages: The technical solution of this invention first performs size normalization and color correction on the original gastroscopy images, so that gastroscopy images acquired in different batches and under different conditions have uniform size specifications and stable color distribution, providing standardized input data for the subsequent segmentation network and effectively avoiding the decrease in segmentation accuracy caused by size inconsistencies and color differences.
[0009] Furthermore, the preprocessed image is input into a multi-scale convolutional segmentation network. Multi-scale features are extracted by the main segmentation branch, and two auxiliary branches generate spatial masks of interference regions and texture anomaly heatmaps, respectively. The multi-scale features are weighted and controlled to suppress interference and enhance anomalies. The resulting fused feature map effectively suppresses the negative impact of surface interference such as reflections and bubbles on feature extraction, while enhancing the texture response of abnormal regions related to gastric cancer. This allows the fused feature map to possess multi-scale spatial information, interference suppression capabilities, and enhanced perception capabilities of lesion regions.
[0010] Finally, the fused feature map is upsampled layer by layer and skip connections are used to restore the resolution. Comprehensive attention guidance is applied during the process. Finally, a pixel-level segmentation mask image is output after thresholding. In the process of resolution restoration, spatial information loss and boundary blurring are prevented. The output pixel-level segmentation mask image with clear boundaries and accurate positioning provides reliable lesion area localization results for clinical diagnosis.
[0011] In summary, the technical solution of the present invention effectively solves the problems of surface interference, difficulty in capturing micro-texture breaks, and jagged segmentation caused by blurred boundaries, and significantly improves the segmentation accuracy and robustness of abnormal areas related to gastric cancer. Attached Figure Description
[0012] Figure 1 This is a flowchart illustrating the intelligent segmentation method for gastric cancer endoscopic images based on multi-scale convolutional networks provided by the present invention.
[0013] Figure 2 This is a schematic diagram of the structure of the multi-scale convolutional segmentation network in the intelligent segmentation method for gastric cancer endoscopic images based on multi-scale convolutional networks provided by the present invention.
[0014] Figure 3 This is a schematic diagram of the structure of the intelligent segmentation chip for gastric cancer endoscopic images based on multi-scale convolutional networks provided by the present invention.
[0015] In the attached diagram, the labels representing each component are as follows: Image preprocessing unit 11, multi-scale feature extraction and fusion unit 12, and decoding and restoration unit 13. Detailed Implementation
[0016] This invention provides an intelligent segmentation method and chip for gastric cancer endoscopic images based on multi-scale convolutional networks, which solves the problem of reduced segmentation accuracy caused by surface interference and insufficient utilization of mid-layer texture features in gastroscopic images.
[0017] It should be noted that the terms "comprising" and "having" are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or server that includes a series of steps or units is not necessarily limited to those steps or units that are explicitly listed, but may include other steps or modules that are not explicitly listed or that are inherent to these processes, methods, products, or devices.
[0018] Example 1, as Figure 1 As shown, this invention provides an intelligent segmentation method for gastric cancer endoscopic images based on multi-scale convolutional networks, the method comprising: S100: The original gastroscopy images are sequentially subjected to size normalization and color correction to obtain preprocessed gastroscopy images.
[0019] This step involves performing size normalization and color correction on the original gastroscopy images to eliminate size differences caused by different acquisition devices or settings, as well as color deviations caused by different light source conditions.
[0020] Step S100 in the method provided by the present invention includes: The original gastroscopy image is scaled to a preset uniform size using bilinear interpolation to obtain a size-normalized gastroscopy image. The size-normalized gastroscopy image is subjected to color correction processing to obtain a color-corrected gastroscopy image. The color-corrected gastroscopy image is used as the preprocessed gastroscopy image.
[0021] Specifically, the original gastroscopy image is first scaled to a preset uniform size using bilinear interpolation to obtain a size-normalized gastroscopy image. The preset uniform size is set according to the input layer size of the segmentation network and can be set to 512×512 pixels.
[0022] The bilinear interpolation method is calculated as follows: Let the coordinates of a pixel in the target image be (i,j), and the coordinates mapped back to the original image be (x,y), where x and y are floating-point numbers. Take the four pixels in the original image that are closest to (x,y), with coordinates ([x],[y]), ([x]+1,[y]), ([x],[y]+1), and ([x]+1,[y]+1) respectively. First, perform linear interpolation on the top and bottom rows horizontally, using the formula f(x,[y])=([x]+1-x)·f([x],[y])+(x-[x])·f([x]+1,[y]), and calculate f(x,[y]+1) similarly. Then, perform linear interpolation on the two intermediate results vertically, resulting in the final target pixel value f(x,y)=([y]+1-y)·f(x,[y])+(y-[y])·f(x,[y]+1). By iterating through all pixel positions of the target image using the above formula, the size-normalized gastroscopy image is obtained.
[0023] For example, suppose a gastroscopy image with dimensions of 1920×1080 pixels is obtained. This image is then scaled down to 512×512 pixels using bilinear interpolation. Taking the pixel at row 100, column 200 of the target image as an example, the scaling ratios are 512 / 1920≈0.2667 and 512 / 1080≈0.4741, mapping back to the original image coordinates as (200 / 0.2667, 100 / 0.4741)≈(750.0, 210.9). The pixel values of four neighboring pixels in the original image (750, 210), (751, 210), (750, 211), and (751, 211) are taken. The horizontal interpolation is calculated first, followed by the vertical interpolation, using the formula described above to obtain the target pixel value. After all pixels of the target image have been calculated, the normalized gastroscopy image is obtained, with a size of 512×512 pixels.
[0024] In this step, the size-normalized gastroscopy image undergoes color correction processing to obtain a color-corrected gastroscopy image, including: The grayscale world algorithm is used to calculate the channel mean values of the size-normalized gastroscopy image in the red, green, and blue channels respectively. The channel mean value of the green channel is used as the benchmark. The channel mean value of the red channel is divided by the channel mean value of the green channel to obtain the red channel gain coefficient. The channel mean value of the blue channel is divided by the channel mean value of the green channel to obtain the blue channel gain coefficient. The red channel pixel value of each pixel in the size-normalized gastroscopy image is multiplied by the red channel gain coefficient, the blue channel pixel value of each pixel is multiplied by the blue channel gain coefficient, and the green channel pixel value remains unchanged to obtain the color-corrected gastroscopy image.
[0025] Specifically, the grayscale world algorithm is used to calculate the channel mean values of the size-normalized gastroscopy image in the red, green, and blue channels, denoted as R, G, and B respectively. Using the green channel mean value as a benchmark, the gain coefficient k1 = G / R for the red channel and k2 = G / B for the blue channel are calculated. The green channel gain coefficient is considered to be 1, and the pixel value remains unchanged.
[0026] Then, the red channel pixel value of each pixel in the size-normalized gastroscopy image is multiplied by the red channel gain coefficient k1, the blue channel pixel value is multiplied by the blue channel gain coefficient k2, and the green channel pixel value remains unchanged to obtain the color-corrected gastroscopy image. The mean values of the red and blue channels of the corrected image are adjusted to be consistent with the mean value of the green channel.
[0027] For example, a normalized gastroscopy image has a size of 512×512 pixels and an overall reddish tint due to the endoscopic light source. Calculate the pixel mean values for the three channels, assuming R=185, G=118, and B=96. Calculate the gain coefficients: k1=118 / 185≈0.638, k2=118 / 96≈1.229. Correct each pixel in the image. For example, a pixel with original values (R=200, G=100, B=80) will have a corrected red channel value of 200×0.638≈128, a blue channel value of 80×1.229≈98, and a green channel value remaining unchanged at 100. After correcting all pixels, the average value of the red channel is adjusted from 185 to 118, the average value of the blue channel is adjusted from 96 to 118, aligning with the average value of the green channel. The overall reddish tint is eliminated, resulting in a color-corrected gastroscopy image.
[0028] Finally, the above color-corrected gastroscopy image is the preprocessed gastroscopy image, with a size of 512×512 pixels. The average values of the three color channels are consistent, and the color performance is uniform. It can be directly processed in subsequent steps.
[0029] It should be noted that the above values are for illustrative purposes only and do not constitute a limitation on the present invention.
[0030] In summary, this step ensures that gastroscopy images acquired in different batches and under different conditions have uniform size specifications and stable color distribution, effectively avoiding a decrease in segmentation accuracy caused by inconsistent size and color differences.
[0031] S200: The preprocessed gastroscopy image is input into a pre-trained multi-scale convolutional segmentation network. The multi-scale convolutional segmentation network includes a segmentation main branch, a surface interference suppression auxiliary branch, and a mid-level texture perception auxiliary branch. Multi-scale image features are extracted by the segmentation main branch, and auxiliary features are extracted by the surface interference suppression auxiliary branch and the mid-level texture perception auxiliary branch, respectively. The auxiliary features are used to perform weighted regulation and cross-scale fusion on the multi-scale image features, and a fused feature map is output.
[0032] This step involves inputting the preprocessed gastroscopy image as follows: Figure 2 The pre-trained multi-scale convolutional segmentation network shown includes a segmentation main branch, a surface interference suppression auxiliary branch, and a mid-level texture perception auxiliary branch. The segmentation main branch extracts multi-scale image features, and the two auxiliary branches extract spatial masks of interference regions and texture anomaly heatmaps as auxiliary features. The auxiliary features are used to perform weighted regulation and cross-scale fusion of multi-scale image features.
[0033] Step S200 in the method provided by the present invention includes: The preprocessed gastroscopy images are input into a pre-trained multi-scale convolutional segmentation network. The processing within the multi-scale convolutional segmentation network includes: The segmentation main branch includes a first convolutional branch, a second convolutional branch, and a third convolutional branch. The first convolutional branch uses a 7×7 convolutional kernel, the second convolutional branch uses a 5×5 convolutional kernel, and the third convolutional branch uses a 3×3 convolutional kernel. The three convolutional branches simultaneously extract feature maps from the color-corrected gastroscopy images of the preprocessed gastroscopy images to form multi-scale image features. The surface interference suppression auxiliary branch takes the color-corrected gastroscopy image of the preprocessed gastroscopy image as input, and outputs an interference region spatial mask of the same size as the color-corrected gastroscopy image through a fully convolutional network with an encoder-decoder structure. The value of each pixel in the interference region spatial mask represents the probability that the pixel belongs to the reflective region or the bubble region, and the value range is 0 to 1. The mid-layer texture perception auxiliary branch performs difference quantification on the texture pattern of each pixel in the color-corrected gastroscopy image of the preprocessed gastroscopy image and the pre-learned normal gastric mucosa texture pattern, and outputs a texture anomaly heatmap. The value of each pixel in the texture anomaly heatmap represents the degree to which the texture of that pixel deviates from the normal mucosa, and the value range is 0 to 1. In the feature fusion stage of the segmented main branch, the spatial mask of the interference region is inverted and multiplied pixel by pixel with the multi-scale image features to obtain the interference-suppressed multi-scale image features. Then, the texture anomaly heatmap is multiplied pixel by pixel with the interference-suppressed multi-scale image features to obtain the weighted multi-scale image features. The weighted multi-scale image features are concatenated in the channel dimension, and 1×1 convolution is used to reduce the channel dimension of the concatenated features to obtain the fused feature map.
[0034] Specifically, a pre-trained multi-scale convolutional segmentation network is used. The main segmentation branch contains three parallel convolutional branches with kernel sizes of 7×7, 5×5, and 3×3, respectively. All branches take color-corrected gastroscopy images as input and simultaneously extract feature maps from different receptive fields to form multi-scale image features.
[0035] Specifically, a 7×7 convolutional kernel is used to capture global contextual information such as the overall morphology and large-scale structural orientation of the gastric mucosa, a 5×5 convolutional kernel takes into account regional texture distribution and local morphological changes, and a 3×3 convolutional kernel accurately captures minute breaks and boundary details of the mucosal texture. The parallel application of these three methods can simultaneously cover multi-level information from global morphology to local details, avoiding information omissions caused by single-scale convolutional kernels.
[0036] For example, the color-corrected gastroscopy image is 512×512 pixels in size, with 3 channels. It is fed into three convolutional branches, each with a stride of 1 and padding of 3, 2, and 1 respectively to maintain the output size. The output channels are all 64, with receptive fields of 7×7, 5×5, and 3×3 pixels respectively. The feature maps output from the three branches are combined in terms of channel dimensions to form a 192-channel multi-scale image feature.
[0037] Furthermore, the surface interference suppression auxiliary branch takes the color-corrected gastroscopy image from the preprocessed gastroscopy image as input, and outputs a spatial mask of the interference region with the same size as the color-corrected gastroscopy image through a fully convolutional network with an encoder-decoder structure.
[0038] The encoder extracts semantic features of the interference region by downsampling layer by layer, while the decoder restores the feature map to the input size by upsampling layer by layer. The value of each pixel in the interference region spatial mask represents the probability that the pixel belongs to the reflective region or the bubble region, with a value ranging from 0 to 1. The closer the value is to 1, the more likely the pixel is to belong to the interference region.
[0039] For example, the encoder contains four downsampling stages, each consisting of two 3×3 convolutional layers and one 2×2 max-pooling layer. The feature map size is progressively reduced to 256×256, 128×128, 64×64, and 32×32, while the number of channels progressively increases to 64, 128, 256, and 512. The decoder contains four upsampling stages, each consisting of one 2×2 deconvolutional layer and two 3×3 convolutional layers. The size is progressively restored to 512×512, while the number of channels progressively decreases to 256, 128, 64, and 1. The final layer uses the Sigmoid activation function to output a spatial mask for the interference region, where pixel values in the interference region are close to 1, and pixel values in the normal tissue region are close to 0.
[0040] Next, the mid-layer texture perception auxiliary branch quantifies the difference between the texture patterns of each pixel in the color-corrected gastroscopy image and the pre-learned normal mucosal texture pattern, outputting a texture anomaly heatmap. The pre-learned normal mucosal texture pattern is obtained through self-supervised reconstruction training in the second stage of pre-training. The branch contains a texture feature encoder that maps the input image patch into a 256-dimensional texture feature vector. The texture anomaly is obtained by calculating the Euclidean distance d between this vector and the center vector C of the normal mucosal texture features, and normalizing it to the 0-1 range using d'=d / (1+d). In the heatmap, a value closer to 1 indicates a higher degree of texture anomaly.
[0041] For example, the texture feature encoder contains four 3×3 convolutional layers with channel numbers of 32, 64, 128, and 256 respectively. Each layer is followed by ReLU and 2×2 max pooling, and then three fully connected layers, ultimately outputting a 256-dimensional texture feature vector. The center vector C of the normal mucosal texture features is calculated from the mean of the texture feature vectors of all normal mucosal image blocks in the second pre-training stage, with a dimension of 256. During inference, an 11×11 pixel image block is taken centered on each pixel, and the texture feature vector v is extracted. The value d = ||vC||2 is calculated and normalized. After traversing all pixels, a texture anomaly heatmap of size 512×512 is obtained. The abnormal areas related to gastric cancer have heatmap values close to 1 due to texture breaks; the heatmap values of normal mucosal areas are close to 0.
[0042] Finally, in the feature fusion stage of the main branch segmentation, two weighted adjustments are performed sequentially: interference suppression and texture enhancement, followed by channel stitching and dimensionality reduction fusion. First, the spatial mask of the interference region is inverted (i.e., 1 minus the original value), changing the probability value of the interference region from close to 1 to close to 0. The inverted mask is then copied to 192 channels and multiplied pixel-by-pixel with the multi-scale image features. The feature response of the interference region is attenuated, resulting in the multi-scale image features after interference suppression.
[0043] Then, the texture anomaly heatmap is copied to 192 channels in the channel dimension and multiplied pixel by pixel with the interference-suppressed multi-scale image features. The feature response of the texture anomaly region is enhanced, while the response of the normal mucosa region is attenuated, resulting in the weighted multi-scale image features.
[0044] Finally, 128 1×1 convolutional kernels are used to perform channel dimensionality reduction on the weighted and modulated features of 192 channels, and a fused feature map of 128 channels with a size of 512×512×128 is output.
[0045] The process involves first multiplying the inverse mask to attenuate the interference response, replacing the blurring of surrounding textures during the removal of reflective bubbles in traditional preprocessing; then multiplying by a texture anomaly heatmap to enhance the response of abnormal regions, making the segmentation main branch more sensitive to gastric cancer-related abnormal regions; and finally, 1×1 convolution to achieve cross-channel information integration and dimensionality reduction while maintaining spatial resolution.
[0046] For example, the spatial mask size for the interference region is 512×512×1. After inversion, the probability value of the interference region changes from close to 1 to close to 0. The multi-scale image feature size is 512×512×192. After copying the inverted mask 192 times in the channel dimension, it is multiplied pixel-by-pixel with the multi-scale image feature, and the response of the interference region feature is attenuated, resulting in a 512×512×192 interference-suppressed feature. The texture anomaly heatmap size is 512×512×1. After copying it 192 times in the channel dimension, it is multiplied pixel-by-pixel with the interference-suppressed feature, and the response of the abnormal region is enhanced while the response of the normal region is attenuated, resulting in a 512×512×192 weighted feature. 128 1×1 convolutional kernels are used to perform convolutional dimensionality reduction on the 192-channel features, outputting a 512×512×128 fused feature map. This feature map suppresses surface interference, enhances the response of texture anomaly regions, and fuses feature information from three scales.
[0047] In this step, the pre-training process of the multi-scale convolutional segmentation network includes: Collect a set of gastroscopy image samples with segmentation labels, the segmentation labels including pixel-level annotations of normal mucosal areas, gastric cancer-related abnormal areas, reflective areas and bubble areas; Each gastroscopy image sample in the gastroscopy image sample set is sequentially subjected to size normalization and color correction to obtain a preprocessed gastroscopy image sample set. An initial multi-scale convolutional segmentation network is constructed, which includes a segmentation main branch, a surface interference suppression auxiliary branch, and a mid-layer texture perception auxiliary branch. In the first stage, the parameters of the mid-layer texture perception auxiliary branch are fixed. The preprocessed gastroscopy image sample set is used as input, and the labels of reflective areas and bubble areas in the segmentation labels are used as supervision signals. The surface interference suppression auxiliary branch is trained separately using the binary cross-entropy loss function until convergence. In the second stage, the parameters of the surface interference suppression auxiliary branch are frozen. The image block containing only the normal gastric mucosa area in the preprocessed gastroscopy image sample set is used as input. The goal is to reconstruct the image block. The mean squared error loss function is used to train the middle texture perception auxiliary branch separately until convergence. In the third stage, the parameters of the surface interference suppression auxiliary branch and the middle texture perception auxiliary branch are frozen. The preprocessed gastroscopy image sample set is used as input, and the labels of normal mucosal areas and gastric cancer-related abnormal areas in the segmentation labels are used as supervision signals. The binary cross-entropy loss function is used to train the segmentation main branch until convergence. In the fourth stage, all parameters of the segmentation main branch, the surface interference suppression auxiliary branch, and the mid-layer texture perception auxiliary branch are unfrozen. Using the preprocessed gastroscopy image sample set as input, the segmentation loss of the segmentation main branch, the mask prediction loss of the surface interference suppression auxiliary branch, and the texture reconstruction loss of the mid-layer texture perception auxiliary branch are weighted and summed to obtain a joint loss function. With minimizing the joint loss function as the optimization objective, all parameters of the three branches are jointly fine-tuned until convergence, resulting in a pre-trained multi-scale convolutional segmentation network.
[0048] Specifically, a set of gastroscopy image samples with segmentation labels was first collected. The segmentation labels included pixel-level annotations of normal mucosal areas, gastric cancer-related abnormal areas, reflective areas, and bubble areas. Each gastroscopy image sample in the set was then subjected to size normalization and color correction to obtain a preprocessed set of gastroscopy image samples.
[0049] For example, 1000 gastroscopy images were collected from a hospital's gastroscopy image database. Each image was pixel-level annotated by a professional physician, with four categories: normal mucosal areas marked as 0, abnormal areas related to gastric cancer marked as 1, reflective areas marked as 2, and bubble areas marked as 3. Each image was uniformly normalized to 512×512 pixels, and color correction employed a grayscale algorithm based on the green channel to ensure consistent mean values across the red, green, and blue channels. The resulting preprocessed gastroscopy image sample set contained 1000 512×512 pixel images and their corresponding four-category segmentation labels.
[0050] Furthermore, an initial multi-scale convolutional segmentation network was constructed, comprising a main segmentation branch, a surface interference suppression auxiliary branch, and a mid-level texture perception auxiliary branch. The main segmentation branch contains three parallel convolutional branches with kernel sizes of 7×7, 5×5, and 3×3, respectively; the surface interference suppression auxiliary branch is a fully convolutional network with an encoder-decoder structure; and the mid-level texture perception auxiliary branch contains a texture feature encoder used to extract texture feature vectors from image patches. The network parameters of all three branches were randomly initialized.
[0051] For example, the kernel parameters of the three convolutional branches in the main branch are initialized using the Xavier initialization method, with the bias term initialized to 0, and each branch outputting 64 channels. The encoder of the surface interference suppression auxiliary branch contains four downsampling stages, each consisting of two 3×3 convolutional layers and one 2×2 max-pooling layer, with channel numbers of 64, 128, 256, and 512 respectively; the decoder contains four upsampling stages, each consisting of one 2×2 deconvolutional layer and two 3×3 convolutional layers, with channel numbers of 256, 128, 64, and 1 respectively. The texture feature encoder of the mid-layer texture perception auxiliary branch contains four convolutional layers and three fully connected layers, ultimately outputting a 256-dimensional texture feature vector. All convolutional layer parameters are initialized using the Xavier initialization method, and the fully connected layer parameters are initialized using a normal distribution with a mean of 0 and a standard deviation of 0.01.
[0052] Furthermore, in the first stage, the parameters of the mid-layer texture perception auxiliary branch are fixed so that it does not participate in the backpropagation of this stage. Using the preprocessed gastroscopy image sample set as input, and the labels of reflective and bubble regions in the segmentation tags as supervision signals, pixels from reflective and bubble regions are merged as positive samples, while pixels from other regions are used as negative samples. A binary cross-entropy loss function is used to train the surface interference suppression auxiliary branch separately. Training continues until the validation set loss no longer decreases for a preset number of cycles, which is considered convergence. The preset number of cycles can be set to 5.
[0053] The binary cross-entropy loss function is calculated as follows: L1=-(1 / N1)·Σ[gi·log(mi)+(1-gi)·log(1-mi)], where N1 is the total number of pixels, gi is the true label of the i-th pixel, which is 1 when it belongs to the reflective or bubble region, and 0 otherwise, and mi is the predicted probability value of the i-th pixel in the spatial mask of the interference region.
[0054] The first stage involves training a separate auxiliary branch for surface interference suppression, allowing this branch to focus on learning the visual features of reflections and bubbles, thus avoiding interference from the training signal of the main branch with the detection accuracy of the interference area.
[0055] For example, 1000 preprocessed gastroscopy images are input into the initial network. The parameters of the middle-layer texture perception auxiliary branch are fixed and do not receive gradient updates. Although the segmentation main branch participates in forward propagation, its output does not calculate the loss in this stage. The labels of reflective and bubble regions are extracted from the segmentation labels and merged into a binary mask as the true labels of the interference regions. The surface interference suppression auxiliary branch outputs a spatial mask of interference regions with a size of 512×512, where each pixel value is a probability between 0 and 1. If the true label of a pixel is 1 and the predicted probability is 0.85, the loss for that pixel is -log(0.85)≈0.1625; if the true label of a pixel is 0 and the predicted probability is 0.12, the loss for that pixel is -log(1-0.12)≈0.1278. The Adam optimizer is used to update the parameters, with a learning rate of 0.001 and a batch size of 8. Training continues until the validation set loss no longer decreases for 5 consecutive epochs, which is considered convergence.
[0056] Furthermore, the second stage involves freezing the parameters of the surface interference suppression auxiliary branch. Taking the image block containing only the normal gastric mucosa area in the preprocessed gastroscopy image sample set as input, and reconstructing the image block as the goal, the mid-layer texture perception auxiliary branch is trained separately using the mean squared error loss function. The training continues until the validation set loss no longer decreases for a preset number of consecutive cycles, which is considered as convergence. The preset number of cycles can be set to 5.
[0057] In this step, the parameters of the surface interference suppression auxiliary branch are frozen. Using image blocks containing only normal gastric mucosa areas from the preprocessed gastroscopy image sample set as input, and aiming to reconstruct these image blocks, the mid-layer texture perception auxiliary branch is trained separately using the mean squared error loss function until convergence. This includes: From the preprocessed gastroscopy image sample set, image blocks containing only normal gastric mucosa areas are extracted according to the segmentation labels, and the size of the image blocks is a preset block size; An autoencoder network containing an encoder and a decoder is constructed as a mid-level texture-aware auxiliary branch. The encoder compresses the image patch into a low-dimensional feature vector through multiple convolutional layers and downsampling layers. The decoder reconstructs a reconstructed image patch of the same size as the original image patch from the low-dimensional feature vector through multiple upsampling layers and convolutional layers. Using the image patch as input and reconstructing the image patch as the goal, the pixel-level mean square error between the original image patch and the reconstructed image patch is calculated as a loss function to train the autoencoder network until the loss function converges. After training, each pixel in the color-corrected gastroscopy image of the preprocessed gastroscopy image and the pixels in the surrounding preset neighborhood window constitute an image block to be evaluated. This block is input into the autoencoder, and the pixel-level mean square error between the reconstructed image block and the image block to be evaluated is calculated. The pixel-level mean square error is used as the texture anomaly degree of each pixel. The texture anomaly degrees of all pixels are normalized to the range of 0 to 1, and a texture anomaly degree heatmap is generated.
[0058] Specifically, from the preprocessed gastroscopy image sample set, image blocks containing only normal gastric mucosa areas are extracted based on segmentation labels. The size of the image blocks is a preset block size, such as 64×64 pixels. During extraction, the image blocks are cropped from the color-corrected gastroscopy images with the pixels within the normal mucosa area as the center, according to the preset block size, to ensure that all pixels within the image block belong to the normal mucosa area.
[0059] For example, select a 512×512 pixel gastroscopy image from the preprocessed gastroscopy image sample set. In its segmentation label, the pixels representing the normal mucosal region are marked as 0. Centered on a pixel at coordinates (200, 300) within the normal mucosal region, crop a 64×64 pixel image block. The cropping range is from row 168 to 231 and column 268 to 331. Check that all pixels within this range have a segmentation label value of 0, confirming that the image block contains only the normal mucosal region. In this way, 5000 normal mucosal image blocks are extracted from 1000 gastroscopy image samples as training samples.
[0060] Secondly, an autoencoder network containing an encoder and a decoder is constructed as a mid-level texture-aware auxiliary branch. The encoder compresses image patches into low-dimensional feature vectors through multiple convolutional and downsampling layers, while the decoder reconstructs reconstructed image patches of the same size as the original image patches from the low-dimensional feature vectors through multiple upsampling and convolutional layers. The low-dimensional feature vectors are set to 256 dimensions.
[0061] For example, the encoder contains four convolutional stages, each consisting of two 3×3 convolutional layers and one 2×2 max-pooling layer. The input is a 64×64 pixel, 3-channel image patch. The first convolutional layer has 32 channels, outputting a feature map of size 32×32×32; the second convolutional layer has 64 channels, outputting a feature map of size 16×16×64; the third convolutional layer has 128 channels, outputting a feature map of size 8×8×128; and the fourth convolutional layer has 256 channels, outputting a feature map of size 4×4×256. Then, a fully connected layer compresses the 4×4×256=4096-dimensional features into a 256-dimensional low-dimensional feature vector. The decoder contains a fully connected layer that restores the 256-dimensional vector to 4096 dimensions. Then, it goes through four upsampling stages, each consisting of a 2×2 deconvolutional layer and two 3×3 convolutional layers, with channel numbers of 256, 128, 64, and 32 respectively, ultimately outputting a 64×64×3 reconstructed image patch. All convolutional layers use the ReLU activation function, and the output layer uses the Sigmoid activation function to map pixel values to the 0-1 range.
[0062] Next, using image patches as input and reconstructed image patches as the target, the pixel-level mean square error between the original image patch and the reconstructed image patch is calculated as the loss function. This loss function is then used to train the autoencoder network until it converges. The formula for calculating the loss function is: L2=(1 / M)·Σ(xi-x̂i) 2 , where M is the total number of pixels in the image block, i.e., M = 64 × 64 × 3 = 12288, xi is the value of the i-th pixel in the original image block, and x̂i is the value of the i-th pixel in the reconstructed image block.
[0063] For example, 5000 extracted 64×64 pixel normal gastric mucosal image patches are used as the training set, with a batch size of 16. Each batch contains 16 image patches, which are input into the encoder, compressed into a 256-dimensional feature vector, and then reconstructed into 64×64×3 image patches by the decoder. The mean squared error between the reconstructed image patches and the original image patches is calculated; for example, if the average loss for a certain batch is 0.0032, the Adam optimizer is used to update the network parameters with a learning rate of 0.001. Training continues until the validation set loss no longer decreases for five consecutive epochs, which is considered convergence. After training, the autoencoder learns the texture distribution features of normal gastric mucosa and can reconstruct normal mucosal image patches with low error.
[0064] Finally, after training, each pixel in the color-corrected gastroscopy image of the preprocessed gastroscopy image and the pixels in the surrounding preset neighborhood window constitute the image block to be evaluated. The image block is input into the autoencoder to calculate the pixel-level mean square error between the reconstructed image block and the image block to be evaluated. The pixel-level mean square error is used as the texture anomaly of each pixel. The texture anomalies of all pixels are normalized to the range of 0 to 1 to generate a texture anomaly heatmap.
[0065] The preset neighborhood window size is consistent with the image block size during training, set to 64×64 pixels. The normalization method can be minimum-maximum normalization, that is, for the texture anomaly of all pixels, the normalized value is calculated as (original value - minimum value) / (maximum value - minimum value).
[0066] For example, a color-corrected gastroscopy image to be segmented is input into a trained autoencoder. A 64×64 neighborhood window is taken as the center of each pixel in the image to form the image block to be evaluated. Taking the pixel at coordinates (100, 200) as an example, a 64×64 pixel region within the range of rows 68 to 131 and columns 168 to 231 is taken as the image block to be evaluated, input into the autoencoder to obtain the reconstructed image block, and the mean square error of this image block is calculated, assumed to be 0.0021. This value is used as the texture anomality of pixel (100, 200). The texture anomality of all 512×512 pixels is obtained. Assuming that the minimum texture anomality of all pixels is 0.0008 and the maximum is 0.045, each pixel is normalized: Normalized anomality = (Original anomality - 0.0008) / (0.045 - 0.0008). In gastric cancer-related abnormal areas, the autoencoder reconstruction error is large due to mucosal texture breaks, and the normalized anomaly degree is close to 1. In contrast, the texture of normal mucosal areas is consistent with the training samples, with small reconstruction error and a normalized anomaly degree close to 0. Finally, a texture anomaly heatmap with a size of 512×512 is generated.
[0067] After the aforementioned self-supervised training, the mid-layer texture perception auxiliary branch maps normal gastric mucosal image patches to a 256-dimensional feature space, where the feature vectors of the normal mucosal image patches are clustered and distributed. The pre-learned normal gastric mucosal texture pattern embodies the mapping relationship from low-dimensional feature vectors to normal mucosal texture learned by the autoencoder. During inference, the texture distribution of image patches in gastric cancer-related abnormal regions deviates from the texture distribution of normal mucosa in the training set, and the autoencoder cannot accurately reconstruct them, resulting in a large reconstruction error. This reconstruction error can be used to quantify the degree of texture abnormality.
[0068] Furthermore, the third stage involves freezing the parameters of the surface interference suppression auxiliary branch and the mid-layer texture perception auxiliary branch. The preprocessed gastroscopy image sample set is used as input, and the labels of normal mucosal areas and gastric cancer-related abnormal areas in the segmentation labels are used as supervision signals. The binary cross-entropy loss function is used to train the segmentation main branch. The training is considered to have converged when the validation set loss no longer decreases for a preset number of consecutive cycles. The preset number of cycles can be set to 5.
[0069] In this step, the parameters of the surface interference suppression auxiliary branch and the mid-layer texture perception auxiliary branch are frozen. Using the preprocessed gastroscopy image sample set as input and the annotations of normal mucosal regions and gastric cancer-related abnormal regions in the segmentation labels as supervision signals, the main segmentation branch is trained using a binary cross-entropy loss function until convergence. This includes: Step 1: Input the preprocessed gastroscopy image sample set into the initial multi-scale convolutional segmentation network. Simultaneously extract multi-scale image features through the three convolutional branches of the main segmentation branch. After cross-scale fusion and decoding, the segmentation prediction result is output. The parameters of the surface interference suppression auxiliary branch and the middle texture perception auxiliary branch are frozen in this stage. Step 2: Calculate the binary cross-entropy loss between the segmentation prediction result and the pixel-level annotations of the normal mucosal region and the abnormal region related to gastric cancer in the segmentation label, and use it as the segmentation loss; Step 3: With minimizing the segmentation loss as the optimization objective, update the parameters of the three convolutional branches and the fusion decoding part in the main segmentation branch, and iteratively execute steps 1 to 3 until the segmentation loss converges.
[0070] Specifically, in step one, the preprocessed gastroscopy image sample set is input into the initial multi-scale convolutional segmentation network. Multi-scale image features are extracted simultaneously through the three convolutional branches of the main segmentation branch, and the segmentation prediction results are output after cross-scale fusion and decoding.
[0071] In this stage, the parameters of the surface interference suppression auxiliary branch and the middle texture perception auxiliary branch remain frozen. They only participate in forward propagation to provide spatial masks of the interference region and texture anomaly heatmaps, and do not receive gradient updates.
[0072] For example, 1000 preprocessed gastroscopy images of size 512×512 pixels are input into the network. The parameters of the surface interference suppression auxiliary branch are frozen, outputting a 512×512 spatial mask of the interference region; the parameters of the middle-layer texture perception auxiliary branch are frozen, outputting a 512×512 texture anomaly heatmap. The three convolutional branches of the segmentation main branch simultaneously extract features, each outputting a 64-channel feature map, resulting in a 192-channel multi-scale image feature. The interference region spatial mask is inverted and copied to the 192 channels, multiplied pixel-by-pixel with the multi-scale image features to attenuate the response of the interference region; the texture anomaly heatmap is copied to the 192 channels and multiplied pixel-by-pixel with the interference-suppressed features to enhance the response of the anomaly region. 128 1×1 convolutional kernels are used to perform channel dimensionality reduction on the weighted 192-channel features, resulting in a 128-channel fused feature map. The fused feature map is upsampled by the decoder to a resolution of 512×512, and a single-channel segmentation prediction map is output. Each pixel value, after being activated by a sigmoid function, represents the predicted probability of belonging to a gastric cancer-related abnormal region, with a value ranging from 0 to 1. For example, the predicted probability of a certain pixel is 0.75.
[0073] Next, step two calculates the binary cross-entropy loss between the segmentation prediction result and the pixel-level annotations of the normal mucosal region and the gastric cancer-related abnormal region in the segmentation label, as the segmentation loss. Pixels in reflective and bubble regions are not included in the loss calculation. The binary cross-entropy loss function is calculated as follows: L3=-(1 / N3)·Σ[yi·log(si)+(1-yi)·log(1-si)], where N3 is the total number of pixels in the normal mucosal region and the gastric cancer-related abnormal region in the segmentation label, yi is the true label of the i-th valid pixel, and si is the predicted probability of the i-th valid pixel in the segmentation prediction map.
[0074] For example, a gastroscopy image contains 200,000 pixels, including normal mucosal areas and abnormal areas related to gastric cancer. A pixel has a true label yi=1 and a predicted probability si=0.75, with a loss of -log(0.75)≈0.2877. Another pixel has a true label yi=0 and a predicted probability si=0.08, with a loss of -log(1-0.08)≈0.0834. The average loss over all 200,000 valid pixels yields a segmentation loss of approximately 0.215. The average loss over all images in the batch is then calculated to obtain the L3 for this batch.
[0075] Finally, step three optimizes by minimizing the segmentation loss, updating the parameters of the three convolutional branches and the fusion decoding part in the main segmentation branch. The parameters of the surface interference suppression auxiliary branch and the mid-layer texture perception auxiliary branch remain frozen and do not participate in parameter updates. Steps one through three are executed iteratively until the segmentation loss converges.
[0076] For example, the Adam optimizer is used with a learning rate of 0.001 and a batch size of 8. Each batch contains 8 preprocessed gastroscopy images. Forward propagation in step one yields the segmentation prediction map, and L3 = 0.215 is calculated for this batch in step two. Gradients are calculated via backpropagation to update the kernel parameters of the three convolutional branches of the main segmentation branch, the parameters of the 1×1 convolutional layers, and the parameters of each layer in the decoder. The parameters of the frozen auxiliary branches are not updated. One training cycle consists of iterating through all training samples. Training continues until the segmentation loss on the validation set no longer decreases for five consecutive cycles, which is considered convergence. After convergence, the main segmentation branch has the ability to accurately segment gastric cancer-related abnormal regions in a feature space where interference is suppressed and texture abnormalities are enhanced.
[0077] Finally, the fourth stage involves unfreezing all parameters of the main segmentation branch, the surface interference suppression auxiliary branch, and the mid-layer texture perception auxiliary branch. Using the pre-processed gastroscopy image sample set as input, the segmentation loss of the main segmentation branch, the mask prediction loss of the surface interference suppression auxiliary branch, and the texture reconstruction loss of the mid-layer texture perception auxiliary branch are weighted and summed to obtain the joint loss function. With minimizing the joint loss function as the optimization objective, all parameters of the three branches are jointly fine-tuned. Training continues until the validation set loss no longer decreases for a preset number of cycles, which is considered convergence. The preset number of cycles can be set to 5. Finally, a pre-trained multi-scale convolutional segmentation network is obtained.
[0078] In this step, using the preprocessed gastroscopy image sample set as input, the segmentation loss of the main segmentation branch, the mask prediction loss of the surface interference suppression auxiliary branch, and the texture reconstruction loss of the mid-layer texture perception auxiliary branch are weighted and summed to obtain a joint loss function. Minimizing this joint loss function is the optimization objective, and all parameters of the three branches are jointly fine-tuned until convergence, resulting in a pre-trained multi-scale convolutional segmentation network, including: Step 1: Input the preprocessed gastroscopy image sample set into the initial multi-scale convolutional segmentation network. The segmentation main branch outputs the segmentation prediction result, the surface interference suppression auxiliary branch outputs the spatial mask of the interference region, and the middle texture perception auxiliary branch outputs the reconstructed image block. Step 2: Calculate the binary cross-entropy loss between the segmentation prediction result output by the main segmentation branch and the pixel-level annotations of the normal mucosal region and the gastric cancer-related abnormal region in the segmentation label, as the segmentation loss; calculate the binary cross-entropy loss between the spatial mask of the interference region and the pixel-level annotations of the reflective region and the bubble region in the segmentation label, as the mask prediction loss; calculate the pixel-level mean square error between the reconstructed image block and the original image block, as the initial texture reconstruction loss. Step 3: Obtain the square of the dynamic range of pixel values of the preprocessed gastroscopy image, divide the initial texture reconstruction loss by the square of the dynamic range of pixel values, and obtain the dimensionally normalized texture reconstruction loss. Step 4: Multiply the mask prediction loss by the first weighting coefficient, multiply the dimensionally normalized texture reconstruction loss by the second weighting coefficient, and sum the weighted mask prediction loss and the weighted dimensionally normalized texture reconstruction loss with the segmentation loss to obtain the joint loss function. Here, the segmentation loss and the mask prediction loss are both binary cross-entropy losses with unified dimensions, and the dimensionally normalized texture reconstruction loss has been converted into a dimensionless relative error, which is consistent with the dimensions of the segmentation loss and the mask prediction loss. Step 5: With minimizing the joint loss function as the optimization objective, update all parameters of the segmentation main branch, the surface interference suppression auxiliary branch, and the middle texture perception auxiliary branch, and iteratively execute steps 1 to 5 until the joint loss function converges.
[0079] Specifically, in step one, the preprocessed gastroscopy image sample set is input into the initial multi-scale convolutional segmentation network, with all three branches participating in forward propagation. The segmentation prediction result is output by the main segmentation branch, the spatial mask of the interference region is output by the surface interference suppression auxiliary branch, and the reconstructed image patch is output by the mid-layer texture perception auxiliary branch.
[0080] For example, 1000 preprocessed gastroscopy images of size 512×512 pixels are input into the network. The segmentation main branch outputs a single-channel segmentation prediction map of size 512×512. Each pixel value, after Sigmoid activation, represents the predicted probability of belonging to a gastric cancer-related abnormal region; for example, a pixel's predicted probability is 0.75. The surface interference suppression auxiliary branch outputs a spatial mask of the interference region of size 512×512. Each pixel value represents the predicted probability of belonging to a reflective or bubble region; for example, a pixel's predicted probability is 0.85. The mid-layer texture perception auxiliary branch extracts 64×64 pixel image blocks from the normal mucosal region, outputs reconstructed image blocks of size 64×64×3 after autoencoder processing; for example, a pixel in the reconstructed image block has a red channel value of 130.
[0081] Next, in step two, the binary cross-entropy loss between the segmentation prediction result output by the main segmentation branch and the pixel-level annotations of normal mucosal regions and gastric cancer-related abnormal regions in the segmentation labels is calculated as the segmentation loss L4. The binary cross-entropy loss between the spatial mask of the interference region and the pixel-level annotations of reflective and bubble regions in the segmentation labels is calculated as the mask prediction loss L5. Finally, the pixel-level mean square error between the reconstructed image patch and the original image patch is calculated as the initial texture reconstruction loss L6.
[0082] The calculation formulas for each loss function are as follows: L4=-(1 / N4)·Σ[yi·log(si)+(1-yi)·log(1-si)], L5=-(1 / N5)·Σ[gj·log(mj)+(1-gj)·log(1-mj)], L6=(1 / M)·Σ(xk-x̂k) 2 Where N4 is the total number of pixels in the normal mucosal region and the abnormal region related to gastric cancer, yi is the true label of the i-th valid pixel, and si is the predicted probability of the i-th valid pixel. N5 is the total number of pixels in the entire image, gj is the true label of the j-th pixel, and mj is the predicted probability of the j-th pixel. M is the total number of pixels in the image patch, xk is the value of the k-th pixel in the original image patch, and x̂k is the value of the k-th pixel in the reconstructed image patch.
[0083] For example, in a certain batch, the segmentation prediction result and the label calculated L4=0.32, the spatial mask of the interference region and the label calculated L5=0.18, and the reconstructed image block and the original image block calculated L6=0.0032.
[0084] Next, in step three, the square of the dynamic range of pixel values of the preprocessed gastroscopy image is obtained. The initial texture reconstruction loss is divided by the square of the dynamic range of pixel values to obtain the dimensionally normalized texture reconstruction loss L7.
[0085] When the image pixel values are normalized to the [0,1] interval, the dynamic range is 1, and the square of the dynamic range is 1. 2 =1. L7 = L6 / 1 2 =L6, the numerical value remains unchanged, but the meaning has been transformed into a dimensionless relative error. When the image pixel value range is [0,255], the dynamic range is 255, and the square of the dynamic range is 255. 2 =65025. L7=L6 / 65025, converting the squared error of the absolute pixel value into a relative error.
[0086] For example, if the image pixel values are normalized to the [0,1] interval, the dynamic range squared is 1. If L6=0.0032, then L7=0.0032 / 1=0.0032, which means that the relative mean square error between the reconstructed image block and the original image block is 0.0032, which is dimensionless.
[0087] Next, in step four, the mask prediction loss L5 is multiplied by the first weighting coefficient λ1, the dimensionally normalized texture reconstruction loss L7 is multiplied by the second weighting coefficient λ2, and the weighted L5 and L7 are summed with the segmentation loss L4 to obtain the joint loss function L0=L4+λ1·L5+λ2·L7.
[0088] Here, λ1 and λ2 are dimensionless weighting coefficients, ranging from 0 to 1, and are positive real numbers used to adjust the contribution ratio of the auxiliary task loss to the total loss. λ1 controls the weight of the mask prediction loss L5, and λ2 controls the weight of the texture reconstruction loss L7. The larger the weighting coefficient, the stronger the influence of the corresponding auxiliary task in the joint optimization. Typically, the segmentation loss L4 is used as the main task loss, with an implicit weight of 1.0. Both λ1 and λ2 are less than 1.0 to ensure that the auxiliary task does not dominate the optimization direction.
[0089] For example, λ1 and λ2 can both be set to 0.5, indicating that the two auxiliary tasks participate in joint optimization with equal and low intensity. In practical applications, if the interference from reflective bubbles is severe, λ1 can be appropriately increased to 0.6 to 0.8; if the differences in gastric mucosal texture are significant, λ2 can be appropriately increased to 0.6 to 0.8.
[0090] For example, if L4=0.32, L5=0.18, L7=0.0032, λ1=0.5, and λ2=0.5, then the joint loss L0=0.32+0.5×0.18+0.5×0.0032=0.4116.
[0091] The L4 mentioned above is the binary cross-entropy loss, calculated as L4 = -(1 / N4)·Σ[yi·log(si) + (1-yi)·log(1-si)]. Here, yi is the true label, taking values of 0 or 1, and is dimensionless; si is the predicted probability, ranging from 0 to 1, and is also dimensionless; the logarithmic operation is dimensionless; and the summation and averaging are also dimensionless. Essentially, L4 measures the difference in information content between two probability distributions, measured in bits, and is a dimensionless quantity in information theory.
[0092] L5 is also a binary cross-entropy loss function, calculated in the same way as L4, using probability values as variables, with the output unit being bits, and is dimensionless. L4 and L5 have completely identical dimensions and can be directly added together.
[0093] L6 is the mean squared error loss, calculated using the formula L6=(1 / M)·Σ(xk-x̂k). 2 If the image pixel value range is [0,1], then the dimension of L6 is the square of the pixel value unit, that is, it has physical dimensions. After dividing by the square of the pixel value dynamic range in step three, L7 is transformed into (L6) / (dynamic range). 2 The numerator and denominator have the same dimension of squared pixel values. After dividing, the dimensions are canceled out, resulting in the dimensionless relative mean square error. This relative mean square error represents the proportion of reconstruction error to the maximum possible error. Like L4 and L5, it is a dimensionless quantity, and the three have unified dimensions.
[0094] Therefore, in the joint loss function L0 = L4 + λ1·L5 + λ2·L7, all three loss terms are dimensionless, and the weighted summation is both mathematically reasonable and physically consistent. The weighting coefficients λ1 and λ2 do not introduce dimensional conflicts; they only adjust the relative importance of each loss term in the joint optimization.
[0095] Finally, step five updates all parameters of the segmentation main branch, the surface interference suppression auxiliary branch, and the mid-layer texture perception auxiliary branch with the goal of minimizing the joint loss function. Steps one through five are executed iteratively until the joint loss function converges.
[0096] For example, using the Adam optimizer with a learning rate of 0.0001 and a batch size of 8, each batch undergoes forward propagation in step one to obtain the outputs of the three branches, and L0 = 0.4116 is calculated in steps two through four. The gradients of L0 with respect to all trainable parameters of the three branches are calculated via backpropagation, updating all parameters at once. One training epoch is defined as iterating through all training samples. Training continues until the joint loss on the validation set no longer decreases for five consecutive epochs, which is considered convergence. After training, all network parameters are saved, resulting in a pre-trained multi-scale convolutional segmentation network, which can be used for subsequent gastroscopy image inference and segmentation.
[0097] It should be noted that the above values are for illustrative purposes only and do not constitute a limitation on the present invention.
[0098] In summary, this step effectively suppresses the impact of surface interference such as reflection and bubbles on feature extraction, while enhancing the texture response of abnormal areas related to gastric cancer. It outputs a high-quality fused feature map that combines multi-scale spatial information, interference suppression capability, and enhanced perception capability of lesion areas, providing a reliable feature foundation for subsequent decoding and pixel-level accurate segmentation.
[0099] S300: Decode and restore the fused feature map, and output a pixel-level segmentation mask image corresponding to the original gastroscopy image.
[0100] This step restores the same resolution as the original gastroscopy image by performing layer-by-layer upsampling and skip connection feature fusion on the fused feature map. During the upsampling process, a comprehensive attention-guided map is used to weight the features of each layer pixel by pixel, continuously maintaining spatial attention to interference areas and texture abnormal areas.
[0101] Step S300 in the method provided by the present invention includes: The fused feature map is upsampled layer by layer by the decoding module. The decoding module contains multiple upsampling layers. Each upsampling layer enlarges the feature map resolution by 2 times through bilinear interpolation. After each upsampling layer, the feature map at the corresponding resolution of the segmentation main branch encoding stage is concatenated with the upsampled feature map in the channel dimension through skip connections. Then, feature fusion is performed through 3×3 convolution and ReLU activation function to restore the same resolution as the original gastroscopy image layer by layer. During the upsampling process, the maximum value of each element of the spatial mask of the interference region and the texture anomaly heatmap is taken to generate a comprehensive attention guidance map. The comprehensive attention guidance map is then multiplied pixel by pixel with the output feature map of each upsampling layer. After the last upsampling layer, the number of feature map channels is compressed to 1 by 1×1 convolution. The probability value of each pixel belonging to the gastric cancer-related abnormal region is output by the Sigmoid activation function. Pixels with a probability value greater than the preset segmentation threshold are marked as gastric cancer-related abnormal regions, and pixels with a probability value less than or equal to the preset segmentation threshold are marked as normal mucosal regions, thus obtaining a pixel-level segmentation mask image.
[0102] Specifically, the fused feature map is first upsampled layer by layer by the decoding module. The decoding module contains multiple upsampling layers. Each upsampling layer increases the resolution of the feature map by a factor of 2 through bilinear interpolation. Then, skip connections are used to concatenate the feature map at the resolution corresponding to the encoding stage of the segmentation main branch with the upsampled feature map in the channel dimension. Finally, feature fusion is performed through 3×3 convolution and ReLU activation function to restore the same resolution as the original gastroscopy image layer by layer.
[0103] The decoding module is a component of the multi-scale convolutional segmentation network, and its parameters have been optimized and determined through backpropagation in the third and fourth stages of the pre-training process. The kernel parameters of the 3×3 convolutional layer and the 1×1 convolutional layer in the decoding module have been learned during the pre-training stage, and the pre-trained parameters can be directly loaded for forward propagation during inference.
[0104] For example, the fused feature map size is 32×32×128. The decoding module contains four upsampling stages. The first upsampling layer enlarges the 32×32 feature map to 64×64 using bilinear interpolation, while maintaining 128 channels. Skip connections extract the corresponding 64×64 resolution feature map from the segmentation main branch encoding stage and concatenate it with the upsampled 128-channel feature map along the channel dimension to obtain a 192-channel feature map. After 3×3 convolution and ReLU activation, the number of channels is reduced to 64, outputting a 64×64×64 feature map. The second upsampling layer enlarges it to 128×128, concatenates it with the corresponding 128×128 resolution feature map, and outputs 128×128×32 after convolutional fusion. The third upsampling layer enlarges it to 256×256, concatenates it with the corresponding 256×256 resolution feature map, and outputs 256×256×16 after convolutional fusion. The fourth upsampling layer is magnified to 512×512, and the corresponding 512×512 resolution feature maps are stitched together. After convolutional fusion, the output is 512×512×8. At this point, the resolution has been restored to be consistent with the original gastroscopy image.
[0105] Furthermore, during the upsampling process, the maximum value of each element of the spatial mask of the interference region and the texture anomaly heatmap is taken to generate a comprehensive attention guidance map. The comprehensive attention guidance map is then multiplied pixel by pixel with the output feature map of each upsampling layer.
[0106] The calculation method for taking the maximum value element-wise is as follows: For each pixel position, the value of the comprehensive attention guidance map = max(value of the spatial mask of the interference region, value of the texture anomaly heatmap). Since the probability of interference regions in the spatial mask of the interference region is close to 1 and that of normal regions is close to 0, and the value of abnormal regions in the texture anomaly heatmap is close to 1 and that of normal regions is close to 0, taking the maximum value results in both interference regions and texture anomaly regions having high response values in the comprehensive attention guidance map. This facilitates the simultaneous suppression of interference and enhancement of attention to abnormal regions during the decoding stage. The comprehensive attention guidance map needs to be downsampled to the same resolution as the current layer's feature map in each upsampling stage, and then copied in the channel dimension to match the number of channels in the feature map before pixel-wise multiplication.
[0107] For example, the size of the spatial mask for the interference region is 512×512×1, and the size of the texture anomaly heatmap is also 512×512×1. After taking the maximum value element-wise, a comprehensive attention guide map with a size of 512×512×1 is generated. The output feature map of the fourth upsampling layer has a size of 512×512×8, and the comprehensive attention guide map also has a size of 512×512. After being copied 8 times along the channel dimension, it is multiplied pixel-wise with the feature map. The responses of the interference region and texture anomaly region are enhanced, while the responses of the normal region are suppressed. In the third upsampling layer, the comprehensive attention guide map is downsampled to 256×256 using bilinear interpolation, copied 16 times along the channel dimension, and then multiplied pixel-wise with the 256×256×16 feature map. The remaining upsampling layers are operated similarly.
[0108] By taking the maximum value of each element to generate a comprehensive attention guidance map, both interference regions and texture anomaly regions receive high response values, avoiding the omission of another type of region requiring attention when relying on only a single attention map. Applying comprehensive attention guidance to each upsampling layer can maintain spatial attention to interference and anomaly regions during the layer-by-layer resolution recovery process, preventing boundary blurring caused by the loss of spatial information after upsampling of deep feature maps.
[0109] Finally, after the last upsampling layer, the number of feature map channels is compressed to 1 by 1×1 convolution, and the probability value of each pixel belonging to the gastric cancer-related abnormal region is output by the Sigmoid activation function. Pixels with probability values greater than the preset segmentation threshold are marked as gastric cancer-related abnormal regions, and pixels with probability values less than or equal to the preset segmentation threshold are marked as normal mucosal regions, thus obtaining a pixel-level segmentation mask image.
[0110] The rules for setting the preset segmentation threshold are as follows: the threshold value ranges from 0 to 1, and is usually set to 0.5 to balance precision and recall. If clinical needs favor reducing missed diagnoses, the threshold can be lowered to 0.3 to 0.4 to improve recall; if the focus is on reducing false diagnoses, the threshold can be increased to 0.6 to 0.7 to improve precision. The specific threshold can be selected based on the receiver operating characteristic curve on the validation set, corresponding to the point of maximum Youden's index.
[0111] For example, the fourth upsampling layer outputs a feature map weighted by the comprehensive attention-guided map, with a size of 512×512×8. A 1×1 convolutional kernel compresses the 8 channels into 1 channel, outputting a 512×512×1 feature map. A sigmoid activation function maps each pixel value to a range of 0 to 1, representing the probability that the pixel belongs to a gastric cancer-related abnormal region. For example, a pixel with an output probability of 0.78, greater than the threshold of 0.5, is marked as 1; another pixel with an output probability of 0.32, less than or equal to the threshold of 0.5, is marked as 0. After binarizing all pixels, a 512×512 pixel-level segmentation mask image is obtained, corresponding to the size of the original gastroscopy image.
[0112] It should be noted that the above values are for illustrative purposes only and do not constitute a limitation on the present invention.
[0113] In summary, this step effectively prevents the loss of spatial information and blurring of boundaries during the resolution restoration process, and ultimately outputs a pixel-level segmentation mask image with clear boundaries and accurate positioning, providing reliable lesion area localization results for clinical diagnosis.
[0114] In summary, this invention effectively solves the problems of surface interference, difficulty in capturing minute texture breaks, and jagged segments caused by blurred boundaries, significantly improving the segmentation accuracy and robustness of abnormal areas related to gastric cancer.
[0115] Example 2, as Figure 3 As shown, this invention provides an intelligent segmentation chip for gastric cancer endoscopic images based on multi-scale convolutional networks, comprising: The image preprocessing unit 11 is used to perform size normalization and color correction processing on the original gastroscopy image in sequence to obtain the preprocessed gastroscopy image.
[0116] The original gastroscopy images are sequentially subjected to size normalization and color correction to obtain preprocessed gastroscopy images, including: The original gastroscopy image is scaled to a preset uniform size using bilinear interpolation to obtain a size-normalized gastroscopy image. The size-normalized gastroscopy image is subjected to color correction processing to obtain a color-corrected gastroscopy image. The color-corrected gastroscopy image is used as the preprocessed gastroscopy image.
[0117] The process involves color correction of the size-normalized gastroscopy image to obtain a color-corrected gastroscopy image, including: The grayscale world algorithm is used to calculate the channel mean values of the size-normalized gastroscopy image in the red, green, and blue channels respectively. The channel mean value of the green channel is used as the benchmark. The channel mean value of the red channel is divided by the channel mean value of the green channel to obtain the red channel gain coefficient. The channel mean value of the blue channel is divided by the channel mean value of the green channel to obtain the blue channel gain coefficient. The red channel pixel value of each pixel in the size-normalized gastroscopy image is multiplied by the red channel gain coefficient, the blue channel pixel value of each pixel is multiplied by the blue channel gain coefficient, and the green channel pixel value remains unchanged to obtain the color-corrected gastroscopy image.
[0118] The multi-scale feature extraction and fusion unit 12 is used to input the preprocessed gastroscopy image into a pre-trained multi-scale convolutional segmentation network. The multi-scale convolutional segmentation network includes a segmentation main branch, a surface interference suppression auxiliary branch, and a mid-layer texture perception auxiliary branch. The segmentation main branch extracts multi-scale image features, and the surface interference suppression auxiliary branch and the mid-layer texture perception auxiliary branch extract auxiliary features respectively. The auxiliary features are used to perform weighted regulation and cross-scale fusion of the multi-scale image features, and output a fused feature map.
[0119] The preprocessed gastroscopy images are input into a pre-trained multi-scale convolutional segmentation network. This network includes a main segmentation branch, a surface interference suppression auxiliary branch, and a mid-level texture perception auxiliary branch. The main segmentation branch extracts multi-scale image features, while the surface interference suppression auxiliary branch and the mid-level texture perception auxiliary branch extract auxiliary features respectively. These auxiliary features are then used to weight and fuse the multi-scale image features across scales, outputting a fused feature map, including: The preprocessed gastroscopy images are input into a pre-trained multi-scale convolutional segmentation network. The processing within the multi-scale convolutional segmentation network includes: The segmentation main branch includes a first convolutional branch, a second convolutional branch, and a third convolutional branch. The first convolutional branch uses a 7×7 convolutional kernel, the second convolutional branch uses a 5×5 convolutional kernel, and the third convolutional branch uses a 3×3 convolutional kernel. The three convolutional branches simultaneously extract feature maps from the color-corrected gastroscopy images of the preprocessed gastroscopy images to form multi-scale image features. The surface interference suppression auxiliary branch takes the color-corrected gastroscopy image of the preprocessed gastroscopy image as input, and outputs an interference region spatial mask of the same size as the color-corrected gastroscopy image through a fully convolutional network with an encoder-decoder structure. The value of each pixel in the interference region spatial mask represents the probability that the pixel belongs to the reflective region or the bubble region, and the value range is 0 to 1. The mid-layer texture perception auxiliary branch performs difference quantification on the texture pattern of each pixel in the color-corrected gastroscopy image of the preprocessed gastroscopy image and the pre-learned normal gastric mucosa texture pattern, and outputs a texture anomaly heatmap. The value of each pixel in the texture anomaly heatmap represents the degree to which the texture of that pixel deviates from the normal mucosa, and the value range is 0 to 1. In the feature fusion stage of the segmented main branch, the spatial mask of the interference region is inverted and multiplied pixel by pixel with the multi-scale image features to obtain the interference-suppressed multi-scale image features. Then, the texture anomaly heatmap is multiplied pixel by pixel with the interference-suppressed multi-scale image features to obtain the weighted multi-scale image features. The weighted multi-scale image features are concatenated in the channel dimension, and 1×1 convolution is used to reduce the channel dimension of the concatenated features to obtain the fused feature map.
[0120] The pre-training process of the multi-scale convolutional segmentation network includes: Collect a set of gastroscopy image samples with segmentation labels, the segmentation labels including pixel-level annotations of normal mucosal areas, gastric cancer-related abnormal areas, reflective areas and bubble areas; Each gastroscopy image sample in the gastroscopy image sample set is sequentially subjected to size normalization and color correction to obtain a preprocessed gastroscopy image sample set. An initial multi-scale convolutional segmentation network is constructed, which includes a segmentation main branch, a surface interference suppression auxiliary branch, and a mid-layer texture perception auxiliary branch. In the first stage, the parameters of the mid-layer texture perception auxiliary branch are fixed. The preprocessed gastroscopy image sample set is used as input, and the labels of reflective areas and bubble areas in the segmentation labels are used as supervision signals. The surface interference suppression auxiliary branch is trained separately using the binary cross-entropy loss function until convergence. In the second stage, the parameters of the surface interference suppression auxiliary branch are frozen. The image block containing only the normal gastric mucosa area in the preprocessed gastroscopy image sample set is used as input. The goal is to reconstruct the image block. The mean squared error loss function is used to train the middle texture perception auxiliary branch separately until convergence. In the third stage, the parameters of the surface interference suppression auxiliary branch and the middle texture perception auxiliary branch are frozen. The preprocessed gastroscopy image sample set is used as input, and the labels of normal mucosal areas and gastric cancer-related abnormal areas in the segmentation labels are used as supervision signals. The binary cross-entropy loss function is used to train the segmentation main branch until convergence. In the fourth stage, all parameters of the segmentation main branch, the surface interference suppression auxiliary branch, and the mid-layer texture perception auxiliary branch are unfrozen. Using the preprocessed gastroscopy image sample set as input, the segmentation loss of the segmentation main branch, the mask prediction loss of the surface interference suppression auxiliary branch, and the texture reconstruction loss of the mid-layer texture perception auxiliary branch are weighted and summed to obtain a joint loss function. With minimizing the joint loss function as the optimization objective, all parameters of the three branches are jointly fine-tuned until convergence, resulting in a pre-trained multi-scale convolutional segmentation network.
[0121] Specifically, the parameters of the surface interference suppression auxiliary branch are frozen, and the image patch containing only normal gastric mucosa areas in the preprocessed gastroscopy image sample set is used as input, with the goal of reconstructing the image patch. The mid-layer texture perception auxiliary branch is trained separately using the mean squared error loss function until convergence, including: From the preprocessed gastroscopy image sample set, image blocks containing only normal gastric mucosa areas are extracted according to the segmentation labels, and the size of the image blocks is a preset block size; An autoencoder network containing an encoder and a decoder is constructed as a mid-level texture-aware auxiliary branch. The encoder compresses the image patch into a low-dimensional feature vector through multiple convolutional layers and downsampling layers. The decoder reconstructs a reconstructed image patch of the same size as the original image patch from the low-dimensional feature vector through multiple upsampling layers and convolutional layers. Using the image patch as input and reconstructing the image patch as the goal, the pixel-level mean square error between the original image patch and the reconstructed image patch is calculated as a loss function to train the autoencoder network until the loss function converges. After training, each pixel in the color-corrected gastroscopy image of the preprocessed gastroscopy image and the pixels in the surrounding preset neighborhood window constitute an image block to be evaluated. This block is input into the autoencoder, and the pixel-level mean square error between the reconstructed image block and the image block to be evaluated is calculated. The pixel-level mean square error is used as the texture anomaly degree of each pixel. The texture anomaly degrees of all pixels are normalized to the range of 0 to 1, and a texture anomaly degree heatmap is generated.
[0122] Freeze the parameters of the surface interference suppression auxiliary branch and the mid-layer texture perception auxiliary branch, take the preprocessed gastroscopy image sample set as input, and use the labels of normal mucosal areas and gastric cancer-related abnormal areas in the segmentation labels as supervision signals. Train the main segmentation branch using the binary cross-entropy loss function until convergence, including: Step 1: Input the preprocessed gastroscopy image sample set into the initial multi-scale convolutional segmentation network. Simultaneously extract multi-scale image features through the three convolutional branches of the main segmentation branch. After cross-scale fusion and decoding, the segmentation prediction result is output. The parameters of the surface interference suppression auxiliary branch and the middle texture perception auxiliary branch are frozen in this stage. Step 2: Calculate the binary cross-entropy loss between the segmentation prediction result and the pixel-level annotations of the normal mucosal region and the abnormal region related to gastric cancer in the segmentation label, and use it as the segmentation loss; Step 3: With minimizing the segmentation loss as the optimization objective, update the parameters of the three convolutional branches and the fusion decoding part in the main segmentation branch, and iteratively execute steps 1 to 3 until the segmentation loss converges.
[0123] Using the preprocessed gastroscopy image sample set as input, the segmentation loss of the main segmentation branch, the mask prediction loss of the surface interference suppression auxiliary branch, and the texture reconstruction loss of the mid-layer texture perception auxiliary branch are weighted and summed to obtain a joint loss function. Minimizing this joint loss function is the optimization objective, and all parameters of the three branches are jointly fine-tuned until convergence, resulting in a pre-trained multi-scale convolutional segmentation network, including: Step 1: Input the preprocessed gastroscopy image sample set into the initial multi-scale convolutional segmentation network. The segmentation main branch outputs the segmentation prediction result, the surface interference suppression auxiliary branch outputs the interference region spatial mask, and the middle texture perception auxiliary branch outputs the reconstructed image block. Step 2: Calculate the binary cross-entropy loss between the segmentation prediction result output by the main segmentation branch and the pixel-level annotations of the normal mucosal region and the gastric cancer-related abnormal region in the segmentation label, as the segmentation loss; calculate the binary cross-entropy loss between the spatial mask of the interference region and the pixel-level annotations of the reflective region and the bubble region in the segmentation label, as the mask prediction loss; calculate the pixel-level mean square error between the reconstructed image block and the original image block, as the initial texture reconstruction loss. Step 3: Obtain the square of the dynamic range of pixel values of the preprocessed gastroscopy image, divide the initial texture reconstruction loss by the square of the dynamic range of pixel values, and obtain the dimensionally normalized texture reconstruction loss. Step 4: Multiply the mask prediction loss by the first weighting coefficient, multiply the dimensionally normalized texture reconstruction loss by the second weighting coefficient, and sum the weighted mask prediction loss and the weighted dimensionally normalized texture reconstruction loss with the segmentation loss to obtain the joint loss function. Here, the segmentation loss and the mask prediction loss are both binary cross-entropy losses with unified dimensions, and the dimensionally normalized texture reconstruction loss has been converted into a dimensionless relative error, which is consistent with the dimensions of the segmentation loss and the mask prediction loss. Step 5: With minimizing the joint loss function as the optimization objective, update all parameters of the segmentation main branch, the surface interference suppression auxiliary branch, and the middle texture perception auxiliary branch, and iteratively execute steps 1 to 5 until the joint loss function converges.
[0124] The decoding and restoration unit 13 is used to decode and restore the fused feature map and output a pixel-level segmentation mask image corresponding to the original gastroscopy image.
[0125] The process includes decoding and restoring the fused feature map to output a pixel-level segmentation mask image corresponding to the original gastroscopy image, including: The fused feature map is upsampled layer by layer by the decoding module. The decoding module contains multiple upsampling layers. Each upsampling layer enlarges the feature map resolution by 2 times through bilinear interpolation. After each upsampling layer, the feature map at the corresponding resolution of the segmentation main branch encoding stage is concatenated with the upsampled feature map in the channel dimension through skip connections. Then, feature fusion is performed through 3×3 convolution and ReLU activation function to restore the same resolution as the original gastroscopy image layer by layer. During the upsampling process, the maximum value of each element of the spatial mask of the interference region and the texture anomaly heatmap is taken to generate a comprehensive attention guidance map. The comprehensive attention guidance map is then multiplied pixel by pixel with the output feature map of each upsampling layer. After the last upsampling layer, the number of feature map channels is compressed to 1 by 1×1 convolution. The probability value of each pixel belonging to the gastric cancer-related abnormal region is output by the Sigmoid activation function. Pixels with a probability value greater than the preset segmentation threshold are marked as gastric cancer-related abnormal regions, and pixels with a probability value less than or equal to the preset segmentation threshold are marked as normal mucosal regions, thus obtaining a pixel-level segmentation mask image.
[0126] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
[0127] This specification and accompanying drawings are merely illustrative examples of the invention and are intended to cover any and all modifications, variations, combinations, or equivalents within the scope of the invention. Clearly, those skilled in the art can make various alterations and modifications to the invention without departing from its scope. Therefore, if such modifications and modifications fall within the scope of the invention and its equivalents, the invention is intended to include these modifications and modifications.
Claims
1. A method for intelligent segmentation of gastric cancer endoscopic images based on multi-scale convolutional networks, characterized in that, The method includes: The original gastroscopy images were sequentially subjected to size normalization and color correction to obtain preprocessed gastroscopy images. The preprocessed gastroscopy images are input into a pre-trained multi-scale convolutional segmentation network. The multi-scale convolutional segmentation network includes a segmentation main branch, a surface interference suppression auxiliary branch, and a mid-level texture perception auxiliary branch. Multi-scale image features are extracted by the segmentation main branch, and auxiliary features are extracted by the surface interference suppression auxiliary branch and the mid-level texture perception auxiliary branch, respectively. The auxiliary features are used to perform weighted regulation and cross-scale fusion on the multi-scale image features, and a fused feature map is output. The fused feature map is decoded and restored to output a pixel-level segmentation mask image corresponding to the original gastroscopy image.
2. The intelligent segmentation method for gastric cancer endoscopic images based on multi-scale convolutional networks according to claim 1, characterized in that, The original gastroscopy images were sequentially subjected to size normalization and color correction to obtain preprocessed gastroscopy images, including: The original gastroscopy image is scaled to a preset uniform size using bilinear interpolation to obtain a size-normalized gastroscopy image. The size-normalized gastroscopy image is subjected to color correction processing to obtain a color-corrected gastroscopy image. The color-corrected gastroscopy image is used as the preprocessed gastroscopy image.
3. The intelligent segmentation method for gastric cancer endoscopic images based on multi-scale convolutional networks according to claim 2, characterized in that, The size-normalized gastroscopy image is subjected to color correction processing to obtain a color-corrected gastroscopy image, including: The grayscale world algorithm is used to calculate the channel mean values of the size-normalized gastroscopy image in the red, green, and blue channels respectively. The channel mean value of the green channel is used as the benchmark. The channel mean value of the red channel is divided by the channel mean value of the green channel to obtain the red channel gain coefficient. The channel mean value of the blue channel is divided by the channel mean value of the green channel to obtain the blue channel gain coefficient. The red channel pixel value of each pixel in the size-normalized gastroscopy image is multiplied by the red channel gain coefficient, the blue channel pixel value of each pixel is multiplied by the blue channel gain coefficient, and the green channel pixel value remains unchanged to obtain the color-corrected gastroscopy image.
4. The intelligent segmentation method for gastric cancer endoscopic images based on multi-scale convolutional networks according to claim 1, characterized in that, The preprocessed gastroscopy images are input into a pre-trained multi-scale convolutional segmentation network. This network includes a main segmentation branch, a surface interference suppression auxiliary branch, and a mid-level texture perception auxiliary branch. The main segmentation branch extracts multi-scale image features, while the surface interference suppression auxiliary branch and the mid-level texture perception auxiliary branch extract auxiliary features respectively. These auxiliary features are then used to weight and fuse the multi-scale image features across scales, outputting a fused feature map, including: The preprocessed gastroscopy images are input into a pre-trained multi-scale convolutional segmentation network. The processing within the multi-scale convolutional segmentation network includes: The segmentation main branch includes a first convolutional branch, a second convolutional branch, and a third convolutional branch. The first convolutional branch uses a 7×7 convolutional kernel, the second convolutional branch uses a 5×5 convolutional kernel, and the third convolutional branch uses a 3×3 convolutional kernel. The three convolutional branches simultaneously extract feature maps from the color-corrected gastroscopy images of the preprocessed gastroscopy images to form multi-scale image features. The surface interference suppression auxiliary branch takes the color-corrected gastroscopy image of the preprocessed gastroscopy image as input, and outputs an interference region spatial mask of the same size as the color-corrected gastroscopy image through a fully convolutional network with an encoder-decoder structure. The value of each pixel in the interference region spatial mask represents the probability that the pixel belongs to the reflective region or the bubble region, and the value range is 0 to 1. The mid-layer texture perception auxiliary branch performs difference quantification on the texture pattern of each pixel in the color-corrected gastroscopy image of the preprocessed gastroscopy image and the pre-learned normal gastric mucosa texture pattern, and outputs a texture anomaly heatmap. The value of each pixel in the texture anomaly heatmap represents the degree to which the texture of that pixel deviates from the normal mucosa, and the value range is 0 to 1. In the feature fusion stage of the segmented main branch, the spatial mask of the interference region is inverted and multiplied pixel by pixel with the multi-scale image features to obtain the interference-suppressed multi-scale image features. Then, the texture anomaly heatmap is multiplied pixel by pixel with the interference-suppressed multi-scale image features to obtain the weighted multi-scale image features. The weighted multi-scale image features are concatenated in the channel dimension, and 1×1 convolution is used to reduce the channel dimension of the concatenated features to obtain the fused feature map.
5. The intelligent segmentation method for gastric cancer endoscopic images based on multi-scale convolutional networks according to claim 4, characterized in that, The pre-training process of a multi-scale convolutional segmentation network includes: Collect a set of gastroscopy image samples with segmentation labels, the segmentation labels including pixel-level annotations of normal mucosal areas, gastric cancer-related abnormal areas, reflective areas and bubble areas; Each gastroscopy image sample in the gastroscopy image sample set is sequentially subjected to size normalization and color correction to obtain a preprocessed gastroscopy image sample set. An initial multi-scale convolutional segmentation network is constructed, which includes a segmentation main branch, a surface interference suppression auxiliary branch, and a mid-layer texture perception auxiliary branch. In the first stage, the parameters of the mid-layer texture perception auxiliary branch are fixed. The preprocessed gastroscopy image sample set is used as input, and the labels of reflective areas and bubble areas in the segmentation labels are used as supervision signals. The surface interference suppression auxiliary branch is trained separately using the binary cross-entropy loss function until convergence. In the second stage, the parameters of the surface interference suppression auxiliary branch are frozen. The image block containing only the normal gastric mucosa area in the preprocessed gastroscopy image sample set is used as input. The goal is to reconstruct the image block. The mean squared error loss function is used to train the middle texture perception auxiliary branch separately until convergence. In the third stage, the parameters of the surface interference suppression auxiliary branch and the middle texture perception auxiliary branch are frozen. The preprocessed gastroscopy image sample set is used as input, and the labels of normal mucosal areas and gastric cancer-related abnormal areas in the segmentation labels are used as supervision signals. The binary cross-entropy loss function is used to train the segmentation main branch until convergence. In the fourth stage, all parameters of the segmentation main branch, the surface interference suppression auxiliary branch, and the mid-layer texture perception auxiliary branch are unfrozen. Using the preprocessed gastroscopy image sample set as input, the segmentation loss of the segmentation main branch, the mask prediction loss of the surface interference suppression auxiliary branch, and the texture reconstruction loss of the mid-layer texture perception auxiliary branch are weighted and summed to obtain a joint loss function. With minimizing the joint loss function as the optimization objective, all parameters of the three branches are jointly fine-tuned until convergence, resulting in a pre-trained multi-scale convolutional segmentation network.
6. The intelligent segmentation method for gastric cancer endoscopic images based on multi-scale convolutional networks according to claim 5, characterized in that, Freeze the parameters of the surface interference suppression auxiliary branch, take the image patch containing only normal gastric mucosa area in the preprocessed gastroscopy image sample set as input, and reconstruct the image patch as the goal. Train the mid-layer texture perception auxiliary branch separately using the mean squared error loss function until convergence, including: From the preprocessed gastroscopy image sample set, image blocks containing only normal gastric mucosa areas are extracted according to the segmentation labels, and the size of the image blocks is a preset block size; An autoencoder network containing an encoder and a decoder is constructed as a mid-level texture-aware auxiliary branch. The encoder compresses the image patch into a low-dimensional feature vector through multiple convolutional layers and downsampling layers. The decoder reconstructs a reconstructed image patch of the same size as the original image patch from the low-dimensional feature vector through multiple upsampling layers and convolutional layers. Using the image patch as input and reconstructing the image patch as the goal, the pixel-level mean square error between the original image patch and the reconstructed image patch is calculated as a loss function to train the autoencoder network until the loss function converges. After training, each pixel in the color-corrected gastroscopy image of the preprocessed gastroscopy image and the pixels in the surrounding preset neighborhood window constitute an image block to be evaluated. This block is input into the autoencoder, and the pixel-level mean square error between the reconstructed image block and the image block to be evaluated is calculated. The pixel-level mean square error is used as the texture anomaly degree of each pixel. The texture anomaly degrees of all pixels are normalized to the range of 0 to 1, and a texture anomaly degree heatmap is generated.
7. The intelligent segmentation method for gastric cancer endoscopic images based on multi-scale convolutional networks according to claim 5, characterized in that, Freeze the parameters of the surface interference suppression auxiliary branch and the mid-layer texture perception auxiliary branch, take the preprocessed gastroscopy image sample set as input, and use the labels of normal mucosal areas and gastric cancer-related abnormal areas in the segmentation labels as supervision signals. Train the main segmentation branch using the binary cross-entropy loss function until convergence, including: Step 1: Input the preprocessed gastroscopy image sample set into the initial multi-scale convolutional segmentation network. Simultaneously extract multi-scale image features through the three convolutional branches of the main segmentation branch. After cross-scale fusion and decoding, the segmentation prediction result is output. The parameters of the surface interference suppression auxiliary branch and the middle texture perception auxiliary branch are frozen in this stage. Step 2: Calculate the binary cross-entropy loss between the segmentation prediction result and the pixel-level annotations of the normal mucosal region and the abnormal region related to gastric cancer in the segmentation label, and use it as the segmentation loss; Step 3: With minimizing the segmentation loss as the optimization objective, update the parameters of the three convolutional branches and the fusion decoding part in the main segmentation branch, and iteratively execute steps 1 to 3 until the segmentation loss converges.
8. The intelligent segmentation method for gastric cancer endoscopic images based on multi-scale convolutional networks according to claim 5, characterized in that, Using the preprocessed gastroscopy image sample set as input, the segmentation loss of the main segmentation branch, the mask prediction loss of the surface interference suppression auxiliary branch, and the texture reconstruction loss of the mid-layer texture perception auxiliary branch are weighted and summed to obtain a joint loss function. Minimizing this joint loss function is the optimization objective, and all parameters of the three branches are jointly fine-tuned until convergence, resulting in a pre-trained multi-scale convolutional segmentation network, including: Step 1: Input the preprocessed gastroscopy image sample set into the initial multi-scale convolutional segmentation network. The segmentation main branch outputs the segmentation prediction result, the surface interference suppression auxiliary branch outputs the interference region spatial mask, and the middle texture perception auxiliary branch outputs the reconstructed image block. Step 2: Calculate the binary cross-entropy loss between the segmentation prediction result output by the main segmentation branch and the pixel-level annotations of the normal mucosal region and the gastric cancer-related abnormal region in the segmentation label, as the segmentation loss; calculate the binary cross-entropy loss between the spatial mask of the interference region and the pixel-level annotations of the reflective region and the bubble region in the segmentation label, as the mask prediction loss; calculate the pixel-level mean square error between the reconstructed image block and the original image block, as the initial texture reconstruction loss. Step 3: Obtain the square of the dynamic range of pixel values of the preprocessed gastroscopy image, divide the initial texture reconstruction loss by the square of the dynamic range of pixel values, and obtain the dimensionally normalized texture reconstruction loss. Step 4: Multiply the mask prediction loss by the first weighting coefficient, multiply the dimensionally normalized texture reconstruction loss by the second weighting coefficient, and sum the weighted mask prediction loss and the weighted dimensionally normalized texture reconstruction loss with the segmentation loss to obtain the joint loss function. Here, the segmentation loss and the mask prediction loss are both binary cross-entropy losses with unified dimensions, and the dimensionally normalized texture reconstruction loss has been converted into a dimensionless relative error, which is consistent with the dimensions of the segmentation loss and the mask prediction loss. Step 5: With minimizing the joint loss function as the optimization objective, update all parameters of the segmentation main branch, the surface interference suppression auxiliary branch, and the middle texture perception auxiliary branch, and iteratively execute steps 1 to 5 until the joint loss function converges.
9. The intelligent segmentation method for gastric cancer endoscopic images based on multi-scale convolutional networks according to claim 1, characterized in that, The fused feature map is decoded and restored to output a pixel-level segmentation mask image corresponding to the original gastroscopy image, including: The fused feature map is upsampled layer by layer by the decoding module. The decoding module contains multiple upsampling layers. Each upsampling layer enlarges the feature map resolution by 2 times through bilinear interpolation. After each upsampling layer, the feature map at the corresponding resolution of the segmentation main branch encoding stage is concatenated with the upsampled feature map in the channel dimension through skip connections. Then, feature fusion is performed through 3×3 convolution and ReLU activation function to restore the same resolution as the original gastroscopy image layer by layer. During the upsampling process, the maximum value of each element of the spatial mask of the interference region and the texture anomaly heatmap is taken to generate a comprehensive attention guidance map. The comprehensive attention guidance map is then multiplied pixel by pixel with the output feature map of each upsampling layer. After the last upsampling layer, the number of feature map channels is compressed to 1 by 1×1 convolution. The probability value of each pixel belonging to the gastric cancer-related abnormal region is output by the Sigmoid activation function. Pixels with a probability value greater than the preset segmentation threshold are marked as gastric cancer-related abnormal regions, and pixels with a probability value less than or equal to the preset segmentation threshold are marked as normal mucosal regions, thus obtaining a pixel-level segmentation mask image.
10. A smart segmentation chip for gastric cancer endoscopic images based on multi-scale convolutional networks, characterized in that, The method for intelligent segmentation of gastric cancer endoscopic images based on multi-scale convolutional networks according to any one of claims 1 to 9 includes: The image preprocessing unit is used to perform size normalization and color correction on the original gastroscopy images in sequence to obtain preprocessed gastroscopy images. A multi-scale feature extraction and fusion unit is used to input the preprocessed gastroscopy image into a pre-trained multi-scale convolutional segmentation network. The multi-scale convolutional segmentation network includes a segmentation main branch, a surface interference suppression auxiliary branch, and a mid-layer texture perception auxiliary branch. The segmentation main branch extracts multi-scale image features, and the surface interference suppression auxiliary branch and the mid-layer texture perception auxiliary branch extract auxiliary features respectively. The auxiliary features are used to perform weighted regulation and cross-scale fusion of the multi-scale image features, and output a fused feature map. The decoding and restoration unit is used to decode and restore the fused feature map and output a pixel-level segmentation mask image corresponding to the original gastroscopy image.