Method and device for judging stains in image, equipment and storage medium

By using the target binary classification model and Gini impurity analysis of stain category information in the livestock insurance claims system, the livestock image recognition problem caused by stain coverage is solved, and more accurate stain identification and the formulation of claims solutions are achieved.

CN119418086APending Publication Date: 2025-02-11PING AN TECH (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411189783.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-27
Publication Date
2025-02-11

AI Technical Summary

Technical Problem

During the livestock insurance claim process, the stained livestock images make the claims system unable to effectively identify the livestock's identity information and health status, and thus fails to provide a reasonable claim plan.

Method used

Stain category information is obtained by obtaining the effective area in the target image and analyzing the area using the target binary classification model. Then, the stain category information is analyzed by Gini impurity to determine its uncertainty probability. If it is lower than the preset threshold, the stain category is determined.

Benefits of technology

Accurate judgment of stain categories in the image is achieved, the probability of misclassification is reduced, the discrimination accuracy is improved, and images that do not comply with the claims rules can be better filtered out.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119418086A_ABST
    Figure CN119418086A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a method and device for judging stains in an image, equipment and a storage medium. The method comprises the following steps: acquiring a target image of stains to be identified, and determining an effective area in the target image; analyzing the effective area through a target dichotomy model to obtain stain category information of the target image, the stain category information comprising a first probability of no stain and a second probability of slight stain, and the slight stain comprising a stain area less than or equal to half of the effective area; the stain category information is analyzed through Gini impurity, and the uncertainty probability of the stain category information is obtained; and in response to the fact that the uncertainty probability of the stain category information is lower than a preset threshold value, determining the stain category corresponding to the maximum probability in the first probability and the second probability as the target stain category of the target image. The embodiment of the invention aims at accurately judging the stain category in the target image, so that the method is applied to the field of insurance claim settlement to filter out the image of which the stain category does not conform to the claim settlement rule.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of financial technology, and in particular to a method for distinguishing stains in an image, a device for distinguishing stains in an image, a computer device, and a computer-readable storage medium. Background Art

[0002] In the livestock insurance claim process, users usually need to provide livestock images to the claim system so that the claim system can automatically determine whether the livestock is insured based on the livestock images, and determine the health of the livestock and give a reasonable claim plan. However, since the body surface of sick or even dead livestock may be covered with stains of varying degrees and areas, the livestock surface or key parts in the livestock image may be covered with stains over a large area, and the claim system may not be able to effectively identify the livestock's identity information, let alone make claims.

[0003] Therefore, the claims system needs to identify the types of stains in livestock images in order to filter out livestock images that do not comply with claims rules or cannot be effectively claimed. Summary of the invention

[0004] The present application provides a method for distinguishing stains in an image, an apparatus for distinguishing stains in an image, a computer device and a computer-readable storage medium, which are intended to more accurately distinguish the type of stains in a target image, thereby being applied in the field of insurance claims to filter out images whose stain types do not comply with claim rules.

[0005] To achieve the above purpose, the present application also provides a method for identifying stains in an image, comprising:

[0006] Acquire a target image of the stain to be identified, and determine a valid area in the target image;

[0007] Analyze the effective area through a target binary classification model to obtain stain category information of the target image, wherein the stain category information includes a first probability of no stain and a second probability of slight stain, and the slight stain includes a stain area that is less than or equal to half of the effective area;

[0008] Analyzing the stain category information by using Gini impurity to obtain the uncertainty probability of the stain category information;

[0009] In response to the uncertainty probability of the stain category information being lower than a preset threshold, a stain category corresponding to a maximum probability between the first probability and the second probability is determined as a target stain category of the target image.

[0010] To achieve the above object, the present application also provides a device for identifying stains in an image, comprising:

[0011] An acquisition module, the acquisition module is used to acquire a target image of the stain to be identified and determine a valid area in the target image;

[0012] An analysis module, the analysis module is used to analyze the effective area through a target binary classification model to obtain stain category information of the target image, wherein the stain category information includes a first probability of no stain and a second probability of slight stain, and the slight stain includes a stain area that is less than or equal to half of the effective area;

[0013] The analysis module is also used to analyze the stain category information through Gini impurity to obtain the uncertainty probability of the stain category information;

[0014] A determination module is configured to determine, in response to the uncertainty probability of the stain category information being lower than a preset threshold, a stain category corresponding to a maximum probability between the first probability and the second probability as a target stain category of the target image.

[0015] In addition, to achieve the above-mentioned purpose, the present application also provides a computer device, which includes a memory and a processor; the memory is used to store a computer program; the processor is used to execute the computer program and implement the steps of the method for distinguishing stains in an image provided in any one of the embodiments of the present application when executing the computer program.

[0016] In addition, to achieve the above-mentioned purpose, 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 processor implements the steps of the method for distinguishing stains in an image as described in any one of the embodiments of the present application.

[0017] The present application discloses a method for distinguishing stains in an image, a device for distinguishing stains in an image, a computer device, and a computer-readable storage medium. The method includes obtaining a target image of stains to be identified, determining a valid area in the target image, and analyzing the valid area through a target binary classification model to obtain stain category information of the target image, wherein the stain category information includes a first probability of no stains and a second probability of slight stains, and the slight stains include a stain area that is less than or equal to half of the valid area. Further, the stain category information can be analyzed by Gini impurity to obtain the uncertainty probability of the stain category information, and in response to the uncertainty probability of the stain category information being lower than a preset threshold, the stain category corresponding to the maximum probability of the first probability and the second probability is determined as the target stain category of the target image. The present application analyzes the valid area through a binary classification model, avoids unnecessary complex processing of the entire image, and saves computing resources. At the same time, through the precise analysis of the valid area, the key parts of the image can be better focused, which is applicable to various image environments and stain forms. In addition, by introducing Gini impurity to measure the uncertainty of the prediction result, the stain category of the target image can be accurately determined. It effectively reduces the probability of misclassification and improves the accuracy of identifying the stain category in the target image. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] 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 will be briefly introduced below. Obviously, the drawings described below are 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 work.

