Yak body weight estimation method, system and equipment based on key point detection

By combining key point detection and binocular cameras, the problem of large yak weight prediction errors in the existing technology is solved, and more accurate and simple weight measurement is achieved, which is suitable for wild grazing environments.

CN118570572APending Publication Date: 2024-08-30SOUTHWEST UNIVERSITY FOR NATIONALITIES
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202410219783.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-02-28
Publication Date
2024-08-30

AI Technical Summary

Technical Problem

Existing yak weight prediction methods based on machine vision and binocular vision have problems with large body size data errors and complex processes. It is especially difficult to accurately measure the yak's weight under wild grazing conditions.

Method used

Using a method based on key point detection, the trained target detection model and attitude estimation model are used to perform target detection and attitude estimation on yak images, combined with binocular cameras to measure distance, calculate body size data, and input it into the linear regression weight prediction model To get a weight estimate.

Benefits of technology

It improves the accuracy of body measurement data and yak weight estimation, simplifies the processing process, reduces the error of body measurement data, and is suitable for yak weight measurement under wild grazing conditions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118570572A
    Figure CN118570572A
Patent Text Reader

Abstract

The invention provides a yak body weight estimation method, system and equipment based on key point detection. The method comprises the following steps: acquiring a left image and a right image of a yak by using a binocular camera; calculating the distance from the camera to the yak based on the left image and the right image of the yak; performing target detection and attitude estimation on the left image of the yak by adopting a trained target detection model and attitude estimation model to obtain key point positions of the yak image; calculating body size data of the yak based on the distance from the camera to the yak and the position of the key point; and inputting the body size data into a trained linear regression weight prediction model to obtain a weight estimated value of the yak. According to the yak body weight estimation method based on key point detection, the problems that an existing body weight estimation method is large in body size data error and low in body weight estimation accuracy are fundamentally solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of weight estimation, and in particular relates to a method, system and device for estimating yak weight based on key point detection. Background Art

[0002] In recent years, plateau animal husbandry has received attention, and yak breeding, as one of the important pillars of plateau animal husbandry, has attracted much attention. However, due to the strong wildness of yaks and their easy fright, it is difficult to measure their weight, especially under grazing conditions in the wild. Therefore, a method of estimating the weight of yaks using body size indicators is very necessary and practical. Nowadays, there are also some methods that use artificial intelligence to estimate the weight of yaks, which provides a research and application basis for the present invention.

[0003] However, the existing weight prediction method based on machine vision needs to extract the foreground of the yak image first. The extraction effect directly affects the recognition of the measurement points. The measurement error is large when extracting the yak body measurement points based on curvature analysis. The distance is measured using a rangefinder to infer the yak's height, oblique body length, chest depth and other data, which is troublesome in practical applications. In addition, the existing weight prediction method based on binocular vision also first adopts the method of foreground image extraction. The extraction effect is poor for yak images with certain fur colors. After extracting the foreground image of the yak, the algorithm is used to calculate the center point of the yak, and then the position of the remaining key points is determined by the position of the center point. Finally, the depth map is obtained through the binocular camera to obtain the body size data. The processing flow is complicated.

[0004] Therefore, how to reduce the error of body size data and improve the accuracy of weight estimation is an urgent problem to be solved in this field. Summary of the invention

[0005] The purpose of the present invention is to provide a yak weight estimation method, system and device based on key point detection in view of the defects of the prior art. The yak weight estimation method based on key point detection of the present invention performs target detection and posture estimation on the left image of the yak through a trained target detection model and posture estimation model to obtain the key point position of the yak image; a binocular camera is integrated for distance measurement, and the body size data of the yak is calculated according to the distance from the camera to the yak and the key point position, and the body size data is input into the trained linear regression weight prediction model to obtain the yak weight estimation value, thereby fundamentally solving the problems of large error in body size data, low weight estimation accuracy and complicated process in the existing weight estimation method.

[0006] In order to achieve the above purpose, the present invention adopts the following technical solutions:

[0007] The present invention proposes a method for estimating yak weight based on key point detection, which is characterized by comprising the steps of:

[0008] S1, using a binocular camera to collect left and right images of yaks;

