Animal body shape feature recognition method for livestock breeding management

Through binocular thermal imaging cameras and deep learning models, combined with simulation and real data sets, the accuracy and efficiency problems of animal body shape feature recognition in livestock breeding are solved, and high-precision animal body shape feature recognition is achieved, which is suitable for livestock breeding management. Efficiently identify needs.

CN118710656BActive Publication Date: 2024-10-29INNER MONGOLIA UNIV FOR THE NATITIES
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202411181091.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-27
Publication Date
2024-10-29
Estimated Expiration
2044-08-27

AI Technical Summary

Technical Problem

In livestock breeding management, it is difficult for existing technologies to identify animal body characteristics in an efficient, real-time, and accurate manner, and traditional manual measurements are susceptible to human factors, and identification tools have limited accuracy under rapid movement or occlusion.

Method used

Binocular thermal imaging cameras are combined with deep learning models to build animal segmentation models through simulation and real data sets. Transfer learning and model distillation technologies are used for image segmentation, animal body shape features are extracted, and accuracy is achieved through the fusion of drones and visual inertial data. Positioning and calculating animal body characteristics.

Benefits of technology

It has achieved high-precision recognition of animal body features, with body shape feature recognition accuracy reaching 90%, and optimized the adjustment of calibration parameters of image data collection equipment, improving the efficiency of acquiring large quantities of animal body features.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118710656B_ABST
    Figure CN118710656B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of animal husbandry and breeding management, and specifically to an animal body shape feature recognition method for animal husbandry and breeding management, establishing a simulation data set and a real data set; based on the simulation data set, establishing an animal segmentation model for animal image segmentation; applying the animal segmentation model to the real data set through a transfer learning method; in the real animal husbandry process, collecting animal image data; outputting the animal image segmentation result through the animal segmentation model based on the animal image data; according to the calibration parameters of the image data acquisition device, converting the pixels in the animal image segmentation result into actual physical coordinates, and calculating and outputting the animal body shape and physical sign results. The present invention uses a binocular thermal imaging camera to collect animal image data, and performs image segmentation, converting the pixel coordinates in the animal image data into actual physical coordinates, thereby calculating and outputting the body shape features of the animal, such as body height, body oblique length, hip width, chest circumference, etc., with an accuracy of up to 90%.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of animal husbandry and breeding management, and in particular to a method for identifying animal body shape characteristics for animal husbandry and breeding management. Background Art

[0002] Livestock management refers to the systematic and standardized management of livestock production processes through scientific methods and technical means to improve production efficiency, ensure animal health, and enhance product quality. Livestock management encompasses multiple aspects, from animal feeding and reproduction to health monitoring and environmental management. Modern livestock management increasingly relies on information technology, intelligent equipment, and data analysis to achieve precise, intelligent, and efficient management.

[0003] Acquiring animal body measurements is crucial in livestock management. These measurements serve as key indicators for measuring animal growth, health, selection, and breeding. For a long time, measuring animal body measurements has typically been performed manually using tools such as measuring rods, tape measures, and tape measures. This method is susceptible to subjective influences and carries the risk of animal injury during measurement. With the continuous advancement of technology, livestock management is increasingly adopting identification tools integrated with the Internet of Things (IoT) to identify and monitor animal body measurements. However, due to the rapid movement and obstruction of animals during activity, as well as the susceptibility of identification tools to environmental factors, the accuracy of identifying animal body measurements is limited.

[0004] In summary, there is an urgent need to propose a method that can efficiently, real-time and accurately identify animal body features. Summary of the Invention

[0005] In order to solve the above problems, the present invention provides an animal body feature recognition method for livestock breeding management, which is used to efficiently, real-time and accurately recognize the animal body feature.

[0006] In order to achieve the above object, the technical solution of the present invention is as follows: A method for identifying animal body shape characteristics for livestock breeding management, comprising the following steps:

[0007] Establish simulation data sets and real data sets;

[0008] Based on the simulation data set, an animal segmentation model for animal image segmentation is established;

[0009] Applying animal segmentation models to real datasets through transfer learning methods;

[0010] During the real livestock breeding process, continuously collect real animal breeding data and expand the real data set; use the expanded real data set to improve the established animal segmentation model or establish a new animal segmentation model;

[0011] In the actual livestock breeding process, animal image data is collected through image data acquisition equipment; based on the animal image data, the animal image segmentation results are output through the animal segmentation model;

[0012] Extracting at least two measurement points on each animal in the animal image segmentation result: a first measurement point and a second measurement point, and constructing a measurement line for body feature recognition for each animal based on the first measurement point and the second measurement point;

[0013] Continuously adjusting calibration parameters of the image data acquisition device until at least one first measurement point and a second measurement point on the animal are at equal distances from the image data acquisition device in the animal image segmentation result, and constructing a reference measurement line based on the first measurement points and the second measurement points on the animal at equal distances from the image data acquisition device;

[0014] Convert pixels in the animal image segmentation result into actual physical coordinates according to calibration parameters of the image data acquisition device, thereby obtaining the actual physical coordinates of each first measurement point and the second measurement point, calculating the length of the reference measurement line, and calculating the actual length of the measurement line for each animal with reference to the reference measurement line length;

[0015] Calculate and output animal body shape and physical signs based on the actual length of each animal's measurement line

[0016] Furthermore, the steps to establish the simulation data set are as follows:

[0017] Build a simulated livestock breeding scene with reference to the real livestock breeding scene;

[0018] Place animal models in the simulated animal husbandry scene and simulate the number of animals and the relative positions of the animals;

[0019] A fixed camera is set up around the simulated livestock breeding scene to capture a first simulated image; at the same time, a second simulated image is captured within the simulated livestock breeding scene area using a drone;

[0020] The simulation data set is established by combining the first simulation image, the second simulation image, the known geometric dimensions of the simulated animal husbandry scene, and the known body features of the animal model.

