Intestinal disease auxiliary diagnosis method based on non-local module and attention mechanism

This paper proposes an auxiliary diagnostic method for intestinal diseases by introducing nonlocal modules and attention mechanisms. It utilizes the ResNet baseline model and nonlocal modules to extract subtle features, and focuses on the lesion area through the attention module. This solves the problems of insufficient accuracy and generalization ability of intestinal disease image recognition in existing technologies, and achieves higher classification accuracy and diagnostic efficiency.

CN115249540BActive Publication Date: 2026-01-20ZHEJIANG UNIV OF TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210693998.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-19
Publication Date
2026-01-20
Estimated Expiration
2042-06-19

AI Technical Summary

Technical Problem

In existing technologies, convolutional neural networks cannot fully extract the subtle local features of lesion areas in endoscopic images, resulting in insufficient accuracy and generalization ability in intestinal disease image recognition and classification tasks. In particular, when the difference between the lesion edge and the normal tissue wall is limited and the similarity between lesion classes is high, misdiagnosis and missed diagnosis are more common.

Method used

We employ an auxiliary diagnostic method for intestinal diseases based on nonlocal modules and attention mechanisms. We utilize a ResNet baseline model combined with nonlocal modules and attention modules. The nonlocal modules extract subtle features, while the attention modules focus on lesion areas. End-to-end training is performed by combining loss functions of the perception branch and the attention branch to improve classification performance.

Benefits of technology

It effectively overcomes the problem of limited difference between the edge of the lesion and the normal tissue wall, improves the classification accuracy and recognition rate of intestinal diseases, reduces the possibility of misdiagnosis and missed diagnosis, and improves the diagnostic efficiency of intestinal diseases.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115249540B_ABST
    Figure CN115249540B_ABST
Patent Text Reader

Abstract

The present application relates to a kind of intestinal disease auxiliary diagnosis methods based on non-local block depth residual and attention mechanism, neural network is established after pre-processing dataset;Neural network uses ResNet baseline model as backbone network, for feature extraction, cooperate backbone network embedding non-local module, cooperate backbone network output end and set attention module;With the pre-processed dataset, neural network is trained until neural network is stable;Stable neural network is input to the image to be diagnosed, and intestinal disease is assisted in diagnosis.The backbone network of the present application uses the first four layers of the ResNet baseline model embedded in the non-local module to extract the lesion area features, overcoming the problem of large intra-class lesion size and shape differences;Focus on the lesion area using the attention branch structure;The network is trained in an end-to-end manner using the sum of the loss functions of the attention branch and the perception branch, further improving the classification performance of intestinal lesions.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of image data processing or generation in general, in particular to an auxiliary diagnosis method for intestinal diseases based on a non-local module and an attention mechanism in the technical field of medical image processing. BACKGROUND

[0002] Intestinal diseases are one of the most common diseases, and according to statistics, malignant colorectal cancer causes hundreds of thousands of deaths every year. It is found in clinical practice that due to the low early screening rate and the insignificant early features, most colorectal cancer patients are in the middle and late stages when they seek medical treatment, thus missing the best time for treatment. Therefore, early diagnosis and early treatment for colorectal cancer patients can help improve the survival rate of colorectal cancer patients.

[0003] Intestinal polyps, ulcers, inflammation, etc. are the main risk factors for early intestinal cancer, and intestinal endoscopy is the most effective way to prevent and treat colon cancer. In clinical practice, colonoscopy requires a high level of skill from doctors, and the quality of the examination results is related to the experience and attention of the doctors, and the operation is difficult and prone to misdiagnosis or missed diagnosis. In order to improve the accuracy and diagnostic efficiency of intestinal endoscopy, many methods for auxiliary diagnosis of intestinal diseases have been proposed by researchers at home and abroad.

[0004] At present, in the classification method of endoscopic images, one category is the traditional machine learning classification method based on image feature extraction, including:

[0005] According to the image segmentation method, the set features of the segmented region are extracted, and a support vector machine or other classification method is combined to realize lesion recognition;

[0006] By extracting the color and texture features of the image, polyp recognition is realized;

