Pig fat and thin degree measuring method and system and storage medium

Through deep learning model and depth camera technology, the depth image point cloud data of pig back is calculated, which solves the problems of strong subjectivity and low efficiency of existing pig fat and thinness measurement methods, and achieves efficient and objective fine-grained measurement results.

CN119723624AActive Publication Date: 2025-03-28HEFEI LASSETER ROBOT TECH CO LTD
View PDF 8 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

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

Method used

The 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 calculate the pig's fatness and thinness through an unsupervised training inference model, and the output is a continuous floating point number.

Benefits of technology

The objective and efficient measurement of pig fat and thinness is achieved, which can provide finer-grained measurement results, completely free from manual participation, and improve measurement consistency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119723624A_ABST
    Figure CN119723624A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of pig measurement, in particular to a pig fat and thin degree measuring method and system and a storage medium, a deep learning model is adopted to conduct pig fat and thin degree reasoning, continuous floating point numerical values of the pig fat and thin degree can be obtained, personnel participation can be completely avoided, objectivity is high, efficiency is high, and the method and system are suitable for large-scale popularization and application. According to the method, the inference model and the clustering center are combined, fine-grained pig fat and thin degree evaluation is achieved, meanwhile, unsupervised training of the model can be achieved by constructing a loss function between the inference model and the clustering center, huge workload of data annotation is avoided, the problem of manual annotation subjectivity possibly generated by data annotation is also avoided, and high-consistency pig fat and thin degree description is achieved.
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: 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 for the standard pig model inference output.

[0007] 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.

[0008] 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.

[0009] In particular, 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; 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.

[0010] 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.

[0011] In particular, the present invention also provides a pig fatness and thinness degree measurement system, comprising: 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.

[0012] 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.

[0013] 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.

[0014] Compared with the prior art, the present invention has the following beneficial effects: 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; 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; 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

[0015] Figure 1 This is a schematic diagram of a method for measuring the fatness or thinness of a pig according to the present invention; Figure 2 It is a schematic diagram of the unsupervised training method of the pig fatness and thinness inference model of the present invention; Figure 3 This is a schematic diagram of the pig fatness and thinness fitting results of the present invention. DETAILED DESCRIPTION

[0016] 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.

[0017] Embodiment 1:

[0018] 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, wherein the standard fatness here can be measured by a variety of measurement methods such as visual inspection by experienced breeders, fatness calipers, B-ultrasound instruments, and the average of the measurement results of multiple people, multiple groups, and multiple pigs in different growth cycles to obtain the standard of pig fatness, which can eventually be used as an enterprise standard or industry standard. For the selected pigs, a depth camera is used to collect the depth image of the pig back from the top, and the point cloud result x0 is calculated and saved. Finally, the pig fatness reasoning model of the present invention is used to receive x0, and the standard output s0 is inferred and saved to complete the initialization of the present invention. The initialization step only needs to be completed once, and the subsequent update of the reasoning model only needs to use x0 to recalculate s0 using the updated reasoning model. It should be noted that if the pigs are of different breeds, x0 and s0 of different breeds of pigs should be established respectively.

[0019] After initialization, in actual application, the depth camera only needs to collect depth image data from the pig's back once each time and send it to the back-end server. The pig fatness reasoning system in the back-end server will go through data pre-processing, pig fatness reasoning, and result post-processing before outputting the final calculated quantitative index value of the pig's fatness in the current collected image. 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 s0 and calculates it 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.

[0020] 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.

[0021] 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.

[0022] Embodiment 2:

[0023] 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: 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; 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 ; 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: .

[0024] Where @ represents matrix multiplication; Step 4. Calculate the transformed point cloud data obtained in step 3 Point cloud data with N cluster centers Distance: .

[0025] The dist() function can be a conventional distance measurement function such as Euclidean distance and Manhattan distance; 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: .

[0026] 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; 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: .

[0027] 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: .

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

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

[0030] 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: .

[0031] 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; Step 11. Output the trained deep learning network net and its parameters param.

[0032] 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.

[0033] 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 and thinness of pigs, characterized in that the method 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 for the standard pig model inference output.

2. The method for measuring the fatness or thinness of pigs according to claim 1, characterized in that: 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.

3. The method for measuring the fatness and thinness of pigs according to claim 2, characterized in that: 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; 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.

4. The method for measuring pig fatness and thinness according to claim 3, 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.

5. A pig fatness measurement system, the system using the pig fatness measurement method according to any one of claims 1 to 4, 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.

6. The pig fatness and thinness measurement system according to claim 5 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.

7. 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-4.

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

  • Method of measuring body weights through point cloud characteristics

    CN106056580A

  • Reference-based pig weight recognition method and system

    CN108764210A

  • Face image-based fat and thin recognition method and device, and electronic equipment

    CN110472509A