Intestine and stomach cancer lesion image recognition method based on multi-scale image enhancement algorithm

By employing multi-scale image enhancement algorithms and dynamic feature perception mechanisms, the problem of lesion morphological polymorphism caused by environmental interference during the acquisition of gastrointestinal endoscopic images was solved, achieving high-accuracy and robust recognition of gastrointestinal cancer lesion images.

CN121767995APending Publication Date: 2026-03-31DONGGUAN PEOPLES HOSPITAL
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-22
Publication Date
2026-03-31

AI Technical Summary

Technical Problem

Existing technologies suffer from polymorphic variations in lesion morphology due to environmental interferences such as fluctuations in light intensity, mucus coverage, and intestinal peristalsis during the acquisition of gastrointestinal and intestinal images. Traditional classification and recognition models struggle to dynamically adjust feature focus points, leading to missed detections or misjudgments and insufficient generalization ability.

Method used

The algorithm extracts shallow texture, mid-level semantics and deep abstract features from gastrointestinal endoscopy images using a multi-scale image enhancement algorithm. It then generates personalized attention masks by combining local image statistical features, dynamically adjusts the attention strategy, introduces an adversarial perturbation loss term to optimize the model, and periodically updates the model parameters to adapt to changes in lesion morphology.

Benefits of technology

It improved the accuracy of gastrointestinal cancer lesion image recognition, reduced the false positive rate, enhanced the model's robustness and adaptability in complex environments, and significantly improved the detection capability of lesion areas.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121767995A_ABST
    Figure CN121767995A_ABST
Patent Text Reader

Abstract

The invention discloses a gastrointestinal cancer lesion image recognition method based on a multi-scale image enhancement algorithm, and the method comprises the steps: synchronously collecting an image and context parameters, such as illumination intensity, mucus coverage and peristaltic state, and obtaining enhancement features different from different scales through multi-scale filtering, semantic segmentation and depth feature extraction. In combination with a channel attention mechanism and interference type discrimination, personalized attention masks are generated, and adaptive weighting of feature fusion in different scenes is realized, so that the discrimination ability of the model to focuses under morphological variation and interference factors is improved. By introducing the incremental learning in the confrontation disturbance training and deployment stage, the recognition accuracy and robustness of the model in a complex clinical environment are remarkably improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of medical image processing technology, and in particular to a method for recognizing gastrointestinal cancer lesion images based on a multi-scale image enhancement algorithm. Background Technology

[0002] In recent years, the fields of medical image processing and intelligent lesion recognition have developed rapidly, especially in the early diagnosis of digestive system diseases such as gastrointestinal cancer. Automatic analysis and lesion identification of endoscopic images have become important tools for clinical decision support. Mainstream technical solutions are typically based on deep learning models, computer vision image enhancement, and multi-level feature extraction, combined with expert-annotated data, to achieve the classification and identification of suspicious lesion areas in gastrointestinal and colorectal endoscopy images. In the field of medical image processing, typical applications include early screening of gastrointestinal tumors, automatic lesion annotation during gastrointestinal endoscopy, and image enhancement to assist doctors in interpretation. Existing representative methods mostly rely on a fixed image feature space, such as using multi-layer convolutional structures to fuse shallow and deep features (e.g., U-Net, ResNet variants); some literature uses multi-scale filtering and pyramid decomposition to enhance image details and perform fine segmentation of the boundaries of lesion regions such as gastrointestinal cancer. These techniques perform well under uniform lighting conditions with no significant interference, and have high accuracy in recognizing typical lesion morphologies. However, existing technologies face significant challenges in practical clinical applications: During the acquisition of gastrointestinal and colonoscopy images, environmental interferences such as fluctuations in light intensity, mucus coverage, and intestinal peristalsis are common. The morphology of lesion areas exhibits high polymorphism and variability depending on individual differences, acquisition conditions, and disease progression. Traditional classification and recognition models either rely on static feature weight distributions, making it difficult to adjust feature focus points according to real-time acquisition scenarios, or employ rigid fusion methods, failing to dynamically perceive and enhance the discrimination region. In complex environments, models are prone to missed detections or misjudgments, especially for cases with blurred boundaries or atypical lesion presentations, resulting in insufficient generalization ability and impacting their practical clinical application value. Furthermore, most methods in the industry focus on qualitative identification of lesion regions, lacking effective mechanisms to proactively address dynamic changes in lesion morphology. For example, existing multi-scale enhancement algorithms simply stack features from different layers without establishing adaptive discrimination processes for deformation, blurring, or mixed interference presented by lesions. Attention mechanisms are often static or globally configured, lacking the ability to adapt to specific interferences such as lighting, mucus, or peristalsis. Robustness enhancement techniques such as adversarial perturbation are mostly applied during model training, and are difficult to sustain in response to novel morphological changes after actual deployment. Summary of the Invention

[0003] In order to solve the above-mentioned technical problems, the present invention provides a method for recognizing gastrointestinal cancer lesions based on a multi-scale image enhancement algorithm.

[0004] The technical solution of this invention is implemented as follows: A method for recognizing gastrointestinal cancer lesions based on a multi-scale image enhancement algorithm, comprising: S1: Acquire raw image data from gastrointestinal endoscopy and record the light intensity, mucus coverage, and intestinal peristalsis status during image acquisition as image quality context parameters; S2: Perform multi-scale image enhancement processing on the original image to generate three sets of enhanced image feature maps, which respectively contain shallow texture features, mid-level semantic features, and deep abstract features; S3: Based on the enhanced image feature map, calculate the local image statistical features, including edge density, gray-level variance and structural complexity, and generate the local image feature vector; S4: Input the local feature vector of the image into the lightweight dynamic feature perception module, generate the importance weight distribution of feature channels at each scale through learnable convolution weights, and output a personalized attention mask. S5: The personalized attention mask is weighted and fused with the original multi-scale enhanced image feature map to generate a fused feature representation vector with strong discriminative ability; S6: Input the fused feature representation vector into the classification and recognition model, perform end-to-end gastrointestinal cancer lesion classification training, and introduce an adversarial perturbation loss term during the training process to simulate lesion morphological changes; S7: Based on the changing trends of recognition accuracy and misjudgment rate of the validation set during training, dynamically adjust the weight coefficient of the adversarial perturbation loss term to optimize the model's generalization ability under unknown morphological changes. S8: During the deployment phase, based on the real-time acquired image quality context parameters, determine whether the current image belongs to a high-light fluctuation, mucus coverage, or intestinal peristalsis interference scenario, and dynamically switch the corresponding attention mask generation strategy. S9: If the scene is determined to be a high-light fluctuation scene, an enhanced edge-preserving attention strategy is adopted; if the scene is determined to be a slime-covered scene, a texture-compensated attention strategy is adopted; otherwise, a standard attention mask generation strategy is adopted. S10: Periodically collect the recognition results and doctor feedback annotation data after the model is deployed, build an incremental training dataset and regularly update the classification and recognition model parameters to continuously improve the model's ability to adapt to dynamic changes in lesion morphology.

[0005] This application provides a method for recognizing gastrointestinal cancer lesions based on a multi-scale image enhancement algorithm, which has the following beneficial effects: (1) This invention can fully extract the regional features of gastrointestinal endoscopy images in shallow texture, middle semantic and deep abstract space through multi-scale enhancement and structural feature separation, effectively alleviating the problems of missed detection and misjudgment caused by single feature scale in traditional classification models; (2) This invention uses a dynamic feature perception mechanism and a multi-channel one-dimensional convolutional network to adaptively generate channel-level weights, thereby effectively enhancing the discriminative features. During the deployment phase, attention strategies are flexibly switched based on real-time collected illumination, mucus, and peristalsis conditions, which not only improves the discriminative ability of weak feature regions but also reduces the impact of subjective noise, resulting in improved single-scene recognition accuracy and a significant decrease in the misjudgment rate. (3) The present invention introduces FGSM perturbation during the training process to simulate clinical real variations such as blurred lesion boundaries, tissue stretching and light distortion, effectively optimizes the classifier space of standard samples and perturbation samples simultaneously, and shows obvious robustness to new or rare lesion morphologies in actual clinical applications. (4) This invention uses multi-layer splicing and fusion of statistical indicators such as edge density, gray-level variance, and structural complexity to enable the model to distinguish the subtle structural differences between the lesion area and the background. Response contrast quantitative analysis shows that the spatial separation of the lesion-background is significantly improved compared with traditional methods, which significantly enhances the detection capability under blurred boundaries or occlusion. Attached Figure Description

