A reagent strip grade recognition method based on image processing and machine learning

By combining targeted target detection and machine learning models, reagent strips are accurately located, solving the problems of inaccurate strip location and poor adaptability in existing technologies, and achieving high-precision and stable reagent strip grade identification.

CN122156059APending Publication Date: 2026-06-05SUZHOU ZHONGYAN BIO-INFORMATION CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
SUZHOU ZHONGYAN BIO-INFORMATION CO LTD
Filing Date
2026-01-23
Publication Date
2026-06-05

AI Technical Summary

Technical Problem

Existing technologies for automated testing of reagent strips suffer from insufficient accuracy in strip positioning, brightness quantification, and consistency in grade classification, and have poor adaptability, making it difficult to meet the needs of large-scale screening and accurate diagnosis.

Method used

A directional target detection model is used to accurately locate the reaction tank area. Median filtering, Gaussian filtering and RGB channel fusion processing are combined to perform background estimation and correction. Color intensity analysis is performed through a support vector regression model to obtain quantitative features and map them into discrete levels.

Benefits of technology

It achieves high-precision, anti-interference, and wide-adaptability automated recognition of reagent strips, improving the accuracy and stability of detection and adapting to reagent strips under different lighting and orientations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122156059A_ABST
    Figure CN122156059A_ABST
Patent Text Reader

Abstract

The application provides a reagent strip grade recognition method based on image processing and machine learning, and relates to the technical field of image processing, and comprises the following steps: an original image of a reagent strip is acquired, and the original image contains a reaction tank area of the reagent strip; a reaction tank area in the original image is located through a directional target detection model, and position and angle information of the reaction tank area is acquired; the original image is corrected and regionally extracted according to the position and angle information, and a reaction tank area image is obtained; the reaction tank area image is processed, and C-line and T-line positions are recognized; T-line area is subjected to color development intensity analysis, and quantitative characteristics are acquired; the quantitative characteristics are input into a machine learning regression model, and the color development grade of the T-line is obtained; high-precision, anti-interference, wide-adaptation automatic recognition of the reagent strip grade is realized, and the detection accuracy, stability and actual application adaptation capability are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of image processing technology, and in particular to a reagent stripe grade recognition method based on image processing and machine learning. Background Technology

[0002] With the rapid development of molecular diagnostic and immunodiagnostic technologies, strip-based rapid testing methods have been widely used in clinical and field testing due to their ease of operation, rapid detection, and low cost. Typical rapid diagnostic strips usually contain a control line (C line) and a test line (T line), and the interpretation of the test results depends on the color intensity of the bands and their changes.

[0003] Traditional reagent strip reading mainly relies on manual visual inspection, which has problems such as strong subjectivity, susceptibility to ambient light, difficulty in quantification, and low degree of automation, making it difficult to meet the needs of large-scale screening and accurate diagnosis.

[0004] In recent years, with the development of computer vision and machine learning technologies, automated reagent strip image analysis methods have gradually emerged. Current methods are mostly based on image processing techniques such as image binarization, edge detection, and color space conversion, combined with machine learning models to classify or regress the color intensity of the strips. However, existing methods still have shortcomings in terms of strip location accuracy, brightness quantization, and consistency of grade classification, and some methods have poor adaptability to different reagent strips.

[0005] Therefore, there is an urgent need for a method that can automatically and accurately position the strips in a test strip, thereby improving the automation, accuracy, and adaptability of test strip testing. Summary of the Invention

[0006] To address the aforementioned issues, this application proposes a reagent strip grade recognition method based on image processing and machine learning. Through the collaborative innovation of directional target detection, refined strip localization, multi-dimensional quantitative feature extraction, and intelligent regression modeling, it achieves high-precision, interference-resistant, and widely adaptable automated recognition of reagent strip grades, thereby improving detection accuracy, stability, and practical application adaptability.

[0007] This invention provides a reagent stripe grade recognition method based on image processing and machine learning, comprising: Acquire an original image of the reagent strip, the original image containing the reaction vessel area of ​​the reagent strip; The reactive groove region in the original image is located using a directional target detection model, and the position and angle information of the reactive groove region are obtained. Based on the position and angle information, the original image is corrected and region extraction is performed to obtain an image of the reaction tank region; The images of the reaction tank area were processed to identify the positions of the C-line and T-line; Color intensity analysis was performed on the T-line region to obtain quantitative characteristics; The quantified features are input into a machine learning regression model to obtain the color level of the T-line.

[0008] Preferably, a target detection model supporting directed bounding boxes is used to detect the reactive region; the training steps of the target detection model supporting directed bounding boxes include: Acquire raw images of multiple reagent strips, including images with multiple predefined deflection angles, various lighting conditions, and scenes where parts of the image are occluded; Using the directed bounding box annotation tool, rotated rectangles are used to annotate the reaction cell region in each image. The annotation information includes the center point coordinates, length, width, rotation angle, and reagent strip reaction cell category label of the box. Augmentation processing is performed on the labeled training images to obtain the processed dataset; The processed dataset is used to train the model and optimize its parameters.

[0009] Preferably, the step of processing the image of the reaction tank area to identify the positions of the C-line and the T-line includes: The image of the reaction tank area is subjected to filtering, noise reduction, and channel fusion processing. Background estimation and correction are performed on the processed image; Pixel projection and peak analysis are performed on the background-corrected image to locate the C-line and T-line.

[0010] Preferably, the filtering, denoising, and channel fusion processing includes: The image of the reaction tank region was sequentially subjected to median filtering and Gaussian filtering. The filtered image is then subjected to RGB channel weighted fusion, where the weight of the red channel is greater than that of the green and blue channels.

[0011] Preferably, the background estimation and correction of the processed image includes: Using the center of the reaction tank region image as a reference, a first rectangular region is selected as the effective analysis region, and the length and width of the first rectangular region are respectively the first preset ratio of the length and width of the reaction tank region image. Within the effective analysis area, for the fused image, pixel values ​​are accumulated along the horizontal direction to generate a first projection curve, and the possible range of strip regions in the image is initially determined based on the first projection curve. Within the effective analysis area, multiple background sampling sub-regions are selected, wherein the background sampling sub-regions avoid the range of the initial strip region; Calculate the mean or median pixel grayscale value in each background sampling sub-region, and fit a background grayscale model that changes continuously along the length of the reaction groove based on the statistical values ​​of all sampling points. Based on the background grayscale model, for each column of pixels in the fused image, the corresponding background grayscale estimate is subtracted to obtain the background-corrected image.

[0012] Preferably, determining the possible range of banded regions in the image includes: The fused image is then downsampled. The pixel values ​​of the downsampled image are accumulated along the horizontal direction to generate the first projection curve; Identify local maxima on the first projection curve; For each local maximum point, on the first projection curve, search to the left and right from that point until a position is encountered where the curve value drops to a second preset proportion of the peak point. The two searched positions are then used as the preliminary strip region boundaries corresponding to the peak point.

