Method, device, electronic device and storage medium for predicting weight of dairy buffalo
By constructing a feature extraction model and weight prediction model, and using the point cloud data on the back of the milk buffalo to calculate its predicted weight, it solves the problems of time-consuming, operational difficulties and stress response in the traditional method, and achieves efficient and accurate weight acquisition of the milk buffalo.
Patent Information
- Application Number
- CN202411454661.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-17
- Publication Date
- 2025-02-14
- Estimated Expiration
- 2044-10-17
AI Technical Summary
The traditional method of obtaining weight of milk buffalo is time-consuming, difficult to operate, and is prone to cause stress response of milk buffalo, which cannot meet the situation where large-scale feedlots or high-precision weight data are required.
By obtaining the point cloud data of the back of milk buffalo from different perspectives, a feature extraction model and the weight prediction model of milk buffalo were constructed, and the fusion features constructed from the key points and corresponding length information of the cow back were extracted, and input them into the weight prediction model to calculate the predicted weight.
It achieves rapid, simple and stress-free acquisition of milk buffalo weight, improves weight acquisition efficiency, and is suitable for large-scale feed farms and situations where high-precision data is required.
Smart Images

Figure CN118968102B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of evaluating the weight of dairy buffaloes, and in particular to a method, device, electronic device and storage medium for predicting the weight of dairy buffaloes. Background Art
[0002] Weight is an important indicator for evaluating the growth and development of dairy buffaloes, and has a wide range of applications and important significance for the feeding and management of dairy buffaloes. By regularly measuring and monitoring the weight changes of dairy buffaloes, it is possible to evaluate whether the nutritional supply of dairy buffaloes is sufficient, judge their reproductive performance, predict the time of delivery, determine milk production performance, and achieve disease early warning. Weight changes can help breeders adjust feed formulas and feeding management strategies to ensure that dairy buffaloes get enough nutrition and maintain good health and production capacity.
[0003] The traditional weighing method requires guiding the buffaloes to a weighing device and recording their weight, which is not only inefficient and may have measurement errors, but it can also easily cause stress reactions in the buffaloes. The traditional weighing method is not suitable for large-scale feedlots or situations where more accurate weight data is required.
[0004] Therefore, in order to solve the technical problems that the traditional method of obtaining the weight of dairy buffaloes is time-consuming, difficult to operate and easy to cause stress reactions in dairy buffaloes when using dairy buffalo scales, a dairy buffalo weight prediction method, device, electronic device and storage medium are urgently needed. Summary of the invention
[0005] The purpose of the present application is to provide a method, device, electronic device and storage medium for predicting the weight of a dairy buffalo. A fusion feature constructed by key points on the back of a cow and corresponding length information is extracted through a feature extraction model, and the fusion feature is input into a dairy buffalo weight prediction model to calculate the predicted weight result of the dairy buffalo to be tested. The problem that the traditional method for obtaining the weight of dairy buffalo is time-consuming, difficult to operate and easy to cause stress reaction in dairy buffaloes when using a dairy buffalo scale is solved. The weight of dairy buffaloes can be calculated objectively, quickly, simply and without stress, thereby improving the efficiency of obtaining the weight of dairy buffaloes.
[0006] In a first aspect, the present application provides a method for predicting the weight of a dairy buffalo, comprising:
[0007] Obtaining back point cloud data of the tested dairy buffalo when standing at different viewing angles, and obtaining a dairy buffalo weight training sample in a database; the dairy buffalo weight training sample includes historical dairy buffalo back point cloud data and corresponding historical key point data, historical length information and historical weight results;
[0008] De-noising the back point cloud data to obtain de-noised back point cloud data of the dairy buffalo;
[0009] Constructing a feature extraction model and a dairy buffalo weight prediction model based on the historical dairy buffalo back point cloud data and the corresponding historical key point data, historical length information and historical weight results;
[0010] Inputting the denoised dairy buffalo back point cloud data into the feature extraction model to obtain fusion features constructed by the key points of the cow back and the corresponding length information;
[0011] The fusion feature is input into the dairy buffalo weight prediction model to calculate the predicted weight result of the dairy buffalo to be tested.
[0012] The dairy buffalo weight prediction method provided in the present application can predict the weight of the dairy buffalo. A fusion feature constructed by the key points of the cow's back and the corresponding length information is extracted through a feature extraction model, and the fusion feature is input into the dairy buffalo weight prediction model to calculate the predicted weight result of the dairy buffalo to be tested. The problem that the traditional dairy buffalo weight acquisition method has the defects of being time-consuming, difficult to operate and easy to cause stress reaction in the dairy buffalo when using a dairy buffalo scale is solved. The dairy buffalo weight can be calculated objectively, quickly, simply and stress-free, thereby improving the efficiency of dairy buffalo weight acquisition.
[0013] Optionally, obtaining back point cloud data of the tested dairy buffalo when standing at different viewing angles includes:
[0014] Acquire the back point cloud data of the dairy buffalo to be tested at different viewing angles;
[0015] The back point cloud data of the dairy buffalo to be tested when standing is extracted from the back point cloud data of the dairy buffalo.
[0016] The buffalo weight prediction method provided in the present application can predict the buffalo weight. By obtaining the back point cloud data of the buffalo when standing, the impact of the buffalo posture differences can be reduced, which is conducive to improving the efficiency of obtaining the buffalo weight.
[0017] Optionally, the feature extraction model is an SC3K-Transformer model; and the dairy buffalo weight prediction model is a fully connected network model.
[0018] Optionally, a feature extraction model and a dairy buffalo weight prediction model are constructed based on the historical dairy buffalo back point cloud data and the corresponding historical key point data, historical length information and historical weight results, including:
[0019] Extracting point cloud data in a standing posture from the historical dairy buffalo back point cloud data and performing denoising to obtain historical dairy buffalo back point cloud data in a standing posture;
[0020] According to the historical dairy buffalo standing posture back point cloud data and the corresponding historical key point data, historical length information and historical weight results, the SC3K-Transformer model and the fully connected network model are respectively constructed to obtain the feature extraction model and the dairy buffalo weight prediction model.
[0021] The dairy buffalo weight prediction method provided in the present application can predict the weight of the dairy buffalo. By extracting the point cloud data in the standing posture from the historical dairy buffalo back point cloud data and performing denoising, the accuracy of the feature extraction model and the dairy buffalo weight prediction model can be improved, which is beneficial to improving the efficiency of obtaining the dairy buffalo's weight.
[0022] Optionally, according to the historical dairy buffalo standing posture back point cloud data and the corresponding historical key point data, historical length information and historical weight results, the SC3K-Transformer model and the fully connected network model are respectively constructed to obtain the feature extraction model and the dairy buffalo weight prediction model, including:
[0023] Constructing an SC3K-Transformer model corresponding to the historical dairy buffalo standing posture back point cloud data, and constructing a fully connected network model corresponding to the historical key point data and the historical length information, to obtain a preliminary feature extraction model and a preliminary dairy buffalo weight prediction model;
[0024] According to the point cloud data used for training in the historical point cloud data of the back of the standing posture of the dairy buffalo and the corresponding historical key point data, historical length information and historical weight results, the preliminary feature extraction model and the preliminary dairy buffalo weight prediction model are trained to obtain the trained preliminary feature extraction model and the trained preliminary dairy buffalo weight prediction model;
[0025] Based on the point cloud data not used for training in the historical dairy buffalo standing posture back point cloud data and the corresponding historical key point data, historical length information and historical weight results, the trained preliminary feature extraction model and the trained preliminary dairy buffalo weight prediction model are verified to obtain the feature extraction model and the dairy buffalo weight prediction model.
[0026] Optionally, the preliminary feature extraction model and the preliminary dairy buffalo weight prediction model are trained according to the point cloud data used for training in the historical dairy buffalo standing posture back point cloud data and the corresponding historical key point data, historical length information and historical weight results, to obtain the trained preliminary feature extraction model and the trained preliminary dairy buffalo weight prediction model, including:
[0027] Inputting the point cloud data used for training in the historical dairy buffalo standing posture back point cloud data into the preliminary feature extraction model to obtain a corresponding first fusion output; the first fusion output includes a first key point output and a first length output;
[0028] Determine a first training error according to the historical dairy buffalo standing posture back point cloud data, historical key point data, historical length information, and the corresponding first key point output and first length output, and optimize the preliminary feature extraction model based on the first training error to obtain the trained preliminary feature extraction model;
[0029] Inputting the point cloud data used for training in the historical dairy buffalo standing posture back point cloud data into the trained preliminary feature extraction model to obtain a corresponding second fusion output; the second fusion output includes a second key point output and a second length output;
[0030] Inputting the corresponding second fusion output into the preliminary dairy buffalo weight prediction model to obtain a corresponding weight output;
[0031] According to the historical dairy buffalo standing posture back point cloud data and the corresponding historical weight results and the corresponding weight output, a second training error is determined, and based on the second training error, the preliminary dairy buffalo weight prediction model is optimized to obtain the trained preliminary dairy buffalo weight prediction model.
[0032] Optionally, before inputting the point cloud data used for training in the historical dairy buffalo standing posture back point cloud data into the preliminary feature extraction model to obtain the corresponding first fusion output, the method further includes:
[0033] Initialize the preliminary dairy buffalo weight prediction model and the parameters of the preliminary dairy buffalo weight prediction model.
[0034] In a second aspect, the present application provides a device for predicting the weight of a dairy buffalo, comprising:
[0035] An acquisition module is used to acquire back point cloud data of the tested dairy buffalo when standing at different viewing angles, and to acquire a dairy buffalo weight training sample in a database; the dairy buffalo weight training sample includes historical dairy buffalo back point cloud data and corresponding historical key point data, historical length information and historical weight results;
[0036] A denoising module, used for denoising the back point cloud data to obtain denoised back point cloud data of the dairy buffalo;
[0037] A construction module, used to construct a feature extraction model and a dairy buffalo weight prediction model based on the historical dairy buffalo back point cloud data and the corresponding historical key point data, historical length information and historical weight results;
[0038] An input module, used to input the denoised dairy buffalo back point cloud data into the feature extraction model to obtain a fusion feature constructed by the key points of the cow back and the corresponding length information;
[0039] The calculation module is used to input the key points of the cow's back and the corresponding length information into the dairy buffalo weight prediction model to calculate the predicted weight result of the dairy buffalo to be tested.
[0040] The dairy buffalo weight prediction device obtains fused features constructed by key points of the cow's back and corresponding length information through a feature extraction model, and inputs the fused features into the dairy buffalo weight prediction model to calculate the predicted weight result of the dairy buffalo to be tested, thereby solving the problems of traditional dairy buffalo weight acquisition methods, such as being time-consuming, difficult to operate, and easily causing stress reactions in dairy buffaloes when using dairy buffalo scales. The dairy buffalo weight can be calculated objectively, quickly, simply, and without stress, thereby improving the efficiency of dairy buffalo weight acquisition.
[0041] In a third aspect, the present application provides an electronic device, comprising a processor and a memory, wherein the memory stores a computer program executable by the processor, and when the processor executes the computer program, it runs the steps in the dairy buffalo weight prediction method as described above.
[0042] In a fourth aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps in the method for predicting the weight of dairy buffaloes as described above are executed.
[0043] Beneficial effects: The method, device, electronic device and storage medium for predicting the weight of dairy buffalo provided in the present application obtain a fusion feature constructed by the key points of the cow's back and the corresponding length information through a feature extraction model, and input the fusion feature into the dairy buffalo weight prediction model to calculate the predicted weight result of the dairy buffalo to be tested, thereby solving the problems of the traditional method for obtaining the weight of dairy buffalo, such as being time-consuming, difficult to operate and easy to cause stress reaction in dairy buffaloes when using dairy buffalo scales. The weight of dairy buffaloes can be calculated objectively, quickly, simply and without stress, thereby improving the efficiency of obtaining the weight of dairy buffaloes. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] Figure 1 This is a flow chart of a method for predicting the weight of dairy buffaloes provided in an embodiment of the present application.
[0045] Figure 2 A schematic diagram of the structure of a device for predicting the weight of dairy buffaloes provided in an embodiment of the present application.
[0046] Figure 3 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application.
[0047] Figure 4 This is the structural block diagram of the feature extraction model.
[0048] Explanation of reference numerals: 1. Acquisition module; 2. De-noising module; 3. Construction module; 4. Input module; 5. Calculation module; 301. Processor; 302. Memory; 303. Communication bus. DETAILED DESCRIPTION
[0049] The technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the 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 of the embodiments. The components of the embodiments of the present application described and shown in the drawings here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the application claimed for protection, but merely represents the selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present application.
[0050] It should be noted that similar reference numerals and letters represent similar items in the following drawings, so once an item is defined in one drawing, it does not need to be further defined and explained in subsequent drawings. At the same time, in the description of this application, the terms "first", "second", etc. are only used to distinguish the description and cannot be understood as indicating or implying relative importance.
[0051] Please refer to Figure 1 , Figure 1 A method for predicting the weight of a dairy buffalo in some embodiments of the present application is used to predict the weight of a dairy buffalo, comprising the steps of:
[0052] Step S101, obtaining back point cloud data of the dairy buffalo to be tested when standing at different viewing angles, and obtaining a dairy buffalo weight training sample in a database; the dairy buffalo weight training sample includes historical dairy buffalo back point cloud data and corresponding historical key point data, historical length information and historical weight results;
[0053] Step S102, denoising the back point cloud data to obtain denoised back point cloud data of the dairy buffalo;
[0054] Step S103, constructing a feature extraction model and a dairy buffalo weight prediction model based on the historical dairy buffalo back point cloud data and the corresponding historical key point data, historical length information and historical weight results;
[0055] Step S104, inputting the denoised dairy buffalo back point cloud data into a feature extraction model to obtain a fusion feature constructed by the key points of the cow back and the corresponding length information;
[0056] Step S105, inputting the fusion features into the dairy buffalo weight prediction model to calculate and obtain the predicted weight result of the dairy buffalo to be tested.
[0057] The method for predicting the weight of a dairy buffalo extracts fused features constructed by key points of the cow's back and corresponding length information through a feature extraction model, and inputs the fused features into the dairy buffalo weight prediction model to calculate the predicted weight result of the dairy buffalo to be tested, thereby solving the problems of traditional methods for obtaining the weight of dairy buffalo, such as being time-consuming, difficult to operate, and easily causing stress reactions in dairy buffaloes when using dairy buffalo scales. The method can objectively, quickly, simply, and stress-freely calculate the weight of dairy buffaloes, thereby improving the efficiency of obtaining the weight of dairy buffaloes.
[0058] Specifically, in step S101, the back point cloud data of the dairy buffalo to be tested when standing under different viewing angles are obtained, including:
[0059] Obtaining the back point cloud data of the dairy buffalo to be tested at different viewing angles (specifically, three angles: the upper left, directly above, and upper right of the back of the dairy buffalo);
[0060] The back point cloud data of the dairy buffalo to be tested when standing is extracted from the back point cloud data of the dairy buffalo.
[0061] In step S101, when obtaining the back point cloud data of the dairy buffalo, since the dairy buffalo may be in different postures during the actual data collection process, there are certain differences in the back point cloud data in different postures. According to the living habits of dairy buffaloes, dairy buffaloes are in a standing posture most of the time. Therefore, in order to overcome the impact of the difference in posture of dairy buffaloes, the back point cloud of the dairy buffalo when standing is collected for weight estimation during data collection.
[0062] Specifically, a buffalo weight training sample is obtained from a database. The buffalo weight training sample includes historical buffalo back point cloud data and corresponding historical key point data, historical length information and historical weight results. The historical buffalo back point cloud data includes historical records of buffalo back point cloud data in the database, and the historical weight results are the corresponding weight results of the buffalo when these historical records are obtained. The corresponding historical key point data are the back key points related to weight marked on the back of the buffalo in these historical records (wherein the back key points correspond to each other in pairs, and the corresponding two back key points are associated key points, and the length and width of the back can be estimated through the associated key points), and the historical length information is the length between the associated key points. Extract any back point cloud data from the historical records in the database as the historical dairy buffalo back point cloud data, annotate the cow's back key points from the back point cloud data as the historical key point data, calculate the length between each associated key point in the historical key point data as the historical length information, extract the weight result of the dairy buffalo corresponding to the back point cloud data as the historical weight result, thereby extracting a large amount of data in the database to form a dairy buffalo weight training sample, and set the above-obtained data as a test set and a validation set for training the model when constructing the model (feature extraction model and dairy buffalo weight prediction model), so that the trained feature extraction model can extract the cow's back key points, calculate the length between each associated key point and construct fusion features, and the trained dairy buffalo weight prediction model can calculate the weight of the dairy buffalo.
[0063] Specifically, in step S102, the back point cloud data is denoised to obtain denoised back point cloud data of the dairy buffalo. For example, a hierarchical clustering algorithm is used for denoising, and the two closest cloud points in the back point cloud data are merged into one cluster according to a preset Euclidean distance, and the merging step is repeated until the latest cluster has no other cloud points within the preset Euclidean distance, thereby obtaining denoised back point cloud data of the dairy buffalo; or, other existing technologies can be used for denoising.
[0064] Specifically, in step S103, a feature extraction model and a dairy buffalo weight prediction model are constructed based on the historical dairy buffalo back point cloud data and the corresponding historical key point data, historical length information and historical weight results, including:
[0065] Extracting point cloud data in a standing posture from the historical dairy buffalo back point cloud data and performing denoising to obtain historical dairy buffalo back point cloud data in a standing posture;
[0066] According to the historical dairy buffalo standing posture back point cloud data and the corresponding historical key point data, historical length information and historical weight results, an SC3K-Transformer model and a fully connected network model are respectively constructed to obtain a feature extraction model and a dairy buffalo weight prediction model.
[0067] In step S103, point cloud data in a standing posture is extracted from the historical dairy buffalo back point cloud data, and the point cloud data in the standing posture is denoised to construct an SC3K-Transformer model and a fully connected network model to obtain a feature extraction model and a dairy buffalo weight prediction model, so that the training data used in the feature extraction model and the dairy buffalo weight prediction model during training and the test data input after training remain consistent, thereby improving the accuracy of the feature extraction model and the dairy buffalo weight prediction model.
[0068] like Figure 4 As shown, Figure 4 It is a structural block diagram of the feature extraction model, which is specifically the SC3K-Transformer model. Among them, the PointNet module, the first residual module, the second residual module and the Transformer module are the model network, the input data is point cloud data, X is the point multiplication operation (that is, the point multiplication operation is performed using the matrix multiplication function), the feature output is the key point coordinates, MxN, 512xN, 256xN, KxN represent the image size of the feature, the PointNet module is used to segment and classify the point cloud data, the first residual module and the second residual module are used to improve the stability of the PointNet module and the Transformer module, and the Transformer module is used to extract and fuse the data features of the point cloud data. The point cloud data (historical dairy buffalo standing posture back point cloud data or denoised dairy buffalo back point cloud data) is input into the feature extraction model. The point cloud data first enters the SC3K-Transformer model, and after feature extraction through the PointNet module, the first residual module, the second residual module and the Transformer module, K key point coordinates are obtained through dot multiplication operation. Then, according to the key point coordinates, the key points (i.e., the cow back key points) are annotated in the point cloud data and the length information between the associated key points is calculated to obtain the annotated point cloud data and length information. The annotated point cloud data and length information will pass through the PointNet module, the first residual module, the second residual module and the Transformer module again in the feature extraction model to extract and fuse the cow back key points and length information, and obtain the fused features that only contain the cow back key points and length information.
[0069] SC3K-Transformer is a neural network model based on the self-attention mechanism architecture, which can process the relationship between each cloud point in the point cloud data and learn the degree of association between different cloud points, so as to realize the positioning of key points. Among them, for the input point cloud data (point cloud data of the back of a dairy buffalo) X, the self-attention mechanism architecture is as follows:
[0070] ;
[0071] in, is the i-th cloud point, is the jth cloud point, n is the number of cloud points in the point cloud data, is the attention weight between the i-th cloud point and the j-th cloud point, It is a query matrix used to obtain the degree of association between each cloud point and the attention weight of each cloud point.
[0072] In the Transformer module, a two-step method is used to randomly rotate any point cloud in the point cloud data (point cloud data of the back of the dairy buffalo) twice, output two adjacent key points, and use the distribution position points corresponding to the two adjacent key points as the set point. The set point is used as a self-supervisory signal to change the semantic information of the two key points so that the semantic information of the two adjacent key points remains consistent. By limiting the distance of each adjacent key point to within the set point, the number of key points is minimized. By limiting the distance of each adjacent key point to within the set point, the number of key points is minimized. Make each key point within the collection point ( ) and its adjacent key points, Make each key point within the collection point ( ) and any adjacent cloud point (the cloud point adjacent to the key point in the point cloud data of the back of the dairy buffalo) is minimized. and They are respectively manifested as:
[0073] ;
[0074] ;
[0075] in, To maximize distance; is the i-th key point; K is the total number of key points in the key point distribution location points; KP is the collection point (i.e. the distribution location point corresponding to the adjacent key points), is the K nearest neighbor algorithm, is the calculation result set of the K nearest neighbor algorithm between the i-th key point and the set point is the two-norm; To minimize the distance; PCD is the point cloud data of the back of the dairy buffalo, is the calculation result set of the K nearest neighbor algorithm between the i-th key point and all the back point cloud data of the dairy buffalo. Among them, the minimum distance In the calculation formula, the loss function on the right side of the equation will get closer and closer to 0 during training, thus finding the key point k i The nearest neighbor point of is taken as the prediction key point, and this prediction key point will get closer and closer to this key point k as the loss value (the calculation result of the loss function) decreases. i , so that the predicted key point and this key point k i distance is minimized.
[0076] In summary, by continuously iteratively calculating the distance difference between these key points, the distance difference between adjacent key points is limited between the maximum distance and the minimum distance. After obtaining the optimal key point, the corresponding associated key point is determined from the optimal key point, and the length information between the associated key points is calculated.
[0077] Specifically, the key points of the cow's back are points on the contour of the cow's back, such as the neck key point (the key point marked on the neck) and the tail key point (the key point marked on the tail). The length between the neck key point and the tail key point can determine the length of the cow's back, so the neck key point and the tail key point are set as associated key points. The length and width of the cow's back can be estimated through the associated key points (the width of the cow's back can be estimated through the corresponding key points on both sides of the cow's back). The weight of the dairy buffalo can be calculated through the relative relationship between the length and width of the cow's back and the weight (the relative relationship is set in the weight calculation network model).
[0078] The fused features are input into the dairy buffalo weight prediction model to estimate the weight and obtain the predicted dairy buffalo weight.
[0079] The dairy buffalo weight prediction model is specifically a fully connected network model (i.e., DNN deep neural network). The fully connected network model is an existing technology and will not be described in detail here.
[0080] In some embodiments, the dairy buffalo weight prediction model may also be a convolutional network model such as a LeNet model or an RNN model.
[0081] Specifically, in step S103, according to the historical dairy buffalo standing posture back point cloud data and the corresponding historical key point data, historical length information and historical weight results, the SC3K-Transformer model and the fully connected network model are respectively constructed to obtain the feature extraction model and the dairy buffalo weight prediction model, including:
[0082] Construct an SC3K-Transformer model corresponding to the historical buffalo standing posture back point cloud data, and construct a fully connected network model corresponding to the historical key point data and historical length information, and obtain a preliminary feature extraction model and a preliminary buffalo weight prediction model;
[0083] According to the point cloud data used for training in the historical point cloud data of the back of the standing posture of the dairy buffalo and the corresponding historical key point data, historical length information and historical weight results, a preliminary feature extraction model and a preliminary dairy buffalo weight prediction model are trained to obtain a trained preliminary feature extraction model and a trained preliminary dairy buffalo weight prediction model;
[0084] Based on the point cloud data of the historical dairy buffalo standing posture back point cloud data that was not used for training and the corresponding historical key point data, historical length information and historical weight results, the trained preliminary feature extraction model and the trained preliminary dairy buffalo weight prediction model were verified to obtain the feature extraction model and the dairy buffalo weight prediction model.
[0085] In step S103, a preliminary feature extraction model and a preliminary dairy buffalo weight prediction model are constructed based on the historical dairy buffalo standing posture back point cloud data and the corresponding historical key point data, historical length information and historical weight results.
[0086] Specifically, in step S103, a preliminary feature extraction model and a preliminary dairy buffalo weight prediction model are trained according to the point cloud data used for training in the historical dairy buffalo standing posture back point cloud data and the corresponding historical key point data, historical length information and historical weight results, and the trained preliminary feature extraction model and the trained preliminary dairy buffalo weight prediction model are obtained, including:
[0087] Inputting the point cloud data used for training in the historical dairy buffalo standing posture back point cloud data into the preliminary feature extraction model to obtain the corresponding first fusion output; the first fusion output includes a first key point output and a first length output;
[0088] Determine a first training error based on historical dairy buffalo standing posture back point cloud data, historical key point data, historical length information, and corresponding first key point output and first length output, and optimize the preliminary feature extraction model based on the first training error to obtain a trained preliminary feature extraction model;
[0089] Inputting the point cloud data used for training in the historical dairy buffalo standing posture back point cloud data into the trained preliminary feature extraction model to obtain the corresponding second fusion output; the second fusion output includes a second key point output and a second length output;
[0090] Inputting the corresponding second fusion output into the preliminary dairy buffalo weight prediction model to obtain the corresponding weight output;
[0091] According to the historical dairy buffalo standing posture back point cloud data and the corresponding historical weight results and the corresponding weight output, the second training error is determined, and based on the second training error, the preliminary dairy buffalo weight prediction model is optimized to obtain the trained preliminary dairy buffalo weight prediction model.
[0092] In step S103, the first training error is obtained by comparing the historical dairy buffalo standing posture back point cloud data and the corresponding historical key point data and historical length information in the database used for training with the first fusion output (the first fusion output includes the first key point output and the first length output) obtained by inputting the historical dairy buffalo standing posture back point cloud data used for training into the preliminary dairy buffalo weight prediction model, such as the magnitude of the length difference between the historical length information and the corresponding associated key point in the first length output, or the deviation degree of the position deviation between the historical key point data and the corresponding cow back key point in the first key point output, etc. The first training error is used to adjust the parameters of the preliminary feature extraction model. If the first training error is the magnitude of the length difference between the historical length information and the corresponding associated key point in the first length output, the corresponding model parameters are modified to make the first length output more accurate, so as to obtain the first optimal parameters. The preliminary feature extraction model is optimized by the first optimal parameters to obtain the trained preliminary feature extraction model.
[0093] Input the historical dairy buffalo standing posture back point cloud data used for training in the database (the training data may be the data input when training the preliminary dairy buffalo weight prediction model, or may not be the data input when training the preliminary dairy buffalo weight prediction model) into the trained preliminary feature extraction model to obtain the corresponding second fusion output; the second fusion output includes a second key point output and a second length output;
[0094] Inputting the corresponding second fusion output into the preliminary dairy buffalo weight prediction model to obtain the corresponding weight output;
[0095] The corresponding weight output is obtained by inputting the second fusion output into the preliminary dairy buffalo weight prediction model, and compared with the historical weight results corresponding to the corresponding historical dairy buffalo standing posture back point cloud data, to obtain a second training error, such as the size of the difference between the historical weight results and the corresponding weight data in the weight output, or the historical weight results are different from the corresponding related data in the weight output (for example, the weight data output is not weight but length information), etc. The second training error is used to adjust the parameters of the preliminary dairy buffalo weight prediction model. If the second training error is the size of the difference between the historical weight results and the corresponding weight data in the weight output, the corresponding model parameters are modified to make the weight output more accurate, and the second optimal parameters are obtained. The preliminary dairy buffalo weight prediction model is optimized by the second optimal parameters to obtain the trained preliminary dairy buffalo weight prediction model.
[0096] In step S103, the historical dairy buffalo standing posture back point cloud data in the database that is not used for training is input into the trained preliminary feature extraction model to obtain the corresponding third fusion output, and the third fusion output is input into the trained preliminary dairy buffalo weight prediction model to obtain the corresponding weight data output, and the third fusion output and the weight data output are used as verification data, and the verification data is compared with the historical key point data, historical length information and historical weight results corresponding to the historical dairy buffalo standing posture back point cloud data that is not used for training, to determine whether the error between them (between the third fusion output and the historical key point data and historical length information, and between the weight data output and the historical weight results) is within an acceptable range (the acceptable error range is generally 0 to 3%, which can be modified according to actual needs), to verify the accuracy of the trained preliminary feature extraction model and the trained preliminary dairy buffalo weight prediction model, and to obtain a feature extraction model and a dairy buffalo weight prediction model.
[0097] Specifically, in step S103, the point cloud data used for training in the historical dairy buffalo standing posture back point cloud data is input into the preliminary feature extraction model to obtain the corresponding first fusion output, and the following is also included:
[0098] Initialize the parameters of the preliminary feature extraction model and the preliminary dairy buffalo weight prediction model.
[0099] In step S103, before inputting data to train the model, the parameters of the preliminary feature extraction model and the preliminary dairy buffalo weight prediction model are initialized to ensure that the model is in normal use.
[0100] Specifically, in step S104, the denoised dairy buffalo back point cloud data is input into a feature extraction model to extract the key points of the cow's back and the corresponding length information, so as to output a fusion feature constructed by the key points of the cow's back and the corresponding length information.
[0101] Specifically, in step S105, the fusion features are input into the dairy buffalo weight prediction model, and the predicted weight result of the dairy buffalo to be tested is obtained through calculation by the dairy buffalo weight prediction model.
[0102] As can be seen from the above, the method for predicting the weight of a dairy buffalo obtains the back point cloud data of the dairy buffalo to be tested when standing at different viewing angles, and obtains the dairy buffalo weight training samples in the database. The dairy buffalo weight training samples include historical dairy buffalo back point cloud data and corresponding historical key point data, historical length information and historical weight results. The back point cloud data is denoised to obtain denoised dairy buffalo back point cloud data. According to the historical dairy buffalo back point cloud data and corresponding historical key point data, historical length information and historical weight results, a feature extraction model and a dairy buffalo weight prediction model are constructed. The denoised dairy buffalo back point cloud data is input into the feature extraction model. A fusion feature constructed by the key points of the cow's back and the corresponding length information is obtained, the fusion feature is input into the dairy buffalo weight prediction model, and the predicted weight result of the dairy buffalo to be tested is calculated; thus, the fusion feature constructed by the key points of the cow's back and the corresponding length information is extracted by the feature extraction model, and the fusion feature is input into the dairy buffalo weight prediction model, and the predicted weight result of the dairy buffalo to be tested is calculated, which solves the problems of the traditional dairy buffalo weight acquisition method being time-consuming, difficult to operate and easy to cause stress reaction in the dairy buffalo when using the dairy buffalo scale, and can objectively, quickly, simply and stress-free calculate the dairy buffalo weight, thereby improving the efficiency of dairy buffalo weight acquisition.
[0103] refer to Figure 2 The present application provides a dairy buffalo weight prediction device for predicting the weight of a dairy buffalo, comprising:
[0104] Acquisition module 1 is used to obtain back point cloud data of the tested dairy buffalo when standing at different viewing angles, and to obtain a dairy buffalo weight training sample in a database; the dairy buffalo weight training sample includes historical dairy buffalo back point cloud data and corresponding historical key point data, historical length information and historical weight results;
[0105] Denoising module 2, used for denoising the back point cloud data to obtain denoised back point cloud data of dairy buffalo;
[0106] Construction module 3 is used to construct a feature extraction model and a dairy buffalo weight prediction model based on historical dairy buffalo back point cloud data and corresponding historical key point data, historical length information and historical weight results;
[0107] Input module 4, used for inputting the denoised dairy buffalo back point cloud data into the feature extraction model to obtain fusion features constructed by the key points of the cow back and the corresponding length information;
[0108] The calculation module 5 is used to input the fusion features into the dairy buffalo weight prediction model to calculate the predicted weight result of the dairy buffalo to be tested.
[0109] The dairy buffalo weight prediction device obtains fused features constructed by key points of the cow's back and corresponding length information through a feature extraction model, and inputs the fused features into the dairy buffalo weight prediction model to calculate the predicted weight result of the dairy buffalo to be tested, thereby solving the problems of traditional dairy buffalo weight acquisition methods, such as being time-consuming, difficult to operate, and easily causing stress reactions in dairy buffaloes when using dairy buffalo scales. The dairy buffalo weight can be calculated objectively, quickly, simply, and without stress, thereby improving the efficiency of dairy buffalo weight acquisition.
[0110] Specifically, when acquiring the back point cloud data of the tested dairy buffalo when standing at different viewing angles, the acquisition module 1 executes:
[0111] Obtaining the back point cloud data of the dairy buffalo to be tested at different viewing angles (specifically, three angles: the upper left, directly above, and upper right of the back of the dairy buffalo);
[0112] The back point cloud data of the dairy buffalo to be tested when standing is extracted from the back point cloud data of the dairy buffalo.
[0113] When the acquisition module 1 is executed, when acquiring the back point cloud data of the dairy buffalo, since the dairy buffalo may be in different postures during the actual data collection process, there are certain differences in the back point cloud data in different postures. According to the living habits of dairy buffaloes, dairy buffaloes are in a standing posture most of the time. Therefore, in order to overcome the impact of the difference in posture of dairy buffaloes, the back point cloud of the dairy buffalo when standing is collected for weight estimation during data collection.
[0114] Specifically, a buffalo weight training sample is obtained from a database. The buffalo weight training sample includes historical buffalo back point cloud data and corresponding historical key point data, historical length information and historical weight results. The historical buffalo back point cloud data includes historical records of buffalo back point cloud data in the database, and the historical weight results are the corresponding weight results of the buffalo when these historical records are obtained. The corresponding historical key point data are the back key points related to weight marked on the back of the buffalo in these historical records (wherein the back key points correspond to each other in pairs, and the corresponding two back key points are associated key points, and the length and width of the back can be estimated through the associated key points), and the historical length information is the length between the associated key points. Extract any back point cloud data from the historical records in the database as the historical dairy buffalo back point cloud data, annotate the cow's back key points from the back point cloud data as the historical key point data, calculate the length between each associated key point in the historical key point data as the historical length information, extract the weight result of the dairy buffalo corresponding to the back point cloud data as the historical weight result, thereby extracting a large amount of data in the database to form a dairy buffalo weight training sample, and set the above-obtained data as a test set and a validation set for training the model when constructing the model (feature extraction model and dairy buffalo weight prediction model), so that the trained feature extraction model can extract the cow's back key points, calculate the length between each associated key point and construct fusion features, and the trained dairy buffalo weight prediction model can calculate the weight of the dairy buffalo.
[0115] Specifically, when the denoising module 2 is executed, the back point cloud data is denoised to obtain the denoised back point cloud data of the dairy buffalo. For example, a hierarchical clustering algorithm is used for denoising, and the two closest cloud points in the back point cloud data are merged into one cluster according to a preset Euclidean distance, and the merging step is repeated until the latest cluster has no other cloud points within the preset Euclidean distance, thereby obtaining the denoised back point cloud data of the dairy buffalo; or, other existing technologies can be used for denoising.
[0116] Specifically, when constructing a feature extraction model and a dairy buffalo weight prediction model based on historical dairy buffalo back point cloud data and corresponding historical key point data, historical length information and historical weight results, the construction module 3 executes:
[0117] Extracting point cloud data in a standing posture from the historical dairy buffalo back point cloud data and performing denoising to obtain historical dairy buffalo back point cloud data in a standing posture;
[0118] According to the historical dairy buffalo standing posture back point cloud data and the corresponding historical key point data, historical length information and historical weight results, an SC3K-Transformer model and a fully connected network model are respectively constructed to obtain a feature extraction model and a dairy buffalo weight prediction model.
[0119] When construction module 3 is executed, point cloud data in a standing posture is extracted from the historical dairy buffalo back point cloud data, and the point cloud data in a standing posture is denoised to construct an SC3K-Transformer model and a fully connected network model to obtain a feature extraction model and a dairy buffalo weight prediction model, so that the training data used in the feature extraction model and the dairy buffalo weight prediction model during training and the test data input after training remain consistent, thereby improving the accuracy of the feature extraction model and the dairy buffalo weight prediction model.
[0120] like Figure 4 As shown, Figure 4 It is a structural block diagram of the feature extraction model, which is specifically the SC3K-Transformer model. Among them, the PointNet module, the first residual module, the second residual module and the Transformer module are the model network, the input data is point cloud data, X is the point multiplication operation (that is, the point multiplication operation is performed using the matrix multiplication function), the feature output is the key point coordinates, MxN, 512xN, 256xN, KxN represent the image size of the feature, the PointNet module is used to segment and classify the point cloud data, the first residual module and the second residual module are used to improve the stability of the PointNet module and the Transformer module, and the Transformer module is used to extract and fuse the data features of the point cloud data. The point cloud data (historical dairy buffalo standing posture back point cloud data or denoised dairy buffalo back point cloud data) is input into the feature extraction model. The point cloud data first enters the SC3K-Transformer model, and after feature extraction through the PointNet module, the first residual module, the second residual module and the Transformer module, K key point coordinates are obtained through dot multiplication operation. Then, according to the key point coordinates, the key points (i.e., the cow back key points) are annotated in the point cloud data and the length information between the associated key points is calculated to obtain the annotated point cloud data and length information. The annotated point cloud data and length information will pass through the PointNet module, the first residual module, the second residual module and the Transformer module again in the feature extraction model to extract and fuse the cow back key points and length information, and obtain the fused features that only contain the cow back key points and length information.
[0121] SC3K-Transformer is a neural network model based on the self-attention mechanism architecture, which can process the relationship between each cloud point in the point cloud data and learn the degree of association between different cloud points, so as to realize the positioning of key points. Among them, for the input point cloud data (point cloud data of the back of a dairy buffalo) X, the self-attention mechanism architecture is as follows:
[0122] ;
[0123] in, is the i-th cloud point, is the jth cloud point, n is the number of cloud points in the point cloud data, is the attention weight between the i-th cloud point and the j-th cloud point, It is a query matrix used to obtain the degree of association between each cloud point and the attention weight of each cloud point.
[0124] In the Transformer module, a two-step method is used to randomly rotate any point cloud in the point cloud data (point cloud data of the back of the dairy buffalo) twice, output two adjacent key points, and use the distribution position points corresponding to the two adjacent key points as the set point. The set point is used as a self-supervisory signal to change the semantic information of the two key points so that the semantic information of the two adjacent key points remains consistent. By limiting the distance of each adjacent key point to within the set point, the number of key points is minimized. By limiting the distance of each adjacent key point to within the set point, the number of key points is minimized. Make each key point within the collection point ( ) and its adjacent key points, Make each key point within the collection point ( ) and any adjacent cloud point (the cloud point adjacent to the key point in the point cloud data of the back of the dairy buffalo) is minimized. and They are respectively manifested as:
[0125] ;
[0126] ;
[0127] in, To maximize distance; is the i-th key point; K is the total number of key points in the key point distribution location points; KP is the collection point (i.e. the distribution location point corresponding to the adjacent key points), is the K nearest neighbor algorithm, is the calculation result set of the K nearest neighbor algorithm between the i-th key point and the set point is the two-norm; To minimize the distance; PCD is the point cloud data of the back of the dairy buffalo, is the calculation result set of the K nearest neighbor algorithm between the i-th key point and all the back point cloud data of the dairy buffalo. Among them, the minimum distance In the calculation formula, the loss function on the right side of the equation will get closer and closer to 0 during training, thus finding the key point k i The nearest neighbor point of is taken as the prediction key point, and this prediction key point will get closer and closer to this key point k as the loss value (the calculation result of the loss function) decreases. i , so that the predicted key point and this key point k i The distance is minimized.
[0128] In summary, by continuously iteratively calculating the distance difference between these key points, the distance difference between adjacent key points is limited between the maximum distance and the minimum distance. After obtaining the optimal key point, the corresponding associated key point is determined from the optimal key point, and the length information between the associated key points is calculated.
[0129] Specifically, the key points of the cow's back are points on the contour of the cow's back, such as the neck key point (the key point marked on the neck) and the tail key point (the key point marked on the tail). The length between the neck key point and the tail key point can determine the length of the cow's back, so the neck key point and the tail key point are set as associated key points. The length and width of the cow's back can be estimated through the associated key points (the width of the cow's back can be estimated through the corresponding key points on both sides of the cow's back). The weight of the dairy buffalo can be calculated through the relative relationship between the length and width of the cow's back and the weight (the relative relationship is set in the weight calculation network model).
[0130] The fused features are input into the dairy buffalo weight prediction model to estimate the weight and obtain the predicted dairy buffalo weight.
[0131] The dairy buffalo weight prediction model is specifically a fully connected network model (i.e., DNN deep neural network). The fully connected network model is an existing technology and will not be described in detail here.
[0132] In some embodiments, the dairy buffalo weight prediction model may also be a convolutional network model such as a LeNet model or an RNN model.
[0133] Specifically, when the construction module 3 constructs the SC3K-Transformer model and the fully connected network model according to the historical dairy buffalo standing posture back point cloud data and the corresponding historical key point data, historical length information and historical weight results, and obtains the feature extraction model and the dairy buffalo weight prediction model, it executes:
[0134] Construct an SC3K-Transformer model corresponding to the historical buffalo standing posture back point cloud data, and construct a fully connected network model corresponding to the historical key point data and historical length information, and obtain a preliminary feature extraction model and a preliminary buffalo weight prediction model;
[0135] According to the point cloud data used for training in the historical point cloud data of the back of the standing posture of the dairy buffalo and the corresponding historical key point data, historical length information and historical weight results, a preliminary feature extraction model and a preliminary dairy buffalo weight prediction model are trained to obtain a trained preliminary feature extraction model and a trained preliminary dairy buffalo weight prediction model;
[0136] Based on the point cloud data of the historical dairy buffalo standing posture back point cloud data that was not used for training and the corresponding historical key point data, historical length information and historical weight results, the trained preliminary feature extraction model and the trained preliminary dairy buffalo weight prediction model were verified to obtain the feature extraction model and the dairy buffalo weight prediction model.
[0137] When construction module 3 is executed, a preliminary feature extraction model and a preliminary dairy buffalo weight prediction model are constructed based on the historical dairy buffalo standing posture back point cloud data and the corresponding historical key point data, historical length information and historical weight results.
[0138] Specifically, the construction module 3 trains the preliminary feature extraction model and the preliminary dairy buffalo weight prediction model according to the point cloud data used for training in the historical dairy buffalo standing posture back point cloud data and the corresponding historical key point data, historical length information and historical weight results, and obtains the trained preliminary feature extraction model and the trained preliminary dairy buffalo weight prediction model, and executes:
[0139] Inputting the point cloud data used for training in the historical dairy buffalo standing posture back point cloud data into the preliminary feature extraction model to obtain the corresponding first fusion output; the first fusion output includes a first key point output and a first length output;
[0140] Determine a first training error based on historical dairy buffalo standing posture back point cloud data, historical key point data, historical length information, and corresponding first key point output and first length output, and optimize the preliminary feature extraction model based on the first training error to obtain a trained preliminary feature extraction model;
[0141] Inputting the point cloud data used for training in the historical dairy buffalo standing posture back point cloud data into the trained preliminary feature extraction model to obtain the corresponding second fusion output; the second fusion output includes a second key point output and a second length output;
[0142] Inputting the corresponding second fusion output into the preliminary dairy buffalo weight prediction model to obtain the corresponding weight output;
[0143] According to the historical dairy buffalo standing posture back point cloud data and the corresponding historical weight results and the corresponding weight output, the second training error is determined, and based on the second training error, the preliminary dairy buffalo weight prediction model is optimized to obtain the trained preliminary dairy buffalo weight prediction model.
[0144] When construction module 3 is executed, the historical dairy buffalo standing posture back point cloud data and the corresponding historical key point data and historical length information used for training in the database are compared with the first fusion output (the first fusion output includes the first key point output and the first length output) obtained by inputting the historical dairy buffalo standing posture back point cloud data used for training into the preliminary dairy buffalo weight prediction model to obtain a first training error, such as the magnitude of the length difference between the historical length information and the corresponding associated key point in the first length output, or the deviation degree of the position deviation between the historical key point data and the corresponding cow back key point in the first key point output, etc. The first training error is used to adjust the parameters of the preliminary feature extraction model. If the first training error is the magnitude of the length difference between the historical length information and the corresponding associated key point in the first length output, the corresponding model parameters are modified to make the first length output more accurate, and the first optimal parameters are obtained. The preliminary feature extraction model is optimized by the first optimal parameters to obtain the trained preliminary feature extraction model.
[0145] Input the historical dairy buffalo standing posture back point cloud data used for training in the database (the training data may be the data input when training the preliminary dairy buffalo weight prediction model, or may not be the data input when training the preliminary dairy buffalo weight prediction model) into the trained preliminary feature extraction model to obtain the corresponding second fusion output; the second fusion output includes a second key point output and a second length output;
[0146] Inputting the corresponding second fusion output into the preliminary dairy buffalo weight prediction model to obtain the corresponding weight output;
[0147] The corresponding weight output is obtained by inputting the second fusion output into the preliminary dairy buffalo weight prediction model, and compared with the historical weight results corresponding to the corresponding historical dairy buffalo standing posture back point cloud data, to obtain a second training error, such as the size of the difference between the historical weight results and the corresponding weight data in the weight output, or the historical weight results are different from the corresponding related data in the weight output (for example, the weight data output is not weight but length information), etc. The second training error is used to adjust the parameters of the preliminary dairy buffalo weight prediction model. If the second training error is the size of the difference between the historical weight results and the corresponding weight data in the weight output, the corresponding model parameters are modified to make the weight output more accurate, and the second optimal parameters are obtained. The preliminary dairy buffalo weight prediction model is optimized by the second optimal parameters to obtain the trained preliminary dairy buffalo weight prediction model.
[0148] When construction module 3 is executed, the historical dairy buffalo standing posture back point cloud data in the database that is not used for training is input into the trained preliminary feature extraction model to obtain the corresponding third fusion output, and the third fusion output is input into the trained preliminary dairy buffalo weight prediction model to obtain the corresponding weight data output, and the third fusion output and the weight data output are used as verification data, and the verification data are compared with the historical key point data, historical length information and historical weight results corresponding to the historical dairy buffalo standing posture back point cloud data that is not used for training, to determine whether the error between them (between the third fusion output and the historical key point data and historical length information, and between the weight data output and the historical weight results) is within an acceptable range (the acceptable error range is generally 0 to 3%, which can be modified according to actual needs), to verify the accuracy of the trained preliminary feature extraction model and the trained preliminary dairy buffalo weight prediction model, and to obtain a feature extraction model and a dairy buffalo weight prediction model.
[0149] Specifically, before inputting the point cloud data used for training in the historical dairy buffalo standing posture back point cloud data into the preliminary feature extraction model to obtain the corresponding first fusion output, the construction module 3 further executes:
[0150] Initialize the parameters of the preliminary feature extraction model and the preliminary dairy buffalo weight prediction model.
[0151] When constructing module 3, before inputting data to train the model, the parameters of the preliminary feature extraction model and the preliminary dairy buffalo weight prediction model are initialized to ensure that the model is in normal use.
[0152] Specifically, when the input module 4 is executed, the denoised dairy buffalo back point cloud data is input into the feature extraction model, and the key points of the cow back and the corresponding length information are extracted to output the fusion features constructed by the key points of the cow back and the corresponding length information.
[0153] Specifically, when the calculation module 5 is executed, the fusion feature is input into the dairy buffalo weight prediction model, and the predicted weight result of the dairy buffalo to be tested is obtained through calculation by the dairy buffalo weight prediction model.
[0154] As can be seen from the above, the dairy buffalo weight prediction device obtains the back point cloud data of the dairy buffalo to be tested when standing at different viewing angles, and obtains the dairy buffalo weight training samples in the database. The dairy buffalo weight training samples include historical dairy buffalo back point cloud data and corresponding historical key point data, historical length information and historical weight results. The back point cloud data is denoised to obtain the denoised dairy buffalo back point cloud data. According to the historical dairy buffalo back point cloud data and the corresponding historical key point data, historical length information and historical weight results, a feature extraction model and a dairy buffalo weight prediction model are constructed, and the denoised dairy buffalo back point cloud data is input into the feature extraction model. A fusion feature constructed by the key points of the cow's back and the corresponding length information is obtained, the fusion feature is input into the dairy buffalo weight prediction model, and the predicted weight result of the dairy buffalo to be tested is calculated; thus, the fusion feature constructed by the key points of the cow's back and the corresponding length information is extracted by the feature extraction model, and the fusion feature is input into the dairy buffalo weight prediction model, and the predicted weight result of the dairy buffalo to be tested is calculated, which solves the problems of the traditional dairy buffalo weight acquisition method being time-consuming, difficult to operate and easy to cause stress reaction in the dairy buffalo when using the dairy buffalo scale, and can objectively, quickly, simply and stress-free calculate the dairy buffalo weight, thereby improving the efficiency of dairy buffalo weight acquisition.
[0155] Please refer to Figure 3 , Figure 3This is a structural diagram of an electronic device provided in an embodiment of the present application. The present application provides an electronic device, including: a processor 301 and a memory 302. The processor 301 and the memory 302 are interconnected and communicate with each other through a communication bus 303 and / or other forms of connection mechanisms (not shown). The memory 302 stores a computer program executable by the processor 301. When the electronic device is running, the processor 301 executes the computer program to execute the method for predicting the weight of a dairy buffalo in any optional implementation of the above embodiment to achieve the following functions: obtaining back point cloud data of the dairy buffalo to be tested when standing at different viewing angles, and obtaining the back point cloud data of the dairy buffalo in the database. Weight training samples, the dairy buffalo weight training samples include historical dairy buffalo back point cloud data and the corresponding historical key point data, historical length information and historical weight results. The back point cloud data is denoised to obtain the denoised dairy buffalo back point cloud data. According to the historical dairy buffalo back point cloud data and the corresponding historical key point data, historical length information and historical weight results, a feature extraction model and a dairy buffalo weight prediction model are constructed. The denoised dairy buffalo back point cloud data is input into the feature extraction model to obtain the fused features constructed by the cow's back key points and the corresponding length information. The fused features are input into the dairy buffalo weight prediction model to calculate the predicted weight result of the dairy buffalo to be tested.
[0156] The embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the method for predicting the weight of a dairy buffalo in any optional implementation of the above embodiment is executed to achieve the following functions: obtaining back point cloud data of a dairy buffalo to be tested when standing at different viewing angles, and obtaining a dairy buffalo weight training sample in a database, wherein the dairy buffalo weight training sample includes historical dairy buffalo back point cloud data and corresponding historical key point data, historical length information and historical weight results, denoising the back point cloud data to obtain denoised dairy buffalo back point cloud data, constructing a feature extraction model and a dairy buffalo weight prediction model based on the historical dairy buffalo back point cloud data and corresponding historical key point data, historical length information and historical weight results, inputting the denoised dairy buffalo back point cloud data into the feature extraction model to obtain a fused feature constructed by the cow's back key points and the corresponding length information, inputting the fused feature into the dairy buffalo weight prediction model, and calculating the predicted weight result of the dairy buffalo to be tested. Among them, the storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable red-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk or optical disk.
[0157] In the embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the units is only a logical function division. 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. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, and the indirect coupling or communication connection of the devices or units can be electrical, mechanical or other forms.
[0158] In addition, the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, and may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0159] Furthermore, the functional modules in the various embodiments of the present application may be integrated together to form an independent part, or each module may exist independently, or two or more modules may be integrated to form an independent part.
[0160] In this document, relational terms such as first and second, etc. are used merely to distinguish one entity or operation from another entity or operation, but do not necessarily require or imply any such actual relationship or order between these entities or operations.
[0161] The above description is only an embodiment of the present application and is not intended to limit the protection scope of the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.
Claims
1. A method for predicting the weight of a dairy buffalo, for predicting the weight of a dairy buffalo, characterized in that: Includes steps: Obtaining back point cloud data of the tested dairy buffalo when standing at different viewing angles, and obtaining a dairy buffalo weight training sample in a database; the dairy buffalo weight training sample includes historical dairy buffalo back point cloud data and corresponding historical key point data, historical length information and historical weight results; De-noising the back point cloud data to obtain de-noised back point cloud data of the dairy buffalo; Constructing a feature extraction model and a dairy buffalo weight prediction model based on the historical dairy buffalo back point cloud data and the corresponding historical key point data, historical length information and historical weight results; Inputting the denoised dairy buffalo back point cloud data into the feature extraction model to obtain fusion features constructed by the key points of the cow back and the corresponding length information; Inputting the fusion feature into the dairy buffalo weight prediction model to calculate the predicted weight result of the dairy buffalo to be tested; The historical length information is the length between the associated key points, the associated key points are the cow back key points corresponding to each other, and the associated key points are used to estimate the length and width of the cow back; The feature extraction model is an SC3K-Transformer model; the dairy buffalo weight prediction model is a fully connected network model; The SC3K-Transformer model includes a PointNet module, a first residual module, a second residual module and a Transformer module, wherein in the Transformer module, a two-step method is used to randomly rotate any point cloud in the back point cloud data of the dairy buffalo twice, output two adjacent key points, and use the distribution position points corresponding to the two adjacent key points as a collection point. The collection point is used as a self-supervisory signal to change the semantic information of the two adjacent key points so that the semantic information of the two adjacent key points remains consistent, and the distance between each adjacent key point is limited within the collection point to minimize the number of key points, wherein, by Make each key point within the collection point Maximize the distance to its neighboring key points, Make each key point within the collection point Minimize the distance to any adjacent cloud point, where the adjacent cloud point is the cloud point adjacent to the key point in the point cloud data of the back of the dairy buffalo. and They are respectively manifested as: ; ; in, To maximize distance; is the i-th key point; K is the total number of key points in the key point distribution position points; KP is the collection point, that is, the distribution position point corresponding to the adjacent key points, is the K nearest neighbor algorithm, is the calculation result set of the K nearest neighbor algorithm between the i-th key point and the set point; is the two-norm; To minimize the distance; PCD is the point cloud data of the back of the dairy buffalo, It is the calculation result set of the K nearest neighbor algorithm between the ith key point and all the back point cloud data of dairy buffaloes.
2. The method for predicting the weight of dairy buffalo according to claim 1, characterized in that: Obtain the back point cloud data of the tested dairy buffalo when standing at different viewing angles, including: Acquire the back point cloud data of the dairy buffalo to be tested at different viewing angles; The back point cloud data of the dairy buffalo to be tested when standing is extracted from the back point cloud data of the dairy buffalo.
3. The method for predicting the weight of dairy buffalo according to claim 1, characterized in that: Based on the historical dairy buffalo back point cloud data and the corresponding historical key point data, historical length information and historical weight results, a feature extraction model and a dairy buffalo weight prediction model are constructed, including: Extracting point cloud data in a standing posture from the historical dairy buffalo back point cloud data and performing denoising to obtain historical dairy buffalo back point cloud data in a standing posture; According to the historical dairy buffalo standing posture back point cloud data and the corresponding historical key point data, historical length information and historical weight results, the SC3K-Transformer model and the fully connected network model are respectively constructed to obtain the feature extraction model and the dairy buffalo weight prediction model.
4. The method for predicting the weight of dairy buffalo according to claim 3, characterized in that: According to the historical dairy buffalo standing posture back point cloud data and the corresponding historical key point data, historical length information and historical weight results, the SC3K-Transformer model and the fully connected network model are respectively constructed to obtain the feature extraction model and the dairy buffalo weight prediction model, including: Constructing an SC3K-Transformer model corresponding to the historical dairy buffalo standing posture back point cloud data, and constructing a fully connected network model corresponding to the historical key point data and the historical length information, to obtain a preliminary feature extraction model and a preliminary dairy buffalo weight prediction model; According to the point cloud data used for training in the historical point cloud data of the back of the standing posture of the dairy buffalo and the corresponding historical key point data, historical length information and historical weight results, the preliminary feature extraction model and the preliminary dairy buffalo weight prediction model are trained to obtain the trained preliminary feature extraction model and the trained preliminary dairy buffalo weight prediction model; Based on the point cloud data not used for training in the historical dairy buffalo standing posture back point cloud data and the corresponding historical key point data, historical length information and historical weight results, the trained preliminary feature extraction model and the trained preliminary dairy buffalo weight prediction model are verified to obtain the feature extraction model and the dairy buffalo weight prediction model.
5. The method for predicting the weight of dairy buffalo according to claim 4, characterized in that: According to the point cloud data used for training in the historical point cloud data of the back of the standing posture of the dairy buffalo and the corresponding historical key point data, historical length information and historical weight results, the preliminary feature extraction model and the preliminary dairy buffalo weight prediction model are trained to obtain the trained preliminary feature extraction model and the trained preliminary dairy buffalo weight prediction model, including: Inputting the point cloud data used for training in the historical dairy buffalo standing posture back point cloud data into the preliminary feature extraction model to obtain a corresponding first fusion output; the first fusion output includes a first key point output and a first length output; Determine a first training error according to the historical dairy buffalo standing posture back point cloud data, historical key point data, historical length information, and the corresponding first key point output and first length output, and optimize the preliminary feature extraction model based on the first training error to obtain the trained preliminary feature extraction model; Inputting the point cloud data used for training in the historical dairy buffalo standing posture back point cloud data into the trained preliminary feature extraction model to obtain a corresponding second fusion output; the second fusion output includes a second key point output and a second length output; Inputting the corresponding second fusion output into the preliminary dairy buffalo weight prediction model to obtain a corresponding weight output; According to the historical dairy buffalo standing posture back point cloud data and the corresponding historical weight results and the corresponding weight output, a second training error is determined, and based on the second training error, the preliminary dairy buffalo weight prediction model is optimized to obtain the trained preliminary dairy buffalo weight prediction model.
6. The method for predicting the weight of dairy buffalo according to claim 5, characterized in that: Before inputting the point cloud data used for training in the historical dairy buffalo standing posture back point cloud data into the preliminary feature extraction model to obtain the corresponding first fusion output, the method further includes: Initialize the preliminary dairy buffalo weight prediction model and the parameters of the preliminary dairy buffalo weight prediction model.
7. A device for predicting the weight of a dairy buffalo, used for predicting the weight of a dairy buffalo, characterized in that: include: An acquisition module is used to acquire back point cloud data of the tested dairy buffalo when standing at different viewing angles, and to acquire a dairy buffalo weight training sample in a database; the dairy buffalo weight training sample includes historical dairy buffalo back point cloud data and corresponding historical key point data, historical length information and historical weight results; A denoising module, used for denoising the back point cloud data to obtain denoised back point cloud data of the dairy buffalo; A construction module, used to construct a feature extraction model and a dairy buffalo weight prediction model based on the historical dairy buffalo back point cloud data and the corresponding historical key point data, historical length information and historical weight results; An input module, used to input the denoised dairy buffalo back point cloud data into the feature extraction model to obtain a fusion feature constructed by the key points of the cow back and the corresponding length information; A calculation module, used for inputting the key points of the cow's back and the corresponding length information into the dairy buffalo weight prediction model, and calculating the predicted weight result of the dairy buffalo to be tested; The historical length information is the length between the associated key points, the associated key points are the cow back key points corresponding to each other, and the associated key points are used to estimate the length and width of the cow back; The feature extraction model is an SC3K-Transformer model; the dairy buffalo weight prediction model is a fully connected network model; The SC3K-Transformer model includes a PointNet module, a first residual module, a second residual module and a Transformer module, wherein in the Transformer module, a two-step method is used to randomly rotate any point cloud in the back point cloud data of the dairy buffalo twice, output two adjacent key points, and use the distribution position points corresponding to the two adjacent key points as a collection point. The collection point is used as a self-supervisory signal to change the semantic information of the two adjacent key points so that the semantic information of the two adjacent key points remains consistent, and the distance between each adjacent key point is limited within the collection point to minimize the number of key points, wherein, by Make each key point within the collection point Maximize the distance to its neighboring key points, Make each key point within the collection point Minimize the distance to any adjacent cloud point, where the adjacent cloud point is the cloud point adjacent to the key point in the point cloud data of the back of the dairy buffalo. and They are respectively manifested as: ; ; in, To maximize distance; is the i-th key point; K is the total number of key points in the key point distribution position points; KP is the collection point, that is, the distribution position point corresponding to the adjacent key points, is the K nearest neighbor algorithm, is the calculation result set of the K nearest neighbor algorithm between the i-th key point and the set point; is the two-norm; To minimize the distance; PCD is the point cloud data of the back of the dairy buffalo, It is the calculation result set of the K nearest neighbor algorithm between the ith key point and all the back point cloud data of dairy buffaloes.
8. An electronic device, characterized in that: It comprises a processor and a memory, wherein the memory stores a computer program executable by the processor, and when the processor executes the computer program, it runs the steps in the method for predicting the weight of dairy buffalo according to any one of claims 1 to 6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps in the method for predicting the weight of dairy buffalo according to any one of claims 1 to 6 are executed.
Citation Information
Patent Citations
Weight measurement method, device, equipment and storage medium
CN116263949A
Cow weight prediction method
CN116972942A