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, an animal segmentation model is established, which solves the efficiency and accuracy problems of animal body shape feature recognition in livestock breeding, and achieves efficient and real-time body shape feature recognition, especially Improved identification efficiency in large-scale breeding scenarios.

CN118710656AActive Publication Date: 2024-09-27INNER 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
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-27
Publication Date
2024-09-27
Estimated Expiration
2044-08-27

AI Technical Summary

Technical Problem

In livestock breeding management, existing technology is difficult to identify animal body characteristics in an efficient, real-time and accurate manner, is easily affected by human factors and the environment, and is less efficient in large-scale and mass breeding.

Method used

Binocular thermal imaging cameras are combined with deep learning models to build animal segmentation models through the establishment and transfer learning of simulated data sets and real data sets. UAVs are used to collect image data, and the body shape characteristics of animals are extracted and calculated. Through image data collection The calibration parameters of the equipment are adjusted, the actual physical coordinates of the animal are obtained, and the length of the reference measurement line is calculated to identify the body shape characteristics.

Benefits of technology

It achieves high-precision identification of animal body characteristics, with an accuracy of up to 90%, optimizes the adjustment of calibration parameters of image data collection equipment, and improves the efficiency of identifying large quantities of animal body characteristics.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118710656A
    Figure CN118710656A
Patent Text Reader

Abstract

The invention relates to the field of livestock breeding management, in particular to an animal body shape feature recognition method for livestock breeding management, and the method comprises the steps: building 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 a real data set through a transfer learning method; in the real livestock breeding process, animal image data are collected; outputting an animal image segmentation result through an animal segmentation model based on the animal image data; and according to calibration parameters of the image data acquisition equipment, pixels in the animal image segmentation result are converted into actual physical coordinates, and an animal body shape sign result is calculated and output. According to the method, the binocular thermal imaging camera is used for collecting animal image data, image segmentation is carried out, and pixel coordinates in the animal image data are converted into actual physical coordinates, so that the body height, the body slope length, the hip width, the chest circumference and other body characteristics of the animal are calculated and output, and the precision can reach 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 an animal body shape feature recognition method for animal husbandry and breeding management. Background Art

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

[0003] In the process of animal husbandry and breeding management, it is very important to obtain the body characteristic parameters of animals. Body characteristic parameters are important indicators for measuring animal growth and development, health status, selection and scientific breeding. For a long time, the body characteristic parameters of animals are usually measured manually using tools such as measuring rods, tape measures and tape measures. The body characteristic parameters of animals obtained in this way are easily affected by human subjective factors, and there is a risk of damaging animals during the measurement process. With the continuous advancement of technology, animal husbandry and breeding management gradually adopts identification tools combined with the Internet of Things (IoT) to identify and monitor the body characteristic parameters of animals. However, due to the fact that animals may move quickly and be blocked during activities, and the identification tools are easily affected by environmental factors, the accuracy of identifying animal body characteristic parameters 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: 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 animal husbandry process, real animal breeding data is continuously collected to expand the real data set; the expanded real data set is used 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 device, pixels in the animal image segmentation result 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 reference measurement line, and calculate the actual length of the measurement line of each animal with reference to the length of the reference measurement line; Based on the actual length of the measurement line of each animal, calculate and output the animal's body shape and physical signs results Further, 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.

[0007] Furthermore, the steps to establish the 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.

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

[0009] Furthermore, real animal husbandry scenarios include but are not limited to penned and free-range; the body characteristics measured by the 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 end points 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.

[0010] Further, the actual length of the measuring line of each animal is calculated with reference to the length of the benchmark 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.

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

[0012] Further, the visual features in the image collected by the visual sensor are extracted, including 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, take 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:

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

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

[0015] Furthermore, matching visual features in the image 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, the feature point set of the tth frame is ; 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 tth frame is ; Step 3: Calculation Any feature point and The feature points in The Euclidean distance between:

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

[0017] 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: Optimize the state quantities of the inertial measurement unit within the sliding window:

[0018]

[0019]

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

[0021] 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 position of the binocular thermal imaging camera in the world coordinate system is obtained.

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

[0023] The above scheme has the following beneficial effects: 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. According to 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 features, with an accuracy of up to 90%.