[0013] Preferably, the step of performing pixel projection and peak analysis on the background-corrected image to locate the C-line and T-line includes: The background-corrected image is accumulated along the horizontal direction to generate a second projection curve for precise positioning. The second projection curve is smoothed and filtered. The local peak points of the smoothed curve are used as the center positions of the candidate strips; For each candidate strip, the region width, average gray level and edge gradient distribution features are calculated based on its center position, and its effectiveness is verified according to the preset strip feature conditions. From the verified candidate strips, the final positions of the C-line and T-line are matched and determined according to the preset order relationship and spacing range between the C-line and T-line.

[0014] Preferably, the quantization feature is the normalized projected area of ​​the T-line region, and the step of performing color intensity analysis on the T-line region to obtain the quantization feature includes: For the image of the located T-line region, pixel values ​​are accumulated along the direction of its strip extension to generate an intensity projection curve; Determine the effective color rendering range on the intensity projection curve; The projected area of ​​the T-line region is obtained by numerically integrating the curve within the effective color rendering range. The projected area is normalized to obtain the quantized features.

[0015] Preferably, the effective colorimetric range is obtained through the following methods: Calculate the global maximum value of the projection curve; The continuous interval on the projection curve whose height is not lower than the third preset ratio of the global maximum value is determined as the effective color rendering interval.

[0016] Preferably, the color rendering level of the T-line is obtained by the following methods: The quantized features are input into a trained support vector regression model to obtain a continuous color intensity prediction value; The continuous color intensity prediction values ​​are mapped to predefined discrete color level labels; Different training weights are assigned to different samples based on their own characteristics and their predictive performance.

[0017] The beneficial effects of this invention include: By supporting a target detection model with directed bounding boxes and employing a phased training strategy, the position and angle information of the reaction groove can be accurately obtained. Denoising through a combination of median filtering and Gaussian filtering, coupled with RGB channel fusion with higher red weight, highlights the stripe features; subsequent analysis focusing on the effective region at the center of the reaction groove, combined with peak-avoiding background sampling and a continuously gradient background model, completely eliminates background interference. Stripe localization, after determining the initial boundary through downsampling and projection curve analysis, is further enhanced by steps such as physical width constraints, overlapping region merging, and spurious peak removal. Furthermore, filtering based on the preset order and spacing of the C-line and T-line effectively avoids problems such as spurious peaks and stripe splitting, ensuring the accuracy of C-line and T-line localization. Obtaining the T-line projection area by numerical integration of the effective colorimetric interval and providing normalization processing eliminates errors caused by the detection environment and reagent batches, making the quantitative features more valuable. The support vector regression model, through sample weight allocation or dynamic weight allocation, can focus on easily confused and difficult-to-identify samples, improving the model's prediction accuracy for colorimetric intensity. The continuous predicted values ​​output are then mapped back to discrete levels, making the level division more reasonable. Attached Figure Description

[0018] Figure 1 This is a schematic diagram of a reagent strip grade recognition method based on image processing and machine learning according to an embodiment of the present invention.

[0019] Figure 2 This is a sample of a reagent used in a reagent stripe level recognition method based on image processing and machine learning, as described in an embodiment of the present invention. Figure 3 The position of the observation slot of the detection reagent is obtained after processing in a reagent strip grade recognition method based on image processing and machine learning according to an embodiment of the present invention. Figure 4 This is an example of a projection curve in a reagent stripe grade recognition method based on image processing and machine learning according to an embodiment of the present invention. Detailed Implementation

[0020] Exemplary embodiments will now be described more fully with reference to the accompanying drawings. However, these exemplary embodiments can be implemented in many forms and should not be construed as limited to the embodiments set forth herein; rather, they are provided to make the invention more comprehensive and complete, and to fully convey the concept of the exemplary embodiments to those skilled in the art. The same reference numerals in the drawings denote the same or similar structures, and therefore repeated descriptions of them will be omitted.

[0021] The terms used to express position and direction in this invention are illustrated with reference to the accompanying drawings, but changes can be made as needed, and all such changes are included within the scope of protection of this invention.

[0022] See appendix Figure 1 This embodiment provides a reagent stripe grade recognition method based on image processing and machine learning, including: Acquire an original image of the reagent strip, the original image containing the reaction vessel area of ​​the reagent strip; The reactive groove region in the original image is located using a directional target detection model, and the position and angle information of the reactive groove region are obtained. Based on the position and angle information, the original image is corrected and region extraction is performed to obtain an image of the reaction tank region; The images of the reaction tank area were processed to identify the positions of the C-line and T-line; Color intensity analysis was performed on the T-line region to obtain quantitative characteristics; The quantified features are input into a machine learning regression model to obtain the color level of the T-line.

[0023] In practical applications, a color industrial camera with at least 65 megapixels is used to photograph the reagent strips under uniform light illumination at a fixed distance and angle. This ensures that the acquired images completely cover the reaction cell area and remain consistent across different batches. The camera features high resolution, low noise, and excellent color reproduction capabilities, effectively capturing detailed information from the reagent strips and guaranteeing the quality of the basic data for subsequent processing. During the imaging process, the reagent strips are placed on a detection platform with uniform light to avoid the influence of uneven external lighting on the images. To ensure the repeatability of the results, the camera and reagent strips are kept at a fixed distance and angle during imaging, thus ensuring the consistency of the acquired images across different testing batches. The original reagent strip images obtained are shown below. Figure 2 As shown, it completely covers the reaction tank area, providing high-quality raw input for subsequent area detection and analysis.

[0024] The reaction tank is detected using a directional target detection model. This model can not only output the position of the reaction tank, but also accurately give its rotation angle, thus providing key parameters for subsequent geometric correction.

[0025] Based on the detected angle information, the image is rotated and corrected to standardize the orientation of the reaction vessel (usually making its long side horizontal), and the core area containing only the reaction vessel is precisely cropped to eliminate angular deviations caused by the random placement of reagent strips and focus the analysis on the key area. A series of processing steps are then performed on the standardized reaction vessel image to identify the C-line and T-line.

[0026] For the located T-line region, a color intensity analysis is performed. For example, pixel projection is performed along the direction of its strip extension, and the color projection area is calculated by integrating the projection curve. Then, it is normalized by the background or C-line reference to obtain a stable and comparable quantitative feature (i.e., normalized projection area), which directly reflects the color intensity of the T-line.

[0027] Finally, the above-mentioned quantitative features are input into a pre-trained machine learning regression model (such as support vector regression SVR). The model has established a mapping relationship between feature values ​​and color rendering levels by learning a large number of standard samples. The continuous predicted values ​​output by the model are mapped and converted into the final discrete color rendering levels (such as G1-G10) to complete the automatic determination.

[0028] By deeply integrating image processing, computer vision, and machine learning technologies, and combining them with high-performance industrial cameras, the system can automatically analyze and grade large batches of test strips in a short time, improving detection efficiency and accuracy.

[0029] In one possible implementation, a target detection model supporting directed bounding boxes is used to detect the reactive region; the training steps of the target detection model supporting directed bounding boxes include: Acquire raw images of multiple reagent strips, including images with multiple predefined deflection angles, various lighting conditions, and scenes where parts of the image are occluded; Using the directed bounding box annotation tool, rotated rectangles are used to annotate the reaction cell region in each image. The annotation information includes the center point coordinates, length, width, rotation angle, and reagent strip reaction cell category label of the box. The labeled training images are augmented to obtain the processed dataset; the augmentation includes one or more of the following: adjusting image brightness and contrast to simulate uneven lighting, adding random salt and pepper noise or Gaussian noise, and performing affine transformation on the image to simulate the physical deformation of the test strip. The processed dataset is used to train the model and optimize its parameters.

