Animal body weight detection method, device, equipment and storage medium

文档序号:49542 发布日期:2021-09-28 浏览:23次 中文

阅读说明:本技术 动物体体重检测方法、装置、设备及存储介质 (Animal body weight detection method, device, equipment and storage medium ) 是由 周雅玲 彭显明 杨小平 于 2020-03-24 设计创作,主要内容包括:本申请实施例公开了一种动物体体重检测方法、装置、设备及存储介质。该动物体体重检测方法包括:根据待测动物体的目标深度图,获取目标区域的目标三维点云,所述目标区域是指所述目标深度图中承载所述待测动物体的区域;根据所述目标三维点云确定所述待测动物体的目标体积;根据所述目标体积和所述目标深度图,确定所述待测动物体的体重。本申请实施例中可以通过图像测量出动物体的体重,省去了搬运动物体进行称重的过程,提高了动物体体重的检测精度。(The embodiment of the application discloses a method, a device, equipment and a storage medium for detecting the body weight of an animal. The method for detecting the body weight of the animal comprises the following steps: acquiring a target three-dimensional point cloud of a target area according to a target depth map of an object to be detected, wherein the target area is an area bearing the object to be detected in the target depth map; determining the target volume of the animal body to be detected according to the target three-dimensional point cloud; and determining the weight of the animal body to be detected according to the target volume and the target depth map. The weight of the animal body can be measured through the image in the embodiment of the application, the process of carrying the animal body to weigh is omitted, and the detection precision of the animal body weight is improved.)

1. A method for measuring body weight of an animal, comprising:

acquiring a target three-dimensional point cloud of a target area according to a target depth map of an object to be detected, wherein the target area is an area bearing the object to be detected in the target depth map;

determining the target volume of the animal body to be detected according to the target three-dimensional point cloud;

and determining the weight of the animal body to be detected according to the target volume and the target depth map.

2. The method for detecting the body weight of the animal body according to claim 1, wherein the determining the target volume of the animal body to be detected according to the target three-dimensional point cloud comprises:

acquiring a target polyhedron according to the target three-dimensional point cloud;

and determining the target volume of the animal body to be detected according to the target polyhedron and the target three-dimensional point cloud.

3. The animal body weight detection method according to claim 2, wherein said obtaining a target polyhedron from the target three-dimensional point cloud comprises:

acquiring a plurality of first target points from the target three-dimensional point cloud;

determining an initial polyhedron according to each first target point, wherein the first target points are vertexes of the initial polyhedron;

traversing each point of the remaining three-dimensional point cloud, and if detecting that a second target point is outside the initial polyhedron, iteratively updating the initial polyhedron according to the second target point to obtain a target polyhedron, wherein the remaining three-dimensional point cloud is a set of points in the target three-dimensional point cloud except the first target point, and the second target point is a point in the remaining three-dimensional point cloud.

4. The animal body weight detection method according to claim 2, wherein the determining the target volume of the animal body to be detected according to the target polyhedron and the target three-dimensional point cloud comprises:

determining a three-dimensional point cloud of the target polyhedron according to the target three-dimensional point cloud;

projecting the target polyhedron to a reference plane to obtain a target point cloud, wherein the reference plane is any plane which does not intersect with any plane of the target polyhedron;

and determining the volume of the target polyhedron according to the three-dimensional point cloud of the target polyhedron and the target point cloud to serve as the target volume of the animal body to be detected.

5. The method for detecting the body weight of the animal body according to claim 1, wherein the determining the target volume of the animal body to be detected according to the target three-dimensional point cloud comprises:

acquiring a target plane, wherein the target plane is a plane formed by projecting the target three-dimensional point cloud on a plane point cloud of a reference plane, and the reference plane is a supporting surface of the object to be measured in each plane of the target depth map;

dividing the target plane to obtain a plurality of sub-planes, and calculating the volume to be measured corresponding to each sub-plane according to the target three-dimensional point cloud;

and obtaining the volume of the animal body to be detected according to the volume to be detected corresponding to each sub-plane.

6. The animal body weight detection method according to claim 5, wherein the calculating the volume to be measured corresponding to each sub-plane according to the target three-dimensional point cloud comprises:

determining the area and the corresponding height of each sub-plane according to the target three-dimensional point cloud;

and calculating the volume to be measured corresponding to each sub-plane according to the area of each sub-plane and the corresponding height.

7. The animal body weight detection method according to any one of claims 1 to 6, wherein the determining the body weight of the animal body to be detected according to the target volume and the target depth map comprises:

inputting the target volume and the target depth map into an animal body weight detection model, so that the animal body weight detection model determines the weight of the animal body to be detected according to the target volume and the target depth map.

8. The animal body weight measurement method according to claim 7, wherein the animal body weight measurement model is obtained by:

obtaining and carrying out model training on the initial model according to the depth maps, the volumes and the actual weights of a plurality of animal bodies;

and determining the initial model after the training as the animal body weight detection model.

9. An animal body weight detection device, characterized in that it comprises:

the system comprises an acquisition unit, a processing unit and a processing unit, wherein the acquisition unit is used for acquiring a target three-dimensional point cloud of a target area according to a target depth map of an object to be detected, and the target area refers to an area which bears the object to be detected in the target depth map;

the processing unit is used for determining the target volume of the animal body to be detected according to the target three-dimensional point cloud acquired by the acquisition unit; and determining the weight of the animal body to be detected according to the target volume and the target depth map.

10. An animal body weight detection device comprising a processor and a memory, wherein a computer program is stored in the memory, and the processor executes the animal body weight detection method according to any one of claims 1 to 8 when calling the computer program in the memory.

11. A computer-readable storage medium, having stored thereon a computer program which is loaded by a processor for performing the steps of the method for weight detection in an animal body according to any one of claims 1 to 8.

Technical Field

The embodiment of the application relates to the technical field of computer vision, in particular to a method, a device, equipment and a storage medium for detecting the body weight of an animal.

