Dairy cow body shape character intelligent evaluation model determination method, application method and device

By using the GBDT classifier and Faster R-CNN model in the dairy cow body shape trait assessment system, combined with hardware and light source design, a stable intelligent assessment model for dairy cow body shape traits is constructed, which solves the problems of poor model generalization and high assessment cost, and achieves efficient and accurate dairy cow body shape assessment.

CN120656205AActive Publication Date: 2025-09-16INST OF ANIMAL SCI & VETERINARY MEDICINE SHANDONG ACADEMY OF AGRI SCI +1
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
CN202510735933.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-04
Publication Date
2025-09-16
Estimated Expiration
2045-06-04

AI Technical Summary

Technical Problem

The existing dairy cow body conformation trait assessment system model has poor generalization ability, and the training set collection and labeling process is cumbersome and complicated, requiring the participation of a large number of professional and technical personnel, resulting in high costs and the risk of disease transmission.

Method used

Cameras with different fields of view are used to obtain historical images of cow body traits. Detection box annotation and linear calculation are performed using the GBDT classifier and Faster R-CNN model to build an intelligent assessment model for cow body traits. Hardware design and light source design are combined to ensure stable image quality, and Gaussian distribution and feature mapping are used for scoring.

Benefits of technology

It realizes accurate and convenient evaluation of dairy cow body traits, shortens evaluation time, reduces costs, reduces the influence of subjective factors, and improves breeding efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120656205A_ABST
    Figure CN120656205A_ABST
Patent Text Reader

Abstract

The invention discloses a dairy cow body shape character intelligent evaluation model determination method, an application method and a device, and relates to the field of computer vision, and the model comprises the steps: obtaining a plurality of dairy cow historical body shape character images; performing scoring and detection frame labeling on each dairy cow historical body shape character image; performing linear calculation on the detection frames of the plurality of marked images to obtain a plurality of corresponding calculation values; forming a feature group by a plurality of corresponding calculation values; performing supervised learning on the machine learning classification model by taking the feature groups as features and taking the corresponding marks as labels; when the correct rate does not reach the standard, returning to carry out detection frame labeling on each cow body shape character image; and when the standard is reached, obtaining an intelligent evaluation model for the body shape character of the dairy cow. According to the invention, an accurate and practical body shape character intelligent determination evaluation score result can be provided, the evaluation time can be greatly shortened, the manual work intensity and the influence of subjective factors can be reduced, the cost can be reduced, and the epidemic disease transmission risk caused by personnel flow can be reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer vision technology, and in particular to a method for determining an intelligent assessment model for dairy cow body shape traits, an application method, and a device. Background Art

[0002] With the development of modern agriculture, the efficiency of dairy cow production has become a focus of attention for many livestock farmers. Holstein cows are one of the most popular dairy cattle breeds worldwide, and their high yield and high-quality dairy products are widely used in both domestic and industrial production. However, the body shape of Holstein cows is crucial to their athletic health, production level, and productive lifespan. Traditional methods for assessing dairy cow body shape traits typically rely on manual visual inspection, which requires highly skilled professional technicians and presents challenges such as time-consuming and costly work, subjectivity, and the spread of disease. To address these issues, intelligent technologies such as computer vision (CV) are gradually being applied to the field of dairy cow body shape trait assessment. By employing techniques such as image processing and machine learning, CV technology can accurately and rapidly extract and assess Holstein cow body shape trait data.

[0003] The automatic scoring system for Holstein cow conformation traits based on CV technology has been widely recognized and researched in the livestock farming industry, and related patents have emerged one after another. However, most patents cannot avoid the following problems:

[0004] Current research relies primarily on simple CV techniques, resulting in poor model generalization and a poor implementation for big data production. This is primarily due to the fact that modeling data is largely based on offline datasets, the primary problem with offline data being poor generalization. This means that varying environments, lighting, camera brand, and camera location can significantly impact model accuracy. The size and quality of the training set are crucial to model accuracy and generalization. Therefore, to improve generalization, a large amount of training data is required. However, this leads to another problem: the training set collection and annotation process for existing Holstein cow automatic scoring systems is cumbersome and complex, requiring the involvement of numerous specialized technicians, resulting in high costs and risks in practical applications.

[0005] Therefore, how to provide dairy farmers with accurate and convenient body shape improvement assessment data results, shorten the assessment time, reduce costs, reduce the impact of subjective factors and disease transmission, provide dairy farmers with accurate data for breeding management, and thus improve breeding efficiency has become a technical problem that needs to be solved urgently in this field. Summary of the Invention

[0006] The purpose of this application is to provide a method, application method and device for determining an intelligent assessment model for the body traits of dairy cows, which can provide dairy cow farmers with accurate and convenient body trait assessment results. Through intelligent technology, it can greatly shorten the assessment time, reduce costs, reduce the influence of subjective factors, and provide dairy cow farmers with more effective breeding management methods and improve breeding efficiency.

[0007] To achieve the above objectives, this application provides the following solutions:

[0008] First, the present application provides a method for determining an intelligent assessment model for dairy cow body traits, the method comprising:

