A method, system and storage medium for measuring pig fatness and thinness

Through deep learning model and depth camera technology, the pig back scaling factor is calculated to determine the degree of weight loss, which solves the problems of strong subjectivity and low efficiency of the existing methods, and achieves efficient and objective measurement of pig fat loss.

CN119723624BActive Publication Date: 2025-06-06HEFEI LASSETER ROBOT TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510239443.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-03-03
Publication Date
2025-06-06
Estimated Expiration
2045-03-03

AI Technical Summary

Technical Problem

The existing methods for measuring pig fat and thinness are highly subjective and inefficient, making it difficult to achieve high consistency and fine-grained measurement results.

Method used

Deep learning model and depth camera are used to obtain the depth image of the pig's back, convert it into point cloud data, and use an unsupervised inference model to calculate the pig's back scaling factor to determine the degree of fatness and thinness.

Benefits of technology

It realizes objective and fine measurement of pig fat and thinness, can completely escape manual participation, and improves measurement efficiency and consistency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119723624B_ABST
    Figure CN119723624B_ABST
Patent Text Reader

Abstract

The present invention relates to the technical field of pig measurement, and specifically to a method, system and storage medium for measuring pig fatness. The present invention uses a deep learning model to infer the pig fatness, so as to obtain continuous floating-point values ​​of the pig fatness. The method can be completely independent of human participation, has strong objectivity and high efficiency, and can achieve fine-grained pig fatness evaluation. At the same time, the inference model of the present invention can achieve unsupervised training of the model by constructing a loss function between the cluster center, thus avoiding the huge workload of data labeling and the subjective problem of manual labeling that may be caused by data labeling, and achieving a highly consistent description of the pig fatness.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of pig measurement, and in particular to a method, system and storage medium for measuring the fatness or thinness of a pig. Background Art

[0002] In the pig farming industry, measuring the fatness of pigs has a very positive meaning. For example, different feed amounts can be fed according to the fatness of the pigs, achieving precise feeding and feeding pigs of specified fatness at low cost. In addition, the fatness of pigs is also one of the important references for measuring the health of pigs and the quality of pork.

[0003] There are many ways to judge the fatness of pigs. Visual inspection based on the breeder's experience is one of them. However, this method is highly subjective, inefficient, and difficult to give highly consistent judgment results on a large scale. Similarly, there are fat calipers or B-ultrasound instruments that measure the fat thickness of the pig's back at a specified position on the pig's back, such as point P2, to estimate the fatness of the pig. This is also inevitably inefficient and highly subjective.

[0004] In view of the shortcomings of traditional methods, the authorization announcement number CN208001852U designed a device for finding the P2 point on the pig's back, which can improve the efficiency of finding the P2 point, but it still cannot be separated from the participation of professional breeders. The authorization announcement number is CN117036820B. Using deep learning technology, based on multi-angle pig image data, combined with manually annotated labels, a convolutional network is trained to classify the fatness of pigs into three categories: fat, medium, and thin. This method still does not completely break away from human subjective evaluation, and requires taking multi-angle image data of pigs. The classification granularity according to the three categories of fat, medium, and thin is coarse, which limits the scope of application. Summary of the invention

[0005] In view of this, the purpose of the present invention is to provide a method, system and storage medium for measuring the fatness of pigs, which can provide more fine-grained measurement results and improve measurement efficiency on the basis of getting rid of subjective measurement of the fatness of pigs.

[0006] To achieve the above object, the present invention provides the following technical solution: a method for measuring the fatness or thinness of a pig, comprising:

[0007] S101. Data acquisition, using a depth camera to acquire a depth image and convert it into point cloud data x;

[0008] S102. Model reasoning, using a deep learning neural network as a reasoning model, the reasoning model receives the point cloud data x for reasoning, and obtains the pig back scaling factor s;

[0009] S103. Calculation of pig fatness H, the calculation method is ,in Represents the pig back scaling factor for the standard pig model inference output.