Background

In real life, it is often necessary to measure the weight of an object. In order to avoid the problem that the body weight measurement process is complicated because an object needs to be transported to a measurement tool when the body weight is measured by using a traditional measurement tool, the volume of the object can be detected based on the principle that the volume is obtained by multiplying the volume and the density, and then the body weight of the object can be determined.

However, some objects are irregular in shape, so that the volume of the object cannot be measured easily and accurately, and inaccurate weight detection is caused easily. And the densities of different objects have individual differences, and if the weights of different objects are determined by adopting the densities of the unified standard, larger weight measurement errors are easily caused.

For example, the bodies of animals are generally irregular, the volumes of animals are difficult to accurately measure, and the density of different animals may cause great individual difference due to factors such as living environment and age.

Therefore, in order to accurately detect the weight of the animal body, the carrying process of the animal body is difficult to avoid.

Disclosure of Invention

The embodiment of the application provides an animal body weight detection method, device, equipment and storage medium, can measure the weight of an animal body through an image, saves the process of carrying the animal body to weigh, and improves the detection precision of the animal body weight.

In one aspect, the present application provides a method for detecting body weight of an animal, the method including:

acquiring a target three-dimensional point cloud of a target area according to a target depth map of an object to be detected, wherein the target area is an area bearing the object to be detected in the target depth map;

determining the target volume of the animal body to be detected according to the target three-dimensional point cloud;

and determining the weight of the animal body to be detected according to the target volume and the target depth map.

In some embodiments of the present application, the determining a target volume of the animal to be tested according to the target three-dimensional point cloud includes:

acquiring a target polyhedron according to the target three-dimensional point cloud;

and determining the target volume of the animal body to be detected according to the target polyhedron and the target three-dimensional point cloud.

In some embodiments of the present application, the obtaining a target polyhedron from the target three-dimensional point cloud comprises:

acquiring a plurality of first target points from the target three-dimensional point cloud;

determining an initial polyhedron according to each first target point, wherein the first target points are vertexes of the initial polyhedron;

traversing each point of the remaining three-dimensional point cloud, and if detecting that a second target point is outside the initial polyhedron, iteratively updating the initial polyhedron according to the second target point to obtain a target polyhedron, wherein the remaining three-dimensional point cloud is a set of points in the target three-dimensional point cloud except the first target point, and the second target point is a point in the remaining three-dimensional point cloud.

In some embodiments of the present application, the determining a target volume of the object to be measured according to the target polyhedron and the target three-dimensional point cloud includes:

determining a three-dimensional point cloud of the target polyhedron according to the target three-dimensional point cloud;

projecting the target polyhedron to a reference plane to obtain a target point cloud, wherein the reference plane is any plane which does not intersect with any plane of the target polyhedron;

and determining the volume of the target polyhedron according to the three-dimensional point cloud of the target polyhedron and the target point cloud to serve as the target volume of the animal body to be detected.

In some embodiments of the present application, the determining a target volume of the animal to be tested according to the target three-dimensional point cloud includes:

acquiring a target plane, wherein the target plane is a plane formed by projecting the target three-dimensional point cloud on a plane point cloud of a reference plane, and the reference plane is a supporting surface of the object to be measured in each plane of the target depth map;

dividing the target plane to obtain a plurality of sub-planes, and calculating the volume to be measured corresponding to each sub-plane according to the target three-dimensional point cloud;

and obtaining the volume of the animal body to be detected according to the volume to be detected corresponding to each sub-plane.

In some embodiments of the present application, the calculating the volume to be measured corresponding to each sub-plane according to the target three-dimensional point cloud includes:

determining the area and the corresponding height of each sub-plane according to the target three-dimensional point cloud;

and calculating the volume to be measured corresponding to each sub-plane according to the area of each sub-plane and the corresponding height.

In some embodiments of the present application, the determining the body weight of the animal to be tested according to the target volume and the target depth map includes:

inputting the target volume and the target depth map into an animal body weight detection model, so that the animal body weight detection model determines the weight of the animal body to be detected according to the target volume and the target depth map.

In some embodiments of the present application, the animal weight measurement model is obtained by:

obtaining and carrying out model training on the initial model according to the depth maps, the volumes and the actual weights of a plurality of animal bodies;

and determining the initial model after the training as the animal body weight detection model.

In another aspect, an embodiment of the present application provides an animal body weight detecting device, including:

the system comprises an acquisition unit, a processing unit and a processing unit, wherein the acquisition unit is used for acquiring a target three-dimensional point cloud of a target area according to a target depth map of an object to be detected, and the target area refers to an area which bears the object to be detected in the target depth map;

the processing unit is used for determining the target volume of the animal body to be detected according to the target three-dimensional point cloud acquired by the acquisition unit; and determining the weight of the animal body to be detected according to the target volume and the target depth map.

In some embodiments of the present application, the processing unit is specifically configured to:

acquiring a target polyhedron according to the target three-dimensional point cloud;

and determining the target volume of the animal body to be detected according to the target polyhedron and the target three-dimensional point cloud.

In some embodiments of the present application, the processing unit is specifically configured to:

acquiring a plurality of first target points from the target three-dimensional point cloud;

determining an initial polyhedron according to each first target point, wherein the first target points are vertexes of the initial polyhedron;

traversing each point of the remaining three-dimensional point cloud, and if detecting that a second target point is outside the initial polyhedron, iteratively updating the initial polyhedron according to the second target point to obtain a target polyhedron, wherein the remaining three-dimensional point cloud is a set of points in the target three-dimensional point cloud except the first target point, and the second target point is a point in the remaining three-dimensional point cloud.

In some embodiments of the present application, the processing unit is specifically configured to:

determining a three-dimensional point cloud of the target polyhedron according to the target three-dimensional point cloud;

projecting the target polyhedron to a reference plane to obtain a target point cloud, wherein the reference plane is any plane which does not intersect with any plane of the target polyhedron;