[0009] Acquire a number of historical body shape and trait images of dairy cows; the historical body shape and trait images of dairy cows are images obtained based on cameras with different field of view.

[0010] Each of the cow's historical body trait images is scored to obtain a plurality of scored first images.

[0011] A detection frame is marked on each of the historical body shape and trait images of the dairy cow to obtain a plurality of marked first images.

[0012] A linear calculation is performed on the detection frames of the plurality of labeled first images to obtain a plurality of corresponding first calculation values.

[0013] A plurality of corresponding first calculated values ​​constitute a first feature group; the first feature group corresponds to a plurality of scored first images.

[0014] Using the first feature group as features and the corresponding scores as labels, supervised learning is performed on the machine learning classification model; the machine learning classification model is a GBDT (Gradient Boosting Decision Tree) classifier.

[0015] Determine whether the accuracy rate meets the standard and obtain the first judgment result.

[0016] If the first judgment result is no, the step returns to "marking each of the historical body shape trait images of the dairy cow with a detection frame to obtain a plurality of marked first images."

[0017] If the first judgment result is yes, an intelligent assessment model for the body shape traits of dairy cows is obtained.

[0018] Second, the present application provides a method for applying an intelligent assessment model for dairy cow body traits, the method comprising:

[0019] Acquire a number of images of the body shape and characteristics of dairy cows to be detected; the images of the body shape and characteristics of dairy cows to be detected are images obtained by cameras based on different fields of view.

[0020] Using the CV detection model, each image of the cow's body shape and trait to be detected is annotated with a detection frame to obtain several annotated second images; the CV detection model is a model obtained by annotating historical cow body shape and trait images with detection frames using rules by data annotation experts and training an image detection algorithm; the image detection algorithm is the multi-stage object detection algorithm Faster R-CNN.

[0021] It is determined whether the detection frame of the marked second image is complete to obtain a second determination result.

[0022] If the second judgment result is no, the process returns to "obtaining several images of cow body shape and characteristics to be detected".

[0023] If the second judgment result is yes, linear calculation is performed on the detection frames of the plurality of marked second images to obtain a plurality of corresponding second calculation values.

[0024] A plurality of corresponding second calculated values ​​constitute a second feature group.

[0025] The second feature group is input as a feature into the intelligent assessment model of dairy cow body traits to obtain a corresponding trait score; the intelligent assessment model of dairy cow body traits is a model trained based on the above-mentioned method for determining the intelligent assessment model of dairy cow body traits.

[0026] Combine several trait scores and take the mode as the final trait score for the trait.

[0027] Third, the present application provides a computer device, comprising: a memory, a processor, and a computer program stored in the memory and runnable on the processor, wherein the processor executes the computer program to implement the above-mentioned method for determining an intelligent assessment model for the body traits of dairy cows or the above-mentioned method for applying an intelligent assessment model for the body traits of dairy cows.

[0028] Fourth, the present application provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the above-mentioned method for determining an intelligent assessment model for the body traits of dairy cows or the above-mentioned method for applying an intelligent assessment model for the body traits of dairy cows.

[0029] Fifth, the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the above-mentioned method for determining an intelligent assessment model for the body traits of dairy cows or implements the above-mentioned method for applying an intelligent assessment model for the body traits of dairy cows.

[0030] According to the specific embodiments provided in this application, this application discloses the following technical effects:

[0031] The present application provides a method, application method and device for determining an intelligent assessment model for body traits of dairy cows, the method comprising: obtaining a plurality of historical body trait images of dairy cows; the historical body trait images of dairy cows are images obtained by cameras based on different fields of view; scoring the trait of each of the historical body trait images of dairy cows to obtain a plurality of scored first images; annotating a detection frame of each of the historical body trait images of dairy cows to obtain a plurality of annotated first images; performing linear calculation on the detection frames of the plurality of annotated first images to obtain a plurality of corresponding first calculated values; and using the first calculated values ​​to respectively evaluate a plurality of target images. Calculate the target classification and obtain a calculated value for each target classification; then, form a first feature group with several corresponding first calculated values; the first feature group corresponds to several scored first images; supervised learning is performed on the machine learning classification model using the first feature group as features and the corresponding scores as labels; the machine learning classification model is a GBDT classifier; determine whether the accuracy meets the standard and obtain a first judgment result; if the first judgment result is no, return "label each of the historical body trait images of the dairy cow with a detection box to obtain several labeled first images"; if the first judgment result is yes, obtain an intelligent assessment model for dairy cow body trait. The machine learning classification model is trained using the first feature group and the corresponding scores to obtain an intelligent assessment model for dairy cow body trait. This model can solve the problems of tedious and complicated training set collection and labeling processes in existing technologies, which require the participation of a large number of professional and technical personnel, and have high costs and risks in practical applications. It can provide livestock farmers with accurate and convenient body trait assessment results. Through intelligent technology, it can greatly shorten the assessment time, reduce costs, and reduce the influence of subjective factors. It can also provide livestock farmers with more effective breeding management methods and improve breeding efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0032] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0033] Figure 1 This is a schematic diagram of the design ideas of this application.

[0034] Figure 2 This is an application environment diagram of a method for determining an intelligent assessment model for dairy cow body traits in this application.

