Ear tag type identification method and device, computer equipment and storage medium

By using different loss functions to process the probability set of ear tag types in the ear tag recognition system, the detection suppression problem caused by uneven sample samples of ear tag types in the prior art is solved, the detection rate of risk ear tags is improved, and the risk of insurance fraud is reduced.

CN120148044APending Publication Date: 2025-06-13PING AN TECH (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510195904.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-02-20
Publication Date
2025-06-13

AI Technical Summary

Technical Problem

In animal insurance, it is difficult for the prior art to effectively identify and detect handwritten or secondary altered ear tags, resulting in a high risk of insurance fraud. Due to the uneven sample number of different types of ear tags, the model's detection rate of risk ear tags is affected.

Method used

By obtaining the target image of the ear tag to be identified and inputting it into the preset ear tag classification model, different loss functions are used to process the probability set of normal ear tag types and risk ear tag types respectively, update the probability of each type, and finally determine the ear tag type based on the background probability and the target probability of each type.

Benefits of technology

The detection rate of risky ear tags by the model is improved, the risk of insurance fraud is reduced, and samples of different types of ear tags are effectively utilized, avoiding detection suppression due to uneven sample size.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120148044A_ABST
    Figure CN120148044A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of artificial intelligence, and discloses an ear tag type identification method and device, computer equipment and a storage medium. The method comprises: obtaining a target image; the target image is input into a preset ear tag classification model to obtain a first probability set, a second probability set and a third probability set, the first probability set comprises a first other type probability and a background probability, and the second probability set comprises a second other type probability and a normal ear tag type probability corresponding to each normal ear tag type; the third probability set comprises a third other type probability and a risk ear tag type probability corresponding to each risk ear tag type; according to the first other type probability, updating the probability of each normal ear tag type and the probability of each risk ear tag type; and determining a target ear tag type according to the background probability, the probability of each target normal ear tag type and the probability of each target risk ear tag type. By implementing the method provided by the embodiment of the invention, the detection rate of the model on the risk ear tag can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the fields of artificial intelligence and financial technology, and in particular to methods, devices, computer equipment and storage media for identifying ear tag types. Background Art

[0002] An important basis for claims in livestock insurance is the ear tag of the livestock. The ear tag should be machine-printed with clear handwriting to be the only effective proof of the livestock's identity. However, in reality, some ear tags use handwritten text, and some even make secondary alterations on handwritten ear tags for reuse. These behaviors are all risk of insurance fraud and require early warning for insurance companies to investigate.

[0003] However, the number of normal ear tags is large, while the number of risk ear tags is proportionally small, but the risk is extremely high. Since the sample numbers of different types of ear tags are very unbalanced, the type with a large number of samples will inhibit the type with a small number of samples, affecting the model's detection rate for risk ear tags. Summary of the invention

[0004] The embodiments of the present application provide a method, apparatus, computer device, and storage medium for identifying ear tag types, which can improve the detection rate of risky ear tags by the model.

[0005] In a first aspect, an embodiment of the present application provides a method for identifying an ear tag type, which includes:

[0006] Acquire a target image of an ear tag to be identified;

[0007] Input the target image into a preset ear tag classification model, and obtain a first probability set, a second probability set, and a third probability set based on different loss functions, respectively, wherein the first probability set includes a first other type probability and a background probability, the second probability set includes a second other type probability and a normal ear tag type probability corresponding to each normal ear tag type, and the third probability set includes a third other type probability and a risk ear tag type probability corresponding to each risk ear tag type;

[0008] Update the normal ear tag type probabilities and the risk ear tag type probabilities according to the first other type probabilities, to obtain target normal ear tag type probabilities corresponding to each normal ear tag type and target risk ear tag type probabilities corresponding to each risk ear tag type;

[0009] The target ear tag type of the ear tag to be identified is determined according to the background probability, the probability of each target normal ear tag type and the probability of each target risk ear tag type.

[0010] In a second aspect, an embodiment of the present application further provides an ear tag type identification device, which includes:

[0011] A transceiver unit, configured to obtain a target image of an ear tag to be recognized;

[0012] A processing unit, configured to input the target image into a preset ear tag classification model, and respectively obtain a first probability set, a second probability set, and a third probability set based on different loss functions. The first probability set includes a first other type probability and a background probability. The second probability set includes a second other type probability and a normal ear tag type probability corresponding to each normal ear tag type. The third probability set includes a third other type probability and a risk ear tag type probability corresponding to each risk ear tag type. Update each normal ear tag type probability and each risk ear tag type probability according to the first other type probability, to obtain a target normal ear tag type probability corresponding to each normal ear tag type and a target risk ear tag type probability corresponding to each risk ear tag type. Determine the target ear tag type of the ear tag to be recognized according to the background probability, each target normal ear tag type probability, and each target risk ear tag type probability.

[0013] In a third aspect, an embodiment of the present application further provides a computer device, which includes a memory and a processor. A computer program is stored on the memory. When the processor executes the computer program, the above method is implemented.

[0014] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium. The storage medium stores a computer program. The computer program includes program instructions. When the program instructions are executed by a processor, the above method can be implemented.

[0015] The embodiments of the present application provide a method, apparatus, computer device, and storage medium for identifying ear tag types. Among them, the method includes: obtaining a target image of an ear tag to be identified; inputting the target image into a preset ear tag classification model, and respectively obtaining a first probability set, a second probability set, and a third probability set based on different loss functions. The first probability set includes a first other type probability and a background probability. The second probability set includes a second other type probability and a normal ear tag type probability corresponding to each normal ear tag type. The third probability set includes a third other type probability and a risk ear tag type probability corresponding to each risk ear tag type; updating each normal ear tag type probability and each risk ear tag type probability according to the first other type probability, to obtain a target normal ear tag type probability corresponding to each normal ear tag type and a target risk ear tag type probability corresponding to each risk ear tag type; determining the target ear tag type of the ear tag to be identified according to the background probability, each target normal ear tag type probability, and each target risk ear tag type probability. In the model in the embodiments of the present application, different loss functions are used to detect normal ear tag types and risk ear tag types respectively, and the detection of risk ear tag types will not be suppressed due to the imbalance in the number of samples between normal ear tag types and risk ear tag types, thereby improving the detection rate of the model for risk ear tags. Description of the Drawings

[0016] To more clearly illustrate the technical solutions of the embodiments of the present application, the following will briefly introduce the drawings required for the description of the embodiments. Obviously, the following drawings are some embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.

[0017] Figure 1 Schematic diagram of images of different ear tag types provided by the embodiments of the present application;

[0018] Figure 2 Schematic flow chart of the method for identifying ear tag types provided by the embodiments of the present application;

[0019] Figure 3 Schematic sub - flow chart of the method for identifying ear tag types provided by the embodiments of the present application;

[0020] Figure 4 Schematic diagram of a scenario of the method for identifying ear tag types provided by the embodiments of the present application;

[0021] Figure 5 Schematic block diagram of the apparatus for identifying ear tag types provided by the embodiments of the present application;

[0022] Figure 6Schematic block diagram of a computer device provided by an embodiment of the present application. Detailed implementation manners

[0023] The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present application without creative efforts shall fall within the protection scope of the present application.

[0024] It should be understood that when used in this specification and the appended claims, the terms "include" and "comprise" indicate the presence of the described features, wholes, steps, operations, elements, and / or components, but do not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components, and / or their combinations.

[0025] It should also be understood that the terms used in this specification of the present application are only for the purpose of describing specific embodiments and are not intended to limit the present application. As used in this specification of the present application and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an", and "the" are intended to include the plural forms.

[0026] It should be further understood that the term "and / or" used in this specification of the present application and the appended claims refers to any combination and all possible combinations of one or more of the associated listed items, and includes these combinations.

[0027] The embodiments of the present application provide a method, an apparatus, a computer device, and a storage medium for identifying ear tag types.

[0028] The execution subject of the method for identifying ear tag types may be the apparatus for identifying ear tag types provided by the embodiments of the present application, or a computer device integrated with the apparatus for identifying ear tag types. Among them, the apparatus for identifying ear tag types may be implemented in a hardware or software manner. The computer device may be a terminal or a server, and the terminal may be a smart phone, a tablet computer, a personal digital assistant, or a notebook computer, etc.

[0029] The following uses a specific example to describe the application scenario of the ear tag type recognition method provided by this application. Generally, to prove the identity of livestock (such as pigs), ear tags are worn on the ears of livestock. When the policyholder purchases insurance for the livestock, the ear tags worn by the livestock become an important basis for insurance claims. When the policyholder needs to apply for a claim for the livestock, they need to provide the insurance company with an image of the livestock including the ear tag. Due to the risk of insurance fraud through ear tag forgery, after receiving the image uploaded by the policyholder, the insurance company needs to conduct underwriting based on the image uploaded by the user. Specifically, the ear tag risk detection is performed on the image uploaded by the user through the ear tag type recognition method provided by this application to effectively detect ear tags with risks and reduce the risk of insurance fraud.

[0030] Specifically, the ear tag type recognition method provided in this embodiment can be applied to the insurance field and can be applied to the claim settlement scenario of livestock insurance. The user can input one or more images that need to be recognized for ear tag types at a time, and then the ear tag type recognition device inputs the images into the ear tag classification model. The ear tag classification model respectively determines the probability sets of different groups based on the loss functions of different groups, determines the probabilities of each ear tag type according to the probability sets of different groups, and outputs the ear tag type with the highest probability as the finally determined target ear tag type. If the target ear tag type is a risk ear tag type, it indicates that there is a risk of forgery in the ear tag in the image, and the claims adjuster is reminded to further verify the ear tag in the image.

[0031] As Figure 1 shown, in this embodiment, the normal ear tag types include bar ear tags, round ear tags, square ear tags, and triangular ear tags, and the risk ear tag types include handwritten ear tags and handwritten and altered ear tags. Taking this as an example, the ear tag type recognition method provided in the embodiments of this application is described. It should be noted that in actual business, there may also be other ear tag types, and this embodiment does not limit the specific ear tag types in the normal ear tag types and risk ear tag types.

[0032] In this embodiment, in the initial stage of the business, due to the small sample size, it is difficult to distinguish similar ear tags. Therefore, ear tags with similar shapes (such as the first ear tag and the second ear tag with similar shapes) are not distinguished and are classified into the mixed label sample set. As the business data increases, the number of the first ear tag and / or the second ear tag increases. Therefore, a separate category is added for the first ear tag and / or the second ear tag, that is, the first ear tag sample set and / or the second ear tag sample set are added. At this time, if the samples in the mixed label sample set need to be relabeled, the labeling cost is relatively high.

[0033] For example, from Figure 1It can be seen that there are 4 major types of normal ear tags in terms of morphology. Among them, the square ear tag and the triangular ear tag are more similar in morphology. If the triangular ear tag is blocked, it is difficult to accurately distinguish. Therefore, in the initial annotation process, the first batch of annotated dataset (mixed label sample set DatasetA) did not distinguish between square ear tags and triangular ear tags. Then, as the business data increased and the number of square ear tags increased, a separate category was added for square ear tags (such as the first ear tag sample set DatasetB). In this embodiment, the ear tag category labels are defined as [0: background; 1: bar ear tag; 2: round ear tag; 3: square ear tag; 4: triangular ear tag; 5: handwritten ear tag (i.e., handwritten and not altered); 6: handwritten and altered ear tag]. Then, 3 and 4 are not distinguished in DatasetA and belong to the same category. Considering the cost issue, one problem to be solved in this embodiment is to effectively utilize DatasetA and DatasetB without re-annotating.

[0034] To solve the above problems, in the classifier of the ear tag classification model in this embodiment, the grouped balanced cross-entropy is used as the loss function, which has strong inclusiveness for datasets with different annotations. As the business expands and the types of ear tags increase, new data can be efficiently utilized and the cost of re-annotating can be greatly saved. Among them, to achieve the above effects, the ear tag classification model provided in this embodiment is trained through the following steps:

[0035] Obtain a mixed label sample set and multiple single label sample sets. The single label sample sets include multiple ear tag samples with the same label. The mixed label sample set includes multiple ear tag samples corresponding to mixed labels. The mixed label is the first label or the second label, and the first label and the second label are labels of different ear tag types. For the mixed label sample set, adjust both the first label and the second label of the group label in the ear tag classification model to a unified label to obtain the adjusted group label, and perform convergence training on the ear tag classification model according to the adjusted group label and the ear tag samples in the mixed label sample set. The unified label is the first label or the second label. For each single label sample set, perform convergence training on the ear tag classification model according to the group label and the ear tag samples in the single label sample set.

[0036] Specifically, first, the confused labels existing in different datasets are grouped. Assume that the final task of the model in this application is a 7-classification task, and the true labels of normal detection boxes are [0, 1, 2, 3, 4, 5, 6]; for DatasetA, the square ear tags and triangular ear tags are not subdivided, so these two categories form a combination as a group, and the labels can be [0, 1, 2, 3, 3, 5, 6], or [0, 1, 2, 4, 4, 5, 6]; the categories with the same labels are a group, and combinations will occur when calculating the loss value loss. The loss function L i is defined as follows:

[0037]

[0038] In the formula, g is a group class, that is, a sample set with the same labels (including single labels and mixed labels). When the i-th ear tag sample belongs to g, p i,g = 1, otherwise, p i,g = 0; P g refers to the probability that the predicted value belongs to g.

[0039] Among them, P g is calculated through the following formula:

[0040]

[0041] In the formula, k is the current predicted classification of the ear tag sample, f j is the probability that the predicted value belongs to the j-th classification, and f k is the probability that the predicted value belongs to the k-th classification.

[0042] The following uses a specific example to illustrate the above description in detail:

[0043] For example, for the mixed label sample set, for the square ear tag in datasetA, the prediction is [-2.35, -1.4, 0.13, 1.14, 3.213, -9.12, 0.132]. Since this sample set is a mixed label sample set, the corresponding group label is [0, 1, 2, 3, 3, 5, 6]; since this ear tag sample is a square ear tag, then only when g = 3, p i,g = 1. Therefore, the specific calculation of the loss function is as follows:

[0044] L = -log P 3 ;

[0045] Among them,

[0046] In addition, for a single-label sample set, such as a circular ear tag sample set, if the prediction is also [-2.35, -1.4, 0.13, 1.14, 3.213, -9.12, 0.132], and the group label corresponding to the single-label sample set is [0, 1, 2, 3, 4, 5, 6]. Since this ear tag sample is a circular ear tag, then only when g = 2, p i,g = 1. Therefore, the specific calculation of the loss function is as follows:

[0047] L = -logP 2 ;

[0048] wherein,

[0049] In addition, through the embodiments of the present application, it is also possible to avoid the problem that the detection of the risk ear tag type is suppressed due to the imbalance in the number of samples between the normal ear tag type and the risk ear tag type.

[0050] Specifically, please refer to Figure 2 , Figure 2 which is a schematic flowchart of the method for identifying ear tag types provided by the embodiments of the present application. As Figure 2 shown, the method includes the following steps S110 - S140.

[0051] S110. Obtain a target image of the ear tag to be identified.

[0052] In this embodiment, the target image is an image that currently needs to be identified for the ear tag type.

[0053] Please refer to Figure 3 , specifically, in some embodiments, step S110 includes:

[0054] S1101. Obtain the original image of the ear tag to be identified.

[0055] Among them, the original image is an image required by the farmer to upload during the claim settlement process, and this image can be taken by the user himself.

[0056] S1102. Perform ear tag position detection processing on the original image to determine the target ear tag area.

[0057] S1103. Determine the image corresponding to the target ear tag area in the original image as the target image.

[0058] In this embodiment, for the original image uploaded by the user, the image content is diverse, there are pictures without ear tags, and the data volume is large. To improve the detection speed and accuracy, after obtaining the original image, it is first necessary to locate the ear tag position. Specifically, as Figure 4As shown in the figure, first, a pre-detection is performed on the feature map of the entire original image through a Region Proposal Network (RPN) to extract the boxes that may be ear tags. Then, through a pooling operation, the images where the boxes are located are cropped and scaled to local feature maps of the same size and input into the classifier of the ear tag classification model.

[0059] In some embodiments, if no box that may contain an ear tag is detected in the original image, the image is filtered.

[0060] S120: Input the target image into a preset ear tag classification model, and respectively obtain a first probability set, a second probability set, and a third probability set based on different loss functions. The first probability set includes a first other type probability and a background probability. The second probability set includes a second other type probability and a normal ear tag type probability corresponding to each normal ear tag type. The third probability set includes a third other type probability and a risk ear tag type probability corresponding to each risk ear tag type.

[0061] In this embodiment, the ear tag classification model sets opposing loss functions for multiple preset groups. Specifically, the model performs a balanced grouping according to the data volume of the categories. According to statistics, the ratio of normal ear tags to risk ear tags can reach 100:1. Therefore, when grouping, the 4 normal ear tags are defined as the head categories and classified into g1, the handwritten ear tags and the handwritten and altered ear tags are defined as the tail types and classified into g2, and g0 is used to distinguish the background from all ear tag categories.

[0062] The above multiple groups respectively include a first group corresponding to g0, a second group corresponding to g1, and a third group corresponding to g2.

[0063] Specifically, the first probability set corresponding to the first group includes a first other type probability and a background probability, where the first other type probability is the probability of other types predicted by the model except the background; the second probability set corresponding to the second group includes a second other type probability and a normal ear tag type probability corresponding to each normal ear tag type, where the second other type probability is the probability of other types predicted by the model except the normal ear tag types; the third probability set corresponding to the third group includes a third other type probability and a risk ear tag type probability corresponding to each risk ear tag type, where the third other type probability is the probability of other types predicted by the model except the risk ear tag types.

[0064] For example, the first probability set is [0.1, 0.9], where 0.1 is the first other type probability and 0.9 is the background probability; the second probability set is [0.92, 0.01, 0.02, 0.03, 0.02], where 0.95 is the second other type probability, and 0.01, 0.02, 0.03, and 0.02 are the probabilities corresponding to bar ear tags, round ear tags, square ear tags, and triangular ear tags respectively; the third probability set is [0.95, 0.02, 0.03], where 0.95 is the third other type probability, and 0.02 and 0.03 are handwritten ear tags and handwritten altered ear tags respectively.

[0065] It can be seen that in this embodiment, the loss functions between each group are calculated oppositely, so the small - magnitude categories will not be suppressed due to class imbalance; moreover, the head type and the tail type are completely non - overlapping. During the prediction process, the probability of this category can be directly extracted from different groups as the score.

[0066] S130. Update the normal ear tag type probabilities and the risk ear tag type probabilities according to the first other type probability, to obtain the target normal ear tag type probabilities corresponding to each normal ear tag type and the target risk ear tag type probabilities corresponding to each risk ear tag type.

[0067] In this embodiment, specifically, multiply each of the normal ear tag type probabilities by the first other type probability to obtain each of the target normal ear tag type probabilities; multiply each of the risk ear tag type probabilities by the first other type probability to obtain each of the target risk ear tag type probabilities.

[0068] S140. Determine the target ear tag type of the ear tag to be recognized according to the background probability, each of the target normal ear tag type probabilities, and each of the target risk ear tag type probabilities.

[0069] Specifically, determine the probability with the largest value among the background probability, each of the target normal ear tag type probabilities, and each of the target risk ear tag type probabilities as the target prediction probability; determine the ear tag type corresponding to the target prediction probability as the target ear tag type.

[0070] For example, when the first probability set, the second probability set, and the third probability set are [0.1, 0.9], [0.92, 0.01, 0.02, 0.03, 0.02], and [0.95, 0.02, 0.03] respectively, the first other type probability is 0.1. Multiply 0.1 by 0.01, 0.02, 0.03, and 0.02 respectively to obtain the probabilities of each normal ear tag type; multiply 0.1 by 0.02 and 0.03 respectively to obtain the probabilities of each risk ear tag type. The finally obtained target probability set is [0.9, 0.001, 0.002, 0.003, 0.002, 0.002, 0.003]. It can be seen that the probability of tag 0 is the largest. At this time, the target ear tag type corresponds to the background.

[0071] Another example, when the first probability set, the second probability set, and the third probability set are [0.9, 0.1], [0.1, 0.1, 0.74, 0.04, 0.02], and [0.95, 0.02, 0.03] respectively, according to the above calculation rules, the obtained target probability set is [0.1, 0.9, 0.666, 0.036, 0.018, 0.018, 0.027]. It can be seen that the probability of tag 2 is the largest. At this time, the target ear tag type corresponds to the circular ear tag.

[0072] In some embodiments, there are multiple target images; after determining the target ear tag type of the ear tag to be recognized according to the background probability, the probabilities of each target normal ear tag type, and the probabilities of each target risk ear tag type, the method further includes: filtering the images with the target ear tag type being the normal ear tag type among the multiple target images; adding a risk label to the filtered target images and outputting the target images with the risk label added.

[0073] It can be seen that through this embodiment, a large number of images can be recognized for the ear tag type, and the ear tag images with risks can be output for the staff to further confirm the risks, reducing the workload of the staff for ear tag recognition.

[0074] In summary, the present embodiment obtains a target image of an ear tag to be recognized; inputs the target image into a preset ear tag classification model, and respectively obtains a first probability set, a second probability set, and a third probability set based on different loss functions. The first probability set includes a first other type probability and a background probability. The second probability set includes a second other type probability and a normal ear tag type probability corresponding to each normal ear tag type. The third probability set includes a third other type probability and a risk ear tag type probability corresponding to each risk ear tag type. Updates each normal ear tag type probability and each risk ear tag type probability according to the first other type probability, to obtain a target normal ear tag type probability corresponding to each normal ear tag type and a target risk ear tag type probability corresponding to each risk ear tag type. Determines the target ear tag type of the ear tag to be recognized according to the background probability, each target normal ear tag type probability, and each target risk ear tag type probability. The model in the embodiment of the present application uses different loss functions to respectively detect normal ear tag types and risk ear tag types, and will not suppress the detection of risk ear tag types due to the imbalance in the number of samples between normal ear tag types and risk ear tag types, thereby improving the detection rate of the model for risk ear tags.

[0075] Figure 5 It is a schematic block diagram of an ear tag type recognition device 500 provided by an embodiment of the present application. As Figure 5 shown, corresponding to the above ear tag type recognition method, the present application also provides an ear tag type recognition device 500. The ear tag type recognition device 500 includes units for executing the above ear tag type recognition method, and the ear tag type recognition device 500 can be configured in terminals such as desktop computers, tablet computers, laptops, etc. Specifically, please refer to Figure 5 , the ear tag type recognition device 500 includes a transceiver unit 501 and a processing unit 502, where:

[0076] The transceiver unit 501 is configured to obtain a target image of an ear tag to be recognized;

[0077] The processing unit 502 is configured to input the target image into a preset ear tag classification model, and respectively obtain a first probability set, a second probability set, and a third probability set based on different loss functions. The first probability set includes a first other type probability and a background probability. The second probability set includes a second other type probability and a normal ear tag type probability corresponding to each normal ear tag type. The third probability set includes a third other type probability and a risk ear tag type probability corresponding to each risk ear tag type. Update the normal ear tag type probabilities and the risk ear tag type probabilities according to the first other type probability, so as to obtain a target normal ear tag type probability corresponding to each normal ear tag type and a target risk ear tag type probability corresponding to each risk ear tag type. Determine the target ear tag type of the ear tag to be recognized according to the background probability, the target normal ear tag type probabilities, and the target risk ear tag type probabilities.

[0078] In some embodiments, when the processing unit 502 executes the step of updating the normal ear tag type probabilities and the risk ear tag type probabilities according to the first other type probability to obtain a target normal ear tag type probability corresponding to each normal ear tag type and a target risk ear tag type probability corresponding to each risk ear tag type, it is specifically configured to:

[0079] Multiply each of the normal ear tag type probabilities by the first other type probability to obtain each of the target normal ear tag type probabilities;

[0080] Multiply each of the risk ear tag type probabilities by the first other type probability to obtain each of the target risk ear tag type probabilities.

[0081] In some embodiments, when the processing unit 502 executes the step of determining the target ear tag type of the ear tag to be recognized according to the background probability, the target normal ear tag type probabilities, and the target risk ear tag type probabilities, it is specifically configured to:

[0082] Determine the probability with the largest value among the background probability, the target normal ear tag type probabilities, and the target risk ear tag type probabilities as the target prediction probability; determine the ear tag type corresponding to the target prediction probability as the target ear tag type.

[0083] In some embodiments, the processing unit 502 trains the ear tag classification model through the following steps:

[0084] Obtain a set of hybrid tag samples and multiple sets of single-tag samples through the transceiver unit 501. Each set of single-tag samples includes multiple ear tag samples with the same tag. The set of hybrid tag samples includes ear tag samples corresponding to multiple hybrid tags. The hybrid tag is the first tag or the second tag, and the first tag and the second tag are tags of different ear tag types. For the set of hybrid tag samples, adjust both the first tag and the second tag of the group tag in the ear tag classification model to a unified tag to obtain an adjusted group tag, and perform convergence training on the ear tag classification model according to the adjusted group tag and the ear tag samples in the set of hybrid tag samples. The unified tag is the first tag or the second tag. For each set of single-tag samples, perform convergence training on the ear tag classification model according to the group tag and the ear tag samples in the set of single-tag samples.

[0085] In some embodiments, when the transceiver unit 501 executes the step of obtaining the target image of the ear tag to be recognized, it is specifically configured to:

[0086] Obtain the original image of the ear tag to be recognized; perform ear tag position detection processing on the original image through the processing unit 502 to determine the target ear tag area; determine the image corresponding to the target ear tag area in the original image as the target image.

[0087] In some embodiments, there are multiple target images. After the processing unit 502 executes the step of determining the target ear tag type of the ear tag to be recognized according to the background probability, the probability of each target normal ear tag type, and the probability of each target risk ear tag type, it is further configured to:

[0088] Filter the images with the target ear tag type being the normal ear tag type among the multiple target images; mark the filtered target images with a risk identifier and output the target images marked with the risk identifier.

[0089] In some embodiments, the normal ear tag types include bar ear tags, circular ear tags, square ear tags, and triangular ear tags, and the risk ear tag types include handwritten ear tags and handwritten altered ear tags.

[0090] In summary, the model in the ear tag type recognition device 500 according to the embodiments of the present application uses different loss functions to detect the normal ear tag type and the risk ear tag type respectively, and will not suppress the detection of the risk ear tag type due to the imbalance in the number of samples between the normal ear tag type and the risk ear tag type, thereby improving the detection rate of the model for risk ear tags.

[0091] It should be noted that those skilled in the art can clearly understand that the specific implementation processes of the above ear tag type recognition device and each unit can refer to the corresponding descriptions in the foregoing method embodiments. For the convenience and conciseness of description, they will not be elaborated herein.

[0092] The above ear tag type recognition device can be implemented in the form of a computer program, and this computer program can run on a computer device as shown in Figure 6 the following.

[0093] Please refer to Figure 6 , Figure 6 which is a schematic block diagram of a computer device provided by an embodiment of the present application. The computer device 600 can be a terminal or a server. Among them, the terminal can be an electronic device with a communication function such as a smart phone, a tablet computer, a notebook computer, a desktop computer, a personal digital assistant, and a wearable device. The server can be an independent server or a server cluster composed of multiple servers.

[0094] Referring to Figure 6 , the computer device 600 includes a processor 602, a memory, and a network interface 605 connected through a system bus 601. Among them, the memory can include a non-volatile storage medium 603 and an internal memory 604.

[0095] The non-volatile storage medium 603 can store an operating system 6031 and a computer program 6032. The computer program 6032 includes program instructions. When the program instructions are executed, the processor 602 can be caused to execute a method for recognizing an ear tag type.

[0096] The processor 602 is used to provide computing and control capabilities to support the operation of the entire computer device 600.

[0097] The internal memory 604 provides an environment for the operation of the computer program 6032 in the non-volatile storage medium 603. When the computer program 6032 is executed by the processor 602, the processor 602 can be caused to execute a method for recognizing an ear tag type.

[0098] The network interface 605 is used for network communication with other devices. Those skilled in the art can understand that Figure 6 the structure shown in

[0099] 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 600 to which the solution of the present application is applied. The specific computer device 600 may include more or fewer components than those shown in the figure, or combine some components, or have a different component layout. Among them, the processor 602 is used to run the computer program 6032 stored in the memory to implement the following steps:

[0100] Obtain a target image of the ear tag to be recognized;

[0101] Input the target image into a preset ear tag classification model, and respectively obtain a first probability set, a second probability set, and a third probability set based on different loss functions. The first probability set includes a first other type probability and a background probability. The second probability set includes a second other type probability and a normal ear tag type probability corresponding to each normal ear tag type. The third probability set includes a third other type probability and a risk ear tag type probability corresponding to each risk ear tag type;

[0102] Update each normal ear tag type probability and each risk ear tag type probability according to the first other type probability, and obtain a target normal ear tag type probability corresponding to each normal ear tag type and a target risk ear tag type probability corresponding to each risk ear tag type;

[0103] Determine the target ear tag type of the ear tag to be recognized according to the background probability, each target normal ear tag type probability, and each target risk ear tag type probability.

[0104] In some embodiments, when the processor 602 implements the step of updating each normal ear tag type probability and each risk ear tag type probability according to the first other type probability, and obtaining a target normal ear tag type probability corresponding to each normal ear tag type and a target risk ear tag type probability corresponding to each risk ear tag type, the specific implementation is as follows:

[0105] Multiply each normal ear tag type probability by the first other type probability to obtain each target normal ear tag type probability;

[0106] Multiply each risk ear tag type probability by the first other type probability to obtain each target risk ear tag type probability.

[0107] In some embodiments, when the processor 602 implements the step of determining the target ear tag type of the ear tag to be recognized according to the background probability, each target normal ear tag type probability, and each target risk ear tag type probability, the specific implementation is as follows:

[0108] Determine the probability with the largest value among the background probability, each target normal ear tag type probability, and each target risk ear tag type probability as the target prediction probability;

[0109] Determine the ear tag type corresponding to the target prediction probability as the target ear tag type.

[0110] In some embodiments, when the processor 602 trains the ear tag classification model, the following steps are specifically implemented:

[0111] Obtain a mixed label sample set and multiple single label sample sets. The single label sample sets include multiple ear tag samples with the same label. The mixed label sample set includes ear tag samples corresponding to multiple mixed labels. The mixed label is the first label or the second label, and the first label and the second label are labels of different ear tag types;

[0112] For the mixed label sample set, adjust both the first label and the second label of the group label in the ear tag classification model to a unified label to obtain an adjusted group label, and perform convergence training on the ear tag classification model according to the adjusted group label and the ear tag samples in the mixed label sample set. The unified label is the first label or the second label;

[0113] For each of the single label sample sets, perform convergence training on the ear tag classification model according to the group label and the ear tag samples in the single label sample set.

[0114] In some embodiments, when the processor 602 implements the step of obtaining the target image of the ear tag to be recognized, the following steps are specifically implemented:

[0115] Obtain the original image of the ear tag to be recognized;

[0116] Perform ear tag position detection processing on the original image to determine the target ear tag area;

[0117] Determine the image corresponding to the target ear tag area in the original image as the target image.

[0118] In some embodiments, there are multiple target images. After the processor 602 implements the step of determining the target ear tag type of the ear tag to be recognized according to the background probability, the probability of each target normal ear tag type, and the probability of each target risk ear tag type, the following steps are further implemented:

[0119] Filter the images among the multiple target images whose target ear tag type is a normal ear tag type;

[0120] Attach a risk identifier to the target images obtained after filtering, and output the target images with the risk identifier attached.

[0121] In some embodiments, the normal ear tag types include bar ear tags, circular ear tags, square ear tags, and triangular ear tags, and the risk ear tag types include handwritten ear tags and handwritten altered ear tags.

[0122] It should be understood that in the embodiments of the present application, the processor 602 may be a central processing unit (CPU), and the processor 602 may also be other general-purpose processors, digital signal processors (DSPs), application specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), 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.