[0030] To accurately locate reactive groove regions in an image, this embodiment uses an object detection model supporting Oriented Bounding Box (OBB) to detect reactive groove regions; and then uses an annotation tool supporting Oriented Bounding Box (OBB) to further analyze the region. Figure 2 The test reagents in the image are labeled by annotating the center point coordinates, length, width, rotation angle and reagent strip reaction groove category label of the reaction groove region in each image. This provides the model with the supervision signal needed to learn how to accurately describe the directional rectangular region. This annotation method is highly matched with the geometric characteristics of the detection target (angled reaction groove).

[0031] Thanks to a dedicated dataset covering multi-angle, multi-light, and occluded scenarios, and precise OBB annotations, the trained model has a high tolerance for reagent strip placement, changes in ambient lighting, and slight occlusion. No matter how the reagent strip is placed, the model can stably and accurately output the precise position and orientation of the reaction vessel, providing a reliable foundation for all subsequent processing steps.

[0032] Unlike traditional horizontal bounding boxes (HBB), OBBs can more accurately describe rectangular regions with rotation angles, making them particularly suitable for detecting reagent containers that experience angular deviations during image capture. The YOLO11OBB model can be used for directional target detection.

[0033] Data augmentation of labeled images involves applying a series of image transformations (such as brightness and contrast adjustment, adding noise, simulating deformation, etc.) to amplify more diverse training samples from limited basic data without changing the authenticity of the annotations. This can effectively prevent the model from overfitting to the limited original data and further enhance its generalization ability and adaptability to unseen variations.

[0034] After processing, a large number of training samples are input into the YOLO11OBB model for training. As a next-generation object detection framework, the YOLO11 model achieves a good balance between detection accuracy and inference speed. Combined with the OBB mechanism, the model can learn the directional features of the reaction groove region, thereby improving detection robustness. The training process continuously adjusts millions or even billions of internal parameters of the model through optimization algorithms (such as gradient descent), aiming to minimize the error between the model's output directed bounding box predictions (position, size, angle, category) and the manually labeled ground truth values. After sufficient training, the model can accurately locate the reaction groove region and predict its precise rotation angle from new, never-before-seen reagent strip images.

[0035] After training, the model is further pruned and quantized: pruning reduces the computational cost by removing redundant neurons and channels; quantization significantly improves inference speed and model lightweighting without significantly reducing detection accuracy by reducing the weight quantization precision (e.g., from FP32 to INT8).

[0036] In one possible implementation, the physical deformation of the simulated reagent strip specifically includes: Based on the thin plate elasticity model or finite element analysis model, the bending deformation of the reagent strip carrier under different support conditions is simulated; A corresponding two-dimensional image displacement field is generated based on the deformation model, and the training image is subjected to non-rigid deformation transformation using the displacement field, thereby generating an enhanced image that is closer to real physical deformation.

