Disclosure of Invention
In order to solve the technical problems or at least partially solve the technical problems, embodiments of the present application provide an egg weight estimation and image processing method and apparatus.
In a first aspect, an embodiment of the present application provides an avian egg weight estimation method, including:
acquiring a side image of the poultry egg;
identifying an egg side profile from the egg side image;
determining egg weight based on the egg side profile according to a pre-trained egg weight estimation model.
Optionally, the method further includes:
generating a sorting instruction according to the weight of the eggs, wherein the sorting instruction is used for controlling sorting equipment to perform sorting operation corresponding to the weight of the eggs;
and sending the sorting instruction to the sorting equipment.
Optionally, determining the weight of the egg based on the side profile of the egg according to the pre-trained egg weight estimation model comprises:
calculating the side area of the poultry egg according to the side profile of the poultry egg;
determining egg weight based on the egg side area according to a pre-trained egg weight estimation model.
Optionally, determining the weight of the egg based on the side profile of the egg according to the pre-trained egg weight estimation model comprises:
calculating the volume of the poultry egg according to the profile of the side surface of the poultry egg;
determining egg weight based on the egg volume according to a pre-trained egg weight estimation model.
Optionally, calculating the volume of the egg according to the profile of the side surface of the egg comprises:
determining a profile curve corresponding to the profile of the side surface of the poultry egg;
calculating the volume of the poultry egg according to the profile curve,
wherein V represents the volume of the egg, the major axis of the side profile of the egg in a two-dimensional coordinate system coincides with the x axis, r
1(x) And r
2(x) Respectively showing the profile curves of the side profile of the poultry egg above the x-axis and below the x-axis, and L shows the length of the long axis.
In a second aspect, an embodiment of the present application provides an image processing method, including:
acquiring a sample image including the side surface of an egg and the weight of the egg;
identifying a side profile of the avian egg from the sample image;
and training according to the side profile and the weight to obtain an egg weight estimation model.
Optionally, the obtaining of the poultry egg weight estimation model according to the side profile and the weight training includes:
calculating the side area of the poultry egg according to the side profile;
and learning the corresponding relation between the side surface area and the weight to obtain the poultry egg weight estimation model.
Optionally, the obtaining of the poultry egg weight estimation model according to the side profile and the weight training includes:
calculating the volume of the poultry egg according to the side profile;
and learning the corresponding relation between the volume and the weight to obtain the poultry egg weight estimation model.
In a third aspect, an embodiment of the present application provides an egg weight estimation device, including:
the acquisition module is used for acquiring the side image of the poultry egg;
the recognition module is used for recognizing the side profile of the egg from the side image of the egg;
and the determining module is used for determining the weight of the eggs based on the side profiles of the eggs according to a pre-trained egg weight estimation model.
In a fourth aspect, an embodiment of the present application provides an image processing apparatus, including:
the device comprises an acquisition module, a processing module and a control module, wherein the acquisition module is used for acquiring a sample image including the side surface of an egg and the weight of the egg;
the identification module is used for identifying the side profile of the poultry egg from the sample image;
and the training module is used for obtaining the poultry egg weight estimation model according to the side profile and the weight training.
In a fifth aspect, an embodiment of the present application provides an electronic device, including: the system comprises a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory complete mutual communication through the communication bus;
the memory is used for storing a computer program;
the processor is configured to implement the above method steps when executing the computer program.
In a sixth aspect, embodiments of the present application provide a computer-readable storage medium, on which a computer program is stored, which, when executed by a processor, implements the above-mentioned method steps.
Compared with the prior art, the technical scheme provided by the embodiment of the application has the following advantages:
the method comprises the steps of collecting side images of eggs, identifying side outlines of the eggs, determining the side areas or the volumes of the eggs according to the side outlines of the eggs, and inputting the side areas or the volumes of the eggs into a pre-trained egg weight estimation model, so that the weight of the eggs can be accurately and quickly obtained. The eggs can be subsequently separately hatched based on weight, and the egg weight estimation efficiency and hatchability are improved.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, 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 some embodiments of the present application, but not all 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 hatching process, in order to improve the hatching rate of the poultry hatching eggs, the poultry hatching eggs need to be graded in weight, and the graded poultry hatching eggs are separately hatched to ensure high hatching rate. According to the weight estimation method and device for the poultry eggs, the weight of the poultry eggs is accurately estimated based on the poultry egg images based on the visual information and the poultry egg weight estimation model learned by a machine, so that the poultry eggs can be hatched separately based on weight subsequently, and the weight estimation efficiency and hatching rate of the poultry eggs are improved.
First, an image processing method according to an embodiment of the present invention will be described below. The image processing method trains the weight estimation model of the poultry egg.
Fig. 1 is a flowchart of an image processing method according to an embodiment of the present application. As shown in fig. 1, the method comprises the steps of:
step S11, acquiring a sample image including the side surface of the egg and the weight of the egg;
step S12, identifying the side profile of the egg from the sample image;
and step S13, obtaining an egg weight estimation model according to the side profile and weight training.
The poultry egg is similar to a spindle body, the side surface observed from the visual angle vertical to the long axis direction of the poultry egg is the side surface of the poultry egg, and the side surface observed from the visual angle vertical to the short axis direction of the poultry egg is the end surface of the poultry egg.
In this embodiment, the side of the egg may be photographed by a camera to obtain a sample image as shown in fig. 2, and the egg may be weighed to obtain the weight of the egg. In this manner, a large number of samples may be collected, each sample including an image of a sample of the side of an egg and the weight of the egg.
The side profile of the egg can be identified from the sample image through an image identification algorithm, the area of the side of the egg can be obtained based on the profile, and the volume of the egg can be calculated.
In this embodiment, the egg weight estimation model in step S13 may be obtained by training the correspondence between the side area and the weight of the egg, or may be obtained by training the correspondence between the volume and the weight of the egg.
Optionally, step S13 includes:
step A1, calculating the side area of the poultry egg according to the side contour;
and A2, learning the corresponding relation between the side surface area and the weight to obtain the poultry egg weight estimation model.
In this embodiment, the weight estimation model of the eggs can be obtained through training of the side areas of the eggs and the weight of the eggs, so that the weight of the eggs can be obtained based on the images of the eggs. However, fitting the egg weight directly through the egg side area may result in a very abstract and complex mathematical formula that is difficult to describe in mathematical language, and if based on egg volume, a linear model may be fitted directly according to a physical formula, mass being the volume x density.
Optionally, step S13 includes:
and step B1, calculating the volume of the poultry egg according to the side profile.
Fig. 3 is a schematic view of an egg side profile in a two-dimensional coordinate system as provided in an embodiment of the present application. As shown in FIG. 3, because egg side profiles are mostly asymmetric in shape, in a two-dimensional coordinate system, the major axis of the egg side profile coincides with the x-axis, r1(x) And r2(x) The profile curves of the side profile of the poultry egg above the x-axis and below the x-axis are respectively shown, and L represents the length of the long axis.
Egg volume can be calculated according to the following formula:
in this embodiment, the method for calculating the volume of the egg based on the side profile of the egg is not limited to this, for example, the side area of the egg is calculated by the side profile of the egg, and then the volume of the egg is calculated based on the area, or calculated by other integral or non-integral methods, and so on, and thus details are not repeated herein.
And step B2, learning the corresponding relation between the volume and the weight to obtain the poultry egg weight estimation model.
According to the volume of the eggs and the weight of the eggs in the sample, a linear egg weight estimation model G which is p multiplied by V + b can be obtained through least square fitting, wherein G represents the weight of the eggs, V represents the volume of the eggs, and p and b are parameters obtained through training.
Fig. 4 is a comparative graph of experimental results provided in the examples of the present application. As shown in fig. 4, the model curve fitting the egg weight based on the egg volume has a high correlation coefficient, and can accurately and effectively realize weight estimation based on the egg image.
The weight estimation method for the poultry egg provided by the embodiment of the invention is introduced below, and the weight estimation method for the poultry egg is applied to the weight estimation model of the poultry egg obtained by training in the embodiment.
Fig. 5 is a flowchart of an egg weight estimation method according to an embodiment of the present application. As shown in fig. 5, the method comprises the steps of:
step S21, acquiring side images of the poultry eggs;
step S22, identifying the side contour of the egg from the side image of the egg;
and step S23, determining the weight of the eggs based on the side profiles of the eggs according to the weight estimation models of the eggs trained in advance.
The weight estimation model for the poultry egg in the embodiment may be a model obtained based on training of the side area of the poultry egg, or a model obtained based on training of the volume of the poultry egg. Therefore, the above step S23 can be implemented in the following two ways.
The weight is estimated based on the side surface area of the poultry egg.
The step S13 includes:
step A1, calculating the side area of the egg according to the side profile of the egg;
step A2, determining the weight of the egg based on the side area of the egg according to a pre-trained egg weight estimation model.
And secondly, estimating the weight based on the volume of the poultry eggs.
Optionally, step S13 includes:
step B1, calculating the volume of the eggs according to the side profiles of the eggs;
and step B2, determining the weight of the eggs based on the volume of the eggs according to the weight estimation models of the pre-trained eggs.
Optionally, step B1 includes:
step C1, determining a profile curve corresponding to the profile of the side surface of the poultry egg;
and C2, calculating the volume of the poultry egg according to the contour curve.
The egg weight estimation method comprises the steps of collecting an egg side image, identifying an egg side profile, determining an egg side area or an egg volume through the egg side profile, and inputting the egg side area or the egg volume into a pre-trained egg weight estimation model, so that the egg weight can be accurately and quickly obtained. The eggs can be subsequently separately hatched based on weight, and the egg weight estimation efficiency and hatchability are improved.
Optionally, the method further includes: generating a sorting instruction according to the weight of the eggs, wherein the sorting instruction is used for controlling sorting equipment to perform sorting operation corresponding to the weight of the eggs; and sending the sorting instruction to the sorting equipment.
In this embodiment, based on the weight of the eggs, the eggs can be sorted to corresponding positions, so that the eggs with different weights are separately hatched, thereby improving the hatching rate of the eggs.
The following are embodiments of the apparatus of the present application that may be used to perform embodiments of the method of the present application.
Fig. 6 is a block diagram of an egg weight estimation apparatus provided in an embodiment of the present application, which may be implemented as part or all of an electronic device through software, hardware, or a combination of the two. As shown in fig. 6, the egg weight estimation device comprises:
the acquisition module 61 is used for acquiring the side image of the poultry egg;
an identification module 62 for identifying an egg side profile from an egg side image;
and the determining module 63 is used for determining the weight of the eggs based on the side profiles of the eggs according to the weight estimation model of the eggs trained in advance.
Fig. 7 is a block diagram of an image processing apparatus provided in an embodiment of the present application, which may be implemented as part or all of an electronic device through software, hardware, or a combination of the two. As shown in fig. 7, the image processing apparatus includes:
the acquiring module 71 is used for acquiring a sample image including the side surface of the egg and the weight of the egg;
an identifying module 72 for identifying a side profile of the avian egg from the sample image;
and the training module 73 is used for training according to the side profile and the weight to obtain an egg weight estimation model.
An embodiment of the present application further provides an electronic device, as shown in fig. 8, the electronic device may include: the system comprises a processor 1501, a communication interface 1502, a memory 1503 and a communication bus 1504, wherein the processor 1501, the communication interface 1502 and the memory 1503 complete communication with each other through the communication bus 1504.
A memory 1503 for storing a computer program;
the processor 1501, when executing the computer program stored in the memory 1503, implements the steps of the method embodiments described below.
The communication bus mentioned in the electronic device may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown, but this does not mean that there is only one bus or one type of bus.
The communication interface is used for communication between the electronic equipment and other equipment.
The Memory may include a Random Access Memory (RAM) or a Non-Volatile Memory (NVM), such as at least one disk Memory. Optionally, the memory may also be at least one memory device located remotely from the processor.
The Processor may be a general-purpose Processor, including a Central Processing Unit (CPU), a Network Processor (NP), and the like; but also Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components.
The present application also provides a computer-readable storage medium having stored thereon a computer program which, when being executed by a processor, carries out the steps of the method embodiments described below.
It should be noted that, for the above-mentioned apparatus, electronic device and computer-readable storage medium embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and for the relevant points, reference may be made to the partial description of the method embodiments.
It is further noted that, herein, relational terms such as "first" and "second," and the like, may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
The foregoing are merely exemplary embodiments of the present invention, which enable those skilled in the art to understand or practice the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.