[0009] S2. Calculate the distance from the camera to the yak based on the left image and the right image of the yak;

[0010] S3, using the trained target detection model and posture estimation model to perform target detection and posture estimation on the left image of the yak, and obtain the key point positions of the yak image; the key point positions include the topknot point, the tail root point, the front elbow joint point and the hoof point;

[0011] S4. Calculating the body size data of the yak based on the distance from the camera to the yak and the key point positions; the body size data includes the body length, oblique length and height of the yak;

[0012] S5. Input the body size data into a trained linear regression weight prediction model to obtain an estimated weight value of the yak.

[0013] Further, step S2, based on the left image and the right image of the yak, calculate the distance from the camera to the yak, specifically:

[0014]

[0015] The baseline distance B represents the horizontal distance between the two cameras, f is the focal length of the camera lens, and the parallax d represents the horizontal position difference of the same object in the left and right camera images. The parallax d is calculated by the horizontal coordinate x of the left camera image. l The horizontal coordinate x of the right camera image r The object depth Z is obtained by the difference between the camera and the yak.

[0016] Furthermore, in step S3, training the target detection model and the posture estimation model specifically includes:

[0017] S31, constructing a yak image dataset;

[0018] S32, using a labeling tool to perform target detection labeling and key point labeling on the yak images in the yak image dataset;

[0019] S33, exporting a yak image dataset containing annotation information, where the annotation information includes information of a bounding box and key points;

[0020] S34, using the yak image dataset containing the labeled information to train the target detection model and the posture estimation model respectively, to obtain a trained target detection model and a trained posture estimation model.

[0021] Furthermore, the target detection model and the posture estimation model both adopt the YOLOv8 algorithm.

[0022] Furthermore, in step S4, based on the distance from the camera to the yak and the key point positions, the body size data of the yak is calculated in the following manner:

[0023] Body height pixel distance h: the vertical distance from the nail point to the hoof point, expressed as:

[0024]

[0025] Body length pixel distance l: the horizontal distance from the top of the nail to the base of the tail, expressed as:

[0026]

[0027] Body oblique length pixel distance s: the length from the elbow joint point to the tail root point, expressed as:

[0028]

[0029] The calculation formula of the real body height length H is as follows:

[0030]

[0031] The calculation formula of the real body length L is as follows:

[0032]

[0033] The calculation formula of the real body oblique length S is as follows:

[0034]

[0035] Among them, Z is the distance from the camera to the yak, h is the pixel length of the vertical distance from the topknot point to the hoof point in the yak image, and f is the focal length of the camera lens.

[0036] The present invention also proposes a yak weight estimation system based on key point detection, characterized in that the yak weight estimation system executes the yak weight estimation method based on key point detection, including: an image acquisition module, a distance calculation module, a key point acquisition module, a body size data calculation module, and a weight estimation module;

[0037] The image acquisition module uses a binocular camera to acquire a left image and a right image of the yak;

[0038] The distance calculation module calculates the distance from the camera to the yak based on the left image and the right image of the yak;

[0039] The key point acquisition module uses the trained target detection model and posture estimation model to perform target detection and posture estimation on the left image of the yak to obtain the key point positions of the yak image; the key point positions include the topknot point, the tail root point, the front elbow joint point and the hoof point;

[0040] The body size data calculation module calculates the body size data of the yak based on the distance from the camera to the yak and the key point positions; the body size data includes the body length, oblique length and height of the yak;

[0041] The weight estimation module inputs the body size data into a trained linear regression weight prediction model to obtain the estimated weight value of the yak.

[0042] The present invention further provides a computer device, comprising a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the above method when executing the computer program.

[0043] Compared with the prior art, it has the following beneficial effects:

[0044] 1. The yak weight estimation method based on key point detection of the present invention performs target detection and posture estimation on the left image of the yak through the trained target detection model and posture estimation model to obtain the key point position of the yak image; integrates a binocular camera for distance measurement, calculates the body size data of the yak according to the distance from the camera to the yak and the key point position, and inputs the body size data into the trained linear regression weight prediction model to obtain the yak weight estimation value, thereby improving the accuracy of the body size data and the accuracy of the yak weight estimation.