[0021] Furthermore, the steps to build the real data set are as follows:

[0022] In a real livestock breeding scene, a fixed-position camera is set up within the animal activity area to capture a first real image. Simultaneously, a drone is used to capture a second real image within the real livestock breeding scene area.

[0023] Measure the body shape characteristics of animals raised in a variety of real livestock farming scenarios;

[0024] The real dataset is established by combining the first real image, the second real image, the known geometric dimensions of the real livestock breeding scene, and the body shape characteristics obtained by animal measurements.

[0025] Furthermore, establishing an animal segmentation model for animal image segmentation includes the following steps:

[0026] Step 1: Preprocessing the collected first simulation image and second simulation image;

[0027] Step 2: Annotate the pre-processed first and second simulated images to generate animal outline and key point annotation data;

[0028] Step 3: Establish an animal segmentation model based on the deep learning model, and train and optimize the animal segmentation model based on distillation and pruning techniques.

[0029] Furthermore, real animal husbandry scenarios include but are not limited to penned and free-range farming; the body characteristics obtained by measuring animals include but are not limited to the animal's height, body length, hip width, and chest circumference;

[0030] When measuring the height of an animal, the first and second measuring points are the highest point of the withers and the point on the ground just below the highest point of the withers, respectively;

[0031] When measuring the oblique length of the animal's body, the first and second measuring points are the endpoints of the front edge of the shoulder end and the outer edge of the ischial end, respectively;

[0032] When measuring the hip width of an animal, the first and second measuring points are the endpoints of the outer edges of the hip joints on both sides of the animal;

[0033] When measuring the chest circumference of an animal, the first and second measuring points are the end point of the posterior angle of the shoulder blade and the point on the animal's body just below the end point of the posterior angle of the shoulder blade, respectively.

[0034] Furthermore, the actual length of the measurement line of each animal is calculated with reference to the length of the baseline measurement line, including the following steps:

[0035] Obtain the coordinates of the first measurement point on the reference measurement line as the first reference coordinates; obtain the coordinates of the first measurement point on the measurement line as the first measurement coordinates;

[0036] The reference measurement line is offset to the measurement line to be calculated with the first reference coordinate as the origin, so that the first reference coordinate after the offset of the reference measurement line coincides with the first measurement coordinate, and the second reference coordinate is located close to one end of the second measurement coordinate;

[0037] A plane to be collected is established based on the offset reference measurement line and the measurement line to be calculated. The animal image data is collected perpendicularly to the plane to be collected by the image data acquisition device. The coordinates of the second measurement point on the reference measurement line at this time are obtained as the second reference coordinates; the coordinates of the second measurement point on the measurement line are obtained as the second measurement coordinates.

[0038] The distance between the second reference coordinate and the second measurement coordinate after the reference measurement line is offset is calculated, and the actual length of the measurement line to be calculated is calculated based on the length of the reference measurement line.

[0039] Furthermore, the image data acquisition device is a binocular thermal imaging camera mounted on a UAV, and the calibration parameters of the binocular thermal imaging camera include intrinsic parameters and extrinsic parameters;

[0040] Intrinsic parameters: focal length, principal point position, and pixel scale factor;

[0041] External parameters: coordinates and posture of the origin of the binocular thermal imaging camera coordinate system in the world coordinate system;

[0042] The coordinates of the origin of the binocular thermal imaging camera coordinate system in the world coordinate system are obtained by the following steps:

[0043] Use ORB feature points to extract and match visual features in images collected by visual sensors;

[0044] Perform data coupling between the data collected by the visual sensor and the data collected by the inertial measurement unit;

[0045] Perform nonlinear optimization on the coupled visual sensor observation residuals and the inertial measurement unit observation residuals to obtain the coordinates of the origin of the binocular thermal imaging camera coordinate system in the world coordinate system;

[0046] Based on the coordinates of the origin of the binocular thermal imaging camera coordinate system in the world coordinate system, the pixels in the animal image segmentation result are converted to the world coordinate system through a coordinate conversion tool or a transformation matrix, thereby obtaining the actual physical coordinates of the pixels in the animal image segmentation result.

[0047] Furthermore, the visual features in the image collected by the visual sensor are extracted, including the following steps:

[0048] (1) Based on FAST corner point positioning, the coordinates of the positioning pixels are extracted and the position of the feature points in the image is determined:

[0049] Step 1: After grayscale processing of the image collected by the visual sensor, randomly select a pixel in the grayscale image , assuming its gray value is ;

[0050] Step 2: Build As the center of the circle, 3 pixels are a circle with a fixed radius, and 16 pixels evenly distributed on the circumference are selected, and the gray value is ;

[0051] Step 3: Set a threshold for the grayscale value of the pixel , if exists The grayscale values ​​of consecutive pixels satisfy , then the pixel Identify as corner points and use them as feature points;

[0052] Step 4: Traverse and detect each pixel in the image according to the above steps to obtain the position of the corner point in each frame of the image, that is, the position of the feature point in the image;

[0053] (2) Using BRIEF descriptor as feature description of feature points:

[0054] Step 1: Perform Gaussian smoothing on the image, taking the corner points As the center, take a local rectangular block to establish the description sub-region;

[0055] Step 2: Randomly determine within the descriptor region Align the pixels and compare The grayscale value of the pixel is marked:

[0056] Where, and is the pixel position to be compared, and is the gray value of the corresponding position;

[0057] Step 3: Use Represents the feature dimension, According to the above formula, a set of feature description vectors are formed for the pixel points:

[0058]

[0059] Where, For the Subscript for feature description vector;

[0060] (3) An ORB feature point is formed by the FAST corner point and the BRIEF descriptor.

[0061] Furthermore, matching visual features in the image captured by the visual sensor includes the following steps:

[0062] Step 1: In the image frame Detect and extract feature point set , is any positive integer; at the same time, the feature point set of the t-th frame is ;