[0037] In practical implementation, based on a thin-plate elasticity model or a more refined finite element analysis model, the reagent strip carrier is simplified into a thin-plate structure with specific material properties (such as elastic modulus and Poisson's ratio) and geometric dimensions (length, width, and thickness). By setting different boundary and support conditions (e.g., simulating single-point or multi-point concentrated loads generated when the reagent strip is pinched by fingers, or non-uniform support caused by uneven bottom surface when laid flat), the equilibrium state of this mechanical model under the corresponding load is solved, thereby calculating the displacement and deformation of each point on the carrier in three-dimensional space.

[0038] Subsequently, this three-dimensional mechanical deformation is mapped to the two-dimensional image domain. Based on the calculated displacement vectors of each point on the carrier surface, a corresponding two-dimensional image displacement field is generated. This displacement field precisely describes the position that each pixel in the image should move to due to the displacement of its corresponding physical point. Finally, using non-rigid deformation techniques in image processing (such as pixel resampling based on the displacement field), this displacement field is applied to the original training image. This causes all visual features in the image, such as reaction grooves and stripes, to be distorted, stretched, or compressed according to the bending laws of the carrier in the real physical world, thereby generating a visually coherent and physically reasonable enhanced image.

[0039] Compared to traditional affine transformations (which can only simulate overall deformations such as translation, rotation, and scaling), this method can generate highly realistic, non-uniform, and localized bending deformation images. This allows the trained target detection model to learn and understand complex appearance changes caused by real physical effects, thus maintaining extremely high positioning accuracy and recognition stability when faced with test strips that bend due to uneven handling, squeezing, or placement in actual use.

[0040] Collecting real test strip images covering various bending states, especially under extreme deformation, is both time-consuming and labor-intensive. However, by performing high-fidelity physical simulation at the image level, only basic flat state images are needed to synthesize a large number of hard-to-obtain deformation samples, which significantly expands the diversity and completeness of training data and saves a lot of field collection costs.

[0041] In one possible implementation, a staged training strategy is employed for the object detection model that supports directed bounding boxes, including: In the first stage, the backbone network of the model is pre-trained using standard horizontal bounding box labeled data, enabling the model to initially learn to locate the reaction slot region. The purpose of this stage is to allow the model's deep feature extractor (backbone network) to learn to see and initially locate the reaction slot region without having to deal with the complex variable of rotation angle at the same time. By taking advantage of the easier availability and lower labeling cost of horizontal bounding box data, a solid foundation for the model's general object detection capability is laid.

[0042] The second stage involves freezing the parameters of the model's backbone network and using the directed bounding box annotation data to train only the model's regression head, focusing on learning how to predict rotation angles. Since the parameters of the backbone network are fixed, the visual features extracted by the model remain stable. At this point, the training objective of the regression head is fully focused on learning how to accurately predict rotation angles based on these features. This freeze-focused training method effectively avoids the oscillations or convergence difficulties that may occur when the network simultaneously fits two strongly correlated tasks, position regression and angle regression, in the early stages of training, thus improving the efficiency and accuracy of angle learning.

[0043] In the third stage, the backbone network parameters are unfrozen, and the entire model is trained end-to-end using the directed bounding box annotation data to optimize the model's comprehensive prediction accuracy for the center point, size, and rotation angle of the directed bounding box. The goal of this stage is to fine-tune and coordinate the backbone network and the regression head so that feature extraction can better serve the comprehensive prediction of the target's center point, size, and rotation angle, achieving Pareto optimality in overall performance and thus reaching the best detection accuracy.

[0044] Through the second phase of specialized training, the model's ability to regress rotation angles was specifically enhanced, particularly improving the predictive sensitivity and accuracy for small angular deviations common in reagent strips within the range of [-30°, 30°]. This makes subsequent image correction steps more precise, laying a solid foundation for the reliability of the entire analysis process.

[0045] By breaking down the complex OBB detection task into progressive subtasks, the difficulty of initial model learning is reduced. The model does not need to simultaneously explore localization and angle in the early stages of training, thereby reducing uncertainty in the training process, accelerating the overall convergence speed, and making the training process more stable.

[0046] The strategy cleverly combines a large amount of readily available horizontal bounding box data (for general feature learning) with a small amount of accurate directed bounding box data (for specific capability enhancement). This data utilization method effectively reduces the dependence on scarce directed bounding box annotation data and saves annotation costs while ensuring model performance.

[0047] The three-stage training ultimately leads to an end-to-end optimized detection model with highly collaborative components. This model not only performs exceptionally well in predicting rotation angles, but its overall prediction accuracy for the center point and size of directed bounding boxes is also further improved through joint optimization, achieving a comprehensive performance leap.

[0048] In one possible implementation, the step of correcting the original image and extracting regions based on the position and angle information includes: The image is geometrically rotated based on the rotation angle of the detected reaction tank area so that the direction of the reaction tank is parallel to a preset reference direction; wherein, the preset reference direction is the horizontal direction; Centered on the rotated bounding box, crop out the core region image containing only the reaction tank.

[0049] After detecting the reaction chamber location, this invention performs post-processing on the YOLO11OBB model inference results. First, based on the OBB's center point and rotation angle, the detected rectangular region is geometrically rotated. The goal of the rotation is to keep the long side of the reaction chamber region parallel to the horizontal direction, thereby correcting any angular deviations that may have occurred during reagent strip imaging. Then, using the center of the rotated bounding box as a reference, the target region is precisely cropped using the bounding box's width and height parameters to extract the image region containing the reaction chamber. This process effectively removes irrelevant areas from the image (such as background, label, or shell parts), retaining only the core detection region required for subsequent analysis. The reaction chamber region image obtained through this step is shown below. Figure 3 As shown.

[0050] By performing precise geometric rotation based on the OBB detection results, the reaction tanks of reagent strips placed at different angles are uniformly corrected to the horizontal direction, eliminating random angle deviations caused by placement or shooting angle. This ensures that all subsequent image processing (such as projection analysis) is based on spatially aligned and oriented input data, which is the fundamental premise for ensuring the repeatability of the algorithm, the comparability of results, and the generalization ability of the model.

[0051] Adaptive cropping centered on the rotated OBB bounding box can automatically and accurately remove irrelevant interference areas such as background, shell, and labels from the image, retaining only the core region containing the reactive groove (e.g., Figure 3As shown in the figure, it not only focuses computing resources entirely on key areas, but also directly removes a large number of noise sources that may interfere with stripe recognition and intensity analysis, improving the signal-to-noise ratio of subsequent image processing steps, thereby directly contributing to the final accuracy of C / T line positioning and color intensity quantization.

[0052] The entire correction and cropping process is based entirely on the automated output of the upstream OBB model, requiring no manual intervention or parameter adjustment, ensuring that the conversion from the original image to the standard analysis image is efficient, consistent, and batch-processable.

[0053] In one possible implementation, processing the image of the reaction tank area to identify the positions of the C-line and T-line includes: The image of the reaction tank area is subjected to filtering, noise reduction, and channel fusion processing. Background estimation and correction are performed on the processed image; Pixel projection and peak analysis are performed on the background-corrected image to locate the C-line and T-line.

[0054] In one possible implementation, the filtering, denoising, and channel fusion processing includes: The image of the reaction tank region was sequentially subjected to median filtering and Gaussian filtering. The filtered image is then subjected to RGB channel weighted fusion, where the weight of the red channel is greater than that of the green and blue channels.

[0055] In one possible implementation, the background estimation and correction of the processed image includes: Using the center of the reaction tank area image as a reference, a first rectangular area is selected as the effective analysis area. The length and width of the first rectangular area are respectively the first preset ratio of the length and width of the reaction tank area image, so as to avoid interference from the image edge. Within the effective analysis area, for the fused image, pixel values ​​are accumulated along the horizontal direction to generate a first projection curve, and the possible range of strip regions in the image is initially determined based on the first projection curve. Within the effective analysis area, multiple background sampling sub-regions are selected, wherein the location of the background sampling sub-regions avoids the range of the initial strip region; Calculate the mean or median pixel grayscale value in each background sampling sub-region, and fit a background grayscale model that changes continuously along the length of the reaction groove based on the statistical values ​​of all sampling points. Based on the background grayscale model, for each column of pixels in the fused image, the corresponding background grayscale estimate is subtracted to obtain the background-corrected image.

[0056] In the background sampling step, multiple non-overlapping rectangular sub-regions are selected as background sampling sub-regions within the effective analysis area using a sliding window method.

[0057] Determining the possible range of band regions in the image includes: The fused image is then downsampled. The pixel values ​​of the downsampled image are accumulated along the horizontal direction to generate the first projection curve; Identify local maxima on the first projection curve; For each local maximum point, on the first projection curve, search to the left and right from that point until a position is encountered where the curve value drops to a second preset proportion (e.g., 60%) of the peak point; the two searched positions are used as the preliminary strip region boundaries corresponding to the peak point.

[0058] In one possible implementation, the step of physically constraining the boundary of the initial strip region is also included: Calculate the width of the region defined by the boundary; If the width of the region is less than the preset minimum strip width, the boundary is symmetrically expanded to both sides according to the minimum strip width; If the width of the region is greater than the preset maximum strip width, then the boundary is trimmed according to the maximum strip width.

[0059] After determining the initial range of each strip region, the process also includes range verification and merging steps: If the horizontal overlap between two initially determined strip regions exceeds a preset threshold, they are merged into a single continuous strip region. If the width of a preliminarily determined band region is less than the minimum band spacing allowed by the physical structure of the reagent strip, it is identified as a spurious peak caused by noise and is removed.

[0060] To further improve the accuracy of subsequent stripe recognition, this invention performs image enhancement processing on the cropped reaction zone region image. Specifically, a median filter is first used to smooth the image. Median filtering effectively removes discrete impurities such as salt-and-pepper noise while preserving edge details from excessive blurring. Based on this, a Gaussian filter is further used to smooth the image. Gaussian filtering has excellent low-pass characteristics, effectively suppressing high-frequency noise in the image, resulting in a smoother and more uniform color region. This combination of two filtering methods simultaneously preserves stripe edges and removes impurities, improving the overall image clarity and contrast.

[0061] Since the colors of the stripes in the reaction cell of the detection reagent are mainly red, the three RGB channels in the image are weighted and averaged. For example, the R channel is given a 50% weighting, and the G and B channels are each given a 25% weighting. This highlights the red signal related to the color of the stripes at the pixel level, further enhancing the visual contrast of the target area.

[0062] Due to factors such as uneven lighting and differences in reagent strip substrate color, the image background exhibits non-uniformity. By analyzing the central region of the image, a grayscale distribution model of the background is estimated, and based on this, the background grayscale values ​​are subtracted column-by-column (or row-by-row) across the entire image. This step aims to eliminate systematic interference from the background signal, allowing the strip signals to surface and creating a flat background condition for subsequent accurate analysis.

[0063] The edges of the strips are easily affected by the reagent mold, and after illumination, black shadow areas will appear at the edges. Therefore, only the central region is calculated (for example, a rectangle with 80% of the length and width at the center point). Then, a region in the very center of the image is selected as the background for estimation to reduce background error.

[0064] The background sampling points are not selected randomly or uniformly, but are deliberately avoided in these initially determined strip regions. This strategy of first predicting and then avoiding ensures that the collected background samples are not contaminated by the target signal, thereby enabling the fitting of a purer and more accurate background grayscale change model. Finally, the original image is subjected to column-by-column background subtraction based on this model to obtain a corrected image with a flat background and a prominent target.

[0065] A high-precision horizontal projection is performed on the corrected image to generate the final positioning projection curve. For each candidate peak of the curve (corresponding to a possible strip), instead of simply expanding the width to a fixed width, the curve is searched to both sides until the signal intensity drops to a certain proportion of the peak (e.g., 60%). This dynamically determines the initial boundary, making the boundary delineation more closely match the actual signal distribution, and enabling the positioning accuracy to adapt to different color intensities (e.g., dark and light stripes) and shapes (e.g., edge diffusion).

[0066] Subsequently, two layers of advanced validation are introduced: the first layer is physical width constraint, which compares and corrects the dynamically determined width with the preset minimum / maximum physical width of the reagent strips to ensure that the results conform to common sense; the second layer is logical validation and cleanup, which determines whether to merge overly close regions or remove spurious peaks caused by noise based on the minimum interval between the strips. Finally, combining the fixed order relationship between the C-line and T-line, the precise positions of the two lines are determined from the candidate regions that have passed all validations.

[0067] From dynamic boundary determination to physical constraint correction and logical cleanup and merging, the entire process possesses inherent fault tolerance and self-verification capabilities. Even if individual deviations occur in intermediate steps, subsequent steps can correct or eliminate them, ensuring the overall robustness of the final output.

[0068] In one possible implementation, performing pixel projection and peak analysis on the background-corrected image to locate the C-line and T-line includes: The background-corrected image is incremented along the horizontal direction to generate a second projection curve for precise positioning; refer to the attached figure. Figure 4 ; The second projection curve is smoothed and filtered. The local peak points of the smoothed curve are used as the center positions of the candidate strips; For each candidate strip, the region width, average gray level and edge gradient distribution features are calculated based on its center position, and its effectiveness is verified according to the preset strip feature conditions. From the verified candidate strips, the final positions of the C-line and T-line are matched and determined according to the preset order relationship and spacing range between the C-line and T-line. If the number of candidate bands that pass the verification is greater than 2, then the two bands with the highest confidence are selected, and C-line and T-line labels are assigned according to their positional relationship.

[0069] The strip feature conditions include: the region width is within the preset strip physical width range, the average gray level is higher than the background region threshold, and the edge gradient conforms to the strip boundary features.

[0070] For the background-corrected image, calculate the cumulative pixel value P(x) for each column x along the horizontal direction; the cumulative pixel value is calculated using the following formula: x is the column coordinate, 1 ≤ x ≤ N, and N is the image width; y is the row coordinate, 1≤y≤M, and M is the image height; Indicates coordinates The pixel value after RGB channel weighted fusion processing; This is the background value of the coordinate point obtained through background estimation.

[0071] Because there is a pixel color difference between the colored area of ​​the strip and the background, such as Figure 4 As shown, the projection curve typically exhibits a distinct peak at the strip location. By smoothing the projection curve and applying threshold segmentation, the approximate location of the strip can be preliminarily determined.

[0072] The amplitude on the second projection curve directly reflects the strength of the net color signal in that vertical column. The curve is then smoothed to suppress residual random noise and ensure the stability of subsequent peak detection. All local peak points on the smoothed projection curve are detected, each peak point corresponding to a potential horizontal position of the strip center. However, these peaks may contain spurious signals generated by noise, impurities, or image defects.

[0073] For each candidate peak, a candidate region is defined centered on it, and three key features are calculated: 1) physical width (converted from pixel width and resolution) to determine whether it conforms to the size range of a real stripe; 2) average grayscale to confirm that its color intensity is significantly higher than the background; and 3) edge gradient distribution to verify whether it has the typical sharp edges of a real stripe. Only candidate regions that simultaneously meet all preset feature conditions are determined to be valid candidate stripes, thus filtering out the vast majority of false targets.