and determining the volume of the target polyhedron according to the three-dimensional point cloud of the target polyhedron and the target point cloud to serve as the target volume of the animal body to be detected.

In some embodiments of the present application, the processing unit is specifically configured to:

acquiring a target plane, wherein the target plane is a plane formed by projecting the target three-dimensional point cloud on a plane point cloud of a reference plane, and the reference plane is a supporting surface of the object to be measured in each plane of the target depth map;

dividing the target plane to obtain a plurality of sub-planes, and calculating the volume to be measured corresponding to each sub-plane according to the target three-dimensional point cloud;

and obtaining the volume of the animal body to be detected according to the volume to be detected corresponding to each sub-plane.

In some embodiments of the present application, the processing unit is specifically configured to:

determining the area and the corresponding height of each sub-plane according to the target three-dimensional point cloud;

and calculating the volume to be measured corresponding to each sub-plane according to the area of each sub-plane and the corresponding height.

In some embodiments of the present application, the processing unit is specifically configured to:

inputting the target volume and the target depth map into an animal body weight detection model, so that the animal body weight detection model determines the weight of the animal body to be detected according to the target volume and the target depth map.

In some embodiments of the present application, the animal body weight detection device further comprises a training unit, the training unit is specifically configured to:

obtaining and carrying out model training on the initial model according to the depth maps, the volumes and the actual weights of a plurality of animal bodies;

and determining the initial model after the training as the animal body weight detection model.

On the other hand, the animal body weight detection device provided by the embodiment of the present application further includes a processor and a memory, where the memory stores a computer program, and the processor executes the steps in any one of the animal body weight detection methods provided by the embodiments of the present application when calling the computer program in the memory.

In another aspect, the present invention further provides a computer-readable storage medium, on which a computer program is stored, where the computer program is loaded by a processor to execute the steps in the method for detecting body weight of an animal body.

According to the method and the device, the three-dimensional point cloud of the animal body to be detected is determined by acquiring and according to the depth map of the animal body to be detected; determining the target volume of the animal body to be detected according to the three-dimensional point cloud of the animal body to be detected; and fitting the weight of the animal body to be detected according to the target volume of the animal body to be detected and the depth map of the animal body to be detected. On the one hand, the weight of the animal body to be detected can be detected only by acquiring the image of the animal body to be detected, and the process of carrying the animal body for weighing is omitted. On the other hand, the body weight of the animal to be detected is fitted based on the target volume and the depth map of the animal to be detected, and the body weight of the animal to be detected is not fitted according to the volume, so that the over-fitting problem is avoided, and the detection error of the body weight is reduced.

Drawings

In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.

FIG. 1 is a schematic flow chart diagram illustrating one embodiment of a method for detecting body weight of an animal provided in the embodiments of the present application;

FIG. 2 is a schematic diagram of a scene of an initial polyhedron provided in an embodiment of the present application;

FIG. 3 is a comparison diagram of an initial polyhedron before and after updating in the embodiment of the present application;

FIG. 4 is a schematic illustration of a target plane being partitioned into a plurality of sub-planes provided in an embodiment of the present application;

FIG. 5 is a schematic structural diagram of an embodiment of an animal body weight detection device provided in the embodiment of the present application;

fig. 6 is a schematic structural diagram of an embodiment of the animal body weight detection device provided in the embodiment of the present application.

Detailed Description

The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.

In the description of the embodiments of the present application, it should be understood that the terms "first", "second", and the like are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or implying any number of technical features indicated. Thus, features defined as "first", "second", may explicitly or implicitly include one or more of the described features. In the description of the embodiments of the present application, "a plurality" means two or more unless specifically defined otherwise.

The following description is presented to enable any person skilled in the art to make and use the application. In the following description, details are set forth for the purpose of explanation. It will be apparent to one of ordinary skill in the art that the present application may be practiced without these specific details. In other instances, well-known processes have not been described in detail so as not to obscure the description of the embodiments of the present application with unnecessary detail. Thus, the present application is not intended to be limited to the embodiments shown, but is to be accorded the widest scope consistent with the principles and features disclosed in the embodiments herein.

First, before describing the embodiments of the present application, the related contents of the embodiments of the present application with respect to the application context will be described.

In real life, it is often necessary to measure the body weight of an animal, for example, a pig, sheep, cow, etc. Conventional weight measurement methods require that the animal be transported to a measuring tool. Many animals are cumbersome and not easily handled. In addition, animals are easy to carry various bacteria and viruses, and people are easy to infect the bacteria and the viruses when the animals are carried manually.

Since in the case of determining the volume and density of the object, the mass of the object can be determined. In order to avoid the carrying process of the animal body, the body weight of the animal body can be obtained by detecting the volume of the animal body.

However, the animal body is an irregular object, and the volume of the animal body is difficult to detect. Even if the volume of the animal body is detected, the density of the animal body is difficult to determine, and due to the fact that the densities of different animal species and different animal bodies of the same animal species are different, if the body weight of the animal body is calculated according to the preset density, the error of the obtained body weight of the animal body is large.

Based on the above-mentioned drawbacks of the prior art, embodiments of the present application provide a method for detecting body weight of an animal, which overcomes at least some of the drawbacks of the prior art.

An execution main body of the animal body weight detection method in the embodiment of the present application may be the animal body weight detection device provided in the embodiment of the present application, or different types of animal body weight detection devices such as a server device, a physical host, or a User Equipment (UE) integrated with the animal body weight detection device, where the animal body weight detection device may be implemented in a hardware or software manner, and the UE may specifically be a terminal device such as a smart phone, a tablet computer, a notebook computer, a palm computer, a desktop computer, or a Personal Digital Assistant (PDA).

This animal body weight detection equipment can adopt the working method of independent operation, perhaps also can adopt the working method of equipment cluster, through the animal body weight detection method who uses this application embodiment to provide, can measure the weight of animal body, avoids the process of transport animal body, improves the detection precision of animal body weight.

