A method, system and storage medium for measuring pig backfat value based on depth image

Through deep learning technology based on deep images, the pig backfat value is calculated, which solves the problem of strong subjectivity and low efficiency of manual measurement in the prior art, and achieves efficient and objective pig backfat value measurement.

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

Patent Information

Application Number
CN202411811342.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-10
Publication Date
2025-04-04

AI Technical Summary

Technical Problem

The prior art relies on manual measurements when evaluating pig fat and thinness levels, which has problems such as strong subjectivity, low efficiency and professional skills.

Method used

Using a deep image-based method, the pig's back depth image data is collected through a depth camera, and the data processing is performed using deep learning technology to calculate the pig's back fat value, achieving accurate measurement without participation.

Benefits of technology

This method can avoid subjective errors in manual measurements, improve measurement efficiency, and eliminate professional skills, and have strong objectivity and high consistency in measurement results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119762569A_ABST
    Figure CN119762569A_ABST
Patent Text Reader

Abstract

The present invention relates to the technical field of pig measurement, and specifically to a pig backfat value measurement method, system and storage medium based on depth images. The invention adopts the depth image of the pig as input, and calculates the pig backfat value with the assistance of a deep learning model. The measurement process does not require human participation, thus avoiding the pig's stress response and also avoiding the introduction of human subjective factors into the measurement results. The measurement results are highly objective and consistent. At the same time, the adopted deep learning model adopts unsupervised training, and does not require manual measurement of the pig backfat value as a label, thus saving manpower and material resources, avoiding the introduction of human subjective factors, and avoiding the interference of measurement noise on the training algorithm.
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 pig backfat value based on depth images. Background Art

[0002] In order to reduce the cost of raising pigs and ensure the growth efficiency of pigs, it is usually necessary to accurately control the amount of feed used to feed pigs. The current precision feeding plan commonly used in the industry is to divide pigs into several grades according to their fatness and thinness, and feed different amounts of feed to pigs of different grades. Therefore, accurately evaluating the fatness and thinness of pigs has a very positive significance for improving pig farming efficiency and reducing pig farming costs.

[0003] A commonly used method to assess the fatness or thinness of pigs is for the breeder to make a visual assessment based on personal experience. This method relies on the breeder's professional ability and is highly subjective. Different breeders may give different fatness or thinness grades when evaluating the same pig.

[0004] Therefore, the use of objective measuring equipment to assess the fatness and thinness of pigs and adjust the amount of feed is also widely used. There is a method of using B-ultrasound equipment to measure the thickness of pig back fat and adjust the amount of feed according to the fat thickness. However, this method requires the user to have certain professional skills and the pig hair in the measurement area needs to be removed, which is inefficient. In order to improve efficiency, there is a method of using fat calipers to measure the caliper value near the pig ribs, and roughly estimate the fat thickness, and then adjust the feed amount accordingly, but this method still cannot avoid relying on the professional skills of the measurement personnel. 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 pig back fat value based on depth images. The invention is based on depth images and adopts deep learning technology to directly calculate the back fat value of pigs without human participation, thereby avoiding human subjective errors and improving measurement efficiency.

[0006] To achieve the above object, the present invention provides a method for measuring pig backfat value based on depth image, comprising:

[0007] S1. Data acquisition: In the data acquisition stage, a depth camera is used to photograph the pig's back to obtain depth image data of the pig's back;

[0008] S2. Data processing and model reasoning, including:

[0009] S201. Convert the pig back depth image data into point cloud data x, and convert the x data format into the required format for input to the pig back contour inference model net;

[0010] S202. Input the point cloud data x into the pig back contour inference model net, and output the key parameters v of the pig back contour, wherein the main processing logic of the pig back contour inference model net is: converting high-dimensional data into low-dimensional data, converting large-order data into low-order data, and converting noisy deep point cloud data into noise-free smooth surface point data;

[0011] S3. Pig back contour surface q fitting and pig back fat value bf calculation, including:

[0012] S301. Receive the key parameters v of the pig back contour in S202, and use the fitting equation f to perform fitting to obtain the pig back contour surface equation q, where q = f(v);

[0013] S302. Calculate the pig back fat value bf, where bf = g(q).

[0014] In particular, the pig back contour inference model net is a deep learning neural network model.

[0015] In particular, the pig back contour surface equation q is defined as a two-dimensional function where p i Represents the position parameter, i represents the i-th point, j=0,1,2,3,...,N.