[0063] Step 2: In the image frame Detect and extract feature point set , is any positive integer; at the same time, the feature point set of the t-th frame is ;

[0064] Step 3: Calculation Any feature point and Feature points in The Euclidean distance between:

[0065]

[0066] Step 4: Calculate the distance between descriptors and get The matching feature point with the shortest distance That is Middle feature point Brute force solution of the closest matching point;

[0067] Step 5: Traverse All feature points in , determine all matching points.

[0068] Furthermore, the data collected by the visual sensor and the data collected by the inertial measurement unit are coupled and tightly coupled within the sliding window:

[0069] Optimize the state quantities of the inertial measurement unit within the sliding window:

[0070]

[0071]

[0072]

[0073] Where, is the estimated variable to be optimized in the sliding window, is the state variable to be estimated in a key frame, is the inverse depth of a map point observed within the sliding window; For the The state of the inertial measurement unit captured by the image frame, is the inertial measurement unit position, is the inertial measurement unit speed, is the inertial measurement unit rotation, is the acceleration bias, is the gyroscope bias; It is the external reference of the binocular thermal imaging camera;

[0074] The coupled visual sensor observation residual and inertial measurement unit observation residual are nonlinearly optimized, and the objective function is:

[0075] Where, is the marginalized residual, is the prior residual constraint, obtained by the iteration of the sliding window FEJ algorithm, is the information transformation matrix, which is a square matrix with the same dimension as the variable to be optimized obtained by graph optimization and is solved iteratively using the Ceres-solver library; is the residual part of the inertial measurement unit, based on the difference in the change in position, velocity, rotation and bias between two frames, is the residual constraint of the inertial measurement unit, is the actual measurement value of IMU; is the visual error function, which comes from the reprojection error. To calculate the coefficient, is the visual error constraint, Calculate values ​​for visual singular value decomposition;

[0076] Based on the state quantities of the inertial measurement unit after nonlinear optimization, the position of the binocular thermal imaging camera in the world coordinate system is obtained.

[0077] The coordinates of the origin of the binocular thermal imaging camera coordinate system in the world coordinate system based on the state quantities of the inertial measurement unit after nonlinear optimization.

[0078] The above scheme has the following beneficial effects:

[0079] 1. Compared with the existing technology, this solution uses a binocular thermal imaging camera to collect animal image data, and the established animal segmentation model performs image segmentation on the collected animal image data. Based on the image segmentation results and the calibration parameters of the binocular thermal imaging camera, the pixel coordinates in the animal image data are converted into actual physical coordinates, thereby calculating and outputting the animal's body height, body oblique length, hip width, chest circumference and other body characteristics with an accuracy of up to 90%.

[0080] Specifically, after converting the pixel coordinates in the acquired animal image data into actual physical coordinates, the system extracts measurement points by identifying specific body features (such as height, body length, hip width, and chest circumference). The calibration parameters of the image data acquisition device are continuously adjusted until two measurement points on the same animal are located at the same distance from the image data acquisition device. A baseline measurement line is then constructed based on these two measurement points on the same animal. The body features of the animal to which the baseline measurement line belongs can be directly calculated based on this baseline measurement line. However, due to the different postures of other animals in the captured images, a baseline measurement line must be obtained for each animal. This requires the image data acquisition device to continuously adjust its calibration parameters, making the acquisition of body features less efficient for animals raised on a large scale.

[0081] Therefore, the present invention uses the known baseline measurement line as a reference for identifying the characteristics of other animals, offsets it to the measurement line constructed by other animals, and quickly constructs a plane to be collected to directly perform a second animal image collection, thereby optimizing the steps of adjusting the calibration parameters of the image data acquisition equipment, and can quickly obtain the actual distance between the baseline measurement line and each point on the measurement line in the plane to be collected. Therefore, through the known baseline measurement line and the actual distance between the baseline measurement line and the end point of the measurement line in the plane to be collected, the actual length of the measurement line of all animals in the first image collection range can be efficiently calculated, and then the body shape characteristics of animals within a certain range can be efficiently and accurately identified.

[0082] 2. This solution uses a combination of simulated data sets and real data sets to establish an animal segmentation model. The simulated data set can generate a large amount of data according to demand, covering various possible scenarios and conditions, thereby enhancing the robustness of the established animal segmentation model. The animal segmentation model is trained on the simulated data set, and the label accuracy of the simulated data set is high, which promotes the training of animal segmentation models with higher accuracy, laying a good foundation for subsequent transfer learning. The animal segmentation model is migrated to the real data set based on transfer learning to ensure the performance of the animal segmentation model in real scenarios. The deep neural network is lightweighted using technologies such as model pruning and model distillation to achieve efficient and real-time data feature extraction and accurate animal body feature recognition.

[0083] 3. In outdoor farming scenarios like grasslands, drones primarily rely on GPS for positioning. However, in indoor farming scenarios like pens, drones detect weak GPS signals. This solution uses ORB feature points to extract and match visual features; performs sensor data fusion based on a tight visual-inertial coupling method; and performs nonlinear optimization on the fused inertial measurement unit observation residuals and visual residuals to achieve precise positioning of the binocular thermal imaging camera.

[0084] Additional aspects and advantages of the present invention will be set forth in part in the description which follows and, in part, will be obvious from the description which follows, or may be learned by practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0085] Figure 1 This is a flow chart of an embodiment of a method for identifying animal body shape characteristics for livestock breeding management according to the present invention;

[0086] Figure 2 A flowchart for establishing an animal segmentation model according to an embodiment of the method for identifying animal body shape characteristics for livestock breeding management of the present invention;

[0087] Figure 3 This is a flow chart for obtaining the actual length of the measurement line in an embodiment of the method for identifying animal body shape characteristics for livestock breeding management of the present invention. DETAILED DESCRIPTION

