Color block detection method and equipment for urine test paper and storage medium

Through image enhancement processing and deep learning neural network model, the accuracy and consistency problems caused by the dependence of visual observation on traditional urine test strip readings are solved, and efficient and convenient detection is achieved in resource-limited environments.

CN119205679APending Publication Date: 2024-12-27SHENZHEN BIZVET BIO-TECH CO LTD
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202411288970.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-14
Publication Date
2024-12-27

AI Technical Summary

Technical Problem

The readings of traditional urine test strips mainly rely on visual observation and manual judgment, resulting in poor accuracy and consistency of results. Automatic detection equipment is usually large and expensive, and cannot be widely used in resource-limited environments.

Method used

Image enhancement processing and deep learning neural network model are used to automatically detect the color blocks of urine test strips. By acquiring the initial image, image separation and random enhancement, inputting it to the preset neural network model to output target marks and coordinate information, realizing color Accurate positioning and detection of block areas.

Benefits of technology

It significantly improves the accuracy and consistency of color block detection of urine test paper. It is suitable for mobile devices and portable instruments. The detection process is completed in milliseconds, providing an efficient and convenient detection solution.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119205679A_ABST
    Figure CN119205679A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of medical detection, in particular to a color block detection method and equipment for urine test paper and a storage medium. The method comprises the following steps: acquiring an initial image of to-be-detected urine test paper; performing image enhancement processing on the initial image to obtain a target image; the target image is input to a preset neural network model, so that the neural network model outputs a target mark of the target image and coordinate information of each color block area, and the target mark is composed of a mask of a main body area and masks of the color block areas in the target image; and according to the target mark and the coordinate information, sequentially outputting a color block mask corresponding to each color block area in the target mark and a center point coordinate of each color block area. According to the method, after the initial image is subjected to image enhancement processing, analysis processing is carried out through the neural network model, and the technical problems that in the prior art, the accuracy and consistency of results are poor due to the fact that the prior art mainly depends on visual observation and manual judgment, time is consumed and the prior art is prone to being influenced by subjective factors are solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the technical field of medical testing, and in particular to a method, device and storage medium for detecting color blocks of pet urine test strips. Background Art

[0002] In modern veterinary diagnosis, urine analysis is one of the important means to evaluate the health status of pets. Urine test strip test is a commonly used analysis method, which collects animal urine and reacts with urine test strips, and simultaneously observes the color change of the color block on the test strip to analyze the various components in urine (such as glucose, protein, pH value, etc.), and then diagnose various diseases.

[0003] The reading of traditional urine test strips mainly relies on visual observation and manual judgment, which is not only time-consuming but also easily affected by subjective factors, resulting in poor accuracy and consistency of the results. Specifically, for the manual color block method, the operator compares the color blocks on the urine test strip with the standard color chart by naked eye to determine the content of the components in the urine. When there are a large number of color blocks on the test strip, the operator needs to spend more time and energy to compare, which can easily lead to fatigue, thus affecting the accuracy of the results; for the automated detection of special instruments, these instruments usually use photoelectric sensors that match the position of the test strip color blocks to read the color of the color blocks, which is more accurate and efficient than manual color block checking. However, since these instruments are usually large, non-portable, and expensive, they cannot be widely used in simpler or resource-limited environments. Summary of the invention

[0004] One purpose of the embodiments of the present application is to provide a method, device and storage medium for detecting color blocks of urine test strips, so as to solve the technical problem that the related art mainly relies on visual observation and manual judgment to read urine test strips, resulting in poor accuracy and consistency of the results.

[0005] In a first aspect, an embodiment of the present application provides a method for detecting a color block of a urine test paper, comprising:

[0006] Acquire an initial image of a urine test strip to be tested, wherein the urine test strip to be tested comprises a main body portion and a plurality of color block detection portions;

[0007] Performing image enhancement processing on the initial image to obtain a target image, wherein the target image at least includes a main body area for indicating a main body part of the urine test paper to be tested, and a color block area for indicating a color block detection part of the urine test paper to be tested;