[0016] In particular, the calculation of pig back fat value bf first obtains the corresponding parameter point P0 (p0, q0) at the maximum value of the two-dimensional function q and uses a search algorithm to continuously search for the target parameter point P i (p i ,q i ) makes P0 and P i The difference between the Euclidean distance and the preset length L is less than the preset threshold T, and finally P0 and P are calculated. i Angle And obtain the pig back fat value bf=c1·a+c2, where c1 and c2 are empirical values.

[0017] Preferably, the pig back contour inference model net is trained in an unsupervised manner, and the training method is:

[0018] a. Construct a pig back depth image dataset and perform preprocessing to convert the depth image data into 3D point cloud data. At the same time, translate the point cloud data to its geometric center, denoted as x;

[0019] bx is input into the neural network model net. In addition to outputting the one-dimensional pig back contour key parameter v with a length of N+1, net also outputs a three-dimensional space rotation vector g with a length of 3 and a dimension of 1, and a three-dimensional space translation vector t;

[0020] c. Construct the fitting surface H based on the parameter v. The construction process of H is as follows:

[0021] i.H1={h 1,1 ,h 1,2 ,h 1,3 ,...,h 1,L}in D is the preset value, L represents the total amount of x point cloud data;

[0022] ii. Where H2 is the pig back contour surface q i The equation takes p i =H1 calculated;

[0023] iii. Make L copies of H1 and H2 and arrange them along the third dimension to form a fitted point cloud surface H;

[0024] d. Use f=R@H+t to construct the label value of the inference model net, where R represents the rotation matrix of the three-dimensional rotation vector g and @ represents matrix multiplication;

[0025] e. Construct the optimization function loss = dist(x, f), where dist(x, f) represents the distance between x and f;

[0026] f. Iterate training, continuously reduce loss, optimize the inference model net parameters, and finally obtain the inference model net and its parameters param.

[0027] Furthermore, each collected pig back depth image data is saved in the database. When the data update amount in the database exceeds the specified threshold, the pig back contour inference model net will integrate the new data for iterative optimization.

[0028] In particular, the present invention also provides a pig backfat value measurement system based on depth image, comprising:

[0029] Data acquisition module, completes S1 data acquisition function;

[0030] The data processing module pre-processes the data collected by the data acquisition module and inputs it into the pig back contour inference model net to obtain the key parameter v of the pig back contour; when the data collected in the application and saved in the data storage module exceeds the specified threshold, the data processing module iteratively optimizes the pig back contour inference model net;

[0031] The result output module calculates the pig back contour surface equation q and the pig back fat value bf and outputs them to the data display module;

[0032] A data display module receives data output by the data acquisition module, the data processing module and the result output module and displays them visually;

[0033] The data storage module stores the pig back contour inference model net and its corresponding parameters param, and also stores the pig back depth image data x, the corresponding pig back contour surface equation q and the pig back fat value bf actually collected in the application.

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

[0035] 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 pig back fat value measurement method based on depth images.

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

[0037] 1. The present invention adopts a deep learning model to assist in calculating the pig backfat value. The measurement process does not require human participation. On the one hand, it avoids the stress response of the pig, and on the other hand, it avoids bringing human subjective factors into the measurement results. The measurement results are highly objective and consistent.

[0038] 2. In practical application, the present invention uses the depth image of the pig as input, and only needs one frame of image at one angle to calculate the back fat value of the pig. The measurement efficiency is high, and human participation can be completely removed, which can provide an application basis for large-scale breeding;

[0039] 3. The deep learning inference model training process of the present invention adopts unsupervised training, and there is no need to manually measure the pig back fat value as a label, which saves manpower and material resources, avoids the introduction of human subjective factors, and avoids the interference of measurement noise on the training algorithm. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] Figure 1 Schematic diagram of a method for measuring pig backfat value based on depth image according to the present invention;

[0041] Figure 2 It is a schematic diagram of unsupervised training of the pig back contour inference model net of the present invention;

[0042] Figure 3 It is a schematic diagram of the net fitting results of the pig back contour inference model of the present invention. DETAILED DESCRIPTION

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

[0044] Embodiment 1:

[0045] The present invention provides a method for measuring pig back fat value based on depth image. The essential principle is to simulate a fat measuring caliper. First, a pig back depth image is collected. Then, a pig back contour surface is calculated through a pig back contour reasoning model net and prior knowledge. Finally, a computer virtual fat measuring caliper is used to measure the inferred pig back contour using the fat measuring caliper side fat calculation principle to obtain the pig back fat thickness value.

[0046] like Figure 1 As shown, in actual application, the steps for measuring the pig backfat value of the present invention are as follows:

[0047] 1. Collect the depth image of the pig back and convert it into point cloud data x, and convert the data format into the format required by the inference model net input;

[0048] 2. The pig back contour inference model net receives data and outputs the key parameters v of the pig back contour (other outputs are ignored during the inference process and are only used in the unsupervised training process of the model);

