An endoscope video anomaly detection method based on normalized flow
By employing a normalized flow-based anomaly detection method for endoscopic videos, and utilizing a spatiotemporal-aware encoder and a bottleneck module to calculate anomaly scores, this method addresses the issues of high data labeling costs and insufficient temporal relationships in endoscopic image detection, achieving highly accurate anomaly detection.
Patent Information
- Application Number
- CN202410794910.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-19
- Publication Date
- 2025-11-11
- Estimated Expiration
- 2044-06-19
AI Technical Summary
Existing technologies for anomaly detection in endoscopic images suffer from high data labeling costs, insufficient model robustness to new categories, and inability to effectively utilize temporal relationships in videos, resulting in low detection accuracy.
An anomaly detection method based on normalized flow is adopted for endoscopic video. By acquiring endoscopic video and using a bottleneck module formed by an encoder with spatiotemporal awareness and reversible normalized flow, anomaly scores are calculated for detection, which solves the problems of high data labeling cost and insufficient utilization of temporal relationships.
It improves the accuracy and robustness of detection without the need for positive sample training, especially showing high accuracy in the detection of low incidence or rare lesions, and is suitable for the detection of various endoscopic video anomalies.
Smart Images

Figure CN118658097B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of video anomaly detection technology, specifically relating to a method for detecting anomalies in endoscopic videos based on normalized flow. Background Technology
[0002] Deep learning methods have demonstrated enormous potential in various fields, including medical image processing, disease diagnosis, and real-time monitoring. Endoscopy plays a crucial role in the examination of gastrointestinal diseases. Applying deep learning methods to endoscopic images for assisted medical treatment aims to reduce the workload of doctors and even replace their work in interpreting endoscopic images. Current endoscopic image-based assisted medical tasks mainly include: lesion identification, lesion target detection, and lesion region segmentation.
[0003] The lesion identification task aims to automatically identify and classify the presence or types of abnormalities in endoscopic images, such as polyps and tumors. This task requires binary or multi-class labels. The lesion target detection task aims to select abnormal regions in an image and assign lesion labels to the selected targets. This task requires bounding box annotation of abnormal regions in the image. The lesion region segmentation task aims to perform pixel-level identification of the disease to obtain the current lesion region. This task requires semantic segmentation annotation or instance segmentation annotation of the image.
[0004] Models designed to accomplish these tasks typically require large amounts of lesion data, which need to be labeled by professionals, making the acquisition of high-quality medical labeled data extremely costly. Furthermore, even when trained on high-quality data, the model may still not be robust enough to unfamiliar new categories or marginal cases, leading to an increased misdiagnosis rate.
[0005] Furthermore, the data obtained by endoscopy is often in the form of images or videos with a sequential relationship. However, current anomaly detection methods in medical imaging are basically based on single images. If the data is only an independently input image or a single frame extracted from a video, the network will not be able to obtain the temporal relationship in the overall data, thus losing the important information it carries and reducing the accuracy of the prediction results in the task. Summary of the Invention
[0006] To address the shortcomings of existing technologies, this invention proposes a normalized flow-based method for detecting anomalies in endoscopic videos. The method includes: acquiring the endoscopic video to be detected and inputting it into a trained endoscopic video anomaly detection model to obtain the model processing result; calculating the anomaly score based on the model processing result and obtaining the endoscopic video anomaly detection result based on the anomaly score.
[0007] The training process of the endoscopic video anomaly detection model includes:
[0008] S1: Acquire endoscopic video and preprocess it to obtain preprocessed video data;
[0009] S2: The preprocessed video data is processed using an encoder with spatiotemporal awareness to obtain video feature vectors;
[0010] S3: The bottleneck module formed by the reversible normalization flow processes the video feature vector to obtain the normalized feature vector;
[0011] S4: Calculate the likelihood loss and likelihood score of the normalized feature vector based on the video feature vector and the normalized feature vector;
[0012] S5: Input the normalized feature vector into the decoder for processing to obtain the reconstructed video data;
[0013] S6: Calculate the reconstruction loss and reconstruction score based on the reconstructed video data and the preprocessed video data;
[0014] S7: Calculate the total model loss based on the likelihood loss and reconstruction loss; calculate the anomaly score based on the likelihood score and reconstruction score; determine whether the video data is abnormal based on the anomaly score, and finally obtain the anomaly detection result of the endoscopic video.
[0015] S8: Adjust the model parameters based on the total model loss, save the optimal parameters, and obtain the trained endoscopic video anomaly detection model.
[0016] Preferably, the preprocessing of the endoscopic video includes: setting the frame number, dividing the endoscopic video data into multiple video segments with a specified frame number, and discarding data with less than a specified frame number; performing a normalization operation on the video data to obtain normalized data with a value range of [0,1]; and performing Z-Score standardization on the normalized data with a mean and standard deviation of 0.5 to obtain the preprocessed video data.
[0017] Preferably, the preprocessed video data processed by the encoder with spatiotemporal awareness is represented as follows:
[0018] z = Encoder(x)
[0019] Where z is the video feature vector extracted by the encoder, x represents the preprocessed data, and Encoder represents a spatiotemporally aware encoder.
[0020] The preferred approach, where the bottleneck module formed by the reversible normalized flow processes the video feature vector, is represented as follows:
[0021] z′=Bottleneck(z)
[0022] Where z′ is the normalized feature vector, z is the video feature vector, and Bottleneck is the bottleneck module formed by the reversible normalized flow.
[0023] Preferably, the formula for calculating the likelihood loss is:
[0024]
[0025] in, Indicates likelihood loss. Let z represent the negative log-likelihood of z. Let |det·| represent the negative log-likelihood of z′, |det·| represent the absolute value of the matrix determinant, z represent the video feature vector, and z′ represent the normalized stream feature vector. Represents the video feature vector space. This represents the normalized feature vector space.
[0026] Preferably, the formula for calculating the likelihood score is:
[0027]
[0028] Among them, S flow Represents the likelihood score. Represents the normalized feature vector space. Let z' represent the negative log-likelihood of z'.
[0029] Preferably, the formula for calculating the reconstruction score is:
[0030]
[0031] Among them, S recon SSIM(·) represents the reconstruction score, SSIM(·) represents the structural similarity calculation, x represents the preprocessed video data, x′ represents the reconstructed video data, and μ represents the reconstruction score. x and μ x′ These represent the mean values of the preprocessed video data and the reconstructed video data, respectively. and These are the variances of the preprocessed video data and the reconstructed video data, σ. xx′ C1 and C2 represent the covariance of the preprocessed video data and the reconstructed video data, respectively. C1 and C2 are the first and second small constants added to avoid the denominator being zero.
[0032] Preferably, the formula for calculating the reconstruction loss is:
[0033]
[0034] in, The reconstruction loss is represented by F, where F represents the number of frames, M represents the width and height of each frame, and C represents the number of channels. MSE(·) represents the mean squared error, xc,f,i,j and x′ c,f,i,j These represent the coordinates (i,j) of the preprocessed video data and the reconstructed video data in the f-th frame of channel c, respectively.
[0035] Preferably, the formula for calculating the total loss of the model is:
[0036]
[0037] in, The model's total loss is represented by α, where α represents the weight of the first loss and β represents the weight of the second loss. Indicates likelihood loss. This indicates the losses incurred during reconstruction.
[0038] Preferably, the formula for calculating the outlier score is:
[0039] S=γ*S flow +δ*S recon
[0040] Where S represents the outlier score, γ represents the first score weight, and δ represents the second score weight. flow S represents the likelihood score. recon This indicates the reconstructed score.
[0041] The beneficial effects of this invention are as follows: This invention only requires negative samples for training, enabling the utilization of negative samples, which constitute a large proportion of all images but cannot be fully utilized by conventional methods. Therefore, there is no need to worry about imbalances in the ratio of positive to negative samples or multiple samples. It achieves high detection accuracy even for cases with low incidence rates, making it difficult to form datasets, or for cases with data anomalies. Employing a spatiotemporally aware encoder, this invention learns the temporal relationships between frames in the video, solving the problem of lacking temporal information in image-based methods. Furthermore, this invention uses a normalized flow method to solve unsupervised anomaly detection, making it more widely applicable than existing methods. The scoring function simultaneously considers the computable probability density of features and the visual structural consistency in the image domain, improving the accuracy of the detection results. Attached Figure Description
[0042] Figure 1 This is a flowchart illustrating the training process of the endoscopic video anomaly detection model in this invention.
[0043] Figure 2 This is a comparison diagram of the Divided Space-Time Attention structure used by TimeSFormer in this invention and the attention mechanism of the original Transformer;
[0044] Figure 3 This is a schematic diagram of the overall network architecture of a preferred embodiment of the present invention;
[0045] Figure 4 This is a schematic diagram of the actual detection results of a preferred embodiment of the present invention. Detailed Implementation
[0046] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0047] This invention proposes a method for detecting anomalies in endoscopic videos based on normalized flow, such as... Figure 1 , Figure 2 As shown, the method includes the following: acquiring the endoscope video to be detected and inputting it into a trained endoscope video anomaly detection model to obtain the endoscope video anomaly detection result.
[0048] The training process of the endoscopic video anomaly detection model includes:
[0049] S1: Acquire endoscopic video and preprocess it to obtain preprocessed video data.
[0050] Preprocessing of endoscopic video: Users specify the frame rate based on their task requirements and computer hardware performance. Preferably, the frame rate F is set to 8. The video data is divided into multiple 8-frame segments. Any remaining segments with fewer than 8 frames are discarded. Thus, each video segment is processed into a small RGB three-channel video block with 8 frames and a width and height of 224×224. Each endoscopic video segment is read as an integer value between 0 and 255. The video data is then normalized by dividing each value by 255 to obtain normalized data with a value range of [0,1]. The normalized data is then standardized using Z-Score, with a mean and standard deviation of 0.5. Specifically, each value in the normalized data is subtracted from the standard deviation, and the difference is divided by the mean to obtain the preprocessed video data. Its value range is [-1, 1], where H represents the height, W represents the width, C represents the number of channels, and F represents the number of frames in each video segment. In this example, H, W, C, and F are 224, 224, 3, and 8, respectively.
[0051] S2: The preprocessed video data is processed using an encoder with spatiotemporal awareness to obtain video feature vectors.
[0052] Preferably, the encoder with spatiotemporal awareness is the TimeSFormer model; the TimeSFormer model is essentially a Transformer model, and its main improvements compared to the original Transformer model are described below:
[0053] 1. Regarding Patch processing, TimeSFormer considers the time dimension. For inputs of... Transformer divides data into a Patch construction sequence, where the number of patches per frame is [number missing]. Here, P represents the size of the patch. When expanded, it is represented as a vector.
[0054] 2. For position embedding processing, we have:
[0055]
[0056] in Indicates initial data embedding, Represents a learnable matrix,
[0057] This represents a learnable spatial encoding.
[0058] 3. TimeSFormer as a whole contains multiple layers of encoded blocks. For each encoded block, such as... Figure 3 As shown, its self-attention mechanism includes:
[0059]
[0060] Where (l,a) specifies the a-th attention head of the current operation in layer l, D h This represents the dimension of each attention head. and Different weights are represented by LN, which indicates the layer normalization operation.
[0061] and Specify the query vector, key vector, and value vector for each location.
[0062] 4. Self-attention based on video data requires calculating the temporal dimension, expressed by the formula:
[0063]
[0064]
[0065] Here, (l,a) indicates that the current operation is located in the a-th attention head of the l-th coding block. For a given set of data at position p and time t, the spatial self-attention weights are Softmax(·), where Softmax(·) represents SoftMax activation. Represents a specific query vector for a given location. and These are the global key at a specified position and the key vector at position p' (from 1 to F), respectively. h It is the dimension of each attention head. This represents the output for position p and time t at a specified location. This represents the attention weight between the query point (p,t) and the key point (p′,t′) at the specified location.
[0066] After merging each attention head, a linear projection is applied to it and then fed into a multilayer perceptron, resulting in:
[0067]
[0068] in, This indicates that this is the intermediate output of the l-th layer at position (p,t). W represents the final output of the l-th layer at position (p,t). o It is a matrix that integrates the outputs of all attention heads A, which are stacked into a column vector; It is the output inherited from the previous layer l-1. MLP refers to Multilayer Perceptron.
[0069] Its self-attention mechanism has been replaced with a paradigm that has spatiotemporal awareness. Here, a divided space-time attention structure is used. Its self-attention mechanism employs a two-step computation: first, temporal self-attention is calculated, and then spatial self-attention is calculated, i.e.:
[0070]
[0071]
[0072] in For the l-th coding block and the a-th attention head, the spatial self-attention weights at position p and time t are calculated, and the parameters are not shared between the two weight calculations. Let represent the key vector at different time points t′ for a given spatial location p under layer l and attention head a.
[0073] After the above improvements, TimeSFormer gained the ability to perceive spatiotemporal information. This is particularly useful in video task processing.
[0074] In this example, the TimeSFormer model parameters are set to those of ViT-Base, namely, a patch size of 16×16, a stacking depth of 12, a hidden layer size of 768, an MLP size of 3072, and 12 attention heads. TimeSFormer processes the pre-processed video data, discards the cls-token feature vector in the output, and obtains the video feature vector, which is:
[0075] z = TimeSFormer(x)
[0076] Wherein, the input is the preprocessed data x, and the output is the video feature vector. Where nf and f represent the number of rows and columns of the feature vector. In this example, nf and f are 1568 and 768, respectively.
[0077] The preprocessed video data processed by the encoder with spatiotemporal awareness is represented as follows:
[0078] z = Encoder(x)
[0079] Where z is the video feature vector extracted by the encoder, x represents the preprocessed data, and Encoder represents a spatiotemporally aware encoder.
[0080] S3: The bottleneck module formed by the reversible normalized flow is used to process the video feature vector to obtain the normalized feature vector.
[0081] The bottleneck module formed by the reversible normalized flow is a flow model composed of deep learning modules, and the normalized flow model. The probability density of the extracted feature vector z can be obtained explicitly. Its input is the video feature vector z, and the output is the normalized feature vector z′. The bottleneck module of this example's reversible normalization flow consists of eight concatenated convolutional blocks. Each convolutional block is a normalization flow architecture composed of convolutional layers and activation function layers. Each convolutional block includes two one-dimensional convolutions with identical kernel sizes, changing only the number of channels in the data shape. The first convolution has four times the number of input channels, and the second has the same number of input channels, ensuring that the input and output shapes of each convolutional block are identical. The kernel size within each of the eight convolutional blocks is either 3 or 1. After processing through eight convolutional blocks, the final output has the same shape as the input, i.e., and Where nf' and f' represent the number of rows and columns of the invertible normalized eigenvector, respectively, and are equal to the values of nf and f, which are 1568 and 768 in this example.
[0082] The model in this streaming architecture is trained by maximizing the log-likelihood of normal image data. During the prediction phase, normal data (negative samples) have a high probability, while anomalous data (positive samples) have a low probability. Positive samples possess different features from negative samples, which are difficult to pass through the bottleneck module and thus difficult for the decoder to reconstruct. Therefore, the output of the bottleneck formed by the reversible normalized stream and the reconstructed video data can be used to perform anomaly detection on the video.
[0083] The bottleneck module formed by the reversible normalized flow processes the video feature vector as follows:
[0084] z′=Bottleneck(z)
[0085] Where z′ is the normalized feature vector, z is the video feature vector, and Bottleneck is the bottleneck module formed by the reversible normalized flow.
[0086] S4: Calculate the likelihood loss and likelihood score based on the video feature vector and the normalized feature vector.
[0087] Calculate the likelihood loss:
[0088]
[0089] Where z represents the video feature vector, and z′ represents the normalized stream feature vector. Represents the video feature vector space. Represents the normalized feature vector space. This represents the likelihood loss value. Let z represent the negative log-likelihood of z. Let |det·| represent the negative log-likelihood of z′, and let |det·| represent the absolute value of the matrix determinant.
[0090] Calculate the likelihood score:
[0091]
[0092] Among them, S flow This represents the likelihood score.
[0093] S5: Input the normalized feature vector into the decoder for processing to obtain the reconstructed video data.
[0094] The decoder can employ a convolutional neural network or a network suitable for data reconstruction. In this example, the decoder is configured with four 3D convolutions, each with a kernel size of 3×3×3 and channel numbers of 64, 32, 16, and 8, respectively. Each convolutional layer is followed by a batch normalization layer, an upsampling layer, and an activation layer. The upsampling layers change the shape and size of the input data to (3,28,28), (3,56,56), (3,112,112), and (3,224,224), respectively. The activation layer uses the GeLU activation function. In this example, to enable successful decoding, the data undergoes a dimensionality transformation before entering the decoding stage. Where h′, w′, c′, and f′ are 16, 16, 3, and 1568 respectively, and the reconstructed data obtained after the decoder completes the convolution is x′∈R. H’×W’×F’×C’ At this point, the F' and C' dimensions of the reconstructed data x' are swapped to make x' conform to the data format of x, ultimately yielding the reconstructed video data. In this example, H', W', C', and F' represent the height, width, number of channels, and number of frames of the reconstructed video data, which are 224, 224, 3, and 8, respectively.
[0095] The above represents the decoder processing the normalized feature vectors, outputting reconstructed video data, and finally obtaining a result with a value range of [-1, 1] through the Tanh activation function:
[0096] x' = Tanh(Decoder(z'))
[0097] Where x′ represents the reconstructed video data, z′ represents the normalized feature vector, Tanh(·) represents activation by the Tanh activation function, and Decoder(·) represents the output obtained by inputting decoder data.
[0098] S6: Calculate the reconstruction loss and reconstruction score based on the reconstructed video data and the preprocessed video data.
[0099] Calculate reconstruction loss:
[0100]
[0101] Among them, L recon Let x represent the reconstruction loss, x represent the preprocessed video data, x′ represent the reconstructed video data, MSE(·) represent the mean squared error, C represent the number of channels, F represent the number of frames, and M represent the width and height of each frame. c,f,i,j and x′ c,f,i,j These represent the coordinates (i,j) of the preprocessed video data and the reconstructed video data in the f-th frame of channel c, respectively.
[0102] Calculate the reconstruction score:
[0103]
[0104] Among them, S recon SSIM(x,x') represents the reconstruction score, where SSIM(x,x') represents the structural similarity between the preprocessed video data and the reconstructed video data, x represents the preprocessed video data, x' represents the reconstructed video data, and μ represents the reconstruction score. x and μ x’ This represents the mean of the preprocessed video data and the reconstructed video data. and It is the variance of the preprocessed video data and the reconstructed video data, σ xx’ This represents the covariance between the preprocessed video data and the reconstructed video data. The calculation window is the default value of 11. C1 and C2 are the first and second small constants added to avoid the denominator being zero. In this example, they are 0.0001 and 0.0009, respectively.
[0105] This invention considers the presence of crucial information before and after the data in video. It employs a spatiotemporally aware network model to extract feature vectors containing spatiotemporal characteristics. The difference between positive and negative samples in the output distribution of the normalized flow model is used as a key criterion for distinguishing data. Furthermore, reconstruction information is obtained by comparing the differences between preprocessed and reconstructed data, serving as a supplementary criterion for distinguishing positive and negative samples, thus improving the accuracy of the model's output. The advantages of this invention are that it does not require positive samples, only a large number of negative samples for training; and it achieves high detection accuracy even when facing low incidence rates, difficulty in forming datasets, or rare data instances.
[0106] S7: Calculate the total model loss based on the likelihood loss and reconstruction loss; calculate the anomaly score based on the likelihood score and reconstruction score; determine whether the video data is abnormal based on the anomaly score; and obtain the anomaly detection result of the endoscopic video.
[0107] The total model loss is obtained by weighted summation of the reconstruction loss and likelihood loss:
[0108]
[0109] in, α represents the total loss of the model, and α represents the user-defined loss weight, which usually needs to be determined through multiple experiments. It is used to set the weight of different losses in the total loss. Preferably, α is set to 0.6.
[0110] Calculate the outlier score:
[0111] S=γ*S flow +δ*S recon
[0112] Where S represents the total outlier score, γ represents the first score weight, and δ represents the second score weight. These two weights are specified by the user based on experimental results or experience to control the weight of different scores within the total outlier score. Preferably, in this example, δ = 0.1 and γ = 0.9; S flow S represents the likelihood score. recon This represents the reconstructed score.
[0113] An appropriate threshold is set for outlier scores to distinguish between positive and negative samples. The outlier score that yields the highest F1 score from the validation data is used as the threshold for judgment. For video data, if its outlier score is greater than or equal to the threshold, it is considered a negative sample, meaning the video has no outliers. Conversely, if its outlier score is less than the threshold, it is considered a positive sample, meaning the video has outliers.
[0114] S8: Adjust the model parameters based on the total model loss, save the optimal parameters, and obtain the trained endoscopic video anomaly detection model.
[0115] Backpropagation is performed based on the total model loss to adjust the model parameters. When the total loss is minimized or the preset maximum number of iterations is reached, the model parameters are saved to obtain the optimal endoscopic video anomaly detection model.
[0116] By acquiring the endoscope video to be detected and inputting it into the optimal endoscope video anomaly detection model, the endoscope video anomaly detection results can be obtained.
[0117] Evaluation of the present invention:
[0118] The validation results of this example on the PolypDiag dataset are shown in Table 1.
[0119] Table 1 Results Indicators
[0120]
[0121] The actual detection effect of a preferred embodiment of the present invention is as follows: Figure 4 As shown in Table 1 and Figure 4 As can be seen, the present invention has good performance and high detection accuracy.
[0122] In summary, this invention achieves unsupervised anomaly detection. Compared to existing methods, its scoring function simultaneously considers the computable probability density of features and the visual structural consistency in the image domain, improving the accuracy of detection results. In medical tasks, it can assist doctors in real-time online diagnosis of medical images such as gastroscopy and colonoscopy, allowing doctors to use anomaly scores as a reference. In offline scenarios, such as capsule endoscopy, doctors can use this invention to first locate the video segment containing lesions, thereby avoiding misdiagnosis or missed diagnosis caused by fatigue from prolonged image review.
[0123] The above-described embodiments further illustrate the purpose, technical solution, and advantages of the present invention. It should be understood that the above-described embodiments are merely preferred embodiments of the present invention and are not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made to the present invention within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A method for detecting anomalies in endoscopic videos based on normalized flow, characterized in that, include: The endoscope video to be detected is acquired and input into the trained endoscope video anomaly detection model to obtain the endoscope video anomaly detection result; The training process of the endoscopic video anomaly detection model includes: S1: Acquire endoscopic video and preprocess it to obtain preprocessed video data; S2: The preprocessed video data is processed using an encoder with spatiotemporal awareness to obtain video feature vectors; S3: The bottleneck module formed by the reversible normalized flow is used to process the video feature vector to obtain the normalized flow feature vector; S4: Calculate the likelihood loss and likelihood score of the normalized stream feature vector based on the video feature vector and the normalized stream feature vector; S5: Input the normalized stream feature vector into the decoder for processing to obtain the reconstructed video data; S6: Calculate the reconstruction loss and reconstruction score based on the reconstructed video data and the preprocessed video data; the formula for calculating the reconstruction score is: ; in, Indicates the reconstructed fraction. This indicates the calculation of structural similarity. This indicates preprocessed video data. This indicates the reconstruction of video data. and These represent the mean values of the preprocessed video data and the reconstructed video data, respectively. and These are the variances of the preprocessed video data and the reconstructed video data, respectively. Represents the covariance between the preprocessed video data and the reconstructed video data. and These are the first and second smaller constants added to avoid the denominator being zero; The formula for calculating reconstruction loss is: ; in, Indicates the losses incurred during reconstruction. Represents the number of frames. Represents the height of each frame of data. Represents the width of each frame of data. This represents the mean squared error, where C represents the number of channels. and These represent the preprocessed video data and the reconstructed video data, respectively. Channel 1 The coordinates of the frame are The value; S7: Calculate the total model loss based on the likelihood loss and reconstruction loss; calculate the anomaly score based on the likelihood score and reconstruction score; determine whether the video data is abnormal based on the anomaly score, and finally obtain the anomaly detection result of the endoscopic video. S8: Adjust the model parameters based on the total model loss, save the optimal parameters, and obtain the trained endoscopic video anomaly detection model.
2. The method for detecting anomalies in endoscopic video based on normalized flow according to claim 1, characterized in that, The preprocessing process for endoscopic video includes: setting the frame number, dividing the endoscopic video data into multiple video segments with a specified frame number, and discarding data with fewer than the specified frame number; normalizing the video data to obtain normalized data with a value range of [0, 1]; and standardizing the normalized data using Z-Score with a mean and standard deviation of 0.5 to obtain preprocessed video data.
3. The method for detecting anomalies in endoscopic video based on normalized flow according to claim 1, characterized in that, The preprocessed video data processed by the encoder with spatiotemporal awareness is represented as follows: ; in, The video feature vector extracted by the encoder. This indicates preprocessed video data. This refers to an encoder with spatiotemporal awareness.
4. The method for detecting anomalies in endoscopic video based on normalized flow according to claim 1, characterized in that, The bottleneck module formed by the reversible normalized flow processes the video feature vector as follows: ; in, For normalized flow feature vectors, For video feature vectors, This is the bottleneck module formed by the reversible normalized flow.
5. The method for detecting anomalies in endoscopic video based on normalized flow according to claim 1, characterized in that, The formula for calculating likelihood loss is: ; in, Indicates likelihood loss. express The negative log-likelihood of the probability. express The negative log-likelihood of the probability. Represents the absolute value of the determinant of a matrix. Represents the video feature vector. Represents the normalized flow feature vector. Represents the video feature vector space. Let represent the eigenvector space of the normalized flow.
6. The method for detecting anomalies in endoscopic video based on normalized flow according to claim 1, characterized in that, The formula for calculating the likelihood score is: ; in, Represents the likelihood fraction. Represents the normalized flow feature vector space. express The negative log-likelihood.
7. The method for detecting anomalies in endoscopic video based on normalized flow according to claim 1, characterized in that, The formula for calculating the total loss of the model is: ; in, This represents the total loss of the model. Indicates the first loss weight. This indicates the second loss weight. Indicates likelihood loss. This indicates the losses incurred during reconstruction.
8. The method for detecting anomalies in endoscopic video based on normalized flow according to claim 1, characterized in that, The formula for calculating the outlier score is: ; in, Indicates abnormal scores. Indicates the first score weight. This indicates the weight of the second score. Represents the likelihood score. This indicates the reconstructed score.