The following description begins with the animal body weight detection method provided in the embodiments of the present application, which includes: acquiring a target three-dimensional point cloud of a target area according to a target depth map of an object to be detected; determining the target volume of the animal body to be detected according to the target three-dimensional point cloud; and determining the weight of the animal body to be detected according to the target volume and the target depth map.

Referring to fig. 1, fig. 1 is a schematic flow chart of a method for detecting body weight of an animal body according to an embodiment of the present application. It should be noted that, although a logical order is shown in the flow chart, in some cases, the steps shown or described may be performed in an order different than that shown or described herein. The method for detecting the body weight of the animal comprises the following steps 10 to 30, wherein:

10. and acquiring a target three-dimensional point cloud of a target area according to the target depth map of the object to be detected.

The target depth map refers to a depth map of the object to be measured, and the target depth map contains information such as three-dimensional coordinates of each point in the image. The target region refers to a region carrying an animal to be tested in the target depth map.

Firstly, a target depth map of an object to be measured is obtained. In practical application, the animal body weight detection device provided by the embodiment of the application can directly comprise one or more cameras on hardware, locally stores a target depth map shot by the one or more cameras, and can directly read the target depth map from the inside of the device; or, the animal body weight detection device may also establish a network connection with other devices, and obtain a target depth map shot or stored by the other devices according to the network connection, where a specific obtaining manner is not limited herein.

Then, the region carrying the animal body to be detected in the target depth map is identified, namely the target region is determined. Wherein the identification of the target area can be realized through a deep neural network.

And finally, extracting the three-dimensional point cloud of the region bearing the object to be detected in the target depth map from the three-dimensional point cloud of the target depth map. Namely, determining a target three-dimensional point cloud of a target area, wherein the target three-dimensional point cloud is the three-dimensional point cloud of the area bearing the object to be measured in the target depth map.

20. And determining the target volume of the animal body to be detected according to the target three-dimensional point cloud.

As an implementation manner, determining a target volume of an object to be measured according to a target three-dimensional point cloud specifically includes: firstly, determining the body shape of the animal body to be detected according to the target three-dimensional point cloud of the target area. Then, based on the body shape of the animal body to be tested, the target volume of the animal body to be tested is determined.

As another embodiment, determining a target volume of the object to be measured according to the target three-dimensional point cloud specifically includes: firstly, according to a target depth map of an animal body to be detected, a supporting surface of the animal body to be detected is obtained through a region growing algorithm. And then, determining the target volume of the object to be detected according to the supporting surface of the object to be detected and the target three-dimensional point cloud of the target area.

The two embodiments mentioned herein will be described in detail in the following embodiments, and will not be described herein for the sake of simplicity.

30. And determining the weight of the animal body to be detected according to the target volume and the target depth map.

As an implementation manner, determining the body weight of the animal to be tested according to the target volume and the target depth map may specifically be: firstly, determining the corresponding density of the animal body to be detected according to the target volume and the target depth map of the animal body to be detected. And then taking the product of the target volume of the animal body to be detected and the corresponding density of the animal body to be detected as the weight of the animal body to be detected.

As another embodiment, determining the body weight of the animal to be tested according to the target volume and the target depth map may specifically be: firstly, a pre-trained weight detection model is obtained, and a target volume and a target depth map of an animal body to be detected are input into the weight detection model, so that the weight of the animal body to be detected is fitted by the weight detection model according to the target volume and the target depth map of the animal body to be detected. And then, extracting the weight of the animal body to be detected output by the weight detection model.

In the embodiment of the application, the target three-dimensional point cloud of the object to be detected is determined by acquiring and according to the target depth map of the object to be detected; determining the target volume of the animal body to be detected according to the target three-dimensional point cloud of the animal body to be detected; and fitting the weight of the animal body to be detected according to the target volume of the animal body to be detected and the target depth map of the animal body to be detected. On the one hand, the body weight of the animal body to be detected can be detected only by acquiring the depth map of the animal body to be detected, and the process of carrying the animal body for weighing is omitted. On the other hand, the body weight of the animal to be detected is fitted based on the target volume and the target depth map of the animal to be detected, instead of the body weight of the animal to be detected being fitted according to the volume, so that the over-fitting problem is avoided, and the detection error of the body weight of the animal to be detected is reduced.

Two ways of determining the target volume of the animal to be tested are described below. The two implementation modes determine the advantages and disadvantages of the target volumes of the object to be detected, and in practical application, which mode is used can be determined according to a specific application scene.

First, a target volume of an animal to be tested is determined based on a body shape of the animal to be tested.

In some embodiments of the present application, the above-mentioned map corresponding to step 20 of the embodiment may be specifically implemented according to the following steps (a1) to (a2), specifically implemented as follows:

(a1) and acquiring a target polyhedron according to the target three-dimensional point cloud.

The target polyhedron is used for indicating the body shape of the pig body to be detected.

Firstly, selecting a plurality of non-coplanar points from a target three-dimensional point cloud to form an initial polyhedron, traversing each point in the target three-dimensional point cloud, and if the point is detected to be outside the initial polyhedron, iteratively updating the initial polyhedron according to the point to obtain the target polyhedron. Then, the target polyhedron is approximately determined as the body shape of the animal body to be detected.

In some embodiments of the present application, the step of obtaining the target polyhedron from the target three-dimensional point cloud specifically includes the following steps (a11) - (a 13):

(a11) and acquiring a plurality of first target points from the target three-dimensional point cloud.

Specifically, at least four points are randomly acquired from the target three-dimensional point cloud, each acquired point is made to be a point which is not coplanar, and each acquired point is used as a first target point, so that an initial polyhedron can be determined according to a plurality of first target points in the following process.

(a12) And determining an initial polyhedron according to the first target points.

The first target point is the vertex of the initial polyhedron.

Specifically, the initial polyhedron is generated by taking the number of the first target points as the vertex number of the initial polyhedron and taking each first target point as the vertex of the initial polyhedron.