[0088] The technical solution of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the embodiments described are only some embodiments of the present invention, not all embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present invention without making any creative efforts shall fall within the scope of protection of the present invention.

[0089] The following is further described in detail through specific implementation methods:

[0090] Implementation example Figure 1 A method for identifying animal body shape characteristics for livestock breeding management includes the following steps:

[0091] S1. Establish simulation data set and real data set.

[0092] The steps for establishing the simulation data set are as follows:

[0093] S101. Build a simulated livestock breeding scene based on the real livestock breeding scene;

[0094] S102, placing animal models in the simulated animal husbandry scene, and simulating the number of animals and the relative positions of the animals;

[0095] S103, setting up a fixed camera around the simulated livestock breeding scene to capture a first simulated image; and simultaneously, using a drone to capture a second simulated image within the simulated livestock breeding scene area;

[0096] S104 , completing the establishment of a simulation data set by combining the first simulation image, the second simulation image, known geometric dimensions of the simulated animal husbandry scene, and known body features of the animal model.

[0097] The steps for establishing the real data set are as follows:

[0098] S111. In a real livestock breeding scenario (real livestock breeding scenarios include but are not limited to caged and free-range breeding), a fixed-position camera is set up within the animal activity area to capture a first real image. Simultaneously, a second real image is captured within the real livestock breeding scenario area using a drone.

[0099] S112. Measure the body shape characteristics of animals raised in various real livestock breeding scenarios;

[0100] S113. Complete the establishment of a real data set by combining the first real image, the second real image, and known geometric dimensions of a real livestock breeding scene and body shape features obtained by animal measurements.

[0101] As mentioned above, the first simulated image and the first real image are both captured by ordinary cameras, and the second simulated image and the second real image are both captured by a binocular thermal imaging camera mounted on a drone.

[0102] S2. Based on the simulation data set, an animal segmentation model for animal image segmentation is established.

[0103] Building an animal segmentation model for animal image segmentation includes the following steps:

[0104] Step 1: Preprocess the collected first simulation image and second simulation image. The preprocessing steps include image enhancement, denoising, normalization and other operations to improve the accuracy of animal contour extraction.

[0105] Step 2: Label the pre-processed first simulation image and the second simulation image to generate animal outline and key point labeling data; this facilitates subsequent accurate training of the animal segmentation model.

[0106] Step 3: Establish an animal segmentation model based on the deep learning model, and train and optimize the animal segmentation model based on distillation and pruning techniques.

[0107] Deep learning models include U-Net, DeepLabV3+, Mask R-CNN, etc. The U-Net model is a classic convolutional neural network used for biomedical image segmentation. It gradually extracts image features through an encoder-decoder structure and retains detail information through jump connections. It is suitable for processing high-resolution animal images. DeepLabV3+ combines void convolution and spatial pyramid pooling, which can effectively capture multi-scale information and is suitable for image segmentation in complex backgrounds. In this embodiment, an animal segmentation model is established based on DeepLabV3+. Deep learning distillation technology is used to train a small model (student model) to imitate the behavior of a large model (teacher model), thereby reducing the number of model parameters and the amount of calculation. At the same time, combined with pruning technology, the model weights are pruned to remove redundant parameters, further reducing the model size and improving the inference speed.

[0108] S3. Apply the animal segmentation model to the real dataset through transfer learning. The transfer learning method involved in this step is an existing technology in this technical field and will not be described in detail.

[0109] S4. To ensure the practical application of the animal segmentation model, this embodiment also continuously optimizes and verifies the animal segmentation model. The animal segmentation model is trained and optimized using a large amount of experimental data, using different data augmentation methods and loss functions to improve the model's generalization capabilities. Real animal breeding data is continuously collected during the actual livestock breeding process to expand the real data set. This expanded real data set is used to improve the established animal segmentation model or establish a new animal segmentation model.

[0110] S5. During the actual livestock breeding process, animal image data is collected; based on the animal image data, an animal segmentation model is used to output an animal image segmentation result. In this step, the animal image data is also collected using a binocular thermal imaging camera mounted on a drone.

[0111] S6. Extract measurement points on each animal in the animal image segmentation result. The number of measurement points extracted varies according to the identified body shape features, but the number of measurement points is usually two. Therefore, in this embodiment, two measurement points are defined as a first measurement point and a second measurement point.

[0112] S7. Continuously adjust the calibration parameters of the image data acquisition device until the animal image segmentation result shows that the first and second measurement points on one or more animals are at equal distances from the image data acquisition device. A reference measurement line is constructed based on the first and second measurement points on the animals at equal distances from the image data acquisition device. Specifically, when the first and second measurement points on the same animal are at equal distances from the image data acquisition device, the image data acquisition device is parallel to the line connecting the first and second measurement points. In this case, the line connecting the first and second measurement points is used as the reference measurement line. The actual length of the reference measurement line can be obtained by analyzing the actual physical coordinates of the first and second measurement points. The length of the reference measurement line obtained using this method is substantially consistent with the actual distance between the first and second measurement points, and has a high degree of reliability.

[0113] When the first measurement point and the second measurement point on the same animal are at the same distance from the image data acquisition device, other animals in the collected animal image may have different postures relative to the image data acquisition device. Therefore, it is necessary to readjust the position angle of the image data acquisition device to build a reference measurement line on other animals to complete the physical sign measurement of other animals. For animals raised in groups and batches, such body feature recognition efficiency is difficult to meet the needs.

[0114] Therefore, this embodiment uses the reference measurement line as a reference to efficiently and reliably quickly identify and measure the body features of other animals. Before this, it is necessary to first obtain the actual physical coordinates of each pixel in the collected animal image to facilitate the calculation of the reference measurement line and the actual length of the measurement line.