[0074] The candidate bands are compared with the prior knowledge inherent in the test strips: that is, there is a fixed order and approximate spacing between the C-line (control line) and the T-line (detection line). Based on this knowledge, a unique pair matching this pattern is selected from the candidate bands, and their respective identities (C-line or T-line) are determined. As a fault-tolerance mechanism, if the number of candidates is abnormal (e.g., more than two), the system optimizes the selection based on the confidence level of each candidate (e.g., peak height, feature fit) before performing the matching, ensuring that reasonable results are still output even under complex conditions.

[0075] Finally, this step automatically outputs the specific coordinate ranges of the C-line and T-line in the image. The C-line serves as a quality control baseline, and its success or failure can be used to determine the effectiveness of the reagent; the T-line serves as the target area to be analyzed, and its location identification result will be used as input for subsequent colorimetric grade calculation.

[0076] By projecting two-dimensional information into a one-dimensional curve, the analysis complexity is significantly simplified. Combined with smoothing filtering and comprehensive verification based on width, grayscale, and gradient features, the system can accurately identify true bands from noise and artifacts, effectively avoiding false and false localizations. Multi-layered feature verification forms a robust filtering network that resists interference from common noise, stains, and uneven lighting. Pre-defined logical matching rules and a fault-tolerant processing flow for abnormal candidate numbers further ensure that the system can still provide stable and reasonable outputs even in non-ideal images or under special conditions (such as an extremely faint line), improving the system's practicality and environmental adaptability.

[0077] In one possible implementation, the quantization feature is the normalized projected area of ​​the T-line region, and the step of performing color intensity analysis on the T-line region to obtain the quantization feature includes: For the image of the located T-line region, pixel values ​​are accumulated along the direction of its strip extension to generate an intensity projection curve; Determine the effective color rendering range on the intensity projection curve; The projected area of ​​the T-line region is obtained by numerically integrating the curve within the effective color rendering range. The projected area is normalized to eliminate systematic and random errors, thus obtaining the quantized features.

[0078] In one possible implementation, the effective colorimetric range is obtained through the following methods: Calculate the global maximum value of the projection curve; The continuous interval on the projection curve whose height is not lower than the third preset ratio of the global maximum value is determined as the effective color rendering interval, wherein the third preset ratio is 20% to 40%.

[0079] The normalization process is background normalization, including: Calculate the average background brightness value of the non-striped region in the image of the reaction tank area; Divide the projected area by the average background brightness value to obtain the background normalized projected area.

[0080] The normalization process is intrinsic parameter normalization, including: Calculate the projected area of ​​the region along line C; Divide the projected area of ​​the T-line region by the projected area of ​​the C-line region to obtain the internal parameter normalized projected area (i.e., the T / C ratio).

[0081] The calculation of the projected area of ​​the C-line region includes: The pixel values ​​of the C-line region image are accumulated along its strip extension direction to generate the C-line projection curve; Based on the C-line projection curve, the C-line projection area is calculated using the same method as that used to calculate the T-line projection area.

[0082] The normalization process is a composite normalization, including: First, the projected area of ​​the T-line region is normalized to obtain the background correction area; Then, the background correction area is divided by the background normalized projection area of ​​the C-line region to obtain the composite normalized projection area.