To facilitate understanding of how the initial polyhedron is defined, a specific embodiment is described. Referring to fig. 2, fig. 2 is a schematic view of an initial polyhedron according to an embodiment of the present disclosure. For example, 4 points (i.e., the first target point) are selected from the target three-dimensional point cloud, and a 4-face body (initial polyhedron) is determined from the 4 points. For another example, 6 points (i.e., the first target point) are selected from the target three-dimensional point cloud, and a 6-face body (initial polyhedron) is determined according to the 6 points.

(a13) And traversing each point of the residual three-dimensional point cloud, and if detecting that a second target point is positioned outside the initial polyhedron, iteratively updating the initial polyhedron according to the second target point to obtain a target polyhedron.

The remaining three-dimensional point cloud is a set of points in the target three-dimensional point cloud except the first target point, and the second target point is a point in the remaining three-dimensional point cloud.

Specifically, first, each plane of the initial polyhedron is determined from the three-dimensional coordinates of the first target point.

Then, it is detected whether the second target point is outside the initial polyhedron. Specifically, all points of the remaining three-dimensional point cloud are randomly arranged to form a target point sequence. And sequentially acquiring a sequence point from the target point sequence as a second target point according to the sequence of each point in the remaining three-dimensional point cloud in the target point sequence, detecting whether the second target point is in the initial polyhedron by using a binary search algorithm or other detection algorithms, and detecting whether the second target point is in any plane of the initial polyhedron.

If the second target point is not within the initial polyhedron and is not within any one of the planes of the initial polyhedron, it is determined that the second target point is outside the initial polyhedron. If the second object point is detected to be within the initial polyhedron, or within any one of the planes of the initial polyhedron, it is determined that the second object point is not outside the initial polyhedron.

And when the second target point is not outside the initial polyhedron, continuously acquiring the next sequence point from the target sequence point as a new second target point, repeating the detection steps, and determining whether the new second target point is outside the initial polyhedron.

And finally, updating the initial polyhedron. And when the second target point is detected to be outside the initial polyhedron, updating the initial polyhedron according to the second target point to obtain an updated initial polyhedron. And continuously acquiring a next sequence point of the second target point acquired last time from the target sequence points to serve as a new second target point, and detecting whether the new second target point is outside the updated initial polyhedron. And if the new second target point is outside the updated initial polyhedron, continuously updating the last updated initial polyhedron. And repeating the steps, iteratively updating the initial polyhedron until each point in the target sequence points finishes passing, and determining the updated initial polyhedron as the target polyhedron.

The method for updating the initial polyhedron according to the second target point specifically comprises the following steps: adding one to the number of the top points of the initial polyhedron to be updated to serve as the number of the top points of the updated initial polyhedron; taking each vertex of the initial polyhedron to be updated and the second target point as each vertex of the updated initial polyhedron; and then the updated initial polyhedron is obtained.

To facilitate understanding of how the initial polyhedron is updated according to the second target point, a specific embodiment is described. Referring to fig. 3, fig. 3 is a schematic diagram illustrating comparison between an initial polyhedron and a previous polyhedron according to an embodiment of the present application. For example, if the initial polyhedron before updating is a tetrahedron including 4 first target points, and the second target point is outside the initial polyhedron before updating, a new polyhedron is generated with the number of vertices 4+1 equal to 5 and the vertices 4 first target points and the second target point, respectively, and the newly generated polyhedron is used as the updated initial polyhedron.

In the embodiment of the application, the dynamic maintenance of the initial polyhedron is realized by traversing each point in the residual three-dimensional point cloud, so that the finally obtained target polyhedron is closer to the body shape of the body to be detected, an accurate data basis is provided for accurately determining the volume of the body to be detected subsequently, and the detection precision of the weight of the body to be detected is further improved.

(a2) And determining the target volume of the animal body to be detected according to the target polyhedron and the target three-dimensional point cloud.

Since each vertex of the target polygon is a point in the target three-dimensional point cloud, the three-dimensional coordinates of each vertex of the target polygon are known. Specifically, first, a three-dimensional point cloud of the target polyhedron is determined from three-dimensional coordinates of respective vertices of the target polyhedron. And then, determining the target volume of the animal body to be detected according to the three-dimensional point cloud of the target polyhedron.

In the embodiment of the application, the target polyhedron is determined according to the target three-dimensional point cloud, and the target polyhedron is approximated to the body shape of the animal body to be detected, so that the target of the animal body to be detected is detected, a data basis is provided for subsequently determining the weight of the animal body to be detected, and the weight of the animal body to be detected can be detected without carrying the animal body to be detected.

In order to accurately determine the target volume of the animal to be tested, in some embodiments of the present application, the step of determining the target volume of the animal to be tested according to the target polyhedron and the target three-dimensional point cloud specifically includes the following steps (a21) - (a 23):

(a21) and determining the three-dimensional point cloud of the target polyhedron according to the target three-dimensional point cloud.

Since each vertex of the target polygon is a point in the target three-dimensional point cloud, the three-dimensional coordinates of each vertex of the target polygon are known. According to the three-dimensional coordinates of each vertex of each plane of the target polyhedron, the three-dimensional point clouds constituting the planes can be determined, that is, the three-dimensional point clouds of each plane of the target polyhedron can be determined. And the collection of the three-dimensional point clouds of each plane of the target polyhedron forms the three-dimensional point cloud of the target polyhedron.

(a22) And projecting the target polyhedron to a reference plane to obtain target point cloud.

Wherein, the reference plane refers to any plane not intersected with any plane of the target polyhedron.

Firstly, any one plane is determined, and the plane is enabled not to intersect with any plane of the target polyhedron and is used as a reference plane.

And then, projecting the target polyhedron to a reference plane to obtain the target point cloud of the target polyhedron. The target point cloud is a set of points which form plane projection after the target polyhedron is projected to the reference plane.