[0123] Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be completed by instructing relevant hardware through a computer program. The computer program includes program instructions, and the computer program can be stored in a storage medium, and the storage medium is a computer-readable storage medium. The program instructions are executed by at least one processor in the computer system to implement the process steps of the embodiments of the above methods.

[0124] Therefore, the present application also provides a storage medium. The storage medium may be a computer-readable storage medium. The storage medium stores a computer program, where the computer program includes program instructions. When the program instructions are executed by a processor, the processor performs the following steps:

[0125] Obtain a target image of the ear tag to be recognized;

[0126] Input the target image into a preset ear tag classification model, and respectively obtain a first probability set, a second probability set, and a third probability set based on different loss functions. The first probability set includes a first other type probability and a background probability. The second probability set includes a second other type probability and a normal ear tag type probability corresponding to each normal ear tag type. The third probability set includes a third other type probability and a risk ear tag type probability corresponding to each risk ear tag type;

[0127] Update the normal ear tag type probabilities and the risk ear tag type probabilities according to the first other type probability to obtain a target normal ear tag type probability corresponding to each normal ear tag type and a target risk ear tag type probability corresponding to each risk ear tag type;

[0128] Determine the target ear tag type of the ear tag to be recognized according to the background probability, the target normal ear tag type probabilities, and the target risk ear tag type probabilities.