[0008] Input the target image into a preset neural network model so that the neural network model outputs a target mark of the target image and coordinate information of each color block area, wherein the target mark is composed of a mask of a main area and a mask of a color block area in the target image;

[0009] According to the target mark and the coordinate information, the color block mask corresponding to each color block area in the target mark and the center point coordinates of each color block area are output in sequence.

[0010] In combination with the first aspect, in a possible implementation, the image enhancement processing of the initial image includes: performing image separation processing on the initial image according to a preset image marking rule to divide the initial image into a background image, a main image and a color block detection image, the main image corresponding to the main part of the urine test paper to be tested, and the color block image corresponding to the color block detection part of the urine test paper to be tested; respectively determining each pixel in the background image, the main image and the color block image to randomly enhance the background image, the main image and the color block image respectively; adding the randomly enhanced background image, the main image and the color block detection image, and reassigning the pixels therein within a preset threshold range to obtain the target image.

[0011] In combination with the first aspect, in a possible implementation method, the respectively determining each pixel in the background image, the main image and the color block image to randomly enhance the background image, the main image and the color block image respectively includes: determining a target pixel whose pixel value is not 0 among the pixels of the color block image; updating the pixel value of the target pixel to the first pixel reference value according to a preset first pixel reference value; determining the pixel value of each pixel in the background image and the main image; and updating the pixel value of each pixel in the background image and the main image according to a preset second pixel reference value.

[0012] In combination with the first aspect, in a possible implementation, the preset neural network model includes an instance segmentation network and a color block positioning network, and the target image is input into the preset neural network model so that the neural network model outputs the target mark in the target image and the coordinate information corresponding to each color block area, including: inputting the target image into the instance segmentation network, and the instance segmentation network outputs the target mark in the target image according to the input target image; inputting the target image into the color block positioning network, and the color block positioning network is used to output the coordinate information corresponding to each color block area in the target image according to the input target image, and the coordinate information includes the category of each color block area, and the upper left corner coordinate and the lower right corner coordinate of each color block area.

[0013] In combination with the first aspect, in a possible implementation method, the color block mask corresponding to each color block area in the target mark and the coordinate information are output in sequence, including: according to the target mark, respectively determining the main body mask corresponding to the main body area in the target image and the color block mask corresponding to the color block area in the target image; removing the color block mask in the target mark to obtain the main body mask; processing the main body mask by a preset corrosion algorithm to determine the target mask; determining the center point coordinates of each color block area according to the coordinate information of each color block area; determining the target order according to the target mask and the center point coordinates of each color block area; according to the target order, outputting the color block mask corresponding to each color block area and the center point coordinates of each color block area in sequence.

[0014] In combination with the first aspect, in a possible implementation method, determining the target order according to the target mask and the center point coordinates of each color block area includes: determining the center point coordinates of the target mask; determining a distance set consisting of the distance between the center point of each color block area and the center point of the main mask according to the center point coordinates of the target mask and the center point coordinates of each color block area; and determining the target order based on the distance set according to the size of the distance between the center point of each color block area and the center point of the main mask.

[0015] In combination with the first aspect, in a possible implementation, the method also includes: training the initial network to obtain the neural network model, specifically including: creating a training data set, the training data set including multiple target images obtained through image enhancement processing; dividing the training data set into multiple small batches of data, and the small batches of data are input into the initial model for training; forward propagating through each layer of the initial model to generate a prediction result; calculating the loss between the prediction result and a preset true label through a preset loss function; if the loss does not meet a preset threshold, determining the gradient of the loss with respect to each parameter in the initial network through a back propagation algorithm to update the parameters of the initial network, and iterating the training until the loss meets the preset threshold.

[0016] In combination with the first aspect, in a possible implementation, the training function includes a VFL loss function, a CIOU loss function and a DFL loss function, the VFL loss function is used to deal with the category imbalance problem, the CIOU loss function is used to optimize the overlapping area of ​​the bounding box, and the DFL loss function is used to deal with difficult samples in classification tasks.