[0115] The image data acquisition device used in this embodiment is a binocular thermal imaging camera, and its calibration parameters include intrinsic parameters and extrinsic parameters; intrinsic parameters: focal length, principal point position and pixel scale factor; extrinsic parameters: coordinates and posture of the origin of the binocular thermal imaging camera coordinate system in the world coordinate system.

[0116] In order to obtain the actual physical coordinates of each pixel in the animal image captured by the binocular thermal imaging camera, it is first necessary to obtain the coordinates of the origin of the binocular thermal imaging camera coordinate system in the world coordinate system. Specifically, the binocular thermal imaging camera is calibrated and obtained through the following steps:

[0117] S701, extracting and matching visual features from an image captured by a visual sensor (binocular thermal imaging camera image acquisition part) using ORB feature points;

[0118] Extraction steps:

[0119] (1) Based on FAST corner point positioning, the coordinates of the positioning pixels are extracted and the position of the feature points in the image is determined:

[0120] Step 1: After grayscale processing of the image collected by the visual sensor, randomly select a pixel in the grayscale image , assuming its gray value is ;

[0121] Step 2: Build As the center of the circle, 3 pixels are a circle with a fixed radius, and 16 pixels evenly distributed on the circumference are selected, and the gray value is ;

[0122] Step 3: Set a threshold for the grayscale value of the pixel If exists The grayscale values ​​of consecutive pixels satisfy , then Identify as corner points and use them as feature points;

[0123] Step 4: Traverse and detect each pixel in the image according to the above steps to obtain the position of the corner point in each frame of the image, that is, the position of the feature point in the image;

[0124] Although FAST corner location is fast, it suffers from uncertain directionality and scale. To address scale uncertainty, an image pyramid is used, starting with the original image and scaling it at a fixed factor to obtain the next layer. This process is repeated until the lowest resolution image is obtained. To address directionality, the grayscale centroid method is used, as follows:

[0125] Assume that the moment of a small image block A is:

[0126]

[0127] Where, and The value of is shown in the above formula.

[0128] The image block is obtained by moment calculation The grayscale centroid is:

[0129] Furthermore, assuming that the geometric center of the image is , then connecting the geometric center of the image can get a feature point direction , which can be expressed as:

[0130] (2) BRIEF descriptor is a feature description vector composed of binary codes of 0 and 1. BRIEF descriptor is used as the feature description of feature points:

[0131] Step 1: Perform Gaussian smoothing on the image, taking the corner points As the center, select a local rectangular block to establish the description sub-region;

[0132] Step 2: Randomly determine within the descriptor region Align the pixels and compare The grayscale value of the pixel is marked:

[0133] Where, and is the pixel position to be compared, and is the gray value of the corresponding position;

[0134] Step 3: Use Represents the feature dimension, According to the above formula, a set of feature description vectors are formed for the pixel points:

[0135]

[0136] Where, For the Subscript for feature description vector;

[0137] (3) An ORB feature point is formed by the FAST corner point and the BRIEF descriptor.

[0138] Matching steps:

[0139] Step 1: In the image frame Detect and extract feature point set , is any positive integer, and the feature point set of the t-th frame is .

[0140] Step 2: In the image frame Detect and extract feature point set , is any positive integer, and the feature point set of the t-th frame is .

[0141] Step 3: Calculation Any feature point and Feature points in The Euclidean distance between:

[0142]

[0143] Step 4: Calculate the distance between descriptors and get The matching feature point with the shortest distance That is middle Brute force solution of the closest matching point;

[0144] Step 5: Traverse All feature points in , determine all matching points.

[0145] After feature extraction and matching, the RANSAC random consistency check algorithm is used to remove some mismatched points. The principle is as follows:

[0146] Step 1: There is a same transformation relationship between multiple pairs of feature points in the left and right image matching. and There is a transformation matrix , the transformation relationship is:

[0147]

[0148] Where, It is a third-order matrix, and the matrix elements are all 1.

[0149] Step 2: Use RANSAC random consistency test to select four pairs of matching feature points for solution , which is defined as an interior point model , and judge whether the projection error of the remaining external points meets the threshold, and decide whether to treat them as internal points. The judgment criteria are:

[0150]

[0151] Where, As the screening threshold for inliers, and Matched feature points.

[0152] Step 3: When the number of internal point sets meets the conditions, perform the next iteration to solve the optimal transformation matrix , and then remove the mismatched features. The adaptive conditions for the number of iterations are as follows:

[0153]

[0154] in, To carry out After selection, at least one selection The probability that all points are inside the game is is the ratio of the interior points.

[0155] S702: Data coupling is performed on the data collected by the visual sensor and the data collected by the IMU (Inertial Measurement Unit, IMU).

[0156] Tight coupling within a sliding window:

[0157] In the sliding window, there is a tight coupling relationship between the image frame and the IMU data, which can be used to determine the state of the IMU in the sliding window (PVQ, acceleration bias, gyroscope bias), the external parameters from the IMU to the camera, Optimize multiple state quantities such as the pseudo-depth of 3D landmark points:

[0158]

[0159]

[0160]

[0161] Where, is the estimated variable to be optimized in the sliding window, is the state variable to be estimated in a key frame, is the inverse depth of a map point observed within the sliding window; is the IMU state captured by the image frame, is the IMU position, is the IMU speed, is the IMU rotation, is the acceleration bias, is the gyroscope bias; are the external parameters of the binocular thermal imaging camera.

[0162] S703: Perform nonlinear optimization on the coupled visual sensor observation residual and the IMU observation residual to obtain the coordinates of the binocular thermal imaging camera.

[0163] The nonlinear optimization objective function is:

[0164]

[0165] Where, is the marginalized residual, is the prior residual constraint, obtained by the iteration of the sliding window FEJ algorithm, is the information transformation matrix, which is a square matrix with the same dimension as the variable to be optimized obtained by graph optimization and is solved iteratively using the Ceres-solver library; is the residual part of the inertial measurement unit, based on the difference in the change in position, velocity, rotation and bias between two frames, is the residual constraint of the inertial measurement unit, is the actual measurement value of IMU; is the visual error function, which comes from the reprojection error. To calculate the coefficient, is the visual error constraint, Computes values ​​for the visual singular value decomposition.