[0019] Figure 1 This is a scene schematic diagram of a method for distinguishing stains in an image provided by an embodiment of the present application;

[0020] Figure 2 It is a flow chart of a method for distinguishing stains in an image provided by an embodiment of the present application;

[0021] Figure 3 It is a schematic diagram of a process for obtaining a target binary classification model provided in an embodiment of the present application;

[0022] Figure 4 is a schematic block diagram of a device for distinguishing stains in an image provided by an embodiment of the present application;

[0023] Figure 5 It is a schematic block diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0024] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0025] The flowcharts shown in the accompanying drawings are only examples and do not necessarily include all the contents and operations / steps, nor do they have to be executed in the order described. For example, some operations / steps can also be decomposed, combined or partially merged, so the actual execution order may change according to actual conditions. In addition, although the functional modules are divided in the device schematic, in some cases, the module division can be different from that in the device schematic.

[0026] The term "and / or" as used in this specification and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.

[0027] In conjunction with the accompanying drawings, some embodiments of the present application are described in detail below. In the absence of conflict, the following embodiments and features in the embodiments can be combined with each other.

[0028] like Figure 1 As shown, the method for distinguishing stains in an image provided by the embodiment of the present application can be applied to Figure 1In the application environment shown. The application environment includes a terminal device 110 and a server 120, wherein the terminal device 110 can communicate with the server 120 through a network. Specifically, the server 120 can obtain a target image of stains to be identified, and determine a valid area in the target image; analyze the valid area through a target binary classification model to obtain stain category information of the target image, wherein the stain category information includes a first probability of no stains and a second probability of slight stains, and the slight stains include a stain area that is less than or equal to half of the valid area; analyze the stain category information through Gini impurity to obtain an uncertainty probability of the stain category information; in response to the uncertainty probability of the stain category information being lower than a preset threshold, determine the stain category corresponding to the maximum probability of the first probability and the second probability as the target stain category of the target image, thereby sending the target stain category to the terminal device 110. Among them, the server 120 can be an independent server, or it can be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDN), and big data and artificial intelligence platforms. The terminal device 110 can be a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart speaker, a smart watch, etc., but is not limited to this. The terminal and the server can be directly or indirectly connected via wired or wireless communication, and this application is not limited here.