[0035] Figure 3 A flowchart of a method for determining an intelligent assessment model for dairy cow body traits provided in one embodiment of the present application.

[0036] Figure 4 This is a diagram illustrating the marking effect provided in one embodiment of the present application.

[0037] Figure 5 This is a Gaussian distribution function image provided by an embodiment of the present application.

[0038] Figure 6 This is an accuracy diagram of the overall system provided in one embodiment of the present application.

[0039] Figure 7 This is an overall flow chart of trait scoring provided in one embodiment of the present application.

[0040] Figure 8 A flowchart of an application method of an intelligent assessment model for dairy cow body traits provided in one embodiment of the present application.

[0041] Figure 9 A schematic diagram of the structure of a computer device provided in one embodiment of the present application. DETAILED DESCRIPTION

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

[0043] In order to make the above-mentioned purposes, features and advantages of the present application more obvious and easy to understand, the present application is further described in detail below with reference to the accompanying drawings and specific implementation methods.

[0044] This application involves a hardware system (including the design of a channel for cattle to pass through, the design of the position of the data acquisition camera and the design of the fill light source) and AI-related computer vision technology (target detection). By effectively combining the two methods and collecting the image data of the body traits of cattle in a fixed manner, the image quality used for model evaluation can be ensured to be stable. In this relatively stable environment, the main improvements of this application are the annotation method of candidate features, machine learning modeling design and scoring mapping. Among them, the scoring mapping includes the feature processing of the model inference output detection frame and the mapping of the processed data to the score. Later in the actual production process, the cows are processed by the frame cutting of the video stream to obtain the body trait image of the cow to be inferred. The image is then sent to the model for inference, and the specified feature information of the cow is calculated according to a specific calculation method. Finally, the score (1-9 points) of the corresponding feature is mapped by the function to achieve the purpose of automatic cattle scoring. The overall design idea is as follows Figure 1 shown.

[0045] The method for determining an intelligent assessment model for dairy cow body traits provided in the embodiment of the present application can be applied to Figure 2In the application environment shown. Among them, the terminal 102 communicates with the server 104 through the network. The data storage system can store the data that the server 104 needs to process. The data storage system can be set up separately, integrated on the server 104, or placed on the cloud or other servers. The terminal 102 can send a number of historical body trait images of dairy cows to the server 104, and the historical body trait images of dairy cows are images obtained based on cameras with different field of view; after the server 104 receives the number of historical body trait images of dairy cows, for the number of historical body trait images of dairy cows, the server 104 performs trait scoring on each of the historical body trait images of dairy cows to obtain a number of scored first images; performs detection frame annotation on each of the historical body trait images of dairy cows to obtain a number of annotated first images; performs linear calculation on the detection frames of the several annotated first images to obtain a number of corresponding first images. A calculated value; several corresponding first calculated values ​​are used to form a first feature group; the first feature group corresponds to several scored first images; supervised learning is performed on the machine learning classification model using the first feature group as features and the corresponding scores as labels; the machine learning classification model is a GBDT classifier; whether the accuracy rate meets the standard is determined to obtain a first judgment result; if the first judgment result is negative, the method returns "labeling each of the historical cow body trait images with a detection frame to obtain several labeled first images"; if the first judgment result is positive, the method obtains an intelligent cow body trait assessment model. Server 104 can provide feedback on the obtained intelligent cow body trait assessment model to terminal 102. In addition, in some embodiments, the method for determining the intelligent assessment model for the body traits of dairy cows can also be implemented independently by the server 104 or the terminal 102. For example, the terminal 102 can directly train the intelligent assessment model for the body traits of dairy cows based on a number of historical body trait images of dairy cows, or the server 104 can obtain a number of historical body trait images of dairy cows from a data storage system and train the intelligent assessment model for the body traits of dairy cows based on a number of historical body trait images of dairy cows.

[0046] The terminal 102 may be, but is not limited to, various desktop computers, laptop computers, smart phones, and tablet computers. The server 104 may be implemented as an independent server or a server cluster consisting of multiple servers, or a cloud server.

[0047] In an exemplary embodiment, Figure 3 As shown, a method for determining an intelligent assessment model for body traits of dairy cows is provided. The method is executed by a computer device, specifically a computer device such as a terminal or a server, or a terminal and a server. In the embodiment of the present application, the method is applied to Figure 2 The server 104 in the example is used for explanation, and the steps include the following steps A1 to A9.

[0048] in:

[0049] A1: Acquire a number of historical body shape and trait images of dairy cows; the historical body shape and trait images of dairy cows are images obtained based on cameras with different field of view.

[0050] A2: Score each of the cow's historical body trait images to obtain a plurality of scored first images.

[0051] A3: Marking each of the historical cow body shape and trait images with a detection frame to obtain a plurality of marked first images.

[0052] A4: Perform linear calculation on the detection frames of the plurality of annotated first images to obtain a plurality of corresponding first calculation values.

[0053] A5: Constitute a first feature group from a plurality of corresponding first calculated values; the first feature group corresponds to a plurality of scored first images.

[0054] A6: Using the first feature group as features and the corresponding scores as labels, supervised learning is performed on the machine learning classification model; the machine learning classification model is a GBDT classifier.