[0017] In a second aspect, an embodiment of the present application provides an electronic device, comprising a memory and a processor, wherein the memory is connected to the processor, and the processor is used to execute one or more computer programs stored in the memory. When the processor executes the one or more computer programs, the electronic device implements a method as described in any one of the above-mentioned first aspects.

[0018] In a third aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, wherein the computer program includes program instructions, and when the program instructions are executed by a processor, the processor executes any of the methods described above.

[0019] The embodiments of the present application can achieve the following technical effects:

[0020] Based on the method proposed in the embodiment of the present application, when performing color block detection on a urine test strip, an initial image of the urine test strip to be tested is first obtained, wherein the urine test strip to be tested includes a main body portion and multiple color block detection portions; then, image enhancement processing is performed on the initial image to obtain a target image, wherein the target image at least includes a main body area for indicating the main body portion in the urine test strip to be tested, and a color block area for indicating the color block detection portion in the urine test strip to be tested; and the target image is input into a preset neural network model so that the neural network model outputs a target mark of the target image, and coordinate information of each color block area, wherein the target mark is composed of a mask of the main body area and a mask of the color block area in the target image; finally, according to the target mark and the coordinate information, the color block mask corresponding to each color block area in the target mark and the center point coordinates of each color block area are output in sequence.

[0021] On the one hand, this method processes the initial image through image enhancement processing, which can better adapt to various possible shooting conditions in the veterinary environment, so that the neural network model can maintain high performance for images under various light and background conditions; on the other hand, the deep learning neural network model is used to automatically detect the color blocks of urine test strips, which significantly improves the accuracy and consistency of detection. The technical solution is suitable for mobile devices or portable instruments, and the entire detection process can be completed in milliseconds, providing an efficient and convenient detection solution in veterinary clinics and home environments. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments of the present application will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0023] Figure 1 A schematic diagram of a flow chart of a color block detection method for a urine test paper provided in an embodiment of the present application;

[0024] Figure 2 It is a structural schematic diagram of a color block detection device for a urine test paper provided in an embodiment of the present application;

[0025] Figure 3 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0026] In order to make the purpose, technical solutions and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not intended to limit the present application. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present application.

[0027] It should be noted that, if there is no conflict, the various features in the embodiments of the present application can be combined with each other, all within the scope of protection of the present application. In addition, although the functional module division is performed in the device schematic diagram and the logical order is shown in the flow chart, in some cases, the steps shown or described can be performed in a sequence different from the module division in the device or the flow chart. Furthermore, the words "first", "second", "third", etc. used in this application do not limit the data and execution order, but only distinguish the same items or similar items with basically the same functions and effects.

[0028] In the first place, see Figure 1 The present application provides a method for detecting color blocks of urine test paper, the method comprising:

[0029] Step S10, obtaining an initial image of a urine test strip to be tested, wherein the urine test strip to be tested comprises a main body portion and a plurality of color block detection portions;

[0030] It should be noted that the urine test paper to be tested in this embodiment refers to the test paper that has been in contact with pet urine, that is, the used test paper. The initial image of the test paper refers to the image obtained by photographing the test paper, and the image has not been further processed. For example, after using the urine test paper to detect pet urine, the user can take a picture of the test paper through various image acquisition devices, and upload it directly or indirectly to the terminal, and the terminal executes this method.

[0031] It is easy to understand that urine test strips usually include a test strip body and various detection color blocks distributed on the test strip body. Based on the understanding here, the initial image of the urine test strip to be tested should be divided into at least two parts: an image of the test strip body and an image of the detection color blocks distributed thereon. In addition, since users usually do not perform further processing after taking the image, the initial image should also include a background image, that is, an image that is not related to the urine test strip as a whole.

[0032] Step S20, performing image enhancement processing on the initial image to obtain a target image, wherein the target image at least includes a main body area for indicating the main body part of the urine test paper to be tested, and a color block area for indicating the color block detection part of the urine test paper to be tested;

[0033] It should be noted that, in this embodiment, performing image enhancement processing on the initial image means classifying pixels of each part of the initial image and then performing different random enhancements on the pixels of each part accordingly.