[0166] Based on the various state quantities (position, velocity, and rotation information, etc.) of the IMU after nonlinear optimization, the coordinates of the origin of the binocular thermal imaging camera coordinate system in the world coordinate system are obtained, thereby enabling accurate acquisition of the image acquisition position under different lighting conditions and complex indoor scenes.

[0167] Subsequently, the pixels in the animal image segmentation result are converted to the world coordinate system using a coordinate conversion tool or transformation matrix, thereby obtaining the actual physical coordinates of the pixels in the animal image segmentation result. For example, coordinate conversion tools such as OpenCV and MATLAB are available. Transformation matrices or coordinate conversion tools are state of the art in this technical field, and the general conversion steps are as follows:

[0168] Step 1: Get the intrinsic parameter matrix and extrinsic parameter matrix of the binocular thermal imaging camera.

[0169] Step 2: Internal parameter matrix. The internal parameter matrix includes the focal length and principal point coordinates (principal point position) of the binocular thermal imaging camera.

[0170] Step 3: External parameter matrix. The external parameter matrix describes the rotation and translation of the binocular thermal imaging camera coordinate system relative to the world coordinate system. It mainly consists of a rotation matrix and a translation matrix.

[0171] Step 4: Coordinate conversion. Use the intrinsic and extrinsic parameter matrices to convert the coordinates of each pixel in the captured image into the coordinates in the binocular thermal imaging camera coordinate system. Then, based on the coordinates of the origin of the binocular thermal imaging camera coordinate system in the world coordinate system, convert the coordinates of each pixel in the captured image in the binocular thermal imaging camera coordinate system into the coordinates in the world coordinate system. In this way, the actual physical coordinates of each pixel in the captured animal image can be obtained, which is used for calculating the actual length of the benchmark measurement line and subsequent measurement lines.

[0172] S8. After obtaining the actual physical coordinates of each pixel in the collected animal image, the actual length of the measurement line of each animal can be calculated with reference to the length of the baseline measurement line. The specific steps are as follows:

[0173] Obtain the coordinates of the first measurement point on the reference measurement line and use them as the first reference coordinates. Then, obtain the coordinates of the first measurement point on the measurement line and use them as the first measurement coordinates. Using the first reference coordinates as the origin (moving point), offset the reference measurement line to the measurement line to be calculated, ensuring that the offset first reference coordinates of the reference measurement line coincide with the first measurement coordinates, and that the second reference coordinates are located near the second measurement coordinates.

[0174] A plane to be collected is established based on the offset reference measurement line and the offset measurement line to be calculated. The image data acquisition device is used to collect animal image data perpendicular to the plane to be collected. The coordinates of the second measurement point on the reference measurement line at this point are obtained and used as the second reference coordinates. The coordinates of the second measurement point on the measurement line are also obtained and used as the second measurement coordinates. The second reference coordinates and second measurement coordinates obtained within the plane to be collected are also obtained using the method described above for obtaining the actual physical coordinates of each pixel in the animal image.

[0175] Calculate the distance between the second reference coordinate and the second measurement coordinate after the reference measurement line is offset, and combine it with the length of the reference measurement line. Use the distance between the second reference coordinate and the second measurement coordinate after the reference measurement line is offset as one side line in space, and use the length of the reference measurement line as another side line in space. The two known side lines and the measurement line to be calculated form an arbitrary triangle. Based on the first reference coordinate, the second reference coordinate and the second measurement coordinate in the plane to be collected, the angle between the two known side lines can be obtained. Therefore, the actual length of the measurement line to be calculated that is offset can be calculated based on the cosine theorem formula.

[0176] Taking the body shape recognition of animals such as cattle, sheep, and horses as an example, these animals are raised in both penned and free-range environments. The measured body shape features typically include height, body length, hip width, and chest circumference. The measurement points selected for the recognition and measurement of these various body shape features are as follows:

[0177] (1) When measuring the height of an animal, the first and second measuring points are the highest point of the withers and the point on the ground just below the highest point of the withers, respectively;

[0178] (2) When measuring the oblique length of the animal, the first and second measuring points are the endpoint of the front edge of the shoulder and the endpoint of the outer edge of the ischial end respectively;

[0179] (3) When measuring the hip width of an animal, the first and second measuring points are the endpoints of the outer edges of the hip joints on both sides of the animal;

[0180] (4) When measuring the chest circumference of an animal, the first and second measuring points are the end point of the posterior angle of the scapula and the point on the animal's body just below the end point of the posterior angle of the scapula, respectively.

[0181] The above-mentioned measurement point settings correspond to the points at which the animal's body shape characteristics are actually measured. Therefore, by obtaining the actual distance between the first measurement point and the second measurement point, the actual body shape parameters of the animal can be obtained.

[0182] For example, when the first measurement point and the second measurement point are the front edge endpoint of the shoulder end and the outer edge endpoint of the ischium end, respectively, the actual distance between the first measurement point and the second measurement point corresponds exactly to the oblique length of the animal's body.

[0183] When obtained through the above method:

[0184] First, based on the animal image segmentation results, the front edge endpoint of the animal's shoulder end and the outer edge endpoint of the ischial end are used as the first and second measurement points;

[0185] Subsequently, the drone, carrying a binocular thermal imaging camera, continuously adjusted its position and image acquisition angle within the breeding area until the first and second measurement points on the same animal were at the same distance from the binocular thermal imaging camera (this distance information can be directly acquired by the binocular thermal imaging camera).

[0186] Then, the line between the first measuring point and the second measuring point on the same animal is used as the reference measuring line, and the lines between the first measuring point and the second measuring point on the remaining animals are used as measuring lines;