[0007] By combining scale-invariant feature transform method and K-means clustering, saliency map and histogram method, the comprehensive features of the image are obtained, and image classification is realized;

[0008] This kind of method is greatly affected by subjective factors, and valuable information is easily missed, and the generalization ability is poor, and the applicability is low;

[0009] Another method is to use a deep learning classification method, and a convolutional neural network (CNN) is one of the commonly used learning models in this method, which automatically extracts features and classifies them. The learned features are more representative of the intrinsic information of the data and have strong generalization ability, and have a higher recognition rate. However, although the deep convolutional neural network proposed for image classification and recognition tasks can obtain good performance, these methods mostly fail to extract the subtle features of the local lesion area of the endoscopic image. Since the inter-class difference between the lesion edge and the normal tissue wall in the intestinal tract is limited, the color and texture features are not obvious enough, and the size and shape of the polyp are different, and the lesion inter-class similarity is large. Therefore, the recognition and classification task of the intestinal disease image is still extremely challenging. SUMMARY

[0010] The present application solves the problems in the prior art and provides an optimized intestinal disease auxiliary diagnosis method based on a non-local module and an attention mechanism, which overcomes the problem that the convolutional neural network in the prior art cannot completely extract the local subtle features of the lesion area of the endoscopic image. For the case where the difference between the lesion edge and the normal tissue wall is limited and the lesion inter-class similarity is large, better classification and diagnosis are achieved.

[0011] The technical scheme adopted by the present application is an intestinal disease auxiliary diagnosis method based on a non-local module and an attention mechanism. After preprocessing the data set, a neural network is established;

[0012] The neural network uses a ResNet baseline model as the backbone network for feature extraction, embeds a non-local module with the backbone network, and sets an attention module at the output end of the backbone network.

[0013] The neural network is trained with the preprocessed data set until the neural network is stable.

[0014] The stable neural network is input with an image to be diagnosed to assist in diagnosing intestinal diseases.

[0015] Preferably, the data set is an image data set, and the preprocessing is to organize and label the data set.

[0016] Preferably, the data set X = {x1, x2, …, xn}, wherein n is the total number of samples, x n is a feature vector composed of three channel pixel values of the input image, i corresponding to any x i , the output sample class label y i , the sample i is (x i , y i ) ;

[0017] The class label y i ​The value of 0 represents normal, the value of 1 represents polyp lesions, and the value of 2 represents ulcer lesions.

[0018] Preferably, the backbone network is a normalized ResNet baseline model, and the input data is normalized by a BatchNorm normalization layer, and then the data is scaled and translated; the output of the i-th node of the b-th layer is calculated by formula (1),

[0019]

[0020] Wherein, is the value of the i-th node of the b-th layer input, x i is is a row vector, μ and σ are the mean and standard deviation of the row respectively, γ is the scaling parameter, β is the translation parameter, ε is the correction term to prevent division by zero, and BN is the BatchNorm normalization.

[0021] Preferably, when the non-local module is embedded with the backbone network, the weighted sum of the features of each position and all the associated feature positions is calculated, and formula (2) is used to calculate,

[0022]

[0023] Wherein, is the input feature map, i and j are the pixel position indexes in the feature map, i.e., X i , X j represent the i-th and j-th rows of feature pixels respectively, f(·) is an affinity kernel with finite F-norm, g(·) represents a linear embedding, defined as g(X j )=X j W Z , C1 and C' are the channel numbers of the input features and the transmitted features respectively; N is the total number of positions of each element;

[0024] Y i is calculated by formula (3), and Y

[0025] Y i =X i +F(X i )W (3)

[0026] Wherein, is a weight matrix.

[0027] Preferably, the matrix form of the non-local operator is introduced, and

[0028] Y=X+F(X)W=X+AZW S1 W S2 (4)

[0029]