[0055] A7: Determine whether the accuracy rate meets the standard and obtain the first judgment result.

[0056] A8: If the first judgment result is no, then return to "marking each of the historical body shape trait images of the dairy cow with a detection frame to obtain a plurality of marked first images."

[0057] A9: If the first judgment result is yes, then an intelligent assessment model for the cow's body shape traits is obtained.

[0058] Implementing steps A1 to A9 above can provide livestock farmers with accurate and convenient body conformation trait assessment results. Intelligent technology can significantly shorten assessment time, reduce costs, and mitigate the influence of subjective factors. This can also provide livestock farmers with more effective breeding management methods and improve breeding efficiency.

[0059] As an optional implementation, in step A1, a number of historical body shape and trait images of dairy cows are obtained, specifically including:

[0060] A11: Obtain historical body trait videos of several dairy cows.

[0061] A12: Cut the frames of the historical body shape and trait video of each dairy cow to obtain a plurality of first images after cutting the frames.

[0062] A13: Capture sub-images at specific positions of the first image after each frame is cut to obtain several historical body shape and trait images of dairy cows.

[0063] Specifically, this application is based on a hardware design solution, and the video frame rate, camera width and height parameters, and total video length are all known information. In this embodiment, the video is first cut into frames, and then sub-images at specific locations in the image are captured to obtain a relatively accurate image of the cow's body shape and characteristics. The data collection time for a single cow is set to approximately 10 seconds. During this process, the video stream is captured multiple times per second and stored as data set augmentation.

[0064] Based on the above steps, a relatively stable data source can be obtained. By extracting frames from the video stream, a pool of images is obtained. Random images are then acquired from this pool. The images acquired vary slightly depending on the process. During the training phase, the images must be clear (as determined by livestock experts). During the inference process, a strategy of randomly extracting images is adopted, and the inference model itself assists in determining whether the images are qualified. Furthermore, because different cameras capture different traits, the modeling process performs an independent modeling process for each camera's field of view (i.e., each camera has its own corresponding model).

[0065] As an optional implementation, in step A2, each of the cow's historical body trait images is scored to obtain a plurality of scored first images, specifically including:

[0066] Based on each of the historical body trait images of the dairy cow, the animal husbandry expert uses experience to score the trait and obtains a plurality of scored first images.

[0067] Specifically, 1,000 data were randomly selected (according to the experimental table name, this method can achieve good results with this number). Animal husbandry experts visually scored the pictures of cattle taken by the camera based on the acquired pictures. The feature selection and scoring annotation method in this embodiment mainly refers to the expert scoring points for the body shape of dairy cows in the "Chinese Holstein Cattle Body Shape Identification and Scoring Standard", that is, the description of the visual features for the evaluation of dairy cows. For example, for the buttocks of dairy cows, it should be as wide as possible and firmly connected to the back. The value range of this scoring scheme is a discrete score of 1-9. The corresponding table of cameras and scoring features is as follows:

[0068] Table 1 Correspondence table of camera and acquired trait part features

[0069]

[0070] As an optional implementation, in step A3, each of the historical cow body trait images is annotated with a detection frame to obtain a plurality of annotated first images, specifically including:

[0071] A CV detection model is used to annotate each of the cow's historical body trait images with a detection frame to obtain several annotated first images; the CV detection model is a model obtained by annotating the cow's historical body trait images with detection frames using rules by data annotation experts and training an image detection algorithm; the image detection algorithm is a multi-stage object detection algorithm Faster R-CNN.

[0072] As an optional implementation, the method for determining the CV detection model specifically includes:

[0073] a1: Obtain several historical body shape and trait images of dairy cows and corresponding detection frames; the detection frames corresponding to the historical body shape and trait images of dairy cows are detection frames annotated by data annotation experts using rules.

[0074] a2: Using historical cow body trait images as input and corresponding detection boxes as output, the image detection algorithm is trained to obtain a CV detection model.

[0075] Specifically, for the data scored by the experts, the detection frames are annotated based on a specific data annotation scheme. When designing the annotation scheme, the goal is to design the annotation scheme so that the detection frame can well represent the excellence of the cow's rump width feature. At the same time, when designing the specific design, it is necessary to approach it from the perspective of maximizing the model's ability to learn features when formulating the annotation specifications. That is, it is necessary to make it clear that the model is good at learning features such as some color blocks and image edges. In other words, when formulating the specifications, it is necessary to pay attention to finding some lines, edges, or some local color blocks and other distinguishing information at the cow's features. For example, for the rump width, it is defined as: the lower boundary of the frame is the tangent line of the upper edge of the ischium of the two hind limbs, the left and right boundaries are the tangent lines on both sides of the ischium, and the upper boundary of the frame is the upper edge of the coccyx. The annotation effect is as follows Figure 4 shown.

[0076] After marking the corresponding detection frame, combined with the expert score, the detection frame of the trait can be statistically counted, and the expert score is used as the classification basis (1-9 points means nine categories). After a linear calculation (such as the value obtained by dividing the height by the width), the characteristics of the Gaussian distribution are obtained. In actual practice, the distribution diagram is as follows Figure 5 As shown in the figure, each Gaussian distribution represents the statistical Gaussian distribution of all detection boxes in a score classification, with scores from 1 to 9 from left to right.