[0129] In some embodiments, when the processor executes the program instructions to implement the step of updating each normal ear tag type probability and each risk ear tag type probability according to the first other type probability, and obtaining the target normal ear tag type probability corresponding to each normal ear tag type and the target risk ear tag type probability corresponding to each risk ear tag type, the specific implementation is as follows:

[0130] Multiply each of the normal ear tag type probabilities by the first other type probability to obtain each of the target normal ear tag type probabilities;

[0131] Multiply each of the risk ear tag type probabilities by the first other type probability to obtain each of the target risk ear tag type probabilities.

[0132] In some embodiments, when the processor executes the program instructions to implement the step of determining the target ear tag type of the ear tag to be recognized according to the background probability, each of the target normal ear tag type probabilities, and each of the target risk ear tag type probabilities, the specific implementation is as follows:

[0133] Determine the probability with the largest value among the background probability, each of the target normal ear tag type probabilities, and each of the target risk ear tag type probabilities as the target prediction probability;

[0134] Determine the ear tag type corresponding to the target prediction probability as the target ear tag type.

[0135] In some embodiments, when the processor trains the ear tag classification model, the specific implementation is as follows:

[0136] Obtain a mixed label sample set and a plurality of single label sample sets. The single label sample sets include a plurality of ear tag samples with the same label, and the mixed label sample set includes a plurality of ear tag samples corresponding to mixed labels. The mixed label is the first label or the second label, and the first label and the second label are labels of different ear tag types;