[0083] Based on the precisely located T-line coordinates, a rectangular sub-image containing only the T-line is extracted. Then, pixel values ​​of this sub-image are accumulated along the strip's extension direction (usually vertical), generating a one-dimensional intensity projection curve. This curve visually reflects the color intensity distribution of the T-line in the vertical direction. To accurately capture the true color signal and eliminate weak edge signals or noise, an adaptive thresholding method is used to determine the integration range, calculate the global maximum value of the curve, and define the effective color interval as a continuous range where the signal intensity is not lower than a certain percentage (e.g., 20%-40%) of this maximum value. Numerical integration of the curve within this interval yields the original projected area, which directly represents the total color loading of the T-line. Through projection and integration along the strip direction, subjective judgments of color depth are transformed into objective, continuous projected area values, providing high-resolution input features for accurate grade prediction based on machine learning models.

[0084] By dynamically determining the effective color rendering interval, the integration range can adapt to T-lines with different color rendering intensities (strong, weak) and shapes (sharp, diffuse), avoiding the signal truncation (area underestimation) or excessive noise (area overestimation) problems that may occur when using a fixed interval, thus ensuring the accuracy and consistency of the area calculation results.

[0085] The original projected area is susceptible to systematic and random errors, such as the intensity of the shooting light, differences in the reagent strip substrate, and environmental background. Therefore, several normalization strategies are introduced: By calculating the average background brightness of the non-striped area of ​​the reaction tank, a background baseline value is obtained. Dividing the original projected area by this value can effectively offset the overall brightness scaling caused by differences in illumination intensity and camera gain, thus initially improving the comparability of image data from different batches.

[0086] By calculating the projected area of ​​the C-line (control line), an internal reference standard is obtained that is embedded in the same test strip and undergoes the same testing process. The T / C ratio is obtained by dividing the projected area of ​​the T-line by the projected area of ​​the C-line. This method can simultaneously correct for common batch-to-batch variability caused by factors such as sample dosage, reaction time, and ambient temperature.

[0087] To pursue ultimate accuracy and robustness, the two methods mentioned above are further combined. First, the projected areas of the T-line and C-line are normalized to eliminate their respective basic brightness differences. Then, the area of ​​the T-line after background correction is divided by the area of ​​the C-line after background correction. This dual correction strategy of background first and then intrinsic parameter can theoretically provide the highest level of error elimination capability.

[0088] The color rendering level of the T-line can be obtained through the following methods: The quantized features are input into a trained support vector regression model to obtain a continuous color intensity prediction value; The continuous color intensity prediction values ​​are mapped to predefined discrete color level labels.

[0089] Different training weights are assigned to different samples based on their own characteristics and their predictive performance.

[0090] In one possible implementation, assigning different training weights to different samples includes: Determine the boundary value between adjacent color development levels based on the color development intensity values ​​of all standard reagent strip samples; For each training sample, calculate the distance between its color intensity value and the nearest boundary value; Initial training weights are assigned to each training sample based on the distance, wherein the initial training weights are negatively correlated with the distance.

[0091] The determination of the boundary value between adjacent color rendering levels specifically involves calculating the average of the median color rendering intensity values ​​of all samples from two adjacent levels.

[0092] In one possible implementation, the initial training weights are assigned according to the following rules: If the distance is less than a preset first distance threshold, then a first weight W_high is assigned; If the distance is greater than or equal to a preset first distance threshold and less than a second distance threshold, then a second weight W_mid is assigned; If the distance is greater than or equal to the second distance threshold, then a third weight W_low is assigned; Among them, W_high>W_mid>W_low.

[0093] In one possible implementation, the initial training weights are obtained in the following way: For each sample, take its normalized distance d∈[0,1] to the nearest boundary, and determine the initial training weights W0 based on the normalized distance d; W0=exp(-d 2 / σ 2 )+λ σ is an adjustment parameter determined by the validation set through grid search, which controls the degree of influence of distance on weights; the value range is 0.1~1.0, λ is a constant, λ=1e-3 to prevent zero weights.

[0094] In the application phase, the quantized features of the T-line extracted in the preceding steps (such as normalized projected area) are input into a pre-trained support vector regression model. This model, through learning from a large number of standard samples, has established a complex nonlinear mapping relationship from quantized features to color intensity and outputs a continuous predicted color intensity value. Subsequently, the system maps this continuous value to the nearest grade label (such as G1-G10) according to a preset discrete grade classification standard, thereby completing the automated grade determination.

[0095] A Support Vector Regression (SVR) model is introduced to establish a mapping relationship between "projected area and color rendering level". During the training phase, standard test strip samples are used as the training set, with the input feature being the projected area of ​​the T-line and the output label being the manually determined level (G1-G10). Through training, the SVR model can learn the nonlinear mapping relationship between different color rendering intensities and levels.

[0096] During the detection phase, when a new test strip image is input, the T-line region is extracted, its projected area is calculated and input into the trained SVR model. The model outputs a continuous prediction value, which is then mapped to the nearest grade label to finally give the grade determination of the T-line color.

[0097] To ensure the prediction accuracy of the SVR model, especially at class boundaries, a sample weighting training strategy is employed. The core of this strategy is to guide the model to focus more on boundary samples that are difficult to determine. First, a quantized boundary value between adjacent classes is calculated based on the training set data. Specifically, this is achieved by averaging the median feature values ​​of all samples from two adjacent classes, which serves as the theoretical classification boundary. Then, for each training sample, the Euclidean distance or absolute distance between its feature value and the nearest boundary value is calculated. The smaller this distance, the closer the sample is to the class boundary, and the higher its classification or regression uncertainty. Finally, a stepped or continuous weighting strategy is implemented based on this distance: for example, assigning the highest weight (W_high) to extremely close boundary samples with a distance less than a first threshold, medium weight (W_mid) to moderately close boundary samples, and low weight (W_low) to clear samples far from the boundary; or assigning weights through a continuous weighting function. During model training, the loss function will therefore focus more on minimizing the prediction error of high-weight samples, thus forcing the model to invest more learning resources in tackling the prediction challenges near the boundary.

[0098] By using a support vector regression model, the quantitative features obtained from image analysis are directly mapped to continuous color intensity values, which are then converted into clear grade labels. This replaces subjective and fatigue-prone manual visual interpretation, ensuring the objectivity, consistency, and traceability of the judgment results.

[0099] By employing a distance-based sample weighting training strategy, the model is forced to focus on learning sample features near the most confusing grade boundaries. This differentiated teaching strategy effectively reduces the model's misclassification rate between adjacent grades (such as G4 and G5), making the final grade classification more accurate and reliable at key boundary points, and greatly enhancing the practical value of the entire system.

[0100] In one possible implementation, assigning different training weights to different samples further includes: Use the initial training weights to train an initial regression model; The initial regression model is used to predict each training sample, and the first error E1 between the predicted value and the true level label, and the second error E2 between the predicted value and the adjacent level standard value are calculated. Based on the first error and the second error, calculate the difficulty coefficient of each training sample; Based on the initial training weights and difficulty coefficients, assign final weights for formal model training to each training sample.

