Test paper color block reading measurement method based on photo database retrieval
By constructing a database of urine test strip images and performing vectorized feature matching, the problems of environmental factors and data scarcity in urine test strip detection were solved, achieving efficient and accurate urine test strip detection.
Patent Information
- Application Number
- CN202411865932.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-18
- Publication Date
- 2026-01-20
AI Technical Summary
Existing urine test strip methods are easily affected by environmental factors such as light and angle, resulting in unstable test results, insufficient efficiency and accuracy, and the scarcity of data limits the generalization ability of deep learning models.
A dedicated database of urine test strip images was constructed. By vectorizing color blocks, test strip subjects, and backgrounds, and combining methods to enhance illumination, angle, and noise, multi-key image data was generated. Weighted similarity calculation was used for feature matching to achieve fast and accurate color block recognition.
It improves the accuracy and stability of urine test strip detection, reduces interference from environmental factors, expands the amount of training data, enhances the robustness and adaptability of the model, and ensures detection accuracy under different conditions.
Smart Images

Figure CN121365148A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of urine test paper detection, in particular to a test paper color block reading measurement method based on photo database retrieval. BACKGROUND
[0002] In medical detection and biosensor data analysis, automated and precise detection methods are gradually becoming a trend. In particular, in the use of urine test paper, traditional detection methods rely on human eye observation or simple optical instruments for result interpretation. However, due to the relatively small changes in the color blocks on the test paper, subjective judgment is easily affected by factors such as light and shooting angle, resulting in unstable detection results and large errors. In addition, manual detection is time-consuming and labor-intensive, which is not conducive to large-scale application. With the help of deep learning technology, detection efficiency and accuracy can be automated and improved, but the key to model training lies in the quality and quantity of data. The picture data of urine test paper has a fixed background and regular color block distribution, which is theoretically very suitable for color block reading methods combining database retrieval and deep learning.
[0003] Existing image retrieval methods usually match based on full-image features. This technology performs well in scenes where object shapes are not fixed and colors are complex. However, for specific objects such as urine test paper with fixed background and regular color blocks, traditional full-image retrieval methods may not be stable. Since the main elements in the test paper image are simple and relatively fixed, using traditional full-image features for retrieval can easily produce large fluctuations due to small changes in light and angle, affecting the interpretation results. In addition, existing simple optical instruments can only read rough color changes and cannot identify subtle color differences, resulting in insufficient data accuracy. In general, the shortcomings of existing technologies are:
[0004] 1. Data feature mismatch: conventional image retrieval methods perform well when dealing with complex backgrounds and diverse objects, but the color blocks and background in urine test paper images are fixed, and full-image feature retrieval cannot effectively identify small color difference changes;
[0005] 2. Susceptible to environmental factors: existing methods are sensitive to shooting conditions such as light and angle, resulting in large fluctuations in results and poor stability;
[0006] 3. Insufficient efficiency and accuracy: manual visual inspection is highly subjective, and traditional instruments lack precision, making it difficult to accurately read the color information on the urine test paper, affecting detection accuracy;
[0007] 4. Data scarcity problem: urine test paper detection involves medical data, and the cost of obtaining and labeling data is high, limiting the training effect of the model and affecting the generalization ability of the deep learning model. Therefore, we propose a test paper color block reading measurement method based on photo database retrieval. SUMMARY
[0008] The application aims to provide a test paper color block reading measurement method based on photo database retrieval, which has the advantages of improving the accuracy, stability and efficiency of detection, and solves the problems of data feature mismatch, susceptibility to environmental factors, insufficient efficiency and accuracy, and data scarcity.
[0009] To achieve the above-mentioned purpose, the application provides the following technical scheme: a test paper color block reading measurement method based on photo database retrieval, comprising the following processes:
[0010] I: Database preparation: color block library, test paper main body library, background library, respectively constructing vector library background picture preparation;
[0011] II: Test paper enhancement, simulating different light and shooting angles, generating multiple keys;
[0012] III: Vector library search based on color block, test paper main body and background.
[0013] The above processes are combined to form the following specific steps:
[0014] S1: Construction of exclusive urine test paper image database, the database construction range includes:
[0015] a, color block library: used to construct a color block color information library containing different indicators on urine test paper, covering color changes of color blocks in different states;
[0016] b, test paper main body library: used to construct a main body library containing shape, structure and size information of various urine test papers, supporting detection of urine test papers of different brands and models;
[0017] c, background library: used to establish a diversified background library, including background data of different materials and light conditions, so that the detection system has environmental adaptability;
[0018] d, vector library construction: used to form an independent vector database by vectorizing color block, test paper main body and background data, to ensure the efficiency and accuracy of subsequent retrieval;
[0019] S2: Urine test paper image enhancement method, the enhancement method includes:
[0020] a, light enhancement: used to simulate test paper images under natural light, indoor light sources and different light directions, to generate enhanced images under multiple light conditions;
[0021] b, angle enhancement: used to simulate different shooting angles to generate test paper images under multiple angles to improve the robustness of the model in actual application;
[0022] c. Color block change enhancement: used to generate color changes of color blocks under different detection states, ensuring that the model can accurately identify color blocks under different detection states;
[0023] d. Background overlay enhancement: used to overlay test paper images on various backgrounds to simulate different shooting scenes and improve the model's adaptability to complex backgrounds;
[0024] e. Noise and blur processing: used to simulate image noise under different shooting devices and environmental conditions by adding Gaussian noise, slight blur, etc., making the model robust to shooting noise;
[0025] S3: Vector library search based on color blocks, test paper bodies, and backgrounds to achieve fast retrieval and accurate color block identification of urine test paper. By inputting the test paper image feature vector, the most similar feature vector in the database is retrieved, and the corresponding detection result is obtained. The specific steps are as follows:
[0026] a. Feature extraction and vectorization of input image:
[0027] Feature extraction of input image includes feature extraction and vectorization of color blocks, test paper bodies, and backgrounds;
[0028] Color block feature extraction: color, texture, and other features are extracted from the color block area Rcolor block. Assume that the color block color vector is Vcolor block, which contains color information of different indicators. The specific form is:
[0029] Vcolor block = {C1, C2,..., Cn}
[0030] Where Ci represents the color feature value of the ith color block;
[0031] Test paper body feature extraction: the outline, edge, and structural features of the test paper body area are extracted to generate the test paper body vector Vbody. Assume that this vector contains outline edge coordinates and shape factor information, which can be represented as:
[0032] Vbody = {S1, S2,..., Sm}
[0033] Where Si represents the ith feature of the test paper body;
[0034] Background feature extraction: texture, color, and other features are extracted from the background area Rbackground to describe different materials and lighting conditions of the background, generating the background vector Vbackground
[0035] Vbackground = {B1, B2,..., Bk}
[0036] Where Bi represents the ith feature of the background;
[0037] Finally, the feature vector of the input image I can be represented as:
[0038] VIbackground = {Vpatch, Vbody, Vbackground}
[0039] b. Matching search in vector library:
[0040] Based on the input image feature vector VI extracted in the previous step, we perform matching search in the patch library, test paper body library and background library respectively. Assume that the vector library in the database is Dpatch, Dbody and Dbackground respectively.
[0041] Patch vector library search: In the patch vector library Dpatch, the similarity between the input image patch vector Vpatch and each patch vector in the patch library is calculated using distance measurement method, and the patch vector Vpatch* with the highest similarity to Vpatch is found.
[0042] Test paper body vector library search: In the test paper body library Dbody, the similarity between the test paper body vector Vbody and each test paper body vector in the body library is calculated, and the most matched test paper body vector Vbody* is found.
[0043] Background vector library search: In the background library Dbackground, the similarity between the test paper body vector Vbackground and each test paper body vector in the body library is calculated, and the most matched test paper body vector Vbackground* is found.
[0044] The finally matched patch, test paper body and background feature vectors can be represented as:
[0045] V* = {Vpatch*, Vbody*, Vbackground*}
[0046] c. Similarity calculation and result output:
[0047] In the vector library matching process, in order to ensure the accuracy and robustness of the matching result, a weighted similarity calculation method is introduced, and the comprehensive similarity S is:
[0048] S = wpatch.sim(Vpatch, Vpatch*) + wbody.sim(Vbody, Vbody*) + wbackground.sim(Vbackground, Vbackground*)
[0049] d. Final search result and patch interpretation:
[0050] By comparing the value of the comprehensive similarity S, the image data in the database that is most matched with the input image is selected, and according to the detection indicators and state values of the matched patch vector Vpatch*, the corresponding urine test paper interpretation result is generated. Specifically:
[0051] If the comprehensive similarity S exceeds a certain threshold T, it is considered that the matching is successful, and the corresponding patch indicators and state are output as the detection result. By further analyzing the color value of the matched patch, the specific detection value is determined, and a detailed detection report is output.
[0052] S4: Multi-key generation and diversified image data construction method, the construction method comprising:
[0053] a. Multi-key generation mechanism: for each test paper image, generate multiple versions according to different dimensions of enhancement processing such as illumination, angle, background, etc., so that each image has diversified forms under different conditions;
[0054] b. Data construction automation: generate multiple keys in batches through automated data enhancement method, significantly expand the training data volume, solve the data scarcity problem, and improve the model training effect;
[0055] S5: Real-time and robustness optimization of urine test paper automatic recognition system, the optimization scheme comprising:
[0056] a. Efficient image processing and retrieval algorithm: through the fast retrieval mechanism of vector library and the multi-level similarity calculation method, the real-time processing of urine test paper image is realized, ensuring that the system can quickly respond under different light, angle and background conditions;
[0057] b. Strong anti-interference structure design: by simulating various background, illumination, angle and noise conditions, the system has high robustness to environmental changes and noise interference in actual use, so that it can maintain detection accuracy in diversified scenarios;
[0058] S6: Accuracy optimization of urine test paper interpretation under specific environmental conditions, the accuracy optimization scheme comprising:
[0059] a. Accurate color block identification based on color features: through the color change pattern of different indicators in the color block library, accurate identification of urine test paper color blocks is realized, avoiding color block interpretation errors caused by changes in shooting conditions;
[0060] b. Compound color block identification under multi-index detection conditions: for the compound color block of multiple detection indicators on the same test paper, through multi-level color vector matching, independent detection and result output of each indicator color block are realized, ensuring the reliability of multi-index compound detection.
[0061] Preferably, the color block library in step S1a is the core part of the database, containing color information of different indicator color blocks on urine test paper.
[0062] Preferably, the test paper main library in step S1b contains the basic information of urine test paper shape, structure and size, which is used to adapt to urine test papers of different brands and models, and at the same time enhances the model's recognition ability of the test paper main body.
[0063] Preferably, the background library in step S1 includes various background pictures that the urine test paper may appear, for enhancing the generalization ability of the model and ensuring that the test paper information can be accurately recognized and read under different shooting environments and background materials.
[0064] Preferably, the vector library construction in step S1 is performed after the color block library, the test paper body library and the background library are constructed, and the image data of each database is processed into vectors to construct a corresponding vector library for subsequent efficient retrieval.
[0065] Preferably, the light condition simulation in step S2a is performed to simulate various actual light scenes to enhance the image data.
[0066] Preferably, the shooting angle variation in step S2b causes the test paper body in the image to appear deformation or offset, and different shooting angle simulation generates multi-view image data to ensure that the model can correctly recognize the test paper body and the color block under various angles.
[0067] Preferably, the color variation and background superposition in steps S2c and S2d are color and contrast adjustment, which can further increase the data diversity and simulate different imaging devices and shooting environments.
[0068] Preferably, the noise and blur processing in step S2e is to enhance the anti-interference ability of the test paper image by adding noise and blur processing.
[0069] Preferably, the multi-key data generation in process II is to generate multiple versions of test paper images through various enhancement methods, and each image generates a “multi-key” under specific conditions, that is, the combination of multiple images, to improve the generalization ability of the model under different environmental conditions.
[0070] Compared with the prior art, the present application has the following advantages:
[0071] 1. The present application constructs a high-quality urine test paper image database, and designs a special feature matching algorithm for urine test paper based on the database, fully considers the color variation of the test paper color block, such as the color distribution of different index color blocks under normal and abnormal states, and calibrates and adjusts the light, shooting angle and other factors to ensure the consistency of the readings under different environmental conditions.
[0072] 2.The urine test paper image detection system provided by the application greatly improves the accuracy and stability of urine test paper image detection by searching and reading exclusive image features, and reduces the interference of environmental factors on the detection results; meanwhile, through database expansion and image enhancement, the problem of insufficient data of the deep learning model is solved, so that the system has stronger generalization ability and robustness; this method reduces the data dependence while significantly improving the accuracy, stability and application range of the urine test paper automatic detection system, and effectively solves the defects of the prior art. BRIEF DESCRIPTION OF DRAWINGS
[0073] Figure 1 The flowchart of the application is shown in the figure. DETAILED DESCRIPTION
[0074] The technical solutions in the embodiments of the application will be described clearly and completely in combination with the accompanying drawings in the embodiments of the application. Obviously, the described embodiments are only a part of the embodiments of the application, rather than all the embodiments. Based on the embodiments in the application, all other embodiments obtained by those skilled in the art without creative labor fall within the protection scope of the application.
[0075] Please refer to Figure 1 The application provides a technical solution: a test paper color block reading measurement method based on photo database search, including the following processes.
[0076] I: Database preparation: color block library, test paper main body library, background library, respectively constructing vector library and background picture preparation.
[0077] II: Test paper enhancement, simulating different lightings and shooting angles to generate multiple keys.
[0078] III: Vector library search based on color block, test paper main body and background.
[0079] The following specific steps are formed in combination with the above processes.
[0080] S1: Exclusive urine test paper image database construction, the database construction range of which includes:
[0081] a. Color block library: used for constructing a color block color information library containing different indicators on the urine test paper, covering color changes of the color blocks in different states.
[0082] b. Test paper main body library: used for constructing a main body library containing shape, structure and size information of various urine test papers, supporting detection of urine test papers of different brands and models.
[0083] c. Background library: used for establishing a diversified background library, including background data of different materials and lighting conditions, so that the detection system has environmental adaptability.
[0084] d. Vector library construction: To form an independent vector database by vectorizing color blocks, test paper bodies, and background data, ensuring the efficiency and accuracy of subsequent retrieval;
[0085] S2: Urine test paper image enhancement method, the enhancement method includes:
[0086] a. Light enhancement: To simulate natural light, indoor light sources, and test paper images under different light directions, generate enhanced images under multiple lighting conditions;
[0087] b. Angle enhancement: To simulate different shooting angles, generate test paper images under multiple angles to improve the robustness of the model in actual application;
[0088] c. Color block change enhancement: To generate color changes of color blocks under different detection states, ensure that the model can accurately identify color blocks in different detection states;
[0089] d. Background superposition enhancement: To superimpose test paper images on multiple backgrounds to simulate different shooting scenes and improve the adaptability of the model to complex backgrounds;
[0090] e. Noise and blur processing: To simulate image noise under different shooting devices and environmental conditions by adding Gaussian noise and slight blur, so that the model has robustness to shooting noise;
[0091] S3: Vector library search based on color blocks, test paper bodies, and backgrounds to achieve fast retrieval and accurate color block recognition of urine test paper. By vectorizing the input test paper image features, the most similar feature vector in the database is retrieved, and the corresponding detection result is obtained. The specific steps are as follows:
[0092] a. Feature extraction and vectorization of input image:
[0093] Feature extraction of input image includes feature extraction and vectorization of color block, test paper body and background;
[0094] Color block feature extraction: Color, texture and other features of color block area R color block are extracted, assuming that color block color vector is V color block, which contains color information of color block of different indicators, and the specific form is:
[0095] V color block = {C1, C2,..., Cn}
[0096] Wherein, Ci represents the color feature value of the ith color block;
[0097] Test paper body feature extraction: The contour, edge and structural features of the test paper body area are extracted to generate the test paper body vector V body, assuming that the vector contains contour edge coordinates and shape factor information, which can be represented as:
[0098] Vbody = {S1, S2,..., Sm}
[0099] where Si represents the i-th feature of the test paper body;
[0100] Background feature extraction: extract texture, color and other features from the background region Rbackground to describe different materials and lighting conditions of the background, and generate a background vector Vbackground
[0101] Vbackground = {B1, B2,..., Bk}
[0102] where Bi represents the i-th feature of the background;
[0103] Finally, the feature vector of the input image I can be represented as:
[0104] VIbackground = {Vpatch, Vbody, Vbackground}
[0105] b. Matching search in vector library:
[0106] Based on the input image feature vector VI extracted in the previous step, we perform matching search in the patch library, test paper body library and background library respectively. Assume that the vector libraries in the database are Dpatch, Dbody and Dbackground respectively;
[0107] Patch vector library search: in the patch vector library Dpatch, use distance measurement method to calculate the similarity between the input image patch vector Vpatch and each patch vector in the patch library, and find the patch vector Vpatch* with the highest similarity to Vpatch;
[0108] Test paper body vector library search: in the test paper body library Dbody, calculate the similarity between the test paper body vector Vbody and each test paper body vector in the body library, and find the most matched test paper body vector Vbody*;
[0109] Background vector library search: in the background library Dbackground, calculate the similarity between the test paper body vector Vbackground and each test paper body vector in the body library, and find the most matched test paper body vector Vbackground*;
[0110] The finally matched patch, test paper body and background feature vectors can be represented as:
[0111] V* = {Vpatch*, Vbody*, Vbackground*}
[0112] c. Similarity calculation and result output:
[0113] In the vector library matching process, in order to ensure the accuracy and robustness of the matching result, a weighted similarity calculation method is introduced, and the comprehensive similarity S is:
[0114] S = wpatch.sim(Vpatch, Vpatch*) + wbody.sim(Vbody, Vbody*) + wbackground.sim(Vbackground, Vbackground*)
[0115] d. Final search results and patch interpretation:
[0116] By comparing the value of the comprehensive similarity S, the image data in the database that best matches the input image is selected, and the corresponding urine test strip interpretation result is generated according to the detection indicators and state values of the matched patch vector Vpatch*, Specifically:
[0117] If the comprehensive similarity S exceeds a certain threshold T, it is considered that the matching is successful, and the corresponding patch indicators and state are output as the detection result, by further analyzing the color value of the matched patch, the specific detection value is determined, and the detailed detection report is output,
[0118] S4: Multi-key generation and diversified image data construction method, the construction method comprises:
[0119] a. Multi-key generation mechanism: for each test paper image, multiple versions are generated according to different dimensions of enhancement processing such as illumination, angle, background, etc., so that each image has multiple forms under different conditions;
[0120] b. Data construction automation: batch generate multi-key through automated data enhancement method, significantly expand training data volume, solve data scarcity problem, improve model training effect;
[0121] S5: Real-time and robustness optimization of urine test paper automatic identification system, the optimization scheme comprises:
[0122] a. Efficient image processing and retrieval algorithm: through the fast retrieval mechanism of vector library and multi-level similarity calculation method, the real-time processing of urine test paper image is realized, ensuring that the system can quickly respond under different light, angle and background conditions;
[0123] b. Strong anti-interference structure design: by simulating various background, illumination, angle and noise conditions, the system has high robustness to environmental changes and noise interference in actual use, so that it can maintain detection accuracy in diversified scenes;
[0124] S6: Precision optimization of urine test paper interpretation under specific environmental conditions, the precision optimization scheme comprises:
[0125] a. Accurate patch identification based on color features: through the color change pattern of different indicators in the patch library, accurate identification of urine test paper patches is realized, avoiding patch interpretation errors caused by changes in shooting conditions;
[0126] b. Compound color block recognition under multi-index detection conditions: For the compound color block situation of multiple detection indexes on the same test paper, through the matching of multiple levels of color vectors, the independent detection and result output of each index color block are realized, and the reliability of multi-index compound detection is ensured.
[0127] Specifically, the a color block library in step S1 is the core part of the database, which contains the color information of different index color blocks on the urine test paper. The construction of the color block library includes the following considerations:
[0128] ① Index classification: Each color block corresponds to a different detection index, and each index has a unique color change pattern;
[0129] ② Color gradient sampling: In each index color block, each color change state is finely sampled to ensure that the color block library can cover all color change situations;
[0130] ③ Standardized color parameters: The color of the color block is standardized to reduce the interference of external factors during shooting and ensure the consistency of color features during subsequent retrieval.
[0131] Specifically, the b test paper main library in step S1 contains the basic information of the shape, structure, and size of the urine test paper, which is used to adapt to different brands and types of urine test papers and enhance the recognition ability of the model to the test paper main body. The main steps include:
[0132] ① Test paper specification diversity: Collect images of urine test papers of multiple specifications to ensure that the model can recognize the shape of test papers of different manufacturers and types;
[0133] ② Partition annotation: Partition annotation is performed on the color block position on the test paper to accurately identify the color block position during subsequent image enhancement and feature extraction;
[0134] ③ Test paper edge feature extraction: Extract and store the edge and contour features of the test paper, including shape and edge position, to accurately locate the test paper main body in different backgrounds.
[0135] Specifically, the c background library in step S1 contains various background pictures where the urine test paper may appear, which is used to enhance the generalization ability of the model and ensure accurate recognition and reading of test paper information in different shooting environments and background materials. The preparation of the background library mainly involves the following aspects:
[0136] ① Diversified background collection: Collect multiple backgrounds where the test paper may be placed, covering home, hospital, and laboratory use scenarios;
[0137] ② Environmental factor regulation: Collect background pictures under different lighting conditions to ensure that the model can adapt to the diversity of lighting conditions in actual scenes;
[0138] ③Texture and color diversification: Select background materials with different textures and colors to adapt to various interference factors that may exist during shooting, and enhance the anti-interference ability of the model.
[0139] Specifically, the d vector library construction in step S1 is to process the image data of each database into vectors after the color block library, test paper body library and background library are constructed, and to construct the corresponding vector library for subsequent efficient retrieval, wherein the vector library includes:
[0140] ①Color block vector library: Each color block color is converted into a unique color vector, and the corresponding detection index and state are labeled for fast retrieval;
[0141] ②Test paper body vector library: The shape, structure and other information of the test paper are stored in the form of vectors to ensure fast positioning of the test paper body;
[0142] ③Background vector library: Through the vectorized background data, ensure that the model can quickly retrieve and match the corresponding background environment in the database, realize stable recognition and enhancement.
[0143] Specifically, the a light condition simulation in step S2 is to simulate various actual light scenes to enhance image data, as different light conditions will affect the color and brightness of the test paper image, wherein the light enhancement includes the following detailed steps:
[0144] ①Light source type: Simulate different light source types, such as natural light (early, mid, and late sunlight), artificial light (incandescent lamp, fluorescent lamp, LED lamp, etc.), each light source has different spectral characteristics and illumination effects, which affects the performance of test paper color blocks;
[0145] ②Light intensity variation: Adjust the light intensity to simulate strong light, weak light and shadow conditions, which has a significant impact on color recognition, ensuring that the model can stably recognize color blocks under high and low brightness conditions;
[0146] ③Light angle simulation: By simulating light changes from different angles, generate test paper image data with different shadows, ensure the recognition accuracy of color blocks under non-vertical light conditions.
[0147] Specifically, the b shooting angle variation in step S2 causes the test paper body in the image to appear deformation or offset, and different shooting angle simulation generates multi-view image data to ensure that the model can correctly identify the test paper body and color blocks under various angles, the specific processing is as follows:
[0148] ①Pitch angle adjustment: Simulate image changes of test paper at different pitch angles, generate image data from 0 degrees (completely vertical viewing angle) to about 45 degrees to cover common shooting angles;
[0149] ② Rotation angle change: Simulates the rotation angle change of the test strip on the horizontal plane to ensure that the model can accurately identify the color block information regardless of the orientation of the test strip;
[0150] ③ Perspective distortion: When simulating angle changes, the perspective effect of the image is processed, especially under non-orthogonal viewing angles, so that the test paper image produces a distortion effect that conforms to the actual shooting, thereby improving the model's resistance to deformation.
[0151] Specifically, the color changes of c and d and the color and contrast adjustments of the background overlay in step S2 can further increase data diversity and simulate different imaging devices and shooting environments. Specific adjustments include:
[0152] ① Color saturation variation: Adjust the color saturation of the color blocks to simulate the differences in color capture between different imaging devices, ensuring that the model adapts to images captured by various devices;
[0153] ② Contrast and brightness adjustment: Fine-tune the overall brightness and contrast of the image to cope with changes caused by different lighting conditions and imaging settings, and ensure that color block information can still be accurately read under different contrast conditions;
[0154] ③ White balance correction: Simulate white balance deviations in different scenarios to generate images under various color temperatures to cope with different color shifts and ensure that the model can accurately identify the color patch information of the test strip in cool and warm color environments.
[0155] Specifically, in step S2, the noise and blurring process enhances the anti-interference capability of the test strip image by adding noise and blurring, wherein:
[0156] ① Noise enhancement: Simulate possible noise types in the image (such as particle noise caused by high ISO, color noise from the device itself, etc.) to improve the model's recognition accuracy under noisy conditions.
[0157] ②Blurring: Simulate possible slight blurring during shooting (such as incomplete focus or slight shaking) to ensure that the model can still identify the color block and the main body of the test paper even under slight blur.
[0158] Specifically, in Process II, multi-bond data generation involves processing images using various enhancement methods to create multiple versions of the test strip image. Each image generates a "multi-bond" under specific conditions, which is a combination of multiple images used to improve the model's generalization ability under different environmental conditions. The multi-bond data generation process includes:
[0159] ① Multidimensional enhancement of the base image: Generate multiple variants based on the aforementioned enhancement methods (lighting, angle, color, contrast, noise, etc.);
[0160] ② Multi-key labels: Each image is attached with specific enhancement information labels (such as lighting conditions, angle, and noise type), enabling the model to learn these condition changes during training;
[0161] ③ Multi-key combination: Combine various enhanced images into a dataset to ensure that the model can read stable and accurate results under different shooting conditions and environments.
[0162] This technical solution: Through these enhancement techniques, the present invention constructs a rich and diverse image dataset, thereby effectively improving the robustness and adaptability of the model, enabling it to accurately identify color block information on urine test strips under different lighting, angles and device conditions, ensuring the stability and accuracy of the detection.
[0163] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit the scope of protection of the present invention. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the essence and scope of the technical solutions of the present invention.
Claims
1. A method for measuring test strip color patches based on photo database retrieval, characterized in that, The process includes the following steps: Ⅰ: Database preparation: color patch library, test strip main body library, background library, and prepare background images for vector library construction respectively; II: The test paper is enhanced to simulate different lighting and shooting angles, generating multiple bonds; III: Vector library search based on color blocks, test strip body, and background. The above process forms the following specific steps: S1: Construction of a dedicated urine test strip image database, the scope of which includes: a. Color Block Library: Used to build a color information library containing different indicators on urine test strips, covering the color changes of color blocks under different conditions; b. Test strip library: Used to build a library containing information on the shape, structure and size of various urine test strips, supporting the detection of different brands and models of urine test strips; c. Background library: Used to establish a diverse background library, including background data of different materials and lighting conditions, so that the detection system has environmental adaptability; d. Vector library construction: This is used to vectorize the color blocks, test strip main body and background data to form an independent vector database, ensuring the efficiency and accuracy of subsequent retrieval; S2: Image enhancement methods for urine test strips, including: a. Light Enhancement: Used to simulate test strip images under natural light, indoor light sources, and different light directions to generate enhanced images under various lighting conditions; b. Angle Enhancement: Used to simulate different shooting angles and generate test strip images from multiple angles to improve the robustness of the model in practical applications; c. Color block variation enhancement: Used to generate color changes of color blocks under different detection states, ensuring that the model can accurately identify color blocks under different detection states; d. Background overlay enhancement: Used to overlay test strip images onto various backgrounds to simulate different shooting scenarios and improve the model's adaptability to complex backgrounds; e. Noise and blur processing: Used to simulate image noise under different shooting equipment and environmental conditions by adding Gaussian noise and slight blur processing, so that the model is robust to shooting noise; S3: Based on vector library search of color blocks, test strip body, and background, this method achieves rapid retrieval and accurate color block recognition of urine test strips. By vectorizing the features of the input test strip image, the method retrieves the most similar feature vectors from the database, ultimately obtaining the corresponding detection results. The specific steps are as follows: a. Feature extraction and vectorization of the input image: Feature extraction of the input image includes feature extraction and vectorization of three parts: color blocks, test paper body, and background; Color block feature extraction: Color, texture, and other features are extracted from the color block region R. Assuming the color vector of the color block is V, it contains color information of the color block in different metrics, specifically in the following form: V color block = {C1, C2, ..., Cn} Where Ci represents the color feature value of the i-th color patch; Test strip main body feature extraction: Extract the contour, edge, and structural features of the main body region of the test strip to generate the test strip main body vector V_main body. Assuming that this vector contains contour edge coordinates and shape factor information, it can be represented as: V_body = {S1, S2, ..., Sm} Where Si represents the i-th feature of the test strip body; Background feature extraction: Extract texture and color features from the background region R (background) to describe different materials and lighting conditions of the background, generating a background vector V (background). V_background = {B1, B2, ..., Bk} Where Bi represents the i-th feature of the background; Finally, the feature vector of the input image I can be represented as: VI background = {V color block, V subject, V background} b. Matching search in the vector library: Using the input image feature vector VI extracted in the previous step, we perform matching searches in the color block library, the test paper subject library, and the background library respectively. Let's assume that the vector libraries in the database are D color block, D subject, and D background respectively. Color patch vector library search: In the color patch vector library D, use the distance metric method to calculate the similarity between the input image color patch vector V and each color patch vector in the color patch library, and find the color patch vector V patch* with the highest similarity to color patch V; Searching the test strip subject vector library: In the test strip subject library D, calculate the similarity between the test strip subject vector V and each test strip subject vector in the library, and find the most matching test strip subject vector V*. Background vector library search: In the background library D background, calculate the similarity between the test strip main body vector V background and each test strip main body vector in the main body library, and find the most matching test strip main body vector V background*; The final matched feature vectors of the color block, the test strip itself, and the background can be represented as follows: V* = {V color block*, V main body*, V background*} c. Similarity calculation and result output: To ensure the accuracy and robustness of the matching results during the vector library matching process, a weighted similarity calculation method is introduced, and the comprehensive similarity S is: S = w_color_block . sim(V_color_block, V_color_block*) + w_body . sim(V_body, V_body*) + w_background . sim(V_background, V_background*) d. Final search results and color block interpretation: By comparing the comprehensive similarity S value, the image data in the database that best matches the input image is selected. Based on the detection index and state value of the matched color block vector V color block*, the corresponding urine test strip interpretation result is generated. Specifically: If the overall similarity S exceeds a certain threshold T, the match is considered successful, and the corresponding color block index and status are output as the detection result. By further analyzing the color values of the matched color blocks, the specific detection value is determined, and a detailed detection report is output. S4: A method for generating multiple bonds and constructing diverse image data, including the following construction methods: a. Multi-key generation mechanism: For each test strip image, multiple versions are generated based on enhancement processing of different dimensions such as lighting, angle, and background, so that the appearance of each image is diversified under different conditions; b. Automated data construction: By using automated data augmentation methods to generate multi-key data in batches, the amount of training data can be significantly expanded, solving the problem of data scarcity and improving the model training effect; S5: Optimization of the real-time performance and robustness of the automatic urine test strip recognition system, including the following optimization schemes: a. Highly efficient image processing and retrieval algorithm: Through the fast retrieval mechanism of the vector library and the multi-level similarity calculation method, real-time processing of urine test strip images is realized, ensuring that the system can respond quickly under different lighting, angle and background conditions; b. Strong anti-interference structural design: By simulating various background, lighting, angle and noise conditions, the system is ensured to have high robustness to environmental changes and noise interference in actual use, so that it can maintain detection accuracy in diverse scenarios; S6: Optimization of urine test strip reading accuracy under specific environmental conditions. The accuracy optimization scheme includes: a. Accurate color block identification based on color features: By using the color change patterns of different indicators in the color block library, accurate identification of color blocks on urine test strips can be achieved, avoiding errors in color block interpretation caused by changes in shooting conditions. b. Composite color block recognition under multi-index detection conditions: For composite color blocks with multiple detection indicators on the same test strip, multi-level color vector matching is used to achieve independent detection and result output for each indicator color block, ensuring the reliability of multi-index composite detection.
2. The test strip color patch reading measurement method based on photo database retrieval according to claim 1, characterized in that, The color patch library mentioned in step S1a is the core part of this database, containing color information of different indicator color patches on the urine test strip.
3. The test strip color patch reading measurement method based on photo database retrieval according to claim 1, characterized in that, The test strip body library mentioned in step S1b contains basic information on the shape, structure, and size of urine test strips, which is used to adapt to different brands and models of urine test strips, while enhancing the model's ability to recognize the test strip body.
4. The test strip color patch reading measurement method based on photo database retrieval according to claim 1, characterized in that, The background library mentioned in step S1c contains various background images that urine test strips may appear in, which is used to enhance the generalization ability of the model and ensure that the test strip information can still be accurately identified and read under different shooting environments and background materials.
5. The test strip color patch reading measurement method based on photo database retrieval according to claim 1, characterized in that, The vector library construction mentioned in step S1d involves processing the image data of each database into vectors after the color block library, test paper subject library, and background library have been constructed, and constructing the corresponding vector library for subsequent efficient retrieval.
6. The test strip color patch reading measurement method based on photo database retrieval according to claim 1, characterized in that, The illumination condition simulation mentioned in step S2a is used to simulate various real-world illumination scenarios to enhance image data, as different illumination conditions affect the color and brightness of the test strip image.
7. The test strip color patch reading measurement method based on photo database retrieval according to claim 1, characterized in that, The change in shooting angle mentioned in step S2b causes the test strip body in the image to be deformed or shifted. Different shooting angles are simulated to generate multi-view image data to ensure that the model can correctly identify the test strip body and color blocks from various angles.
8. The test strip color patch reading measurement method based on photo database retrieval according to claim 1, characterized in that, The color changes and background overlay color and contrast adjustments described in steps S2c and d can further increase data diversity while simulating different imaging devices and shooting environments.
9. The test strip color patch reading measurement method based on photo database retrieval according to claim 1, characterized in that, The noise and blurring process described in step S2e is to enhance the anti-interference ability of the test paper image by adding noise and blurring.
10. The test strip color patch reading measurement method based on photo database retrieval according to claim 1, characterized in that, The multi-bond data generation described in Process II involves generating multiple versions of test strip images from images processed by various enhancement methods. Each image generates a "multi-bond" under specific conditions, which is a combination of multiple images used to improve the model's generalization ability under different environmental conditions.