An automatic diagnosis system for Crohn's disease based on capsule endoscopy video
By designing an automatic diagnosis system for Crohn's disease based on capsule endoscopy video, and using video classification and lesion detection models to extract small intestine segment video features, the problem of low diagnostic efficiency of capsule endoscopy video in the existing technology is solved, and Crohn's disease is realized. Fully automatic and efficient diagnosis of diseases.
Patent Information
- Application Number
- CN202410782428.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-18
- Publication Date
- 2024-09-06
- Estimated Expiration
- 2044-06-18
AI Technical Summary
It is difficult to directly use capsule endoscopy video to automatically diagnose Crohn's disease using existing technology, resulting in low diagnostic efficiency.
An automatic diagnosis system for Crohn's disease based on capsule endoscopy video is designed, including a video acquisition module, a small intestine video recognition module, a small intestine lesion detection module, a target video frame extraction module and a Crohn's disease recognition module. Through the video classification model And the lesion detection model extracts the features of the small intestine segment video, calculates the lesion probability, and inputs it into the Crohn's disease recognition model for diagnosis.
It achieves fully automatic and efficient diagnosis of Crohn's disease, overcomes the shortcoming of being unable to input the entire capsule endoscopy video into the Crohn's disease recognition model, and improves diagnostic efficiency.
Smart Images

