Endoscopic image processing method, device, electronic device and readable storage medium
By combining current and historical recognition results in the endoscopic image processing method for continuity detection and part interval detection, the problems of non-standard images and recognition model reasoning errors in endoscopy are solved, and the accuracy and accuracy of the recognition results are improved. Stability ensures that users receive continuous and accurate inspection information.
Patent Information
- Application Number
- CN202110633080.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-06-07
- Publication Date
- 2024-10-15
- Estimated Expiration
- 2041-06-07
AI Technical Summary
During endoscopic gastrointestinal examination, non-standard images and recognition model inference errors lead to low accuracy of recognition results and unstable results, affecting the accuracy of user inspections.
By obtaining the current image and inputting the recognition model, we perform continuity detection based on historical recognition results to determine whether the current recognition result is continuous. If it passes, the image is output; if it is not continuous, perform part interval detection, update the interval switching parameters, and determine whether the switching conditions are met. , if satisfied, the continuity detection is determined to avoid unstable recognition results.
It improves the accuracy and stability of the output recognition results, ensures that users obtain continuous and accurate recognition information during the inspection process, and reduces the interference of recognition results.
Smart Images

Figure CN115511770B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing technology, and in particular to an endoscopic image processing method, an endoscopic image processing device, an electronic device, and a computer-readable storage medium. Background Art
[0002] During endoscopic upper gastrointestinal examination, the user operates the endoscope to examine the specified parts in the "Standardized Operating Procedures for Upper Gastrointestinal Endoscopic Examination". In order to assist users in completing the examination better, relevant technologies can identify and output the examination parts recorded in the image, so that users can intuitively understand the current location being examined. However, during the examination, the position of the endoscope and human tissue will change all the time, making the image non-standard, and the recognition model has reasoning errors, so the accuracy of the image recognition results is low, causing the output information to interfere with the user's examination. In addition, correct results and incorrect results usually appear and are output alternately, making the recognition results unstable, which also interferes with the user. Summary of the invention
[0003] In view of this, the purpose of the present application is to provide an endoscopic image processing method, an endoscopic image processing device, an electronic device and a computer-readable storage medium, which improve the accuracy and stability of the output recognition results.
[0004] In order to solve the above technical problems, the present application provides an endoscopic image processing method, comprising:
[0005] Acquire a current image, and input the current image into a recognition model to obtain a current recognition result;
[0006] Obtaining historical recognition results corresponding to historical images, and performing continuity detection using the current recognition results and the historical recognition results;
[0007] If the continuity detection is passed, the current image is output based on the current recognition result.
[0008] Optionally, the performing continuity detection using the current recognition result and the historical recognition result includes:
[0009] Determining whether the current recognition result is the same as the historical recognition result;
[0010] If they are the same, it is determined that the continuity test has passed;
[0011] If they are not the same, the current recognition result and the historical recognition result are used to perform part interval detection, and the continuity detection result is determined based on the part interval detection result.
[0012] Optionally, performing part interval detection using the current recognition result and the historical recognition result, and determining a continuity detection result based on the part interval detection result, includes:
[0013] Determining whether the current recognition result and the historical recognition result are in the same interval;
[0014] If they are not in the same interval, determine whether the interval switching condition is met;
[0015] If the interval switching condition is met, determining that the continuity test is passed;
[0016] If the interval switching condition is not met, determining that the continuity test has not been passed;
[0017] If they are in the same interval, it is determined that the continuity test has passed.
[0018] Optionally, if the two nodes are not in the same interval, determining whether an interval switching condition is met includes:
[0019] If they are not in the same interval, updating the interval switching parameter and determining whether the interval switching parameter is greater than the switching threshold;
[0020] If it is greater than the switching threshold, it is determined that the interval switching condition is met;
[0021] If it is not greater than the switching threshold, it is determined that the interval switching condition is not met;
[0022] Correspondingly, if the two are in the same interval, it is determined that the continuity test has been passed, including:
[0023] If they are in the same interval, the interval switching parameter is cleared to zero, and it is determined that the continuity test has been passed.
[0024] Optionally, it also includes:
[0025] Performing output condition matching detection on the current image;
[0026] Correspondingly, if the continuity detection is passed, outputting the current image based on the current recognition result includes:
[0027] If the continuity test is passed and the output condition matching test is passed, the current image is output based on the current recognition result.
[0028] Optionally, the performing output condition matching detection on the current image includes:
[0029] Using the recognition model to perform quality score recognition processing on the current image to obtain a current quality score corresponding to the current image;
[0030] Performing image quality detection using the current quality score;
[0031] Correspondingly, if the continuity test is passed and the output condition matching test is passed, then the current image is output based on the current recognition result, including:
[0032] If the continuity test and the image quality test are passed, the current image is output based on the current recognition result and the current quality score.
[0033] Optionally, performing image quality detection using the current quality score includes:
[0034] Obtaining a historical quality score corresponding to the historical image;
[0035] Smoothing the current quality score and the historical quality score to obtain a smoothed quality score;
[0036] If the smoothing quality score is greater than the quality threshold, it is determined that the image quality detection has been passed.
[0037] Optionally, outputting the current image based on the current recognition result and the current quality score includes:
[0038] Storing the current image in a candidate image pool;
[0039] Correspondingly, it also includes:
[0040] If an output instruction is detected, each candidate image in the candidate image pool is grouped according to the recognition result to obtain a plurality of candidate image groups;
[0041] The candidate image with the largest quality score in each of the candidate image groups is output.
[0042] Optionally, the training process of the recognition model includes:
[0043] Acquire a standard training image, and use the standard training image to train an initial model to obtain an initial recognition model;
[0044] Testing the initial recognition model using a test image to obtain an erroneous recognition image;
[0045] Outputting the misrecognition image, and acquiring an artificially labeled negative sample image in response to the misrecognition image;
[0046] A training data set is constructed using the artificially labeled negative sample images and the standard training images, and the initial model is trained using the training data set to obtain the recognition model.
[0047] The present application also provides an endoscopic image processing device, comprising:
[0048] A recognition module is used to obtain a current image and input the current image into a recognition model to obtain a current recognition result;
[0049] A continuity detection module, used to obtain historical recognition results corresponding to historical images, and perform continuity detection using the current recognition results and the historical recognition results;
[0050] An output module is used to output the current image based on the current recognition result if the continuity detection is passed.
[0051] The present application also provides an electronic device, including a memory and a processor, wherein:
[0052] The memory is used to store the computer program;
[0053] The processor is used to execute the computer program to implement the above-mentioned endoscopic image processing method.
[0054] The present application also provides a computer-readable storage medium for storing a computer program, wherein the computer program implements the above-mentioned endoscopic image processing method when executed by a processor.
[0055] The endoscopic image processing method provided in the present application obtains a current image, and inputs the current image into a recognition model to obtain a current recognition result; obtains a historical recognition result corresponding to a historical image, and uses the current recognition result and the historical recognition result to perform continuity detection; if the continuity detection is passed, the current image is output based on the current recognition result.
[0056] It can be seen that after acquiring the current image, the method uses the trained recognition model to identify it and obtains the corresponding current recognition result. During endoscopic examination, after the endoscope enters the digestive tract, the images of various parts of the digestive tract are acquired in sequence as the endoscope goes deeper into the digestive tract. Since the various parts of the digestive tract are connected, the digestive tract parts corresponding to the recognition results obtained after the acquired image is recognized should be continuous. If there is an interruption or jump, it means that the recognition is wrong. Therefore, after obtaining the current recognition result, it can be used to perform continuity detection together with the historical recognition results corresponding to the historical images that were previously acquired and detected, that is, to determine whether the current recognition result is continuous based on the historical recognition results. If the continuity test is passed, it means that the current result is continuous with the recognition result corresponding to the historical image, which conforms to the law of the movement of the endoscope in the human body, so it can be determined that the recognition result of the image is correct, so the current image can be output based on the current recognition result. Through continuity detection, it is possible to judge whether the current recognition result is accurate from the perspective of whether the recognition result conforms to the continuity law of the endoscopic detection result. After the continuity detection, that is, when it is determined that the recognition result is accurate, the current image is output based on the current recognition result, thereby improving the accuracy of the output recognition result and avoiding the unstable state of the recognition result to avoid interference to the user.
[0057] In addition, the present application also provides an endoscopic image processing device, an electronic device and a computer-readable storage medium, which also have the above-mentioned beneficial effects. BRIEF DESCRIPTION OF THE DRAWINGS
[0058] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the related technologies, the drawings required for use in the embodiments or the related technical descriptions are briefly introduced below. Obviously, the drawings described below are merely embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.
[0059] Figure 1 A flow chart of an endoscopic image processing method provided in an embodiment of the present application;
[0060] Figure 2 A flowchart of a specific endoscopic image processing method provided in an embodiment of the present application;
[0061] Figure 3 A schematic diagram of the structure of an endoscopic image processing device provided in an embodiment of the present application;
[0062] Figure 4 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0063] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0064] Please refer to Figure 1 , Figure 1 A flow chart of an endoscopic image processing method provided in an embodiment of the present application. The method comprises:
[0065] S101: Acquire a current image, and input the current image into a recognition model to obtain a current recognition result.
[0066] The current image refers to the endoscope image acquired at the current moment. After the endoscope starts working, it will acquire the endoscope image at each moment according to a certain frequency. This embodiment does not limit the specific way of acquiring the image by the endoscope, and reference may be made to related technologies.
[0067] The recognition model refers to a model for recognizing the digestive tract part in the input image. The digestive tract can be the upper digestive tract or the lower digestive tract, so the digestive tract part can be a part in the upper digestive tract or a part in the lower digestive tract. It should be noted that any network model that can functionally recognize the digestive tract part can be used as a recognition model, so the structure and type of the recognition model are not limited. For example, a special CNN (Convolutional Neural Network) model ResNet (Deep residual network) can be used.
[0068] The recognition model is a model that has been trained to converge. When all or part of the steps in this application are executed by this device, the recognition model can be trained by this device, or can be trained by other devices other than this device. When performing image processing, in one embodiment, this device can obtain a trained recognition model from a local or other storage path and use it to perform part recognition.
[0069] After the current image is input into the recognition model, each network layer or network layer group in the recognition model processes the current image in turn to obtain the current recognition result. Depending on the structure of the recognition model, the specific processing process of the current image is also different, for example, it can be a process of feature map generation, feature extraction, classification, or other processes. The current recognition result refers to the result obtained by the recognition model to classify or predict the digestive tract part recorded in the current image, which may be correct, that is, it matches the current image, or it may be wrong, that is, it does not match the current image.
[0070] For the form of the current recognition result, the expression form can be set as needed. In one embodiment, the expression form is a name form, and the current recognition result can be a part name or an abnormal name. It can be understood that the specific number and content of the part name and the abnormal name vary according to the training set adopted by the recognition model. When the training set includes negative samples, the label of the negative sample is the abnormal name, and the label of the standard sample (or positive sample) is the part name. If the training set does not include negative samples, the current recognition result can only be a part name and cannot be an abnormal name. Specifically, in this embodiment, the current recognition result can be a part name "upper esophagus", "throat", etc., or it can be an abnormal name "water splash occlusion image", "in vitro image", etc.
[0071] In another embodiment, the current recognition result is expressed in a numbered form. Specifically, according to the requirements of the inspection order specification during actual operation, the various parts in the digestive tract are sorted in order and the corresponding numbers are obtained. Therefore, the labels of the training set used in training the recognition model are all in the form of numbers, so the current recognition result obtained after recognizing the current image can be in the form of numbers. Similar to the first embodiment above, the current recognition result can be the number of the positive sample in the training set, that is, the number corresponding to a certain part in the digestive tract, or it can be the number of the negative sample in the training set, that is, the number corresponding to the abnormal image.
[0072] S102: Obtain historical recognition results corresponding to historical images, and perform continuity detection using current recognition results and historical recognition results.
[0073] A historical image refers to the last image output based on the corresponding historical recognition result before the current moment, and the number is one. It should be noted that, in a possible implementation, in addition to the historical image, one or more non-standard historical images are required in the continuity detection process. Among them, a non-standard historical image refers to an image that is acquired after the historical image and before the current moment but does not pass the continuity detection. Although it is also output, its corresponding recognition result is not reliable. Therefore, it is not output based on the recognition result, but only outputs the image separately to ensure the continuity of the video stream when the user views the video stream composed of images in real time or after the overall processing is completed. At the same time, not outputting the current recognition result can avoid the interference of unreliable recognition results to the user. Specifically, when visual output is adopted, only the current image is displayed on the display component, and the corresponding current recognition result is not displayed; or when the storage output is adopted, only the current image is stored in a preset path, and the corresponding current recognition result is not stored. According to the specific process of continuity detection, the number of historical images used may also be different. The historical image is also processed by the recognition model and has a corresponding recognition result, that is, a historical recognition result. It is understandable that if the current image is the first image acquired, that is, there is no corresponding historical image and historical recognition result, then the historical recognition result can be set as the current recognition result, or can be set to a pre-specified recognition result to execute subsequent processes.
[0074] It should be noted that, since the historical image has been output, it means that at the time of outputting the historical image, the corresponding historical recognition result is considered to have passed the continuity test and is a correct recognition result. Therefore, the historical recognition result can be used as a standard for continuity detection and used to perform continuity detection with the current recognition result.
[0075] Continuity detection refers to the detection of whether the two digestive tract parts corresponding to the current recognition result and the historical recognition result are continuous. It is understandable that when the endoscope enters the digestive tract, it gradually goes deeper and examines each digestive tract part in turn as the depth increases. Therefore, the images corresponding to each digestive tract part obtained by the endoscope are in a certain order. For example, when performing an upper digestive tract examination, the endoscope enters the upper digestive tract from the mouth, and it must first obtain an image of the esophageal-gastric junction, and only then can it obtain an image of the pylorus in the gastric body, because the endoscope first enters the esophagus and then the stomach.
[0076] Through the continuity test, it can be determined whether the digestive tract part corresponding to the current recognition result is continuous with the digestive tract part accurately detected last time (i.e., the digestive tract part corresponding to the historical recognition result), which further reflects whether the image of the digestive tract part corresponding to the current recognition result can be obtained when continuing to test based on the digestive tract part corresponding to the historical recognition result. If it can be obtained, it can be determined that the continuity test has passed. Otherwise, it is determined that the continuity test has not passed.
[0077] S103: If the continuity detection is passed, the current image is output based on the current recognition result.
[0078] If the continuity test passes, it means that based on the digestive tract part corresponding to the historical recognition result, the image of the digestive tract part corresponding to the current recognition result, that is, the target image, can be obtained when the test is continued. If the continuity test between the current recognition result and the historical recognition result passes, it means that the current recognition result is a reasonable result that can be obtained based on the historical recognition result, so it can be determined that the current recognition result is an accurate result. The recognition model can accurately recognize the current image, which further shows that it is possible to accurately understand which digestive tract part is recorded in the current image, and it is not an image of poor quality where the specific content cannot be seen, so the current image can be output based on the current recognition result.
[0079] This embodiment does not limit the specific output method, for example, it can be a visual output, that is, visually displaying the target image, or it can be a saved output, that is, storing the current image in a specified path.
[0080] This embodiment does not limit the processing method of the current image that fails the continuity test. In this case, the current image is actually a non-standard historical image of the image acquired subsequently. Specifically, it can be stored in a preset storage path, or the current image can be output separately without being output based on the recognition result, or other operations such as counting can be performed.
[0081] Applying the endoscopic image processing method provided by the embodiment of the present application, after acquiring the current image, the trained recognition model is used to recognize it and obtain the corresponding current recognition result. Since during endoscopic examination, after the endoscope enters the digestive tract, the images of various digestive tract parts are acquired in sequence as the endoscope goes deeper into the digestive tract. Since the various parts in the digestive tract are connected, the digestive tract parts corresponding to the recognition results obtained by the acquired image after recognition should be continuous. If there is an interruption or jump, it means that the recognition is wrong. Therefore, after obtaining the current recognition result, it can be used to perform continuity detection together with the historical recognition results corresponding to the historical images previously acquired and detected, that is, to determine whether the current recognition result is continuous based on the historical recognition results. If the continuity test is passed, it means that the current result is continuous with the recognition result corresponding to the historical image, which conforms to the law of the movement of the endoscope in the digestive tract, so it can be determined that the recognition result of the image is correct, so the current image can be output based on the current recognition result. Through continuity detection, it is possible to judge whether the current recognition result is accurate from the perspective of whether the recognition result conforms to the continuity law of the endoscopic detection result. After the continuity detection, that is, when it is determined that the recognition result is accurate, the current image is output based on the current recognition result, thereby improving the accuracy of the output recognition result and avoiding the unstable state of the recognition result to avoid interference to the user.
[0082] Based on the above embodiment, this embodiment will specifically explain the existing steps in the above embodiment or the steps newly added to the above embodiment. Before using the recognition model to recognize the image, the recognition model can be generated locally. In order to obtain a more accurate recognition model, a training set with negative samples can be constructed. The training process of the recognition model may include the following steps:
[0083] Step 11: Obtain standard training images, and use the standard training images to train the initial model to obtain an initial recognition model.
[0084] Step 12: Use the test image to test the initial recognition model and obtain the incorrectly recognized image.
[0085] Step 13: Output the misrecognition image and obtain an artificially labeled negative sample image corresponding to the misrecognition image.
[0086] Step 14: Use manually labeled negative sample images and standard training images to construct a training data set, and use the training data set to train the initial model to obtain a recognition model.
[0087] Standard training images refer to standard images corresponding to various parts of the digestive tract. The initial model refers to an untrained recognition model. In this embodiment, after the initial model is trained using standard training images and converged, the model obtained is the initial recognition model. The initial recognition model can recognize images that can clearly show the characteristics of the digestive tract, but for images blocked by splashes, images taken when the endoscope is too close to the inner wall of the digestive tract, and other similar images, since they do not accurately record the characteristics of the digestive tract, the recognition results obtained by identifying them are almost bound to be wrong.
[0088] In order to solve the above problems and improve the accuracy of the recognition model, after obtaining the initial recognition model, the initial recognition model is tested with a test image to obtain the test results corresponding to each test image. If the test result is the same as the standard label of the test image, it is considered that the initial recognition model can accurately recognize the test image, which also shows that enough features are recorded in the test image to support the initial recognition model to recognize it. If the test result is different from the standard label of the test image, the test image is determined to be an incorrectly recognized image. This phenomenon shows that the initial recognition model cannot accurately recognize the test image (i.e., the incorrectly recognized image). Therefore, the test image does not record enough features and must be a non-standard image, such as an image blocked by water splashes, an image taken when the endoscope is too close to the inner wall of the digestive tract, etc.
[0089] In this case, the specific real category is identified by outputting the misidentified image so that it can be manually marked. For example, it was originally identified as the greater curvature of the middle part of the gastric body, but it was misidentified due to the occlusion of water splashes. At this time, it can be manually re-identified as occlusion of water splashes. After the identification is completed, it is re-entered, that is, the manually marked negative sample image in response to the misidentified image is obtained. In practical applications, the manually marked negative sample image is usually an image that cannot be determined by a single image, such as an in vitro image, an endoscope attached to the wall, occluded by water splashes, and an extremely blurred image. For images with blur, reflection, partial water splashes, partial food residues, a biased shooting angle, and an inappropriate lens height, although its image quality is poor, the part can be determined using a single image. When the initial recognition model is used for recognition, it may be misidentified, so it may be determined as a misidentified image and output. This embodiment does not limit the specific processing method for this type of misidentified image. In the process of manual marking, considering that other similar situations are likely to be successfully recognized, it can be marked as a non-standard training image, and then used together with the manually marked negative sample image and the standard training image to form a training data set. Specifically, the labels of non-standard training images are the information of the corresponding parts. They are also training images, but the image quality is better than that of manually labeled negative samples and worse than that of standard training images. Based on the above situation, it can be explained that the number of manually labeled negative sample images may be less than the number of misidentified images.
[0090] The artificially labeled negative sample images are determined as training data to achieve the effect of expanding the training data. The training data set is constructed by using them and standard training images, and the initial model is trained with the training data set. The model obtained after the training is completed and converged is the recognition model. By generating artificially labeled negative sample images and using them to train the recognition model, the recognition model can have the ability to recognize these special images instead of misidentifying them and obtaining wrong recognition results, so that the recognition model has a higher recognition accuracy.
[0091] Based on the above embodiment, the process of performing continuity detection using the current recognition result and the historical recognition result may specifically include the following steps:
[0092] Step 21: Determine whether the current recognition result is the same as the historical recognition result.
[0093] Step 22: If they are the same, it is determined that the continuity test has passed.
[0094] Step 23: If they are not the same, the current recognition result and the historical recognition result are used to perform part interval detection, and the continuity detection result is determined based on the part interval detection result.
[0095] Since the endoscope moves slowly in the digestive tract, and the frequency of acquiring images is relatively high, the endoscope may acquire multiple images for a digestive tract part. Therefore, when performing continuity detection, you can first determine whether the current recognition result is the same as the historical recognition result. If they are the same, it means that the part recorded in the current image is the same as the part recorded in the historical image. It can be determined that the parts recorded in the current recognition result and the historical recognition result are continuous, and then it can be determined that it has passed the continuity test.
[0096] If they are not the same, two situations may occur at this time. The first situation is that the endoscope moves in the digestive tract, and the image obtained is the image corresponding to the subsequent part, that is, the part recorded in the current image is actually different from the part recorded in the historical image. The second situation is that the current image quality is poor, and there are no features recorded that are sufficient for accurate identification, resulting in errors in the current recognition result. In order to accurately distinguish the above two situations, the current recognition result and the historical recognition result can be used to perform part interval detection to obtain the corresponding part interval detection result, and the continuity detection result is determined based on it. The continuity detection result is passed or failed.
[0097] Among them, the part interval refers to the interval to which one or more parts belong, and the part interval detection refers to the detection of determining whether the first part interval to which the part corresponding to the current recognition result belongs and the second part interval to which the part corresponding to the historical recognition result belongs conform to the rules. The specific form of the part interval detection may be different depending on the division method of the part interval and the specific content of the corresponding rules.
[0098] In one embodiment, each part belongs to an interval, and the corresponding rule is that the intervals are adjacent in a preset inspection order. In this embodiment, the user needs to operate the endoscope to inspect each part of the digestive tract in a preset inspection order. Therefore, when it is found that the current recognition result is different from the historical recognition result, it is necessary to determine whether the two are adjacent, and whether the current recognition result is the next recognition result of the historical recognition result in the preset inspection order. If so, it can be determined that the continuity test has been passed, otherwise it is determined that the continuity test has not been passed.
[0099] In another embodiment, in actual application, there may be multiple detection orders for various parts of the digestive tract, and the loss of the detection results and images of a certain part will not interfere with the user's diagnosis of the patient. In this case, in order to expand the scope of application of continuity detection, the user is allowed to check in any detection order, and the current recognition result and the historical recognition result are used to perform part interval detection, and the process of determining the continuity detection result based on the part interval detection result may include the following steps:
[0100] Step 31: Determine whether the current recognition result and the historical recognition result are in the same interval.
[0101] Step 32: If they are not in the same interval, determine whether the interval switching condition is met.
[0102] Step 33: If the interval switching condition is met, it is determined that the continuity test has passed.
[0103] Step 34: If the interval switching condition is not met, it is determined that the continuity test has not passed.
[0104] Step 35: If they are in the same interval, it is determined that the continuity test has passed.
[0105] It should be noted that in this embodiment, one interval includes multiple parts, and each interval does not include two parts with similar features. For example, the esophageal stomach junction in the esophagus is close to the pylorus in the stomach body, so they need to be divided into two different intervals. The interval division method can be obtained by the user based on experience, or the similarity of the standard images corresponding to each part can be calculated, and the two parts whose similarity exceeds the threshold are determined as similar parts, and the two similar parts are divided into different intervals.
[0106] When the current recognition result is different from the historical recognition result, it can be determined whether the two are in the same interval. If the two are in the same interval, it means that the endoscope has currently moved to another part, and the image obtained is an image of another part, so it can be determined that the continuity test has passed. If the two are not in the same part, it is determined whether the interval switching condition is currently met.
[0107] The interval switching condition refers to a condition that can indicate that the endoscope moves from one interval to another. According to actual needs, the specific content of the interval switching condition can be various. In one embodiment, the interval switching condition is that the number of images that are continuously determined to have failed the continuity test exceeds the quantity threshold; in another embodiment, the recognition model can also score the image quality of the current image to obtain the instruction parameter. At this time, the interval switching condition is that the number of images that are continuously determined to have failed the continuity test and whose image quality exceeds the quality threshold exceeds the quantity threshold.
[0108] If the interval switching condition is met, it means that the endoscope has moved from one interval of the digestive tract to another interval, and it can be determined that the continuity test has passed. If the interval switching condition is not met, it means that the current image may be of poor quality and cannot be correctly recognized, and the current recognition result is inaccurate, so it can be determined that the continuity test has not passed.
[0109] Further, in one implementation, if they are not in the same interval, the process of determining whether the interval switching condition is met may include the following steps:
[0110] Step 41: If they are not in the same interval, update the interval switching parameter and determine whether the interval switching parameter is greater than the switching threshold.
[0111] Step 42: If it is greater than the switching threshold, it is determined that the interval switching condition is met.
[0112] Step 43: If it is not greater than the switching threshold, it is determined that the interval switching condition is not met.
[0113] The interval switching parameter refers to the number of images detected at the current moment that are continuously determined to have failed the continuity test, that is, the number of non-standard historical images at the current moment. Since when the endoscope has just moved from one interval to another, the recognition result corresponding to the acquired image must be in a different interval from the historical recognition result of the historical image output last time, and it is no longer possible to acquire images in the same interval. Therefore, the interval switching parameter can be accumulated, that is, when it is detected that it is not in the same interval, the interval switching parameter is increased by one to complete the update. After the update is completed, it is determined whether the interval switching parameter is greater than the switching threshold. If it is greater than the switching threshold, it means that there are enough newly acquired images whose corresponding recognition results are inconsistent with the historical recognition results. This situation usually occurs when the endoscope has just moved from one interval to another, and the images acquired by the endoscope usually do not have continuous abnormalities (for example, continuous wall-attached images, continuous appearance of multiple splash-covered images, etc.), so it can be determined that the interval switching image is satisfied. Otherwise, it is determined that the interval switching condition is not met.
[0114] Correspondingly, if they are in the same interval, the process of determining whether the continuity test is passed may include the following steps:
[0115] Step 44: If they are in the same interval, the interval switching parameters are cleared and it is determined that the continuity test has passed.
[0116] In order to avoid the interval switching parameters being accumulated continuously and causing incorrect interval switching condition judgment, when it is detected that the current recognition result and the historical recognition result are in the same interval, not only is it determined that the continuity test has passed, but the interval switching parameters are also cleared to facilitate subsequent re-accumulation.
[0117] Based on the above embodiment, in another implementation, when the current recognition result corresponding to the current image is correct, it is possible to further detect whether the single-signed image meets other requirements, and then determine whether to output the current image based on the current recognition result. Specifically, it may also include the following steps:
[0118] Step 51: Perform output condition matching detection on the current image.
[0119] Among them, the output condition refers to the condition that restricts whether the current image can be output based on the current recognition result. Through the output condition matching test, it can be determined whether the current image meets the requirements of the output condition, and then it can be determined whether it can be output based on the current recognition result. If the output condition matching test fails, the current image can be output alone, and the current recognition result will not be output regardless of whether the current recognition result is correct.
[0120] The specific content of the output condition can be set as needed, for example, it can be an image quality condition, that is, judging whether the quality of the current image meets the requirements; or it can be a brightness condition, that is, judging whether the brightness of the current image meets the requirements; or it can be a similarity condition, that is, judging whether the similarity between the current image and the image output at the last moment (that is, the historical image or the non-standard historical image, both of which are output, the difference is whether they are output based on the corresponding recognition results) meets the requirements. It can be understood that the number of output conditions can be one or more.
[0121] Correspondingly, if the continuity test is passed, the current image is output based on the current recognition result, including:
[0122] Step 52: If the continuity test is passed and the output condition matching test is passed, the current image is output based on the current recognition result.
[0123] In this embodiment, the current image can be output based on the current recognition result only when the continuity test is passed and the output condition is matched, that is, the continuity test is passed and the output condition matching test is passed.
[0124] Furthermore, in one implementation, the output condition is an image quality condition. Specifically, the process of performing output condition matching detection on the current image may include the following steps:
[0125] Step 61: Perform quality score recognition processing on the current image using the recognition model to obtain a current quality score corresponding to the current image.
[0126] Step 62: Use the current quality score to perform image quality detection.
[0127] In this embodiment, the recognition model can also recognize the image quality of the current image, so after the current image is input into the recognition model, the current quality score corresponding to the current image can also be obtained. Correspondingly, the output condition matching detection is specifically image quality detection.
[0128] Image quality detection refers to the detection of whether the current quality score meets the requirements. For a specific detection method, in one implementation, it can be determined whether the current quality score is greater than a parameter threshold. If it is greater than the parameter threshold, it is determined that the image quality detection has passed. In another implementation, this step can further include the following steps:
[0129] Step 71: Obtain the historical quality score corresponding to the historical image.
[0130] Step 72: Smoothing the current quality score and the historical quality score to obtain a smoothed quality score.
[0131] Step 73: If the smoothing quality score is greater than the quality threshold, it is determined that the image quality detection has been passed.
[0132] In order to avoid discontinuous image output due to image output limitation when the content of adjacent images does not change much but the quality is relatively large, and to limit the output of images with poor quality, in this embodiment, a smoothing process can be used to obtain a smoothed quality score by smoothing the quality score. This embodiment does not limit the specific method of smoothing, and reference can be made to related technologies. For example, a weighted average smoothing process can be performed, that is, different weights are assigned to the historical quality score and the current quality score, and a smoothed quality score is obtained by weighted average calculation. Through smoothing, a smoothed quality score can be obtained for determining whether the image quality detection is passed, and it is determined to have passed the image quality detection when it is greater than the quality threshold.
[0133] Correspondingly, if the continuity test is passed and the output condition matching test is passed, the process of outputting the current image based on the current recognition result may include the following steps:
[0134] Step 63: If the continuity test and the image quality test are passed, the current image is output based on the current recognition result and the current quality score.
[0135] In this embodiment, the image is output only when it is determined that the image quality is good and the recognition result is accurate, so as to avoid interference to the user caused by low-quality image output.
[0136] Furthermore, in one embodiment, the current image can be stored in a designated path, and when generating a pathology report or a diagnosis report, the image with the best quality corresponding to each part can be selected from the images in the designated path for output, so as to generate the report. Therefore, the process of outputting the current image based on the current recognition result and the current quality score may include the following steps:
[0137] Step 81: Store the current image in the candidate image pool.
[0138] The candidate image pool is used to store candidate images, and the candidate images refer to images waiting to be selected for output when an output instruction is detected.
[0139] Accordingly, the following steps are also included:
[0140] Step 82: If an output instruction is detected, the candidate images in the candidate image pool are grouped according to the recognition results to obtain a plurality of candidate image groups.
[0141] Step 83: Output the candidate image with the largest quality score in each candidate image group.
[0142] If an output instruction is detected, in response to the output instruction, all candidate images in the candidate image pool will be grouped according to the recognition results to obtain several candidate image groups. The recognition result is the current recognition result when each image is used as the current image. In each candidate image group, the candidate image with the largest quality score in each candidate image group is sorted based on the quality score of each candidate image, that is, the candidate image with the best quality, and it is output. It should be noted that the output method in this embodiment is not limited. In one embodiment, it can be a visual output, that is, the image with the best quality corresponding to each part is displayed with a visual report. Specifically, the display position of each image in the report can be determined based on the part information, and a visual display is performed based on the display position. In another embodiment, it can be a storage output, for example, the candidate image with the largest quality score can be stored in the path specified by the output instruction, and the specified path is specifically the storage path of the data required for report generation. When viewing the report, the user can obtain text, image and other data from the path, fill in the preset report template, and then generate the report.
[0143] Based on the above examples, please refer to Figure 2 , Figure 2 A flow chart of a specific endoscopic image processing method provided in an embodiment of the present application. After inputting the image, the recognition model is used for model reasoning to obtain the corresponding current recognition result and current quality score (i.e., standard degree). After obtaining the historical quality score and historical recognition result, the current quality score and the historical quality score are used for smoothing, i.e., standard degree smoothing is performed, and after smoothing, it is determined whether the obtained smoothed quality score is greater than the threshold. If not, it means that the quality of the current image is poor, and an exception is performed on it. Exception processing is the processing of limiting the output of the current recognition result, such as deleting the current recognition result and only outputting the image processing. In addition, it can also include logging, reminders and other processing.
[0144] If the smoothing quality score is greater than the threshold, it is further determined whether the current recognition result is the same as the historical recognition result, that is, whether it is the same part as the previous frame. If so, it is determined that the continuity test has been passed, the recognition result is determined to be correct, and the part category (that is, the current recognition result) and the standard degree (that is, the current quality score) are output. If it is not the same part, it is further determined whether it is the same interval as the previous frame. If so, it is determined that the continuity test has been passed, the recognition result is determined to be correct, and the part category and standard degree are output. If it is not the same interval, it is further determined whether the interval switching condition is met. If not, it is determined that the continuity test has not been passed, and exception processing is performed. Otherwise, it is determined that the continuity test has been passed, and the part category and standard degree are output.
[0145] After the output is completed, it is determined whether new input appears, that is, whether the input is finished. If not, the new current image is input into the model and model inference is performed, and the above process is repeated.
[0146] The following is an introduction to an endoscopic image processing device provided in an embodiment of the present application. The endoscopic image processing device described below and the endoscopic image processing method described above can be referenced to each other.
[0147] Please refer to Figure 3 , Figure 3 A schematic structural diagram of an endoscopic image processing device provided in an embodiment of the present application includes:
[0148] The recognition module 110 is used to obtain a current image and input the current image into a recognition model to obtain a current recognition result;
[0149] A continuity detection module 120, used to obtain historical recognition results corresponding to historical images, and perform continuity detection using the current recognition results and the historical recognition results;
[0150] The output module 130 is configured to output the current image based on the current recognition result if the continuity detection is passed.
[0151] Optionally, the continuity detection module 120 includes:
[0152] A sameness determination module, used to determine whether the current recognition result is the same as the historical recognition result;
[0153] A first determination unit, configured to determine that the continuity test is passed if the current recognition result is the same as the historical recognition result;
[0154] The interval detection unit is used to perform part interval detection using the current recognition result and the historical recognition result if the current recognition result is different from the historical recognition result, and determine the continuity detection result based on the part interval detection result.
[0155] Optionally, the interval detection unit includes:
[0156] An interval determination subunit, used to determine whether the current recognition result and the historical recognition result are in the same interval;
[0157] A condition judgment subunit, used to judge whether the interval switching condition is met if they are not in the same interval;
[0158] A first determining subunit, configured to determine that the continuity test is passed if the interval switching condition is met;
[0159] A second determining subunit, configured to determine that the continuity test fails if the interval switching condition is not met;
[0160] The third determining subunit is used to determine if the two are in the same interval, then pass the continuity test.
[0161] Optionally, the condition judgment subunit includes:
[0162] An updating subunit, used for updating the interval switching parameter if the two intervals are not in the same interval, and determining whether the interval switching parameter is greater than a switching threshold;
[0163] A fourth determining subunit, configured to determine that the interval switching condition is satisfied if the value is greater than the switching threshold;
[0164] a fifth determining subunit, configured to determine that the interval switching condition is not satisfied if the value is not greater than the switching threshold;
[0165] Correspondingly, the third determining subunit is a subunit that clears the interval switching parameter if they are in the same interval, and determines the subunit that passes the continuity detection.
[0166] Optionally, it also includes:
[0167] An output condition matching module is used to perform output condition matching detection on the current image;
[0168] Correspondingly, the output module 130 is a module that outputs the current image based on the current recognition result if the continuity test and the output condition matching test are passed.
[0169] Optionally, the output condition matching module includes:
[0170] The quality score recognition unit is used to perform quality score recognition processing on the current image using the recognition model to obtain a current quality score corresponding to the current image;
[0171] A quality detection unit, used for performing image quality detection using a current quality score;
[0172] Correspondingly, the output module 130 is a module that outputs the current image based on the current recognition result and the current quality score if the continuity test and the image quality test are passed.
[0173] Optionally, it also includes:
[0174] A quality detection module, used for performing image quality detection using the current quality score;
[0175] Correspondingly, the output module 130 is a module that outputs the current image based on the current recognition result and the current quality score if the continuity test and the image quality test are passed.
[0176] Optionally, the quality detection module includes:
[0177] An acquisition unit, used to acquire a historical quality score corresponding to the historical image;
[0178] A smoothing unit, used for smoothing the current quality score and the historical quality score to obtain a smoothed quality score;
[0179] The second determining unit is configured to determine that the image quality detection has been passed if the smoothing quality score is greater than a quality threshold.
[0180] Optionally, the output module 130 includes:
[0181] A storage output unit, used for storing the current image in a candidate image pool;
[0182] Correspondingly, it also includes:
[0183] A grouping module, for grouping the candidate images in the candidate image pool according to the recognition results to obtain a plurality of candidate image groups if an output instruction is detected;
[0184] The quality output module is used to output the candidate image with the largest quality score in each of the candidate image groups.
[0185] Optionally include:
[0186] An initial training module, used to obtain a standard training image and use the standard training image to train an initial model to obtain an initial recognition model;
[0187] A testing module, used to test the initial recognition model using a test image to obtain an erroneous recognition image;
[0188] a marking module, configured to output the misidentified image and obtain an artificially marked negative sample image in response to the misidentified image;
[0189] The secondary training module is used to construct a training data set using the artificially labeled negative sample images and the standard training images, and to train the initial model using the training data set to obtain the recognition model.
[0190] The electronic device provided in the embodiment of the present application is introduced below. The electronic device described below and the endoscopic image processing method described above can be referenced to each other.
[0191] Please refer to Figure 4 , Figure 4 The electronic device 100 may include a processor 101 and a memory 102 , and may further include one or more of a multimedia component 103 , an information input / information output (I / O) interface 104 , and a communication component 105 .
[0192] The processor 101 is used to control the overall operation of the electronic device 100 to complete all or part of the steps in the above-mentioned endoscopic image processing method; the memory 102 is used to store various types of data to support the operation of the electronic device 100, and these data may include, for example, instructions for any application or method operated on the electronic device 100, and data related to the application. The memory 102 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (Static Random Access Memory, SRAM), electrically erasable programmable read-only memory (Electrically Erasable Programmable Read-Only Memory, EEPROM), erasable programmable read-only memory (Erasable Programmable Read-Only Memory, EPROM), programmable read-only memory (Programmable Read-Only Memory, PROM), read-only memory (Read-Only Memory, ROM), magnetic memory, flash memory, magnetic disk or optical disk. One or more.
[0193] The multimedia component 103 may include a screen and an audio component. The screen may be, for example, a touch screen, and the audio component is used to output and / or input audio signals. For example, the audio component may include a microphone, which is used to receive external audio signals. The received audio signal may be further stored in the memory 102 or sent through the communication component 105. The audio component also includes at least one speaker for outputting audio signals. The I / O interface 104 provides an interface between the processor 101 and other interface modules, and the above-mentioned other interface modules may be keyboards, mice, buttons, etc. These buttons may be virtual buttons or physical buttons. The communication component 105 is used for wired or wireless communication between the electronic device 100 and other devices. Wireless communication, such as Wi-Fi, Bluetooth, Near Field Communication (NFC), 2G, 3G or 4G, or a combination of one or more of them, so the corresponding communication component 105 may include: Wi-Fi components, Bluetooth components, NFC components.
[0194] The electronic device 100 may be implemented by one or more application specific integrated circuits (ASIC), digital signal processors (DSP), digital signal processing devices (DSPD), programmable logic devices (PLD), field programmable gate arrays (FPGA), controllers, microcontrollers, microprocessors or other electronic components to execute the endoscopic image processing method given in the above embodiment. Specifically, the electronic device 100 may be an endoscopic device. In addition to the above components and assemblies, the endoscopic device may also include an endoscopic lens for acquiring endoscopic images, i.e., current images at various moments. In another endoscopic device, images sent by other electronic devices may be acquired through a communication component and processed as current images.
[0195] The computer-readable storage medium provided in the embodiments of the present application is introduced below. The computer-readable storage medium described below and the endoscopic image processing method described above can be referenced to each other.
[0196] The present application also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the above-mentioned endoscopic image processing method are implemented.
[0197] The computer-readable storage medium may include: a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and other media that can store program codes.
[0198] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.
[0199] Those skilled in the art may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented with electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0200] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
[0201] Finally, it should be noted that, in this article, relationships such as first and second, etc. are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms include, include or any other variations are intended to cover non-exclusive inclusion, so that a process, method, article or device that includes a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device.
[0202] Specific examples are used herein to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea. At the same time, for those skilled in the art, according to the idea of the present application, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. An endoscopic image processing method, characterized in that: include: Acquire a current image, and input the current image into a recognition model to obtain a current recognition result; Obtaining historical recognition results corresponding to historical images, and performing continuity detection using the current recognition results and the historical recognition results; The continuity detection is to detect whether the parts corresponding to the current recognition result and the historical recognition result respectively conform to the movement law of the endoscope in the human body; If the continuity test is passed, outputting the current image based on the current recognition result; The using the current recognition result and the historical recognition result to perform continuity detection includes: Determining whether the current recognition result is the same as the historical recognition result; If they are the same, it is determined that the continuity test has passed; If they are not the same, it is further determined whether the part corresponding to the current recognition result can be obtained when continuing the detection based on the part corresponding to the historical recognition result. If it can be obtained, it is determined that the continuity test has been passed, otherwise it is determined that the continuity test has not been passed.
2. The endoscopic image processing method according to claim 1, characterized in that: The further determining whether the part corresponding to the current recognition result can be obtained when continuing to detect based on the part corresponding to the historical recognition result includes: Part interval detection is performed using the current recognition result and the historical recognition result, and a continuity detection result is determined based on the part interval detection result, wherein a part interval refers to an interval to which one or more parts belong, and part interval detection refers to determining whether a first part interval to which the part corresponding to the current recognition result belongs and a second part interval to which the part corresponding to the historical recognition result belongs comply with the detection rules.
3. The endoscopic image processing method according to claim 2, characterized in that: The performing part interval detection by using the current recognition result and the historical recognition result, and determining the continuity detection result based on the part interval detection result, includes: Determining whether the current recognition result and the historical recognition result are in the same interval; If they are not in the same interval, determine whether the interval switching condition is met; If the interval switching condition is met, determining that the continuity test is passed; If the interval switching condition is not met, determining that the continuity test has not been passed; If they are in the same interval, it is determined that the continuity test has passed.
4. The endoscopic image processing method according to claim 3, characterized in that: If the two terminals are not in the same interval, determining whether an interval switching condition is met includes: If they are not in the same interval, updating the interval switching parameter and determining whether the interval switching parameter is greater than the switching threshold; If it is greater than the switching threshold, it is determined that the interval switching condition is met; If it is not greater than the switching threshold, it is determined that the interval switching condition is not met; Correspondingly, if the two are in the same interval, it is determined that the continuity test has been passed, including: If they are in the same interval, the interval switching parameter is cleared to zero, and it is determined that the continuity test has been passed.
5. The endoscopic image processing method according to any one of claims 1 to 4, characterized in that: Also includes: Performing output condition matching detection on the current image; Correspondingly, if the continuity detection is passed, outputting the current image based on the current recognition result includes: If the continuity test is passed and the output condition matching test is passed, the current image is output based on the current recognition result.
6. The endoscopic image processing method according to claim 5, characterized in that: The performing output condition matching detection on the current image includes: Using the recognition model to perform quality score recognition processing on the current image to obtain a current quality score corresponding to the current image; Performing image quality detection using the current quality score; Correspondingly, if the continuity test is passed and the output condition matching test is passed, then the current image is output based on the current recognition result, including: If the continuity test and the image quality test are passed, the current image is output based on the current recognition result and the current quality score.
7. The endoscopic image processing method according to claim 6, characterized in that: The using the current quality score to perform image quality detection includes: Obtaining a historical quality score corresponding to the historical image; Smoothing the current quality score and the historical quality score to obtain a smoothed quality score; If the smoothing quality score is greater than the quality threshold, it is determined that the image quality detection has been passed.
8. The endoscopic image processing method according to claim 6, characterized in that: The outputting the current image based on the current recognition result and the current quality score comprises: Storing the current image in a candidate image pool; Correspondingly, it also includes: If an output instruction is detected, each candidate image in the candidate image pool is grouped according to the recognition result to obtain a plurality of candidate image groups; The candidate image with the largest quality score in each of the candidate image groups is output.
9. The endoscopic image processing method according to claim 1, characterized in that: The training process of the recognition model includes: Acquire a standard training image, and use the standard training image to train an initial model to obtain an initial recognition model; Testing the initial recognition model using a test image to obtain an erroneous recognition image; Outputting the misrecognition image, and acquiring an artificially labeled negative sample image in response to the misrecognition image; A training data set is constructed using the artificially labeled negative sample images and the standard training images, and the initial model is trained using the training data set to obtain the recognition model.
10. An endoscope image processing device, characterized in that: include: A recognition module is used to obtain a current image and input the current image into a recognition model to obtain a current recognition result; A continuity detection module, used to obtain historical recognition results corresponding to historical images, and perform continuity detection using the current recognition results and the historical recognition results; The continuity detection is to detect whether the parts corresponding to the current recognition result and the historical recognition result respectively conform to the movement law of the endoscope in the human body; The continuity test using the current recognition result and the historical recognition result includes: determining whether the current recognition result is the same as the historical recognition result; if they are the same, determining that the continuity test has been passed; if they are not the same, further determining whether the part corresponding to the current recognition result can be obtained when continuing to test based on the part corresponding to the historical recognition result, if it can be obtained, determining that the continuity test has been passed, otherwise determining that the continuity test has not been passed; An output module is used to output the current image based on the current recognition result if the continuity detection is passed.
11. An electronic device, characterized in that: comprising a memory and a processor, wherein: The memory is used to store the computer program; The processor is used to execute the computer program to implement the endoscopic image processing method according to any one of claims 1 to 9.
12. A computer-readable storage medium, characterized in that: Used to store a computer program, wherein when the computer program is executed by a processor, the endoscopic image processing method according to any one of claims 1 to 9 is implemented.