[0137] For the mixed label sample set, adjust both the first label and the second label of the group label in the ear tag classification model to a unified label to obtain an adjusted group label, and perform convergence training on the ear tag classification model according to the adjusted group label and the ear tag samples in the mixed label sample set. The unified label is the first label or the second label;

[0138] For each of the single label sample sets, perform convergence training on the ear tag classification model according to the group label and the ear tag samples in the single label sample set.

[0139] In some embodiments, when the processor executes the program instructions to implement the step of obtaining the target image of the ear tag to be recognized, the following specific steps are implemented:

[0140] Obtain the original image of the ear tag to be recognized;

[0141] Perform ear tag position detection processing on the original image to determine the target ear tag area;

[0142] Determine the image corresponding to the target ear tag area in the original image as the target image.

[0143] In some embodiments, there are multiple target images; after the processor executes the program instructions to implement the step of determining the target ear tag type of the ear tag to be recognized according to the background probability, the probability of each target normal ear tag type, and the probability of each target risk ear tag type, the following steps are further implemented:

[0144] Filter the images with the target ear tag type of normal ear tag type among the multiple target images;

[0145] Mark the filtered target images with risk marks and output the target images marked with risk marks.

[0146] In some embodiments, the normal ear tag types include bar ear tags, round ear tags, square ear tags, and triangular ear tags, and the risk ear tag types include handwritten ear tags and handwritten altered ear tags.