(a23) And determining the volume of the target polyhedron according to the three-dimensional point cloud of the target polyhedron and the target point cloud to serve as the target volume of the animal body to be detected.

Firstly, determining the X-axis, Y-axis or Z-axis direction of a three-dimensional coordinate system corresponding to the three-dimensional point cloud of the target polyhedron. Rotating a three-dimensional coordinate system corresponding to the three-dimensional point cloud of the target polyhedron to enable a Z axis (or a Y axis, or an X axis, which can be set according to specific requirements) of the three-dimensional coordinate system to be vertical to the reference plane; and meanwhile, updating the three-dimensional coordinates of the point cloud of the target polyhedron according to the rotation change of the three-dimensional coordinate system so as to subsequently determine the three-dimensional coordinates corresponding to the target point cloud projected to the reference plane by the target polyhedron.

Then, determining a three-dimensional coordinate point of each point in the target point cloud mapped in the target polyhedron as a three-dimensional coordinate corresponding to the point in the target point cloud, namely determining a three-dimensional coordinate corresponding to the target point cloud projected to the reference plane by the target polyhedron.

And finally, because the Z axis of the rotated three-dimensional coordinate system is vertical to the reference plane, the volume of the target polyhedron can be determined according to the three-dimensional coordinates corresponding to the target point cloud, and the volume of the target polyhedron is approximately regarded as the target volume of the animal body to be detected.

In the embodiment of the application, the volume of a target polyhedron is determined as the target volume of an animal body to be detected by determining a reference plane and according to a target point cloud obtained by projecting the target polyhedron to the reference plane and a three-dimensional point cloud of the target polyhedron; the supporting surface of the object to be measured is avoided being fitted based on the target depth map, and the problem that the fitted supporting surface is not accurate easily due to the complex shooting background of the depth image is avoided, so that the accuracy of the target volume of the object to be measured is improved.

And secondly, fitting a supporting surface of the object to be detected based on the target depth map, and determining the target volume of the object to be detected according to the supporting surface and the target three-dimensional point cloud.

In the case that the shooting background of the target depth map is relatively simple, the fitting influence on the supporting surface is relatively small, and in order to simplify the determination process of the target volume of the animal to be measured, in some embodiments of the present application, the above-mentioned map corresponds to step 20 of the embodiment, and may be specifically implemented according to the following steps (b1) to (b3), and specifically implemented as follows:

(b1) and acquiring a target plane.

The target plane is a plane formed by projecting the target three-dimensional point cloud on the plane point cloud of the reference plane, and the reference plane is a supporting surface of the object to be measured in each plane of the target depth map.

Firstly, based on a region growing algorithm, solving a supporting surface of the object to be detected according to a target depth map and a target three-dimensional point cloud of the object to be detected.

And then, projecting the target three-dimensional point cloud of the object to be measured onto the supporting surface, and taking a plane formed by each point of the projection area as a target plane. So that the volume of the object to be detected can be determined based on the target plane and the target three-dimensional point cloud of the object to be detected.

(b2) And dividing the target plane to obtain a plurality of sub-planes, and calculating the volume to be measured corresponding to each sub-plane according to the target three-dimensional point cloud.

For example, first, mesh division is performed using a rectangle as an outer contour of the target plane, the target plane is divided into a plurality of regions, and each region is taken as one sub-plane. Then, the area and the corresponding height corresponding to each region are calculated, and the volume to be measured corresponding to each sub-plane is obtained according to the area and the corresponding height corresponding to each region, as shown in fig. 4. Further, after the target plane is divided into a plurality of regions in order to reduce the error of the volume of the body to be measured, if the area of the projection region corresponding to the target plane is smaller than one half of the area of the outer contour rectangle, the volume of the body to be measured is calculated, and the volume corresponding to part of the projection region is discarded; if the area of the projection area corresponding to the target plane is larger than one half of the area of the outer contour rectangle and smaller than the area of the outer contour rectangle, the volume of the animal to be measured is calculated, and the volume corresponding to the projection area is abandoned.

The determination of the volume to be measured corresponding to the sub-planes will be described in detail below, and for ease of understanding, reference may be made to fig. 4. In some embodiments of the present application, the step of calculating the volume to be measured corresponding to each sub-plane according to the target three-dimensional point cloud specifically includes the following steps (b21) - (b 22):

(b21) determining the area and the corresponding height of each sub-plane according to the target three-dimensional point cloud;

wherein, the corresponding height refers to the average value of the Z-axis coordinate values of all points of the sub-plane.

Specifically, according to the target three-dimensional point cloud, three-dimensional coordinates corresponding to each point of each sub-plane are determined. On one hand, according to the three-dimensional coordinates corresponding to each point of each sub-plane, coordinate values of each point of each sub-plane on the Z axis are obtained. And calculating the mean value of the coordinate values of all points of each sub-plane on the Z axis as the corresponding height of the sub-plane.

For example, the coordinate values of the points of the sub-plane on the Z-axis are: 10. 12, 13, 14, 15, 17, 20, 16, 18, 19, the mean value of the coordinate values of the points of the sub-plane on the Z-axis is: (10+12+13+14+15+17+20+16+18+ 19)/10-15.

On the other hand, the area of each sub-plane is calculated according to the three-dimensional coordinates corresponding to each point of each sub-plane, and in the embodiment of the present application, the areas of each sub-plane are the same.

(b22) And calculating the volume to be measured corresponding to each sub-plane according to the area of each sub-plane and the corresponding height.

Specifically, the volume to be measured corresponding to each sub-plane is equal to the product of the corresponding height of the sub-plane and the area of the sub-plane, and the volume to be measured corresponding to each sub-plane is sequentially calculated according to the calculation method.

In the embodiment of the application, the target plane is divided into the plurality of sub-planes, and then the error of the volume to be measured corresponding to each sub-plane is relatively small due to the fact that the divided sub-planes are small according to the area and the corresponding height of each sub-plane, and therefore the accuracy of the volume of the animal to be measured can be improved.