[0034] In this embodiment, the purpose of performing image enhancement processing on the initial image is to avoid specific situations affecting the detection accuracy by randomly enhancing various parts of the initial image.

[0035] As mentioned above, the initial image includes an image of the test strip body, an image of the detection color blocks distributed thereon, and a background image that is irrelevant to the urine test strip as a whole. Therefore, the image enhancement process is also classified according to the specific parts of the image.

[0036] Specifically, performing image enhancement processing on the initial image includes:

[0037] According to a preset image labeling rule, the initial image is subjected to image separation processing to divide the initial image into a background image, a main image and a color block image, wherein the main image corresponds to the main part of the urine test paper to be tested, and the color block image corresponds to the color block detection part of the urine test paper to be tested; each pixel in the background image, the main image and the color block image is determined respectively to randomly enhance the background image, the main image and the color block image respectively; the background image, the main image and the color block detection image after random enhancement are added, and the pixels therein within a preset threshold range are reassigned to obtain the target image.

[0038] In this embodiment, the preset image marking rule refers to a marking method set in advance by humans, and its purpose is to determine the color block mask (corresponding to the color block image) and the main body mask (corresponding to the main body image) through manual marking, and then separate the image into local image blocks corresponding to the mask area according to pixels, that is, the background image, the main body image and the color block image, and the color block image is located inside the main body image.

[0039] More specifically, the respectively determining each pixel in the background image, the main image and the color block image to respectively randomly enhance the background image, the main image and the color block image includes: determining a target pixel whose pixel value is not 0 among the pixels of the color block image; updating the pixel value of the target pixel to the first pixel reference value according to a preset first pixel reference value; determining the pixel value of each pixel in the background image and the main image; and updating the pixel value of each pixel in the background image and the main image according to a preset second pixel reference value.

[0040] Preferably, for the color block partial image, three random integers with values ​​between 0 and 255 are used to replace the non-zero pixels of the RGB three channels of the image to achieve the effect of randomly changing the color; for the background and test strip partial images, a random integer ranging from -100 to 100 is added to the RGB three channels. Finally, the color block, test strip, and background partial images that have been randomly enhanced are added together, and the pixels less than 0 or greater than 255 are reassigned to 0 or 255, and finally an enhanced test strip photo can be obtained.

[0041] Step S30, inputting the target image into a preset neural network model, so that the neural network model outputs a target mark of the target image and coordinate information of each color block area, wherein the target mark is composed of a mask of a main area and a mask of a color block area in the target image;

[0042] The preset neural network model can be created based on any deep learning network, such as a convolutional neural network, etc. Preferably, this embodiment uses YoloV8 as the framework of the preset neural network model.

[0043] Specifically, in this embodiment, the preset neural network model includes an instance segmentation network and a color block positioning network, and the target image is input into the preset neural network model so that the neural network model outputs the target mark in the target image and the coordinate information corresponding to each color block area, including:

[0044] The target image is input into the instance segmentation network, and the instance segmentation network outputs the target mark in the target image according to the input target image; the target image is input into the color block positioning network, and the color block positioning network is used to output the coordinate information corresponding to each color block area in the target image according to the input target image, and the coordinate information includes the category of each color block area, and the upper left corner coordinates and lower right corner coordinates of each color block area.

[0045] Among them, the instance segmentation network is used to output the masks corresponding to the test paper body and the color block area, that is, to remove the irrelevant background image from the target image and retain only the two parts related to the test paper. The color block positioning network is used to output the category and coordinate information of each color block area. The target mark refers to the calibration object in the target image (that is, the main mask corresponding to the test paper body and the color block mask corresponding to the color block area) after calibration in accordance with the preset rules.

[0046] Step S40 , according to the target mark and the coordinate information, sequentially outputting the color block mask corresponding to each color block area in the target mark and the center point coordinates of each color block area.