[0010] Furthermore, the calculation of the pig fatness H in step S103 requires the collection of the pig back scaling factor output by the standard pig model inference. This is because the method of the present invention uses deep learning model reasoning to obtain the pig fatness scaling factor. The deep learning model learning process itself is random, and the model learning results may be more inclined to use the fatness with a larger fatness sample size as the standard. Therefore, this step collects the model reasoning results of pigs that are consistently identified as standard fatness by standard measurement as the standard, so the pig fatness Therefore, the method of the present invention does not rely on the distribution of sample data and can objectively describe the fatness or thinness of pigs.

[0011] Furthermore, the inference model also outputs the 3D rotation angle a, the 3D translation vector t, the cluster center vector ct and the cluster center vector residual ce i , where i=1,2,3,…,N, and N is a hyperparameter.

[0012] In particular, the inference model uses an unsupervised training method to perform parameter training, and the training steps are:

[0013] S301. Sampling Group B pig back point cloud data Input the inference model to obtain the 3D rotation angle , 3D translation vector , scaling factor , and the cluster center vector and cluster center vector residual , where b=1,2,3,…,B;

[0014] S302. Construct N cluster center point clouds for each group of pig back point cloud data: ;

[0015] S303. Calculate the target output: ,in, for The constructed rotation matrix, @ indicates matrix multiplication;

[0016] S304. Calculate target output Point cloud with N cluster centers The distance between as well as The probability of belonging to the i-th cluster center ,in: , , m is the preset hyperparameter;

[0017] S305. Constructing model loss function ,in , , ,in, ;

[0018] S306. Perform iterative optimization of the model, continuously reduce the loss function value L, and complete model training.

[0019] Furthermore, each collected point cloud data x is saved in the database. When the amount of data update in the database exceeds the specified threshold, the pig fatness inference model will integrate the new data for iterative optimization.

[0020] In particular, the present invention also provides a pig fatness and thinness degree measurement system, comprising:

[0021] Data acquisition module, completes the S101 data acquisition function;

[0022] Model reasoning module, completing the S102 model reasoning function;

[0023] The result output module performs post-processing on the pig back scaling factor s output by the model inference module and calculates the pig fatness or thinness H value;

[0024] The data storage module stores the pig fatness and thinness inference model and its corresponding parameter param, and also stores the pig back point cloud data x actually collected in the application and the corresponding pig fatness and thinness H output;

[0025] Model iteration module: when the data update amount in the data storage module exceeds the specified threshold, the model iteration module integrates the new data to iteratively optimize the pig fatness inference model;

[0026] The data display module receives the data output by the data acquisition module, model reasoning module, result output module and model iteration module and displays them visually.

[0027] In particular, the data display module also summarizes and displays historical measurement data, and the display modes at least include: data list display and data curve display.

[0028] Furthermore, the present invention also provides a storage medium, which is a computer-readable storage medium for computer-readable storage, and the storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the steps of the method for measuring pig fatness.

[0029] Compared with the prior art, the present invention has the following beneficial effects:

[0030] 1. The present invention uses a deep learning model to infer the fatness of pigs, and the fatness of pigs finally outputted is a continuous floating point number. Therefore, the granularity of pig fatness assessment is fine, which can support more and finer further applications;

[0031] 2. The present invention uses the depth image of the pig as input, and only needs one frame of image at one angle to measure the fatness or thinness of the pig, which is highly objective, efficient, and can be completely independent of human participation;

[0032] 3. The pig fatness inference model of the present invention can realize unsupervised training of the model by constructing a loss function between the cluster center, avoiding the huge workload of data labeling and the subjective problem of manual labeling that may arise from data labeling, and realizing a highly consistent description of the pig fatness. BRIEF DESCRIPTION OF THE DRAWINGS

[0033] Figure 1 This is a schematic diagram of a method for measuring the fatness or thinness of a pig according to the present invention;

[0034] Figure 2 It is a schematic diagram of the unsupervised training method of the pig fatness and thinness inference model of the present invention;

[0035] Figure 3 It is a schematic diagram of the pig fatness and thinness fitting results of the present invention. DETAILED DESCRIPTION

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