[0029] Please continue reading Figure 2 , Figure 2 FIG. 1 is a flow chart of a method for identifying stains in an image provided by an embodiment of the present application. Figure 2 As shown, the method for distinguishing stains in an image can be implemented through steps S11 to S14.

[0030] Step S11: Acquire a target image of stains to be identified, and determine a valid area in the target image.

[0031] The effective area is used to represent the part of the image that needs to be identified for stains.

[0032] For example, the target image may include an unprocessed raw image, for example, in a livestock insurance claim, the target image may be an image including livestock.

[0033] For example, the target image may be processed by image cropping technology, image segmentation technology, etc. to obtain a valid area in the target image.

[0034] Step S12: Analyze the effective area through the target binary classification model to obtain stain category information of the target image.

[0035] The stain category information includes a first probability of no stain and a second probability of slight stain, and slight stain includes a stain area that is less than or equal to half of the effective area.

[0036] For example, after determining the effective area, the effective area can be input into a pre-trained target binary classification model for analysis, so that the target binary classification model can classify and distinguish the input effective area to obtain a first probability of no stain and a second probability of slight stain.

[0037] It should be noted that the binary classification model is a machine learning model whose task is to classify the input data into one of two possible categories. It is widely used in various classification tasks. The core task of the binary classification model is to find a decision boundary to classify the samples into two categories. The decision boundary can be linear or nonlinear, depending on the complexity of the model. Common binary classification models include but are not limited to decision tree models, naive Bayes models, and neural network models, which are not limited here.

[0038] The above method can effectively extract the key areas from the target image, and use the binary classification model to accurately analyze the key areas, and finally obtain the stain category information, laying the foundation for further identification of stains in the image.

[0039] Step S13: Analyze the stain category information through Gini impurity to obtain the uncertainty probability of the stain category information.

[0040] Step S14: in response to the uncertainty probability of the stain category information being lower than a preset threshold, determining the stain category corresponding to the maximum probability between the first probability and the second probability as the target stain category of the target image.

[0041] It should be noted that Gini impurity is an indicator that measures the uncertainty or degree of confusion of a data set. It is usually used in decision tree models to select the optimal split point. In a binary classification problem, Gini impurity reflects the sum of the probabilities that a sample does not belong to a certain class.

[0042] The stain category information is analyzed by calculating the Gini impurity to obtain the uncertainty probability of the stain category information. The higher the uncertainty probability of the stain category information, the more uncertain the model's judgment of the stain category (that is, the more chaotic the category distribution). For example, if the uncertainty probability of the stain category information is 0, it means that the model's judgment of the stain category information is more accurate; if it is close to 0.5, it means that the model's judgment of the stain category information is relatively vague.

[0043] For example, the preset threshold is 0.5. That is, if the uncertainty probability of the stain category information is lower than 0.5, it means that the determination of the stain category information is relatively accurate, and the stain category corresponding to the maximum probability of the first probability and the second probability can be determined as the target stain category of the target image.

[0044] The above method can effectively use Gini impurity to measure the uncertainty probability of the model's prediction of stain category information, so as to improve the reliability and efficiency of the target stain category.

[0045] The method for distinguishing stains in an image disclosed in an embodiment of the present application includes obtaining a target image of stains to be identified, determining an effective area in the target image, and analyzing the effective area through a target binary classification model to obtain stain category information of the target image, wherein the stain category information includes a first probability of no stain and a second probability of slight stain, and the slight stain includes a stain area that is less than or equal to half of the effective area. Further, the stain category information can be analyzed through Gini impurity to obtain the uncertainty probability of the stain category information, and in response to the uncertainty probability of the stain category information being lower than a preset threshold, the stain category corresponding to the maximum probability of the first probability and the second probability is determined as the target stain category of the target image. The present application analyzes the effective area through a binary classification model, avoids unnecessary complex processing of the entire image, and saves computing resources. At the same time, through the precise analysis of the effective area, the key part of the image can be better focused, which is applicable to various image environments and stain forms. In addition, by introducing Gini impurity to measure the uncertainty of the prediction result, the stain category of the target image can be accurately determined. The probability of misclassification is effectively reduced, and the accuracy of distinguishing the stain category in the target image is improved.

