Method, device and computer-readable storage medium for obtaining livestock weight
By generating a 3D point cloud from the image of the breeding bar and segmenting the mask image of the livestock using an instance segmentation model, the problems of high labor costs and low work efficiency in the prior art are solved, and a method of efficiently obtaining the weight of the livestock is realized.
Patent Information
- Application Number
- CN202210007019.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-05
- Publication Date
- 2025-05-30
- Estimated Expiration
- 2042-01-05
AI Technical Summary
The prior art requires manual participation when acquiring livestock weight, resulting in high labor costs and low work efficiency.
By obtaining the image of the breeding bar, a 3D point cloud is generated and converted into a 3D depth image. The mask image of each livestock is divided from the 3D depth image by using an example segmentation model, and then the target image of each livestock is obtained. Finally, the weight of each livestock is calculated based on the trunk area and body length of each livestock.
Reduces the need for manual annotation and calculation, reduces labor costs, and improves work efficiency.
Smart Images

Figure CN114419131B_ABST
Abstract
Description
Technical Field
[0001] The present invention generally relates to the technical field of methods for obtaining livestock weights. More specifically, the present invention relates to a method, device, and computer-readable storage medium for obtaining livestock weights. Background Art
[0002] Currently, when a farm obtains the weight of the livestock it raises, the commonly used method is to place the livestock on a weighing device such as a weighing scale, and obtain the weight of the livestock through the weighing device. On the one hand, this weighing method requires transporting the livestock to the weighing device one by one, resulting in high labor costs and time costs; on the other hand, when weighing live livestock, if the livestock move, the accuracy of the detection results will be poor.
[0003] To solve the above problems, a vision-based detection method can be used to obtain the weight of livestock, that is, a camera is used to obtain the 3D depth image of the livestock, and then the livestock in the 3D depth image is identified, and the weight of the livestock is obtained according to the volume of the identified livestock. Since there are usually multiple livestock in the breeding pen, after obtaining the 3D depth image of the breeding pen, it is necessary to first segment each livestock in it one by one, and then identify the weight of each livestock. When segmenting the livestock image from the 3D depth image, it is necessary to first manually annotate the livestock in the 3D depth image, and then use the manually annotated 3D depth image to train the segmentation network model to obtain a segmentation network model that can segment the livestock image from the 3D depth image. However, the 3D depth image has many feature points, and the annotation process is rather cumbersome, requiring a large amount of labor costs; in addition, when segmenting the 3D depth image, the segmentation network model needs to perform complex calculations on a large amount of data, so there is also a problem of low work efficiency.
[0004] In summary, it can be seen that when identifying livestock in an image in the prior art, there are problems of high labor costs and low work efficiency due to the need for manual annotation. Summary of the Invention
[0005] The present invention provides a method, device, and computer-readable storage medium for obtaining livestock weights, so as to at least solve the problems of high labor costs and low work efficiency due to the need for manual participation when obtaining livestock weights.
[0006] To solve the above problems, in a first aspect, the present invention provides a method for obtaining the weight of livestock, including: obtaining an image of a breeding pen and obtaining a corresponding 3D point cloud based on the image of the breeding pen; converting the 3D point cloud into a 3D depth image, using an instance segmentation model to segment a mask image of each livestock from the 3D depth image, and obtaining a target image of each livestock based on the image of the breeding pen and the mask images of each livestock; respectively segmenting the target images of each livestock to obtain a mask image of the torso of each livestock; obtaining the torso area and body length of each livestock based on the mask images of the torso of each livestock, and obtaining the weight of each livestock based on the torso area and body length of each livestock.
[0007] According to an embodiment of the present invention, the instance segmentation model includes a backbone network, a feature pyramid, a yolox_head prediction head, and a yolox_proto network.
[0008] According to another embodiment of the present invention, obtaining the target image of each livestock based on the image of the breeding pen and the mask images of each livestock includes: obtaining an instance image of each livestock based on the image of the breeding pen and the mask images of each livestock; placing the instance images of each livestock into corresponding preset background images respectively to obtain the target images of each livestock.
[0009] According to yet another embodiment of the present invention, obtaining the posture of each livestock based on the target images of each livestock, and deleting the target images of livestock with non-standing postures.
[0010] According to another embodiment of the present invention, obtaining the posture of each livestock based on the target images of each livestock includes: inputting the target images of each livestock into a classification model, and obtaining the posture corresponding to each livestock target image according to the classification model.
[0011] According to yet another embodiment of the present invention, it further includes: preprocessing the 3D point cloud to delete the noise points therein.
[0012] According to another embodiment of the present invention, preprocessing the 3D point cloud includes: in response to the number of points of the 3D point cloud being less than a set number, deleting the 3D point cloud.
[0013] According to yet another embodiment of the present invention, preprocessing the 3D point cloud includes: performing density filtering processing on the 3D point cloud.
[0014] In a second aspect, the present invention further provides a device for obtaining the weight of livestock, including a processor and a memory, the memory is used to store computer program instructions, and the computer program instructions are executed by the processor to implement the method described in any one of the above first aspect embodiments.
[0015] In a third aspect, the present invention further provides a computer-readable storage medium, on which computer program instructions are stored, and when the computer program instructions are executed, the method described in any one of the embodiments of the first aspect above is implemented.
[0016] In the technical solution provided by the present invention, when obtaining the weight of livestock, first, an image of the breeding pen is obtained, and a corresponding 3D point cloud is obtained according to the image of the breeding pen. Then, the 3D point cloud is converted into a 3D depth image, and an instance segmentation model is used to segment the mask images of each livestock from the 3D depth image, so as to obtain the target images of each livestock. Then, according to the target images, the mask images of the trunks of each livestock are obtained, the trunk areas and body lengths of each livestock are obtained according to the mask images of the trunks of each livestock, and finally, the weight of each livestock is obtained according to the trunk areas and body lengths of each livestock. The technical solution provided by the present invention obtains the target images of livestock according to the images of the breeding pen. Since the breeding pen image is a planar image, compared with the 3D depth image, it has fewer feature points to be marked, and when the instance segmentation model processes the data, the amount of data to be processed is also less. Therefore, compared with the prior art, the labor cost can be reduced and the work efficiency can be improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] By referring to the following detailed description with reference to the accompanying drawings, the above and other objects, features, and advantages of the exemplary embodiments of the present invention will become readily understood. In the drawings, several embodiments of the present invention are shown by way of illustration and not limitation, and like or corresponding reference numerals indicate like or corresponding parts, wherein:
[0018] Figure 1 is a flowchart of a method for obtaining the weight of livestock according to an embodiment of the present invention;
[0019] Figure 2 is a schematic diagram of an instance segmentation model according to an embodiment of the present invention; and
[0020] Figure 3 is a schematic diagram of a device for obtaining the weight of livestock according to an embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0021] The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. It should be understood that the embodiments described in this specification are only some embodiments provided by the present invention for the convenience of clear understanding of the solution and for compliance with legal requirements, and not all embodiments that can implement the present invention. All other embodiments obtained by those skilled in the art based on the embodiments disclosed in this specification without creative efforts belong to the scope of protection of the present invention.
[0022] Please refer to Figure 1 ,Figure 1 The figure shows a flowchart of a method for obtaining the weight of livestock according to the present invention. According to Figure 1 the process shown, the method for obtaining the weight of livestock according to the present invention includes:
[0023] In step S1, an image of the breeding pen is acquired, and a corresponding 3D point cloud is obtained based on the image of the breeding pen. In the method provided by the present invention, when acquiring the image of the breeding pen, the camera can be installed on a mobile trolley, and an inspection track is set in the breeding house, and then the mobile trolley is controlled to travel on the inspection track; when the trolley moves to a breeding pen, the camera can be controlled to take a picture of the breeding pen to obtain an image of the breeding pen; for example, the mobile trolley can be made to stay at each breeding pen for three minutes, and an image of the breeding pen is taken every minute to obtain three images of each breeding pen. After obtaining the image of the breeding pen, based on the camera internal parameters and the three-dimensional imaging principle, the collected image of the breeding pen can be analyzed to obtain the corresponding 3D point cloud. In this embodiment, the method for obtaining the corresponding 3D point cloud according to the breeding pen image can refer to the method for obtaining the corresponding 3D point cloud according to the image taken by the camera in the prior art.
[0024] In step S2, the 3D point cloud obtained in step S1 is converted into a 3D depth image, an instance segmentation model is used to segment the mask images of each livestock from the 3D depth image, and then the images of each livestock are obtained based on the image of the breeding pen and the mask images of each livestock.
[0025] When converting the 3D point cloud obtained in step S1 into a 3D depth image, the following calculation formula can be used:
[0026] i = int(scale × x)
[0027] j = int(scale × y)
[0028] value = int(255 × (max - z) / (max - min))
[0029] where x, y, and z are the coordinate values of a point in the 3D point cloud, i and j are the corresponding coordinates of the point in the 3D depth image, value is the pixel value corresponding to the point in the 3D depth image, max is the distance from the camera to the ground, the value of min is set according to the height from the camera to the ground and the expected height of the livestock, and scale is the conversion ratio from the 3D point cloud to the 3D depth image.
[0030] After obtaining the 3D depth image, the 3D depth image can be input into an instance segmentation model, and the instance segmentation model can segment the mask images of each livestock from the 3D depth image. The instance segmentation model in this embodiment can be a segmentation neural network model. The method for obtaining the instance segmentation model can include: First, establish a segmentation neural network model for instance segmentation and a training data set containing multiple 3D depth images of livestock. Then, label the livestock on each 3D depth image in the training data set, and use the labeled training data set to train the established segmentation neural network model to obtain the trained segmentation neural network model, which is the instance segmentation model that can perform instance segmentation on the 3D depth image.
[0031] In step S3, the images of each livestock are segmented respectively to obtain the mask images of the trunks of each livestock. In this step S3, after obtaining the mask images of each livestock, they can be input into the recognition neural network model, and the recognition neural network is used to recognize the trunk parts of the corresponding livestock in the mask images of each livestock to obtain the mask images of the trunks of each livestock. The method for obtaining the recognition neural network in this embodiment can include: First, establish a recognition segmentation neural network model and a training data set containing multiple livestock images. Then, label the trunk parts of the livestock on each livestock image in the training data set, and use the labeled training data set to train the established recognition neural network model to obtain the trained recognition neural network model.
[0032] In step S4, the trunk areas and body lengths of each livestock are obtained according to the mask images of the trunks of each livestock, and the weights of each livestock are obtained according to the trunk areas and body lengths of each livestock. After obtaining the mask image of the livestock trunk, the area area and length of the livestock trunk in the mask image of the trunk can be obtained. Then, according to the area of the livestock trunk in its mask image of the trunk and the above conversion ratio scale, the actual area true_area and body length of the livestock trunk can be obtained through the following calculation formula:
[0033] true_area = area / (scale 2 )
[0034] Since the larger the trunk area of the livestock, the greater its weight, and there is a linearly positive correlation between the two, and the larger the body length of the livestock, the greater its weight. Therefore, in this embodiment, a linear correlation function between the trunk area, body length length and weight of the livestock can be established. After obtaining the actual trunk area of the livestock, the weight of the livestock can be calculated according to the following formula:
[0035] weight = A × true_area + B × length + C
[0036] Where A is the coefficient of the actual area true_area of the livestock trunk, B is the coefficient of the length of the livestock slaughterhouse, and C is a constant.
[0037] In summary, in the technical solution of the present invention for obtaining the weight of livestock, after obtaining the image of the breeding pen, first obtain the corresponding 3D point cloud according to the image of the breeding pen, and convert the 3D point cloud into a 3D depth image; then use an instance segmentation model to segment the mask images of each livestock from the 3D depth image, and then obtain the target images of each livestock; then obtain the mask images of the trunks of each livestock according to the target images of each livestock, and obtain the trunk areas and body lengths of each livestock according to the mask images of the trunks of each livestock, and finally obtain its weight according to the trunk areas and body lengths of each livestock. In the technical solution of the present invention, the target images of livestock are obtained according to the images of the breeding pen. Since the breeding pen image is a planar image, compared with the 3D depth image, the planar image has fewer feature points, so the labor cost for labeling it is lower, and when the instance segmentation model processes the data, the amount of data to be processed is also less. Therefore, compared with the prior art, the technical solution of the present invention can reduce the labor cost and improve the work efficiency when segmenting the mask images of each livestock.
[0038] The method for obtaining the weight of livestock of the present invention is introduced as a whole above. Next, in combination with specific application scenarios, the instance segmentation model will be described in detail.
[0039] Figure 2 What is shown is an instance segmentation model. It can be understood that Figure 2 What is shown is an implementation manner of the instance segmentation model, which is exemplary rather than restrictive. The description of the instance segmentation model above also applies to the description of the Figure 2 instance segmentation model shown below.
[0040] As Figure 2As shown, in one embodiment, the instance segmentation model includes a backbone network, a feature pyramid, a yolox_head prediction head, and a proto segmentation network. The backbone network uses the CSPDarknet53 network, and its input is a 3D depth image with a size of 640×640. After the 3D depth image is input into the backbone network, the backbone network can perform convolutional processing on the 3D depth image to sequentially obtain feature images with sizes of 320×320, 160×160, 80×80, 40×40, and 20×20. The feature pyramid includes an FPN (Feature Pyramid Networks) structure and a PANet (Path Aggregation Network) structure. The FPN structure can upsample the feature image with a size of 20×20 in the backbone network to obtain feature images with sizes of 40×40 and 80×80 respectively, and then splice the feature images with sizes of 40×40 and 80×80 with the feature images with sizes of 40×40 and 80×80 in the backbone network respectively to obtain feature images with sizes of 40×40 and 80×80 after the first splicing. The PANet structure is used to downsample the feature image with a size of 80×80 after the first splicing to sequentially obtain feature images with sizes of 40×40 and 20×20, and then splice them with the feature image with a size of 40×40 after the first splicing and the feature image with a size of 20×20 in the backbone network respectively to obtain feature images with sizes of 40×40 and 20×20 after the second splicing. The feature image with a size of 80×80 after the first splicing and the feature images with sizes of 40×40 and 20×20 after the second splicing are used as the output of the feature pyramid.
[0041] The yolox_head prediction head includes 1×1 and 3×3 convolutional kernels, and its input is the output of the feature pyramid. The yolox_head prediction head can perform feature processing on the output of the feature pyramid to obtain a feature matrix (a + b + c + d, sum). In this feature matrix, sum is the number of target boxes in the image, and a, b, c, and d are all positive integers. Let n be a positive integer greater than or equal to 1 and less than or equal to sum, then the nth column represents the nth target in the image, the first a rows represent the position of the corresponding target box in the image, the b rows after the a-th row represent the confidence level of whether there is livestock in the corresponding target box, the c rows after the a + b-th row are the livestock categories of the corresponding target box, and the d rows after the a + b + c-th row are the mask coefficients of the corresponding target box.
[0042] For example, let the value of a be 4, the value of b be 1, the value of c be 1, and the value of d be 32. Then the first 4 rows of the feature matrix (a + b + c + d, sum) are the positions of the corresponding target boxes in the image. For example, the first row is the length of the corresponding target box, the second row is the width of the corresponding target box, the third row is the abscissa of the center point of the corresponding target box in the image, and the fourth row is the ordinate of the center point of the corresponding target box in the image. The 5th row of the feature matrix (a + b + c + d, sum) is the confidence that there is livestock in the corresponding target box. This confidence can be a value between 0 and 1, indicating the probability that there is livestock in the target box. The 6th row of the feature matrix (a + b + c + d, sum) is the livestock category of the corresponding target box. The livestock of different categories can be numbered respectively, and this row stores the number of the livestock category of the corresponding target box. The 7th - 38th rows of the feature matrix (a + b + c + d, sum), that is, the last 32 rows of this matrix, are the mask coefficients of the corresponding target box.
[0043] The above - mentioned feature matrix (a + b + c + d, sum) is the output of the yolox_head prediction head. The input of the yolox_proto network is the feature map with a size of 80×80 in the output of the feature pyramid, and the feature map with a size of 80×80 can be upsampled to obtain a feature map with a size of 160×160. After upsampling all the feature maps in the input, a feature matrix (160, 160, m) can be obtained, where m is the number of images with a size of 160×160, and this matrix is the output of the yolox_proto network.
[0044] After obtaining the output of the yolox_head prediction head and the yolox_proto network, select the target boxes with a confidence b greater than the set confidence from the matrix output by the yolox_head prediction head, and obtain the mask coefficient matrix C according to the mask coefficients of these target boxes; let the matrix output by the yolox_proto network be P, the Sigmoid function be σ, and the activation function be tanh, then the mask image M of livestock in the 3D depth image can be obtained according to the following formula:
[0045] M = σ(P(tanh(C))) T )
[0046] After obtaining the 3D depth image in step S2, first perform a scaling process on the 3D depth image to scale it into a 3D depth image with a size of 640×640, and then input it into the instance segmentation model. The corresponding mask image of the 3D depth image can be obtained through the instance segmentation model, and then crop it according to the position of the target box in the 3D depth image to obtain the mask images of each livestock.
[0047] The instance segmentation model was introduced in detail above. Below, in combination with specific application scenarios, the method for obtaining the pictures of each livestock target will be described in detail.
[0048] In an application scenario, the step of obtaining the images of each livestock from the image of the breeding pen and the mask images of each livestock in step S2 includes: obtaining the instance images of each livestock from the image of the breeding pen and the mask images of each livestock, and placing the instance images of each livestock into the corresponding preset background pictures respectively to obtain the target pictures of each livestock. Since the image of the breeding pen was scaled during the acquisition of the mask images of each livestock, when obtaining the instance images of each livestock, it is necessary to first restore the size of the mask images of each livestock. Therefore, in this embodiment, after obtaining the mask images of each livestock, first upsample them to the same size as the image of the breeding pen respectively, and then multiply the mask images of each livestock by the image of the breeding pen to obtain the instance images of each livestock. After obtaining the instance images of each livestock, the livestock in the instance image of a single livestock can be cut out, and this cutting can be implemented using the cutting algorithm in opencv; after cutting out each livestock separately, its angle can be adjusted and placed into a black background picture of 400×200 to obtain the target picture of a single livestock.
[0049] Furthermore, in another application scenario, after obtaining the target pictures of each livestock, the posture of the livestock in each target picture can be recognized first, and then the target pictures with the posture of the livestock being standing are retained, and the target pictures with the posture of the livestock not being standing are deleted. There may be various postures of the livestock in the acquired breeding pen image, such as standing, lying down, and squatting, etc. When calculating the weight of the livestock in step S4, if the posture of the livestock is not standing, there will be a large error in the calculation result. Therefore, in this embodiment, after obtaining the target pictures of the livestock, the posture of the livestock in each target picture is recognized first, and the target pictures with the posture of the livestock not being standing are deleted, and only the target pictures with the posture of the livestock being standing are retained, which can improve the accuracy of the detection result of the livestock weight.
[0050] Even further, in yet another application scenario, the method for recognizing the posture of the livestock in each target picture includes: inputting the target pictures of each livestock into a classification model, and obtaining the posture corresponding to each livestock target picture through the classification model. In this embodiment, the classification model can adopt the VGG (Visual Geometry Group) classification model. The VGG classification model is a type of neural network model. When using this VGG classification model, a training data set containing multiple livestock pictures can be established first, and then the postures corresponding to each livestock picture are labeled, and the labeled livestock pictures are used to train the VGG classification model to obtain the trained VGG classification model, so that the VGG classification model can recognize and classify the postures corresponding to each livestock target picture.
[0051] In the above text, the instance segmentation model and the method for obtaining the pictures of each livestock target are introduced in detail. Next, in combination with specific application scenarios, the method for obtaining the weight of livestock in the present invention will be further described in detail.
[0052] In an application scenario, the method for obtaining the weight of livestock in the present invention further includes: after obtaining the 3D point cloud, preprocessing the 3D point cloud to remove the noise points therein. In the obtained image of the breeding pen, there are not only livestock but also other breeding equipment such as feed troughs. Therefore, there will be a lot of noise points in the 3D point cloud obtained according to the image of the breeding pen, which affects the accuracy of the detection result of the livestock weight. Therefore, in this embodiment, after obtaining the 3D point cloud, it is first preprocessed to remove the noise points therein, so as to improve the accuracy of the detection result of the livestock weight.
[0053] Further, in another application scenario, the method for preprocessing the 3D point cloud includes: obtaining the number of points in the 3D point cloud and judging whether the number is less than a set number. If it is less, the 3D point cloud is deleted. In the obtained image of the breeding pen, the more livestock there are in the breeding pen, the more points there are in the 3D point cloud obtained according to the image of the breeding pen. On the contrary, the fewer livestock there are in the breeding pen, the fewer points there are in the 3D point cloud obtained according to the image of the breeding pen. In this embodiment, after obtaining the corresponding 3D point cloud according to the image of the breeding pen, first count the number of points in the 3D point cloud, and then judge whether the number of points in the 3D point cloud is less than a set number (such as 1800). If it is less, it is judged that there are no livestock in the image of the breeding pen, so the 3D point cloud is deleted to reduce the interference of miscellaneous points.
[0054] Further, in yet another application scenario, the method for preprocessing the 3D point cloud includes: performing density filtering on the 3D point cloud to filter out the noise points therein. In this embodiment, the method for performing density filtering on the 3D point cloud includes: counting the average distance of the 25 nearest neighbor points adjacent to each point in the 3D point cloud, and taking this average distance as the point cloud density of this point. Obtain the 1 / 4 quantile and 3 / 4 quantile of all the point cloud densities in the 3D point cloud, and add 0.25 times the difference between the 3 / 4 quantile and the 1 / 4 quantile to the 3 / 4 quantile as the filtering threshold for density filtering. For example, let the maximum point cloud density of all points in the 3D point cloud be Lmax and the minimum value be Mmin, then the calculated filtering threshold for density filtering is (7Lmax + Mmin) / 8. After obtaining the point cloud density of each point in the 3D point cloud, delete the points whose point cloud density is greater than the filtering threshold to realize the density filtering of the 3D point cloud.
[0055] According to another aspect of the present invention, the present invention also provides a device for obtaining the weight of livestock, such as Figure 3As shown, the device for obtaining the weight of livestock includes a processor, a memory, a communication interface, and a communication bus. The processor, the memory, and the communication interface complete communication with each other through the communication bus. The processor is used to provide computing and control capabilities. The memory includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and computer program instructions. The internal memory provides an environment for the operation of the operating system and computer program instructions in the non-volatile storage medium. The communication interface of the above device is used to communicate with an external terminal in a wired or wireless manner. The wireless manner can be implemented through WIFI, a carrier network, NFC (Near Field Communication), or other technologies. In the device for obtaining the weight of livestock provided in this embodiment, the memory is used to store computer program instructions. When the computer program instructions are executed by the processor, the above-mentioned multiple method embodiments for obtaining the weight of livestock can be implemented.
[0056] According to another aspect of the present invention, the present invention also provides a computer-readable storage medium. Those of ordinary skill in the art can understand that all or part of the processes in the above method embodiments for obtaining the weight of livestock can be completed by computer program instructions instructing relevant hardware. The computer program instructions can be stored in a non-volatile computer-readable storage medium. When the computer program instructions are executed, they can include the processes of the above method embodiments. Among them, any reference to a memory, storage, database, or other medium used in the embodiments provided by the present invention can include non-volatile and / or volatile memories. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or an external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
[0057] The terms "first", "second", etc. used in this specification, which are terms used to refer to numbers or ordinals, are for descriptive purposes only and should not be construed as indicating explicitly or implicitly relative importance or implicitly specifying the quantity of the indicated technical features. Thus, features defined with "first" or "second" may explicitly or implicitly include at least one such feature. In the description of this specification, "a plurality of" means at least two, such as two, three or more, etc., unless otherwise specifically defined.
[0058] Although this specification has shown and described multiple embodiments of the present invention, it will be apparent to those skilled in the art that such embodiments are provided by way of example only. Those skilled in the art will think of many changes, alterations and alternative ways without departing from the spirit and idea of the present invention. It should be understood that various alternatives of the embodiments of the present invention described herein may be adopted in the process of practicing the present invention. The appended claims are intended to define the scope of protection of the present invention and thus cover the module compositions, equivalents or alternatives within the scope of protection of these claims.
Claims
1. A method for obtaining the weight of livestock, characterized in that, it includes: Obtaining an image of the breeding pen and obtaining a corresponding 3D point cloud based on the image of the breeding pen; Converting the 3D point cloud into a 3D depth image, and using an instance segmentation model to segment the mask images of each livestock from the 3D depth image; Based on the image of the breeding pen and the mask images of each livestock, obtaining the instance images of each livestock; Placing the instance images of each livestock into corresponding preset background pictures respectively to obtain the target pictures of each livestock; Segmenting the target pictures of each livestock respectively to obtain the mask images of the trunks of each livestock; Obtaining the trunk area and body length of each livestock according to the mask images of the trunks of each livestock, and obtaining the weight of each livestock according to the trunk area and body length of each livestock.
2. The method for obtaining the weight of livestock according to claim 1, characterized in that, the instance segmentation model includes a backbone network, a feature pyramid, a yolox_head prediction head and a yolox_proto network.
3. The method for obtaining the weight of livestock according to claim 1, characterized in that, it further includes: Obtaining the poses of each livestock according to the target pictures of each livestock, and deleting the target pictures of livestock with non-standing poses.
4. The method for obtaining the weight of livestock according to claim 1, characterized in that, obtaining the poses of each livestock according to the target pictures of each livestock includes: inputting the target pictures of each livestock into a classification model, and obtaining the poses corresponding to each livestock target picture according to the classification model.
5. The method for obtaining the weight of livestock according to claim 1, characterized in that, it further includes: Preprocessing the 3D point cloud to delete the noise points therein.
6. The method for obtaining the weight of livestock according to claim 5, characterized in that, preprocessing the 3D point cloud includes: in response to the number of points of the 3D point cloud being less than a set number, deleting the 3D point cloud.
7. The method for obtaining the weight of livestock according to claim 3, characterized in that, preprocessing the 3D point cloud includes: performing density filtering processing on the 3D point cloud.
8. An apparatus for obtaining the weight of livestock, characterized in that, it includes a processor and a memory, the memory is used to store computer program instructions, and the computer program instructions are executed by the processor to implement the method according to any one of claims 1-7.
9. A computer-readable storage medium, on which computer program instructions are stored, characterized in that, when the computer program instructions are executed, the method according to any one of claims 1-7 is implemented.
Citation Information
Patent Citations
Portrait segmentation method and system based on 3D camera
CN111652884A
Body weight estimation method, device and system based on computer vision
CN113532616A