[0006] Figure 1 This is a flowchart of a gastrointestinal cancer lesion image recognition method based on a multi-scale image enhancement algorithm according to the present invention; Figure 2 This is a sub-flowchart of a gastrointestinal cancer lesion image recognition method based on a multi-scale image enhancement algorithm according to the present invention; Figure 3 This is another sub-flowchart of a gastrointestinal cancer lesion image recognition method based on a multi-scale image enhancement algorithm according to the present invention. Detailed Implementation

[0007] To make the objectives and advantages of the present invention clearer, the present invention will be further described below with reference to embodiments; it should be understood that the specific embodiments described herein are merely for explaining the present invention and are not intended to limit the present invention.

[0008] Preferred embodiments of the present invention will now be described with reference to the accompanying drawings. Those skilled in the art should understand that these embodiments are merely illustrative of the technical principles of the present invention and are not intended to limit the scope of protection of the present invention.

[0009] When used herein, the singular forms of “a,” “an,” and “the” may also include the plural forms unless the context clearly indicates otherwise. It should also be understood that the terms “comprising / including” or “having,” etc., specify the presence of the stated features, wholes, steps, operations, components, parts, or combinations thereof, but do not preclude the possibility of the presence or addition of one or more other features, wholes, steps, operations, components, parts, or combinations thereof. Meanwhile, the term “and / or” as used in this specification includes any and all combinations of the associated listed items.

[0010] Please see Figures 1-3 As shown, a method for recognizing gastrointestinal cancer lesions based on a multi-scale image enhancement algorithm includes: S1: Acquire raw image data from gastrointestinal endoscopy and record the light intensity, mucus coverage, and intestinal peristalsis status during image acquisition as image quality context parameters; S2: Perform multi-scale image enhancement processing on the original image to generate three sets of enhanced image feature maps, which respectively contain shallow texture features, mid-level semantic features, and deep abstract features; S3: Based on the enhanced image feature map, calculate the local image statistical features, including edge density, gray-level variance and structural complexity, and generate the local image feature vector; S4: Input the local feature vector of the image into the lightweight dynamic feature perception module, generate the importance weight distribution of feature channels at each scale through learnable convolution weights, and output a personalized attention mask. S5: The personalized attention mask is weighted and fused with the original multi-scale enhanced image feature map to generate a fused feature representation vector with strong discriminative ability; S6: Input the fused feature representation vector into the classification and recognition model, perform end-to-end gastrointestinal cancer lesion classification training, and introduce an adversarial perturbation loss term during the training process to simulate lesion morphological changes; S7: Based on the changing trends of recognition accuracy and misjudgment rate of the validation set during training, dynamically adjust the weight coefficient of the adversarial perturbation loss term to optimize the model's generalization ability under unknown morphological changes. S8: During the deployment phase, based on the real-time acquired image quality context parameters, determine whether the current image belongs to a high-light fluctuation, mucus coverage, or intestinal peristalsis interference scenario, and dynamically switch the corresponding attention mask generation strategy. S9: If the scene is determined to be a high-light fluctuation scene, an enhanced edge-preserving attention strategy is adopted; if the scene is determined to be a slime-covered scene, a texture-compensated attention strategy is adopted; otherwise, a standard attention mask generation strategy is adopted. S10: Periodically collect the recognition results and doctor feedback annotation data after the model is deployed, build an incremental training dataset and regularly update the classification and recognition model parameters to continuously improve the model's ability to adapt to dynamic changes in lesion morphology.

[0011] Step S1: Acquire the raw image data from the gastrointestinal endoscopy, and record the light intensity, mucus coverage, and intestinal peristalsis status during image acquisition as image quality context parameters. Specifically, this includes: S1.1: Perform frame synchronization acquisition processing on the raw RGB image signal output by the gastrointestinal endoscopy acquisition device to obtain image data frames containing the complete lesion area; Under the condition of raw RGB image signal input, a frame synchronization acquisition control algorithm is adopted (parameter: frequency of the output clock signal of the gastrointestinal endoscope camera module). Video data stream baseband signal delay tolerance (ms), to achieve precise synchronization between the image signal of the acquisition device and the system time base signal; Read the pixel-by-pixel RGB data stream output by the image sensor via a high-speed, low-latency frame buffer interface (parameter: sampling bit depth). bit, sampling frequency (fps) to perform data integrity checks on the transmission channel and obtain unpacked frame-level data buffers; Furthermore, an image boundary detection algorithm based on line synchronization signals and field synchronization signals (parameter: effective row pixels) is used. Column effective pixels This enables edge localization of the effective region within the frame and generates a set of candidate regions of interest (ROI) coordinates containing the complete lesion region. Furthermore, a frame cropping and pixel remapping algorithm based on the ROI coordinate set (parameter: distortion correction coefficient matrix) is used. (using bilinear interpolation) to correct pixel position errors caused by lens distortion and output a geometrically corrected full-frame image matrix; Furthermore, a channel separation and gain equalization method based on color fidelity constraints is used (parameter: target white balance coefficient vector). This enables amplitude compensation for each RGB component and generates standard RGB frame data with consistent color space. By using frame-synchronized acquisition and geometric color correction processing, the raw signal acquired in the previous step is transformed into full-frame image data that meets the requirements of spatial geometric consistency and color accuracy, thus achieving the expected technical effect of providing high-quality input for subsequent calculations of light intensity, mucus coverage and intestinal peristalsis state parameters. For example, in a gastrointestinal endoscopy device of model HD-1200, the reference clock frequency of the frame synchronization control algorithm is set to... MHz, delay tolerance is ms, video sampling bit depth is bit, sampling frame rate FPS. The raw RGB data output by the device is input to the capture card's buffer module via the LVDS interface, with a line synchronization pixel count of [missing value]. The number of field-synchronized pixels is During image boundary detection, the ROI range is automatically located to... × The pixel area is used to ensure coverage of the entire lesion area. Distortion correction uses pre-calibrated radial distortion coefficients. Pixel remapping is performed using bilinear interpolation to ensure straight edges are free of distortion. The color correction stage uses a target white balance coefficient of [value missing]. This allows the RGB mean error under grayscale card testing to be controlled within a certain range. Within 90%. The final generated full-frame RGB image showed high stability in subsequent illumination intensity calculations, and the complete extraction rate of the ROI lesion area reached 90% in multiple tests. This provides high-confidence input data for the dynamic feature perception and classification recognition module; S1.2: Based on the metadata interface of the image acquisition device, obtain the illumination intensity parameters recorded synchronously with the original image. The illumination intensity parameters include the light source output intensity value and white balance adjustment parameters at the time of image acquisition. Based on the metadata interface of the image acquisition device, a synchronous data request protocol is adopted (parameter: timestamp precision). ms, interface bandwidth (Gbps), enabling time-aligned access to the full-frame RGB image data output from the preceding S1.1; Furthermore, through a metadata parsing algorithm (parameter: data frame header length) (Bytes, CRC32 verification method) The collected metadata stream is structured and parsed to locate the offset address between the light intensity information field and the white balance parameter information field, and the original values ​​are extracted. Furthermore, a light source output intensity value decoding method is adopted (parameter: sensor output range). to ADC bit width bit), to encode the value Converted to actual light intensity The calculation formula is:

[0012] in For ADC sampled values, To calibrate the maximum value (in Lux) of the output illumination range; Furthermore, a white balance adjustment parameter normalization method is adopted (parameter: range of red channel gain coefficient). Blue channel gain range ), the original gain coefficient , Mapping to an unbiased reference The normalization formula is:

[0013] in The original white balance gain coefficient recorded by the device; Furthermore, the light intensity with normalized white balance coefficient vector Vectors are combined to generate a set of illumination intensity parameters, which serve as components of subsequent image quality context parameters; Through the above metadata access, parsing, numerical decoding and normalization processing, the illumination intensity values ​​and white balance parameters recorded synchronously with the original RGB image are transformed into quantifiable numerical illumination intensity parameters that can directly participate in image enhancement and feature perception, so as to achieve the expected technical effect of providing accurate illumination environment input for multi-scale enhancement and dynamic feature weight adaptation. For example, in the acquisition system of the HD-1200 gastrointestinal endoscope, the timestamp precision of the metadata interface is set to... ms, interface bandwidth is Gbps ensures consistency between metadata and RGB frame data. The raw ADC value of the light source output intensity is parsed from the 128-byte frame header using CRC32 checksum. The light intensity is calculated using the formula as follows: ≈ Lux. The red channel gain coefficient is obtained by reading the white balance parameters. Blue channel gain coefficient After normalization, they are respectively = and = The generated set of illumination intensity parameters is ( , , , In subsequent feature fusion experiments, compared to the base model without illumination parameters, the average classification accuracy improved. The false positive rate decreased. % S1.3: Obtain the slime coverage parameter through the slime detection sensor built into the image acquisition device. The slime coverage parameter is an estimated value of the slime layer thickness calculated based on the near-infrared spectral reflectance intensity. S1.4: Motion estimation is performed on continuously acquired image sequences using an image sequence inter-frame motion vector analysis algorithm to extract intestinal peristalsis state parameters, which include motion vector amplitude distribution entropy and local region displacement variance; S1.5: The light intensity parameter, mucus coverage parameter and intestinal peristalsis state parameter are normalized and fused to generate an image quality context parameter vector, which serves as the environmental perception input for the subsequent dynamic feature perception module.

[0014] Step S2: Perform multi-scale image enhancement processing on the original image to generate three sets of enhanced image feature maps, each containing shallow texture features, mid-level semantic features, and deep abstract features. Specifically, this includes: S2.1: Perform multi-scale Gaussian filtering on the original gastrointestinal images to extract local contrast and edge information at different scales and obtain a multi-scale edge response image set; The normalized RGB image matrix of gastrointestinal endoscopy after full-frame geometric and color correction output by step S1 is then subjected to a multi-scale Gaussian filtering method (parameter: scale set). The pixel and filter kernel size are adaptively set according to the scale. This enables smoothing and detail separation of images at different spatial frequencies; Furthermore, a two-dimensional Gaussian kernel generation algorithm (parameter: standard deviation) is used. (corresponding to scale s, the normalization coefficient ensures the conservation of convolution energy), generate two-dimensional Gaussian convolution kernels for each scale, and perform spatial convolution operations on the RGB three channels respectively to obtain a smoothed multi-scale image set; Furthermore, the Differential Gaussian (DoG) edge enhancement algorithm is used (parameter: the ratio of the standard deviations of adjacent scales is set to...). Perform pixel-by-pixel difference on adjacent smooth scale images to extract edge intensity response maps at multiple scales, forming a preliminary multi-scale edge feature set; Furthermore, the gradient magnitude of the edge response maps at each scale is normalized using a normalized gradient magnitude calculation method (parameter: gradient operator is Sobel 3×3 kernel), and the local contrast index of each pixel is calculated. And its intensity distribution is linearly normalized (range 0 to 1) to improve cross-scale consistency and comparability; Furthermore, a threshold filtering method that balances noise suppression with detail preservation (parameter: threshold coefficient) is employed. Low-gradient artifacts in the multi-scale edge response map are eliminated while structural edge details are preserved, resulting in a denoised multi-scale edge response image set. By using multi-scale Gaussian filtering, differential edge enhancement, gradient magnitude normalization, and noise suppression, the original standardized gastrointestinal endoscopy image matrix is ​​transformed into a multi-scale edge response image set containing local contrast and edge information at different spatial scales. This achieves the expected technical effect of providing high signal-to-noise ratio and multi-resolution structured input data for the subsequent Laplacian pyramid decomposition in S2.2. For example, in the HD-1200 gastrointestinal endoscopy system equipped with a CMOS image sensor, the resolution is... × The normalized RGB frame data of pixels, with the Gaussian kernel scale set selected as... Pixels, with corresponding standard deviations generated according to scale. = , = A two-dimensional Gaussian kernel was applied and convolutional smoothing was performed to obtain five images with different levels of smoothness. A DoG image was constructed using adjacent scale differences, and then the gradient components were calculated using the Sobel operator. and The normalized contrast map was obtained using the gradient magnitude formula. After filtering out noise responses with a threshold below 0.05, the edge response maps at each scale showed continuous high-intensity peaks at the lesion contour, and background noise was significantly suppressed. After subsequent S2.2 structure layering processing, the contour localization accuracy of this multi-scale edge response set was improved by 4.8% compared to the unenhanced processing in complex lighting fluctuation and mucus interference scenarios, providing stable and high-quality input features for the dynamic feature perception module. S2.2: Based on the multi-scale edge response image set, the Laplacian pyramid decomposition method is used to perform image structure layering to separate shallow texture features and mid-level structural features in the image and generate a multi-scale image pyramid representation. S2.3: Perform local histogram equalization on each layer of the multi-scale image pyramid to enhance the ability of the image to express local details at different scales and obtain an enhanced multi-scale texture feature map; S2.4: Based on the enhanced multi-scale texture feature map, a semantic segmentation network model is used to extract mid-level semantic features to identify tissue structures and potential lesion areas in the image and generate a mid-level semantic feature map. S2.5: Perform deep convolution feature extraction processing on the mid-level semantic feature map to obtain a high-level abstract feature representation with strong discriminative ability, and generate a deep abstract feature map; S2.6: Perform scale alignment and normalization on the shallow texture feature map, the mid-level semantic feature map and the deep abstract feature map to ensure the consistency of features at each scale in terms of spatial dimension and numerical range, and generate a standardized multi-scale enhanced image feature map set.

[0015] Step S3: Based on the enhanced image feature map, calculate local image statistical features, including edge density, gray-level variance, and structural complexity, to generate a local image feature vector. For example... Figure 2 As shown, it specifically includes: S3.1: After multi-scale image enhancement processing, three sets of enhanced image feature maps are generated. Edge detection algorithms are then executed on each set to extract edge distribution information at each scale and obtain edge density feature maps. S3.2: Based on the edge density feature map, calculate the ratio of the number of edge pixels to the area of ​​the region in the local area to quantify the edge density features and generate an edge density statistical vector; Based on the multi-scale edge density feature map matrix output by the S3.1 sub-step, a local region partitioning method is adopted (parameter: window size). <w>for Pixels × pixels, sliding step size is (pixels) to achieve spatial block processing of the entire feature map; Furthermore, a binarized edge mask generation algorithm is used (parameter: edge response threshold τ is set to...). (Values ​​range from 0 to 1) Threshold segmentation is performed on the edge intensity map of each local region to generate a binarized matrix containing only significant edge pixels; Furthermore, the number of local edge pixels is calculated. This number represents the number of units with a pixel value of 1 in the binarized matrix of the region; simultaneously, the area of ​​the local region is calculated. Its value is the total number of pixels within the window size; Furthermore, the edge density formula is used for normalization calculation, as follows:

[0016] in, The edge density of this local region represents the proportion of significant edge pixels per unit area. Furthermore, the calculations obtained for all local regions of the entire map The values ​​are concatenated sequentially in row-first scanning order to form an edge density statistical vector, maintaining an index mapping relationship consistent with the spatial distribution of the original feature map; By using local edge pixel counting and normalization, the edge distribution information generated by S3.1 is transformed into a quantitative edge density statistical index, which effectively quantifies the intensity of structural detail distribution in feature maps at different scales, providing a basis for subsequent joint analysis of gray-scale variance and structural complexity. For example, at a resolution of × On the single-scale enhanced edge feature map of a pixel, set the local window size. <w>= × pixels, sliding step size is Pixels, then each feature map is divided into × A local region. Within a certain region, the number of salient edge pixels after binarization. area Pixels, substituting them into the formula to calculate edge density ≈ In areas with uniform lighting and clearly defined lesion boundaries, Generally higher than In areas covered by mucus, this value drops significantly to [value missing]. The following is a sequence of concatenating the edge densities of all local regions to obtain a length of... The statistical vector is used in sub-steps S3.3 and S3.4 for subsequent feature fusion and structural complexity calculation. Validation results show that this quantitative indicator is significantly positively correlated with lesion contour integrity (Pearson correlation coefficient reaches [value missing]). ); S3.3: Perform gray-level variance calculation on local image blocks in the feature maps of enhanced images at each scale to evaluate the intensity of gray-level changes in local image regions and obtain gray-level variance statistical vectors; For the multi-scale enhanced image feature map corresponding to the edge density statistical vector output by sub-step S3.2, a local image block partitioning method is adopted (parameter: window size is...). Pixels × pixels, sliding step size is (pixels), perform spatial scanning on feature maps at various scales to obtain a local set of pixels for grayscale variance calculation; Furthermore, the average gray value of each local area is obtained through the pixel gray value mean calculation method, and used as the central reference value for variance calculation; Furthermore, the dispersion of pixel grayscale distribution in each local image block is calculated using the grayscale variance formula to reflect the intensity of grayscale change in that region. Furthermore, a normalization algorithm is used (parameter: normalization interval [...]). , The system performs a linear mapping on all local grayscale variance values ​​to eliminate the absolute influence of different scales and brightness conditions on the variance values, and obtains grayscale variance normalized values ​​that can be compared across scales. Furthermore, the normalized grayscale variance values ​​are sequentially stitched together according to the original image block scanning order to generate a grayscale variance statistical vector, maintaining the spatial order index consistent with the edge density statistical vector, so that the structural complexity can be jointly calculated in the S3.4 sub-step; By using a chain-like calculation method based on the mean and dispersion of local pixel sets, the intensity of detail brightness changes in enhanced feature maps at each scale is transformed into a quantifiable gray-level variance statistical index, thereby achieving an effective description of the texture complexity of the lesion region. For example, at a resolution of × On the single-scale enhanced feature map of pixels, set the window size to × pixels, sliding step size is Pixels divide the entire image into × A local region. The total number of pixels within a certain region. Calculate the mean gray value pixel by pixel Then, the variance of the original gray level is calculated using the variance formula. The variance of all gray levels in the entire image is divided into intervals [...]. , Normalization processing was performed, and the normalized variance value for this region is [value missing]. In lesion margin regions with high texture complexity, the normalized variance is typically greater than [value missing]. In smooth background areas, it is lower The final spliced ​​length is... The gray-level variance statistical vector is perfectly aligned with the edge density statistical vector on the index. Validation shows that this index is more sensitive to texture details under changes in lesion morphology than the simple edge density feature (improving accuracy by 3.1% in texture differentiation tasks in dynamic crawling scenes). S3.4: Based on the gray-level variance statistical vector and the edge density statistical vector, the structural similarity measurement algorithm is used to calculate the structural complexity of local image patches and generate a structural complexity feature vector. Based on the gray-level variance statistical vector output by sub-step S3.3 and the edge density statistical vector output by sub-step S3.2, a structural similarity measurement algorithm is adopted (parameter: window size). Pixels × Pixels, sliding step Pixel, luminance component weight The contrast and structural components each have a weight of 1. This allows for the calculation of the structural complexity of local image patches. Furthermore, a region-by-region analysis is performed by combining the edge density statistical vector and the gray-level variance statistical vector using a structural similarity metric formula. The structural similarity formula is as follows:

[0017] in, and These represent the mean values ​​of the local regions corresponding to the gray-level variance statistical vector and the edge density statistical vector, respectively. and Its standard deviation, Let the covariance of the two be , and To avoid a stabilization constant with a denominator of zero (set to...) and ); Furthermore, within each local window, the brightness component is calculated based on the normalized gray-level variance and edge density features. Contrast component With structural components They are then combined according to their weights to form a comprehensive structural complexity index. :

[0018] in, = , = , = ; Furthermore, the above calculations yielded... The values ​​are arranged sequentially according to the image scanning order to form a structural complexity feature vector. This feature vector is strictly aligned with the gray-level variance statistical vector and the edge density statistical vector in terms of dimension, so that the feature of the three can be stitched together in the S3.5 sub-step. By combining structural similarity measurement and weighted component analysis, edge distribution features and grayscale change features are integrated into a unified structural complexity quantification index, which can comprehensively describe the consistency of details and spatial structural differences of local image blocks, and improve the ability of the dynamic feature perception module to distinguish lesion areas. For example, at a resolution of × On the enhanced image feature map of pixels, using window size Pixels × Pixels, Step Pixels, to obtain a total A local region. For a given region, its edge density statistical mean. Gray-scale variance statistical mean Corresponding standard deviation , covariance Substituting into the structural similarity formula, we get... Then, the brightness, contrast, and structure components are combined according to parameter weights to obtain... The structural complexity feature vector calculated from the entire image shows a concentrated high value distribution in high-texture lesion regions and a low value in smooth background regions. Validation indicates that this indicator has a high consistency coefficient with clinicians' annotation of lesion saliency. This helps to significantly reduce the misjudgment rate in complex contexts; S3.5: Perform feature concatenation operation on the edge density statistical vector, gray-level variance statistical vector and structural complexity feature vector to generate a unified-dimensional local image feature vector, which serves as the input feature representation for the dynamic feature perception module.

[0019] Step S4: The local feature vector of the image is input into a lightweight dynamic feature perception module, which generates an importance weight distribution for feature channels at each scale through learnable convolutional weights, and outputs a personalized attention mask. For example... Figure 3 As shown, it specifically includes: S4.1: Perform channel normalization processing on the local feature vector of the image to eliminate the influence of different image quality context parameters on the feature distribution and obtain a standardized local feature vector of the image; For the unified-dimensional local feature vector of the image generated by the S3.5 sub-step, a channel normalization algorithm (parameter: normalization method is Z-score standardization) is used to eliminate the overall offset and scale inconsistency of the context parameters of different image quality in the feature distribution; Furthermore, mean estimation is performed on each channel of the feature vector using a mean calculation method, as shown in the following formula:

[0020] in, For channel The mean, For the first channel 1 eigenvalue, The length of the channel vector; Furthermore, the standard deviation is estimated for each channel of the eigenvector using the standard deviation calculation method, as shown in the following formula:

[0021] in, Indicates channel Standard deviation; Furthermore, the feature values ​​of each channel are normalized and mapped according to the Z-score formula, as follows:

[0022] in, For the normalized first One eigenvalue; Furthermore, through a linear scaling algorithm (parameter: target interval [...]), , The Z-score normalization result is mapped to ensure that the output range of different channels is consistent, thereby avoiding scale bias in subsequent convolution processing and channel attention calculation.