[0187] Then, the actual physical coordinates of each measurement point in the acquired image are obtained according to the above method. Based on this, the length of the reference measurement line can be directly obtained, which corresponds to the body oblique length of the animal to which it belongs. The reference measurement line is offset to the measurement line and used as a reference for calculating the actual length of the measurement lines of other animals.

[0188] Finally, a unique plane to be collected is constructed using the reference measurement line and the offset measurement line. The drone, carrying a binocular thermal imaging camera, is positioned parallel to the plane to be collected and captures images perpendicular to the plane to be collected, thereby obtaining the coordinates of each measurement point in the plane to be collected; at least the first reference coordinate, the second reference coordinate, and the second measurement coordinate are obtained, all of which are used to obtain the actual physical coordinates of each measurement point in the collected image according to the above method.

[0189] Thus, the measurement line length of each animal in the initially collected image can be calculated in sequence, corresponding to the oblique body length of each animal. Preferably, the above steps can be completed by multiple drones carrying binocular thermal imaging cameras.

[0190] Obviously, the above embodiments are merely examples for clarity of explanation and are not intended to limit the implementation methods. Those skilled in the art will readily appreciate that other variations or modifications based on the above descriptions are possible. It is not necessary and impossible to enumerate all implementation methods here. Obvious variations or modifications arising therefrom remain within the scope of protection of the present invention.

Claims

1. A method for identifying animal body shape characteristics for livestock breeding management, characterized in that: The steps include: Establish simulation data sets and real data sets; Based on the simulation data set, an animal segmentation model for animal image segmentation is established; Apply the animal segmentation model to real datasets through transfer learning methods; In the real livestock breeding process, we continuously collect real data on animal breeding and expand the real data set; Use the expanded real data set to improve the established animal segmentation model or establish a new animal segmentation model; In the actual livestock breeding process, animal image data is collected through image data acquisition equipment; based on the animal image data, the animal image segmentation results are output through the animal segmentation model; Extracting at least two measurement points on each animal in the animal image segmentation result: a first measurement point and a second measurement point, and constructing a measurement line for body feature recognition for each animal based on the first measurement point and the second measurement point; Continuously adjusting the calibration parameters of the image data acquisition device until the animal image segmentation result shows that at least one first measurement point and a second measurement point on the animal are at an equal distance from the image data acquisition device, and constructing a reference measurement line based on the first measurement point and the second measurement point on the animal that are at an equal distance from the image data acquisition device; According to the calibration parameters of the image data acquisition equipment, the pixels in the animal image segmentation results are converted into actual physical coordinates, so as to obtain the actual physical coordinates of each first measurement point and the second measurement point, calculate the length of the baseline measurement line, and calculate the actual length of the measurement line of each animal with reference to the baseline measurement line length; based on the actual length of the measurement line of each animal, the animal body shape and physical sign results are calculated and output.

2. The animal body shape feature recognition method for livestock breeding management according to claim 1, characterized in that: The steps to establish the simulation data set are as follows: Build a simulated livestock breeding scene based on the real livestock breeding scene; Place animal models in the simulated animal husbandry scene, and simulate the number of animals and the relative positions of the animals; A fixed camera is set up around the simulated animal husbandry scene to collect a first simulated image; at the same time, a second simulated image is collected in the simulated animal husbandry scene area by using a drone; The simulation data set is established by combining the first simulation image, the second simulation image, the known geometric dimensions of the simulated animal husbandry scene, and the known body features of the animal model.

3. The animal body shape feature recognition method for livestock breeding management according to claim 2, characterized in that: The steps to build a real data set are as follows: In a real livestock breeding scene, a fixed-position camera is set up within the animal activity area to collect a first real image; at the same time, a drone is used to collect a second real image in the real livestock breeding scene area; Measure the body shape characteristics of animals raised in a variety of real livestock farming scenarios; The real data set is established by combining the first real image, the second real image, and the known geometric dimensions of the real livestock breeding scene and the body shape characteristics obtained by animal measurement.

4. The animal body shape feature recognition method for livestock breeding management according to claim 3, characterized in that: Building an animal segmentation model for animal image segmentation includes the following steps: Step 1: preprocessing the collected first simulation image and the second simulation image; Step 2: Annotate the preprocessed first simulation image and the second simulation image to generate animal outline and key point annotation data; Step 3: Establish an animal segmentation model based on the deep learning model, and train and optimize the animal segmentation model based on distillation and pruning techniques.

5. The animal body shape feature recognition method for livestock breeding management according to claim 1, characterized in that: Real animal husbandry scenarios include but are not limited to penned and free-range farming; the body characteristics measured by animals include but are not limited to the height, oblique length, hip width and chest circumference of the animals; When measuring the height of an animal, the first measuring point and the second measuring point are the highest point of the withers and the point on the ground just below the highest point of the withers, respectively; When measuring the oblique length of the animal's body, the first and second measuring points are the end point of the front edge of the shoulder end and the end point of the outer edge of the ischial end, respectively; When measuring the hip width of an animal, the first and second measuring points are the outer edge endpoints of the hip joint on both sides of the animal; When measuring the chest circumference of an animal, the first measuring point and the second measuring point are the end point of the posterior angle of the shoulder blade and the point on the animal's body just below the end point of the posterior angle of the shoulder blade, respectively.