[0049] 3. Perform post-processing and calculate the pig back fat value bf.

[0050] In this example, a deep learning model is used as the pig back contour inference model net. The v inferred by net is a one-dimensional vector with a length of N+1, and the corresponding pig back contour surface equation q is a two-dimensional function where p ij represents the position parameter, i and j represent the index value of the two-dimensional function. Correspondingly, the calculation method of the pig back fat value df is as follows: first obtain the corresponding parameter point P0 (p0, q0) at the maximum value of the two-dimensional function q and use a search algorithm (such as sequential search, binary search, difference search, etc.) to continuously search for the target parameter point P i (p i ,q i ) makes P0 and P i The difference between the Euclidean distance and the preset length L (empirical value: L = 130) is less than the preset threshold T (empirical value: T = 1), and finally P0 and P i Angle And obtain the pig back fat value bf=c1·a+c2, where c1 and c2 are empirical values ​​(according to the standard of fat caliper: c1=-0.85, c2=37.5).

[0051] It should be noted that the core function of the pig back contour inference model net in the present invention is mainly to convert high-dimensional data into low-dimensional data, convert large-order-magnitude data into low-order-magnitude data, and convert noisy deep point cloud data into noise-free smooth surface point data. Therefore, the deep learning inference model net in this example is only a preferred solution, and other solutions with similar functions should be regarded as consistent with the solution of the present invention.

[0052] In practical applications, net can be used to select neural network models, least squares fitting models, implicit surface fitting models and other method models. The corresponding pig back contour surface equation is the corresponding polynomial equation or surface equation. These methods are all effective, but there are the following problems in application:

[0053] 1. The fitting model needs to assume that the surface to be fitted is a surface with a specific general equation. The fitting process is actually to solve the coefficients of the general equation to minimize the error between the assumed equation surface and the actual point cloud data;

[0054] 2. Direct surface fitting requires calculation of all point cloud data, which requires a large amount of calculation and makes it difficult to ensure the real-time performance of the calculation.

[0055] Embodiment 2:

[0056] like Figure 2 As shown, the pig back contour inference model net of the present invention is a deep learning network model, whose input is the point cloud tensor converted from the depth image, and the output is a one-dimensional vector function fitting parameter v with a length equal to N+1, and two one-dimensional vectors with a length equal to 3. The three-dimensional space rotation angle g and the three-dimensional translation vector t, the model net is trained by an unsupervised training method, and its basic principle is to use v to calculate a preset function curve, copy the function curve, splice it into a surface, rotate g in 3D space and translate t, so that the difference between the final surface and the surface formed by the pig back image data is minimized, specifically:

[0057] Step 1. Build a pig back depth image dataset;

[0058] Step 2. Sample depth image data from the pig back depth image dataset, convert the depth image data into three-dimensional point cloud data, and translate the point cloud data to its geometric center, denoted as x;

[0059] Step 3. Input x into the deep learning network net to get the output v, g, t. According to the network output, calculate the fitted pig back surface:

[0060] f=R@H+t

[0061] Where R represents the rotation matrix constructed according to the three-dimensional space rotation angle g, @ represents the matrix multiplication operation, and H represents the fitting surface constructed according to the parameter v. In engineering practice, it is a number of three-dimensional point coordinates. The point coordinates in the first dimension direction are

[0062] H1={h 1,1 ,h 1,2 ,h 1,3 ,…,h 1,L}

[0063] in L represents the number of input 3D point cloud data x points, and D is a preset value, which is selected based on experience. For example, let D = 500; the corresponding point coordinates in the second dimension direction are:

[0064]

[0065] Make L copies of H1 and H2 and arrange them along the third dimension to obtain the final fitted point cloud data H;

[0066] Step 4. Let the learnable parameter of the deep learning network net be param, and optimize param according to the following objectives:

[0067]

[0068] Where dist(x,f) represents the measured distance between x and f, which can be a commonly used distance calculation function such as Euclidean distance and Manhattan distance in practice;

[0069] Step 5. Optimize the target described in step 4 according to the conventional deep learning network training method (such as stochastic gradient descent SGD, Adam and other optimization methods), and judge whether the training is completed according to the conventional method, such as whether the number of training times has reached the specified number, whether the loss function no longer has a significant decrease, if the training is not completed, return to step 2, otherwise go to step 6;

[0070] Step 6. Save the deep learning network net and parameters param as the trained network.

[0071] 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 the error between the surface fitted by the pig back contour inference model net inference of the present invention and the original point cloud data is small, and the fitted surface is smooth and noise-free.