[0023] Through the above normalization process, the original image local feature vector generated by the S3.5 sub-step is transformed into a standardized image local feature vector with a mean of zero, a variance of one, and a consistent numerical range, thereby achieving the preprocessing effect of feature alignment under different image quality contexts. For example, at a resolution of × Pixels, Local Window Size × Pixels, sliding step Under pixel conditions, the length of the uniform-dimensional local feature vector of the image output by S3.5 is... It contains three statistical feature sub-vectors (edge ​​density, gray-level variance, and structural complexity). In a given channel, the original mean... Standard deviation For the 1200th eigenvalue The normalized value is obtained by Z-score normalization. Then map to the interval [ , The value obtained afterwards After this processing was applied to all channels, the distribution deviation of the normalized feature vector under different acquisition conditions (high light fluctuations, slime coverage, and creep disturbances) was reduced to the original value. Within this range, the scale consistency and stability of the subsequent S4.2 one-dimensional convolution extraction of local feature maps are significantly improved; S4.2: Based on the standardized local feature vector of the image, a lightweight one-dimensional convolutional network is used to extract local feature maps in order to capture the potential correlation of the image in terms of edge density, gray-level variance and structural complexity. Based on the standardized local feature vectors of the image output by the S4.1 sub-step, a lightweight one-dimensional convolutional neural network feature extraction method is adopted (parameter: number of convolutional kernels). kernel length Step length (with the padding method being "same"), this operation performs a sliding window convolution on the feature vector along the channel dimension, thereby capturing the local interaction patterns between edge density, gray-level variance, and structural complexity. Furthermore, the convolution output feature map is processed by the ReLU nonlinear activation function to model the nonlinear correlation in the feature space and suppress the influence of weakly correlated noise features; Furthermore, a batch normalization algorithm is employed (parameter: momentum coefficient). ε stability constant The convolution activation results are normalized by mean-variance within the batch to eliminate the distributional bias of different feature channels and improve the stability of subsequent feature weighting processes. Furthermore, through a second convolutional layer (parameter: number of convolutional kernels) kernel length Step length Extract long-range dependency patterns across channels in the low-dimensional feature subspace to enhance the coupling expression ability of multidimensional features under complex lesion morphology; Furthermore, the high-dimensional features output by the second convolutional layer are mapped onto the channel dimension and concatenated and fused, and then max pooling is performed (parameter: pooling window length). Step length Compress the feature length to retain significant response locations while reducing computational redundancy; Through the above convolution-activation-normalization-convolution-fusion-pooling chain processing method, the standardized local feature vector of the image is transformed into a local feature map that can reflect the potential correlation pattern between multi-scale statistical features, so as to realize the efficient capture of lesion discrimination features by the dynamic feature perception module under complex clinical interference conditions. For example, at a resolution of × pixels, uniform feature vector length is Given standardized local image features as input, the number of kernels in the first layer of the one-dimensional convolutional network is configured to be... , length is Step size is It can generate the dimension of the output feature matrix. × After ReLU activation and batch normalization, a second convolutional layer is performed (number of convolutional kernels). ,length ) to obtain the output matrix × Subsequently, the initial convolution result is introduced into the channel dimension stitching to form... The joint characteristics of the channel, the execution kernel length is The max pooling operation compresses the length to The final size is × The local feature mapping. On the doctor-annotated image of a scene with fluctuating high-light conditions, the average response value of the above feature mapping in the lesion area is improved compared to the background. The activation response generated after global pooling in step S4.3 can significantly improve the accuracy of weight allocation of the discriminative channel by the personalized attention mask; S4.3: Perform global average pooling on the local feature map to generate preliminary activation response values ​​for feature channels at each scale, which serve as the initial reference for the importance weight distribution; For the local feature mapping matrix output by the S4.2 sub-step, a global average pooling method is used (parameters: the pooling kernel covers the entire spatial dimension, and the stride is consistent with the width and height of the feature map) to realize the numerical averaging operation of each feature channel in the global space, so as to compress the spatial distribution and obtain a channel-level global description. Furthermore, the average value is calculated using the formula for the first... Each channel performs global statistics, using the following formula:

[0024] in, Indicates channel The global average response value, For channel In position eigenvalues, This represents the total number of spatial locations. Furthermore, the above global average results are combined into a one-dimensional vector in the order of channel index to form a preliminary activation response value vector, so as to ensure that the channel importance mapping relationship can be directly established based on the vector in the subsequent attention weight learning stage. Furthermore, a normalization algorithm is used (parameter: mapping interval [...]). , The initial activation response value is linearly scaled to eliminate the dimensional differences in response amplitude between different feature mapping channels, thereby avoiding numerical dominance bias in the weight distribution generation process. Furthermore, numerical stabilization is performed on the normalized activation response value vector (parameter: minimum threshold is...). This prevents the vanishing gradient problem caused by the minimal response channel in the subsequent S4.4 sub-step learnable weight calculation stage; By using global average pooling and normalization, the local feature maps generated by S4.2 are transformed into preliminary activation response value vectors that can characterize the overall activation level of feature channels at each scale, providing an initial reference for generating the importance weight distribution of multi-scale feature channels. For example, at a resolution of × Pixels, number of channels The length of the space is In the local feature mapping matrix, for the th Each channel is used to perform global average pooling to obtain the original average response value. ; By linear normalization (interval [ , ], original maximum value minimum value Mapped to Numerical stabilization process is maintained. The unchanged value was used as the initial activation response value. Under different interference scenarios (high light fluctuations, mucus coverage, and peristalsis interference), the normalized response value of the lesion-related channel was generally higher than that of the background channel. The above differences, after being weighted by the channel attention matrix in S4.4, can further amplify the importance of discriminative features and achieve precise selective enhancement of multi-scale information under complex clinical interference conditions; S4.4: Based on the preliminary activation response value, linear transformation and nonlinear activation are performed through the learnable channel attention weight matrix to generate the importance weight distribution of feature channels at each scale; S4.5: Perform Softmax normalization on the importance weight distribution to generate a personalized attention mask to adapt to the multi-scale feature fusion requirements under different image quality contexts.

[0025] Step S5: The personalized attention mask is weighted and fused with the original multi-scale enhanced image feature map to generate a fused feature representation vector with strong discriminative power. Specifically, this includes: S5.1: Channel dimension alignment is performed on the shallow texture features, mid-level semantic features and deep abstract features in the original multi-scale enhanced image feature maps to ensure that the feature maps at each scale have a unified feature dimension and spatial resolution during subsequent weighted fusion. S5.2: Based on the importance weight distribution of feature channels at each scale in the personalized attention mask, a channel-wise weighting operation is performed on the aligned multi-scale enhanced image feature map to highlight discriminative features that are highly correlated with the local statistical characteristics of the current image; For the multi-scale enhanced image feature map after channel dimension alignment in the S5.1 sub-step, a channel-wise weighted algorithm (parameter: weighting coefficients are derived from the importance weight distribution of the personalized attention mask) is used to adaptively adjust the feature intensity according to the scale feature channel; Furthermore, by performing element-wise multiplication of the channel weight mapping matrix and the feature map in the channel dimension, an explicit combination of weight distribution and eigenvalues ​​is achieved, generating a weighted multi-scale feature response matrix. The element-wise multiplication formula used is as follows:

[0026] in, For channel In spatial location eigenvalues ​​at that location The channel weight coefficients given for the personalized attention mask. These are the weighted eigenvalues; Furthermore, the above channel-wise and pixel-wise weighted operations are executed on a GPU parallel architecture through vectorization to reduce computational latency and meet clinical real-time requirements. Furthermore, the weighted multi-scale feature matrix is ​​grouped according to scale number, and the mean response value of the lesion region and the contrast of the response value of the background region are calculated at each scale to quantify the enhancement effect of the discriminant features after weighting. The formula for calculating the mean is as follows:

[0027] in, For channel The average response value of the lesion or background area. For weighted eigenvalues, This represents the number of pixels in the region. Furthermore, the response contrast calculation formula is adopted:

[0028] in, For channel Lesion-background response contrast, and These are the average response values ​​for the lesion and background regions, respectively. By monitoring and analyzing the response contrast, scale channels that significantly improve discriminative power under the current local statistical characteristics of the image are selected, providing targeted feature inputs for the subsequent spatial stitching and fusion of S5.3. By using the above-mentioned channel-by-channel weighting, grouping statistics and contrast evaluation processing methods, the importance weights in the personalized attention mask are accurately mapped to multi-scale features, thereby achieving discriminative feature enhancement for the current clinical interference conditions and improving the feature separation degree between lesions and background. For example, at a resolution of × The number of pixels and the number of channels in the aligned multi-scale feature map are 100. Under the given conditions, the weight range of the shallow texture feature channel in the personalized attention mask is: to The range of channel weights for mid-level semantic features is: to The range of deep abstract feature channel weights is to After channel-by-channel weighted calculation, the average response value of the gastrointestinal cancer lesion area was changed from the original... Upgraded to The average response value of the background area remains at Left and right, contrast from Upgraded to In high-light fluctuation interference scenarios, this feature enhancement increases the edge gradient magnitude of the lesion boundary relative to the background. Furthermore, the stability fluctuation amplitude of the response of deep features to the mucus-covered area is reduced to Within this scope, it provides an efficient and stable feature foundation for the splicing and fusion of S5.3; S5.3: The weighted multi-scale feature maps are spliced ​​and fused in the spatial dimension to generate a primary feature tensor of fused feature representation, so as to integrate key discriminative information at different scales; For the multi-scale feature matrix after weighted processing in sub-step S5.2, a spatial dimension splicing and fusion method is adopted (parameters: splicing mode is horizontal splicing within the channel, fusion order is arranged according to shallow texture → mid-level semantics → deep abstraction) to combine features of different scales into a unified structure in the spatial domain. Furthermore, a tensor rearrangement algorithm (parameters: target spatial resolution is...) is used... × (pixels) to achieve spatial alignment of feature maps at each scale, ensuring that the spatial correlation between features at each scale is not distorted after stitching; Furthermore, an overlapping region weighted fusion algorithm is adopted (parameter: weight allocation is based on response contrast index). Normalization to interval Pixel-level smooth transitions are implemented at the fusion boundary locations between scales to reduce spatial edge artifacts caused by scale differences. The fusion calculation formula is as follows:

[0029] in, For the first Scale in spatial location eigenvalues ​​at that location For fusion weights based on response contrast, For spatial location fusion feature values; Furthermore, a block-level correlation correction algorithm is adopted (parameter: correlation threshold). The consistency of cross-scale features is tested within the local block range of the spliced ​​feature tensor, and a weighted correction operation is performed on low-correlation regions to improve the consistency and discriminativeness of the fused features. Furthermore, perform a spatial normalization process (parameter: normalization interval is...). This maps the pixel values ​​of the fused tensor in the spatial dimension to a uniform scale so that the nonlinear activation function processing in the subsequent S5.4 sub-step maintains the stability of the input distribution; Through the above spatial stitching, position alignment, boundary smoothing, correlation correction and spatial normalization processing methods, the weighted and enhanced discriminative features at different scales are tightly integrated in the spatial domain to generate a primary fusion feature tensor containing key discriminative information at multiple scales and with a consistent spatial structure, thereby achieving the optimized multi-scale feature spatial integration effect. For example, at a resolution of × Under the experimental conditions of pixels, the spatial resolution of the shallow texture feature map is × The middle-layer semantic feature map is × Deep abstract feature map is × After scaling and alignment using the tensor rearrangement algorithm, all three sets of feature maps were unified to [the desired size]. × Resolution; fusion calculations were performed using response contrast normalization weights (0.85 for shallow layers, 0.73 for mid-layers, and 0.61 for deep layers), resulting in improved fusion feature values ​​at the lesion edge region compared to the highest single-scale response. The background area response change does not exceed After correlation correction, the mean cross-scale correlation was changed from... Raise to The fused feature tensor, in subsequent nonlinear activation and classification training, improves the model's recognition accuracy compared to the non-fused version in scenarios with high light fluctuations and slime coverage interference. This verifies the technical effectiveness of this sub-step in integrating discriminative information and improving robustness; S5.4: Perform nonlinear activation function processing on the fused feature tensor to introduce higher-order nonlinear relationships between features and enhance the expressive power of feature representation; S5.5: Perform global average pooling on the activated fusion feature tensor to compress the feature space dimension and extract the global feature vector, which serves as the input feature representation for the subsequent classification and recognition model.

[0030] Step S6: Input the fused feature representation vector into the classification and recognition model to perform end-to-end gastrointestinal cancer lesion classification training, and introduce an adversarial perturbation loss term during the training process to simulate lesion morphological changes. Specifically, this includes: S6.1: Input the fused feature representation vector into a lightweight convolution classifier, perform multi-layer nonlinear transformation on the fused features to extract high-dimensional abstract feature representations, and obtain preliminary classification confidence output; S6.2: Based on the preliminary classification confidence output, construct a multi-class cross-entropy loss function as the basic supervision signal for model training, and use it to optimize classifier parameters to improve the recognition accuracy of standard morphological lesions; Based on the preliminary classification confidence output, a multi-class cross-entropy loss method is used to construct the classification (parameter: number of classes). Total number of class labels from training data, batch size (where the number of samples is for each gradient update), enabling the quantification of the difference between the predicted probability distribution and the true class label into an optimizable loss metric; Furthermore, by multiplying the predicted probability vector element-wise with the one-hot encoded label vector and summing the results, the negative log-likelihood value of each sample is calculated, generating the single-sample cross-entropy loss. Furthermore, for all batches The batch-average cross-entropy loss is obtained by arithmetically averaging the single-sample cross-entropy loss for each sample. The calculation formula is as follows:

[0031] in, For the sample In category The one-hot encoded tag value (0 or 1) on it. Samples predicted by the model Category The probability value; Furthermore, by introducing Softmax normalization (parameter: temperature coefficient) during the probability calculation process... (used to smooth the probability distribution), mapping the classifier's original logit output to the 0-1 interval, ensuring that the sum of the probabilities of each class is 1; Furthermore, gradient calculation is performed on the batch average cross-entropy loss, and the gradient of the loss with respect to each parameter of the model is explicitly obtained by using the chain rule, so as to provide derivative information for subsequent backpropagation and parameter optimization. By constructing the multi-class cross-entropy loss and processing the gradient, the initial classification confidence is transformed into a measurable and optimizable supervision signal, thereby achieving precise optimization of the classifier parameters for standard morphological lesion samples and improving the model's recognition accuracy in the target category. For example, in the number of categories =3 (representing normal tissue, early lesions, and advanced gastrointestinal cancer), batch size Given that = 4, the preliminary classification confidence output matrix for a certain batch is:

[0032] The corresponding one-hot encoding matrix for the tag is:

[0033] The batch loss is obtained by taking the logarithm and negative of the predicted probability of each sample label position and then averaging the results. = The gradient generated by this loss during backpropagation is used to update the convolutional kernel weights and fully connected layer weights, improving the accuracy on the validation set from the unoptimized level. % increased to This indicates that the loss design effectively improves the classification performance of lesions with standard morphology; S6.3: During the training process, an adversarial perturbation generation algorithm based on FGSM is applied to the fused feature representation vector to simulate typical morphological variations such as lesion edge blurring, morphological stretching, and illumination distortion, thereby generating perturbation-enhanced samples. S6.4: Calculate the adversarial perturbation loss term based on the perturbation-enhanced sample. This loss term guides the model to learn a more robust discriminative feature space by maximizing the classifier's misclassification probability of the perturbation sample. S6.5: The multi-class cross-entropy loss and the adversarial perturbation loss term are weighted and summed to form a joint loss function, which is used to drive the collaborative optimization of the classification and recognition model on standard samples and perturbation samples, and improve the model's generalization ability to dynamic lesion morphological changes.

[0034] Step S7: Based on the changing trends of recognition accuracy and false positive rate on the validation set during training, dynamically adjust the weight coefficients of the adversarial perturbation loss term to optimize the model's generalization ability under unknown morphological changes. Specifically, this includes: S7.1: Periodically collect the recognition accuracy of the validation set during the training process to obtain the model recognition performance indicators at the current training stage; based on the callback mechanism provided by the deep learning training framework, regularly record the classification accuracy and misclassification rate on the validation set as the basic data for evaluating the model's generalization ability. S7.2: Perform sliding window statistical analysis on the collected trends of recognition accuracy and misjudgment rate, calculate the slope and fluctuation amplitude of the current trend; use a linear regression model to fit the trend of accuracy changes, identify whether the model is in a stage of performance improvement, stability or decline, and use this as the basis for adjusting the weight of the adversarial perturbation loss term. S7.3: Based on the performance trend of the current model training stage, construct a dynamic weight adjustment function; the input of this function is the slope of the accuracy change trend and the fluctuation range of the misclassification rate, and the output is the weight coefficient increment of the adversarial perturbation loss term. Adaptive adjustment is achieved by combining exponential decay and linear interpolation. Based on the performance trend data of the current model training phase, a dynamic weight adjustment function is used to construct the function (input parameter: slope of accuracy change trend). Fluctuation of misjudgment rate This enables the quantification of performance trends into incremental mapping relationships for the weight coefficients of the anti-disturbance loss term; Furthermore, through a normalization process (parameter: minimum value) Maximum value (Taken from historical sliding window statistics) to implement input slope With fluctuation range Interval standardization yields the normalized slope. With normalized fluctuation .

[0035] Furthermore, the exponential decay weighting method (decay factor) is used for calculation. (Taking values ​​between 0 and 1), this achieves a smooth attenuation of historical trend changes. The calculation formula is:

[0036] in, The exponential decay weighting coefficient; Furthermore, through the linear interpolation weight calculation method (interpolation parameters) (Set as a scaling factor of 0-1), within the basic weight range The internal mechanism adjusts to the fluctuation range of the false positive rate. The calculation formula is as follows:

[0037] in, These are the weighting coefficients for linear interpolation; Furthermore, through a weighted fusion method (fusion coefficient) (Using the contribution ratios of exponential decay and linear interpolation), the final weight coefficient increment is generated, calculated using the following formula:

[0038] Through the aforementioned algorithm chain, the validation set trend indicators are accurately converted into dynamic increments of the weight coefficients of the adversarial perturbation loss term, thereby achieving an adaptive balance between performance improvement and overfitting suppression in the loss function. For example, during a certain training process, the slope of the accuracy change trend is statistically obtained through sliding window analysis. = The fluctuation range of the misjudgment rate = minimum value in historical interval = maximum value = Normalizing the slope and fluctuation yields... = , = Set the exponential decay factor. = ,calculate = Set the linear interpolation parameters. = Weighting range = , = ,get = Let the fusion coefficient be... = Final calculation = This value is added to the original adversarial perturbation loss weight, and the accuracy of the validation set in the next iteration is improved by approximately [percentage missing]. The false positive rate decreased by approximately %. % S7.4: The dynamically adjusted weight coefficients of the adversarial perturbation loss term are weighted and fused with the original loss function to generate an updated composite loss function. This composite loss function includes a classification loss term, a regularization term, and a dynamically adjusted adversarial perturbation loss term, which are used to drive the gradient update of the model parameters. S7.5: Backpropagation and optimizer parameter updates are performed based on the updated composite loss function to improve the model's robustness in identifying unknown lesion morphological changes; an adaptive learning rate optimization algorithm is used to iteratively update the model parameters to ensure that the model maintains high accuracy and low false positive rate when facing morphological variations.

[0039] Step S8: During the deployment phase, based on the real-time acquired image quality context parameters, it is determined whether the current image belongs to a scenario of high illumination fluctuation, mucus coverage, or intestinal peristalsis interference, and the corresponding attention mask generation strategy is dynamically switched. Specifically, this includes: S8.1: Perform feature analysis on the image quality context parameters collected in real time during the deployment phase. The image quality context parameters include light intensity, mucus coverage, and intestinal peristalsis status to identify the typical interference scene type of the current image. S8.2: Based on the identified interference scene type, perform scene feature matching on the multi-scale enhanced image feature map, and extract local statistical features of the image that are highly related to the current interference type, including edge density, gray-level variance and structural complexity, in order to generate scene-aware feature vectors; S8.3: Input the scene-aware feature vector into the lightweight dynamic feature perception module, generate the importance weight distribution of feature channels at each scale through pre-trained learnable convolutional weights, and output a personalized attention mask candidate set that matches the current interference scene. The scene-aware feature vector is input into a lightweight dynamic feature perception module, which employs a multi-kernel one-dimensional convolutional network with a specific shape configuration (parameter: kernel size). , and (The number of channels is consistent with the dimension of the scene-aware feature vector), to achieve simultaneous capture of multi-scale local patterns, and to establish spatial correlation mapping relationships in the dimensions of edge density, gray-level variance and structural complexity; Furthermore, the numerical stability control of convolutional features is achieved by combining batch normalization with ReLU nonlinear activation (the batch normalization parameters are determined by the mean and variance of the deployed data statistics), and the responsiveness of the feature distribution to fluctuations in different scenarios is enhanced. Furthermore, a global average pooling method is used to perform dimensionality reduction along the feature sequence space dimension, compressing the response mapping of each convolutional channel into a single scalar, thereby obtaining the global description vector of the feature channels at each scale; Furthermore, based on the global description vector, a learnable channel weight mapping matrix is ​​constructed. The importance weight distribution is calculated by combining a linear transformation with the Sigmoid nonlinear activation function, and the calculation formula is as follows:

[0040] in, For channel Importance weight, These are the feature values ​​of the corresponding channels in the global description vector of the convolution. and These are the weights and bias parameters, respectively; Furthermore, Softmax normalization is performed on the obtained importance weight distribution to ensure that the sum of all channel weights is equal to the sum of all channel weights. This results in a normalized set of personalized attention mask candidates. Through the above multi-level convolution-normalization-global pooling-weight mapping chain, the input scene-aware feature vector is transformed into a multi-scale channel weight distribution that can directly adapt to the current interference scene, thereby realizing fine control of the dynamic adjustment of the multi-scale feature fusion process. For example, in a single deployment and operation, the dimension of the scene-aware feature vector is... Each is processed by a convolution kernel of size [size missing]. , and One-dimensional convolution, with each output channel having a certain number of channels. Batch normalized mean variance After global average pooling, the result is obtained. 3D channel description vector, weight mapping matrix Size is Bias vector Length is The initial channel weight range after Sigmoid activation is... After Softmax normalization, the channel with the largest weight corresponds to the lesion edge features, which are higher than the mean. The accuracy of the validation set in high-light-fluctuation scenes is improved by several times. %, the false positive rate decreased. %; S8.4: Based on the matching score between the current interference type and the attention mask candidate set, the optimal attention mask strategy is selected by the maximum correlation criterion. Among them, the enhanced edge preservation attention strategy is adopted for high-light fluctuation scene, the texture compensation attention strategy is adopted for slime coverage scene, and the standard attention mask generation strategy is adopted for other scenes. S8.5: The selected attention masking strategy is weighted and fused with the original multi-scale enhanced image feature map to generate a scene adaptive fusion feature representation vector with strong discriminative ability, so as to drive the classification and recognition model to achieve dynamic attention adjustment and recognition optimization during the deployment stage.

[0041] Step S9: If the scene is determined to be a high-light fluctuation scene, an enhanced edge-preserving attention strategy is adopted; if the scene is determined to be a slime-covered scene, a texture-compensated attention strategy is adopted; otherwise, a standard attention mask generation strategy is adopted. Specifically, this includes: S9.1: Based on the image quality context parameters collected in real time during the deployment phase, threshold judgments are made on the light intensity, mucus coverage, and intestinal peristalsis status of the current image to identify whether the image belongs to a high light fluctuation, mucus coverage, or intestinal peristalsis interference scenario. S9.2: If the scene is determined to be a high-light-fluctuation scene, an enhanced attention weight allocation strategy is executed on the edge-preserving channel in the multi-scale enhanced image feature map. The local response normalization algorithm based on edge density gradient weighting is used to generate an enhanced edge-preserving attention mask to improve the model’s sensitivity to lesion edges under light changes. S9.3: If the scene is determined to be covered by mucus, a texture compensation attention weight allocation strategy is executed on the middle semantic feature channel. An attention mechanism based on the joint optimization of local gray-level variance and texture entropy is adopted to generate a texture compensation attention mask to enhance the model's ability to identify the real lesion area under mucus occlusion. S9.4: If the above two scenario judgment conditions are not met, the standard attention weight allocation strategy is executed on the original multi-scale feature map, and the SE module based on the channel attention mechanism is used to generate a standard attention mask in order to maintain the stable recognition performance of the model under normal image quality. S9.5: The generated attention mask is fused with the multi-scale enhanced image feature map of the corresponding scene through channel-wise weighted fusion to generate a scene-adaptive fusion feature representation vector, which is used as the input of the classification and recognition model to improve the recognition accuracy and robustness of the model in complex clinical environments.

[0042] Step S10: Periodically collect the recognition results and doctor feedback annotation data after model deployment, construct an incremental training dataset, and regularly update the classification and recognition model parameters to continuously improve the model's adaptability to dynamic lesion morphological changes. Specifically, this includes: S10.1: Periodically collect the gastrointestinal cancer lesion classification and identification results output during the deployment phase, and obtain output data including identification category, confidence score and corresponding original image feature vector to construct model behavior log; S10.2: Based on the original image feature vectors in the model behavior log, the credibility assessment of the classification results is performed in combination with the image quality context parameters. The consistency index between the recognition results and the doctor's annotations is calculated using a Bayesian probability model to generate a feedback annotation sample set. S10.3: Classify the high-confidence samples in the feedback labeled sample set according to the time window partitioning strategy to generate an incremental training dataset, and perform data augmentation operations on the samples in the dataset, including affine transformation, illumination perturbation simulation and edge perturbation injection, to improve sample diversity. S10.4: Fine-tuning training of the classification and recognition model is performed based on the incremental training dataset. The model parameters are updated incrementally using an elastic weight merging strategy. While retaining the original classification ability, the ability to recognize new lesion morphologies is enhanced to generate an updated classification model. S10.5: Perform performance verification on the updated classification model before online deployment. Based on the trend of misclassification rate changes and model robustness indicators in the validation set, dynamically adjust the model update frequency and sample weight allocation strategy for incremental training to optimize the model's generalization performance under unknown lesion morphological changes.

[0043] The technical solution of the present invention has been described above with reference to the preferred embodiments shown in the accompanying drawings. However, it will be readily understood by those skilled in the art that the scope of protection of the present invention is obviously not limited to these specific embodiments. Without departing from the principles of the present invention, those skilled in the art can make equivalent changes or substitutions to the relevant technical features, and the technical solutions after these changes or substitutions will all fall within the scope of protection of the present invention.

[0044] The above description is merely a preferred embodiment of the present invention and is not intended to limit the invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and rules of the present invention should be included within the scope of protection of the present invention.< / w> < / w>

Claims

1. A method for recognizing gastrointestinal cancer lesions based on a multi-scale image enhancement algorithm, characterized in that, Includes the following steps: S1: Acquire raw image data from gastrointestinal endoscopy and record the light intensity, mucus coverage, and intestinal peristalsis status during image acquisition as image quality context parameters; S2: Perform multi-scale image enhancement processing on the original image to generate an enhanced image feature map; S3: Based on the enhanced image feature map, calculate the local image statistical features and generate the local image feature vector; S4: Input the local feature vector of the image into the lightweight dynamic feature perception module, generate the importance weight distribution of feature channels at each scale through learnable convolution weights, and output a personalized attention mask. S5: The personalized attention mask is weighted and fused with the original multi-scale enhanced image feature map to generate a fused feature representation vector; S6: Input the fused feature representation vector into the classification and recognition model, perform end-to-end gastrointestinal cancer lesion classification training, and introduce an adversarial perturbation loss term to simulate lesion morphological changes during the training process; S7: Based on the changing trends of recognition accuracy and misclassification rate of the validation set during training, dynamically adjust the weight coefficient of the adversarial perturbation loss term; S8: During the deployment phase, based on the real-time acquired image quality context parameters, determine whether the current image belongs to a high-light fluctuation, mucus coverage, or intestinal peristalsis interference scenario, and dynamically switch the corresponding attention mask generation strategy.

2. The method for assessing the quality of engineering data based on privacy computing according to claim 1, characterized in that, Following step S8, the following is also included: S9: If the scene is determined to be a high-light fluctuation scene, an enhanced edge-preserving attention strategy is adopted; if the scene is determined to be a slime-covered scene, a texture-compensated attention strategy is adopted; otherwise, a standard attention mask generation strategy is adopted. S10: Periodically collect the recognition results and doctor feedback labeled data after the model is deployed, build an incremental training dataset, and regularly update the classification and recognition model parameters.

3. The method for recognizing gastrointestinal cancer lesions based on a multi-scale image enhancement algorithm according to claim 1, characterized in that, Step S1 specifically includes: The raw image signals output by the gastrointestinal endoscope acquisition device are processed by frame synchronization acquisition to obtain image data frames containing the complete lesion area; Based on the metadata interface of the image acquisition device, obtain the illumination intensity parameters that are synchronously recorded with the original image; The degree of mucus coverage is obtained by using the mucus detection sensor built into the image acquisition device. An image sequence inter-frame motion vector analysis algorithm is used to estimate motion in continuously acquired image sequences and extract intestinal peristalsis state parameters. The light intensity parameter, the mucus coverage parameter, and the intestinal peristalsis state parameter are normalized and fused to generate an image quality context parameter vector.

4. The method for recognizing gastrointestinal cancer lesions based on a multi-scale image enhancement algorithm according to claim 3, characterized in that, In step S1, the illumination intensity parameter includes the light source output intensity value and white balance adjustment parameter at the time of image acquisition. The light source output intensity value is calculated by the image acquisition device metadata interface based on the normalized sampled ADC value. The white balance adjustment parameter is normalized by the gain coefficient of each channel. The illumination intensity parameter, along with the mucus coverage parameter and intestinal peristalsis parameter, are normalized and spliced ​​together to form an image quality context parameter vector.

5. The method for recognizing gastrointestinal cancer lesions based on a multi-scale image enhancement algorithm according to claim 1, characterized in that, Step S2 specifically includes: Multi-scale Gaussian filtering was performed on the original gastrointestinal images to extract local contrast and edge information at different scales, resulting in a multi-scale edge response image set. Based on the multi-scale edge response image set, the Laplacian pyramid decomposition method is used to perform image structure layering, separating the shallow texture features and the middle structure features in the image to generate a multi-scale image pyramid representation. Local histogram equalization is performed on each layer of the multi-scale image pyramid representation to enhance the ability of the image to express local details at different scales and obtain an enhanced multi-scale texture feature map. Based on the enhanced multi-scale texture feature map, a semantic segmentation network model is used to extract mid-level semantic features, identify tissue structures and potential lesion areas in the image, and generate a mid-level semantic feature map. The mid-level semantic feature map is subjected to deep convolution feature extraction processing to obtain a high-level abstract feature representation with strong discriminative ability, thereby generating a deep abstract feature map; The shallow texture feature map, the mid-level semantic feature map, and the deep abstract feature map are scale-aligned and normalized to generate a standardized multi-scale enhanced image feature map set.

6. The method for recognizing gastrointestinal cancer lesions based on a multi-scale image enhancement algorithm according to claim 5, characterized in that, In step S2, the original gastrointestinal endoscopic image is processed by multiple Gaussian filters with different standard deviations to extract multi-scale edge responses, and edge features are calculated by the differential Gaussian algorithm and the normalized gradient magnitude. After noise suppression, Laplacian pyramid decomposition is used to separate multi-level structural features, and local histogram equalization is performed on each layer to obtain shallow texture feature maps and enhanced mid-level structural feature maps.

7. The method for recognizing gastrointestinal cancer lesions based on a multi-scale image enhancement algorithm according to claim 1, characterized in that, Step S3 specifically includes: After multi-scale image enhancement processing, three sets of enhanced image feature maps are generated. Edge detection algorithms are then applied to each set to extract edge distribution information at each scale and obtain edge density feature maps. Based on the edge density feature map, the ratio of the number of edge pixels to the area of ​​the region is calculated to generate an edge density statistical vector. Perform gray-level variance calculation on local image blocks in the feature maps of enhanced images at each scale to obtain gray-level variance statistical vectors; Based on the gray-level variance statistical vector and the edge density statistical vector, the structural complexity of local image patches is calculated using a structural similarity measurement algorithm to generate a structural complexity feature vector. The edge density statistical vector, the gray-level variance statistical vector, and the structural complexity feature vector are concatenated to generate a unified-dimensional local image feature vector.

8. The method for recognizing gastrointestinal cancer lesions based on a multi-scale image enhancement algorithm according to claim 1, characterized in that, Step S4 specifically includes: Channel normalization is performed on the local feature vectors of the image to obtain standardized local feature vectors of the image; Based on the standardized local feature vectors of the image, local feature maps are extracted using a lightweight one-dimensional convolutional network; A global average pooling operation is performed on the local feature map to generate preliminary activation response values ​​for each scale feature channel; Based on the initial activation response value, linear transformation and nonlinear activation are performed through a learnable channel attention weight matrix to generate the importance weight distribution of feature channels at each scale. The importance weight distribution is subjected to Softmax normalization to generate a personalized attention mask.

9. A method for recognizing gastrointestinal cancer lesions based on a multi-scale image enhancement algorithm according to claim 1, characterized in that, Step S5 specifically includes: The shallow texture features, mid-level semantic features and deep abstract features in the original multi-scale enhanced image feature map are aligned by channel dimension to generate an aligned multi-scale enhanced image feature map. Based on the importance weight distribution of feature channels at each scale in the personalized attention mask, a channel-wise weighting operation is performed on the aligned multi-scale enhanced image feature map. The weighted multi-scale feature maps are spliced ​​and fused in the spatial dimension to generate a primary feature tensor of fused feature representation; The primary feature tensor is processed by a nonlinear activation function to generate an activated fused feature tensor; A global average pooling operation is performed on the activated fusion feature tensor to compress the feature space dimension and extract the global feature vector, thereby generating a fusion feature representation vector.

10. A method for recognizing gastrointestinal cancer lesions based on a multi-scale image enhancement algorithm according to claim 1, characterized in that, In step S6, the fused feature representation vector is used for multi-layer nonlinear transformation of the convolution classifier to obtain the preliminary classification confidence output. The classification parameters are jointly optimized by the cross-entropy loss with the real label and the adversarial perturbation loss generated based on FGSM, and multi-class classification is performed using the Softmax probability output.