6. The animal body shape feature recognition method for livestock breeding management according to claim 1, characterized in that: The actual length of the measuring line for each animal is calculated based on the length of the baseline measuring line, including the following steps: The coordinates of the first measuring point on the reference measuring line are obtained as the first reference coordinates; the coordinates of the first measuring point on the measuring line are obtained as the first measuring coordinates; Taking the first reference coordinate as the origin, the reference measurement line is offset to the measurement line to be calculated, so that the first reference coordinate after the reference measurement line is offset coincides with the first measurement coordinate, and the second reference coordinate is located close to one end of the second measurement coordinate; A plane to be collected is established based on the offset reference measurement line and the measurement line to be calculated. The animal image data is collected perpendicularly to the plane to be collected by the image data acquisition device. The coordinates of the second measurement point on the reference measurement line are obtained as the second reference coordinates. The coordinates of the second measurement point on the measurement line are obtained as the second measurement coordinates. The distance between the second reference coordinate and the second measurement coordinate after the reference measurement line is offset is calculated, and the actual length of the measurement line to be calculated is calculated in combination with the length of the reference measurement line.

7. The animal body shape feature recognition method for livestock breeding management according to claim 1, characterized in that: The image data acquisition device is a binocular thermal imaging camera mounted on a UAV. The calibration parameters of the binocular thermal imaging camera include intrinsic parameters and extrinsic parameters. Intrinsic parameters: focal length, principal point position and pixel scale factor; External parameters: coordinates and posture of the origin of the binocular thermal imaging camera coordinate system in the world coordinate system; The coordinates of the origin of the binocular thermal imaging camera coordinate system in the world coordinate system are obtained by the following steps: Use ORB feature points to extract and match visual features in images collected by visual sensors; Conduct data coupling between the data collected by the visual sensor and the data collected by the inertial measurement unit; The coupled visual sensor observation residual and the inertial measurement unit observation residual are nonlinearly optimized to obtain the coordinates of the origin of the binocular thermal imaging camera coordinate system in the world coordinate system; Based on the coordinates of the origin of the binocular thermal imaging camera coordinate system in the world coordinate system, the pixels in the animal image segmentation result are converted to the world coordinate system through a coordinate conversion tool or a transformation matrix, thereby obtaining the actual physical coordinates of the pixels in the animal image segmentation result.

8. The animal body shape feature recognition method for livestock breeding management according to claim 7, characterized in that: Extracting visual features from images collected by visual sensors includes the following steps: (1) Based on FAST corner point positioning, the coordinates of the positioning pixels are extracted and the position of the feature points in the image is determined: Step 1: After grayscale processing of the image collected by the visual sensor, a pixel point is randomly selected in the grayscale image. , assuming its gray value is ; Step 2: Build The center of the circle is , and the three pixels are a circle with a fixed radius. 16 pixels evenly distributed on the circumference are selected, and the gray value is ; Step 3: Set a threshold for the grayscale value of the pixel , if exists The grayscale values ​​of consecutive pixels satisfy , then the pixel Identify as a corner point and use the corner point as a feature point; Step 4: Traverse and detect each pixel in the image according to the above steps to obtain the position of the corner point in each frame of the image, that is, the position of the feature point in the image; (2) Using BRIEF descriptor as feature description of feature points: Step 1: Perform Gaussian smoothing on the image, using the corner points As the center, select a local rectangular block to establish a description sub-region; Step 2: Randomly determine For pixels, and compare The gray value of the pixel is marked: ; In the formula, and is the pixel position to be compared, and is the gray value of the corresponding position; Step 3: Use represents the feature dimension, According to the above formula, a set of feature description vectors are formed for the pixel points: ; In the formula, For the Subscripts for feature description vectors; (3) The FAST corner point and the BRIEF descriptor together form an ORB feature point.

9. The animal body shape feature recognition method for livestock breeding management according to claim 8, characterized in that: Matching visual features in images collected by the visual sensor includes the following steps: Step 1: In the image frame Detect and extract feature point set , is any positive integer; at the same time, count the The feature point set of the frame is ; Step 2: In the image frame Detect and extract feature point set , is any positive integer; at the same time, count the The feature point set of the frame is ; Step 3: Calculation Any feature point and The feature points in The Euclidean distance between: ; Step 4: Calculate the distance between descriptors and get The matching feature point with the shortest distance That is Middle feature point Brute force solution of the closest matching point; Step 5: Traversal All feature points in the ,determine all matching points.

10. The animal body shape feature recognition method for livestock breeding management according to claim 9, characterized in that: Data collection from the visual sensor and the inertial measurement unit are coupled and tightly coupled within the sliding window: Optimize the state quantities of the inertial measurement unit within the sliding window: , , ; In the formula, is the estimated variable to be optimized in the sliding window, is the state variable to be estimated in a key frame, is the inverse depth of a map point observed within the sliding window; For the The state of the inertial measurement unit captured by the image frame, is the inertial measurement unit position, is the inertial measurement unit speed, is the inertial measurement unit rotation, is the acceleration bias, is the gyroscope bias; It is the external reference of the binocular thermal imaging camera; The coupled visual sensor observation residual and inertial measurement unit observation residual are nonlinearly optimized, and the objective function is: ; In the formula, is the marginalized residual, is the prior residual constraint, obtained by iterating the sliding window FEJ algorithm, is the information transformation matrix, which is a square matrix with the same dimension as the variable to be optimized obtained by graph optimization and is solved iteratively using the Ceres-solver library; is the residual part of the inertial measurement unit, based on the difference in the change in position, velocity, rotation, and bias between two frames, is the residual constraint of the inertial measurement unit, is the actual measurement value of IMU; is the visual error function, which comes from the reprojection error. To calculate the coefficient, is the visual error constraint, Calculate values ​​for visual singular value decomposition; Based on the state quantities of the inertial measurement unit after nonlinear optimization, the coordinates of the origin of the binocular thermal imaging camera coordinate system in the world coordinate system are obtained.

Citation Information

Patent Citations

  • Horse body ruler measurement method based on deep learning and image processing

    CN110782467A

  • Cow body size intelligent identification algorithm

    CN117115230A

  • Apparatus and methods for the volumetric and dimensional measurement of livestock

    US20050257748A1

  • Method and device for acquiring external features of animal, and computer device

    WO2022052189A1