[0045] 2. The yak weight estimation method based on key point detection of the present invention uses the YOLOv8 algorithm to perform target detection and posture estimation of yak images, effectively identifies key points in yak images, and realizes accurate measurement of yak body size; at the same time, a single algorithm is used for image processing, which reduces the complexity of multiple algorithms and methods; using target detection and posture estimation to obtain key points can avoid the situation where the extraction effect is poor during the image segmentation process, and reduce the error of body size data.

[0046] 3. The yak weight estimation method based on key point detection of the present invention adopts a linear regression weight prediction model to predict the yak weight based on the yak's body size data. The model predicts the yak's weight by analyzing the input body size data through a neural network, thereby improving the accuracy of yak weight estimation.

[0047] 4. The yak weight estimation method based on key point detection of the present invention ensures the generalization and accuracy of the training data set through the collection and annotation of the yak image data set, and provides support for accurate target detection and key point recognition using the YOLOv8 algorithm. BRIEF DESCRIPTION OF THE DRAWINGS

[0048] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying any creative work.

[0049] Figure 1 A schematic diagram of a yak weight estimation method based on key point detection provided in an embodiment of the present invention.

[0050] Figure 2 A flow chart of a method for estimating yak weight based on key point detection provided in an embodiment of the present invention.

[0051] Figure 3 A schematic diagram of the imaging principle of a binocular camera provided in an embodiment of the present invention.

[0052] Figure 4 This is an example of a yak image dataset collected according to an embodiment of the present invention, wherein (a) is a picture collected in Hongyuan County, and (b) is a picture crawled from the Internet.

[0053] Figure 5 A schematic diagram of using the LabelMe labeling tool to label a target provided by an embodiment of the present invention.

[0054] Figure 6 A schematic diagram of key point position marking provided by an embodiment of the present invention.

[0055] Figure 7 This is a network structure diagram of the linear regression weight prediction model provided by an embodiment of the present invention.

[0056] Figure 8 A schematic diagram of a handheld device for estimating yak weight provided in an embodiment of the present invention.

[0057] Fig. 9 A schematic diagram of a yak weight estimation system based on key point detection provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0058] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are 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.

[0059] It should be understood that when used in this specification and the appended claims, the terms "include" and "comprises" indicate the presence of described features, integers, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or combinations thereof.

[0060] The present invention will be further described below in conjunction with the accompanying drawings and specific embodiments, but they are not intended to limit the present invention.

[0061] It should also be understood that the terms used in this specification of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention. As used in the specification of the present invention and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an" and "the" are intended to include plural forms.

[0062] It should be further understood that the term "and / or" used in the present description and the appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.

[0063] The present invention proposes a yak weight estimation method based on key point detection. Figure 1 As shown in FIG. 1 , the method for estimating yak weight based on key point detection includes the following steps S1 to S5. In addition, the flow chart of the method for estimating yak weight based on key point detection is as follows: Figure 2 shown.

[0064] S1. Use a binocular camera to collect the left and right images of the yak.

[0065] A binocular camera is a device that obtains stereoscopic images through two camera lenses. It uses the principle of human vision and obtains three-dimensional information of objects by simulating the human binocular vision system. Binocular cameras are widely used in computer vision, robot vision, virtual reality and other fields. A binocular camera consists of two parallel cameras, each with its own lens and image sensor.

[0066] S2. Calculate the distance from the camera to the yak based on the left image and the right image of the yak.

[0067] The distance between the two cameras is called the baseline distance, which determines the stereoscopic field of view and parallax range of the binocular camera. The binocular camera obtains the three-dimensional information of the object by simulating the binocular vision system of the human eye and using the principle of parallax. Parallax refers to the difference in the position of the object in the two camera lenses. This difference is caused by the baseline distance between the two cameras. By measuring this difference, the depth information of the object can be calculated. The imaging principle of the binocular camera can be Figure 3 shown.

[0068] Based on the left image and the right image of the yak, the distance from the camera to the yak is calculated as follows:

[0069]