[0030] Where A is the affinity matrix, M = [M ij D is composed of pairwise similarities between pixels. M It is a diagonal matrix containing M vertices. Through with A linear transformation is performed to compress the channel transitive feature map of X. and Two parameter matrices are used to filter out discriminative features and recover the number of channels, respectively.

[0031] get,

[0032] Y = X + F(A, Z, W) S1 W S2 =X+F(A,Z,g θ W S2 (6)

[0033] Where F(A,Z,gθ) is the nonlocal operator in the spectral view, with g θ W S1 It is decomposed into a set of graphical filters; abbreviated as F(A,Z).

[0034] Preferably, the symmetry of equation (6) is adjusted using a symmetric affinity matrix according to equation (7).

[0035] Y = X + F R (A,Z)=X+ZW1+AZW2,

[0036]

[0037] Among them, F R (A,Z) is the nonlocal block operator, W1 and W2 are two parameter matrices, where A represents the symmetric affinity matrix, and M = [M ij It is still composed of paired similarities between pixels.

[0038] Preferably, the attention module is as shown in equation (8).

[0039]

[0040] Where, μ B and σ B γ and β are the mean and standard deviation of the preset batch B, and γ and β are trainable affine transformation parameters.

[0041] The output feature M is obtained using equation (9). C ,

[0042] MC = sigmoid(W γ (BN(F1))) (9)

[0043] wherein γ is a scale factor for each channel, and the weight is W γ = γ i ∑ j=0 γ i , and the output class probability score Prob.score after the Sigmoid activation function.

[0044] Preferably, a regularization term is added in the loss function as formula (10),

[0045]

[0046] wherein f(x,W) represents the calculated prediction result, x represents the input, y represents the output, W is the network weight, l(·) is the loss function, g(·) is the L1 norm penalty function, and p is the coefficient for balancing the penalty function, p∈(0,1).

[0047] Preferably, the L att (x i ) represents the attention branch loss when the input sample is x i , the L per (xi) represents the perception branch loss when the input sample is x i , and the total loss function L(xi) is represented as formula (11),

[0048] L = L att (x i ) + L per (x i ) (11)

[0049] The accuracy Accuracy is calculated as formula (12), the sensitivity Sensitivity is calculated as formula (13), and the specificity Specificity is calculated as formula (14) for evaluating the performance of the model until the optimal is obtained,

[0050]

[0051]

[0052]

[0053] wherein TP, TN, FP, and FN represent the number of true positives, true negatives, false positives, and false negatives, respectively.

[0054] The application relates to an optimized intestinal disease auxiliary diagnosis method based on a non-local block depth residual and an attention mechanism, wherein after a data set is preprocessed, a neural network is established; the neural network takes a ResNet baseline model as a backbone network for feature extraction, embeds a non-local module in cooperation with the backbone network, and sets an attention module at an output end of the backbone network; the neural network is trained with the preprocessed data set until the neural network is stable; and an image to be diagnosed is input into the stable neural network to assist in diagnosing intestinal diseases.

[0055] The application has the following beneficial effects:

[0056] (1) The first four layers of the ResNet baseline model embedded with the non-local module are used in the backbone network to extract lesion region features, thereby overcoming the problem of large differences in lesion size and shape within the same class;

[0057] (2) The attention branch structure is used to focus on the lesion region;

[0058] (3) The sum of the loss functions of the attention branch and the perception branch is used to train the network in an end-to-end manner, thereby further improving the classification performance of intestinal lesions. BRIEF DESCRIPTION OF DRAWINGS

[0059] Figure 1 is a whole flowchart of the application;

[0060] Figure 2 is a structure diagram of a bottleneck residual block in the feature extractor of the application;

[0061] Figure 3 is a structure diagram of a non-local module embedded in the feature extractor of the application;

[0062] Figure 4 is a structure diagram of the attention branch of the application. DETAILED DESCRIPTION

[0063] The application will be further described in detail in combination with the embodiments below, but the protection scope of the application is not limited thereto.

[0064] The application relates to an intestinal disease auxiliary diagnosis method based on a non-local module and an attention mechanism, and the neural network for auxiliary diagnosis is composed of a feature extractor, an attention branch and a perception branch; wherein the feature extractor contains multiple convolution layers, extracts features from an input image and outputs feature maps, the attention branch processes the feature maps output by the feature extractor, and the perception branch outputs the probability of each class by receiving the feature maps output from the attention branch.

[0065] After preprocessing a data set, the neural network is established;

[0066] The neural network takes a ResNet baseline model as a backbone network for feature extraction, embeds a non-local module with the backbone network, and sets an attention module at the output end of the backbone network;

[0067] The neural network is trained with the preprocessed data set until the neural network is stable;

[0068] The stable neural network is inputted with the image to be diagnosed to assist in diagnosing intestinal diseases.

[0069] In the present application, the backbone network is based on a ResNet baseline model embedded with a non-local block, the first four layers of which are feature extractors for fine feature extraction, including a 7*7 convolution layer, a BatchNorm normalization layer, a Relu function layer and a maximum pooling layer, thereby overcoming the problem of large intra-class lesion size and shape difference, and starting from the fifth layer, two layers of standard Bottleneck residual blocks of ResNet and one layer of Bottleneck embedded with a non-local module are connected in series, and finally an attention module is set at the output end, that is, divided into an attention branch and a perception branch, wherein the introduced attention branch structure is used to focus on the lesion area, and the problem of blurred boundary between the edges of various lesions and normal tissues is alleviated, and for the problem of large inter-class similarity of various benign lesions, the sum of the loss functions of the attention branch and the perception branch is used for end-to-end training, thereby further improving the classification performance of intestinal diseases.

[0070] In the present application, part of the pictures are selected from the HyperKvasir public data set to make an intestinal disease classification data set, which contains 1000 images of each of normal, polyp and ulcer, and each type of image is randomly divided into a training set, a validation set and a test set according to a ratio of 3:1:1, thereby obtaining a training set of 1800 images, a validation set of 600 images and a test set of 600 images;

[0071] The image size is adjusted to 256*256 pixels, in order to enhance the robustness and stability of the model, the images in the training set are randomly cropped to images with a resolution of 224*224, and the images in the validation set and the test set are center-cropped to images with a resolution of 224*224, in order to solve the problem of insufficient data set, the method of transfer learning is introduced, the parameters of the trained ResNet network model are transferred to the new model, and the new model is better trained.

[0072] The data set is an image data set, and the preprocessing is to arrange and label the data set.

[0073] The data set X={x1, x2, …, xn} is obtained, wherein n is the total number of samples, x n} is obtained, wherein n is the total number of samples, x ia feature vector composed of three channel pixel values of an input image, Generally, Corresponding to any x i Output sample category label y i , sample i is (x i , y i );

[0074] The value of the category label y i is 0 for normal, 1 for polyp lesions, and 2 for ulcer lesions.

[0075] In the present application, after the network trains a classification model, the feature vector x i is input, and the result is predicted to determine whether the endoscopic image is normal, polyp or ulcer; the network structure is as shown in Figure 1 .

[0076] The main network is a normalized ResNet baseline model, which normalizes the input data with a BatchNorm normalization layer, and then scales and translates the data; the output of the bth layer and the ith node is calculated by formula (1),

[0077]

[0078] Among them, is the value of the bth layer and the ith node of the input, x i is a row vector composed of , μ and σ are the mean and standard deviation of the row respectively, γ is the scaling parameter, β is the translation parameter, ε is the correction term to prevent division by zero, and BN is the BatchNorm normalization.

[0079] When the non-local module is embedded with the main network, the weighted sum of the features of each position and all associated feature positions is calculated, which is calculated by formula (2),

[0080]

[0081] Among them, is the input feature map, i and j are the pixel position indexes in the feature map, that is, X i , X j represent the i, j row feature pixels respectively, f(·) is an affinity kernel with finite F-norm, g(·) represents a linear embedding, defined as g(X j )=X j W Z , C1 and C' are the channel numbers of the input features and the transmitted features respectively; N is the total position of each element;

[0082] Y is calculated in formula (3) i , represents the output feature pixel of the i-th row,

[0083] Y i = X i +F(X i )W (3)

[0084] wherein, is a weight matrix.

[0085] In the application, a normalized ResNet baseline model is used as a backbone network for a feature extractor to extract features from an input image and output a feature map, and the last three layers of the feature extractor are respectively composed of two standard bottleneck residual blocks of ResNet and one bottleneck with an embedded non-local module in series.

[0086] In the application, the residual branch is suppressed when the backbone network is initialized, and the BatchNorm normalization layer (BN layer) is used to eliminate the mean deviation, so that the model is no longer sensitive to weight scale and weight initialization, and overfitting is reduced; specifically, first, normalize each dimension of the input data to transform the input data into data with a mean of 0 and a variance of 1, reducing the bias of the data distribution; then, the data is scaled (γ) and translated (β), and after scaling and translation, γ and β are learnable parameters, initially set γ=1 and β=0, and adjusted to appropriate values through learning during network training. The network can independently think whether the normalization operation has played an optimization role, and decide whether to offset part of the normalization by adjusting the γ and β parameters. The ε in formula (1) is a small amount introduced to prevent division by zero, which can be ignored.

[0087] In the application, the associated feature position refers to the position with the same or similar features as the features of each position, which can be set by the technician.

[0088] The matrix form of the non-local operator is introduced, and

[0089] Y=X+F(X)W=X+AZW S1 W S2 (4)

[0090]

[0091] wherein, A is an affinity matrix, M=[M ij ] is composed of pairwise similarities between pixels, D M is a diagonal matrix containing M vertices, is a channel transfer feature mapping that compresses X by linear transformation with , and Two parameter matrices are used to filter out discriminative features and recover the number of channels, respectively.

[0092] get,

[0093] Y = X + F(A, Z, W) S1 W S2 =X+F(A,Z,g θ W S2 (6)

[0094] Where F(A,Z,gθ) is the nonlocal operator in the spectral view, with g θ W S1 It is decomposed into a set of graphical filters; abbreviated as F(A,Z).

[0095] Adjust the symmetry of equation (6) using the symmetric affinity matrix according to equation (7).

[0096] Y = X + F R (A,Z)=X+ZW1+AZW2,

[0097]

[0098] Among them, F R (A,Z) is the nonlocal block operator, W1 and W2 are two parameter matrices, where A represents the symmetric affinity matrix, and M = [M ij It is still composed of paired similarities between pixels.

[0099] In this invention, nonlocal modules are embedded in the backbone network, and when inserting the nonlocal modules into the network structure, the weight matrix is ​​increased as follows: Linear transformations and residual connections.

[0100] In this invention, the theory of “spectral view” is added to the nonlocal block. Based on Chebyshev filtering, it has a stronger theoretical foundation and robustness. However, since the existing nonlocal block does not guarantee symmetry, the result is not an approximate complete form. Therefore, symmetric affinity matrix is ​​used to process equation (6).

[0101] In this invention, non-local modules such as Figure 3 As shown, the nonlocal module is embedded into the last layer of the feature extractor, Bottleneck, to become a new layer. The mechanism of improving the nonlocal block is improved by aggregating feature maps. A fully connected graph is constructed based on the input features to include the similarity between different locations. Then, the output is generated by directly filtering the features using a learnable graph filter. In this structure, long-range information can be maintained by the affinity of the structure, and more flexibility is provided in capturing long-range dependencies through graph filtering.

[0102] The attention module is shown as formula (8),

[0103]

[0104] Wherein, mu B And sigma B Are the average and standard deviation of the preset batch B, and gamma and beta are trainable affine transformation parameters,

[0105] The output feature M C is obtained in formula (9),

[0106] M C = sigmoid (W γ (BN (F1)) (9)

[0107] Wherein, gamma is a scaling factor for each channel, and the weight is W γ = gamma i / sum j=0 Gamma i , and the output class probability score Prob.score is obtained after Sigmoid activation function.

[0108] A regularization term is added in the loss function in formula (10),

[0109]

[0110] Wherein, f(x,W) represents the calculated prediction result, x represents the input, y represents the output, W is the network weight, l(·) is the loss function, g(·) is the L1 norm penalty function, and p is the coefficient of balancing the penalty function, p is in (0,1).

[0111] In the present application, in the used data set, because the lesion edge in the intestinal image and the normal tissue wall boundary are blurred, an attention branch is selected to focus on the lesion area, and the less significant weights in the model are suppressed, and the residual block is constructed using BatchNorm normalization in the convolution layer, the stride of the first 3*3 convolution layer is set to 1, so that the resolution of the feature map is maintained, by introducing the attention branch, the network is trained while focusing on the important position of the image, and the classification performance is improved.

[0112] In the present application, as Figure 4 The attention module is a channel attention module, which is embedded at the end of each network block, and for ResNet, it is embedded at the end of the residual structure.

[0113] In the present application, in order to suppress the less significant weights, a regularization term is added in the loss function.

[0114] The L att (x i) represents the attention branch loss when the input sample is x i ) represents the perception branch loss when the input sample is x per (x i ) represents the perception branch loss when the input sample is x i ) represents the perception branch loss when the input sample is x i ) is represented as formula (11),

[0115] L = L att (x i ) + L per (x i ) (11)

[0116] The accuracy Accuracy is calculated by formula (12), the sensitivity Sensitivity is calculated by formula (13), and the specificity Specificity is calculated by formula (14), which are used to evaluate the performance of the model until the optimal model is obtained,

[0117]

[0118]

[0119]

[0120] Wherein, TP, TN, FP and FN represent the number of true positives, true negatives, false positives and false negatives, respectively.

[0121] In the present application, the sum of the losses of the attention branch and the perception branch L is used as the training loss, and the training loss of each branch is calculated by combining the Softmax function and the cross entropy.

[0122] In the present application, during training, a 224x224 intestinal image is input into a feature extractor, the parameters are optimized using an Adam optimizer, the learning rate is adjusted using a StepLR mechanism, and the network is trained end-to-end combined with a loss function to obtain an optimal model. The optimal model is then input into a test set image for testing, and the accuracy Accuracy, sensitivity Sensitivity and specificity Specificity are used to evaluate the performance of the optimal model.

[0123] In order to achieve the above-mentioned content, the present application also relates to a computer readable storage medium having a non-local module and attention mechanism based intestinal disease auxiliary diagnosis program stored thereon, which is executed by a processor to realize the above-mentioned non-local module and attention mechanism based intestinal disease auxiliary diagnosis method, thereby solving the problems existing in the prior art.

[0124] In order to achieve the above, the application further provides a computer device, comprising a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the above-mentioned auxiliary diagnosis method for intestinal diseases based on a non-local module and an attention mechanism when executing the program.

[0125] Those skilled in the art will understand that embodiments of the application can be provided as methods, systems or computer program products. Therefore, the application can take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Moreover, the application can take the form of a computer program product implemented on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0126] The effects of the application can be further illustrated by simulation experiments.

[0127] (1) Simulation conditions

[0128] The experiment uses a workstation configured with Intel(R) Xeon(R) Silver 4210R CPU@2.40GHz 2.39GHz (2 processors), 64GB memory, Windows 10 operating system and 3 NVIDIA GeForce RTX 2080 SUPER graphics cards, Cuda version is 10.0, model is based on PyTorch deep learning framework, PyTorch version is 1.6.0+cu101, Python version is 3.7. The Batch-size of the training process is set to 32, the Adam algorithm is used to optimize the overall parameters, the learning rate is set to 0.0001, and the StepLR mechanism is used to adjust the learning rate, and the model converges after 100 epochs of training.

[0129] (2) Simulation results

[0130] The method proposed in the application is compared with the classical ResNet network on the same data set. The accuracy, sensitivity and specificity commonly used in image classification are used to evaluate the model;

[0131]

[0132] As can be seen from the above table, the method of the application has better effect than ResNet, which improves the classification performance well and can be better applied to the auxiliary diagnosis of intestinal lesions, and has better practical engineering application value.

[0133] The embodiments of the present specification are merely illustrative of the implementation forms of the inventive concept, and are only used for the purpose of description. The protection scope of the present application should not be regarded as being limited to the specific forms shown in the embodiments, and the protection scope of the present application also includes the equivalent technical means that can be thought of by those skilled in the art according to the inventive concept.

Claims

1. A method for auxiliary diagnosis of intestinal diseases based on non-local module and attention mechanism, characterized in that: The method comprises the following steps: preprocessing a data set, and establishing a neural network after preprocessing the data set; The neural network takes a ResNet baseline model as a backbone network for feature extraction, embeds a non-local module in cooperation with the backbone network, and sets an attention module at an output end of the backbone network; The backbone network is a normalized ResNet baseline model, which normalizes input data through a BatchNorm normalization layer, and then performs scaling and translation operations on the data; The output of the layer is computed as layer the output of the node, (1) in, For the input of the first Layer The value of each node, for The row vectors formed and These are the mean and standard deviation of the row, respectively. For scaling parameters, For translation parameters, To prevent the correction term introduced by division by zero, BN is normalized using BatchNorm. When the non-local module is embedded in cooperation with the backbone network, the weighted sum of each position feature and all paired features with associated positions is calculated, and the calculation is performed according to formula (2), (2) wherein, is the input feature map, is the pixel position index in the feature map image, i.e. , respectively represent the first row feature pixels, is an affinity kernel with finite F-norm, denotes a linear embedding defined as , , and are the number of channels of the input feature and the transferred feature, respectively; N is the total position of each element. is calculated as formula (3) , indicates the output characteristic pixel of the row, (3) wherein, is a weight matrix; The matrix form of the non-local operator is introduced, and formula (3) is obtained, (4) (5) wherein, is an affinity matrix, consists of pairwise similarities between pixels, is a diagonal matrix containing M vertices, is a channel passing feature map that compresses by a linear transformation with and and are two parameter matrices for filtering discriminative features and restoring channel numbers, respectively; Formula (4) is obtained, (6) wherein, is a non-local operator in the spectral view to g θ W S1 is decomposed into a set of image filters; abbreviated as ; Formula (6) is adjusted for symmetry according to formula (7) by using a symmetric affinity matrix, , (7) wherein, is the non-local operator, , are two parameter matrices, where denotes a symmetric affinity matrix, while is still composed of pairwise similarities between pixels; The neural network is trained until the neural network is stable by using the preprocessed data set; The stable neural network is input with an image to be diagnosed, and the intestinal disease is assisted in diagnosis.

2. The method of claim 1, wherein the method is characterized by: The data set is an image data set, and the preprocessing is arranging and labeling the data set.

3. The method of claim 1 or 2, wherein the method is based on a non-local module and an attention mechanism. The dataset wherein, is the total number of samples, x i is a feature vector consisting of three channel pixel values of the input image, ; for any x i output sample class label , sample is ; By category label A value of 0 indicates normal, a value of 1 indicates a polyp lesion, and a value of 2 indicates an ulcer lesion.

4. The method of claim 1, wherein the method is characterized by: The attention module is shown in formula (8), (8) wherein, and are the mean and standard deviation of a preset batch of and are trainable affine transformation parameters, obtaining output features in the form of equation (9) , (9) wherein, is a scaling factor for each channel, and the weights are , and the output class probability score Prob. score after the Sigmoid activation function.

5. The method of claim 4, wherein the method is characterized by: A regularization term is added in the loss function according to formula (10), (10) wherein, represents a computed prediction, represents an input, represents an output, is a network weight, is a loss function, is an LI norm penalty function, is a coefficient balancing the penalty function, .

6. The method of claim 1, wherein the method is characterized by: Let denote the attention branch loss when the input sample is Let denote the perception branch loss when the input sample is The total loss function is given by equation (11), (11) The accuracy Accuracy is calculated according to formula (12), the sensitivity Sensitivity is calculated according to formula (13), and the specificity Specificity is calculated according to formula (14), which are used to evaluate the performance of the model until the optimal model is obtained, (12) (13) (14) Wherein, TP, TN, FP and FN represent the number of true positives, true negatives, false positives and false negatives, respectively.