[0077] For this linear calculation, the Gaussian distribution is considered because it is also called the normal distribution. It is a continuous probability distribution and is often used to describe phenomena in nature because many traits show a distribution pattern similar to the Gaussian distribution in their natural state. In nature, many traits, such as height, weight, IQ scores, etc., are Gaussian distributed. This is because these traits are the result of the combined influence of many different genes and environmental factors, and the combined effect of these multiple factors causes the changes in traits to conform to the law of Gaussian distribution. Therefore, the Gaussian distribution method is used to record this value. The formula is as follows:

[0078]

[0079] in, represents normal distribution, x represents sample, μ represents expected mean, and σ represents standard deviation.

[0080] The above form is based on a continuous random variable with only one variable dimension, so it is also called a univariate Gaussian distribution. Obviously, μ here represents the "core difference" between different scoring values. Figure 5 The eight superimposed Gaussian distribution curves represent the differences between the nine scores for the buttocks width attribute. You can see that the means are arranged in order on the X-axis.

[0081] Here, for each trait, a different mapping method should be designed to convert the detection characteristics of the trait into one or several floating-point numbers, and then use enough labeled data to form the entire Gaussian distribution. The conversion method includes but is not limited to calculating the aspect ratio of the detection frame, the relative position offset of the two detection frames, etc. The output is a numerical value, which is given by the model. After linear transformation, whether it can be mapped into an expert score, the effectiveness of the standard setting and conversion method can be evaluated. In this embodiment, the binary method is used to record the labeled data, that is, for each detection frame, it will be recorded in the system as the following structure:

[0082] Instance:<Xmin,Ymin,Xmax,Ymax> ;

[0083] Where instance represents the entity of the detection box, and the four values ​​represent the coordinates of the upper left corner and lower right corner of a detection box.

[0084] Common formulas include but are not limited to the following:

[0085] Aspect Ratio:

[0086] Relative phase difference:

[0087] angle

[0088] In either case, the detection box can be well mapped to a point on the Gaussian distribution. This method is sufficiently stable.

[0089] CV detection model recognition is performed on the labeled data. The detection model here is based on the most advanced and fast multi-stage object detection algorithm Faster R-CNN. As the name suggests, Faster R-CNN has a faster detection speed than Fast R-CNN. The main reasons are as follows: First, in terms of the model structure, FasterRCNN has integrated the four major tasks of feature extraction, possible detection area selection, and bounding box regression and bounding box classification into a single network structure, which further improves the model detection performance, especially in terms of detection speed. The Faster R-CNN model contains the following four main structures:

[0090] 1) Convolutional layers: They use multiple convolution kernels and stack multiple layers of convolution to extract multiple layer features from the original image, and obtain feature maps for the image and its anchor points, which are used to provide input features and decision-making basis for subsequent modules.

[0091] 2) Region Proposal Layer: This network provides the model with possible image region proposals that may contain genetic features. It uses a softmax function to predict the category of the anchor point, that is, whether it is a follow-up to a feature region, and corrects the position of the candidate region.

[0092] 3) Roi Pooling: This layer aggregates the outputs of the convolutional layer and the region proposal network, performs feature extraction, and obtains enhanced feature maps for the final prediction.

[0093] 4) Classifier: After obtaining the Roi Pooling of each candidate region, predict the category and correct the coordinates of the candidate box again. For this application, the classifier classification target is the features in all the marked boxes.

[0094] This model architecture explains why the selected genetic features should have easily recognizable edges, such as bone edges. This allows the region proposal network to better locate the feature region and accurately determine its location. Through repeated training iterations, a stable Faster RCNN detection model is achieved.

[0095] Among these, we use the mean average precision (mAP) method as a stable evaluation metric. mAP is the average of the mean precision (AP). Assume there are k categories of objects in the test set. First, calculate the AP of our model for each category, then add these APs together and divide by the total number of categories, k, to obtain the final mAP of the model.

[0096] Adjusting the confidence threshold can yield different prediction results, resulting in different precision and recall rates. A similar concept, called the Intersection-over-Union (IoU) threshold, is introduced here. For an object of a certain category in an image, the model predicts a corresponding bounding box, but the IoU (Interference-over-Union) between these predicted bounding boxes can be very small or very large.

[0097] So if the IoU corresponding to the bounding box is greater than a certain threshold (the IoU threshold used in this example is 0.5), we can say that the predicted bounding box is correct, or can be classified as TP. Conversely, if the IoU is less than the threshold, then the predicted bounding box is wrong, or a FP. If the model does not predict the corresponding bounding box for an object in the image, this situation can be recorded as a FN.

[0098] With TP, FP, and FN, we can calculate precision and recall. By adjusting the IoU threshold, we can plot a PR curve for each object category. Therefore, for each object category in the object detection test dataset, we can plot a corresponding PR curve for the model. From this PR curve, we can obtain the AP value corresponding to the PR curve.