[0046] Optionally, obtaining a target image of the stain to be identified and determining a valid area in the target image includes: obtaining a target image of the stain to be identified; and performing a preprocessing operation on the target image to obtain a preprocessed target image, wherein the preprocessing operation includes at least one of a random flipping operation, a cropping operation, and an image enhancement operation; and determining the valid area based on the preprocessed target image.

[0047] For example, after obtaining a target image of stains to be identified, a preprocessing operation may be performed on the target image to improve, standardize or enhance the quality of the image so that the target binary classification model can better understand and process the target image.

[0048] Among them, the random flipping operation allows the target image to be randomly flipped horizontally or vertically; the cropping operation* refers to cutting a smaller area from the target image, thereby removing irrelevant parts of the target image and focusing on analyzing the effective area; the image enhancement operation includes brightness adjustment, contrast adjustment, noise addition, color transformation, etc., to increase the diversity of the target image.

[0049] For example, the effective area can be determined based on the preprocessed target image, so that the target binary classification model can focus on the effective area related to stain recognition, reduce the interference of irrelevant areas, and improve the accuracy of classification.

[0050] In the above method, the image is standardized or enhanced through preprocessing operations, and then the most likely effective area is determined therefrom, which can lay a foundation for the subsequent analysis of stain category information and improve the analysis accuracy of the model.

[0051] Optionally, determining the valid area includes: performing instance segmentation on the target image to obtain a physical area in the target image, wherein the physical area includes a plurality of entities; and determining the physical area as the valid area in the target image.

[0052] Illustratively, the entities include livestock.

[0053] It should be noted that instance segmentation is a type of image segmentation that not only marks the category to which objects in the image belong, but also distinguishes different individuals of the same category in the image (i.e., different "instances").

[0054] For example, instance segmentation can be performed on the target image to identify the entity regions in the target image. Each entity region corresponds to a specific object in the target image, and these objects can belong to the same category (for example, multiple livestock in the same image). After the instance segmentation is completed, the identified entity regions (such as different livestock in the target image) will be regarded as valid regions of the target image for further analysis and processing.

[0055] In the above way, instance segmentation can accurately identify the valid area in the target image, which helps to exclude irrelevant background or interference information in the image, making the subsequent analysis more focused and accurate.

[0056] Optionally, after analyzing the stain category information through Gini impurity to obtain the uncertainty probability of the stain category information, it also includes: in response to the uncertainty probability of the stain category information being higher than or equal to a preset threshold, determining that the target stain category of the target image is a severe stain, wherein the severe stain includes a stain area that is higher than half of the effective area.

[0057] For example, when the uncertainty probability of the stain category information is higher than or equal to the preset threshold, it indicates that the uncertainty of the target binary classification model in judging the stain category of the current image is high, and at this time, the target stain category of the target image can be directly determined to be severe stain. In this way, the possible misjudgment caused by high processing uncertainty can be reduced, thereby improving the reliability of the stain category information.

[0058] Optionally, analyzing the stain category information by using the Gini impurity to obtain the uncertainty probability of the stain category information includes: obtaining the uncertainty probability of the stain category information by using the following formula:

[0059] Where Gini is the uncertainty probability; k = 2, p k is the first probability or the second probability.

[0060] Please continue reading Figure 3 , Figure 3 Schematic diagram of a process for obtaining a target binary classification model provided in an embodiment of the present application. Figure 3 As shown, the target binary classification model can be obtained through steps S21 to S23.

[0061] Step S21: Obtain a first training data set and an initial binary classification model.

[0062] The first training data set includes a plurality of images.

[0063] Step S22: labeling the first training data set to obtain a labeling result.

[0064] Step S23: Train the initial binary classification model using the first training data set and the annotation results to obtain a target binary classification model.

[0065] Specifically, a number of images may be obtained to be used as a training data set for training, wherein the number of images include stains.

[0066] Furthermore, each image can be annotated to obtain an annotation result for each image, wherein the annotation result includes stain category information corresponding to several images, and then the annotation result is used as a label for the group of input data, and then each group of labeled training data sets is input into the initial binary classification model for supervised learning. When the training end conditions are met, such as when the number of training times reaches a number threshold or the output accuracy of the model reaches an accuracy threshold, the training is terminated to obtain a trained target binary classification model.