[0070] The baseline distance B represents the horizontal distance between the two cameras, f is the focal length of the camera lens, and the parallax d represents the horizontal position difference of the same object in the left and right camera images. The parallax d is calculated by the horizontal coordinate x of the left camera image. l The horizontal coordinate x of the right camera image r The object depth Z is obtained by the difference between the camera and the yak.

[0071] After the yak image is acquired through the binocular camera, it is divided into two images, left and right, and the yak is ensured to be in the left and right images respectively. The left image is used for target detection and posture estimation to find the key point position, and the right image and the left image form a parallax to calculate the real distance from the camera to the yak.

[0072] S3. Use the trained target detection model and posture estimation model to perform target detection and posture estimation on the left image of the yak to obtain the key point positions of the yak image; the key point positions include the topknot point, the tail root point, the front elbow joint point and the hoof point.

[0073] In one embodiment, training the target detection model and the posture estimation model specifically includes:

[0074] S31. Build a yak image dataset.

[0075] The yak image dataset is constructed by manual collection and online crawling. The manual collection location is Hongyuan County, Aba Prefecture, Sichuan Province. Figure 4 As shown, (a) is a picture collected in Hongyuan County, and (b) is a picture crawled from the Internet.

[0076] When collecting image data of yaks, images were collected at different angles, different time periods, and different lighting conditions to ensure image quality and diversity, so as to facilitate the training of the YOLOv8 algorithm.

[0077] S32: using a labeling tool to perform target detection labeling and key point labeling on the yak images in the yak image dataset.

[0078] In one embodiment, the LabelMe annotation tool is used to import the collected yak image into the LabelMe annotation tool. LabelMe provides a user-friendly interactive interface for annotating images.

[0079] Object detection and annotation: Draw bounding boxes on the yak image to mark the overall position of the yak. ​​These bounding boxes should ensure that the entire shape of the yak is covered. Yaks that can be fully identified in the near distance should be fully annotated, and those that cannot be fully identified in the far distance need to be discarded. Figure 5 shown.

[0080] Key point annotation: When drawing the upper bounding box of the yak image, annotate the key points, such as the topknot point, the base of the tail point, the front elbow joint point and the hoof point. Each key point should be annotated at a specific coordinate point in strict accordance with the standard. The key points of the yak are as follows: B: topknot point; G: base of the tail point; Z: front elbow joint point; T: hoof point. Figure 6 shown.

[0081] S33, exporting a yak image dataset containing annotation information, where the annotation information includes information of a bounding box and key points.

[0082] Export the labeled data to the JSON format required by the YOLOv8 algorithm. These files contain detailed information about bounding boxes and key points. Through such steps, a high-quality Yak dataset can be created to support accurate target detection and key point recognition using the YOLOv8 algorithm.

[0083] S34, using the yak image dataset containing the labeled information to train the target detection model and the posture estimation model respectively, to obtain a trained target detection model and a trained posture estimation model.

[0084] The target detection model and the pose estimation model are trained respectively using the yak image dataset containing the labeled information, wherein both the target detection model and the pose estimation model use the YOLOv8 algorithm, and these labeled datasets are used to train and verify the YOLOv8 algorithm. During the training process, the algorithm will learn how to accurately identify the position and key points of the yak.

[0085] Specifically, the target detection process of the YOLOv8 algorithm can be divided into the following steps. First, feature extraction is performed through a series of convolutional layers, pooling layers, and activation functions. The second is prediction box generation. After feature extraction, the YOLOv8 algorithm generates prediction boxes. Since there is only one class, yak, during training, each prediction box represents an area that may contain yaks and is used to locate yaks. For each prediction box, the YOLOv8 algorithm calculates its degree of match with the real target object. This process is achieved by comparing the prediction box with the position, size, and category of the real target object. If the prediction box matches the real target object to a high degree, the prediction box is considered correct. During the target detection process, the YOLOv8 algorithm calculates the loss function to optimize the parameters of the model. The loss functions include classification loss, box regression loss, and object confidence loss. These loss functions are calculated based on the difference between the predicted results and the real results, thereby guiding the update of the model parameters.