[0099] In terms of generalization, Faster R-CNN has good generalization performance in target detection tasks. It uses a feature pyramid network to process objects of different sizes, and uses a RoI pooling layer to perform regional sampling of objects of different sizes, thereby improving the detection performance of objects of different shapes. In addition, Faster R-CNN also uses an RPN network to generate candidate boxes, which can effectively reduce the number of candidate boxes, thereby improving the detection speed of the algorithm. During the training process, Faster R-CNN also uses a number of techniques to enhance the generalization performance of the model, such as data enhancement, especially the mentioned object edge enhancement and dropout. In summary, Faster R-CNN has good generalization performance and can be applied to applications that require target detection in real scenarios.

[0100] Import the same batch of data into the model formula. Then, obtain the corresponding feature detection boxes detected by the model. Note that there will be slight differences between the detection boxes here and the manually annotated detection boxes. The manually annotated boxes are the ground truth values, while the obtained feature detection boxes are the values ​​inferred by the model in the actual production environment. However, by ensuring that the model converges and stabilizes in the previous steps, this error will be kept within a small range.

[0101] The obtained detection frame is linearly calculated to obtain a corresponding calculated value. Then the corresponding distribution of the 9 target categories is obtained. Therefore, the obtained calculated value can be calculated for the 9 target categories respectively, and 9 corresponding calculated values ​​are obtained. These 9 calculated values ​​are assembled into a feature group with a width of 9. Here, the selected mapping method is the one-by-one difference method, that is, a new frame is obtained and the μ of the 9 Gaussian distributions of GroundTurth is subtracted to form a feature group, that is:

[0102] Feature=<μ-μ i >*9(where i∈1-9);

[0103] Supervised learning is performed using the obtained feature groups as features and the obtained scores as labels. In this method, GBDT is selected as the classifier for this nine-category classification. GBDT is a machine learning method and a type of ensemble learning. It performs prediction and classification by gradually training multiple decision trees. The main idea is to train multiple decision trees, each of which has low complexity, and then through continuous iteration and optimization, eventually fuse them into a complex model. During the training process, each decision tree corrects the prediction of the previous tree. Negative gradients are used for updates during training, a strategy known as gradient boosting.

[0104] GBDT was chosen primarily for its excellent performance in multi-classification. The feature is a float-type feature group with a dimension of 9, which perfectly complements GBDT's highly adaptable nature. During GBDT training, the model can adaptively adjust to changes in the data, thereby improving the accuracy of predictions. Extensive data processing, such as normalization and feature scaling, is unnecessary, saving processing time and computing resources.

[0105] In terms of robustness, GBDT employs a random forest approach when building decision trees. This approach mitigates overfitting by randomly selecting parameters such as data, features, and tree depth. Furthermore, GBDT builds multiple decision trees for prediction, and the final prediction result is the average or weighted average of the predictions from these trees. Even if a single tree exhibits prediction error, the overall model's predictions remain relatively stable, ensuring a stable multi-classifier for the system.

[0106] The overall model stability is assessed in a comprehensive assessment. Although the two models are trained independently, they ultimately serve the same goal: prediction accuracy. If accuracy falls short, the labeling scheme is adjusted and the entire process is repeated. If accuracy meets the target, a camera-specific CV detection model and machine learning classification model are obtained.

[0107] like Figure 6 The accuracy loss of the overall step is shown in the figure. The model deviation mainly comes from the multiplication of Fast R-CNN and GBDT (because GBDT takes into account the overall feature set composed of Gaussian distribution to reduce deviation). The stability of these two models has been fully discussed. Therefore, they can provide stable accuracy for the entire system.

[0108] For single-image model evaluation, we used the most basic multi-classification model evaluation method:

[0109]

[0110] During the inference process, which is the actual production process, random images will continue to be captured from the video stream as the cow passes through the hardware channel. However, the image acceptance criteria have changed from what humans consider to be clear to whether the CV detection model can detect all the frames. If it can, the image passes. If not, the system needs to select a new one.

[0111] For all qualified images, the corresponding frame values ​​will be calculated. A total of 5 qualified images must be obtained before proceeding to the next step.

[0112] Here, we combine the obtained feature values ​​with the features to assemble machine learning features, and then call the obtained machine learning model to perform the final nine-category classification. Each feature has exactly one classification label. Therefore, for the corresponding camera position, we can obtain scores for all observable features.

[0113] A total of five such photos are required, so for each feature, the five votes are used to vote, and the score with the most votes is output as the final score. For example, if two photos give a feature a score of 4, and three photos give it a score of 5, the final score for that feature will be 5.

[0114] Therefore, the evaluation rules of the entire system will further offset the instability of single image evaluation that may be caused by various reasons. That is, for single image accuracy, the following are further adopted:

[0115]

[0116] In this way, as long as the system ensures that the number of correct judgments is greater than the number of incorrect ones, that is, the accuracy of single-card judgment is greater than 50% (in addition, the accuracy of the random model is 1 / 9), the voting method can ultimately provide the correct result.