[0067] In the embodiment of the present application, the training data set and the annotation results can be input into the initial binary classification model for supervised learning, and then the target binary classification model can be trained to obtain the stain category information corresponding to the target image based on the target binary classification model.

[0068] Optionally, the initial binary classification model is trained using the first training data set and the labeling results to obtain a target binary classification model, including: iteratively training the target binary classification model based on the first training data set and the labeling results to extract data features, and calculating a first loss function; iteratively training the first loss function using a preset method with the purpose of reducing the value of the loss function until the expected threshold requirement is met; based on the iteratively trained first loss function, obtaining the iterative target binary classification model.

[0069] It can be understood that in order to train a target binary classification model with higher accuracy, the target binary classification model can be repeatedly iterated to continuously reduce the loss function until the loss function meets the expected threshold requirement, and then more accurate stain category information corresponding to the target image can be obtained based on the iterated target binary classification model.

[0070] It should be noted that the present application does not limit the above-mentioned preset method and expected threshold. For example, the preset method may be a gradient descent algorithm, a batch gradient descent algorithm, a stochastic gradient descent algorithm, etc. The present application takes the gradient descent algorithm as an example for explanation.

[0071] The purpose of the gradient descent algorithm is to find the minimum value of the loss function through iteration, or to converge to the minimum value. In a geometric sense, the gradient descent algorithm means that the gradient decreases fastest in the direction opposite to the vector where the function changes the fastest, so it is easier to find the minimum value of the function. Based on this, in an embodiment of the present application, the event extraction model can be repeatedly iterated and trained by the gradient descent algorithm so that the loss function is continuously reduced, thereby reducing the error of the calculation result.

[0072] In an embodiment of the present application, the target binary classification model is repeatedly iteratively trained using a gradient descent algorithm so that the loss function is continuously reduced to obtain an iterative target binary classification model, and then more accurate stain category information corresponding to the target image can be obtained based on the iterative target binary classification model.

[0073] See also Figure 4 , Figure 4 This is a schematic block diagram of a stain identification device in an image provided by an embodiment of the present application. The stain identification device in an image can be configured in a server to execute the stain identification method in the image described above.

[0074] like Figure 4As shown, the device 200 for distinguishing stains in an image includes: an acquisition module 201 , an analysis module 202 and a determination module 203 .

[0075] An acquisition module 201 is used to acquire a target image of stains to be identified and determine a valid area in the target image;

[0076] An analysis module 202 is used to analyze the effective area through a target binary classification model to obtain stain category information of the target image, wherein the stain category information includes a first probability of no stain and a second probability of slight stain, and the slight stain includes a stain area that is less than or equal to half of the effective area;

[0077] The analysis module 202 is further used to analyze the stain category information through Gini impurity to obtain the uncertainty probability of the stain category information;

[0078] The determination module 203 is configured to determine, in response to the uncertainty probability of the stain category information being lower than a preset threshold, a stain category corresponding to a maximum probability between the first probability and the second probability as a target stain category of the target image.

[0079] The acquisition module 201 is also used to acquire the target image of the stain to be identified; and perform a preprocessing operation on the target image to obtain a preprocessed target image, wherein the preprocessing operation includes at least one of a random flipping operation, a cropping operation, and an image enhancement operation; and determine the effective area based on the preprocessed target image.

[0080] The acquisition module 201 is further used to perform instance segmentation on the target image to obtain a physical region in the target image, wherein the physical region includes a plurality of entities; and determine the physical region as a valid region in the target image.

[0081] The acquisition module 201 is further used to perform instance segmentation on the target image to obtain a physical region in the target image, wherein the physical region includes a plurality of entities; and determine the physical region as a valid region in the target image.

[0082] The determination module 203 is further configured to determine that the target stain category of the target image is severe stain in response to the uncertainty probability of the stain category information being greater than or equal to the preset threshold, wherein the severe stain includes the stain area being higher than half of the effective area.

[0083] The analysis module 202 is further used to obtain the uncertainty probability of the stain category information through the following formula:

[0084]

[0085] Where Gini is the uncertainty probability; k = 2, p k is the first probability or the second probability.

[0086] The acquisition module 201 is also used to obtain a first training data set and an initial binary classification model; wherein the first training data set includes a plurality of images; the first training data set is annotated to obtain an annotation result, wherein the annotation result includes stain category information corresponding to the plurality of images; the initial binary classification model is trained by the first training data set and the annotation result to obtain the target binary classification model.