[0086] In addition to target detection, the YOLOv8 algorithm also performs posture estimation on the yak. ​​Pose estimation refers to determining the key points, orientation, tilt angle and other information of the target object. In the YOLOv8 algorithm, posture estimation is achieved by analyzing the texture features and shape information of the target object. The YOLOv8 algorithm extracts the texture features of the target object, including color, texture, edge, etc. In addition to the texture features, the YOLOv8 algorithm also extracts the contour, size, direction, etc. of the target object. After extracting the texture features and shape information of the target object, the YOLOv8 algorithm performs posture estimation based on this information. By analyzing the texture features and shape information of the target object, its key points, orientation, tilt angle and other information are determined. At the same time, the loss function is optimized together with the loss function in the target detection process to achieve better performance and accuracy.

[0087] S4. Calculate the body size data of the yak based on the distance from the camera to the yak and the key point positions; the body size data includes the body length, oblique body length, and body height of the yak.

[0088] After performing target detection and posture estimation on the yak image, we initially obtain a picture with key point information. Each key point has a plane coordinate. For example, the coordinate of the topknot point is expressed as (x 髻甲点 ,y 髻甲点 ). While predicting the key points, the stereo matching algorithm is used to measure the distance between the camera and the yak using the binocular image to obtain the distance Z between the camera and the yak. ​​The yak body size data in the image can be expressed by the following parameter formula:

[0089] Body height pixel distance (h): the vertical distance from the nail point to the hoof point, expressed as:

[0090]

[0091] Body length pixel distance (l): The horizontal distance from the top of the nail to the base of the tail, expressed as:

[0092]

[0093] Body oblique length pixel distance (s): the length from the elbow joint point to the tail root point, expressed as:

[0094]

[0095] Through these steps and formulas, the necessary geometric parameters can be accurately extracted from the yak image, and the pixel distance of the body size in the yak image can be calculated. The actual body size data of the yak can be estimated through the following parameters and conversion formulas, taking body length as an example:

[0096] Distance(Z): The distance between the camera and the yak.

[0097] Focal length (f): The focal length of the camera lens.

[0098] Pixel body length (h): The pixel length of the vertical distance from the topknot point to the hoof point in the yak image.

[0099] The calculation formula of the real body height length H is as follows:

[0100]

[0101] The calculation formula of the real body length L is as follows:

[0102]

[0103] The calculation formula of the real body oblique length S is as follows:

[0104]

[0105] S5. Input the body size data into a trained linear regression weight prediction model to obtain an estimated weight value of the yak.

[0106] By acquiring the body size data of yaks and inputting it into the trained linear regression prediction model, the weight data of yaks is predicted. The linear regression weight prediction model uses the PyTorch framework to build a neural network for yak weight prediction. The model contains five fully connected layers, which are configured with 3 to 5, 5 to 10, 10 to 5, 5 to 3 and 3 to 1 neurons. Each fully connected layer is followed by a LeakyReLU activation function to introduce nonlinearity and enhance the expressive power of the model. At the same time, each activation function is followed by a Dropout layer, and a drop probability of 0.1 is set to reduce overfitting. The network is trained using the L1 loss function and the Adam optimizer, where the learning rate is adjusted during the training process. The data set includes the body size data of yaks, such as body length, oblique body length, and body height, as input features, and the weight of yaks is used as the prediction target. The input data is standardized to adapt to model training. During the entire training process, the model is saved after each epoch for subsequent evaluation and prediction. The network structure diagram of the linear regression weight prediction model is shown in the figure below. Figure 7 shown.

[0107] The present invention performs target detection and posture estimation model training on yak images and integrates the binocular stereo matching algorithm into the YOLOv8 algorithm, so as to obtain the distance information from the camera to the yak while obtaining the key points in the yak image, thereby calculating the actual body size data information of the yak, and finally obtaining the yak weight through the calculation of the sex regression weight prediction model.

[0108] In addition, in order to facilitate researchers or yak farmers to apply this algorithm in actual scenarios, we plan to deploy the algorithm on microcomputers such as Raspberry Pi. The portability and computing power of Raspberry Pi make it an ideal edge computing device, especially suitable for outdoor or pasture environments. With a 1440x2560 high-definition display, it can display images collected from the binocular camera module in real time, and instantly process and display results, such as the body size data and estimated weight of yaks.