[0024] Specifically, after the pixel coordinates in the acquired animal image data are converted into actual physical coordinates, the measurement points are extracted by clarifying the specific content of the body shape feature recognition (body height, body oblique length, hip width and chest circumference, etc.), and the calibration parameters of the image data acquisition device are continuously adjusted until two measurement points with the same distance from the image data acquisition device are obtained on the same animal. The reference measurement line is constructed based on the two measurement points on the same animal, and the body shape features of the animal to which the reference measurement line belongs can be directly calculated and obtained based on the reference measurement line. However, due to the different postures of other animals in the acquired images, it is necessary to obtain the reference measurement line of each animal, resulting in the image data acquisition device needing to continuously adjust the calibration parameters, which is less efficient for obtaining the body shape features of animals raised on a large scale.

[0025] 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, quickly constructs a plane to be collected, and directly performs the 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 within the first image collection range can be efficiently calculated, thereby efficiently and accurately identifying the body features of animals within a certain range.

[0026] 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, and enhancing the robustness of the established animal segmentation model; the animal segmentation model is trained on the simulated data set. 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; and the deep neural network is lightweighted using model pruning, model distillation and other technologies to achieve efficient and real-time data feature extraction and accurate animal body feature recognition.

[0027] 3. In outdoor farming scenarios such as grasslands, drones are mainly positioned by GPS, while in indoor farming scenarios such as pens, drones detect weak GPS signals. This solution uses ORB feature points to extract and match visual features; performs sensor data fusion based on the visual-inertial tight coupling method; and performs nonlinear optimization on the fused inertial measurement unit observation residuals and visual residuals to achieve accurate positioning of the binocular thermal imaging camera.

[0028] Additional aspects and advantages of the present invention will be given in part in the following description and in part will be obvious from the following description, or will be learned through practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0029] Figure 1 It is a flow chart of an embodiment of the method for identifying animal body shape characteristics for livestock breeding management of the present invention; Figure 2 A flow chart of establishing an animal segmentation model for an embodiment of the method for identifying animal body shape features for livestock breeding management of the present invention; 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

[0030] The technical solution of the present invention will be described clearly and completely below in conjunction with the accompanying drawings. 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.

[0031] The following is further described in detail through specific implementation methods: Implementation example Figure 1 As shown: A method for identifying animal body shape characteristics for livestock breeding management, comprising the following steps: S1. Establish simulation data set and real data set.

[0032] The steps for establishing the simulation data set are as follows: S101. Building a simulated animal husbandry scene based on the real animal husbandry scene; S102, placing animal models in the simulated animal husbandry scene, and simulating the number of animals and the relative positions of the animals; S103, setting up a fixed camera around the simulated animal husbandry scene to collect a first simulated image; at the same time, using a drone to collect a second simulated image in the simulated animal husbandry scene area; S104. Complete 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.

[0033] The steps for establishing the real data set are as follows: S111. In a real livestock breeding scene (real livestock breeding scenes include but are not limited to caged and free-range breeding), a fixed-position camera is set up within the animal activity area to collect a first real image; at the same time, a second real image is collected within the real livestock breeding scene area by a drone; S112. Measure the body shape characteristics of animals raised in various real animal husbandry scenarios; 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.

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

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

[0036] Building an animal segmentation model for animal image segmentation includes the following steps: 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.

[0037] Step 2: Label the preprocessed first simulation image and the second simulation image to generate animal contour and key point labeling data; this facilitates subsequent accurate training of the animal segmentation model.

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

[0039] 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, which is suitable for processing high-resolution animal images. DeepLabV3+ combines dilated convolution and spatial pyramid pooling, which can effectively capture multi-scale information and is suitable for image segmentation under complex backgrounds. In this embodiment, an animal segmentation model is established based on DeepLabV3+, and 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 reasoning speed.

[0040] S3. Apply the animal segmentation model to the real data set through the transfer learning method. The transfer learning method involved in this step is the prior art in the technical field, so it will not be described in detail.