[0117] For the entire system above, the use of fixed hardware channels, fixed light sources (uniform shooting quality), and the final voting scoring system (single classification accuracy greater than 50% means there is a high probability of correct judgment) ensures the robustness and stability of the system as a whole. In terms of the model itself, the characteristics of biological features that conform to the natural Gaussian distribution are combined to perform feature (space → floating point) transformation, and a Fast R-CNN model with an IOU mechanism is added in the front. The edge characteristics of the organism itself are fully highlighted through the design of hardware and light sources to ensure that Fast R-CNN can achieve the best effect; the classic and highly stable tree classification model GBDT is connected at the end. The entire automatic scoring system thus constructed has an overall robust and stable effect. The overall flow chart of trait scoring is as follows Figure 7 shown.

[0118] In an exemplary embodiment, Figure 8 As shown, a method for applying an intelligent assessment model for dairy cow body traits is provided, and the method for applying an intelligent assessment model for dairy cow body traits comprises:

[0119] B1: Acquire a number of images of the body shape and characteristics of dairy cows to be detected; the images of the body shape and characteristics of dairy cows to be detected are images obtained by cameras based on different fields of view.

[0120] B2: Using a CV detection model, each image of the cow's body shape and trait to be detected is annotated with a detection frame to obtain several annotated second images. The CV detection model is a model obtained by training an image detection algorithm based on rules used by data annotation experts to annotate historical images of cows' body shape and trait with detection frames. The image detection algorithm is the multi-stage object detection algorithm Faster R-CNN.

[0121] B3: Determine whether the annotated detection frame of the second image is complete, and obtain a second determination result.

[0122] B4: If the second judgment result is no, then return to "obtaining several images of cow body shape characteristics to be detected".

[0123] B5: If the second judgment result is yes, perform linear calculation on the detection frames of the plurality of labeled second images to obtain a plurality of corresponding second calculation values.

[0124] B6: Constitute a second feature group from a number of corresponding second calculated values.

[0125] B7: Input the second feature group as features into the intelligent assessment model for dairy cow body traits to obtain corresponding trait scores; the intelligent assessment model for dairy cow body traits is a model trained based on the above-mentioned method for determining the intelligent assessment model for dairy cow body traits.

[0126] B8: Combine several trait scores and take the mode as the final trait score for the trait.

[0127] As an optional implementation, in step B1, obtaining a number of images of the body shape and characteristics of cows to be detected specifically includes:

[0128] B101: Obtain videos of the body shape and characteristics of several dairy cows to be tested.

[0129] B102: Cut the frames of the video of the body shape and characteristics of each cow to be tested to obtain a plurality of second images after cutting the frames.

[0130] B103: Capturing sub-images at specific positions of each second frame-sliced ​​image to obtain a number of cow body shape and trait images to be detected.

[0131] In an exemplary embodiment, a computer device is provided. The computer device may be a server or a terminal. The internal structure diagram thereof may be as follows: Figure 9 As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, abbreviated as I / O) and a communication interface. The processor, memory and input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and computer program in the non-volatile storage medium. The database of the computer device is used to store a number of historical body shape trait images of dairy cows. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a method for determining an intelligent assessment model for dairy cow body shape traits or a method for applying an intelligent assessment model for dairy cow body shape traits is implemented.

[0132] Those skilled in the art will understand that Figure 9 The structure shown in the figure 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 shown in the figure, or combine certain components, or have a different component arrangement.

[0133] In an exemplary embodiment, a computer device is further provided, including a memory and a processor. The memory stores a computer program, and the processor implements the above method embodiments when executing the computer program.

[0134] In an exemplary embodiment, a computer-readable storage medium is provided, storing a computer program, which implements the above-mentioned method embodiments when executed by a processor.

[0135] In an exemplary embodiment, a computer program product is provided, including a computer program. When the computer program is executed by a processor, the above method embodiments are implemented.

[0136] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.

[0137] Those skilled in the art will appreciate that all or part of the processes in the above-mentioned embodiment methods can be implemented by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, database or other media used in the embodiments provided in this application may include at least one of non-volatile and volatile memory. Non-volatile memory may include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory may include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM may be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM).

[0138] The databases involved in the various embodiments provided herein may include at least one of a relational database and a non-relational database. Non-relational databases may include, but are not limited to, distributed databases based on blockchains. The processors involved in the various embodiments provided herein may include, but are not limited to, general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic units, data processing logic units based on quantum computing, and the like.

[0139] The technical features of the above embodiments can be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0140] This document uses specific examples to illustrate the principles and implementation methods of this application. The description of the above examples is only intended to help understand the method and core concept of this application. At the same time, for those skilled in the art, based on the concept of this application, there may be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as limiting this application.

Claims

1. A method for determining an intelligent assessment model for dairy cow body traits, characterized in that: The method for determining the intelligent assessment model for dairy cow body traits comprises: Acquire a number of historical body shape and trait images of dairy cows; the historical body shape and trait images of dairy cows are images obtained based on cameras with different field of view; Scoring the characteristics of each of the historical body shape and characteristics images of the dairy cow to obtain a plurality of scored first images; Performing detection frame annotation on each of the historical body shape and trait images of the dairy cow to obtain a plurality of annotated first images; Performing linear calculation on the detection frames of the plurality of annotated first images to obtain a plurality of corresponding first calculation values; forming a first feature group from a plurality of corresponding first calculated values; wherein the first feature group corresponds to a plurality of scored first images; Using the first feature group as features and the corresponding scores as labels, supervised learning is performed on the machine learning classification model; the machine learning classification model is a GBDT classifier; Determine whether the accuracy rate meets the standard and obtain the first judgment result; If the first judgment result is no, then return to "marking each of the historical body shape trait images of the dairy cow with a detection frame to obtain a plurality of marked first images"; If the first judgment result is yes, an intelligent assessment model for the body shape traits of dairy cows is obtained.