(b3) And obtaining the volume of the animal body to be detected according to the volume to be detected corresponding to each sub-plane.

Specifically, the volumes corresponding to each plane are accumulated to obtain the volume of the target polyhedron, and the accumulated value of the volumes corresponding to each plane is approximated to the volume of the animal to be measured. And finishing the volume detection of the animal body to be detected. For example, if it is determined that the volumes to be measured corresponding to the sub-planes are respectively: 2dm3、4dm3、3dm3And then the volume of the animal body to be detected is as follows: 2+4+3 ═ 9dm3

In the embodiment of the application, a target plane is obtained, the target plane is divided to obtain a plurality of sub-planes, and the volume to be measured corresponding to each sub-plane is calculated according to a target three-dimensional point cloud; the volumes to be detected corresponding to the sub-planes are accumulated to obtain the volume of the animal body to be detected, so that a data basis is provided for subsequently determining the weight of the animal body to be detected, and the weight of the animal body to be detected can be detected without carrying the animal body to be detected.

In some embodiments of the present application, the above-mentioned diagram corresponds to step 30 of the embodiment, and may be implemented by a model, that is, the weight of the animal to be tested may be detected by the model.

In order to obtain an animal body weight detection model which can be used for detecting the body weight of an animal body, training set data is required to be collected for model training. In some embodiments of the present application, the animal body weight measurement model is obtained by the following steps (1) and (2):

(1) obtaining and carrying out model training on the initial model according to the depth maps, the volumes and the actual weights of a plurality of animal bodies;

firstly, a network structure of an initial model is designed, a three-layer network is designed in the embodiment of the application, each layer comprises a full connection layer and an activation layer, and the number of the full connection layers, the activation function and the regular term of each layer are set. And setting the loss function of the initial model training as: l ═ G1-G2)/G2, where L represents the loss value, G1 represents the body weight of the animal body predicted by the model, and G2 represents the actual body weight of the animal body.

Then, depth maps of a plurality of animal bodies, an actual weight of each animal body, and a volume of each animal body determined according to the depth map of each animal body with reference to the above steps 10 to 20 are collected.

And finally, inputting the volume, the actual weight and the depth map of each animal body into the initial model in a one-dimensional vector mode for forward propagation. And then, taking the weight of the output animal body as a target, and performing back propagation according to a loss function configured for the initial model to update the model parameters of the initial model and continuously perform model training on the initial model.

(2) And determining the initial model after the training as the animal body weight detection model.

When the weight of the animal body output by the trained initial model can meet the loss function or other target conditions, the model training is completed iteratively. At this time, the initial model after the training is used as an animal body weight detection model for detecting the weight of the animal body.

In the embodiment of the application, the training data of the model comprises the body weights of different animals and the volume of different animals, and also comprises the depth maps of different animals, so that in the training process of the model, the model can be guided to pay attention to the incidence relation between the depth maps of different animals and the body weights of the animals, the model can fit the body weights of the animals according to the volume and the depth maps of the animals, the problem that the body weights of the animals are only fit according to the volume of the animals by the model and are easy to over-fit is solved, the detection precision of the model is improved, and the detection precision of the body weights of the animals to be detected is improved.

After obtaining the animal body weight detection model, the step 30 can be implemented by the animal body weight detection model, which is specifically implemented as follows:

inputting the target volume and the target depth map into an animal body weight detection model, so that the animal body weight detection model determines the weight of the animal body to be detected according to the target volume and the target depth map.

For convenience of understanding, the weight of the pig body is measured as an example. Firstly, obtaining a depth map of a pig body, and identifying and segmenting a pig body region from the depth map of the pig body; and determining the three-dimensional point cloud of the pig body area based on the three-dimensional point cloud of the pig body depth map and the pig body area. Then, based on a region growing algorithm, fitting a supporting surface (such as the ground) of the pig body according to the depth map of the pig body, projecting the three-dimensional point cloud of the pig body region onto the supporting surface of the pig body to obtain a region point cloud of the pig body region on the supporting surface, and calculating the volume of the pig body according to the region point cloud. And finally, inputting the volume of the pig body and the depth map of the pig body into the animal body weight detection model, and outputting the weight of the pig body by the animal body weight detection model.

In the embodiment of the application, the weight of the animal to be detected is fitted through the animal weight detection model, and the animal weight of the animal to be detected is fitted according to the target volume and the target depth map at the same time through the animal weight detection model, so that the problem that the body of the animal to be detected is fitted according to the volume of the animal to be detected only and is easy to over-fit is solved, and the detection precision of the body weight of the animal to be detected is improved.

In order to better implement the animal body weight detection method in the embodiment of the present application, based on the animal body weight detection method, an embodiment of the present application further provides an animal body weight detection device, as shown in fig. 5, which is a schematic structural diagram of an embodiment of the animal body weight detection device in the embodiment of the present application, and the animal body weight detection device 500 includes:

the acquiring unit 501 is configured to acquire a target three-dimensional point cloud of a target area according to a target depth map of a to-be-detected animal body, where the target area is an area in the target depth map, where the to-be-detected animal body is borne by the target area;

the processing unit 502 is configured to determine a target volume of the animal to be tested according to the target three-dimensional point cloud acquired by the acquiring unit 501; and determining the weight of the animal body to be detected according to the target volume and the target depth map.

In some embodiments of the present application, the processing unit 502 is specifically configured to:

acquiring a target polyhedron according to the target three-dimensional point cloud;

and determining the target volume of the animal body to be detected according to the target polyhedron and the target three-dimensional point cloud.

In some embodiments of the present application, the processing unit 502 is specifically configured to:

acquiring a plurality of first target points from the target three-dimensional point cloud;

determining an initial polyhedron according to each first target point, wherein the first target points are vertexes of the initial polyhedron;