[0147] The storage medium can be various computer-readable storage media such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a magnetic disk, or an optical disc that can store program codes.

[0148] Those of ordinary skill in the art can realize that the units and algorithm steps of each example described in combination with the embodiments disclosed herein can be implemented by electronic hardware, computer software, or a combination of the two. To clearly illustrate the interchangeability of hardware and software, the components and steps of each example have been generally described according to functions in the above description. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Professional technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of this application.

[0149] In several embodiments provided by 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 merely illustrative. For example, the division of each unit is only a logical function division, and there may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed.

[0150] The steps in the method embodiments of the present application can be adjusted, combined, and deleted according to actual needs. The units in the device embodiments of the present application can be combined, divided, and deleted according to actual needs. In addition, the functional units in each embodiment of the present application can be integrated in a processing unit, or each unit can exist physically alone, or two or more units can be integrated in one unit.

[0151] 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 storage medium. Based on this understanding, the technical solution of the present application, in essence, 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. The computer software product is stored in a storage medium and includes several instructions for causing a computer device (which can be a personal computer, a terminal, or a network device, etc.) to execute all or part of the steps of the methods described in each embodiment of the present application.

[0152] As described above, the above are only specific embodiments of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art within the technical scope disclosed by the present application can easily think of various equivalent modifications or substitutions, and these modifications or substitutions should be covered by the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.