Figure CN118366645B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of Crohn's disease diagnosis, and in particular to an automatic Crohn's disease diagnosis system based on capsule endoscopy video. Background Art
[0002] Crohn's disease is a complex, chronic inflammatory bowel disease that primarily affects the patient's digestive system, causing inflammation of the digestive tract, which can cause symptoms such as abdominal pain, diarrhea, and even fatal complications. This intestinal inflammation can occur anywhere in the gastrointestinal tract from the mouth to the anus, most commonly in the small intestine.
[0003] Currently, wireless capsule endoscopes are mostly used to diagnose Crohn's disease. It is painless and non-invasive. Patients only need to swallow the capsule, and the capsule endoscope can move along the peristalsis of the intestine and easily capture images of small intestine segments that are difficult to observe with traditional endoscopes at a speed of 3 frames per second, thereby improving the detection rate of Crohn's disease. Among them, each capsule endoscopy video has nearly 100,000 frames, and it is impossible to directly input the entire endoscopy video as a model into the Crohn's disease diagnosis model. Most existing technologies first classify each video frame separately to quickly locate the position of the lesion frame, and then conduct manual inspection and diagnose Crohn's disease based on the scoring system.
[0004] Therefore, how to automatically diagnose Crohn's disease directly using capsule endoscopy video is an urgent problem that needs to be solved. Summary of the invention
[0005] An embodiment of the present invention provides an automatic Crohn's disease diagnosis system based on capsule endoscopy video. The automatic Crohn's disease diagnosis system can directly use capsule endoscopy video to automatically diagnose Crohn's disease, thereby improving the efficiency of Crohn's disease diagnosis.
[0006] An embodiment of the present invention provides an automatic diagnosis system for Crohn's disease based on capsule endoscopy video, comprising:
[0007] Video acquisition module, small intestine video recognition module, small intestine lesion detection module, target video frame extraction module, Crohn's disease recognition module;
[0008] The video acquisition module is used to acquire the whole target capsule endoscopy video;
[0009] The small intestine video recognition module is used to classify the full-course target capsule endoscopy video according to a preset video classification model, and extract the small intestine segment video of the full-course target capsule endoscopy image;
[0010] The small intestinal lesion detection module is used to extract features from each video frame in the small intestinal segment video according to a preset small intestinal lesion detection model, and determine the probability of the presence of lesions in each video frame according to the extracted features;
[0011] The target video frame extraction module is used to divide the small intestine segment video into several video segments on average, and for each video segment, select several video frames with the highest probability of the presence of lesions in the video as target video frames;
[0012] The Crohn's disease recognition module is used to input all target video frames into a preset Crohn's disease recognition model, so that the Crohn's disease recognition model determines the diagnosis result of Crohn's disease based on the target video frames.
[0013] Furthermore, the above-mentioned full-course target capsule endoscopy video is identified according to a preset video classification model, and the small intestine segment video of the above-mentioned full-course target capsule endoscopy image is extracted, including:
[0014] According to the preset video classification model, the normalized classification probabilities of the stomach segment video, the small intestine segment video and the large intestine segment video in the full-course target capsule endoscopy video are obtained;
[0015] According to the binary search algorithm and the above classification probability, the starting image frame and the ending image frame of the above small intestine segment video are calculated, and then the small intestine segment video of the above full-course target capsule endoscopy image is obtained.
[0016] Furthermore, the video classification model is provided with an image encoder, a filter, a high-frequency information encoder and a Transformer;
[0017] The above-mentioned normalized classification probabilities of the stomach segment video, the small intestine segment video, and the large intestine segment video in the above-mentioned full-course target capsule endoscopy video are obtained according to the above-mentioned preset video classification model, including:
[0018] Using the image encoder to extract the first feature of each frame of the full-course target capsule endoscopy video;
[0019] Using the above filter to extract high-frequency information of each frame of the above image;
[0020] Extracting a second feature of the high-frequency information using the high-frequency information encoder;
[0021] Adding the second feature to the first feature to obtain a third feature corresponding to each frame of the image;
[0022] Input the third feature of each frame of the image and the third features of the 2N frames of images adjacent to the left and right thereof into the Transformer to obtain a fused fourth feature;
[0023] The fourth feature is concatenated, the classification probability is calculated, and the classification probability is normalized to obtain the normalized classification probability:
[0024] ;
[0025] ;
[0026] In the formula, represents the above classification probability, represents the normalized classification probability, This represents the fourth feature mentioned above.
[0027] Furthermore, the training of the above video classification model includes:
[0028] Acquire a plurality of first video frames with first real labels, wherein the first real labels are used to indicate the categories corresponding to the first video frames; the categories of the first video frames include: video frames of the stomach, video frames of the small intestine, or video frames of the large intestine;
[0029] For each frame of the first video frame, input the first video frame into the video classification model to be trained to obtain the classification probability that the first video frame is recognized as stomach, small intestine or large intestine by the video classification model; calculate the value of the first loss function according to the classification probability, the first true label corresponding to the classification probability and the cross entropy loss function formula;
[0030] After each calculation to obtain a value of the first loss function, determine whether the first loss function converges, if so, determine that the training of the video classification model to be trained is completed, if not, continue to train the video classification model to be trained;
[0031] Among them, the above cross entropy loss function formula is as follows:
[0032] ;
[0033] In the formula, Represents the one-hot vector corresponding to the first true label of each frame image. They represent the classification probability of the t-th frame image being predicted as stomach, small intestine or large intestine, respectively. They respectively represent the one-hot vector corresponding to the first true label of the t-th frame image.
[0034] Furthermore, the above-mentioned binary search algorithm and the above-mentioned normalized classification probability are used to calculate the dividing point between the small intestine segment and the stomach and large intestine segment videos, and then the small intestine segment video of the above-mentioned full-course target capsule endoscopy image is obtained, including:
[0035] For the above-mentioned full-course target capsule endoscopy image, frame numbers are set from small to large frame by frame from the start frame to the end frame;
[0036] The midpoint image frame of the whole target capsule endoscopy image is used as the initial search position. If the predicted category of the midpoint image frame is the small intestine or the large intestine, the search is started in the direction of decreasing frame number. Otherwise, the search is started in the direction of increasing frame number until the first search step is less than 1.
[0037] The search position when the first search step length is less than 1 is determined as the starting point of the small intestine segment video;
[0038] The midpoint image frame of the whole target capsule endoscopy image is used as the initial search position. If the predicted category of the midpoint image frame is stomach or small intestine, the search starts in the direction of increasing frame number. Otherwise, the search starts in the direction of decreasing frame number until the second search step length is less than 1.
[0039] The search position when the second search step length is less than 1 is determined as the end point of the small intestine segment video;
[0040] Perform video extraction according to the starting point and the ending point of the small intestine segment video to obtain the small intestine segment video of the full-course target capsule endoscopy image;
[0041] Among them, when searching, the distance to the next search step is calculated according to the classification probability of the currently searched video frame and the step formula;
[0042] The above step size formula is:
[0043] ;
[0044] ;
[0045] In the formula, Indicates the predicted category of the current video frame, They represent the stomach, small intestine, and large intestine. represents the classification probability of the stomach, small intestine and large intestine respectively, d represents the initial step length, is a constant, is a constant, α is the preset decay rate, Represents the classification probability corresponding to the predicted category of the current video frame, Indicates the search step size.
[0046] Furthermore, feature extraction is performed on each video frame in the above-mentioned small intestine segment video according to a preset small intestine lesion detection model, and the probability of the presence of a lesion in each video frame is determined according to the extracted features, including:
[0047] Extracting a fifth feature of each video frame in the small intestine segment video according to the preset small intestine lesion detection model;
[0048] The fifth feature is input into the fully connected layer to obtain a vector indicating whether each video frame in the small intestine segment video contains a lesion;
[0049] Normalizing the above vector to obtain a first probability vector of whether each video frame in the above small intestine segment video contains a lesion;
[0050] The probability of a lesion existing in each video frame is determined according to the first probability vector.
[0051] Furthermore, the training of the above-mentioned small intestinal lesion detection model includes:
[0052] Acquire a plurality of second video frames with second real labels, wherein the second real labels are used to indicate whether the small intestine corresponding to the second video frame has a lesion;
[0053] For each frame of the second video frame, input the second video frame into the small intestinal lesion detection model to be trained to obtain a second probability that the second video frame is detected by the small intestinal lesion detection model as having a lesion; and calculate the value of the second loss function according to the second probability and the corresponding second true label;
[0054] After each calculation to obtain a value of the second loss function, it is determined whether the second loss function converges. If so, it is determined that the training of the small intestinal lesion detection model to be trained is completed. If not, the training of the small intestinal lesion detection model to be trained continues.
[0055] Furthermore, the above-mentioned small intestine segment video is evenly divided into several video segments. For each video segment, several video frames with the highest probability of the presence of lesions in the video are used as target video frames, including:
[0056] The above-mentioned small intestine segment video is evenly divided into 4 video segments. For each video segment, the 500 video frames with the highest probability of the existence of lesions in the video are used as target video frames.
[0057] Further, all target video frames are input into a preset Crohn's disease recognition model, so that the Crohn's disease recognition model determines the diagnosis result of Crohn's disease according to the target video frames, including:
[0058] Input the target video frame into a preset Crohn's disease recognition model; wherein the preset Crohn's disease recognition model includes: a first layer Transformer, a second layer Transformer, and a fully connected layer;
[0059] The sixth features of the 500 target video frames of each of the four videos are fused through the first layer of Transformer to obtain the first output feature of the four output first feature sequences after the fusion of the four videos;
[0060] Input the first output feature into the second layer Transformer to obtain the first output vector of four output second feature sequences;
[0061] The first output vector is input into the fully connected layer and normalized to obtain a diagnosis result of Crohn's disease.
[0062] Furthermore, the construction of the above-mentioned Crohn's disease recognition model includes:
[0063] Acquire a plurality of third video frames with third real labels, wherein the third real labels are used to indicate whether there is a Crohn's disease lesion in the small intestine of the third video frame;
[0064] For each of the third video frames, input the third video frame into the Crohn's disease recognition model to be trained to obtain a third probability that the third video frame is recognized as having Crohn's disease by the Crohn's disease recognition model; and calculate a value of a third loss function according to the third probability and the corresponding third true label;
[0065] Each time a value of the third loss function is calculated, it is determined whether the third loss function converges, until the third loss function converges, and the Crohn's disease recognition model at this time is determined as the preset Crohn's disease recognition model.
[0066] Furthermore, the above-mentioned automatic diagnosis system for Crohn's disease based on capsule endoscopy video further includes: a small intestinal lesion positioning module;
[0067] The above-mentioned small intestinal lesion positioning module is used to obtain a lesion positioning map in the small intestinal segment video according to a preset small intestinal lesion positioning model;
[0068] The construction of the above-mentioned small intestinal lesion localization model includes:
[0069] Acquire a plurality of fourth video frames with fourth real labels, wherein the fourth real labels are used to indicate whether the small intestine corresponding to the fourth video frame has a lesion;
[0070] For each of the fourth video frames, the fourth video frame is input into the small intestine lesion localization model to be trained to obtain a first prediction score of whether there is a lesion or no lesion in each of the fourth video frames, and a value of a fourth loss function is calculated according to the first prediction score, a fourth true label corresponding to the first prediction score, a cross entropy loss supervision function, and a background suppression loss supervision function;
[0071] After each calculation to obtain a value of the fourth loss function, it is determined whether the fourth loss function converges. If so, it is determined that the training of the small intestinal lesion localization model to be trained is completed. If not, the training of the small intestinal lesion localization model to be trained continues.
[0072] Among them, the above cross entropy loss supervision function is as follows:
[0073] ;
[0074] ;
[0075] Where y represents the true label of the video frame of the above small intestine segment video, Indicates the probability of whether the lesion appears in the foreground localization map, Indicates the probability of whether the lesion appears in the background localization map, Indicates the probability of whether the background appears in the foreground positioning map, Indicates the probability of whether the background appears in the background positioning map;
[0076] The above background suppression loss supervision function is as follows:
[0077] ;
[0078] ;
[0079] In the formula, represents the foreground activation score, represents the background activation fraction, Represents a constant.
[0080] Furthermore, the above-mentioned small intestinal lesion localization model includes a Softmax layer and a convolutional layer;
[0081] For each of the fourth video frames, the fourth video frame is input into the small intestine lesion localization model to be trained to obtain a first prediction score of whether there is a lesion or no lesion in each of the fourth video frames, including:
[0082] According to the preset small intestine lesion detection model, a sixth feature of each frame of the small intestine segment video is obtained;
[0083] The sixth feature is expanded in the spatial dimension to obtain the foreground feature and background feature after the sixth feature is expanded in the spatial dimension:
[0084] According to the foreground features and background features, a foreground aggregator and a background aggregator are obtained through the Softmax layer and the convolution layer;
[0085] Aggregating the sixth feature with the foreground aggregator and the background aggregator to obtain a foreground feature corresponding to the foreground part and a background feature corresponding to the background part;
[0086] The foreground features and the background features are respectively input into a foreground classifier and a background classifier to calculate a first prediction score of whether there is a lesion or not.
[0087] Furthermore, the lesion location map in the small intestine segment video is obtained according to the preset small intestine lesion location model, including:
[0088] According to the preset small intestine lesion localization model, a second prediction score of the video frame with lesions in the small intestine segment video is obtained;
[0089] The average value of the partial derivative of each pixel point of each channel of the sixth feature is calculated according to the second prediction score, the sixth feature and the following formula:
[0090] ;
[0091] In the formula, represents the second prediction score mentioned above, Represents each channel and each pixel of the sixth feature above, represents the above average value;
[0092] According to the above average value and the channel of the sixth characteristic, the above lesion localization map is obtained by the following formula:
[0093] ;
[0094] In the formula, The above lesion localization map is shown. Represents the kth channel of the sixth feature mentioned above.
[0095] The embodiments of the present invention have the following beneficial effects:
[0096] The present invention provides an automatic diagnosis system for Crohn's disease based on capsule endoscopy video. The system uses a small intestine video recognition module to identify the small intestine segment video of the entire capsule endoscopy video, then extracts the features of each video frame of the small intestine segment video, determines the probability of the presence of lesions in each video frame based on the extracted features, then divides the small intestine segment video into several segments on average, and inputs several frames with the highest probability of lesions in the video frames of each segment video into a preset Crohn's disease recognition model to determine the diagnosis result of Crohn's disease. Therefore, in the entire diagnosis process of Crohn's disease, the present invention obtains the small intestine segment video through the video classification model, and then inputs several video frames with the highest probability of lesions in the small intestine segment video into the Crohn's disease recognition model, thereby overcoming the disadvantage that the entire capsule endoscopy video cannot be input into the Crohn's disease recognition model, and realizes fully automatic and efficient diagnosis of Crohn's disease. BRIEF DESCRIPTION OF THE DRAWINGS
[0097] Figure 1 The present invention is a schematic diagram of the structure of an automatic diagnosis system for Crohn's disease based on capsule endoscopy video provided in one embodiment of the present invention.
[0098] Figure 2 It is a structural diagram of a video classification model provided by an embodiment of the present invention.
[0099] Figure 3 It is a schematic diagram of an algorithm for finding the starting point of a small intestine segment video provided by an embodiment of the present invention.
[0100] Figure 4 It is a schematic diagram of an algorithm for finding the end point of a small intestine segment video provided by an embodiment of the present invention.
[0101] Figure 5 The figure is a schematic diagram of a Transformer-based Crohn's disease diagnosis process according to an embodiment of the present invention.
[0102] Figure 6 It is a schematic diagram of the training process of the above-mentioned small intestinal lesion localization model provided by one embodiment of the present invention. DETAILED DESCRIPTION
[0103] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0104] In the description of the present invention, it is to be understood that the terms "first" and "second" are used for descriptive purposes only and are not to be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features. In the description of the present invention, unless otherwise specified, "plurality" means two or more.
[0105] In the description of the present invention, it should be noted that, unless otherwise clearly specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium, or it can be the internal communication of two components. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0106] like Figure 1 As shown, an embodiment of the present invention provides an automatic diagnosis system for Crohn's disease based on capsule endoscopy video, including: a video acquisition module, a small intestine video recognition module, a small intestine lesion detection module, a target video frame extraction module, and a Crohn's disease recognition module;
[0107] The video acquisition module is used to acquire the whole target capsule endoscopy video;
[0108] Specifically, the above-mentioned full-course target capsule endoscopy video is a capsule endoscopy video of a patient for detecting Crohn's disease.
[0109] The small intestine video recognition module is used to classify the full-course target capsule endoscopy video according to a preset video classification model, and extract the small intestine segment video of the full-course target capsule endoscopy image;
[0110] In the above-mentioned full-course target capsule endoscopy video, the digestive tract includes the stomach video segment, the small intestine video segment and the large intestine video segment in order. Due to the gravity factor, the capsule endoscope moves faster in the stomach video segment, and the stomach video segment is generally not related to the diagnosis of Crohn's disease; there are many residues in the large intestine segment video and the imaging quality is poor; the small intestine segment video is relatively clear, and Crohn's disease often occurs in the small intestine segment. Therefore, the diagnosis of Crohn's disease requires the small intestine segment video to be separated from the above-mentioned full-course target capsule endoscopy video; wherein, the above-mentioned stomach video segment is the video from the starting point of the above-mentioned full-course target capsule endoscopy video to the end of the stomach, the above-mentioned small intestine video segment is the video from the pylorus to the end of the ileocecal valve, and the above-mentioned large intestine video segment is the video from the ileocecal valve to the end of the above-mentioned full-course target capsule endoscopy video.
[0111] By observing images of the intestines in different parts of the digestive tract, it was found that there are certain differences in the mucosa of the stomach, small intestine, and large intestine.
[0112] Therefore, in a preferred embodiment, the above-mentioned full-course target capsule endoscopy video is identified according to a preset video classification model, and the small intestine segment video of the above-mentioned full-course target capsule endoscopy image is extracted, including:
[0113] According to the preset video classification model, the normalized classification probabilities of the stomach segment video, the small intestine segment video and the large intestine segment video in the full-course target capsule endoscopy video are obtained;
[0114] According to the binary search algorithm and the above classification probability, the starting image frame and the ending image frame of the above small intestine segment video are calculated, and then the small intestine segment video of the above full-course target capsule endoscopy image is obtained.
[0115] The above video classification model is provided with an image encoder, a filter, a high-frequency information encoder and a Transformer;
[0116] The above-mentioned normalized classification probabilities of the stomach segment video, the small intestine segment video, and the large intestine segment video in the above-mentioned full-course target capsule endoscopy video are obtained according to the above-mentioned preset video classification model, including:
[0117] Using the image encoder to extract the first feature of each frame of the full-course target capsule endoscopy video;
[0118] Using the above filter to extract high-frequency information of each frame of the above image;
[0119] Extracting a second feature of the high-frequency information using the high-frequency information encoder;
[0120] Adding the second feature to the first feature to obtain a third feature corresponding to each frame of the image;
[0121] Input the third feature of each frame of the image and the third features of the 2N frames of images adjacent to the left and right thereof into the Transformer to obtain a fused fourth feature;
[0122] The fourth feature is concatenated, the classification probability is calculated, and the classification probability is normalized to obtain the normalized classification probability:
[0123] ;
[0124] ;
[0125] In the formula, represents the above classification probability, represents the normalized classification probability, This represents the fourth feature mentioned above.
[0126] The training of the above video classification model includes:
[0127] Acquire a plurality of first video frames with first real labels, wherein the first real labels are used to indicate the categories corresponding to the first video frames; the categories of the first video frames include: video frames of the stomach, video frames of the small intestine, or video frames of the large intestine;
[0128] For each frame of the first video frame, input the first video frame into the video classification model to be trained to obtain the classification probability that the first video frame is recognized as stomach, small intestine or large intestine by the video classification model; calculate the value of the first loss function according to the classification probability, the first true label corresponding to the classification probability and the cross entropy loss function formula;
[0129] After each calculation to obtain a value of the first loss function, determine whether the first loss function converges, if so, determine that the training of the video classification model to be trained is completed, if not, continue to train the video classification model to be trained;
[0130] Among them, the above cross entropy loss function formula is as follows:
[0131] ;
[0132] In the formula, Represents the one-hot vector corresponding to the first true label of each frame image. They represent the classification probability of the t-th frame image being predicted as stomach, small intestine or large intestine, respectively. They respectively represent the one-hot vector corresponding to the first true label of the t-th frame image.
[0133] According to the binary search algorithm and the normalized classification probability, the dividing point between the small intestine segment and the stomach and large intestine segment videos is calculated, and then the small intestine segment video of the full-course target capsule endoscopy image is obtained, including:
[0134] For the above-mentioned full-course target capsule endoscopy image, frame numbers are set from small to large frame by frame from the start frame to the end frame;
[0135] The midpoint image frame of the whole target capsule endoscopy image is used as the initial search position. If the predicted category of the midpoint image frame is the small intestine or the large intestine, the search is started in the direction of decreasing frame number. Otherwise, the search is started in the direction of increasing frame number until the first search step is less than 1.
[0136] The search position when the first search step length is less than 1 is determined as the starting point of the small intestine segment video;
[0137] The midpoint image frame of the whole target capsule endoscopy image is used as the initial search position. If the predicted category of the midpoint image frame is stomach or small intestine, the search starts in the direction of increasing frame number. Otherwise, the search starts in the direction of decreasing frame number until the second search step length is less than 1.
[0138] The search position when the second search step length is less than 1 is determined as the end point of the small intestine segment video;
[0139] Perform video extraction according to the starting point and the ending point of the small intestine segment video to obtain the small intestine segment video of the full-course target capsule endoscopy image;
[0140] Among them, when searching, the distance to the next search step is calculated according to the classification probability of the currently searched video frame and the step formula;
[0141] The above step size formula is:
[0142] ;
[0143] ;
[0144] In the formula, Indicates the predicted category of the current video frame, They represent the stomach, small intestine, and large intestine. represents the classification probability of the stomach, small intestine and large intestine respectively, d represents the initial step length, is a constant, is a constant, α is the preset decay rate, Represents the classification probability corresponding to the predicted category of the current video frame, Indicates the search step size.
[0145] Preferably, ResNet is used as the above-mentioned image encoder and the above-mentioned high-frequency information encoder, and a Gaussian filter is used as the above-mentioned filter.
[0146] Specifically, an image encoder is used to extract the first feature of each frame of the above-mentioned full-course target capsule endoscopy video:
[0147] ;
[0148] In the formula, Represents each frame of the above-mentioned full-course target capsule endoscopy video, represents the image encoder, Represents the above-mentioned first feature; wherein the above-mentioned first feature is used to classify the stomach segment video, small intestine segment video and large intestine segment video in the above-mentioned full-course target capsule endoscopy video.
[0149] The high-frequency information of each frame of the above image is extracted using the above filter through the following formula:
[0150] ;
[0151] In the formula, Indicates the above high frequency information;
[0152] The second feature of the high frequency information is extracted using the high frequency information encoder through the following formula:
[0153] ;
[0154] In the formula, Indicates the second characteristic mentioned above;
[0155] The third feature corresponding to each frame of the image is obtained by adding the second feature to the first feature through the following formula:
[0156] ;
[0157] In the formula, Indicates the third characteristic mentioned above;
[0158] The third feature of each frame image and the third features of the 2N frames of images adjacent to its left and right are input into the above Transformer through the following formula to obtain the fused fourth feature:
[0159] ;
[0160] In the formula, Represents the third feature of each frame image and the third features of the 2N frames of images adjacent to it on the left and right. This represents the fourth feature mentioned above.
[0161] Schematically, the structural diagram of the above video classification model is as follows Figure 2 As shown, it can be seen that the first feature obtained by the image encoder and the second feature obtained by the filter and the high-frequency encoder for each frame image of the above-mentioned full-course target capsule endoscopy video are added to obtain the above-mentioned third feature, and then the above-mentioned third feature is passed through a sliding window, and each frame is fused with the third features corresponding to the 2N frames adjacent to its left and right, and the above-mentioned fourth feature after fusion is spliced, and then trained through the loss function to obtain the above-mentioned classification probability of the three categories of the above-mentioned video classification model, and finally the small intestine segment video is obtained.
[0162] Preferably, the initial value of the basic step length is half the length of the video frame of the full-course target capsule endoscopy video, and the value of α is set to 0.9.
[0163] Schematically, the algorithm for finding the starting point of the small intestine segment video is as follows Figure 3 As shown, first input the above-mentioned full-course target capsule endoscopy video, wherein the initial video frame number is at the midpoint frame position of the above-mentioned full-course target capsule endoscopy video, the video frame number is represented by t, the initial step length is half of the above-mentioned full-course target capsule endoscopy video, the initial step length is represented by d, if the current frame is classified as stomach, the formula is used to increase the direction of the video frame number to search for the step length To update the search position, determine the video frame number of the new position, if the current frame is classified as small intestine or large intestine, use the formula to reduce the video frame number in the direction of the search step length To repeatedly update the search position, determine the video frame number of the new position, until the search step is less than 1, and regard the video frame number at this time as the number of the start frame of the small intestine, where the start frame number of the small intestine is Indicates that the starting point of the small intestine segment video is then obtained.
[0164] Schematically, the algorithm for finding the end point of the small intestine segment video is as follows Figure 4 As shown, first input the above-mentioned full-course target capsule endoscopy video, wherein the initial video frame number is at the midpoint frame position of the above-mentioned full-course target capsule endoscopy video, the video frame number is represented by t, the initial step length is half of the above-mentioned full-course target capsule endoscopy video, the initial step length is represented by d, if the current frame is classified as stomach or small intestine, the formula is used to increase the direction of the video frame number to search the step length To update the search position, determine the video frame number of the new position, if the current frame is classified as large intestine, use the formula to decrease the video frame number in the direction of the step length To repeatedly update the search position, determine the video frame number of the new position, until the search step is less than 1, and regard the video frame number at this time as the number of the end frame of the small intestine, where the end frame number of the small intestine is Indicates that the end point of the small intestine segment video is then obtained.
[0165] In this preferred embodiment, a Gaussian filter is used to extract the high-frequency information, and then the second feature of the high-frequency information is extracted, so that the texture information of the image can be better captured. By fusing each frame of the full-course target capsule endoscopy video with the fourth feature corresponding to the 2N frames adjacent to its left and right, the disadvantage that the video image may be blocked, resulting in the inability to capture the mucosa and thus reducing the classification accuracy is effectively alleviated. Setting it as a constant can make the above algorithm results converge better to the start frame and end frame of the small intestine. Setting it to a constant can avoid the situation where the search step size is 0 and causes early stopping.
[0166] In this embodiment of the present invention, the target capsule endoscopy video is classified by a preset video classification model, and the small intestine segment video of the full-course target capsule endoscopy image is obtained by the binary search algorithm and the classification probability.
[0167] The small intestinal lesion detection module is used to extract features from each video frame in the small intestinal segment video according to a preset small intestinal lesion detection model, and determine the probability of the presence of lesions in each video frame according to the extracted features;
[0168] Since there are tens of thousands of frames in the small intestine video, it is time-consuming and laborious for doctors to manually find the frames with lesions.
[0169] Therefore, in a preferred embodiment, feature extraction is performed on each video frame in the above-mentioned small intestine segment video according to a preset small intestine lesion detection model, and the probability of the presence of a lesion in each video frame is determined according to the extracted features, including:
[0170] Extracting a fifth feature of each video frame in the small intestine segment video according to the preset small intestine lesion detection model;
[0171] The fifth feature is input into the fully connected layer to obtain a vector indicating whether each video frame in the small intestine segment video contains a lesion;
[0172] Normalizing the above vector to obtain a first probability vector of whether each video frame in the above small intestine segment video contains a lesion;
[0173] The probability of a lesion existing in each video frame is determined according to the first probability vector.
[0174] The training of the above-mentioned small intestinal lesion detection model includes:
[0175] Acquire a plurality of second video frames with second real labels, wherein the second real labels are used to indicate whether the small intestine corresponding to the second video frame has a lesion;
[0176] For each frame of the second video frame, input the second video frame into the small intestinal lesion detection model to be trained to obtain a second probability that the second video frame is detected by the small intestinal lesion detection model as having a lesion; and calculate the value of the second loss function according to the second probability and the corresponding second true label;
[0177] After each calculation to obtain a value of the second loss function, it is determined whether the second loss function converges. If so, it is determined that the training of the small intestinal lesion detection model to be trained is completed. If not, the training of the small intestinal lesion detection model to be trained continues.
[0178] Preferably, the above-mentioned small intestinal lesion detection model is a ResNet34 model.
[0179] Specifically, through the above-mentioned small intestine lesion detection model, the following formula is used to extract features from each video frame in the above-mentioned small intestine segment video:
[0180] ;
[0181] In the formula, represents the video frame in the above small intestine segment, Indicates the fifth characteristic mentioned above;
[0182] The fifth feature is input into the fully connected layer through the following formula to obtain a vector of length 2:
[0183] ;
[0184] In the formula, represents the above vector;
[0185] The above vector is normalized by the Softmax function through the following formula to obtain a first probability vector of length 2 for whether each video frame in the above small intestine segment video contains a lesion, and then the probability of the presence of a lesion in each video frame is obtained:
[0186] ;
[0187] In the formula, represents the above first probability vector.
[0188] In this embodiment of the present invention, a preset small intestine lesion detection model is used to perform feature extraction on each video frame in the above-mentioned small intestine segment video to obtain the above-mentioned fifth feature, and the probability of the existence of lesions in each video frame is determined based on the above-mentioned fifth feature.
[0189] The target video frame extraction module is used to divide the small intestine segment video into several video segments on average, and for each video segment, select several video frames with the highest probability of the presence of lesions in the video as target video frames;
[0190] Since the small intestine segment video has tens of thousands of frames, it is unrealistic to input the entire small intestine segment video into the network for prediction. Therefore, in a preferred embodiment, the small intestine segment video is evenly divided into several video segments. For each video segment, several video frames with the highest probability of the presence of lesions in the video are used as target video frames, including:
[0191] The above-mentioned small intestine segment video is evenly divided into 4 video segments. For each video segment, the 500 video frames with the highest probability of the existence of lesions in the video are used as target video frames.
[0192] All target video frames are input into a preset Crohn's disease recognition model, so that the Crohn's disease recognition model determines the diagnosis result of Crohn's disease according to the target video frames, including:
[0193] Input the target video frame into a preset Crohn's disease recognition model; wherein the preset Crohn's disease recognition model includes: a first layer Transformer, a second layer Transformer, and a fully connected layer;
[0194] The sixth features of the 500 target video frames of each of the four videos are fused through the first layer of Transformer to obtain the first output feature of the four output first feature sequences after the fusion of the four videos;
[0195] Input the first output feature into the second layer Transformer to obtain the first output vector of four output second feature sequences;
[0196] The first output vector is input into the fully connected layer and normalized to obtain a diagnosis result of Crohn's disease.
[0197] The construction of the above-mentioned Crohn's disease recognition model includes:
[0198] Acquire a plurality of third video frames with third real labels, wherein the third real labels are used to indicate whether there is a Crohn's disease lesion in the small intestine of the third video frame;
[0199] For each of the third video frames, input the third video frame into the Crohn's disease recognition model to be trained to obtain a third probability that the third video frame is recognized as having Crohn's disease by the Crohn's disease recognition model; and calculate a value of a third loss function according to the third probability and the corresponding third true label;
[0200] Each time a value of the third loss function is calculated, it is determined whether the third loss function converges, until the third loss function converges, and the Crohn's disease recognition model at this time is determined as the preset Crohn's disease recognition model.
[0201] Indicatively, Figure 5As shown, the fifth feature of the 500 target video frames of each of the four videos is obtained through the ResNet34 model and input into the first layer Transformer to obtain the first output feature of the four output first feature sequences after the fusion of the four videos. Then, the first output feature is input into the second layer Transformer to obtain the first first output vector TF1 of the four output second feature sequences. Then, the four first output vectors TF1 are input into the fully connected layer and normalized to obtain the second output vector TF2, and then the diagnosis result of Crohn's disease is obtained.
[0202] Specifically, the sixth features of the 500 target video frames of the above four videos are fused in the above first-layer Transformer through the following formula to obtain four output first feature sequences after the fusion of the four videos:
[0203] ;
[0204] In the formula, The sixth feature of the 500 target video frames of each of the four videos before fusion, It represents the 4 output first feature sequences after the fusion of the above 4 videos;
[0205] The first output features of the above four output first feature sequences are input into the above second layer Transformer through the following formula to obtain the first first output vectors of the four output second feature sequences:
[0206] ;
[0207] In the formula, represents the first output feature of the first output sequence, represents the first output feature of the second output sequence, represents the first output feature of the third output sequence, represents the first output feature of the 4th output sequence, Represents the first output vector of the second feature sequence. Represents the second first output vector of the output second feature sequence, Represents the third first output vector of the output second feature sequence, Represents the fourth first output vector of the output second feature sequence;
[0208] The first output vector is input into the fully connected layer and normalized by the following formula to obtain the diagnosis result of Crohn's disease:
[0209] ;
[0210] ;
[0211] Wherein, o represents the vector after being connected by the fully connected layer, and p represents the second output vector mentioned above, wherein the length of p is 2, the first value of p represents the probability of predicting a lesion without Crohn's disease, and the second value of p represents the probability of predicting a lesion with Crohn's disease.
[0212] In this embodiment of the present invention, the small intestine segment video is evenly divided into 4 video segments. For each video segment, the 500 video frames with the highest probability of the presence of lesions in the video are used as target video frames. Subsequently, all target video frames are input into a preset Crohn's disease recognition model, so that the Crohn's disease recognition model determines the diagnosis result of Crohn's disease based on the target video frames, thereby realizing the diagnosis of Crohn's disease using a small number of frames in a video segment.
[0213] The above-mentioned automatic diagnosis system for Crohn's disease based on capsule endoscopy video also includes: a small intestinal lesion positioning module;
[0214] The above-mentioned small intestinal lesion positioning module is used to obtain a lesion positioning map in the small intestinal segment video according to a preset small intestinal lesion positioning model;
[0215] The construction of the above-mentioned small intestinal lesion localization model includes:
[0216] Acquire a plurality of fourth video frames with fourth real labels, wherein the fourth real labels are used to indicate whether the small intestine corresponding to the fourth video frame has a lesion;
[0217] For each of the fourth video frames, the fourth video frame is input into the small intestine lesion localization model to be trained to obtain a first prediction score of whether there is a lesion or no lesion in each of the fourth video frames, and a value of a fourth loss function is calculated according to the first prediction score, a fourth true label corresponding to the first prediction score, a cross entropy loss supervision function, and a background suppression loss supervision function;
[0218] After each calculation to obtain a value of the fourth loss function, it is determined whether the fourth loss function converges. If so, it is determined that the training of the small intestinal lesion localization model to be trained is completed. If not, the training of the small intestinal lesion localization model to be trained continues.
[0219] Among them, the above cross entropy loss supervision function is as follows:
[0220] ;
[0221] ;
[0222] Where y represents the true label of the video frame of the above small intestine segment video, Indicates the probability of whether the lesion appears in the foreground localization map, Indicates the probability of whether the lesion appears in the background localization map, Indicates the probability of whether the background appears in the foreground positioning map, Indicates the probability of whether the background appears in the background positioning map;
[0223] The above background suppression loss supervision function is as follows:
[0224] ;
[0225] ;
[0226] In the formula, represents the foreground activation score, represents the background activation fraction, Represents a constant.
[0227] Since the location of the lesion in the lesion frame can help doctors quickly find the location of the lesion and assist doctors in diagnosis. However, the current data set does not have an annotation of the lesion location, only label information of whether it is a lesion, so this embodiment of the present invention locates the lesion location in a weakly supervised scenario, that is, a scenario with only label information.
[0228] Therefore, in a preferred embodiment, the small intestinal lesion localization model includes a Softmax layer and a convolution layer; for each of the fourth video frames, the fourth video frame is input into the small intestinal lesion localization model to be trained, and a first prediction score of whether there is a lesion or no lesion in each of the fourth video frames is obtained, including:
[0229] According to the preset small intestine lesion detection model, a sixth feature of each frame of the small intestine segment video is obtained;
[0230] The sixth feature is expanded in the spatial dimension to obtain the foreground feature and background feature after the sixth feature is expanded in the spatial dimension:
[0231] According to the foreground features and background features, a foreground aggregator and a background aggregator are obtained through the Softmax layer and the convolution layer;
[0232] Aggregating the sixth feature with the foreground aggregator and the background aggregator to obtain a foreground feature corresponding to the foreground part and a background feature corresponding to the background part;
[0233] The foreground features and the background features are respectively input into a foreground classifier and a background classifier to calculate a first prediction score of whether there is a lesion or not.
[0234] The above-mentioned lesion location map in the small intestine segment video is obtained based on the preset small intestine lesion location model, including:
[0235] According to the preset small intestine lesion localization model, a second prediction score of the video frame with lesions in the small intestine segment video is obtained;
[0236] The average value of the partial derivative of each pixel point of each channel of the sixth feature is calculated according to the second prediction score, the sixth feature and the following formula:
[0237] ;
[0238] In the formula, represents the second prediction score mentioned above, Represents each channel and each pixel of the sixth feature above, represents the above average value;
[0239] According to the above average value and the channel of the sixth characteristic, the above lesion localization map is obtained by the following formula:
[0240] ;
[0241] In the formula, The above lesion localization map is shown. Represents the kth channel of the sixth feature mentioned above.
[0242] Specifically, the sixth feature of each frame of the small intestine segment video is obtained according to the preset small intestine lesion detection model through the following formula:
[0243] ;
[0244] Wherein, I represents the above-mentioned small intestine segment video, and Z represents the above-mentioned sixth feature;
[0245] The sixth feature is expanded in the spatial dimension by the following formula to obtain the foreground feature and background feature after the sixth feature is expanded in the spatial dimension:
[0246] ;
[0247] ;
[0248] In the formula, represents the above prospect characteristics, represents the above background features, M represents the number of channels of the feature, and N represents the number of pixels of the feature;
[0249] According to the foreground features and background features, the foreground aggregator and the background aggregator are obtained through the above Softmax layer and the above convolution layer through the following formula:
[0250] ;
[0251] ;
[0252] In the formula, represents the above foreground aggregator, represents the above background aggregator;
[0253] The sixth feature is aggregated with the foreground aggregator and the background aggregator by the following formula to obtain a foreground feature corresponding to the foreground part and a background feature corresponding to the background part:
[0254] ;
[0255] ;
[0256] In the formula, represents the above prospect characteristics, Indicates the above background characteristics;
[0257] The foreground features and the background are respectively input into the foreground classifier and the background classifier through the following formulas, and the probability of the lesion appearing in the foreground positioning map, the probability of the lesion appearing in the background positioning map, the probability of the background appearing in the foreground positioning map, and the probability of the background appearing in the background positioning map are calculated:
[0258] ;
[0259] ;
[0260] In the formula, Indicates the probability of whether the lesion appears in the foreground localization map, Indicates the probability of whether the lesion appears in the background localization map, Indicates the probability of whether the background appears in the foreground positioning map, Indicates the probability of whether the background appears in the background positioning map. The value of C is 2, which indicates the number of categories.
[0261] Since whether the lesion appears in the foreground positioning map depends on whether the video frame itself has a lesion, the lesion will not appear in the background positioning map, and the background and foreground are in an opposite relationship. Therefore, in a preferred embodiment, To use the real labels of video frames To supervise, Use zero vectors for supervision, To use To supervise, Use a vector to supervise, and the supervised loss function used is cross entropy loss. The supervised loss function is as follows:
[0262] ;
[0263] ;
[0264] Since it was found in previous studies that if only cross entropy loss is used for supervision, the model can only locate part of the lesions, in a preferred embodiment, background suppression loss is added to further suppress the background:
[0265] First and The activation scores of the foreground and background are regarded as the activation scores, and their means are calculated and then input into the activation function to obtain the foreground activation score and the background activation score:
[0266] ;
[0267] In the formula, represents the above foreground activation score, represents the above background activation score;
[0268] Then the following formula is used to reduce and Ratio:
[0269] ;
[0270] In the formula, Represents a small constant.
[0271] Specifically, the sixth feature is used to detect whether there is lesion in the small intestine, which is different from the first feature.
[0272] Schematically, the training process diagram of the above-mentioned small intestinal lesion localization model is as follows Figure 6 As shown, firstly, the image of the small intestine segment video is input into the small intestine lesion localization model, and the sixth feature of the image is extracted by using the ResNet small intestine lesion detection model. Then, the convolution layer and the Softmax layer in the small intestine lesion localization model are used to obtain the foreground aggregator and the background aggregator respectively. Then, the obtained foreground aggregator and the background aggregator are respectively aggregated with the sixth feature to obtain the foreground feature and the background feature. Then, the foreground feature and the background feature are input into the foreground classifier. and background classifier The probability of the lesion appearing in the foreground positioning map, the probability of the lesion appearing in the background positioning map, the probability of the background appearing in the foreground positioning map, and the probability of the background appearing in the background positioning map are obtained. Finally, the probability of the lesion appearing in the foreground positioning map and the probability of the background appearing in the foreground positioning map are regarded as the foreground activation score and the background activation score, respectively. Their means are calculated respectively, and then the means are input into the ReLU activation function to obtain the final foreground activation score. and background activation score .
[0273] In this preferred embodiment, through the above-mentioned preset small intestinal lesion localization model, it is possible to locate the lesion position of Crohn's disease in the target video frame in a scenario where the target video frame only has label information on whether it is a lesion, and use the ReLU function to make the pixel point range of the above-mentioned lesion localization map between 0 and 1, including 0 and 1.
[0274] In this embodiment of the present invention, the second prediction score of the video frame with lesions in the small intestine segment is obtained by the above-mentioned preset small intestine lesion localization model, and the above-mentioned second prediction score is combined with the above-mentioned sixth feature to calculate the average value of the partial derivative of each pixel point of each channel of the above-mentioned sixth feature, and then the above-mentioned lesion localization map is calculated based on the above-mentioned average value and the channel of the above-mentioned sixth feature.
[0275] The above are preferred embodiments of the present invention. It should be pointed out that, for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention. These improvements and modifications are also considered to be within the scope of protection of the present invention.
Claims
1. An automatic diagnosis system for Crohn's disease based on capsule endoscopy video, characterized in that: include: Video acquisition module, small intestine video recognition module, small intestine lesion detection module, target video frame extraction module, Crohn's disease recognition module; The video acquisition module is used to acquire the whole target capsule endoscopy video; The small intestine video recognition module is used to classify the full-course target capsule endoscopy video according to a preset video classification model, and extract the small intestine segment video of the full-course target capsule endoscopy image; The small intestine lesion detection module is used to extract features from each video frame in the small intestine segment video according to a preset small intestine lesion detection model, and determine the probability of the presence of lesions in each video frame according to the extracted features; The target video frame extraction module is used to divide the small intestine segment video into several video segments on average, and for each video segment, several video frames with the highest probability of the presence of lesions in the video are used as target video frames; wherein the small intestine segment video is divided into 4 video segments on average, and for each video segment, 500 video frames with the highest probability of the presence of lesions in the video are used as target video frames; The Crohn's disease recognition module is used to input all target video frames into a preset Crohn's disease recognition model, so that the Crohn's disease recognition model determines the diagnosis result of Crohn's disease according to the target video frames; Inputting the target video frame into a preset Crohn's disease recognition model; The preset Crohn's disease recognition model includes: a first layer Transformer, a second layer Transformer and a fully connected layer; the sixth feature of the 500 target video frames of each of the four videos is fused through the first layer Transformer to obtain the first output feature of the four output first feature sequences after the fusion of the four videos; the first output feature is input to the second layer Transformer to obtain the first first output vector of the four output second feature sequences; the first first output vector is input to the fully connected layer and normalized to obtain the diagnosis result of Crohn's disease; according to the preset small intestinal lesion detection model, the sixth feature of each frame of the small intestinal segment video is obtained; The construction of the Crohn's disease recognition model includes: Acquire a plurality of third video frames with third real labels; wherein the third real labels are used to indicate whether there is a Crohn's disease lesion in the small intestine of the third video frame; For each of the third video frames, input the third video frame into the Crohn's disease recognition model to be trained to obtain a third probability that the third video frame is recognized as having Crohn's disease by the Crohn's disease recognition model; and calculate a value of a third loss function according to the third probability and the corresponding third true label; Each time a value of the third loss function is calculated, it is determined whether the third loss function converges, until the third loss function converges, and the Crohn's disease recognition model at this time is determined as the preset Crohn's disease recognition model.
2. The automatic Crohn's disease diagnosis system based on capsule endoscopy video according to claim 1, characterized in that: The step of identifying the whole-course target capsule endoscopy video according to a preset video classification model and extracting the small intestine segment video of the whole-course target capsule endoscopy image comprises: According to the preset video classification model, the normalized classification probabilities of the stomach segment video, the small intestine segment video, and the large intestine segment video in the full-course target capsule endoscopy video are obtained; According to the binary search algorithm and the normalized classification probability, the starting image frame and the ending image frame of the small intestine segment video are calculated, and then the small intestine segment video of the full-course target capsule endoscopy image is obtained.
3. The automatic Crohn's disease diagnosis system based on capsule endoscopy video according to claim 2, characterized in that: The video classification model is provided with an image encoder, a filter, a high-frequency information encoder and a Transformer; The step of obtaining normalized classification probabilities of the stomach segment video, the small intestine segment video, and the large intestine segment video in the full-course target capsule endoscopy video according to the preset video classification model includes: Using the image encoder to extract a first feature of each frame of the full-course target capsule endoscopy video; wherein the first feature is used to classify the stomach segment video, the small intestine segment video, and the large intestine segment video in the full-course target capsule endoscopy video; Using the filter to extract high-frequency information of each frame of image; extracting a second feature of the high-frequency information using the high-frequency information encoder; Adding the second feature to the first feature to obtain a third feature corresponding to each frame of image; Input the third feature of each frame image and the third features of the 2N frames of images adjacent to its left and right sides into the Transformer to obtain a fused fourth feature; The fourth features are concatenated, the classification probability is calculated, and the classification probability is normalized to obtain the normalized classification probability: ; ; In the formula, represents the classification probability, represents the normalized classification probability, This represents the fourth feature.
4. The automatic Crohn's disease diagnosis system based on capsule endoscopy video according to claim 3, characterized in that: The training of the video classification model includes: Acquire a plurality of first video frames with first real labels; wherein the first real labels are used to indicate the categories corresponding to the first video frames; the categories of the first video frames include: video frames of the stomach, video frames of the small intestine, or video frames of the large intestine; For each frame of the first video frame, input the first video frame into the video classification model to be trained to obtain the classification probability that the first video frame is recognized by the video classification model as stomach, small intestine or large intestine; calculate the value of the first loss function according to the classification probability, the first true label corresponding to the classification probability and the cross entropy loss function formula; After each calculation to obtain a value of the first loss function, determine whether the first loss function converges, if so, determine that the training of the video classification model to be trained is completed, if not, continue to train the video classification model to be trained; Among them, the cross entropy loss function formula is as follows: ; In the formula, Represents the one-hot vector corresponding to the first true label of each frame image, They represent the classification probability of the t-th frame image being predicted as stomach, small intestine or large intestine, respectively. They respectively represent the one-hot vector corresponding to the first true label of the t-th frame image.
5. The automatic Crohn's disease diagnosis system based on capsule endoscopy video according to claim 4, characterized in that: The step of calculating the demarcation point between the small intestine segment and the stomach and large intestine segment videos according to the binary search algorithm and the normalized classification probability, and then obtaining the small intestine segment video of the full-course target capsule endoscopy image, includes: For the whole target capsule endoscopy image, frame numbers are set from small to large frame by frame from the start frame to the end frame; The midpoint image frame of the whole target capsule endoscopy image is used as the initial search position. If the predicted category of the midpoint image frame is the small intestine or the large intestine, the search is started in the direction of decreasing frame number. Otherwise, the search is started in the direction of increasing frame number until the first search step is less than 1. Determine the search position when the first search step length is less than 1 as the starting point of the small intestine segment video; The midpoint image frame of the whole target capsule endoscopy image is used as the initial search position. If the predicted category of the midpoint image frame is stomach or small intestine, the search starts in the direction of increasing frame number; otherwise, the search starts in the direction of decreasing frame number until the second search step length is less than 1; Determine the search position when the second search step length is less than 1 as the end point of the small intestine segment video; Performing video extraction according to the starting point and the ending point of the small intestine segment video to obtain the small intestine segment video of the entire target capsule endoscopy image; Among them, when searching, the distance to the next search step is calculated according to the classification probability of the currently searched video frame and the step formula; The step length formula is: ; ; In the formula, Indicates the predicted category of the current video frame, They represent the stomach, small intestine, and large intestine. represents the classification probability of the stomach, small intestine and large intestine respectively, d represents the initial step length, is a constant, is a constant, α is the preset decay rate, Represents the classification probability corresponding to the predicted category of the current video frame, Indicates the search step size.
6. The automatic Crohn's disease diagnosis system based on capsule endoscopy video according to claim 5, characterized in that: Extracting features from each video frame in the small intestine segment video according to a preset small intestine lesion detection model, and determining the probability of a lesion existing in each video frame according to the extracted features, including: According to the preset small intestinal lesion detection model, the fifth feature of each video frame in the small intestinal segment video is extracted; wherein the preset small intestinal lesion detection model includes: a fully connected layer; Inputting the fifth feature into the fully connected layer to obtain a vector indicating whether each video frame in the small intestine segment video contains a lesion; Normalizing the vector to obtain a first probability vector of whether each video frame in the small intestine segment video contains a lesion; The probability of a lesion existing in each video frame is determined according to the first probability vector.
7. The automatic Crohn's disease diagnosis system based on capsule endoscopy video according to claim 6, characterized in that: The training of the small intestinal lesion detection model includes: Acquire a plurality of second video frames with second real labels, wherein the second real labels are used to indicate whether there is a lesion in the small intestine corresponding to the second video frame; For each frame of the second video frame, input the second video frame into the small intestinal lesion detection model to be trained to obtain a second probability that the second video frame is detected by the small intestinal lesion detection model as having a lesion; and calculate the value of the second loss function according to the second probability and the corresponding second true label; After each calculation to obtain a value of the second loss function, it is determined whether the second loss function converges. If so, it is determined that the training of the small intestinal lesion detection model to be trained is completed. If not, the training of the small intestinal lesion detection model to be trained continues.
8. The automatic Crohn's disease diagnosis system based on capsule endoscopy video according to claim 7, characterized in that: Also includes: Small bowel lesion localization module; The small intestinal lesion positioning module is used to obtain a lesion positioning map in the small intestinal segment video according to a preset small intestinal lesion positioning model; According to the preset small intestine lesion localization model, a second prediction score of the video frame having the lesion in the small intestine segment video is obtained; The average value of the partial derivative of each pixel point of each channel of the sixth feature is calculated according to the second prediction score, the sixth feature and the following formula: ; In the formula, represents the second prediction score, Represents each channel and each pixel of the sixth feature, represents said average value; According to the average value and the channel of the sixth feature, the lesion localization map is obtained by the following formula: ; In the formula, represents the lesion localization map, a k-th channel representing the sixth feature; The construction of the small intestinal lesion localization model includes: Acquire a plurality of fourth video frames with fourth real labels, wherein the fourth real labels are used to indicate whether the small intestine corresponding to the fourth video frame has a lesion; For each of the fourth video frames, input the fourth video frame into the small intestine lesion localization model to be trained, obtain a first prediction score of whether there is a lesion or no lesion in each of the fourth video frames, and calculate the value of a fourth loss function according to the first prediction score, a fourth true label corresponding to the first prediction score, a cross entropy loss supervision function, and a background suppression loss supervision function; After each calculation to obtain a value of the fourth loss function, determine whether the fourth loss function converges, if so, determine that the training of the small intestinal lesion localization model to be trained is completed, if not, continue to train the small intestinal lesion localization model to be trained; Among them, the cross entropy loss supervision function is as follows: ; ; Where y represents the true label of the video frame of the small intestine segment video, Indicates the probability of whether the lesion appears in the foreground localization map, Indicates the probability of whether the lesion appears in the background localization map, Indicates the probability of whether the background appears in the foreground positioning map, Indicates the probability of whether the background appears in the background positioning map; The background suppression loss supervision function is as follows: ; ; In the formula, represents the foreground activation score, represents the background activation fraction, Represents a constant.
9. The automatic Crohn's disease diagnosis system based on capsule endoscopy video according to claim 8, characterized in that: The small intestinal lesion localization model includes a Softmax layer and a convolution layer; For each of the fourth video frames, inputting the fourth video frame into the small intestine lesion localization model to be trained to obtain a first prediction score of whether there is a lesion or no lesion in each of the fourth video frames, including: According to the preset small intestine lesion detection model, a sixth feature of each frame of the small intestine segment video is obtained; Expanding the sixth feature in the spatial dimension to obtain a foreground feature and a background feature after the sixth feature is expanded in the spatial dimension; According to the foreground features and the background features, a foreground aggregator and a background aggregator are obtained through the Softmax layer and the convolution layer; Aggregating the sixth feature with the foreground aggregator and the background aggregator to obtain a foreground feature corresponding to the foreground part and a background feature corresponding to the background part; The foreground feature and the background feature are input into a foreground classifier and a background classifier respectively, and a first prediction score of whether there is a lesion or not is calculated.