[0037] Embodiment 1:

[0038] like Figure 1 As shown, when the present invention is initialized, it is first necessary to select pigs with standard fatness as the judgment standard. The standard fatness here can be measured by a variety of methods such as visual inspection by experienced breeders, fatness calipers, B-ultrasound, etc., and the average of the measurement results of multiple people, multiple groups, and multiple pigs in different growth cycles is used to obtain the standard of pig fatness, which can eventually be used as an enterprise standard or industry standard. The selected pigs use a depth camera to collect the depth image of the pig back from the top, and calculate the point cloud result x 0 Finally, the pig fatness and thinness inference model of the present invention is used to receive x 0 , inferring the standard output s 0 And save, completing the initialization of the present invention. The initialization step only needs to be completed once, and subsequent updates of the inference model only need to use x 0Recalculate s using the updated inference model 0 It should be noted that if the pigs are of different breeds, x should be established for different breeds of pigs. 0 With s 0 .

[0039] After initialization, in actual application, the depth camera only needs to collect depth image data from the pig's back once and send it to the backend server. The pig fatness reasoning system in the backend server will output the final calculated quantitative index value of the pig's fatness in the current collected image after data pre-processing, pig fatness reasoning, and result post-processing. Among them, the data pre-processing mainly converts the depth image into point cloud data x and further converts the data format into the format required for the inference model input. The pig fatness reasoning process mainly receives input data and outputs the pig back scaling factor s (other outputs are ignored during the inference process). The result post-processing process mainly receives the initialized standard pig back scaling factor s 0 And according to the formula Calculate the floating point index of the pig's fatness. Ultimately, the breeding unit can evaluate the pig's health based on the measured results of the pig's fatness and thinness, and further match the feed amount to achieve precise feeding.

[0040] It should be noted that in modern automated breeding units, depth cameras can be directly integrated into corresponding auxiliary equipment such as track robots. At the same time, the back-end service can also be directly calculated locally by the front-end data collection unit, and the quantitative indicators of the pig's fatness and thinness can be obtained and directly transmitted back to the server for processing.

[0041] In essence, the inference model of the present invention actually compares the contour shape of the pig's back with the standard contour shape, and uses the comparison ratio as the fatness or thinness of the pig. However, in application, it is necessary to overcome the inherent differences in the contours of pigs in different growth cycles, so a certain contour cannot be directly used as a standard.

[0042] Embodiment 2:

[0043] like Figure 2 As shown, the present invention adopts an unsupervised method to train the inference model net, and the training steps are as follows:

[0044] Step 1. Sample the point cloud data x of the pig back of group B b Input net and get the output 3D rotation angle a b , 3D translation vector t b , scaling factor s b , and the cluster center vector ct b and cluster center vector residual ce b,i, Where b=1,2,3,…,B;

[0045] Step 2. Construct N cluster center point clouds for each group of pig back point cloud data: c b,i =ct b +ce b,i ;

[0046] Step 3. Based on the 3D rotation angle a b Construct the rotation matrix R b , combined with the 3D translation vector t b , scaling factor s b , scale, rotate and translate the input data x b , the specific operations are:

[0047] .

[0048] Where @ represents matrix multiplication;

[0049] Step 4. Calculate the transformed point cloud data obtained in step 3 Point cloud data with N cluster centers Distance:

[0050] .

[0051] The dist() function can be a conventional distance measurement function such as Euclidean distance and Manhattan distance;

[0052] Step 5. Based on the transformed point cloud data The negative number of the distance to the N cluster center point cloud data ,calculate The probability of belonging to the i-th cluster center point cloud data:

[0053] .

[0054] Among them, softmax i represents the softmax function commonly used in deep learning along the i dimension, and m is a preset hyperparameter, for example, m=0.2;

[0055] Step 6. Point cloud data based on the data transformed in step 3 , and N cluster center point cloud data The weighted distance between the two is calculated as the first loss:

[0056] .