Claims

1. A method for identifying ear tag types, characterized in that: include: Acquire a target image of an ear tag to be identified; Input the target image into a preset ear tag classification model, and obtain a first probability set, a second probability set, and a third probability set based on different loss functions, respectively, wherein the first probability set includes a first other type probability and a background probability, the second probability set includes a second other type probability and a normal ear tag type probability corresponding to each normal ear tag type, and the third probability set includes a third other type probability and a risk ear tag type probability corresponding to each risk ear tag type; Update the normal ear tag type probabilities and the risk ear tag type probabilities according to the first other type probabilities, to obtain target normal ear tag type probabilities corresponding to each normal ear tag type and target risk ear tag type probabilities corresponding to each risk ear tag type; The target ear tag type of the ear tag to be identified is determined according to the background probability, the probability of each target normal ear tag type and the probability of each target risk ear tag type.

2. The method according to claim 1, characterized in that The updating of each of the normal ear tag type probabilities and each of the risk ear tag type probabilities according to the first other type probabilities to obtain target normal ear tag type probabilities corresponding to each normal ear tag type and target risk ear tag type probabilities corresponding to each risk ear tag type includes: Multiplying each of the normal ear tag type probabilities by the first other type probability to obtain each of the target normal ear tag type probabilities; Each of the risk ear tag type probabilities is multiplied by the first other type probability to obtain each of the target risk ear tag type probabilities.