[0109] As a key image acquisition device, the binocular camera module can provide high-precision image data, which is crucial to ensure the accuracy of the algorithm. The binocular camera used this time has a resolution of 1080P, and the longer baseline provides the possibility of estimating the weight of yaks from a longer distance. In addition, in order to ensure the stable operation of the system, a relatively portable power module such as a power bank will be used to power all electronic components such as the Raspberry Pi, display and binocular camera module. The schematic diagram of the yak weight estimation handheld device is shown below. Figure 8 shown.

[0110] Such an integrated system will provide an efficient and convenient tool for the yak breeding industry, allowing researchers and breeders to more accurately monitor and manage the health and growth of yaks. Through the application of this technology, it can not only improve breeding efficiency, but also provide support for the modernization of livestock breeding.

[0111] Fig. 9 The embodiment of the present invention provides a yak weight estimation system based on key point detection. Fig. 9 As shown, the yak weight estimation system based on key point detection includes an image acquisition module, a distance calculation module, a key point acquisition module, a body size data calculation module, and a weight estimation module.

[0112] The image acquisition module uses a binocular camera to acquire a left image and a right image of the yak;

[0113] The distance calculation module calculates the distance from the camera to the yak based on the left image and the right image of the yak;

[0114] The key point acquisition module uses the trained target detection model and posture estimation model to perform target detection and posture estimation on the left image of the yak to obtain the key point positions of the yak image; the key point positions include the topknot point, the tail root point, the front elbow joint point and the hoof point;

[0115] The body size data calculation module calculates the body size data of the yak based on the distance from the camera to the yak and the key point positions; the body size data includes the body length, oblique length and height of the yak;

[0116] The weight estimation module inputs the body size data into a trained linear regression weight prediction model to obtain the estimated weight value of the yak.

[0117] The above-mentioned yak weight estimation system based on key point detection can be implemented in the form of a computer program, and the computer program can be run on a computer device.

[0118] The computer device may be a server, wherein the server may be an independent server or a server cluster composed of multiple servers.

[0119] The computer device includes a processor, a memory, and a network interface connected via a system bus, wherein the memory may include a non-volatile storage medium and an internal memory.

[0120] The non-volatile storage medium can store an operating system and a computer program. The computer program includes program instructions, and when the program instructions are executed, the processor can execute a yak weight estimation method based on key point detection.

[0121] The processor is used to provide computing and control capabilities to support the operation of the entire computer equipment.

[0122] The internal memory provides an environment for the operation of a computer program in a non-volatile storage medium. When the computer program is executed by a processor, the processor can execute a method for estimating yak weight based on key point detection.

[0123] The network interface is used to communicate with other devices over the network. Those skilled in the art will appreciate that the above-mentioned computer device structure is only a partial structure related to the present application solution, and does not constitute a limitation on the computer device to which the present application solution is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0124] The processor is used to run a computer program stored in the memory, and the program implements the yak weight estimation method based on key point detection described in Example 1.

[0125] It should be understood that in the embodiments of the present application, the processor may be a central processing unit (CPU), and the processor may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among them, the general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.

[0126] It can be understood by those skilled in the art that all or part of the processes in the method for implementing the above embodiment can be completed by instructing the relevant hardware through a computer program. The computer program includes program instructions, and the computer program can be stored in a storage medium, which is a computer-readable storage medium. The program instructions are executed by at least one processor in the computer system to implement the process steps of the embodiment of the above method.

[0127] The present invention also provides a storage medium. The storage medium may be a computer-readable storage medium. The storage medium stores a computer program, wherein when the computer program is executed by a processor, the processor executes a method for estimating yak weight based on key point detection as described in Embodiment 1.

[0128] The storage medium may be a USB flash drive, a mobile hard disk, a read-only memory (ROM), a magnetic disk, or an optical disk, or any other computer-readable storage medium that can store program codes.

[0129] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.

[0130] In the several embodiments provided by the present invention, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of each unit is only a logical function division, and there may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed.