[0072] 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 pig backfat value based on depth image, characterized in that the method include: S1. Data acquisition: In the data acquisition stage, a depth camera is used to photograph the pig's back to obtain depth image data of the pig's back; S2. Data processing and model reasoning, including: S201. Convert the pig back depth image data into point cloud data x, and convert the x data format into the required format for input to the pig back contour inference model net; S202. Input the point cloud data x into the pig back contour inference model net, and output the key parameters v of the pig back contour, wherein the main processing logic of the pig back contour inference model net is: converting high-dimensional data into low-dimensional data, converting large-order data into low-order data, and converting noisy deep point cloud data into noise-free smooth surface point data; S3. Pig back contour surface q fitting and pig back fat value bf calculation, including: S301. Receive the key parameters v of the pig back contour in S202, and use the fitting equation f to perform fitting to obtain the pig back contour surface equation q, where q = f(v); S302. Calculate the pig back fat value bf, where bf = g(q).

2. The method for measuring pig backfat value based on depth image according to claim 1, characterized in that: The pig back contour inference model net is a deep learning neural network model.

3. The method for measuring pig backfat value based on depth image according to claim 2, characterized in that: The pig back contour surface equation q is defined as a two-dimensional function where p i Represents the position parameter, i represents the i-th point, j=0,1,2,3,...,N.

4. The method for measuring pig backfat value based on depth image according to claim 3, characterized in that: The calculation of pig back fat value bf first obtains the corresponding parameter point P0 (p0, q0) at the maximum value of the two-dimensional function q and uses the search algorithm to continuously search for the target parameter point P i (p i ,q i ) makes P0 and P i The difference between the Euclidean distance and the preset length L is less than the preset threshold T, and finally P0 and P are calculated. i Angle And obtain the pig back fat value bf=c1·a+c2, where c1 and c2 are empirical values.

5. The method for measuring pig backfat value based on depth image according to claim 4, characterized in that: The pig back contour inference model net is trained in an unsupervised manner, and the training method is: a. Construct a pig back depth image dataset and perform preprocessing to convert the depth image data into 3D point cloud data. At the same time, translate the point cloud data to its geometric center, denoted as x; bx is input into the neural network model net. In addition to outputting the one-dimensional pig back contour key parameter v with a length of N+1, net also outputs a three-dimensional space rotation vector g with a length of 3 and a dimension of 1, and a three-dimensional space translation vector t; c. Construct the fitting surface H based on the parameter v. The construction process of H is as follows: i.H1={h 1,1 ,h 1,2 ,h 1,3 ,...,h 1,L }in D is the preset value, L represents the total amount of x point cloud data; ii. Where H2 is the pig back contour surface q i The equation takes p i =H1 calculated; iii. Make L copies of H1 and H2 and arrange them along the third dimension to form a fitted point cloud surface H; d. Use f=R@H+t to construct the label value of the inference model net, where R represents the rotation matrix of the three-dimensional rotation vector g and @ represents matrix multiplication; e. Construct the optimization function loss = dist(x, f), where dist(x, f) represents the distance between x and f; f. Iterate training, continuously reduce loss, optimize the inference model net parameters, and finally obtain the inference model net and its parameters param.

6. The method for measuring pig backfat value based on depth image according to claim 5, characterized in that: Each time the pig back depth image data is collected, it is saved in the database. When the data update amount in the database exceeds the specified threshold, the pig back contour inference model net will integrate the new data for iterative optimization.

7. A pig backfat value measurement system based on depth images, the system using the pig backfat value measurement method based on depth images according to any one of claims 1 to 6, characterized in that the system include: Data acquisition module, completes S1 data acquisition function; The data processing module pre-processes the data collected by the data acquisition module and inputs it into the pig back contour inference model net to obtain the key parameter v of the pig back contour; when the data collected in the application and saved in the data storage module exceeds the specified threshold, the data processing module iteratively optimizes the pig back contour inference model net; The result output module calculates the pig back contour surface equation q and the pig back fat value bf and outputs them to the data display module; A data display module receives data output by the data acquisition module, the data processing module and the result output module and displays them visually; The data storage module stores the pig back contour inference model net and its corresponding parameters param, and also stores the pig back depth image data x, the corresponding pig back contour surface equation q and the pig back fat value bf actually collected in the application.

8. The pig backfat value measurement system based on depth image according to claim 7, 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.

9. 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 backfat value based on depth images as described in any one of claims 1-6.

Citation Information

Cited By

  • Non-contact in-vivo pig backfat thickness measuring method based on point cloud and deep learning

    CN120747357A

  • Non-contact in-vivo pig eye muscle area determination method based on point cloud and deep learning

    CN120807615A