[0041] S4. In order to ensure the practical application effect of the animal segmentation model, this embodiment also continuously optimizes and verifies the animal segmentation model. The animal segmentation model is trained and optimized through a large amount of experimental data, and different data enhancement methods and loss functions are used to improve the generalization ability of the model. In the real animal husbandry process, real data of animal breeding is continuously collected to expand the real data set; the expanded real data set is used to improve the established animal segmentation model or establish a new animal segmentation model.

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

[0043] 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, this embodiment defines two measurement points as a first measurement point and a second measurement point.

[0044] S7, continuously adjusting the calibration parameters of the image data acquisition device until the first measurement point and the second measurement point on more than one animal are at the same distance from the image data acquisition device in the animal image segmentation result, and constructing a reference measurement line based on the first measurement point and the second measurement point on the animal at the same distance from the image data acquisition device. Specifically, 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, the image data acquisition device is in a parallel position to the line between the first measurement point and the second measurement point. At this time, the line between the first measurement point and the second measurement point is used as the reference measurement line. The actual length of the reference measurement line can be obtained by the actual physical coordinates of the first measurement point and the second measurement point. The length of the reference measurement line obtained by this method is basically consistent with the actual distance between the first measurement point and the second measurement point, and has a high degree of credibility.

[0045] 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, etc., in order 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.

[0046] Therefore, this embodiment uses the reference measurement line as a reference to quickly identify and measure the body features of other animals efficiently and reliably. Before this, the actual physical coordinates of each pixel in the collected animal image must be obtained to facilitate the calculation of the reference measurement line and the actual length of the measurement line.

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

[0048] 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 calibration is performed through the following steps: S701, extracting and matching visual features in the image collected by the visual sensor (binocular thermal imaging camera image collection part) using ORB feature points; Extraction 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 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; Although FAST corner location is fast, it has problems with directionality and scale uncertainty. For scale, the image pyramid is used to take the original image as the starting layer, and the next layer is obtained by scaling at a fixed ratio. The operation is repeated until the image with the lowest resolution is obtained. For directionality, the grayscale centroid method is used to solve it. The implementation steps are as follows: Assume that the moment of a small image block A is:

[0049] In the formula, and The value of is shown in the above formula.

[0050] Then the image block is obtained by moment calculation The grayscale centroid is:

[0051] Further, assume 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:

[0052] (2) BRIEF descriptor is a feature description vector composed of 0 and 1 in binary code. BRIEF descriptor is used as the 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:

[0053] 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:

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

[0055] Matching steps: 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 tth frame is .

[0056] 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 tth frame is .

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

[0058] 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; Step 5: Traversal All feature points in the ,determine all matching points.

[0059] After feature extraction and matching, the RANSAC random consistency check algorithm is used to remove some mismatched points. The principle is as follows: Step 1: There are the same transformation relationships between multiple pairs of feature points in the left and right image matching. and There is a transformation matrix , the transformation relationship is:

[0060] In the formula, It is a third-order matrix, and all elements in the matrix are 1.

[0061] 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:

[0062] In the formula, As the screening threshold of inliers, and Matched feature points.

[0063] 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 condition of the number of iterations is as follows:

[0064] 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 inner points.

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

[0066] Tight coupling within a sliding window: 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 IMU to the camera, 3D landmark points, pseudo depth and other state quantities are optimized:

[0067]

[0068]

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

[0070] S703, performing nonlinear optimization on the coupled visual sensor observation residual and the IMU observation residual to obtain the coordinates of the binocular thermal imaging camera.

[0071] The nonlinear optimization objective function is:

[0072] 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, Computes values ​​for visual singular value decomposition.