[0101] The difficulty coefficient K is calculated as follows: K = α * E1norm + β * min(E2norm) Where E1norm is the normalized value of the first error, E2norm is the normalized value of the second error, α and β are the weighting coefficients of the error term, α+β=1 and β>α; min(E2norm) represents the minimum normalized value of the second error between the predicted value and the standard value of the adjacent level. Final weight W f For: W f =W0*(1+K)

[0102] In one possible implementation, the weight calibration step further includes a single-round early stopping mechanism: after the final weight is calculated, the calibration effect is evaluated on the validation set using the weight; if the absolute value of the change in the mean absolute error (MAE) of the validation set before and after calibration is less than a preset threshold, the weight update iteration is terminated, and the current weight is directly used for formal model training.

[0103] In one possible implementation, the weight calibration step further includes a hard example identification and backflow mechanism: samples whose calculated difficulty coefficient (K) is greater than a preset outlier threshold (e.g., 3 times the median of all sample K values) are automatically marked as "hard examples", and their image data and prediction information are backflowed to the labeling pool to trigger a closed-loop optimization process of manual review and model retraining.

[0104] A meta-learning framework of pre-training exploration → difficulty assessment → focused training is introduced to enable the training process of support vector regression models to have self-awareness and self-optimization capabilities, thereby achieving high-precision modeling of complex data distributions, especially grade boundary regions.

[0105] An initial regression model is trained using all standard samples to quickly learn the basic distribution of the data and generate a preliminary predicted value for each sample. These predicted values ​​reveal the inherent learning difficulty information of the data. Based on the prediction results of the initial model, two types of key errors are calculated for each training sample: the first error (E1) is the deviation of the predicted value from the true grade label, reflecting the difficulty of the model fitting the sample; the second error (E2) is the deviation of the predicted value from the standard values ​​of adjacent grades, reflecting the classification ambiguity of the sample's prediction result, i.e., whether it is easily confused with neighboring grades. The final difficulty coefficient K of the sample is a weighted sum of these two types of errors. min(E2norm) selects the smallest neighboring grade error, capturing the trend of which neighboring grade the sample is most likely to be misclassified as, ensuring that samples that are difficult to fit accurately and are located near the grade boundary are assigned the highest difficulty coefficient.

[0106] The training weights of the formal model are determined by the initial weights (W0) and the difficulty coefficient (K), which makes the optimization objective (loss function) of the model adaptively tilt towards key samples with high difficulty and high ambiguity, guiding the model to invest more learning capacity to overcome the prediction problem near the decision boundary.

[0107] To further enhance the system's robustness and efficiency, a closed-loop calibration mechanism is introduced. Through a single-round early stopping mechanism, the effect is verified immediately after weight calibration. If the performance improvement is minimal (e.g., the change in validation set MAE < 0.01), the system terminates early, effectively preventing overfitting of the weights. Simultaneously, a hard example identification and retraining mechanism automatically labels highly difficult outliers (e.g., K > 3·median(K)) and sends them back to the labeling pool, triggering a closed loop of manual review and model retraining, enabling the system to continuously iterate and evolve.

[0108] Through the exploration-evaluation-focus meta-learning process, the model can proactively identify learning difficulties and dynamically adjust the learning focus, transforming from passive data fitting to proactive difficulty overcoming, significantly improving the intelligence and efficiency of training.

[0109] The difficulty coefficient, calculated using dual errors (especially E2 focusing on classification ambiguity), ensures that training resources are precisely focused on the most easily confused boundary samples. Combined with the early stopping mechanism in closed-loop calibration, the generalization performance of boundary modeling is ensured, thereby significantly reducing the misclassification rate between adjacent levels.

[0110] The difficult example feedback mechanism combines automated processes with expert experience (manual review), forming a data closed loop of algorithm discovery of difficult problems → manual calibration → model iteration and enhancement. This not only improves the reliability of the current model, but also accumulates valuable difficult example data for the system, providing core impetus for its long-term performance evolution and enabling the entire solution to have continuous adaptive optimization capabilities.

[0111] In one possible implementation, the level mapping step includes: Calculate the distance between the continuous predicted color rendering intensity value and the standard values ​​of two adjacent discrete levels; If the distance between the predicted value and any level standard value is less than a set threshold, it is directly mapped to that level; If the distance between the predicted value and the two adjacent standard values ​​is greater than or equal to the set threshold, the prompt message "Cannot be determined" or "Needs to be reviewed" will be output.

[0112] By following the steps above, unreliable predictions caused by extremely poor image quality, reagent strip failure, or abnormal model predictions can be effectively intercepted, preventing obviously questionable results from being incorrectly output as a definite level. This avoids the risk of subsequent decision-making due to misjudgment and greatly enhances the credibility of the system.

[0113] The uncertainty of predictions is quantified by calculating the distance to the nearest standard value. The principle is intuitive and computationally inexpensive. The distance threshold, as a clearly adjustable parameter, allows users to flexibly balance the degree of automation with the prudence of the results according to the different requirements of false positive and false negative rates in actual applications.

[0114] Before inputting the quantitative features into the regression model, a quality control judgment step is also included, including: Calculate the projected area or signal-to-noise ratio of the region along line C; If the projected area or signal-to-noise ratio of the C-line region is lower than the preset quality control threshold, the detection is deemed invalid and the grade prediction process is terminated.

[0115] The projected area reflects the total color intensity of the C-line, while the signal-to-noise ratio (SNR) assesses the clarity of the C-line signal relative to background noise. These two metrics directly quantify the quality of the C-line.

[0116] The calculated index value is compared with a preset quality control threshold, which is determined based on a large amount of valid test data and represents the minimum C-line signal intensity or clarity required to ensure normal reagent reaction, sufficient sample addition, and membrane integrity. If the projected area or signal-to-noise ratio of the C-line region is lower than this threshold, it indicates that the test may be invalid due to reagent failure, insufficient sample addition, insufficient reaction time, or damaged test strip. Once an invalidation is determined, the entire grade prediction process will be terminated immediately, and feature extraction and regression analysis of the T-line will no longer be performed.

[0117] By deeply integrating the inherent quality control function (C-line) of the test strips with automated image analysis, a T-line grade report is generated only for valid tests that pass internal quality control. This fundamentally prevents the risk of incorrect quantification and reporting of invalid test results. Through pre-emptive, automated invalid test screening, subsequent calculations for invalid samples can be identified and terminated in advance, avoiding unnecessary waste of computational resources. Once invalidity is determined, a clear conclusion can be returned to the user immediately without waiting for complete grade analysis results. This allows users to quickly learn of test failures and promptly retry or troubleshoot, shortening the overall processing cycle for invalid tests and improving system interaction efficiency and user satisfaction.

[0118] This invention also provides a reagent stripe grading recognition system based on image processing and machine learning, comprising the following steps for implementing a reagent stripe grading recognition method based on image processing and machine learning: An image acquisition module is used to acquire an original image of the reagent strip, the original image containing the reaction cell area of ​​the reagent strip; The localization module is used to locate the reaction groove region in the original image through a directional target detection model, and to obtain the position and angle information of the reaction groove region; The correction module is used to correct and extract regions from the original image based on the position and angle information to obtain an image of the reaction groove region. The position recognition module is used to process the image of the reaction tank area and identify the positions of the C-line and T-line; The quantitative feature acquisition module is used to perform color intensity analysis on the T-line region and acquire quantitative features. The grade determination module is used to input the quantified features into a machine learning regression model to obtain the color grade of the T-line.

