Quality control method and system for capsule endoscope
Patent Information
- Application Number
- CN202210202383.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-03
- Publication Date
- 2026-08-21
- Estimated Expiration
- 2042-03-03
AI Technical Summary
[0043]This invention provides a capsule endoscope quality control method that inspects each image acquired by the capsule endoscope. When no identification unit is detected in the image, the capsule endoscope continues to move and acquire images within the current area. When an identification unit is detected in the image, the method determines whether the identification unit has been completely detected based on the position information of the detection frame of the identification unit. If the identification unit is not completely detected, the capsule endoscope can be controlled to change its position and posture in the area where the identification unit is located and acquire images until it is determined that the identification unit has been completely detected. The terminal device determines the completeness based on the percentage of the total number of segmented units in all detected identification units relative to the total number of segmented units in the target area. When the completeness is 100%, it is confirmed that the complete scan of the target area has been completed. If the completeness reaches 100%, the capsule endoscope is controlled to continue scanning the target area until the completeness reaches 100%, thereby ensuring the comprehensiveness of the inspection, guaranteeing the quality of the inspection, and avoiding missed detections.
Smart Images

Figure CN114557660B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of medical device technology, and in particular to a quality control method and system for capsule endoscopy. Background Technology
[0002] Currently, there are two main control methods for magnetically controlled capsule endoscopy. The first involves medical staff manually operating the magnetic control device to guide the capsule endoscope for examination of the target area based on their clinical experience. The second involves a terminal device with control software controlling the magnetic control device to guide the capsule endoscope for automatic examination of the target area. Both control methods carry the risk of missed detections, while a comprehensive scan of the target area is a prerequisite and foundation for disease diagnosis. Therefore, ensuring the completeness of capsule endoscopy examinations is a pressing issue that needs to be addressed. Summary of the Invention
[0003] To address the aforementioned technical problems in the existing technology, this invention provides a capsule endoscope quality control method and system, which aims to magnetically control the capsule endoscope during the scanning process of the target area, determine the completeness of the capsule endoscope scan in real time, and ensure the quality of the examination.
[0004] This invention provides a quality control method for capsule endoscopy, comprising the following steps:
[0005] S01: The magnetic control device drives the capsule endoscope to move within the target area via the first magnet;
[0006] S02: The capsule endoscope acquires images within the target area and sends the images to the terminal device;
[0007] S03: The terminal device detects whether there is a recognition unit in the image through a trained AI model. When the recognition unit is detected, it outputs the identifier name of the detected recognition unit and the position information of the detection box.
[0008] S04: When the terminal device determines that the position of the detection box of the recognition unit in the image meets the preset conditions, the recognition unit is completely checked;
[0009] S05: The terminal device determines the completeness based on the number of segmentation units detected in the identification unit and the total number of all segmentation units in the target area;
[0010] S06: When the completeness is determined to be 100%, the capsule endoscope ends image acquisition.
[0011] In some embodiments, when the terminal device determines in step S04 that the position of the detection box of the recognition unit in the image meets a preset condition, the complete inspection of the recognition unit includes:
[0012] The pixel distances between the detection frame of the recognition unit and the upper, lower, left, and right sides of the image are d1, d2, d3, and d4 respectively. When d1, d2, d3, and d4 are all greater than or equal to the preset threshold d, the recognition unit is completely inspected.
[0013] In some embodiments, before step S01, the following steps are further included:
[0014] S01-1: The terminal device divides the target area into n adjacent and non-overlapping segmentation units. Each segmentation unit has a unique identifier, which are sequentially identified as A1, A2, A3,..., An. All the segmentation units form a set S, S = {A1, A2, A3,..., An}, and the set S covers the target area, where 1 ≤ n ≤ N and N is a positive integer;
[0015] S01-2: The terminal device divides the target area into m partially overlapping recognition units. Each recognition unit is composed of k adjacent segmentation units. Each recognition unit has a unique identifier, which are sequentially identified as B1, B2, B3,..., Bm. All the recognition units form a set T, T = {B1, B2, B3,..., Bm}, and the set T covers the target area, where 1 ≤ k < n, 1 ≤ m ≤ N, and N is a positive integer.
[0016] In some embodiments, for the terminal device to determine the completeness according to the number of segmentation units in the recognized recognition unit and the number of all segmentation units in the target area in step S05, it includes:
[0017] S05-01: The terminal device incorporates each detected recognition unit into the set T'. The set T' is initially an empty set, and
[0018] S05-02: The terminal device decomposes each recognition unit in the set T' into k segmentation units according to the corresponding relationship between the recognition unit and k adjacent segmentation units;
[0019] S05-03: The terminal device incorporates the k segmentation units obtained by decomposing each recognition unit into the set S'. The set S' is initially an empty set, and
[0020] S05-04: The terminal device calculates the percentage of the number of all segmentation units in the set S' to the number of all segmentation units in the set S to obtain the completeness.
[0021] In some embodiments, the method further includes the step of:
[0022] S07: The terminal device detects the image quality of the image and obtains the quality inspection result.
[0023] In some embodiments, the terminal device in S07 performs image quality detection on the image and obtains the quality inspection result, including:
[0024] The terminal device performs mucus detection on the image and obtains the mucus detection result.
[0025] In some embodiments, the terminal device performs mucus detection on the image to obtain mucus detection results, including:
[0026] The terminal device converts the image to HSV space to obtain an HSV image;
[0027] The terminal device determines regions in the HSV image whose S-space values are less than a preset S-th threshold, thereby obtaining multiple low-saturation regions;
[0028] The terminal device uses multiple low-saturation regions as seeds and performs flooding in S-space according to color gradient changes to obtain multiple first slime regions.
[0029] The terminal device determines regions in the first slime regions whose area is greater than a first preset area threshold, thereby obtaining a plurality of second slime regions.
[0030] The terminal device calculates the sum of the areas of multiple second mucus regions to obtain a first total area;
[0031] When the first total area is greater than the second preset area threshold, the image contains a lot of mucus, and the mucus detection result indicates that the image does not meet the requirements.
[0032] When the first total area is less than or equal to the second preset area threshold, the image has little mucus, and the mucus detection result indicates that the image meets the requirements.
[0033] This invention provides a capsule endoscope quality control system, including a magnetic control device, a capsule endoscope, and a terminal device, wherein the terminal device is communicatively connected to the magnetic control device and the capsule endoscope respectively;
[0034] The magnetic control device is used to drive the capsule endoscope to move within the target area via a first magnet;
[0035] The capsule endoscope is used to acquire images within the target area and send the images to the terminal device;
[0036] The terminal device is used to detect whether there is an identification unit in the image through a trained AI model. When the identification unit is detected, the identification name of the detected identification unit and the position information of the detection frame are output;
[0037] The terminal device is further used to determine whether the position of the detection frame of the identification unit in the image meets a preset condition;
[0038] The terminal device is further used to determine the completeness according to the number of segmentation units in the detected identification unit and the number of all segmentation units in the target area
[0039] In some embodiments, the terminal device is further used to divide the target area into n adjacent and non-overlapping segmentation units. Each segmentation unit has a unique identifier, which are sequentially identified as A1, A2, A3,..., An. All the segmentation units form a set S, S = {A1, A2, A3,..., An}, and the set S covers the target area, where 1 ≤ n ≤ N and N is a positive integer;
[0040] The terminal device divides the target area into m partially overlapping identification units. Each identification unit is composed of k adjacent segmentation units. Each identification unit has a unique identifier, which are sequentially identified as B1, B2, B3,..., Bm. All the identification units form a set T, T = {B1, B2, B3,..., Bm}, and the set T covers the target area, where 1 ≤ k < n, 1 ≤ m ≤ N, and N is a positive integer.
[0041] In some embodiments, the terminal device is further used to incorporate each detected identification unit into a set T'. The set T' is initially an empty set, and The terminal device is further used to decompose each identification unit in the set T' into k segmentation units according to the corresponding relationship between the identification unit and the k adjacent segmentation units;
[0042] The terminal device is further used to incorporate the k segmentation units obtained by decomposing each identification unit into a set S'. The set S' is initially an empty set, and The terminal device is further used to calculate the percentage of the number of all segmentation units in the set S' to the number of all segmentation units in the set S to obtain the completeness.
[0043] This invention provides a capsule endoscope quality control method that inspects each image acquired by the capsule endoscope. When no identification unit is detected in the image, the capsule endoscope continues to move and acquire images within the current area. When an identification unit is detected in the image, the method determines whether the identification unit has been completely detected based on the position information of the detection frame of the identification unit. If the identification unit is not completely detected, the capsule endoscope can be controlled to change its position and posture in the area where the identification unit is located and acquire images until it is determined that the identification unit has been completely detected. The terminal device determines the completeness based on the percentage of the total number of segmented units in all detected identification units relative to the total number of segmented units in the target area. When the completeness is 100%, it is confirmed that the complete scan of the target area has been completed. If the completeness reaches 100%, the capsule endoscope is controlled to continue scanning the target area until the completeness reaches 100%, thereby ensuring the comprehensiveness of the inspection, guaranteeing the quality of the inspection, and avoiding missed detections. Attached Figure Description
[0044] The accompanying drawings are provided to further illustrate the embodiments of the present invention and form part of the specification. They are used together with the following detailed description to explain the embodiments of the present invention, but do not constitute a limitation on the embodiments of the present invention.
[0045] Figure 1 This is a flowchart of a capsule endoscopy quality control method according to an embodiment of the present invention;
[0046] Figure 2 This is a schematic diagram showing the position of a recognition unit and its detection box in an image according to an embodiment of the present invention;
[0047] Figure 3 This is a schematic diagram showing the position of another identification unit and its detection box in an image according to an embodiment of the present invention;
[0048] Figure 4 This is a partial flowchart of another capsule endoscopy quality control method in an embodiment of the present invention;
[0049] Figure 5 This is a schematic diagram of the structure of a capsule endoscope quality control system according to an embodiment of the present invention. Detailed Implementation
[0050] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.
[0051] like Figure 1As shown, this embodiment of the invention provides a capsule endoscope quality control method, applied to a capsule endoscope quality control system. The capsule endoscope quality control system includes a magnetic control device, a capsule endoscope, and a terminal device. The capsule endoscope quality control method includes the following steps:
[0052] S01: The magnetic control device drives the capsule endoscope to move within the target area via the first magnet;
[0053] S02: The capsule endoscope acquires images within the target area and sends the images to the terminal device;
[0054] S03: The terminal device detects whether there is a recognition unit in the image through a trained AI model. When the recognition unit is detected, it outputs the identifier name of the detected recognition unit and the position information of the detection box.
[0055] S04: When the terminal device determines that the position of the detection box of the recognition unit in the image meets the preset conditions, the recognition unit is completely checked;
[0056] S05: The terminal device determines the completeness based on the number of segmentation units detected in the identification unit and the total number of all segmentation units in the target area;
[0057] S06: When the completeness is determined to be 100%, the capsule endoscope ends image acquisition.
[0058] Specifically, the magnetically controlled device is equipped with a multi-axis transmission mechanism or a robotic arm. This embodiment of the invention uses a multi-axis transmission mechanism as an example. The magnetically controlled device controls the movement of the multi-axis transmission mechanism according to control commands, thereby driving the first magnet to move. The capsule endoscope contains a second magnet. The first magnet, through its interaction with the second magnet, drives the capsule endoscope to move within the target area. The capsule endoscope moves within the target area and acquires images. In step S01, the capsule endoscope moves within the target area and acquires images. The movement of the capsule endoscope does not necessarily follow a specific cruising path. In this embodiment of the invention, the target area is a closed space, such as a biomimetic stomach, a stomach model, an excised animal stomach, or a human stomach.
[0059] S02: The capsule endoscope changes position and orientation under the drive of the first magnet and acquires images of the target area, and sends the acquired images to the terminal device in real time.
[0060] S03: The terminal device uses a trained AI model to detect whether a recognition unit exists in each image. For each image, if no recognition unit is detected, a null value is output; otherwise, the identifier name of the detected recognition unit and the position information of the detection box are output. The detection box of the recognition unit can be a rectangle, and the position information of the detection box is the coordinate information of each vertex of the detection box in the corresponding image. For example, for a stomach model, the recognition unit can be the fundus, cardia, lesser curvature, or greater curvature of the stomach.
[0061] S04: The terminal device determines whether the position of the detection box of the recognition unit in the corresponding image meets the preset conditions. When the preset conditions are met, it means that the recognition unit has been completely detected; otherwise, it means that the recognition unit has not been completely detected.
[0062] S05: The terminal device determines completeness based on the percentage of the number of segmented units within the detected identification unit relative to the total number of segmented units within the target area. Here, a segmented unit refers to the smallest feature unit of the target area, and the segmented units constituting the target area do not overlap. For example, in a stomach model, a segmented unit could be the posterior wall below the cardia, the anterior wall below the cardia, the anterior wall of the upper part of the stomach body, the posterior wall of the upper part of the stomach body, or the greater curvature of the upper part of the stomach body, etc.
[0063] S06: When the completeness is determined to be 100%, the capsule endoscope ends image acquisition; otherwise, the capsule endoscope continues to move and acquire images of the target area, and performs complete checks and confirmations on each recognition unit and the completeness of the entire target area until each recognition unit is completely checked and the completeness of the entire target area is 100%, at which point image acquisition ends.
[0064] This invention provides a capsule endoscope quality control method that inspects each image acquired by the capsule endoscope. When no identification unit is detected in the image, the capsule endoscope continues to move and acquire images within the current area. When an identification unit is detected in the image, the method determines whether the identification unit has been completely detected based on the position information of the detection frame of the identification unit. If the identification unit is not completely detected, the capsule endoscope can be controlled to change its position and posture in the area where the identification unit is located and acquire images until it is determined that the identification unit has been completely detected. The terminal device determines the completeness based on the percentage of the total number of segmented units in all detected identification units relative to the total number of segmented units in the target area. When the completeness is 100%, it is confirmed that the complete scan of the target area has been completed. If the completeness reaches 100%, the capsule endoscope is controlled to continue scanning the target area until the completeness reaches 100%, thereby ensuring the comprehensiveness of the inspection, guaranteeing the quality of the inspection, and avoiding missed detections.
[0065] In some embodiments, when the terminal device determines that the position of the detection frame of the recognition unit in the image meets the preset conditions in step S04, the complete inspection of the recognition unit includes: the pixel distances between the detection frame of the recognition unit and the upper, lower, left, and right sides of the image are d1, d2, d3, and d4 respectively. When d1, d2, d3, and d4 are all greater than or equal to the preset threshold d, the recognition unit is completely inspected.
[0066] As Figure 2 , Figure 3 shown, the pixel distances between the detection frame of the recognition unit and the upper, lower, left, and right sides of the image where it is located are d1, d2, d3, and d4 respectively. Compare d1, d2, d3, and d4 with the preset threshold d respectively. The preset threshold d is the distance value to ensure the recognition unit in the corresponding image. The resolution of the image is L*L, then 0 < d < L / 2. When d1, d2, d3, and d4 are all greater than or equal to the preset threshold d, it indicates that the recognition unit has been completely detected; otherwise, the recognition unit has not been completely detected, and the capsule endoscope is controlled to continue scanning, or the capsule endoscope is controlled to rescan and collect images of the area where the recognition unit is located.
[0067] In some embodiments, before step S01, there are also steps:
[0068] S01-1: The terminal device divides the target area into n adjacent and non-overlapping segmentation units. Each segmentation unit has a unique identifier, which are sequentially identified as A1, A2, A3,..., An. All the segmentation units form a set S, S = {A1, A2, A3,..., An}. The set S covers the target area, where 1 ≤ n ≤ N and N is a positive integer;
[0069] S01-2: The terminal device divides the target area into m partially overlapping recognition units. Each recognition unit is composed of k adjacent segmentation units. Each recognition unit has a unique identifier, which are sequentially identified as B1, B2, B3,..., Bm. All the recognition units form a set T, T = {B1, B2, B3,..., Bm}. The set T covers the target area, where 1 ≤ k < n, 1 ≤ m ≤ N, and N is a positive integer.
[0070] Specifically, taking the target area as a human stomach model as an example, the stomach model is divided into 24 parts, namely: fundus A1, cardia A2, posterior wall of the cardia A3, anterior wall of the cardia A4, anterior wall of the upper part of the stomach body A5, posterior wall of the upper part of the stomach body A6, greater curvature of the upper part of the stomach body A7, lesser curvature of the upper part of the stomach body A8, anterior wall of the middle part of the stomach body A9, posterior wall of the middle part of the stomach body A10, greater curvature of the middle part of the stomach body A11, lesser curvature of the middle part of the stomach body A12, anterior wall of the lower part of the stomach body A13, posterior wall of the lower part of the stomach body A14, and stomach body... The lower greater curvature A15, the lower lesser curvature of the gastric body A16, the gastric angle A17, the anterior wall of the gastric angle A18, the posterior wall of the gastric angle A19, the anterior wall of the gastric antrum A20, the posterior wall of the gastric antrum A21, the greater curvature of the gastric antrum A22, the lesser curvature of the gastric antrum A23, and the pylorus A24 are considered as 24 adjacent, non-overlapping segmentation units of the target area. These segmentation units are then grouped into a set S, S = {A1, A2, A3, ..., A24}, and set S covers the entire target area.
[0071] The stomach model is divided into nine partially overlapping identification units: fundus (B1), cardia (B2), lesser curvature (B3), greater curvature (B4), superior gastric cavity (B5), inferior gastric cavity (B6), gastric angle (B7), antrum (B8), and pylorus (B9). These identification units are grouped into a set T, where T = {B1, B2, B3, ..., B9}, and set T covers the entire target region. Wherein:
[0072] Since the gastric fundus B1 cannot be further divided, the identification unit gastric fundus B1 is equivalent to the segmentation unit gastric fundus A1.
[0073] The identification unit cardia B2 is composed of the segmentation unit cardia A2, the inferior posterior wall of cardia A3, and the inferior anterior wall of cardia A4; the identification unit lesser curvature of the stomach B3 is composed of the segmentation unit upper lesser curvature of stomach body A8, middle lesser curvature of stomach body A12, and lower lesser curvature of stomach body A16.
[0074] The identification unit, the greater curvature of the stomach B4, is composed of the segmentation units: the upper greater curvature of the stomach body A7, the middle greater curvature of the stomach body A11, and the lower greater curvature of the stomach body A15.
[0075] The gastric cavity B5 of the identification unit is composed of the segmented unit: the anterior wall of the upper part of the gastric body A5, the posterior wall of the upper part of the gastric body A6, the greater curvature of the upper part of the gastric body A7, the lesser curvature of the upper part of the gastric body A8, the anterior wall of the middle part of the gastric body A9, the posterior wall of the middle part of the gastric body A10, the greater curvature of the middle part of the gastric body A11, and the lesser curvature of the middle part of the gastric body A12.
[0076] The gastric cavity B6 of the identification unit is composed of the segmented unit: the anterior wall of the middle part of the gastric body A9, the posterior wall of the middle part of the gastric body A10, the greater curvature of the middle part of the gastric body A11, the lesser curvature of the middle part of the gastric body A12, the anterior wall of the lower part of the gastric body A13, the posterior wall of the lower part of the gastric body A14, the greater curvature of the lower part of the gastric body A15, and the lesser curvature of the lower part of the gastric body A16.
[0077] The identification unit gastric angle B7 is composed of the segmentation unit gastric angle A17, the anterior wall of the gastric angle A18, and the posterior wall of the gastric angle A19;
[0078] The identification unit, gastric antrum B8, is composed of the segmented units: anterior wall of gastric antrum A20, posterior wall of gastric antrum A21, greater curvature of gastric antrum A22, and lesser curvature of gastric antrum A23.
[0079] Since pylorus B9 cannot be further divided, the identification unit pylorus B9 is equivalent to the segmentation unit pylorus A24.
[0080] Establish the correspondence between each recognition unit and the segmentation units that make up that recognition unit.
[0081] In some embodiments, the training process of the AI model is as follows:
[0082] A set of images pre-capsule images taken at different locations within the target area using a capsule endoscope is selected. Each image in the set contains at least one complete and identifiable recognition unit. All recognition units in the selected set are fully labeled, and a labeling file is generated based on the label name and bounding box. The labeled images are divided into a training set and a test set, with no overlap between the images in the training set and the test set. An initial deep convolutional neural network model is trained using the training set. The initial deep convolutional neural network model is based on a natural scene detection network architecture, and its weights are initialized to the weights of the pre-trained model of the natural scene detection network. During the training process, the feature maps generated by each network convolutional layer are passed between them in a cascade manner, and detection boxes are generated simultaneously. The parameters of the initial deep convolutional neural network model are updated through backpropagation of the loss function gradient to obtain the current deep convolutional neural network model.
[0083] The current deep convolutional neural network (DNN) model is trained using a training set, and tested using a test set. This yields one or a combination of the current DNN model's recognition accuracy, sensitivity, and specificity. The model's performance is then assessed based on these metrics to determine if they meet predetermined requirements. If they do, training terminates, and the model at the termination point is taken as the final DNN model, i.e., the trained AI model. If not, training continues until the predetermined recognition accuracy, sensitivity, and specificity requirements are met. Figure 4 As shown, in some embodiments, step S05, where the terminal device determines completeness based on the number of segmented units within the identified identification unit and the total number of segmented units within the target area, includes:
[0084] S05-01: The terminal device incorporates each detected identification unit into a set T′, which is initially an empty set, and
[0085] S05-02: The terminal device decomposes each of the identification units in the set T′ into k segmentation units according to the correspondence between the identification unit and k adjacent segmentation units;
[0086] S05-03: The terminal device merges the k segmentation units obtained from the decomposition of each identification unit into a set S′, wherein the set S′ is initially an empty set, and
[0087] S05-04: The terminal device calculates the percentage of the number of all the segmented units in the set S′ to the total number of all the segmented units in the set S, and obtains the completeness.
[0088] Specifically, a trained AI model is used to detect the presence of recognition units in each image acquired by the capsule endoscope. Each detected recognition unit is then added to a set T′, which is initially empty. The terminal device incorporates the k segmentation units obtained from decomposing each identification unit into a set S′, where the set S′ is initially empty. The terminal device calculates the percentage of the number of all segmentation units in the set S′ relative to the total number of all segmentation units in the set S, thus obtaining the completeness. For example, by using a trained AI model to detect recognition units in each image acquired by a capsule endoscope, the gastric fundus B1, cardia B2, lesser curvature B3, greater curvature B4, and suprastomach cavity B5 are detected. Then T′={B1, B2, B3, B4, B5}. Based on the correspondence between each recognition unit and the segmentation units that make up that recognition unit, S′={A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A15, A16} is obtained, and S={A1, A2, A3, A4, ..., A22, A23, A24}. In this case, the completeness is (14 / 24)*100%=58.3%.
[0089] In some embodiments, the capsule endoscopy quality control method further includes step S07: the terminal device detects the image quality of the image to obtain a quality inspection result. Further, images meeting the requirements in the quality inspection result are output and displayed for review by medical personnel.
[0090] In some embodiments, the terminal device performs image quality detection on the image to obtain a quality inspection result, including: the terminal device performs mucus detection on the image to obtain a mucus detection result.
[0091] The terminal device performs slime detection on the image to obtain slime detection results, including: the terminal device converts the image to HSV space to obtain an HSV image; the terminal device identifies regions in the HSV image whose S-space value is less than a preset S threshold, obtaining multiple low-saturation regions, where 0 < S < 1.0; the terminal device uses the multiple low-saturation regions as seeds and performs flooding in the S-space according to color gradient changes to obtain multiple first slime regions; the terminal device identifies regions in the multiple first slime regions whose area is greater than a first preset area threshold S1, obtaining multiple second slime regions, where 0 < S1 < L*L; the terminal device calculates the sum of the area of the multiple second slime regions to obtain a first total area; when the first total area is greater than a second preset area threshold S2, the image has a lot of slime, and the slime detection result is that the image does not meet the requirements, where S1 ≤ S2 ≤ L*L; when the first total area is less than or equal to the second preset area threshold, the image has little slime, and the slime detection result is that the image meets the requirements.
[0092] In some embodiments, the terminal device further includes detecting the image quality of the image and obtaining the quality inspection result by:
[0093] S07-01: The terminal device performs overexposure detection on the image and obtains an overexposure detection result;
[0094] S07-02: The terminal device performs underexposure detection on the image and obtains the underexposure detection result;
[0095] S07-03: The terminal device performs blur detection on the image and obtains the blur detection result.
[0096] Sub-step S07-01: The terminal device performs overexposure detection on the image, and the overexposure detection result includes: the terminal device removes noise from the image by Gaussian filtering to obtain a denoised image; the terminal device performs binarization processing on the denoised image according to a preset brightness threshold V to obtain a binarized image, where 0 < V < 1.0; the terminal device detects high-brightness regions in the binarized image to obtain multiple first high-brightness regions; the terminal device determines regions in the multiple first high-brightness regions whose area is greater than a third preset area threshold S3 to obtain multiple second high-brightness regions, where 0 < S3 < L*L; the terminal device calculates the sum of the areas of the multiple second high-brightness regions to obtain a second total area; when the second total area is greater than a fourth preset area threshold S4, the image is overexposed, and the overexposure detection result is that the image does not meet the requirements, where S3 ≤ S4 ≤ L*L; when the second total area is less than or equal to the fourth preset area threshold S4, the overexposure detection result is that the image meets the requirements.
[0097] Sub-step S07-02: The terminal device performs underexposure detection on the image and obtains the underexposure detection result by: the terminal device calculating the average gray level of the image to obtain the average gray level value; when the average gray level value is less than a preset gray level threshold Gray, the image is underexposed, and the underexposure detection result is that the image does not meet the requirements, where 0 < Gray < 255; when the average gray level value is greater than or equal to the preset gray level threshold, the image is not underexposed, and the underexposure detection result is that the image meets the requirements. Sub-step S07-03 describes the terminal device performing blur detection on the image to obtain a blur detection result, which includes: the terminal device performing convolution operation on the image, calculating the gradient change variance of the color channels of the image, and obtaining a gradient change variance value; when the gradient change variance value is less than a preset threshold D, the image is blurred, and the blur detection result is that the image does not meet the requirements, where 0 < D < 100 * 100; when the gradient change variance value is greater than or equal to the preset threshold, the image is clear, and the blur detection result is that the image meets the requirements.
[0098] Images that meet the quality inspection requirements will be output and displayed. This means that only images that simultaneously meet the requirements in overexposure, underexposure, mucus, and blur detection will be output and displayed. Because the resolution of images acquired by capsule endoscopy is lower than that of traditional intubation endoscopes, and capsule endoscopes lack a lens cleaning function, the images acquired by capsule endoscopy cannot always be guaranteed to be clear. By performing quality inspection on the images acquired by capsule endoscopy and outputting images that meet the quality inspection requirements, the efficiency of image review by medical staff can be improved, and it is also more conducive to medical staff making accurate diagnostic results based on images that meet the quality inspection results.
[0099] like Figure 5 As shown, this embodiment of the invention provides a capsule endoscope quality control system, including a magnetic control device, a capsule endoscope, and a terminal device. The terminal device is communicatively connected to the magnetic control device and the capsule endoscope. The magnetic control device is used to drive the capsule endoscope to move within a target area via a first magnet. The capsule endoscope is used to acquire images within the target area and send the images to the terminal device. The terminal device is used to detect the presence of recognition units in the images using a trained AI model. When a recognition unit is detected, the terminal device outputs the identifier name of the detected recognition unit and the position information of the detection frame. The terminal device is also used to determine whether the position of the detection frame of the recognition unit in the image meets preset conditions. The terminal device is also used to determine completeness based on the number of segmentation units within the detected recognition unit and the total number of segmentation units in the target area.
[0100] Specifically, the capsule endoscope may include: a camera module, a control module, a radio frequency module, and a first magnet. The magnetic control device may include a transmission mechanism and a second magnet. The first and second magnets may be electromagnets, permanent magnets, or other types of magnets. The terminal device may be, but is not limited to, various smartphones, tablets, laptops, desktop computers, smart speakers, smartwatches, etc.
[0101] For specific implementation details of each execution entity, please refer to the detailed description of the above method embodiments, which will not be repeated here. In some embodiments, the terminal device is further configured to divide the target area into n adjacent, non-overlapping segmentation units, each segmentation unit having a unique identifier, sequentially identified as A1, A2, A3, ..., An, and all the segmentation units form a set S, S = {A1, A2, A3, ..., An}, the set S covering the target area, where 1 ≤ n ≤ N, and N is a positive integer;
[0102] The terminal device divides the target area into m partially overlapping recognition units, each of which consists of k adjacent segmentation units. Each recognition unit has a unique identifier, which are sequentially identified as B1, B2, B3, ……, Bm. All the recognition units form a set T, T = {B1, B2, B3, ……, Bm}, and the set T covers the target area, where 1 ≤ k < n, 1 ≤ m ≤ N, and N is a positive integer.
[0103] In some embodiments, the terminal device is further configured to incorporate each detected recognition unit into a set T′, where the set T′ is initially an empty set, and The terminal device is further configured to decompose each recognition unit in the set T′ into k segmentation units according to the correspondence between the recognition unit and the k adjacent segmentation units;
[0104] The terminal device is further configured to incorporate the k segmentation units obtained by decomposing each recognition unit into a set S′, where the set S′ is initially an empty set, and The terminal device is further configured to calculate the percentage of the number of all the segmentation units in the set S′ to the number of all the segmentation units in the set S to obtain the completeness.
[0105] For the specific implementation of the terminal device, please refer to the specific description of the above method embodiments, which will not be elaborated here. The optional embodiments of the present invention have been described in detail above with reference to the accompanying drawings. However, the embodiments of the present invention are not limited to the specific details in the above embodiments. Within the technical concept scope of the embodiments of the present invention, various simple modifications can be made to the technical solutions of the embodiments of the present invention, and these simple modifications all fall within the protection scope of the embodiments of the present invention.
[0106] In addition, it should be noted that, in the above specific embodiments, the various specific technical features described can be combined in any suitable manner without contradiction. To avoid unnecessary repetition, the embodiments of the present invention do not separately describe various possible combination manners.
[0107] In addition, any combination can be made among various different embodiments of the present invention as long as it does not violate the idea of the embodiments of the present invention, and it should also be regarded as the content disclosed by the embodiments of the present invention.
Claims
1. A capsule endoscope quality control system, characterized in that, It includes a magnetic control device, a capsule endoscope, and a terminal device. The terminal device is communicatively connected to the magnetic control device and the capsule endoscope respectively; The magnetic control device is used to drive the capsule endoscope to move within the target area through a first magnet; The capsule endoscope is used to collect images within the target area and send the images to the terminal device; The terminal device is used to detect whether there is an identification unit in the image through a trained AI model. When the identification unit is detected, it outputs the identification name of the detected identification unit and the position information of the detection frame; The terminal device is further used to determine whether the position of the detection frame of the identification unit in the image meets a preset condition; The terminal device is further used to determine the completeness according to the number of segmentation units in the detected identification unit and the number of all segmentation units in the target area; The terminal device detects the image quality of the image and obtains a quality inspection result, including: The terminal device performs mucus detection on the image and obtains a mucus detection result. Specifically: The terminal device converts the image into the HSV space to obtain an HSV image; The terminal device determines the areas in the HSV image where the S space value is less than a preset S threshold to obtain multiple low-saturation areas; The terminal device uses the multiple low-saturation areas as seeds and performs flood filling in the S space according to the color gradient change to obtain multiple first mucus areas; The terminal device determines the areas in the multiple first mucus areas where the area is greater than a first preset area threshold to obtain multiple second mucus areas; The terminal device calculates the sum of the areas of the multiple second mucus areas to obtain a first total area; When the first total area is greater than a second preset area threshold, there is a lot of mucus in the image, and the mucus detection result is that the image does not meet the requirements; When the first total area is less than or equal to the second preset area threshold, there is little mucus in the image, and the mucus detection result is that the image meets the requirements; The terminal device outputs and displays the images that meet the requirements in the quality inspection result.
2. The capsule endoscope quality control system according to claim 1, characterized in that, The terminal device is further used to divide the target area into n adjacent and non-overlapping segmentation units. Each segmentation unit has a unique identifier, which is sequentially identified as A1, A2, A3,..., An. All the segmentation units form a set S, S = {A1, A2, A3,..., An}, and the set S covers the target area, where 1 ≤ n ≤ N and N is a positive integer; The terminal device divides the target area into m partially overlapping identification units. Each identification unit is composed of k adjacent segmentation units. Each identification unit has a unique identifier, which is sequentially identified as B1, B2, B3,..., Bm. All the identification units form a set T, T = {B1, B2, B3,..., Bm}, and the set T covers the target area, where 1 ≤ k < n, 1 ≤ m ≤ N, and N is a positive integer.
3. The capsule endoscope quality control system according to claim 2, characterized in that, The terminal device is further configured to incorporate each detected identification unit into a set T′, wherein the set T′ is initially an empty set, and T′ T; The terminal device is further configured to decompose each of the identification units in the set T′ into k of the segmentation units according to the correspondence between the identification unit and k adjacent segmentation units; The terminal device is further configured to incorporate the k segmentation units obtained from the decomposition of each identification unit into a set S′, wherein the set S′ is initially an empty set, and S′ S; The terminal device is further configured to calculate the percentage of the number of all the segmented units in the set S′ relative to the total number of all the segmented units in the set S, thereby obtaining the completeness; and / or The terminal device is further configured to determine whether the position of the detection box of the recognition unit in the image meets preset conditions, specifically including: The pixel distances between the detection box of the recognition unit and the top, bottom, left, and right sides of the image are d1, d2, d3, and d4, respectively. When d1, d2, d3, and d4 are all greater than or equal to a preset threshold d, the terminal device determines that the position of the detection box of the recognition unit in the image meets the preset condition, and the recognition unit is completely checked.
Citation Information
Patent Citations
Capsule endoscopy system
CN112075914A