[0087] The acquisition module 201 is also used to iteratively train the target binary classification model based on the first training data set and the annotation results to extract data features, and calculate a first loss function; iteratively train the first loss function using a preset method for the purpose of reducing the value of the loss function until the expected threshold requirement is met; based on the first loss function after iterative training, obtain the iterative target binary classification model.

[0088] It should be noted that those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described devices and modules and units can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0089] The method and apparatus of the present application can be used in many general or special computing system environments or configurations, such as personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer terminal devices, network PCs, minicomputers, mainframe computers, and distributed computing environments including any of the above systems or devices.

[0090] Exemplarily, the above method and apparatus may be implemented in the form of a computer program. The computer program may be implemented in Figure 5 Runs on the computer device shown.

[0091] See also Figure 5 , Figure 5 1 is a schematic diagram of a computer device provided in an embodiment of the present application. The computer device may be a server.

[0092] like Figure 5 As shown, the computer device includes a processor, a memory and a network interface connected through a system bus, wherein the memory may include a volatile storage medium, a non-volatile storage medium and an internal memory.

[0093] The non-volatile storage medium can store an operating system and a computer program. The computer program includes program instructions, and when the program instructions are executed, the processor can execute any method for distinguishing stains in an image.

[0094] The processor is used to provide computing and control capabilities and support the operation of the entire computer equipment.

[0095] The internal memory provides an environment for the operation of the computer program in the non-volatile storage medium. When the computer program is executed by the processor, the processor can execute any method for distinguishing stains in an image.

[0096] The network interface is used for network communication, such as sending assigned tasks, etc. Those skilled in the art can understand that the structure of the computer device is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0097] It should be understood that the processor may be a central processing unit (CPU), and the processor may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among them, the general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.

[0098] Among them, in some embodiments, the processor is used to obtain a target image of stains to be identified, and determine a valid area in the target image; analyze the valid area through a target binary classification model to obtain stain category information of the target image, wherein the stain category information includes a first probability of no stain and a second probability of slight stain, and the slight stain includes a stain area that is less than or equal to half of the valid area; analyze the stain category information through Gini impurity to obtain an uncertainty probability of the stain category information; in response to the uncertainty probability of the stain category information being lower than a preset threshold, determine the stain category corresponding to the maximum probability of the first probability and the second probability as the target stain category of the target image.

[0099] In some embodiments, the processor is also used to obtain a target image of the stain to be identified; and perform a preprocessing operation on the target image to obtain a preprocessed target image, wherein the preprocessing operation includes at least one of a random flipping operation, a cropping operation, and an image enhancement operation; and determine the effective area based on the preprocessed target image.

[0100] In some embodiments, the processor is further used to perform instance segmentation on the target image to obtain a solid region in the target image, wherein the solid region includes a plurality of entities; and determine the solid region as a valid region in the target image.

[0101] In some embodiments, the processor is further used to determine that the target stain category of the target image is severe stain in response to the uncertainty probability of the stain category information being higher than or equal to the preset threshold, wherein the severe stain includes the stain area being higher than half of the effective area.

[0102] In some embodiments, the processor is further configured to obtain the uncertainty probability of the stain category information by using the following formula:

[0103]

[0104] Where Gini is the uncertainty probability; k = 2, p k is the first probability or the second probability.

[0105] In some embodiments, the processor is also used to obtain a first training data set and an initial binary classification model; wherein the first training data set includes a number of images; annotate the first training data set to obtain an annotation result, wherein the annotation result includes stain category information corresponding to the number of images; train the initial binary classification model using the first training data set and the annotation result to obtain the target binary classification model.

[0106] In some embodiments, the processor is also used to iteratively train the target binary classification model based on the first training data set and the annotation results to extract data features, and calculate a first loss function; iteratively train the first loss function using a preset method for the purpose of reducing the value of the loss function until the expected threshold requirement is met; based on the iteratively trained first loss function, obtain the iterative target binary classification model.

[0107] An embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored. The computer program includes program instructions, and when the program instructions are executed, any method for distinguishing stains in an image provided in the embodiment of the present application is implemented.