[0047] Specifically, according to the target mark and the coordinate information, the color block mask corresponding to each color block area in the target mark and the center point coordinates of each color block area are output in sequence, including: according to the target mark, respectively determining the main body mask corresponding to the main body area in the target image and the color block mask corresponding to the color block area in the target image; removing the color block mask in the target mark to obtain the main body mask; processing the main body mask by a preset corrosion algorithm to determine the target mask; according to the coordinate information of each color block area, determining the center point coordinates of each color block area; according to the target mask and the center point coordinates of each color block area, determining the target order; according to the target order, outputting the color block mask corresponding to each color block area and the center point coordinates of each color block area in sequence.

[0048] Furthermore, determining the target order according to the target mask and the center point coordinates of each color block area includes: determining the center point coordinates of the target mask; determining a distance set consisting of the distance between the center point of each color block area and the center point of the main mask according to the center point coordinates of the target mask and the center point coordinates of each color block area; and determining the target order based on the distance set according to the size of the distance between the center point of each color block area and the center point of the main mask.

[0049] In this embodiment, the main body mask is used as a reference for calculating the color block mask, that is, the color block areas are sorted by calculating the distance between the coordinates of the center point of each color block and the center point of the main body mask, thereby providing the position information of each color block on the test paper, and outputting the mask of each color block one by one in this order, that is, the information of each pixel in each color block is output in this order as the standard output of color block detection.

[0050] Furthermore, in the above embodiment, the process of training the initial network to obtain the neural network model specifically includes:

[0051] A training data set is created, wherein the training data set includes a plurality of target images obtained through image enhancement processing; the training data set is divided into a plurality of small batches of data, and the small batches of data are input into the initial model for training; forward propagation is performed through each layer of the initial model to generate a prediction result; the loss between the prediction result and a preset true label is calculated through a preset loss function; if the loss does not meet a preset threshold, the gradient of the loss with respect to each parameter in the initial network is determined through a back-propagation algorithm to update the parameters of the initial network, and the training is iterated until the loss meets the preset threshold.

[0052] Among them, the training function includes VFL (Varifocal Loss) loss function, CIOU (Complete Intersection over Union Loss) loss function and DFL (Distribution Focal Loss) loss function, the VFL loss function is used to deal with the category imbalance problem, the CIOU loss function is used to optimize the overlapping area of ​​the bounding box, and the DFL loss function is used to deal with difficult samples in classification tasks.

[0053] In combination with the above embodiments, the present embodiment provides reference formulas of various loss functions for reference:

[0054] VFL loss function: VFL = i∑(pi(1-yi)+(1-pi)yi), where pi is the predicted probability of the i-th sample and yi is the true label of the i-th sample.

[0055] CIOU loss function: CIOU = 1-IOU + ρ 2 (b,b gt ) / c 2 +αv, where IOU represents intersection-over-union, ρ represents the distance between the center points of the predicted box and the true box, c represents the diagonal length of the minimum bounding box of the two boxes, and α and v are weight coefficients and shape consistency metrics.

[0056] DFL loss function: DFL = -i∑(yi·log(pi)+(1-yi)log(1-pi)), where pi represents the predicted probability of the i-th sample and yi represents the true label of the i-th sample.

[0057] See also Figure 2 This embodiment provides a color block detection device 200 for a urine test paper, comprising:

[0058] The data acquisition module 210 is used to acquire an initial image of the urine test paper to be tested, wherein the urine test paper to be tested includes a main body portion and a plurality of color block detection portions;

[0059] A data processing module, used for performing image enhancement processing on the initial image to obtain a target image, wherein the target image at least includes a main body area for indicating the main body part of the urine test paper to be tested, and a color block area for indicating the color block detection part of the urine test paper to be tested;

[0060] A data analysis module, used for inputting the target image into a preset neural network model, so that the neural network model outputs a target mark of the target image and coordinate information of each color block area, wherein the target mark is composed of a mask of a main area and a mask of a color block area in the target image;

[0061] A data output module is used to sequentially output the color block mask corresponding to each color block area in the target mark and the center point coordinates of each color block area according to the target mark and the coordinate information.