[0131] The steps in the method of the embodiment of the present invention can be adjusted in order, combined and deleted according to actual needs. The units in the device of the embodiment of the present invention can be combined, divided and deleted according to actual needs. In addition, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.

[0132] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a storage medium. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, terminal, or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention.

[0133] Note that the above are only preferred embodiments of the present invention and the technical principles used. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and that various obvious changes, readjustments and substitutions can be made by those skilled in the art without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in more detail through the above embodiments, the present invention is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of the present invention, and the scope of the present invention is determined by the scope of the appended claims.

Claims

1. A method for estimating yak weight based on key point detection, characterized in that: Includes steps: S1, using a binocular camera to collect left and right images of yaks; S2. Calculate the distance from the camera to the yak based on the left image and the right image of the yak; S3, using the trained target detection model and posture estimation model to perform target detection and posture estimation on the left image of the yak, and obtain the key point positions of the yak image; the key point positions include the topknot point, the tail root point, the front elbow joint point and the hoof point; S4. Calculating the body size data of the yak based on the distance from the camera to the yak and the key point positions; the body size data includes the body length, oblique length and height of the yak; S5. Input the body size data into a trained linear regression weight prediction model to obtain an estimated weight value of the yak.

2. The method according to claim 1, characterized in that Step S2, based on the left image and the right image of the yak, calculate the distance from the camera to the yak, specifically: The baseline distance B represents the horizontal distance between the two cameras, f is the focal length of the camera lens, and the parallax d represents the horizontal position difference of the same object in the left and right camera images. The parallax d is calculated by the horizontal coordinate x of the left camera image. l The horizontal coordinate x of the right camera image r The object depth Z is obtained by the difference between the camera and the yak.

3. The method according to claim 1, characterized in that: In step S3, training the target detection model and the posture estimation model specifically includes: S31, constructing a yak image dataset; S32, using a labeling tool to perform target detection labeling and key point labeling on the yak images in the yak image dataset; S33, exporting a yak image dataset containing annotation information, where the annotation information includes information of a bounding box and key points; S34, using the yak image dataset containing the labeled information to train the target detection model and the posture estimation model respectively, to obtain a trained target detection model and a trained posture estimation model.

4. The method according to claim 3, characterized in that The target detection model and the posture estimation model both use the YOLOv8 algorithm.

5. The method according to claim 1, characterized in that Step S4, based on the distance from the camera to the yak and the key point positions, calculate the body size data of the yak, specifically in the following manner: Body height pixel distance h: the vertical distance from the nail point to the hoof point, expressed as: Body length pixel distance l: the horizontal distance from the top of the nail to the base of the tail, expressed as: Body oblique length pixel distance s: the length from the elbow joint point to the tail root point, expressed as: The calculation formula of the real body height length H is as follows: The calculation formula of the real body length L is as follows: The calculation formula of the real body oblique length S is as follows: Among them, Z is the distance from the camera to the yak, h is the pixel length of the vertical distance from the topknot point to the hoof point in the yak image, and f is the focal length of the camera lens.

6. A yak weight estimation system based on key point detection, characterized in that: The yak weight estimation system implements the yak weight estimation method based on key point detection as claimed in claim 1, comprising: an image acquisition module, a distance calculation module, a key point acquisition module, a body size data calculation module, and a weight estimation module; The image acquisition module uses a binocular camera to acquire a left image and a right image of the yak; The distance calculation module calculates the distance from the camera to the yak based on the left image and the right image of the yak; The key point acquisition module uses the trained target detection model and posture estimation model to perform target detection and posture estimation on the left image of the yak to obtain the key point positions of the yak image; the key point positions include the topknot point, the tail root point, the front elbow joint point and the hoof point; The body size data calculation module calculates the body size data of the yak based on the distance from the camera to the yak and the key point positions; the body size data includes the body length, oblique length and height of the yak; The weight estimation module inputs the body size data into a trained linear regression weight prediction model to obtain the estimated weight value of the yak.

7. A computer device, characterized in that: The device comprises a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the method according to any one of claims 1 to 5 is implemented.

Citation Information

Cited By

  • Livestock weight estimation method, device and equipment based on cross mark visual measurement and storage medium

    CN122468240A