[0119] The working principle and effect of the above technical solution are the same as those in the embodiment of the reagent strip grade recognition method based on image processing and machine learning, and will not be repeated here.

[0120] This invention also provides an electronic device, which includes a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the steps of the method described in any embodiment of this invention.

[0121] This invention also provides a computer-readable storage medium for storing a computer program. When the computer program is executed, it implements the steps of the method described in Embodiment 1 of this invention. The specific implementation method is consistent with the implementation method and the technical effects achieved in the above method embodiments, and some contents will not be repeated.

[0122] Although embodiments of the present invention have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present invention. Those skilled in the art can make changes, modifications, substitutions and variations to the above embodiments within the scope of the invention without departing from the principles and spirit of the invention, and all such changes should fall within the protection scope of the claims of the present invention.

Claims

1. An image processing and machine learning based reagent strip grade recognition method, characterized in that, include: Acquire an original image of the reagent strip, the original image containing the reaction vessel area of ​​the reagent strip; The reactive groove region in the original image is located using a directional target detection model, and the position and angle information of the reactive groove region are obtained. Based on the position and angle information, the original image is corrected and region extraction is performed to obtain an image of the reaction tank region; The images of the reaction tank area were processed to identify the positions of the C-line and T-line; Color intensity analysis was performed on the T-line region to obtain quantitative characteristics; The quantified features are input into a machine learning regression model to obtain the color level of the T-line.

2. The reagent strip grade identification method according to claim 1, characterized in that, The reactive region is detected using a target detection model that supports directed bounding boxes; the training steps of the target detection model that supports directed bounding boxes include: Acquire raw images of multiple reagent strips, including images with multiple predefined deflection angles, various lighting conditions, and scenes where parts of the image are occluded; Using the directed bounding box annotation tool, rotated rectangles are used to annotate the reaction cell region in each image. The annotation information includes the center point coordinates, length, width, rotation angle, and reagent strip reaction cell category label of the box. The labeled training images are enhanced to obtain the processed dataset; the enhancement process includes one or more of the following: adjusting the image brightness and contrast to simulate uneven lighting, adding random salt and pepper noise or Gaussian noise, and performing affine transformation on the image to simulate the physical deformation of the test strip. The processed dataset is used to train the model and optimize its parameters. The physical deformation of the simulated reagent strip includes: Based on the thin plate elasticity model or finite element analysis model, the bending deformation of the reagent strip carrier under different support conditions is simulated; A corresponding two-dimensional image displacement field is generated based on the deformation model, and the training image is subjected to non-rigid deformation transformation using the displacement field, thereby generating an enhanced image that is closer to the real physical deformation.

3. The reagent strip grade identification method according to claim 1, characterized in that, The process of processing the image of the reaction tank area to identify the positions of the C-line and T-line includes: The image of the reaction tank area is subjected to filtering, noise reduction, and channel fusion processing. Background estimation and correction are performed on the processed image; Pixel projection and peak analysis are performed on the background-corrected image to locate the C-line and T-line.

4. The reagent strip grade identification method according to claim 3, characterized in that, The filtering, denoising, and channel fusion processing includes: The image of the reaction tank region was sequentially subjected to median filtering and Gaussian filtering. The filtered image is then subjected to RGB channel weighted fusion, where the weight of the red channel is greater than that of the green and blue channels.

5. The reagent strip grade identification method according to claim 3, characterized in that, The background estimation and correction of the processed image includes: Using the center of the reaction tank region image as a reference, a first rectangular region is selected as the effective analysis region, and the length and width of the first rectangular region are respectively the first preset ratio of the length and width of the reaction tank region image. Within the effective analysis area, for the fused image, pixel values ​​are accumulated along the horizontal direction to generate a first projection curve, and the possible range of strip regions in the image is initially determined based on the first projection curve. Within the effective analysis area, multiple background sampling sub-regions are selected, wherein the background sampling sub-regions avoid the range of the initial strip region; Calculate the mean or median pixel grayscale value in each background sampling sub-region, and fit a background grayscale model that changes continuously along the length of the reaction groove based on the statistical values ​​of all sampling points. Based on the background grayscale model, for each column of pixels in the fused image, the corresponding background grayscale estimate is subtracted to obtain the background-corrected image.

6. The reagent strip grade identification method according to claim 5, characterized in that, Determining the possible range of band regions in the image includes: The fused image is then downsampled. The pixel values ​​of the downsampled image are accumulated along the horizontal direction to generate the first projection curve; Identify local maxima on the first projection curve; For each local maximum point, on the first projection curve, search to the left and right from that point until a position is encountered where the curve value drops to a second preset proportion of the peak point. The two searched positions are then used as the preliminary strip region boundaries corresponding to the peak point.

7. The reagent strip grade identification method according to claim 3, characterized in that, The step of performing pixel projection and peak analysis on the background-corrected image to locate the C-line and T-line includes: The background-corrected image is accumulated along the horizontal direction to generate a second projection curve for precise positioning. The second projection curve is smoothed and filtered. The local peak points of the smoothed curve are used as the center positions of the candidate strips; For each candidate strip, the region width, average gray level and edge gradient distribution features are calculated based on its center position, and its effectiveness is verified according to the preset strip feature conditions. From the verified candidate strips, the final positions of the C-line and T-line are matched and determined according to the preset order relationship and spacing range between the C-line and T-line.

8. The reagent strip grade identification method according to claim 1, characterized in that, The quantization feature is the normalized projected area of ​​the T-line region. The step of performing color intensity analysis on the T-line region to obtain the quantization feature includes: For the image of the located T-line region, pixel values ​​are accumulated along the direction of its strip extension to generate an intensity projection curve; Determine the effective color rendering range on the intensity projection curve; The projected area of ​​the T-line region is obtained by numerically integrating the curve within the effective color rendering range. The projected area is normalized to obtain the quantized features.

9. The reagent strip grade identification method according to claim 1, characterized in that, The color rendering level of the T-line can be obtained through the following methods: The quantized features are input into a trained support vector regression model to obtain a continuous color intensity prediction value; The continuous color intensity prediction values ​​are mapped to predefined discrete color level labels; Among them, different training weights are assigned to different samples based on their own characteristics and their prediction performance. The method of assigning different training weights to different samples includes: Determine the boundary value between adjacent color development levels based on the color development intensity values ​​of all standard reagent strip samples; For each training sample, calculate the distance between its color intensity value and the nearest boundary value; Initial training weights are assigned to each training sample based on the distance, wherein the initial training weights are negatively correlated with the distance.

10. The reagent strip grade identification method according to claim 9, characterized in that, The method of assigning different training weights to different samples also includes: Use the initial training weights to train an initial regression model; The initial regression model is used to predict each training sample, and the first error between the predicted value and the true level label, and the second error between the predicted value and the adjacent level standard value are calculated. Based on the first error and the second error, calculate the difficulty coefficient of each training sample; Based on the initial training weights and difficulty coefficients, assign final weights for formal model training to each training sample.