[0057] Step 7. Constrain the transformed point cloud data Calculate the second loss by belonging to one of the cluster centers with the greatest possible probability:

[0058] .

[0059] Step 8. Constrain the B samples sampled once to be evenly distributed to each cluster center and calculate the third loss:

[0060] .

[0061] in Represents the average probability that B samples belong to the i-th cluster center:

[0062] .

[0063] Step 9. Use conventional deep learning optimization algorithms (such as stochastic gradient descent SGD, etc.) to iteratively update the learnable parameters param of the deep learning network net:

[0064] .

[0065] Step 10. Use conventional methods to determine whether the deep learning network training is complete, such as determining whether the iterations have reached a preset number of times. Is it no longer decreasing significantly? If yes, go to step 11; otherwise, go to step 1;

[0066] Step 11. Output the trained deep learning network net and its parameters param.

[0067] Finally, the trained inference model is evaluated. To make the inference results more intuitive, this example uses the inference model to fit the point cloud data for representation, such as Figure 3 As shown in the figure, it can be seen that there are differences between each center of the fitting results, but they are not large. The slight difference is reflected in the difference between each pig data and the cluster center after transformation and scaling.

[0068] The above description of the disclosed embodiments enables one skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A method for measuring the fatness or thinness of pigs, characterized in that: include: S101. Data acquisition, using a depth camera to acquire a depth image and convert it into point cloud data x; S102. Model reasoning, using a deep learning neural network as a reasoning model, the reasoning model receives the point cloud data x for reasoning, and obtains the pig back scaling factor s; S103. Calculation of pig fatness H, the calculation method is ,in represents the pig back scaling factor of the standard pig model inference output; The inference model uses an unsupervised training method to perform parameter training, and the training steps are: S301. Sampling Group B pig back point cloud data Input the inference model to obtain the 3D rotation angle , 3D translation vector , scaling factor , and the cluster center vector and cluster center vector residual , where b=1,2,3,…,B; i=1,2,3,…N, N is a hyperparameter; S302. Construct N cluster center point clouds for each group of pig back point cloud data: ; S303. Calculate the target output: ,in, for The constructed rotation matrix, @ indicates matrix multiplication; S304. Calculate target output Point cloud with N cluster centers The distance between as well as The probability of belonging to the i-th cluster center ,in: , , m is the preset hyperparameter; S305. Constructing model loss function ,in , , ,in, ; S306. Perform iterative optimization of the model, continuously reduce the loss function value L, and complete the model training.

2. The method for measuring the fatness or thinness of pigs according to claim 1, characterized in that: Each collected point cloud data x is saved in the database. When the amount of data update in the database exceeds the specified threshold, the pig fatness inference model will integrate the new data for iterative optimization.

3. A pig fatness measurement system, the system using the pig fatness measurement method according to any one of claims 1-2, characterized in that the system include: Data acquisition module, completes the S101 data acquisition function; Model reasoning module, completing the S102 model reasoning function; The result output module performs post-processing on the pig back scaling factor s output by the model inference module and calculates the pig fatness or thinness H value; The data storage module stores the pig fatness and thinness inference model and its corresponding parameter param, and also stores the pig back point cloud data x actually collected in the application and the corresponding pig fatness and thinness H output; Model iteration module: when the data update amount in the data storage module exceeds the specified threshold, the model iteration module integrates the new data to iteratively optimize the pig fatness inference model; The data display module receives the data output by the data acquisition module, model reasoning module, result output module and model iteration module and displays them visually.

4. The pig fatness and thinness measurement system according to claim 3 is characterized in that: The data display module also summarizes and displays historical measurement data, and the display modes at least include: data list display and data curve display.

5. A storage medium, the storage medium being a computer-readable storage medium, used for computer-readable storage, characterized in that: The storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the steps of a method for measuring pig fatness and thinness as described in any one of claims 1-2.

Citation Information

Patent Citations

  • A pig classification model and method based on visual images

    CN117036820B

  • Fat detection zone quickly determine ware of sow P2 point back of body

    CN208001852U