3. The method according to claim 1, characterized in that The step of determining the target ear tag type of the ear tag to be identified according to the background probability, the probability of each target normal ear tag type, and the probability of each target risk ear tag type includes: The probability with the largest median value among the background probability, the normal ear tag type probabilities of the targets, and the risk ear tag type probabilities of the targets is determined as the target prediction probability; The ear tag type corresponding to the target prediction probability is determined as the target ear tag type.

4. The method according to claim 1, characterized in that: The ear tag classification model is trained by the following steps: Acquire a mixed label sample set and multiple single label sample sets, wherein the single label sample set includes multiple ear tag samples with the same label, and the mixed label sample set includes multiple ear tag samples corresponding to the mixed labels, wherein the mixed label is the first label or the second label, and the first label and the second label are labels of different ear tag types; For the mixed label sample set, the first label and the second label of the group label in the ear label classification model are adjusted to a unified label to obtain an adjusted group label, and the ear label classification model is converged according to the adjusted group label and the ear label samples in the mixed label sample set, and the unified label is the first label or the second label; For each of the single-label sample sets, convergence training is performed on the ear tag classification model according to the group label and the ear tag samples in the single-label sample set.

5. The method according to claim 1, characterized in that The step of obtaining a target image of an ear tag to be identified comprises: Acquire the original image of the ear tag to be identified; Performing ear tag position detection processing on the original image to determine a target ear tag area; An image corresponding to the target ear mark area in the original image is determined as the target image.

