A sputum smear compliance detection method based on fragmentation processing and an AI model
By employing a sputum smear compliance detection method based on smear segmentation and AI models, the problems of subjectivity and low efficiency in sputum smear quality assessment have been solved, achieving objective, accurate detection and efficient quality control of sputum smears.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- WEST CHINA HOSPITAL SICHUAN UNIV
- Filing Date
- 2026-03-05
- Publication Date
- 2026-05-29
AI Technical Summary
In existing technologies, the quality assessment of sputum smears relies on manual microscopic examination, which suffers from high subjectivity, low efficiency, insufficient stability, and poor adaptability to general AI models, resulting in poor repeatability and difficulty in correcting errors.
A sputum smear compliance detection method based on slice processing and AI model is adopted. Low-magnification objective scan images are acquired, preprocessed and segmented, and screened using Lab space characteristics and ab channel features. Cell counting is performed by combining the Transformer detection network with multi-scale fusion module to generate a digital traceability report.
It enables objective and accurate compliance testing of sputum smears, improves the identification accuracy of WBC and EC, ensures testing efficiency and stability, establishes a traceable quality calibration mechanism, and supports high-throughput testing.
Smart Images

Figure CN121810666B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of artificial intelligence and medicine, specifically to a method for detecting the compliance of sputum smears based on slice processing and AI models. Background Technology
[0002] Sputum smear quality assessment is a crucial preliminary step in the diagnosis of respiratory infections and the etiological detection of pathogens such as tuberculosis. Its results directly determine whether a sample is suitable for subsequent testing and affect the reliability of the test results. Currently, sputum smear quality assessment mainly relies on manual microscopic examination by laboratory personnel. Based on the Murray-Washington criteria, WBCs (white blood cells) and ECs (epithelial cells) within the field of view are observed, counted, and threshold-determined, resulting in a "pass / fail" conclusion.
[0003] However, existing manual microscopic examination methods have significant drawbacks: First, they rely on individual experience and visual interpretation, which can easily lead to differences in judgment between different examiners or between the same examiner at different times, resulting in subjective results and poor repeatability. Second, the counting and statistical processes are meticulous and repetitive operations, which are time-consuming and labor-intensive. Under the demand for high-throughput detection, visual fatigue can easily introduce omissions and miscounts, affecting detection efficiency and quality stability. Third, they only output final judgments and lack a process-based quantitative calibration mechanism, making it difficult to correct errors. Furthermore, there are no traceability records, resulting in weak quality control capabilities.
[0004] Meanwhile, directly applying general AI (Artificial Intelligence) detection models to sputum smear microscopic image detection yields poor results: on the one hand, the pre-trained weights of general models are designed for macroscopic objects and are difficult to adapt to the detection of small volumes and numerous cells under low-magnification microscopes; on the other hand, downsampling of large-size images leads to the loss of cell information, further reducing the recognition accuracy. Therefore, there is an urgent need for a sputum smear compliance detection solution that balances objectivity, efficiency, and stability. Summary of the Invention
[0005] To address the aforementioned shortcomings in existing technologies, this invention provides a sputum smear compliance detection method based on slice processing and an AI model, which solves the problems of strong subjectivity, low efficiency, insufficient stability, and poor adaptability of general AI models in existing technologies.
[0006] To achieve the above-mentioned objectives, the technical solution adopted by this invention is as follows:
[0007] A method for sputum smear compliance detection based on smear processing and AI model includes the following steps:
[0008] S1. Obtain the full image of the sputum smear by low-power objective scanning, and after preprocessing, crop and segment it to obtain a set of fields of view containing multiple field of view blocks.
[0009] S2. Based on the physical compliance of the L (brightness) channel and the chromaticity compliance of the ab (red-green-yellow-blue) channel in the Lab (brightness-red-green-yellow-blue) space, the field of view set is screened and sorted. Combined with the requirement of spatial non-overlap, quality-first heuristic sampling is performed to obtain the field of view set to be inspected.
[0010] S3. Each field of view block in the set of fields of view to be inspected is clipped into multiple sub-images by sliding window, and the sub-images are input into an optimized Transformer detection network with the last-stage downsampling canceled and containing a multi-scale fusion module for cell detection. The sub-image detection results are fused through a redundancy elimination algorithm to obtain the WBC / EC cell count of each field of view block.
[0011] S4. Based on the WBC / EC cell count of each field of view in the set of fields of view to be inspected, determine the compliance level of the sputum smear according to the preset standards, and generate a digital traceability report.
[0012] Further, step S1 includes the following sub-steps:
[0013] S11. Obtain a full-size image of the sputum smear using a low-power objective lens;
[0014] S12. Perform preprocessing on the entire image, including: white balance correction, brightness / contrast normalization, and smoothing and noise reduction;
[0015] S13. The preprocessed full-image is cropped into multiple field-of-view blocks according to a fixed pixel size to form a field-of-view set.
[0016] Further, S2 includes the following steps:
[0017] S21. Perform color space conversion on each field of view in the field of view set, from RGB space to CIE Lab space;
[0018] S22. Based on the L-channel value of Lab space, define two indicators, thickness tendency and uniformity, to reflect the thickness and uniformity of sputum smears, and calculate the thickness tendency-uniformity deviation of each field of view in the field of view set.
[0019] S23. Perform a first round of screening on the field of view set based on the physical compliance of the L-channel, and remove field of view blocks whose thickness tendency-uniformity deviation is greater than the first threshold.
[0020] S24. Based on the two-dimensional joint histogram representation vector of channels a and b in Lab space, define the staining distribution feature vector and calculate the staining compliance score of each field of view in the field of view set after the first round of screening.
[0021] S25. Perform a second round of screening on the field of view set after the first round of screening based on the staining compliance score, and remove field of view blocks whose staining compliance score is less than the second threshold.
[0022] S26. Sort the remaining field-of-view blocks after the second round of screening according to their staining compliance scores from high to low;
[0023] S27. Remove blocks that do not meet the condition "distance between the centers of any two viewpoints". The field of view is selected based on the "third threshold" condition, and the front view is selected. The set of fields of view to be inspected consists of several field-of-view blocks. It is a positive integer.
[0024] Furthermore, in S22, the expression for the thickness tendency is: ,
[0025] in, For thickness tendency, This represents the total number of Lab space pixels in the field of view block. For the Lab space of the view block Pixel L-channel normalized value;
[0026] The expression for the uniformity is: ,
[0027] in, For uniformity, This represents the normalized mean of the L-channel in the Lab space of the field of view. For a very small number of parameters, The standard deviation of brightness;
[0028] The expression for the standard deviation of brightness is: ;
[0029] The expression for the thickness tendency-uniformity deviation is: ,
[0030] in, For thickness tendency - uniformity deviation, The mean value of the standard thickness tendency index for sputum smears. This is a standard uniformity index.
[0031] Furthermore, in S24, the staining distribution feature vector is the normalized result of the two-dimensional joint histogram expression vector of channels a and b;
[0032] The expression for the dyeing compliance score is: ,
[0033] in, For dyeing compliance scoring, It is an exponential function with the natural constant as its base. The Bartholin's distance between the staining distribution feature vector and the standard staining distribution feature vector of sputum smear; ,
[0034] in, The element index is located in the feature vector of the color distribution. The th element in the eigenvector of the staining distribution Element value, The first eigenvector in the standard staining distribution feature vector of sputum smear Element value, Let be a logarithmic function with the natural constant as its base. is the length of the eigenvector of the coloring distribution.
[0035] Furthermore, the optimization of the Transformer detection network in S3 includes:
[0036] Remove the final downsampling layer in the backbone network that generates 1 / 32 resolution scale features;
[0037] The backbone network outputs three-scale features, including 1 / 4 resolution scale features, 1 / 8 resolution scale features, and 1 / 16 resolution scale features;
[0038] A multi-scale fusion module was set up behind the backbone network.
[0039] Furthermore, the multi-scale fusion module outputs a multi-scale fusion feature set. ,in This is an intermediate fusion feature at a 1 / 4 resolution scale. For intermediate fusion features at a 1 / 8 resolution scale, Intermediate fusion features at a 1 / 16 resolution scale; , , ,
[0040] in, This is a 3×3 convolution operation function. For channel-based fusion operators, , and These are the 1 / 4 resolution scale features, 1 / 8 resolution scale features, and 1 / 16 resolution scale features after 1×1 convolution operations, respectively.
[0041] Furthermore, in S3, the optimized Transformer detection network detects all cell detection targets in each subgraph. Each cell detection target has three pieces of information: predicted bounding box coordinates, WBC / EC class label, and confidence score.
[0042] The method for obtaining the WBC / EC cell count for each field of view block by fusing the sub-image detection results through the redundancy elimination algorithm in S3 is as follows: For each field of view block, based on the WBC / EC category label, all cell detection targets within all sub-images corresponding to the field of view block are divided into two categories, and the following steps are performed for each cell detection target in each category:
[0043] A1. Based on the offset coordinates of the sub-image relative to the field of view, the coordinates of each predicted box are traced back to the field of view coordinate system;
[0044] A2. Sort each prediction box from highest to lowest confidence level;
[0045] A3. Initialize an empty set as the representative set, and add the prediction box with the highest confidence to the representative set;
[0046] A4. Iterate through each prediction box sorted from high to low confidence, and calculate the intersection-union ratio (IU) of each prediction box with the prediction boxes in the representative set. If the IU is greater than or equal to the fourth threshold, use the weighted fusion method to merge it with the corresponding prediction box in the representative set. Otherwise, add it as a new prediction box to the representative set.
[0047] A5. The final representative set is used as the fusion result of the redundancy elimination algorithm. The number of detection boxes in the representative set is the cell count of the corresponding category in the field of view.
[0048] Further, the method in S4 is as follows: The mean WBC cell count and mean EC cell count of the set of fields to be examined are calculated respectively as the average WBC cell count and average EC cell count per field of sputum smear, and the compliance level of the sputum smear is determined according to the following criteria, and a digital traceability report is generated:
[0049] Acceptable: >25 WBC cells and <10 EC cells per low-power field;
[0050] Non-deep sputum: WBC count <10 per low power field, EC count >25;
[0051] Basic qualification 1: WBC cell count per low-power field is 10-25, EC cell count is <25;
[0052] Basic qualification 2: WBC cell count >25 and EC cell count >25 per low power field.
[0053] The beneficial effects of this invention are as follows:
[0054] 1) To address the challenge of balancing accuracy and computational power in small target recognition, the SAHI (Slicing Aided Hyper Inference) framework is introduced. This framework performs non-destructive slicing of the field of view, ensuring that the inference process remains based on the original pixel resolution. This approach effectively avoids the loss of cell features caused by image scaling, significantly improving the recognition accuracy of WBC and EC.
[0055] 2) Eliminate subjective influences and achieve objective judgment: Utilize the characteristics of Lab space, and calculate the color perception by using the features of the ab channels and the Bach distance, to convert color perception into quantitative values, accurately select effective fields of view, ensure consistent sampling logic, and avoid human cognitive bias.
[0056] 3) To balance detection efficiency and statistical representativeness, this invention adopts an "image filtering + spatial non-overlapping sampling" strategy. By selecting representative fields of view and eliminating redundant areas, it can efficiently support high-throughput clinical detection while ensuring full coverage.
[0057] 4) Establish a traceable quality calibration mechanism: generate digital reports, support manual review, realize quantitative monitoring of the testing process and traceability of results, and improve quality control capabilities. Attached Figure Description
[0058] Figure 1 This is a flowchart of a sputum smear compliance detection method based on slice processing and AI model according to an embodiment of the present invention;
[0059] Figure 2 This is a full-view image of a sputum smear obtained by low-magnification objective scanning according to an embodiment of the present invention, and one of its fields of view. Detailed Implementation
[0060] The specific embodiments of the present invention are described below to enable those skilled in the art to understand the present invention. However, it should be understood that the present invention is not limited to the scope of the specific embodiments. For those skilled in the art, various changes are obvious as long as they are within the spirit and scope of the present invention as defined and determined by the appended claims. All inventions utilizing the concept of the present invention are protected.
[0061] like Figure 1 As shown, a method for sputum smear compliance detection based on smear processing and AI model includes the following steps:
[0062] S1. Obtain the full image of the sputum smear by low-power objective scanning, and after preprocessing, crop and segment it to obtain a set of fields of view containing multiple field of view blocks.
[0063] S1 includes the following steps:
[0064] S11. Obtain a full-size image of the sputum smear using a low-power objective lens;
[0065] S12. Perform preprocessing on the entire image, including: white balance correction, brightness / contrast normalization, and smoothing and noise reduction;
[0066] S13. The preprocessed full-image is cropped into multiple field-of-view blocks according to a fixed pixel size to form a field-of-view set.
[0067] In this embodiment, as Figure 2 As shown, the system receives a whole-slide image (WSI) of a sputum smear under a low-magnification objective lens (e.g., 10×) via an interface. This image at this magnification reflects the macroscopic distribution, staining characteristics, and obvious artifact areas of the sputum smear.
[0068] Read the entire image I and retain metadata related to coordinate backtracking, including pixel resolution (μm / px), full-image coordinate system definition, stitching offset information, etc., for subsequent detection results to be backtracked to the full image and the original field of view position, so as to achieve result traceability.
[0069] To reduce the offset introduced by differences in scanning equipment, batch staining, and imaging brightness, basic preprocessing is performed on the entire image I, including at least:
[0070] White balance correction;
[0071] Brightness / contrast normalization (or color normalization strategy);
[0072] Smoothing and denoising (e.g., mild Gaussian filtering / bilateral filtering).
[0073] Then, the preprocessed full-image I' is obtained. I' is then cropped into view patches of fixed pixel size. The set of fields of view (e.g., each field of view block is 2560×2560 pixels). For each viewpoint block, the cropping method can be a grid scan (with or without overlap). Record its upper left corner coordinates in the I' coordinate system. As a view-level coordinate index.
[0074] S2. Based on the physical compliance of the L (brightness) channel and the coloring compliance of the ab (red-green-yellow-blue) channel in the Lab (brightness-red-green-yellow-blue) space, the field of view set is screened and sorted. Combined with the requirement of non-overlapping space, quality-first heuristic sampling is performed to obtain the field of view set to be inspected.
[0075] S2 includes the following steps:
[0076] S21. Perform color space conversion on each field of view block in the field of view set, from RGB space to CIE Lab space.
[0077] In this embodiment, the RGB color space is first converted to the XYZ color space: ,
[0078] Recalculate the Lab three channels: , , ,
[0079] in, , , These are the three channel values in RGB space. , , These are the three components of the XYZ color space. , , These are the three channel values in Lab space. , and To reference the standard values of the XYZ color space components of the white point, The default value is 95.047. The default value is 100.0. The default value is 108.883.
[0080] function The expression is: ,
[0081] in, For function The independent variable.
[0082] S22. Based on the L-channel value of Lab space, define two indicators, thickness tendency and uniformity, to reflect the thickness and uniformity of sputum smears, and calculate the thickness tendency-uniformity deviation of each field of view in the field of view set.
[0083] Microscopic imaging brightness is related to transmittance; changes in smear thickness can cause a systematic change in the overall brightness distribution of the field of view. Therefore, a thickness tendency index is defined. with uniformity index .
[0084] First, normalize the L channel values, for example, by mapping them to [0,1].
[0085] The thickness tendency is defined as follows: ,in, For thickness tendency, This represents the total number of Lab space pixels in the field of view block. For the Lab space of the view block Normalized value of the L channel of a pixel.
[0086] Uniformity is defined as: ,
[0087] in, For uniformity, This represents the normalized mean of the L-channel in the Lab space of the field of view. For a very small number of parameters, This represents the standard deviation of brightness.
[0088] The expression for the standard deviation of luminance is: .
[0089] The standard model feature set was obtained based on statistical analysis of existing labeled datasets from inspectors. ,
[0090] in, For the standard model feature set, The mean value of the standard thickness tendency index for sputum smears. As a standard uniformity index, This represents the characteristic vector of standard staining distribution in sputum smears.
[0091] The expression for thickness tendency-uniformity deviation is defined as follows: ,
[0092] in, This refers to the thickness tendency - uniformity deviation.
[0093] S23. Perform a first round of screening on the view set based on L-channel physical compliance, removing view items whose thickness tendency-uniformity deviation exceeds the first threshold. The field of view.
[0094] S24. Based on the two-dimensional joint histogram representation vector of channels a and b in Lab space, define the staining distribution feature vector, and calculate the staining compliance score of each field of view in the field of view set after the first round of screening.
[0095] In this embodiment, a two-dimensional joint histogram of the ab dual channels is extracted from the field of view blocks that pass the first round of screening;
[0096] Binning and quantizing channels a and b yields a two-dimensional histogram representation vector. ;
[0097] Will Normalization and quantization .
[0098] This is the characteristic vector of the coloring distribution.
[0099] calculate and Bach distance:
[0100] ,
[0101] in, The Bartholin's distance between the staining distribution feature vector and the standard staining distribution feature vector of sputum smear is given. The element index is located in the feature vector of the color distribution. The th element in the eigenvector of the staining distribution Element value, The first eigenvector in the standard staining distribution feature vector of sputum smear Element value, Let be a logarithmic function with the natural constant as its base. is the length of the eigenvector of the coloring distribution.
[0102] Then, the expression for the coloring compliance score is defined as follows: ,
[0103] in, For dyeing compliance scoring, It is an exponential function with the natural constant as its base.
[0104] Fraction The larger the value, the closer the staining distribution is to the standard.
[0105] S25. Perform a second round of screening on the field of view after the first round of screening, based on the staining compliance score, and remove fields with a staining compliance score lower than the second threshold. The field of view.
[0106] At this point, the set of views after the second round of screening can be represented as ,in, For the field of view Dyeing compliance score, For the field of view Thickness tendency - uniformity deviation.
[0107] S26. Sort the remaining field-of-view blocks after the second round of screening according to their staining compliance scores from high to low.
[0108] S27. Remove blocks that do not meet the condition "distance between the centers of any two viewpoints". The field of view is selected based on the "third threshold" condition, and the front view is selected. The set of fields of view to be inspected consists of several field-of-view blocks. It is a positive integer.
[0109] In this embodiment, Take 50.
[0110] The third threshold is taken as the side length of the field of view image in this embodiment, so as to avoid the sampled field of view blocks being concentrated in the same area.
[0111] S3. Each field of view in the set of fields of view to be inspected is clipped into multiple sub-images by sliding window. The sub-images are then input into an optimized Transformer detection network with the final downsampling canceled and a multi-scale fusion module included for cell detection. The sub-image detection results are fused through a redundancy elimination algorithm to obtain the WBC / EC cell count for each field of view.
[0112] In this embodiment, to avoid the loss of cell texture and boundary information caused by direct resizing and downsampling of large-resolution fields of view, the system performs resampling on each field of view block. Perform sliding window clipping inference:
[0113] right For example, a 2560×2560 image can be cropped into a sub-image set using a sliding window. The size is 640×640, and the overlap rate between subgraphs is r=0.2. This is the subgraph number.
[0114] Record each subgraph Compared to Top left corner offset coordinates This is used for subsequent detection box coordinate backtracking.
[0115] In this embodiment, step S3 is optimized based on the existing Transformer detection network as follows:
[0116] Remove the final downsampling layer in the backbone network that generates 1 / 32 resolution scale features;
[0117] The backbone network outputs three-scale features, including 1 / 4 resolution scale features. 1 / 8 resolution scale features and 1 / 16 resolution scale features ;
[0118] A multi-scale fusion module (MFM) was set up after the backbone network.
[0119] In this embodiment, the module uses the three-scale features output by the backbone network. For the input (corresponding to the Transformer detection network stride parameters {4, 8, 16}), channel alignment is first performed using a 1×1 convolution to obtain a unified channel dimension. Features: ,
[0120] Among them, serial number , For channel dimension 1×1 convolution operation.
[0121] The multi-scale fusion module outputs a multi-scale fused feature set. ,in This is an intermediate fusion feature at a 1 / 4 resolution scale. For intermediate fusion features at a 1 / 8 resolution scale, Intermediate fusion features at a 1 / 16 resolution scale; , , ,
[0122] in, This is a 3×3 convolution operation function. For channel-based fusion operators, , and These are the 1 / 4 resolution scale features, 1 / 8 resolution scale features, and 1 / 16 resolution scale features after 1×1 convolution operations, respectively.
[0123] The optimized Transformer detection network in S3 detects all cells in each subgraph. Each cell has three pieces of information: bounding box coordinates, WBC / EC class label, and confidence score.
[0124] In this embodiment, S3 uses the Greedy NMM (Non-Maximum Merging) redundancy elimination algorithm to fuse sub-image detection results and obtain the WBC / EC cell count for each field of view. The method is as follows: For each field of view, based on the WBC / EC category label, all cell detection targets within all sub-images corresponding to the field of view are divided into two categories, and the following steps are performed for each cell detection target in each category:
[0125] A1. Based on the offset coordinates of the sub-image relative to the view area, the coordinates of each predicted box are traced back to the view area coordinate system. In this embodiment:
[0126] Pair diagram Predicted bounding boxes detected in the image: ,
[0127] For the predicted box number, For the first The first view block Subgraph The coordinate set of the predicted bounding box is obtained by using previously recorded submaps. Compared to Top left corner offset Back to the view block Coordinate system:
[0128] , A2. Sort the prediction boxes from highest to lowest confidence level.
[0129] A3. Initialize an empty set as the representative set, and add the prediction box with the highest confidence to the representative set;
[0130] A4. Iterate through each predicted box after sorting the confidence levels from high to low, and calculate the intersection-union ratio (IoU) between each predicted box and the predicted boxes in the representative set. If the IoU is greater than or equal to the fourth threshold τ, then use the weighted fusion method to merge it with the corresponding predicted box in the representative set. Otherwise, add it as a new predicted box to the representative set.
[0131] A5. The final representative set is used as the fusion result of the redundancy elimination algorithm. The number of detection boxes in the representative set is the cell count of the corresponding category in the field of view.
[0132] S4. Based on the WBC / EC cell count of each field of view in the set of fields of view to be inspected, determine the compliance level of the sputum smear according to the preset standards, and generate a digital traceability report.
[0133] In this embodiment, the mean WBC cell count and mean EC cell count of 50 representative fields of view of the sputum smear are calculated as the average WBC cell count and average EC cell count per field of view. The compliance level of the sputum smear is determined according to the following criteria, and a digital traceability report is generated:
[0134] Acceptable: >25 WBC cells and <10 EC cells per low-power field;
[0135] Non-deep sputum: WBC count <10 per low power field, EC count >25;
[0136] Basic qualification 1: WBC cell count per low-power field is 10-25, EC cell count is <25;
[0137] Basic qualification 2: WBC cell count >25 and EC cell count >25 per low power field.
[0138] By comparing the samples, we can determine whether the sample quality is up to standard.
[0139] The system automatically generates compliance reports that include quantitative statistical charts and sample quality grading recommendations. The report not only provides the final judgment but also visually labels the coordinates of the detected cells in 50 field-of-view blocks, allowing laboratory personnel to manually review the original high-resolution images and ensuring the traceability and objectivity of the diagnostic results.
[0140] In summary, this invention:
[0141] 1) A balance between computational complexity and accuracy was achieved in the model for small target recognition tasks.
[0142] In contrast, existing general AI models often use resizing technology, which causes pixel loss in the already tiny white blood cells during downsampling, resulting in serious missed detections.
[0143] Advantages of this invention: This invention introduces the SAHI framework, which performs non-destructive physical segmentation of the field of view.
[0144] This strategy of slicing and merging inference results ensures that the inference process is always carried out at the original pixel resolution, completely avoiding the blurring of cell features caused by image scaling, and greatly improving the identification accuracy of WBCs and pathogens.
[0145] 2) It eliminates the subjective influence of inspectors and allows for objective judgment based on numerical values.
[0146] In contrast, manual microscopic examination relies on the inspector's sensory memory of color, is easily affected by batch differences in dyeing and visual fatigue, and lacks unified quantitative standards.
[0147] Advantages of this invention: This invention utilizes the characteristic that the Lab space is more in line with human perception. Under the condition of ignoring the light intensity (L channel), it extracts the features of the ab dual channels and calculates the Bach distance with the training set to perform image screening.
[0148] By using Bach distance similarity calculation, the fuzzy color perception is transformed into a quantifiable value. This not only accurately filters out meaningless blank areas and areas where the staining effect does not conform to the tester's experience, but also ensures the objectivity and consistency of the sampling logic throughout the entire image, eliminating human cognitive bias.
[0149] 3) It balances detection efficiency with statistical representativeness.
[0150] In contrast, manual microscopic examination is difficult to complete the observation of a large sample size in a short time, often leading to "generalization based on limited information"; while general models lack sampling and screening mechanisms and have high computational redundancy.
[0151] Advantages of this invention: It adopts an "image filtering + spatial non-overlapping sampling" strategy to automatically extract 50 suitable fields of view from the candidate pool.
[0152] Advantages: This mechanism ensures the statistical principle of "full coverage" while eliminating redundant and invalid fields of view, achieving an optimal balance between detection speed and result stability, and meeting the needs of high-throughput clinical testing.
[0153] 4) A closed-loop traceable quality calibration mechanism was constructed.
[0154] In contrast, the traditional process only provides a paper-based conclusion, and the basis for its judgment (which fields of view were selected, how many cells were counted) cannot be verified.
[0155] Advantages of this invention: After completing the AI automatic classification judgment, this invention will generate a digital report containing 50 global coordinates of the field of view and cell prediction boxes.
[0156] This traceable reporting format provides clinicians with powerful traceability capabilities. Laboratory personnel can click on coordinates at any time to review the original field of view, enabling quantifiable monitoring of the quality grading process.
[0157] The above are merely preferred embodiments of the present invention and are not intended to limit the present invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A method for detecting compliance of sputum smears based on slice processing and AI models, characterized in that, Includes the following steps: S1. Obtain the full image of the sputum smear by low-power objective scanning, and after preprocessing, crop and segment it to obtain a set of fields of view containing multiple field of view blocks. S2. Based on the physical compliance of the L channel and the staining compliance of the ab channel in the Lab space, the field of view set is screened and sorted. Combined with the requirement of spatial non-overlap, quality-first heuristic sampling is performed to obtain the field of view set to be inspected. S3. Each field of view block in the set of fields of view to be inspected is clipped into multiple sub-images by sliding window, and the sub-images are input into an optimized Transformer detection network with the last-stage downsampling canceled and containing a multi-scale fusion module for cell detection. The sub-image detection results are fused through a redundancy elimination algorithm to obtain the WBC / EC cell count of each field of view block. S4. Based on the WBC / EC cell count of each field of view in the set of fields of view to be inspected, determine the compliance level of the sputum smear according to the preset standards, and generate a digital traceability report. S2 includes the following steps: S21. Perform color space conversion on each field of view in the field of view set, from RGB space to CIE Lab space; S22. Based on the L-channel value of Lab space, define two indicators, thickness tendency and uniformity, to reflect the thickness and uniformity of sputum smears, and calculate the thickness tendency-uniformity deviation of each field of view in the field of view set. S23. Perform a first round of screening on the field of view set based on the physical compliance of the L-channel, and remove field of view blocks whose thickness tendency-uniformity deviation is greater than the first threshold. S24. Based on the two-dimensional joint histogram representation vector of channels a and b in Lab space, define the staining distribution feature vector and calculate the staining compliance score of each field of view in the field of view set after the first round of screening. S25. Perform a second round of screening on the field of view set after the first round of screening based on the staining compliance score, and remove field of view blocks whose staining compliance score is less than the second threshold. S26. Sort the remaining field-of-view blocks after the second round of screening according to their staining compliance scores from high to low; S27. Remove blocks that do not satisfy the condition "distance between the centers of any two viewpoints". The field of view is selected based on the "third threshold" condition, and the front view is selected. The set of fields of view to be inspected consists of several field-of-view blocks. It is a positive integer; In S22, the expression for the thickness tendency is: , in, For thickness tendency, This represents the total number of Lab space pixels in the field of view block. For the Lab space of the view block Pixel L-channel normalized value; The expression for the uniformity is: , in, For uniformity, This represents the normalized mean of the L-channel in the Lab space of the field of view. For a very small number of parameters, The standard deviation of brightness; The expression for the standard deviation of luminance is: ; The expression for the thickness tendency-uniformity deviation is: , in, For thickness tendency - uniformity deviation, The mean value of the standard thickness tendency index for sputum smears. Standard uniformity index; The optimized Transformer detection network in S3 provides the detection results for all cell detection targets in each subgraph. Each cell detection target has three pieces of information: predicted bounding box coordinates, WBC / EC class label, and confidence score. The method for obtaining the WBC / EC cell count for each field of view block by fusing the sub-image detection results through the redundancy elimination algorithm in S3 is as follows: For each field of view block, based on the WBC / EC category label, all cell detection targets within all sub-images corresponding to the field of view block are divided into two categories, and the following steps are performed for each cell detection target in each category: A1. Based on the offset coordinates of the sub-image relative to the field of view, the coordinates of each predicted box are traced back to the field of view coordinate system; A2. Sort each prediction box from highest to lowest confidence level; A3. Initialize an empty set as the representative set, and add the prediction box with the highest confidence to the representative set; A4. Iterate through each prediction box sorted from high to low confidence, and calculate the intersection-union ratio (IU) of each prediction box with the prediction boxes in the representative set. If the IU is greater than or equal to the fourth threshold, use the weighted fusion method to merge it with the corresponding prediction box in the representative set. Otherwise, add it as a new prediction box to the representative set. A5. The final representative set is used as the fusion result of the redundancy elimination algorithm. The number of detection boxes in the representative set is the cell count of the corresponding category in the field of view.
2. The sputum smear compliance detection method based on slice processing and AI model according to claim 1, characterized in that, S1 includes the following steps: S11. Obtain a full-size image of the sputum smear using a low-power objective lens; S12. Perform preprocessing on the entire image, including: white balance correction, brightness / contrast normalization, and smoothing and noise reduction; S13. The preprocessed full-image is cropped into multiple field-of-view blocks according to a fixed pixel size to form a field-of-view set; 。 3. The sputum smear compliance detection method based on slice processing and AI model according to claim 1, characterized in that, In S24, the staining distribution feature vector is the normalized result of the two-dimensional joint histogram expression vector of channels a and b; The expression for the dyeing compliance score is: , in, For dyeing compliance scoring, It is an exponential function with the natural constant as its base. The Bartholin's distance between the staining distribution feature vector and the standard staining distribution feature vector of sputum smear; , in, The element index is located in the feature vector of the color distribution. The th element in the eigenvector of the staining distribution Element value, The first eigenvector in the standard staining distribution feature vector of sputum smear Element value, Let be a logarithmic function with the natural constant as its base. is the length of the eigenvector of the coloring distribution.
4. The sputum smear compliance detection method based on slice processing and AI model according to claim 1, characterized in that, The optimizations to the Transformer detection network in S3 include: Remove the final downsampling layer in the backbone network that generates 1 / 32 resolution scale features; The backbone network outputs three-scale features, including 1 / 4 resolution scale features, 1 / 8 resolution scale features, and 1 / 16 resolution scale features; A multi-scale fusion module was set up after the backbone network.
5. The sputum smear compliance detection method based on slice processing and AI model according to claim 4, characterized in that, The multi-scale fusion module outputs a multi-scale fusion feature set. ,in This is an intermediate fusion feature at a 1 / 4 resolution scale. For intermediate fusion features at 1 / 8 resolution scale, Intermediate fusion features at a 1 / 16 resolution scale; , , , in, This is a 3×3 convolution operation function. For channel-based fusion operators, , and These are the 1 / 4 resolution scale features, 1 / 8 resolution scale features, and 1 / 16 resolution scale features after 1×1 convolution operations, respectively.
6. The sputum smear compliance detection method based on slice processing and AI model according to claim 1, characterized in that, The method described in S4 is as follows: The mean WBC cell count and mean EC cell count of the set of fields to be examined are calculated respectively, and used as the average WBC cell count and average EC cell count per field of sputum smear. The compliance level of the sputum smear is determined according to the following criteria, and a digital traceability report is generated: Acceptable: >25 WBC cells per low-power field, <10 EC cells; Non-deep sputum: WBC count <10 per low power field, EC count >25; Basic qualification 1: WBC cell count per low-power field is 10-25, EC cell count is <25; Basic qualification 2: WBC cell count >25 and EC cell count >25 per low power field.