[0073] Based on the state quantities (position, speed, 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, so that the image acquisition position can be accurately obtained under different lighting conditions and complex indoor scenes.

[0074] Subsequently, 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. For example, coordinate conversion tools such as OpenCV and MATLAB, transformation matrices or coordinate conversion tools are prior art in the technical field, and the general conversion steps are as follows: Step 1: Get the intrinsic parameter matrix and extrinsic parameter matrix of the binocular thermal imaging camera.

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

[0076] 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 is mainly composed of a rotation matrix and a translation matrix.

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

[0078] 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 reference measurement line. The specific steps are as follows: Get the coordinates of the first measurement point on the reference measurement line and use them as the first reference coordinates; then get the coordinates of the first measurement point on the measurement line and use them as the first measurement coordinates. Use the first reference coordinates as the origin (moving point) to offset the reference measurement line to the measurement line to be calculated, 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.

[0079] A plane to be collected is established based on the offset reference measurement line and the measurement line to be calculated, and the animal image data is collected perpendicularly to the plane to be collected by the image data acquisition device, and the coordinates of the second measurement point on the reference measurement line at this time are obtained, which are used as the second reference coordinates; the coordinates of the second measurement point on the measurement line are obtained, which are used as the second measurement coordinates. The second reference coordinates and the second measurement coordinates obtained in the plane to be collected are also obtained based on the actual physical coordinate acquisition method of each pixel in the animal image.

[0080] 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. Take the distance between the second reference coordinate and the second measurement coordinate after the reference measurement line is offset as one sideline in space, and take the length of the reference measurement line as another sideline in space. The two known sidelines and the measurement line to be calculated form an arbitrary triangle. The angle between the two known sidelines can be obtained based on the first reference coordinate, the second reference coordinate and the second measurement coordinate in the plane to be collected. Therefore, the actual length of the measurement line to be calculated that is offset can be calculated based on the cosine theorem formula.

[0081] Take the body feature recognition of cattle, sheep, horses and other animals as an example. The actual breeding scenarios of these animals include penned and free-range. The body features measured by the animals usually include their body height, body oblique length, hip width and chest circumference. The measurement points selected for the recognition and measurement of their various body features are as follows: (1) 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; (2) When measuring the oblique length of the animal's body, the first measuring point and the second measuring point 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; (3) 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; (4) 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 scapula and the point on the animal's body just below the end point of the posterior angle of the scapula, respectively.

[0082] The above-mentioned measurement point setting positions correspond to the points when the animal's body shape characteristics are actually measured, so 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.

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

[0084] When obtained through the above method: Firstly, based on the animal image segmentation result, the front edge endpoint of the shoulder end and the outer edge endpoint of the ischial end of the animal are used as the first measurement point and the second measurement point; Subsequently, the drone carrying the binocular thermal imaging camera continuously adjusted its position and image acquisition angle in the breeding area, and the device showed that the first and second measurement points on the same animal were at the same acquisition distance from the binocular thermal imaging camera (the distance information here can be directly obtained by the binocular thermal imaging camera); 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; Then, the actual physical coordinates of each measuring point in the acquired image are obtained according to the above method, based on which the length of the reference measuring line can be directly obtained, corresponding to the body oblique length of the animal to which it belongs; the reference measuring line is offset to the measuring line, and it is used as a reference for calculating the actual length of the measuring lines of other animals; Finally, a unique plane to be collected is constructed by using the reference measurement line and the offset measurement line. The drone carries a binocular thermal imaging camera to a position parallel to the plane to be collected, and collects images perpendicularly to the plane to be collected, so that the coordinates of each measurement point in the plane to be collected can be obtained; at least the first reference coordinate, the second reference coordinate and the second measurement coordinate are obtained, and these coordinates are used to obtain the actual physical coordinates of each measurement point in the collected image according to the above method; Thus, the length of the measurement line of each animal in the initially collected image can be calculated in turn, corresponding to the oblique length of the body of each animal. Preferably, the above steps can be completed by multiple drones carrying binocular thermal imaging cameras.

[0085] Obviously, the above embodiments are merely examples for the purpose of clear explanation, and are not intended to limit the implementation methods. For those skilled in the art, other different forms of changes or modifications can be made based on the above description. It is not necessary and impossible to list all the implementation methods here. The obvious changes or modifications derived therefrom are still within the scope of protection of the invention.

Claims

1. A method for identifying animal body shape characteristics for livestock breeding management, It is 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 method for identifying animal body shape characteristics for livestock breeding management according to claim 1, It is 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, It is 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 method for identifying animal body shape characteristics for livestock breeding management according to claim 3, It is 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, It is 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 end points 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, It is 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, It is 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 method for identifying animal body shape characteristics for livestock breeding management according to claim 7, It is 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 method for identifying animal body shape characteristics for livestock breeding management according to claim 8, It is 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, It is 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