6. The method according to claim 1, characterized in that There are multiple target images; after determining the target ear tag type of the ear tag to be identified according to the background probability, the probability of each target normal ear tag type and the probability of each target risk ear tag type, the method further includes: Performing filtering processing on images whose target ear label type is a normal ear label type among the plurality of target images; A risk mark is added to the target image obtained after filtering, and the target image with the risk mark is output.

7. The method according to any one of claims 1 to 6, characterized in that The normal ear tag types include bar ear tags, round ear tags, square ear tags and triangular ear tags, and the risky ear tag types include handwritten ear tags and handwritten altered ear tags.

8. An ear tag type identification device, characterized in that: include: A transceiver unit, used to obtain a target image of an ear tag to be identified; A processing unit is used to input the target image into a preset ear tag classification model, and obtain a first probability set, a second probability set and a third probability set based on different loss functions, wherein the first probability set includes a first other type probability and a background probability, the second probability set includes a second other type probability and a normal ear tag type probability corresponding to each normal ear tag type, and the third probability set includes a third other type probability and a risk ear tag type probability corresponding to each risk ear tag type; update each normal ear tag type probability and each risk ear tag type probability according to the first other type probability, and obtain a target normal ear tag type probability corresponding to each normal ear tag type and a target risk ear tag type probability corresponding to each risk ear tag type; determine the target ear tag type of the ear tag to be identified according to the background probability, each target normal ear tag type probability and each target risk ear tag type probability.

9. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the method for identifying the ear tag type according to any one of claims 1 to 7 is implemented.

10. A storage medium, characterized in that: The storage medium stores a computer program, wherein the computer program includes program instructions, and when the program instructions are executed by a processor, the processor executes the ear tag type recognition method according to any one of claims 1 to 7.