traversing each point of the remaining three-dimensional point cloud, and if detecting that a second target point is outside the initial polyhedron, iteratively updating the initial polyhedron according to the second target point to obtain a target polyhedron, wherein the remaining three-dimensional point cloud is a set of points in the target three-dimensional point cloud except the first target point, and the second target point is a point in the remaining three-dimensional point cloud.

In some embodiments of the present application, the processing unit 502 is specifically configured to:

determining a three-dimensional point cloud of the target polyhedron according to the target three-dimensional point cloud;

projecting the target polyhedron to a reference plane to obtain a target point cloud, wherein the reference plane is any plane which does not intersect with any plane of the target polyhedron;

and determining the volume of the target polyhedron according to the three-dimensional point cloud of the target polyhedron and the target point cloud to serve as the target volume of the animal body to be detected.

In some embodiments of the present application, the processing unit 502 is specifically configured to:

acquiring a target plane, wherein the target plane is a plane formed by projecting the target three-dimensional point cloud on a plane point cloud of a reference plane, and the reference plane is a supporting surface of the object to be measured in each plane of the target depth map;

dividing the target plane to obtain a plurality of sub-planes, and calculating the volume to be measured corresponding to each sub-plane according to the target three-dimensional point cloud;

and obtaining the volume of the animal body to be detected according to the volume to be detected corresponding to each sub-plane.

In some embodiments of the present application, the processing unit 502 is specifically configured to:

determining the area and the corresponding height of each sub-plane according to the target three-dimensional point cloud;

and calculating the volume to be measured corresponding to each sub-plane according to the area of each sub-plane and the corresponding height.

In some embodiments of the present application, the processing unit 502 is specifically configured to:

inputting the target volume and the target depth map into an animal body weight detection model, so that the animal body weight detection model determines the weight of the animal body to be detected according to the target volume and the target depth map.

In some embodiments of the present application, the animal body weight detection device further comprises a training unit (not shown in the figures), the training unit being specifically configured to:

obtaining and carrying out model training on the initial model according to the depth maps, the volumes and the actual weights of a plurality of animal bodies;

and determining the initial model after the training as the animal body weight detection model.

In addition, in order to better implement the animal body weight detection method in the embodiment of the present application, based on the animal body weight detection method, an embodiment of the present application further provides an animal body weight detection device, referring to fig. 6, fig. 6 shows a schematic structural diagram of the animal body weight detection device in the embodiment of the present application, specifically, the animal body weight detection device provided in the embodiment of the present application includes a processor 601, and the processor 601 is configured to implement the steps of the animal body weight detection method in any embodiment corresponding to fig. 1 to fig. 4 when executing a computer program stored in a memory 602; alternatively, the processor 601 is configured to implement the functions of the units in the corresponding embodiment of fig. 5 when executing the computer program stored in the memory 602.

Illustratively, a computer program may be partitioned into one or more modules/units, which are stored in the memory 602 and executed by the processor 601 to implement embodiments of the present application. One or more modules/units may be a series of computer program instruction segments capable of performing certain functions, the instruction segments being used to describe the execution of a computer program in a computer device.

The animal body weight detection device may include, but is not limited to, a processor 601, a memory 602. It will be understood by those skilled in the art that the illustration is merely an example of the animal body weight detection device, and does not constitute a limitation of the animal body weight detection device, and may include more or less components than those shown, or combine some components, or different components, for example, the animal body weight detection device may further include an input-output device, a network access device, a bus, etc., and the processor 601, the memory 602, the input-output device, the network access device, etc., are connected through the bus.

The Processor 601 may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic device, discrete hardware component, etc. The general processor can be a microprocessor or the processor can be any conventional processor and the like, the processor is a control center of the animal body weight detection device, and various interfaces and lines are utilized to connect all parts of the whole animal body weight detection device.

The memory 602 may be used for storing computer programs and/or modules, and the processor 601 may implement various functions of the computer apparatus by executing or executing the computer programs and/or modules stored in the memory 602 and calling data stored in the memory 602. The memory 602 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application program required by at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may store data (such as audio data, video data, etc.) created according to the use of the animal body weight detecting apparatus, etc. In addition, the memory may include high speed random access memory, and may also include non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), at least one magnetic disk storage device, a Flash memory device, or other volatile solid state storage device.

It can be clearly understood by those skilled in the art that, for convenience and brevity of description, the specific working processes of the animal body weight detection apparatus and device and the corresponding units thereof described above may refer to the description of the animal body weight detection method in any embodiment corresponding to fig. 1 to 4, and are not described herein again in detail.

It will be understood by those skilled in the art that all or part of the steps of the methods of the above embodiments may be performed by instructions or by associated hardware controlled by the instructions, which may be stored in a computer readable storage medium and loaded and executed by a processor.

For this reason, an embodiment of the present application provides a computer-readable storage medium, where a plurality of instructions are stored, where the instructions can be loaded by a processor to execute steps in the animal body weight detection method in any embodiment corresponding to fig. 1 to 4 in the present application, and specific operations refer to descriptions of the animal body weight detection method in any embodiment corresponding to fig. 1 to 4, which are not described herein again.

Wherein the computer-readable storage medium may include: read Only Memory (ROM), Random Access Memory (RAM), magnetic or optical disks, and the like.

Since the instructions stored in the computer-readable storage medium can execute the steps in the animal body weight detection method in any embodiment corresponding to fig. 1 to 4 in the present application, the beneficial effects that can be achieved by the animal body weight detection method in any embodiment corresponding to fig. 1 to 4 in the present application can be achieved, for details, see the foregoing description, and are not repeated herein.

The method, the apparatus, the device and the storage medium for detecting the body weight of the animal body provided by the embodiment of the present application are described in detail above, and the principle and the implementation manner of the present application are explained in this document by applying specific examples, and the description of the above embodiments is only used to help understanding the method and the core concept of the present application; meanwhile, for those skilled in the art, according to the idea of the present application, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present application.

18页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:一种数据处理方法、设备及系统

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!