[0062] It should be noted that the color block detection device for the urine test paper can execute the color block detection method for the urine test paper provided in the embodiment of the present application, and has the functional modules and beneficial effects corresponding to the execution method. For technical details not fully described in the embodiment of the color block detection device for the urine test paper, please refer to the color block detection method for the urine test paper provided in the embodiment of the present application.

[0063] See also Figure 3 , Figure 3 1 is a schematic diagram of the structure of an electronic device 300 provided in an embodiment of the present application, and the electronic device can perform the above-mentioned urine test strip color block detection method. The electronic device 300 includes one or more processors 31 and a memory 32. The memory 32 is connected to the one or more processors 31, for example, connected to the processor 31 via a bus.

[0064] The processor 31 is configured to support the electronic device 300 to perform the corresponding functions in the method in the above method embodiment. The processor 31 can be a central processing unit (CPU), a network processor (NP), a hardware chip or any combination thereof. The above hardware chip can be an application specific integrated circuit (ASIC), a programmable logic device (PLD) or a combination thereof. The above PLD can be a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL) or any combination thereof.

[0065] The memory 32 is used to store program codes, etc. The memory may include a volatile memory (VM), such as a random access memory (RAM); the memory may also include a non-volatile memory (NVM), such as a read-only memory (ROM), a flash memory, a hard disk drive (HDD) or a solid-state drive (SSD); the memory 32 may also include a combination of the above-mentioned types of memory.

[0066] The memory 32 can be used to store non-volatile software programs, non-volatile computer executable programs and modules, such as program instructions / modules corresponding to the color block detection method of the urine test paper in the embodiment of the present application. The processor 31 executes various functional applications and data processing of the color block detection method of the urine test paper and the color block detection device of the urine test paper by running the non-volatile software programs, instructions and modules stored in the memory 32, that is, realizes the functions of each module or unit of the color block detection method of the urine test paper and the color block detection device of the urine test paper provided in the above method embodiment.

[0067] The memory 32 may include a program storage area and a data storage area, wherein the program storage area may store an operating system and an application required for at least one function. The data storage area may store data created according to the use of the color block detection device of the urine test paper, etc. In some embodiments, the memory 32 may optionally include a memory remotely arranged relative to the processor 31, and these remote memories may be connected to the color block detection device of the urine test paper via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0068] One or more modules are stored in the memory 32. When executed by one or more processors 31, the color block detection method of the urine test paper in any of the above method embodiments is executed, for example, the method steps described in the above method embodiments are executed to realize the functions of the modules described in the above device embodiments.

[0069] An embodiment of the present application further provides a computer-readable storage medium, which stores a computer program. The computer program includes program instructions. When the program instructions are executed by a computer, the computer executes the method of the aforementioned embodiment.

[0070] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program, and the program can be stored in a computer-readable storage medium, and when the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, the storage medium can be a disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM), etc.

[0071] The above disclosure is only the preferred embodiment of the present application, which certainly cannot be used to limit the scope of rights of the present application. Therefore, equivalent changes made according to the claims of the present application are still within the scope covered by the present application.

Claims

1. A method for detecting color blocks of urine test paper, characterized in that: The method comprises: Acquire an initial image of a urine test strip to be tested, wherein the urine test strip to be tested comprises a main body portion and a plurality of color block detection portions; Performing image enhancement processing on the initial image to obtain a target image, wherein the target image at least includes a main body area for indicating a main body part of the urine test paper to be tested, and a color block area for indicating a color block detection part of the urine test paper to be tested; Input the target image into a preset neural network model so that the neural network model outputs a target mark of the target image and coordinate information of each color block area, wherein the target mark is composed of a mask of a main area and a mask of a color block area in the target image; According to the target mark and the coordinate information, the color block mask corresponding to each color block area in the target mark and the center point coordinates of each color block area are output in sequence.