2. The method for determining an intelligent assessment model for dairy cow body traits according to claim 1, characterized in that: Obtain historical body trait images of several dairy cows, including: Obtain historical body trait videos of several dairy cows; Cut the historical body shape and trait video of each dairy cow to obtain the first images after cutting several frames; A sub-image at a specific position is captured from the first image after each frame is cut, and several historical body shape and trait images of dairy cows are obtained.

3. The method for determining an intelligent assessment model for dairy cow body shape traits according to claim 1, characterized in that: Scoring the characteristics of each of the cow's historical body trait images to obtain a plurality of scored first images, specifically including: Based on each of the historical body trait images of the dairy cow, the animal husbandry expert uses experience to score the trait and obtains a plurality of scored first images.

4. The method for determining an intelligent assessment model for dairy cow body shape traits according to claim 1, characterized in that: Performing detection frame annotation on each of the cow's historical body shape and trait images to obtain a plurality of annotated first images, specifically including: A CV detection model is used to annotate each of the historical body trait images of the cow with a detection frame to obtain several annotated first images; the CV detection model is a model obtained by annotating the historical body trait images of the cow with detection frames using rules by data annotation experts and training an image detection algorithm; the image detection algorithm is a multi-stage object detection algorithm Faster R-CNN.

5. The method for determining an intelligent assessment model for dairy cow body shape traits according to claim 4, characterized in that: The method for determining the CV detection model specifically includes: Obtaining a number of historical body shape and trait images of dairy cows and corresponding detection frames; the detection frames corresponding to the historical body shape and trait images of dairy cows are detection frames obtained by data annotation experts using rules; The image detection algorithm is trained with the historical body trait images of dairy cows as input and the corresponding detection boxes as output to obtain the CV detection model.

6. A method for applying an intelligent assessment model for dairy cow body traits, characterized in that: The application method of the intelligent assessment model for dairy cow body shape traits includes: Acquire a plurality of images of the body shape and characteristics of dairy cows to be detected; the images of the body shape and characteristics of dairy cows to be detected are images obtained by cameras based on different fields of view; Using a CV detection model, each image of the cow's body trait to be detected is annotated with a detection frame to obtain several annotated second images. The CV detection model is based on data annotation experts using rules to annotate historical images of cows' body trait with detection frames, and then trained with an image detection algorithm. The image detection algorithm is the multi-stage object detection algorithm Faster R-CNN. Determining whether the detection frame of the annotated second image is complete to obtain a second determination result; If the second judgment result is no, then return to "obtaining several images of cow body shape characteristics to be detected"; If the second judgment result is yes, performing linear calculation on the detection frames of the plurality of annotated second images to obtain a plurality of corresponding second calculation values; forming a second feature group from a plurality of corresponding second calculated values; Inputting the second feature group as a feature into an intelligent assessment model for dairy cow body traits to obtain a corresponding trait score; the intelligent assessment model for dairy cow body traits is a model trained based on the method for determining an intelligent assessment model for dairy cow body traits according to any one of claims 1 to 5; Combine several trait scores and take the mode as the final trait score for the trait.

7. The method for applying the intelligent assessment model for dairy cow body shape traits according to claim 6, characterized in that: Obtain several images of cow body shape traits to be tested, including: Obtain videos of the body shape traits of several cows to be tested; Cut the frames of the video of the body shape and characteristics of each cow to be tested to obtain a plurality of second images after cutting the frames; Sub-images at specific positions are captured from each second frame-sliced ​​image to obtain several cow body shape and trait images to be detected.

8. A computer device comprising: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the method for determining an intelligent assessment model for dairy cow body traits according to any one of claims 1 to 5 or the method for applying an intelligent assessment model for dairy cow body traits according to any one of claims 6 to 7.

9. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method for determining an intelligent assessment model for dairy cow body shape traits according to any one of claims 1 to 5 or the method for applying an intelligent assessment model for dairy cow body shape traits according to any one of claims 6 to 7 is realized.

10. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the method for determining an intelligent assessment model for dairy cow body shape traits according to any one of claims 1 to 5 or the method for applying an intelligent assessment model for dairy cow body shape traits according to any one of claims 6 to 7 is realized.

Citation Information

Patent Citations

  • PDA (personal digital assistance) method for linear grading of body type of dairy cow

    CN102693348A

  • Automatic cow body condition scoring method and scoring device

    CN105844534A

  • Intelligent scoring system for dairy cow body condition based on deep learning and long-distance video

    CN109508907A

  • Dairy cow body condition scoring method based on improved YOLOv7 model

    CN118196837A

  • Sheep face expression recognition method, system and device and medium

    CN119360420A