[0108] The computer-readable storage medium may be an internal storage unit of the computer device described in the foregoing embodiment, such as a hard disk or memory of the computer device. The computer-readable storage medium may also be an external storage device of the computer device, such as a plug-in hard disk, a smart memory card (SmartMedia Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc., equipped on the computer device.

[0109] Furthermore, the computer-readable storage medium may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application program required for at least one function, and the like.

[0110] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in the present application, and these modifications or replacements should be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be based on the protection scope of the claims.

Claims

1. A method for identifying stains in an image, characterized in that: The method comprises: Acquire a target image of the stain to be identified, and determine a valid area in the target image; Analyze the effective area through a target binary classification model to obtain stain category information of the target image, wherein the stain category information includes a first probability of no stain and a second probability of slight stain, and the slight stain includes a stain area that is less than or equal to half of the effective area; Analyzing the stain category information by using Gini impurity to obtain the uncertainty probability of the stain category information; In response to the uncertainty probability of the stain category information being lower than a preset threshold, a stain category corresponding to a maximum probability between the first probability and the second probability is determined as a target stain category of the target image.

2. The method according to claim 1, characterized in that The step of acquiring a target image of stains to be identified and determining a valid area in the target image includes: Acquire a target image of the stain to be identified; and performing a preprocessing operation on the target image to obtain a preprocessed target image, wherein the preprocessing operation includes at least one of a random flipping operation, a cropping operation, and an image enhancement operation; The effective area is determined according to the preprocessed target image.

3. The method according to claim 1, characterized in that: The determining of the effective area comprises: Performing instance segmentation on the target image to obtain an entity region in the target image, wherein the entity region includes a plurality of entities; The entity region is determined as a valid region in the target image.

4. The method according to claim 1, characterized in that After analyzing the stain category information by using the Gini impurity to obtain the uncertainty probability of the stain category information, the method further includes: In response to the uncertainty probability of the stain category information being higher than or equal to the preset threshold, determining that the target stain category of the target image is severe stain, wherein the severe stain includes the stain area being higher than half of the effective area.

5. The method according to claim 1, characterized in that The step of analyzing the stain category information by using the Gini impurity to obtain the uncertainty probability of the stain category information includes: The uncertainty probability of the stain category information is obtained by the following formula: Where Gini is the uncertainty probability; k = 2, p k is the first probability or the second probability.

6. The method according to claim 1, characterized in that The method further comprises: Obtain a first training data set and an initial binary classification model; wherein the first training data set includes a plurality of images; Annotating the first training data set to obtain an annotation result, wherein the annotation result includes stain category information corresponding to a plurality of images; The initial binary classification model is trained using the first training data set and the annotation results to obtain the target binary classification model.

7. The method according to claim 6, characterized in that The step of training the initial binary classification model using the first training data set and the annotation result to obtain the target binary classification model includes: Iteratively train the target binary classification model based on the first training data set and the annotation result to extract data features, and calculate a first loss function; Iteratively training the first loss function by using a preset method for the purpose of reducing the value of the loss function until the expected threshold requirement is met; Based on the first loss function after iterative training, an iterative target binary classification model is obtained.

8. A device for identifying stains in an image, characterized in that: The distinguishing device comprises: An acquisition module, the acquisition module is used to acquire a target image of the stain to be identified and determine a valid area in the target image; An analysis module, the analysis module is used to analyze the effective area through a target binary classification model to obtain stain category information of the target image, wherein the stain category information includes a first probability of no stain and a second probability of slight stain, and the slight stain includes a stain area that is less than or equal to half of the effective area; The analysis module is also used to analyze the stain category information through Gini impurity to obtain the uncertainty probability of the stain category information; A determination module is configured to determine, in response to the uncertainty probability of the stain category information being lower than a preset threshold, a stain category corresponding to a maximum probability between the first probability and the second probability as a target stain category of the target image.

9. A computer device, characterized in that: include: A memory and a processor; wherein the memory is connected to the processor and is used to store a program; the processor is used to implement the steps of the method for distinguishing stains in an image as described in any one of claims 1 to 7 by running the program stored in the memory.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the processor implements the steps of the method for distinguishing stains in an image according to any one of claims 1 to 7.