2. The method according to claim 1, characterized in that The performing image enhancement processing on the initial image comprises: According to a preset image marking rule, the initial image is subjected to image separation processing to divide the initial image into a background image, a main image and a color block detection image, wherein the main image corresponds to the main body of the urine test paper to be tested, and the color block image corresponds to the color block detection part of the urine test paper to be tested; Determine pixels in the background image, the main image, and the color block image respectively, so as to randomly enhance the background image, the main image, and the color block image respectively; The randomly enhanced background image, main image and color block detection image are added together, and the pixels within the preset threshold range are reassigned to obtain the target image.

3. The method according to claim 2, characterized in that The respectively determining each pixel in the background image, the main image and the color block image to randomly enhance the background image, the main image and the color block image respectively includes: Determine a target pixel whose pixel value is not 0 among the pixels of the color block image; According to a preset first pixel reference value, updating the pixel value of the target pixel to the first pixel reference value; Determine the pixel value of each pixel in the background image and the main image; According to the preset second pixel reference value, the pixel value of each pixel in the background image and the main image is updated.

4. The method according to claim 1, characterized in that: The preset neural network model includes an instance segmentation network and a color block positioning network, and the target image is input into the preset neural network model so that the neural network model outputs the target mark in the target image and the coordinate information corresponding to each color block area, including: Inputting the target image into the instance segmentation network, the instance segmentation network outputting the target mark in the target image according to the input target image; The target image is input into the color block positioning network, and the color block positioning network is used to output coordinate information corresponding to each color block area in the target image according to the input target image, and the coordinate information includes the category of each color block area, and the upper left corner coordinates and lower right corner coordinates of each color block area.

5. The method according to claim 1, characterized in that The step of sequentially outputting the color block mask corresponding to each color block area in the target mark and the center point coordinates of each color block area according to the target mark and the coordinate information includes: According to the target mark, respectively determining a subject mask corresponding to a subject area in the target image and a color block mask corresponding to a color block area in the target image; Removing the color block mask from the target mark to obtain the main body mask; Processing the subject mask by a preset corrosion algorithm to determine a target mask; Determine the coordinates of the center point of each color block area according to the coordinate information of each color block area; Determine the target order according to the target mask and the coordinates of the center point of each color block area; According to the target order, the color block mask corresponding to each color block area and the center point coordinates of each color block area are output in sequence.

6. The method according to claim 5, characterized in that The step of determining the target order according to the target mask and the coordinates of the center point of each color block area includes: Determining the center point coordinates of the target mask; Determine, according to the coordinates of the center point of the target mask and the coordinates of the center point of each color block area, a distance set consisting of the distance between the center point of each color block area and the center point of the subject mask; Based on the distance set, the target order is determined according to the distance between the center point of each color block area and the center point of the main body mask.

7. The method according to claim 1, characterized in that The method further comprises: The initial network is trained to obtain the neural network model, which specifically includes: Creating a training data set, wherein the training data set includes a plurality of target images obtained through image enhancement processing; Dividing the training data set into a plurality of small batches of data, and inputting the small batches of data into the initial model for training; Perform forward propagation through each layer of the initial model to generate a prediction result; Calculate the loss between the prediction result and the preset true label by using a preset loss function; If the loss does not meet the preset threshold, the gradient of the loss to each parameter in the initial network is determined by a back propagation algorithm to update the parameters of the initial network, and the training is iterated until the loss meets the preset threshold.

8. The method according to claim 7, characterized in that The training function includes a VFL loss function, a CIOU loss function and a DFL loss function. The VFL loss function is used to deal with the category imbalance problem, the CIOU loss function is used to optimize the overlapping area of ​​the bounding box, and the DFL loss function is used to deal with difficult samples in the classification task.

9. An electronic device, characterized in that: The electronic device comprises a memory and a processor, wherein the memory is connected to the processor, and the processor is used to execute one or more computer programs stored in the memory, and when the processor executes the one or more computer programs, the electronic device implements the method according to any one of claims 1 to 8.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer program includes program instructions, and when the program instructions are executed by a processor, the processor is caused to perform the method according to any one of claims 1 to 8.

Citation Information

Cited By

  • Method and device for evaluating consistency of urine protein indexes

    CN119132421A

  • A method and device for evaluating consistency of urine protein index

    CN119132421B