Ovulation test paper recognition method and device, electronic equipment and storage medium
By performing key point detection and perspective transformation on the ovulation test strip image, candidate test strip areas are determined and identified based on the clarity score, the problem of reducing recognition accuracy caused by changes in shooting angle is solved, and the accuracy and universality of ovulation test strip recognition is improved. .
Patent Information
- Application Number
- CN202411095866.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-12
- Publication Date
- 2024-12-27
AI Technical Summary
Different shooting angles will cause changes in the relative position of the detection line and the control line in the ovulation test strip image, reducing the accuracy of ovulation test strip recognition.
The ovulation test strip image is detected through the preset target key point detection model, the vertex of the test strip area is positioned and perspective transformed, the candidate test strip area is determined, and the ovulation test strip is identified based on the clarity score.
It improves the accuracy and versatility of ovulation test strip recognition, can cope with shooting at any angle, eliminates the impact of shooting angle on recognition, and improves image quality.
Smart Images

Figure CN119206164A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image recognition technology, and in particular to an ovulation test paper recognition method and device, an electronic device and a storage medium. Background Art
[0002] With the development of computer image processing technology and the widespread application of intelligent devices, image processing technology has been applied to the recognition of ovulation test strips. By identifying ovulation test strips, the intensity level of luteinizing hormone (LH) in urine can be detected to determine the ovulation period and menstrual cycle. However, different shooting angles will change the relative position of the detection line (T line) and the control line (C line) in the ovulation test strip image, resulting in a decrease in the accuracy of ovulation test strip recognition. Summary of the invention
[0003] The main purpose of the embodiments of the present application is to propose an ovulation test paper identification method and device, an electronic device and a storage medium, aiming to improve the accuracy of ovulation test paper identification.
[0004] To achieve the above-mentioned purpose, a first aspect of an embodiment of the present application proposes an ovulation test paper identification method, the method comprising:
[0005] Acquire the target ovulation test strip image;
[0006] Key point detection is performed on the target ovulation test paper image by using a preset target key point detection model to obtain the vertices of the test paper area and the vertex position relationship of the vertices of the test paper area; the vertex position relationship is used to characterize the position relationship of the vertices of the test paper area in the target ovulation test paper image in the target placement direction;
[0007] Performing perspective transformation on the vertices of the test paper area according to the vertex position relationship to obtain the vertices of the target area;
[0008] Determine a candidate test strip area according to the target area vertices and the target ovulation test strip image;
[0009] Obtaining a clarity score of the candidate test paper area;
[0010] The candidate test strip area is identified by ovulation test strip identification according to the clarity score.
[0011] In some embodiments, the key point detection of the target ovulation test paper image is performed using a preset target key point detection model to obtain the vertices of the test paper area and the vertex position relationship of the vertices of the test paper area, including:
[0012] Perform key point detection on the target ovulation test paper image by using the target key point detection model to obtain the key points of the test paper and the initial position relationship of the key points of the test paper;
[0013] Connecting the key points of the test paper according to the initial position relationship to obtain a detection area; the detection area includes a first side and a second side; the length of the first side is greater than the length of the second side;
[0014] Screening the key points of the test paper according to the first side and the second side to obtain the vertices of the test paper area;
[0015] The initial position relationship of the vertices of the test paper area is used as the vertex position relationship.
[0016] In some embodiments, the key point detection of the target ovulation test paper image is performed by the target key point detection model to obtain the key points of the test paper and the initial position relationship of the key points of the test paper, including:
[0017] Performing preliminary feature extraction on the target ovulation test paper image to obtain test paper image features;
[0018] Performing multi-scale feature extraction on the test paper image feature to obtain a first test paper feature, a second test paper feature, and a third test paper feature; wherein the feature scales of the first test paper feature, the second test paper feature, and the third test paper feature are increased in sequence;
[0019] Perform heat map prediction according to the first test paper feature, the second test paper feature and the third test paper feature to obtain a target test paper heat map;
[0020] Key point detection is performed on the target test paper heat map to obtain the relationship between the test paper key points and the initial position.
[0021] In some embodiments, screening the key points of the test paper according to the first side and the second side to obtain the vertices of the test paper area includes:
[0022] If the length of the first side is greater than a first preset length threshold, and the length of the second side is greater than a second preset length threshold, obtaining a first length deviation between the first sides and a second length deviation between the second sides;
[0023] The key points of the test paper are screened according to the first length deviation and the second length deviation to obtain the vertices of the test paper area.
[0024] In some embodiments, screening the key points of the test paper according to the first length deviation and the second length deviation to obtain the vertices of the test paper area includes:
[0025] If the first length deviation is less than or equal to a first preset deviation threshold, and the second length deviation is less than or equal to a second preset deviation threshold, calculating the aspect ratio according to the first side and the second side;
[0026] Acquire the edge spatial position relationship between the first edges according to the aspect ratio;
[0027] The key points of the test paper are screened according to the edge spatial position relationship to obtain the vertices of the test paper area.
[0028] In some embodiments, the target key point detection model is trained according to the following steps:
[0029] Obtaining a sample test paper image and a test paper area position label of the sample test paper image;
[0030] Perform key point detection on the sample test paper image by using a preset key point detection model to obtain a pre-test paper area and a pre-test paper heat map;
[0031] Calculate the loss according to the test paper area position label, the pre-test paper area and the pre-test paper heat map to obtain a target loss;
[0032] The model parameters of the preset key point detection model are adjusted according to the target loss to obtain the target key point detection model.
[0033] In some embodiments, obtaining the clarity score of the candidate test paper region includes:
[0034] Extracting edge features of the candidate test paper area to obtain an edge feature map;
[0035] The clarity score is obtained according to the edge feature map.
[0036] To achieve the above-mentioned purpose, a second aspect of an embodiment of the present application provides an ovulation test paper identification device, the device comprising:
[0037] A first acquisition module is used to acquire a target ovulation test paper image;
[0038] A key point detection module is used to perform key point detection on the target ovulation test paper image through a preset target key point detection model to obtain the vertices of the test paper area and the vertex position relationship of the vertices of the test paper area; the vertex position relationship is used to characterize the position relationship of the vertices of the test paper area in the target ovulation test paper image in the target placement direction;
[0039] A perspective transformation module, used for performing perspective transformation on the vertices of the test paper area according to the vertex position relationship to obtain the vertices of the target area;
[0040] A determination module, used to determine a candidate test paper area according to the target area vertices and the target ovulation test paper image;
[0041] A second acquisition module, used to obtain the clarity score of the candidate test paper area;
[0042] The ovulation test paper identification module is used to identify the ovulation test paper of the candidate test paper area according to the clarity score.
[0043] To achieve the above-mentioned purpose, the third aspect of an embodiment of the present application proposes an electronic device, the electronic device comprising a memory and a processor, the memory storing a computer program, and the processor implementing the ovulation test paper identification method of the first aspect mentioned above when executing the computer program.
[0044] To achieve the above-mentioned purpose, the fourth aspect of the embodiments of the present application proposes a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the ovulation test paper identification method of the first aspect is implemented.
[0045] The ovulation test paper identification method, ovulation test paper identification device, electronic device and computer-readable storage medium proposed in the present application, by obtaining the target ovulation test paper image, to perform image recognition on the target ovulation test paper image, and determine the intensity level of LH. The detection line and control line positions of different brands of ovulation test paper are different. In order to improve the efficiency and accuracy of ovulation test paper recognition, the target ovulation test paper image is detected by a preset target key point detection model to locate the test paper area containing the detection line and the control line in the target ovulation test paper image, and obtain the vertex position relationship of the test paper area vertex and the test paper area vertex. According to the vertex position relationship, the test paper area vertex is transformed in perspective, and the test paper area vertex can be converted to the standard placement position to obtain the target area vertex, which ensures the relative fixation of the detection line and the control line position. While realizing complex background filtering, it can also cope with shooting at any angle, eliminating the influence of the shooting angle on the test paper recognition. According to the target area vertex and the target ovulation test paper image, the candidate test paper area is determined, and redundant background information can be removed, which improves the versatility of ovulation test paper recognition. Obtain clarity scores of candidate test strip regions, perform ovulation test strip recognition on candidate test strip regions based on the clarity scores, and utilize the clarity scores to obtain high-quality ovulation test strip images, thereby improving the accuracy of ovulation test strip recognition. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] Figure 1 is a flow chart of the ovulation test paper identification method provided in an embodiment of the present application;
[0047] Figure 2 yes Figure 1 Flow chart of step S120 in FIG.
[0048] Figure 3 yes Figure 2 Flow chart of step S210 in FIG.
[0049] Figure 4 yes Figure 2 Flow chart of step S230 in FIG.
[0050] Figure 5 yes Figure 4 Flow chart of step S420 in FIG.
[0051] Figure 6 is a flow chart of the training process of the target key point detection model provided in the embodiment of the present application;
[0052] Figure 7 yes Figure 1 Flow chart of step S150 in FIG.
[0053] Figure 8 It is a structural schematic diagram of an ovulation test paper identification device provided in an embodiment of the present application;
[0054] Fig. 9 It is a schematic diagram of the hardware structure of the electronic device provided in the embodiment of the present application. DETAILED DESCRIPTION
[0055] In order to make the purpose, technical solution 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 used to limit the present application.
[0056] It should be noted that, although the functional modules are divided in the device schematic diagram and the logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than the module division in the device or the order in the flowchart. The terms "first", "second", etc. in the specification, claims and the above drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.
[0057] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.
[0058] With the development of computer image processing technology and the widespread application of smart devices, image processing technology has been applied to the recognition of ovulation test strips. By identifying ovulation test strips, the intensity level of luteinizing hormone in urine can be detected to determine the ovulation period and menstrual cycle. However, different shooting angles will cause the relative position of the detection line (T line) and the control line (C line) in the ovulation test strip image to change, resulting in a decrease in the accuracy of ovulation test strip recognition.
[0059] Based on this, the embodiments of the present application provide an ovulation test paper identification method, an ovulation test paper identification device, an electronic device and a computer-readable storage medium, aiming to improve the accuracy of ovulation test paper identification.
[0060] The ovulation test paper identification method, ovulation test paper identification device, electronic device and computer-readable storage medium provided in the embodiments of the present application are specifically illustrated by the following embodiments. First, the ovulation test paper identification method in the embodiments of the present application is described.
[0061] The ovulation test strip recognition method provided in the embodiment of the present application relates to the field of image recognition technology. The ovulation test strip recognition method provided in the embodiment of the present application can be applied to a terminal, can also be applied to a server side, and can also be software running in a terminal or a server side. In some embodiments, the terminal can be a smart phone, a tablet computer, a laptop computer, a desktop computer, etc.; the server side can be configured as an independent physical server, or a server cluster or a distributed system composed of multiple physical servers, and can also be configured to provide cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms and other basic cloud computing services. Cloud servers; software can be applications that implement ovulation test strip recognition methods, etc., but are not limited to the above forms.
[0062] The present application can be used in many general or special computer system environments or configurations. For example: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, etc. The present application can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The present application can also be practiced in distributed computing environments, in which tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media including storage devices.
[0063] Figure 1 This is an optional flow chart of an ovulation test strip identification method provided in an embodiment of the present application. Figure 1 The method may include but is not limited to steps S110 to S160.
[0064] Step S110, obtaining a target ovulation test paper image;
[0065] Step S120, performing key point detection on the target ovulation test paper image by using a preset target key point detection model to obtain the vertices of the test paper area and the vertex position relationship of the vertices of the test paper area; the vertex position relationship is used to characterize the position relationship of the vertices of the test paper area in the target ovulation test paper image in the target placement direction;
[0066] Step S130, performing perspective transformation on the vertices of the test paper area according to the vertex position relationship to obtain the vertices of the target area;
[0067] Step S140, determining a candidate test strip area according to the target area vertices and the target ovulation test strip image;
[0068] Step S150, obtaining the clarity score of the candidate test paper area;
[0069] Step S160, identifying the ovulation test strips on the candidate test strip areas according to the clarity scores.
[0070] In step S110 of some embodiments, the target ovulation test paper image is the ovulation test paper image to be identified by the ovulation test paper, which can be obtained by photographing the terminal device. Specifically, the camera of the terminal device is turned on, and the ovulation test paper image to be detected is acquired in real time to obtain the target ovulation test paper image. The ovulation test paper usually includes a test line, a control line and a max line, and the distance between the test line and the max line is closer, and the distance between the control line and the max line is farther. By comparing the colors of the test line and the control line, the intensity level of luteinizing hormone in urine can be obtained, and then the ovulation period and the safe period of the menstrual cycle can be determined. Therefore, the test line and the control line play a very important role in the test results of the ovulation test paper.
[0071] See also Figure 2 In some embodiments, step S120 may include but is not limited to steps S210 to S240:
[0072] Step S210, performing key point detection on the target ovulation test paper image by using a target key point detection model to obtain the key points of the test paper and the initial position relationship of the key points of the test paper;
[0073] Step S220, connecting the key points of the test paper according to the initial position relationship to obtain a detection area; the detection area includes a first side and a second side; the length of the first side is greater than the length of the second side;
[0074] Step S230, screening the key points of the test paper according to the first side and the second side to obtain the vertices of the test paper area;
[0075] Step S240: taking the initial position relationship of the vertices in the test paper area as the vertex position relationship.
[0076] In step S210 of some embodiments, the target key point detection model is a pre-trained key point detection model (Differentiable Spatial to Numerical Transform, DSNT), which can be used to identify and locate the key points of the test paper target area such as the detection line and the control line. In order to extract the test paper target area in the target ovulation test paper image, the target ovulation test paper image is subjected to key point detection by a preset target key point detection model, and the coordinate information of the four test paper key points and the initial position relationship of each test paper key point are obtained. The test paper key points are the vertices of the test paper target area, and the test paper target area is the area containing the detection line and the control line. The initial position relationship is used to characterize the positional relationship of the test paper key points when the target ovulation test paper image is in the target placement direction, and can reflect the vertex relationship between the test paper key points and the standard placement test paper. The target placement direction is the forward placement direction, and the target ovulation test paper image is located at the standard placement position. The forward placement direction can be that the max line is placed horizontally to the left. Assume that in the standard placement scenario, the upper left vertex of the target area of the test strip in the target ovulation test strip image is a, the upper right vertex is b, the lower left vertex is c, and the lower right vertex is d. If the key point of the test strip is the upper left vertex in the standard placement scenario, the initial position relationship characterization of the position relationship of the key point of the test strip is that the key point of the test strip is the upper left vertex, and the key points of the test strip in other positions are the same, which will not be repeated here.
[0077] In step S220 of some embodiments, among the four test paper key points, the test paper key point whose initial position relationship characterizes the test paper key point as the upper left corner vertex a is connected with the test paper key point whose initial position relationship characterizes the test paper key point as the upper right corner vertex b, the test paper key point whose initial position relationship characterizes the test paper key point as the lower left corner vertex c is connected with the test paper key point whose initial position relationship characterizes the test paper key point as the lower right corner vertex d, the test paper key point whose initial position relationship characterizes the test paper key point as the upper left corner vertex a is connected with the test paper key point whose initial position relationship characterizes the test paper key point as the lower left corner vertex c, the test paper key point whose initial position relationship characterizes the test paper key point as the upper right corner vertex b is connected with the test paper key point whose initial position relationship characterizes the test paper key point as the lower right corner vertex d, to obtain the detection area. The detection area includes two first sides and two second sides, the length of the first side is greater than the length of the second side, the first side (width) is a line segment formed by connecting the upper left vertex a and the upper right vertex b, and a line segment formed by connecting the lower left vertex c and the lower right vertex d, and the second side (height) is a line segment formed by connecting the upper left vertex a and the lower left vertex c, and a line segment formed by connecting the upper right vertex b and the lower right vertex d.
[0078] In step S230 of some embodiments, due to the characteristics of the key point detection algorithm, even if the target ovulation test paper image does not have a test paper target, the target key point detection model will generate a test paper key point, so it is necessary to further judge the test paper key point. According to the first side and the second side, it is judged whether the test paper key point is the vertex of the test paper target area. If the test paper key point is the vertex of the test paper target area, the test paper key point is used as the test paper area vertex. If the test paper key point is not the vertex of the test paper target area, the image to be detected is reacquired to obtain the target ovulation test paper image.
[0079] Referring to step S220, the coordinates of the vertices of the test paper area are used to render and draw the test paper frame in real time on the shooting page, and the detected coordinates are fed back to the user in a visual form in real time, so that the user can adjust the shooting distance in real time according to the detection results, thereby further improving the effect of model key point detection.
[0080] In step S240 of some embodiments, if the key point of the test paper is a vertex of the target area of the test paper, the key point of the test paper is used as the vertex of the test paper area, and the initial position relationship of the key point of the test paper is used as the vertex position relationship.
[0081] Through the above steps S210 to S240, the target ovulation test paper image can be positioned to the test paper target area, thereby avoiding the interference of redundant background information on the ovulation test paper recognition result, improving the recognition accuracy, and filtering out key points generated by non-test paper targets.
[0082] See also Figure 3In some embodiments, step S210 may include but is not limited to steps S310 to S340:
[0083] Step S310, performing preliminary feature extraction on the target ovulation test paper image to obtain test paper image features;
[0084] Step S320, performing multi-scale feature extraction on the test paper image feature to obtain a first test paper feature, a second test paper feature, and a third test paper feature; the feature scales of the first test paper feature, the second test paper feature, and the third test paper feature are increased in sequence;
[0085] Step S330, performing heat map prediction according to the first test paper feature, the second test paper feature and the third test paper feature to obtain a target test paper heat map;
[0086] Step S340, performing key point detection on the target test paper heat map to obtain the key points of the test paper and the initial position relationship.
[0087] In step S310 of some embodiments, the target key point detection model includes a backbone network, a feature pyramid network (FPN), a single stage headless (SSH) module and a key point detection module. The backbone network adopts a MobileNetV2 network, and the MobileNetV2 network is used to extract features of the target ovulation test paper image to obtain test paper image features. The test paper image features are shallow image features of the target ovulation test paper image, which can be color features, texture features, shape features, spatial features, etc. of the image.
[0088] In step S320 of some embodiments, the feature pyramid network includes three parts: a bottom-up path, a top-down path, and a lateral connection. The bottom-up path uses the MobileNetV2 network. During the forward propagation process, each layer of the MobileNetV2 network can output feature maps of different sizes. The feature map output by the shallow layer of the MobileNetV2 network is large, with less semantic information, but with higher resolution information, which can help accurately detect the target position. The deeper the number of layers, the smaller the output feature map, and the richer the image semantic information it contains, which can help roughly detect the target position. The multi-scale detection capability of the FPN enhancement model is utilized, and the multi-scale feature extraction of the test paper image features is performed through the MobileNetV2 network to obtain the first feature map, the second feature map, and the third feature map to meet the detection requirements of targets of different scales. The first feature map, the second feature map, and the third feature map are feature maps output by network layers of different depths. The network layer depth increases successively, and the feature map sizes of the first feature map, the second feature map, and the third feature map decrease successively. The first feature map is a feature map of size 28*28, the second feature map is a feature map of size 14*14, and the third feature map is a feature map of size 7*7. The first feature map, the second feature map, and the third feature map are feature maps output from the bottom-up path.
[0089] Based on the top-down path, the third feature map can be upsampled by interpolation algorithms such as nearest neighbor interpolation, bilinear interpolation, bicubic interpolation, etc., and the feature map of 7*7 size can be upsampled to 14*14 to obtain the fourth feature map. The second feature map is upsampled, and the feature map of 14*14 size can be upsampled to 28*28 to obtain the fifth feature map. The fourth and fifth feature maps are sampled feature maps output by the top-down path.
[0090] The third feature map of 7*7 size is used as the first test paper feature, and the first test paper feature is used to detect large-scale targets. Based on lateral connection, the second feature map and the fourth feature map are feature fused, that is, feature addition is performed to obtain the second test paper feature of 14*14 size, and the second test paper feature is used to detect medium-scale targets. The first feature map and the fifth feature map are feature fused to obtain the third test paper feature of 28*28 size, and the third test paper feature is used to detect small-scale targets. The feature scales of the first test paper feature, the second test paper feature, and the third test paper feature increase in sequence. Based on lateral connection, feature fusion of feature maps of the same size can realize the transmission and fusion of deep semantic information to the shallow layer, so that the DSNT model has multi-scale detection capabilities, thereby improving the overall target detection effect.
[0091] In step S330 of some embodiments, the SSH module is composed of three parallel structures, namely, structure one, structure two and structure three. Through structure one, a 3*3 convolution operation is performed on the first test paper feature to obtain a first test paper heat map. Through structure two, a 3*3 convolution operation is performed twice on the second test paper feature to obtain a second test paper heat map. Through structure three, a 3*3 convolution operation is performed three times on the third test paper feature to obtain a third test paper heat map. Feature fusion is performed on the first test paper heat map, the second test paper heat map and the third test paper heat map to obtain a target test paper heat map. The more convolution operations, the larger the receptive field. The SSH module stacks feature maps of different receptive fields through three different parallel structures, thereby realizing the fusion of contextual information to enhance the detection accuracy of the DSNT model.
[0092] In step S340 of some embodiments, the target test paper heat map is input into a key point detection module for key point detection to obtain the test paper key points and the initial position relationship.
[0093] Through the above steps S310 to S340, the target key point detection model can have multi-scale detection capabilities, thereby improving the positioning accuracy of the target area of the test paper.
[0094] See also Figure 4 In some embodiments, step S230 may include but is not limited to steps S410 to S420:
[0095] Step S410, if the length of the first side is greater than a first preset length threshold, and the length of the second side is greater than a second preset length threshold, obtaining a first length deviation between the first sides and a second length deviation between the second sides;
[0096] Step S420, screening the key points of the test paper according to the first length deviation and the second length deviation to obtain the vertices of the test paper area.
[0097] In step S410 of some embodiments, in order to filter out key points generated by non-test paper targets, it is determined whether the two first sides and the two second sides are greater than a specified threshold. If the length of any one of the two first sides is less than or equal to the first preset length threshold, or the length of any one of the two second sides is less than or equal to the second preset length threshold, it means that the test paper key point is a vertex of the non-test paper target area, and the coordinates of the test paper key point are non-test paper coordinates, and it is necessary to re-detect the key point or re-acquire the image to be detected in real time. The first preset length threshold and the second preset length threshold are the length limit of the specified first side and the length limit of the second side, respectively.
[0098] Even for test strips of different brands, the deviations between the height and width of the target area of the test strips will be within a certain range. If the lengths of the two first sides are both greater than the first preset length threshold, and the lengths of the two second sides are both greater than the second preset length threshold, indicating that the width and height meet the specified rules, then the first length deviation between the two first sides and the second length deviation between the two second sides are obtained. The first length deviation is the absolute value of the difference between the lengths of the two first sides, and the second length deviation is the absolute value of the difference between the lengths of the two second sides.
[0099] In step S420 of some embodiments, it is determined whether the key point of the test paper is the vertex of the test paper target area according to the first length deviation and the second length deviation to obtain the vertex of the test paper area.
[0100] Through the above steps S410 to S420, the key points of the test paper can be further screened to locate the accurate target area of the test paper.
[0101] See also Figure 5 In some embodiments, step S420 may include but is not limited to steps S510 to S530:
[0102] Step S510, if the first length deviation is less than or equal to the first preset deviation threshold, and the second length deviation is less than or equal to the second preset deviation threshold, calculating the aspect ratio according to the first side and the second side;
[0103] Step S520, obtaining the edge spatial position relationship between the first edges according to the aspect ratio;
[0104] Step S530, screening the key points of the test paper according to the edge space position relationship to obtain the vertices of the test paper area.
[0105] In step S510 of some embodiments, the first preset deviation threshold value and the second preset deviation threshold value are respectively the limit of the length difference between the specified first sides and the limit of the length difference between the second sides. If the first length deviation is greater than the first preset deviation threshold value, or the second length deviation is greater than the second preset deviation threshold value, it is indicated that the coordinates of the key points of the test paper are non-test paper coordinates, and it is necessary to use the camera to re-collect the image to be detected in real time. Even if it is an ovulation test paper of different brands, its aspect ratio will be within a certain interval. If the first length deviation is less than or equal to the first preset deviation threshold value, and the second length deviation is less than or equal to the second preset deviation threshold value, it is indicated that the length deviation between the first sides and the length deviation between the second sides meet the specified rules, then the two first sides and the two second sides are divided into two groups, each group including a first side and a second side. According to the length of the first side of each group and the length of the second side of each group, the aspect ratio of each group is calculated, and the aspect ratio is the ratio of the length of the first side to the length of the second side.
[0106] In step S520 of some embodiments, the target key point detection model cannot guarantee 100% key point detection accuracy, and the vertex relationship of the corresponding standard placement test paper obtained may be disordered, causing the two first edges to intersect, thereby affecting the effect of using the relationship for perspective transformation. For example, the coordinates of the four test paper key points are (x1, y1), (x2, y2), (x3, y3), and (x4, y4), and their correct vertex relationships are a, b, c, and d. The target key point detection model may mistakenly identify the test paper key point corresponding to (x2, y2) as vertex d, and mistakenly identify the test paper key point corresponding to (x4, y4) as vertex b. The line segment formed by vertex a and vertex b, and the line segment formed by vertex c and vertex d are all first edges, and the two first edges will intersect. If both sets of aspect ratios are within the specified interval, the edge space position relationship between the first edges is obtained, and the edge space position relationship is used to determine whether there is a line segment intersection between the two first edges. The edge spatial position relationship is used to characterize the intersection state between the two first edges, which can indicate that the two first edges intersect or do not intersect. If at least one of the two sets of aspect ratios is not within the specified interval, it means that the coordinates of the key points of the test paper are non-test paper coordinates, and the image to be tested needs to be re-captured in real time.
[0107] The edge spatial position relationship can be obtained according to the following steps: the two first edges are line segments ab and cd, and line segments ab and cd are cross-multiplied, and line segments cd and ab are cross-multiplied. If the two cross product results are both less than 0, the edge spatial position relationship is determined to be that the two first edges intersect. If one of the two cross product results is greater than or equal to 0, the edge spatial position relationship is determined to be that the two first edges do not intersect.
[0108] The cross product of line segment ab and line segment cd is expressed as xmult(ab,cd), and the cross product of line segment cd and line segment ab is expressed as xmult(cd,ab). xmult(ab,cd) is expressed as:
[0109]
[0110] in, is the edge vector of the first edge, which can be obtained based on the coordinates of vertex a and vertex b; is the edge vector of the second edge, which can be obtained based on the coordinates of vertex a and vertex c; is the edge vector of line segment ad, which can be obtained based on the coordinates of vertex a and vertex d.
[0111] xmult(cd,ab) is expressed as:
[0112]
[0113] in, is the edge vector of the first edge, which can be obtained based on the coordinates of vertex c and vertex d; is the edge vector of the second edge, which can be obtained based on the coordinates of vertex c and vertex a; is the edge vector of line segment cb, which can be obtained based on the coordinates of vertex c and vertex b.
[0114] In step S530 of some embodiments, if the edge spatial position relationship indicates that the two first edges intersect, it means that there is confusion in the vertex relationship, and the coordinates of the key points of the test paper should not be used as the test paper coordinates, and the key point detection needs to be re-performed. If the edge spatial position relationship indicates that the two first edges do not intersect, the four key points of the test paper are used as the four vertices of the test paper area.
[0115] Through the above steps S510 to S530, it is possible to determine whether the detected key point of the test paper is the vertex of the test paper target area, filter out non-test paper targets, and automatically extract the test paper target area, thereby further improving the effect of key point detection.
[0116] See also Figure 6 In some embodiments, the training process of the target key point detection model may include but is not limited to steps S610 to S640:
[0117] Step S610, obtaining a sample test paper image and a test paper area position label of the sample test paper image;
[0118] Step S620, performing key point detection on the sample test paper image by using a preset key point detection model to obtain a pre-test paper area and a pre-test paper heat map;
[0119] Step S630, calculating the loss according to the test paper area position label, the pre-test paper area and the pre-test paper heat map to obtain the target loss;
[0120] Step S640, adjusting the model parameters of the preset key point detection model according to the target loss to obtain the target key point detection model.
[0121] In step S610 of some embodiments, the test paper area position label of the sample test paper image and the sample test paper image is obtained from the training data set. The sample test paper image is an ovulation test paper image for training the target key point detection model. Ovulation test paper images of different brands, different shooting angles (0-360 degrees, arbitrary tilt angle of the camera), and complex backgrounds (background color is not single, including non-test paper targets) can be collected as sample test paper images. The test paper area position label is the coordinates of the four vertices of the test paper area marked in the sample ovulation test paper image, and the test paper area is the area where the ovulation test paper appears in the sample test paper image. When the sample ovulation test paper image is marked, the sample test paper image is in a forward placement position, and the upper left corner vertex a, the upper right corner vertex b, the lower left corner vertex c, and the lower right corner vertex d are marked with four vertex coordinates in the vertex order, and the marking method makes the training sample include the test paper coordinate information and the vertex relationship of the corresponding standard placement test paper.
[0122] In order to increase the number of training samples, training data generation can be performed based on the following method. Specifically, a large number of non-test paper images are collected as background images, and the test paper target area is cropped out from the test paper image using the labeled test paper coordinate information. An area of the same size as the test paper target area is randomly selected from the background image, and the selected area is replaced with the image of the test paper target area to obtain more labeled test paper images with different backgrounds, which can enrich the model training samples while reducing the amount of manual labeling.
[0123] The training data is uniformly scaled to 416*416 size, and data enhancement methods such as random blur, random contrast, random brightness, and random cropping are applied to enable the model to cope with scenes such as lighting and blur to improve the robustness of the model. Among them, the random blur is to set a probability of 10% to blur the image, that is, 10% of the sample ovulation test strip images are randomly selected from the training data set for Gaussian blur. The main operation is to randomly select a number from the interval [0,15] as the Gaussian kernel size, and convolve the image with the Gaussian kernel of the selected size to obtain a blurred image. Random contrast is to set a probability of 10% to perform contrast processing on the image. The main operation is to increase the pixel value of the bright part and reduce the pixel value of the dark part. Random brightness is to set a probability of 10% to process the brightness of the image. The main operation is to generate a random value. If the brightness is lowered, the pixel value is subtracted from the random value, and if the brightness is increased, the pixel value is added to the random value. Random cropping is to set a 10% probability to crop the image, and the main operation is to randomly crop pixels that are not located in the target area of the test paper.
[0124] In step S620 of some embodiments, the sample test paper image is input into a preset key point detection model for key point detection, and vertex coordinates are output in sequence in the order of vertices abcd to obtain a pre-test paper area. The preset key point detection model has the same network structure as the target key point detection model, and the feature maps of different receptive fields are stacked through three different parallel structures of the SSH module to obtain a pre-test paper heat map.
[0125] In step S630 of some embodiments, the predicted coordinate information usually deviates from the marked coordinate information, and the target loss can be calculated by the deviation. The loss function used to calculate the target loss consists of a Euclidean loss function and a JS regularization constraint. The Euclidean loss function is used to regress the coordinates, and the JS regularization constraint is used to constrain the generated pre-test paper heat map to be closer to a Gaussian distribution. The loss function is expressed as:
[0126] L euc (u,p)+λL D (Z,P),
[0127] Among them, L euc (u,p) is the Euclidean loss function, L euc (u,p)=||pu||2, u is the pre-test paper area, p is the test paper area position label, 2 represents the 2 norm; L D (Z,P) is the JS regularization constraint, Z and P are both probability distributions, P is the predicted probability distribution, i.e. the pre-test paper heat map, and Z is the Gaussian distribution; D is the JS divergence (Jensen-Shannon divergence), P(c) is the predicted distribution, i.e. the pre-test paper heat map, and c is the sample test paper image. is centered at the true coordinate p and has a variance of Gaussian distribution of; λ is the weight factor of JS regular constraint.
[0128] Based on the above loss function, the loss is calculated according to the test paper area position label, the pre-test paper area and the pre-test paper heat map to obtain the target loss.
[0129] In step S640 of some embodiments, the target loss is minimized, the model parameters of the preset key point detection model are adjusted, and when the target loss tends to be stable, the model training is stopped to obtain the target key point detection model. The ovulation test strip image is input into the trained target key point detection model, and the coordinates of the four vertices of the target area of the test strip can be output in the order of vertices abcd. At this time, the vertex relationship corresponding to the standard placement of the test strip is known.
[0130] Through the above steps S610 to S640, a target key point detection model can be obtained to detect key points and vertex relationships of the key points corresponding to the forward placement positions based on the target key point detection model.
[0131] In step S130 of some embodiments, the vertices of the test paper area are perspectively transformed according to the vertex position relationship, and the vertices of the test paper area are projected onto a new visual plane to obtain the vertices of the target area, so that different shooting angles can obtain the test paper target area placed at the same horizontal standard, ensuring the relative fixation of the positions of the T line and the C line, reducing the difficulty of subsequent test paper identification, and improving the accuracy of test paper identification. The embodiment of the present application enables the ovulation test paper identification process to cope with shooting at any angle of the user through perspective transformation, and can realize random shooting at 0-360 degrees and any tilt angle of the camera, and the user does not need to align the test paper according to the specification.
[0132] The perspective transformation is expressed as:
[0133]
[0134] Among them, (x, y) is the coordinate of the vertex of the test paper area; (X, Y, Z) is the coordinate point of the transformed image plane, that is, the coordinate of the vertex of the target area; is the transformation matrix.
[0135] Since we are dealing with a two-dimensional image, we can set Z = 1. Dividing the transformed (X, Y, Z) by Z can transform the image from three-dimensional to two-dimensional, and obtain the final transformed plane coordinate point (X′, Y′). The perspective transformation can be re-expressed as:
[0136]
[0137] Among them, a 33 is 1.
[0138] The entire perspective transformation equation exists a 11 、a 12 、a 13 、a 21 、a 22 、a 23 、a 31 and a 32These 8 unknowns, and the transformation matrix constructed by these 8 unknowns can be used to perform perspective transformation on the image. Select four points on the test strip image containing the background (target ovulation test strip image) and the transformed target image respectively. These four points are usually vertices, and the four points selected on the two images correspond one to one. The four points of the transformed target image are clear, with the upper left corner being (0, 0), the upper right corner being (w, 0), the lower left corner being (0, h), and the lower right corner being (w, h). w is the width of the set transformed test strip image, and h is the height of the set transformed test strip image. Solve the transformation matrix based on the coordinates of the points on the test strip image containing the background and the coordinates of the points on the transformed target image.
[0139] Specifically, the target key point detection model can output the coordinates of the four test paper area vertices in the order of vertices placed in the standard positive direction, and select the four points of the transformed target area in turn according to the vertex position relationship (the position coordinates correspond to the vertices of the test paper placed in the positive direction) corresponding to the order of vertices placed in the standard positive direction, and input them into the above-represented equations to obtain the transformation matrix. Multiply the transformation matrix with the coordinates of the vertices of the test paper area to obtain the vertices of the target area.
[0140] It should be noted that if the position information of the four points is known, the target area of the test paper placed in the reverse direction with the background filtered out can be obtained after perspective transformation of the test paper placed in the reverse direction; if the position information of the four points and the corresponding vertex relationship of the test paper placed in the positive direction are known, the target area of the test paper placed in the positive direction with the background filtered out can be obtained.
[0141] In step S140 of some embodiments, the transformation matrix is multiplied by the target ovulation test strip image to obtain the target test strip image, and the candidate test strip area is determined from the target test strip image according to the coordinates of the four target area vertices to filter out the complex background of ovulation test strips of different brands and improve the versatility of test strip recognition.
[0142] See also Figure 7 In some embodiments, step S150 may include but is not limited to steps S710 to S720:
[0143] Step S710, extracting edge features of the candidate test paper area to obtain an edge feature map;
[0144] Step S720, obtaining a clarity score according to the edge feature map.
[0145] In step S710 of some embodiments, the candidate test paper area is scaled to 224*224 and converted into a grayscale image. An edge detection operator such as a Laplacian operator is used to perform edge detection on the candidate test paper area, and edge points of the candidate test paper area are extracted to obtain an edge feature map.
[0146] In step S720 of some embodiments, the clearer the image, the more edge information it contains, so the clarity of the candidate test paper area can be measured by the edge feature map. Specifically, the variance of the edge feature map is calculated, and the variance is used as a clarity score, and the clarity score is used to characterize the image quality of the candidate test paper area. The larger the clarity score, the higher the image quality. It should be noted that the larger the variance of the edge feature map, the greater the change in pixel values in the candidate test paper area, and the image edges represented by the edge feature map are more obvious and clear. Conversely, the smaller the variance of the edge feature map, the less obvious the change in pixel values in the candidate test paper area, and the image edges represented by the edge feature map are more blurred. The calculation formula for the variance is as follows:
[0147]
[0148] Where x represents the edge feature map; D represents the variance; n is the number of pixels in the edge feature map; x i is the pixel value of the i-th pixel; is the pixel average value.
[0149] Through the above steps S710 to S720, the clarity score of the candidate test paper area can be obtained, and the image quality can be determined based on the clarity score, so that the candidate test paper area with high image quality can be used for ovulation test paper identification, thereby improving the accuracy of ovulation test paper identification.
[0150] In step S160 of some embodiments, the overall process of the ovulation test paper identification method is real-time, which can provide the camera with sufficient focusing time. When the focus is on the clarity that meets the requirements, the candidate test paper area is identified for ovulation test paper, avoiding the collection of blurred images due to focusing problems and affecting subsequent identification. Specifically, if the clarity score is greater than the preset score threshold, it means that a high-definition and standard-placed test paper target area image is obtained, and the candidate test paper area is identified for ovulation test paper, which improves the accuracy of ovulation test paper identification. If the clarity score is less than or equal to the preset score threshold, the image to be detected is re-collected in real time.
[0151] See also Figure 8 The embodiment of the present application also provides an ovulation test paper identification device, which can implement the above-mentioned ovulation test paper identification method, and the ovulation test paper identification device includes:
[0152] The first acquisition module 810 is used to acquire the target ovulation test paper image;
[0153] The key point detection module 820 is used to perform key point detection on the target ovulation test paper image through a preset target key point detection model to obtain the vertices of the test paper area and the vertex position relationship of the vertices of the test paper area; the vertex position relationship is used to characterize the position relationship of the vertices of the test paper area in the target ovulation test paper image in the target placement direction;
[0154] A perspective transformation module 830 is used to perform perspective transformation on the vertices of the test paper area according to the position relationship of the vertices to obtain the vertices of the target area;
[0155] A determination module 840 is used to determine a candidate test strip area according to the target area vertices and the target ovulation test strip image;
[0156] The second acquisition module 850 is used to obtain the clarity score of the candidate test paper area;
[0157] The ovulation test strip recognition module 860 is used to recognize the ovulation test strip of the candidate test strip area according to the clarity score.
[0158] The specific implementation of the ovulation test paper identification device is basically the same as the specific implementation of the above-mentioned ovulation test paper identification method, and will not be repeated here.
[0159] The embodiment of the present application also provides an electronic device, the electronic device includes a memory and a processor, the memory stores a computer program, and the processor implements the above ovulation test strip identification method when executing the computer program. The electronic device can be any intelligent terminal including a tablet computer, a car computer, etc.
[0160] See also Fig. 9 , Fig. 9 The hardware structure of an electronic device of another embodiment is illustrated, and the electronic device includes:
[0161] The processor 910 may be implemented by a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of the present application.
[0162] The memory 920 can be implemented in the form of a read-only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM). The memory 920 can store an operating system and other application programs. When the technical solution provided in the embodiment of this specification is implemented by software or firmware, the relevant program code is stored in the memory 920, and the processor 910 calls and executes the ovulation test paper identification method of the embodiment of this application;
[0163] Input / output interface 930, used to implement information input and output;
[0164] Communication interface 940, used to realize communication interaction between the device and other devices, which can be realized through wired mode (such as USB, network cable, etc.) or wireless mode (such as mobile network, WI FI, Bluetooth, etc.);
[0165] bus 950 , which transmits information between the various components of the device (e.g., processor 910 , memory 920 , input / output interface 930 , and communication interface 940 );
[0166] The processor 910 , the memory 920 , the input / output interface 930 , and the communication interface 940 are connected to each other in communication within the device via a bus 950 .
[0167] An embodiment of the present application also provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the above-mentioned ovulation test paper identification method is implemented.
[0168] The memory, as a non-transient computer-readable storage medium, can be used to store non-transient software programs and non-transient computer executable programs. In addition, the memory may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some embodiments, the memory may optionally include a memory remotely disposed relative to the processor, and these remote memories may be connected to the processor 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.
[0169] The embodiments described in the embodiments of the present application are intended to more clearly illustrate the technical solutions of the embodiments of the present application and do not constitute a limitation on the technical solutions provided in the embodiments of the present application. Those skilled in the art will appreciate that with the evolution of technology and the emergence of new application scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.
[0170] Those skilled in the art will appreciate that the technical solutions shown in the figures do not constitute a limitation on the embodiments of the present application, and may include more or fewer steps than shown in the figures, or a combination of certain steps, or different steps.
[0171] The device embodiments described above are merely illustrative, and the units described as separate components may or may not be physically separated, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0172] Those skilled in the art will appreciate that all or some of the steps in the methods disclosed above, and the functional modules / units in the systems and devices may be implemented as software, firmware, hardware, or a suitable combination thereof.
[0173] The terms "first", "second", "third", "fourth", etc. (if any) in the specification of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0174] It should be understood that in the present application, "at least one (item)" means one or more, and "plurality" means two or more. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the objects associated before and after are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.
[0175] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the above units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. The mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0176] The units described above as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0177] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0178] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including multiple instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, referred to as ROM), random access memory (Random Access Memory, referred to as RAM), disk or optical disk and other media that can store programs.
[0179] The preferred embodiments of the present invention are described above with reference to the accompanying drawings, but the scope of the rights of the present invention is not limited thereto. Any modification, equivalent substitution and improvement made by a person skilled in the art without departing from the scope and essence of the present invention should be within the scope of the rights of the present invention.
Claims
1. An ovulation test paper identification method, characterized in that: The method comprises: Acquire the target ovulation test strip image; Key point detection is performed on the target ovulation test paper image by using a preset target key point detection model to obtain the vertices of the test paper area and the vertex position relationship of the vertices of the test paper area; the vertex position relationship is used to characterize the position relationship of the vertices of the test paper area in the target ovulation test paper image in the target placement direction; Performing perspective transformation on the vertices of the test paper area according to the vertex position relationship to obtain the vertices of the target area; Determine a candidate test strip area according to the target area vertices and the target ovulation test strip image; Obtaining a clarity score of the candidate test paper area; The candidate test strip area is identified by ovulation test strip identification according to the clarity score.
2. The ovulation test paper identification method according to claim 1, characterized in that: The method of performing key point detection on the target ovulation test paper image by using a preset target key point detection model to obtain the vertices of the test paper area and the vertex position relationship of the vertices of the test paper area includes: Perform key point detection on the target ovulation test paper image by using the target key point detection model to obtain the key points of the test paper and the initial position relationship of the key points of the test paper; Connecting the key points of the test paper according to the initial position relationship to obtain a detection area; the detection area includes a first side and a second side; the length of the first side is greater than the length of the second side; Screening the key points of the test paper according to the first side and the second side to obtain the vertices of the test paper area; The initial position relationship of the vertices of the test paper area is used as the vertex position relationship.
3. The ovulation test paper identification method according to claim 2, characterized in that: The method of performing key point detection on the target ovulation test paper image by using the target key point detection model to obtain the key points of the test paper and the initial position relationship of the key points of the test paper includes: Performing preliminary feature extraction on the target ovulation test paper image to obtain test paper image features; Performing multi-scale feature extraction on the test paper image feature to obtain a first test paper feature, a second test paper feature, and a third test paper feature; wherein the feature scales of the first test paper feature, the second test paper feature, and the third test paper feature are increased in sequence; Perform heat map prediction according to the first test paper feature, the second test paper feature and the third test paper feature to obtain a target test paper heat map; Key point detection is performed on the target test paper heat map to obtain the relationship between the test paper key points and the initial position.
4. The ovulation test paper identification method according to claim 2, characterized in that: The step of screening the key points of the test paper according to the first side and the second side to obtain the vertices of the test paper area includes: If the length of the first side is greater than a first preset length threshold, and the length of the second side is greater than a second preset length threshold, obtaining a first length deviation between the first sides and a second length deviation between the second sides; The key points of the test paper are screened according to the first length deviation and the second length deviation to obtain the vertices of the test paper area.
5. The ovulation test paper identification method according to claim 4, characterized in that: The step of screening the key points of the test paper according to the first length deviation and the second length deviation to obtain the vertices of the test paper area includes: If the first length deviation is less than or equal to a first preset deviation threshold, and the second length deviation is less than or equal to a second preset deviation threshold, calculating the aspect ratio according to the first side and the second side; Acquire the edge spatial position relationship between the first edges according to the aspect ratio; The key points of the test paper are screened according to the edge spatial position relationship to obtain the vertices of the test paper area.
6. The ovulation test paper identification method according to any one of claims 1 to 5, characterized in that: The target key point detection model is trained according to the following steps: Obtaining a sample test paper image and a test paper area position label of the sample test paper image; Perform key point detection on the sample test paper image by using a preset key point detection model to obtain a pre-test paper area and a pre-test paper heat map; Calculate the loss according to the test paper area position label, the pre-test paper area and the pre-test paper heat map to obtain a target loss; The model parameters of the preset key point detection model are adjusted according to the target loss to obtain the target key point detection model.
7. The ovulation test paper identification method according to any one of claims 1 to 5, characterized in that: The obtaining of the clarity score of the candidate test paper area includes: Extracting edge features of the candidate test paper area to obtain an edge feature map; The clarity score is obtained according to the edge feature map.
8. An ovulation test strip identification device, characterized in that: The device comprises: A first acquisition module is used to acquire a target ovulation test paper image; A key point detection module is used to perform key point detection on the target ovulation test paper image through a preset target key point detection model to obtain the vertices of the test paper area and the vertex position relationship of the vertices of the test paper area; the vertex position relationship is used to characterize the position relationship of the vertices of the test paper area in the target ovulation test paper image in the target placement direction; A perspective transformation module, used for performing perspective transformation on the vertices of the test paper area according to the vertex position relationship to obtain the vertices of the target area; A determination module, used to determine a candidate test paper area according to the target area vertices and the target ovulation test paper image; A second acquisition module, used to obtain the clarity score of the candidate test paper area; The ovulation test paper identification module is used to identify the ovulation test paper of the candidate test paper area according to the clarity score.
9. An electronic device, characterized in that The electronic device comprises a memory and a processor, the memory stores a computer program, and the processor implements the ovulation test paper identification method according to any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the ovulation test paper identification method according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Ovulation test paper detection method and system
CN106405118A
Image recognition method and device, electronic equipment and storage medium
CN111339846A
Target edge feature extraction method and device, terminal and storage medium
CN115375917A
Image matching processing method and device, electronic equipment and storage medium
CN116912516A
Image processing method and device and transmission scanning system
CN118447067A
