Livestock measuring method, device and equipment and storage medium

By segmenting the captured pictures of livestock using the segmentation model and calculating the measurement conversion coefficient, the problem of poor measurement convenience of livestock in the prior art is solved, and fast and accurate measurement of livestock is achieved.

CN119573561APending Publication Date: 2025-03-07PING AN TECH (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411689998.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-22
Publication Date
2025-03-07

AI Technical Summary

Technical Problem

The existing domestic livestock measurement methods are less convenient and require professional measurement equipment. Due to the large size of domestic livestock, the equipment is inconvenient to carry.

Method used

By obtaining the captured pictures of domestic animals marked by preset markers, using the preconstructed segmentation model to segment the area of ​​domestic animals and markers, calculating the pixel area and characteristic values ​​of the markers, obtaining the measurement conversion coefficient, and then obtaining the actual measurement parameters of domestic animals.

Benefits of technology

It improves the convenience of livestock measurement, breaks away from the limitations of professional equipment, and can quickly and accurately measure the body size parameters and weight of livestock.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119573561A_ABST
    Figure CN119573561A_ABST
Patent Text Reader

Abstract

The invention relates to an artificial intelligence technology, and discloses a livestock measurement method, which can be used for insurance claim settlement of livestock breeding in the financial insurance field, and comprises the following steps: obtaining a shot picture of a to-be-measured livestock marked by a preset marker and a marker feature value of the marker; and carrying out picture segmentation on the shot picture, and converting the pixel measurement parameters of the livestock in the segmented picture into actual measurement parameters based on the conversion relation between the feature value of the marker in the segmented picture and the actual feature value of the marker, thereby completing the measurement of the livestock. The invention further provides a livestock measuring device, equipment and a medium. According to the invention, the convenience of livestock measurement can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to safety detection technology, and in particular to a livestock measurement method, device, electronic equipment and storage medium. Background Art

[0002] In the field of financial insurance, many farmers will purchase insurance for their livestock and make claims after the livestock die. When making claims, different amounts of claims are generally made based on the relevant body parameters or weight of the livestock. Therefore, it is necessary to measure the body parameters (such as height, body length) or weight of the livestock.

[0003] However, the existing livestock measurement method requires the claims coordinator to carry professional measuring equipment when handling claims business on site. However, since many livestock are relatively large in size and professional measuring equipment is inconvenient to carry, the convenience of livestock measurement is poor. Summary of the invention

[0004] The present invention provides a livestock measurement method, device, electronic equipment and storage medium, the main purpose of which is to improve the convenience of livestock measurement.

[0005] Obtaining a photograph of the livestock to be measured marked with a preset marker and a marker characteristic value of the marker;

[0006] Using a pre-built first segmentation model to perform regional segmentation of livestock and landmarks on the photographed image to obtain a comprehensive segmentation image;

[0007] Obtaining an interactive operation picture of the photographed picture, and performing livestock region segmentation using a pre-constructed second segmentation model based on the comprehensive segmentation picture, the photographed picture and the interactive operation picture to obtain a livestock segmentation picture;

[0008] Calculating the pixel area of ​​the image region corresponding to the marker in the comprehensive segmentation image to obtain the pixel area of ​​the marker;

[0009] Calculating based on the pixel area of ​​the marker and the characteristic value of the marker to obtain a measurement conversion coefficient;

[0010] Acquire livestock pixel measurement parameter information of the livestock segmentation picture, and convert each parameter in the livestock pixel measurement parameter information based on the measurement conversion coefficient to obtain actual livestock measurement parameter information;

[0011] The livestock measurement type is obtained, and the actual livestock measurement parameter information is screened or calculated based on the livestock measurement type to obtain the livestock measurement result.

[0012] Optionally, calculating the pixel area of ​​the image region corresponding to the marker in the comprehensive segmentation image to obtain the pixel area of ​​the marker includes:

[0013] The total number of pixels in the image area corresponding to the marker in the comprehensive segmentation picture is calculated to obtain the pixel area of ​​the marker.

[0014] Optionally, the calculation based on the pixel area of ​​the marker and the characteristic value of the marker to obtain the measurement conversion coefficient includes:

[0015] Obtaining an area formula of the graphic corresponding to the marker, and performing calculation based on the area formula and the pixel area of ​​the marker to obtain a pixel measurement characteristic value of the marker;

[0016] The ratio of the marker pixel measurement characteristic value to the marker characteristic value is calculated to obtain the measurement conversion coefficient.

[0017] Optionally, the acquiring of livestock pixel measurement parameter information of the livestock segmentation picture includes:

[0018] Binarizing the livestock segmentation picture to obtain a target segmentation picture;

[0019] Calculate the difference in pixel coordinates in the vertical direction between the highest point and the lowest point of the pixel with a pixel gray value of 1 in the target segmented image to obtain a pixel measurement parameter of the livestock height;

[0020] Calculate the ratio of the number of pixels with a grayscale value of 1 in each row of pixels in the target segmentation image to the total number of pixels in the row, and obtain the torso pixel ratio of each row of pixels in the target segmentation image;

[0021] Filtering pixel rows in the target segmentation image based on the torso pixel ratio and a preset torso pixel threshold to obtain torso pixel rows;

[0022] Determine an area consisting of pixels with a pixel gray value of 1 in all the trunk pixel rows as a trunk pixel area;

[0023] Calculating the difference in pixel coordinates of the highest pixel and the lowest pixel in the trunk pixel area in the vertical direction to obtain a pixel measurement parameter of the height of the livestock trunk;

[0024] Calculate the difference in pixel coordinates of the leftmost pixel and the rightmost pixel in the trunk pixel area in the horizontal direction to obtain a pixel measurement parameter of the livestock body length;

[0025] Calculating the number of edge pixels in the trunk pixel area to obtain a pixel measurement parameter of the livestock trunk circumference;

[0026] The livestock height pixel measurement parameters, the livestock trunk height pixel measurement parameters, the livestock body length pixel measurement parameters and the livestock trunk circumference pixel measurement parameters are summarized to obtain the livestock pixel measurement parameter information.

[0027] Optionally, the livestock region segmentation is performed based on the comprehensive segmentation picture, the captured picture and the interactive operation picture using a pre-built second segmentation model to obtain the livestock segmentation picture, including:

[0028] Convolving the interactive operation picture to obtain an interactive feature picture;

[0029] Convolving the captured image to obtain a captured feature image;

[0030] All image channels of the interactive feature image, the shooting feature image and the comprehensive segmentation image are used as inputs of the second segmentation model to perform livestock area segmentation to obtain the livestock segmentation image.

[0031] Optionally, the livestock region segmentation is performed based on the comprehensive segmentation picture, the captured picture and the interactive operation picture using a pre-built second segmentation model to obtain the livestock segmentation picture, including:

[0032] Convolving the captured image to obtain a captured feature image;

[0033] Determining the comprehensive segmented picture as a historical segmented picture;

[0034] Convolving the interactive operation picture to obtain an interactive feature picture;

[0035] Using the interactive feature image, the shooting feature image and all the image channels of the comprehensive segmentation image as inputs of the second segmentation model to perform livestock region segmentation, obtain an initial livestock segmentation image, and record the number of model segmentation times;

[0036] Determine whether the number of model segmentation times is greater than or equal to a preset segmentation threshold;

[0037] When the number of segmentation times of the model is less than a preset segmentation threshold, the initial livestock segmentation picture is determined as a historical segmentation picture, and the step of using the interactive feature picture, the shooting feature picture and all the picture channels of the comprehensive segmentation picture as inputs of the second segmentation model is returned;

[0038] When the model segmentation times is greater than or equal to a preset segmentation threshold, the initial livestock segmentation picture is determined as the livestock segmentation picture.

[0039] Optionally, the screening or calculating of the actual livestock measurement parameter information based on the livestock measurement type to obtain the livestock measurement result includes:

[0040] When the livestock measurement type is body parameter measurement, obtaining a measurement parameter type corresponding to the livestock measurement type, extracting measurement parameters of the same type from actual livestock measurement parameters according to the measurement parameter type, and obtaining the livestock measurement result;

[0041] When the livestock measurement type is weight measurement, a weight measurement calculation is performed based on the measurement parameters in the actual measurement parameter information of the livestock and a preset weight calculation formula to obtain the measured weight of the livestock to be measured, and the measured weight of the livestock to be measured is determined as the livestock measurement result.

[0042] In order to solve the above problems, the present invention also provides a livestock measuring device, the device comprising:

[0043] A data acquisition module, used to acquire a photograph of the livestock to be measured marked with a preset marker and a marker characteristic value of the marker;

[0044] An image segmentation module is used to perform livestock and landmark area segmentation on the photographed picture using a pre-constructed first segmentation model to obtain a comprehensive segmentation picture; obtain an interactive operation picture of the photographed picture, and perform livestock area segmentation using a pre-constructed second segmentation model based on the comprehensive segmentation picture, the photographed picture and the interactive operation picture to obtain a livestock segmentation picture;

[0045] The livestock measurement module is used to calculate the pixel area of ​​the image area corresponding to the marker in the comprehensive segmentation picture to obtain the marker pixel area; perform calculation based on the marker pixel area and the marker characteristic value to obtain the measurement conversion coefficient; obtain the livestock pixel measurement parameter information of the livestock segmentation picture, convert each parameter in the livestock pixel measurement parameter information based on the measurement conversion coefficient to obtain the livestock actual measurement parameter information; obtain the livestock measurement type, screen or calculate the livestock actual measurement parameter information based on the livestock measurement type, and obtain the livestock measurement result.

[0046] In order to solve the above problem, the present invention further provides an electronic device, the electronic device comprising:

[0047] a memory storing at least one computer program; and

[0048] A processor executes the computer program stored in the memory to implement the livestock measurement method described above.

[0049] In order to solve the above problems, the present invention also provides a computer-readable storage medium, in which at least one computer program is stored. The at least one computer program is executed by a processor in an electronic device to implement the livestock measurement method described above.

[0050] The embodiment of the present invention calculates the pixel area of ​​the image area corresponding to the marker in the comprehensive segmentation picture to obtain the marker pixel area; performs calculation based on the marker pixel area and the marker characteristic value to obtain the measurement conversion coefficient; obtains the livestock pixel measurement parameter information of the livestock segmentation picture, converts each parameter in the livestock pixel measurement parameter information based on the measurement conversion coefficient to obtain the livestock actual measurement parameter information; obtains the livestock measurement type, and screens or calculates the livestock actual measurement parameter information based on the livestock measurement type to obtain the livestock measurement result. Measuring livestock through livestock pictures gets rid of the limitations of livestock body shape and professional measurement equipment, and improves the convenience of livestock measurement. Therefore, the livestock measurement method, device, electronic device and readable storage medium proposed in the embodiment of the present invention improve the convenience of livestock measurement. BRIEF DESCRIPTION OF THE DRAWINGS

[0051] Figure 1 A schematic diagram of a livestock measurement method according to an embodiment of the present invention;

[0052] Figure 2 A schematic diagram of a module of a livestock measuring device provided in one embodiment of the present invention;

[0053] Figure 3 A schematic diagram of the internal structure of an electronic device for implementing a livestock measurement method provided by an embodiment of the present invention;

[0054] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0055] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.

[0056] An embodiment of the present invention provides a livestock measurement method. The execution subject of the livestock measurement method includes but is not limited to at least one of the electronic devices such as a server and a terminal that can be configured to execute the method provided in the embodiment of the present application. In other words, the livestock measurement method can be executed by software or hardware installed on a terminal device or a server device, and the software can be a blockchain platform. The server includes but is not limited to: a single server, a server cluster, a cloud server or a cloud server cluster, etc. The server can be an independent server or a cloud server that provides cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (Content Delivery Network, CDN), and basic cloud computing services such as big data and artificial intelligence platforms.

[0057] Reference Figure 1 FIG. 1 is a flow chart of a livestock measurement method provided by an embodiment of the present invention. In the embodiment of the present invention, the livestock measurement method comprises the following steps:

[0058] S1. Obtaining a photograph of the livestock to be measured marked with a preset marker and a marker characteristic value of the marker;

[0059] The marker in the embodiment of the present invention can be a circular or square cardboard, plastic plate, metal plate, etc., with a fixed size, such as a diameter / side length of 10 cm; the corresponding marker feature value corresponds to the shape of the marker. If the marker is circular, the corresponding marker feature value is the diameter of the marker; if the marker is square, the corresponding marker feature value is the side length of the marker. The color of the marker is a fixed solid color, such as red. The marker can be attached to the animal for marking, or it can be sprayed on the animal in a specified size and color, or mounted on the animal's horns or ears for marking, and it can be facing the camera.

[0060] Furthermore, the photographed picture in the embodiment of the present invention is a side picture of the livestock to be measured marked by the marker.

[0061] S2, using a pre-built first segmentation model to perform regional segmentation of livestock and landmarks on the captured image to obtain a comprehensive segmentation image;

[0062] In the embodiment of the present invention, the first segmentation model is a trained semantic segmentation model, and livestock and landmarks are respectively used as separate segmentation categories during segmentation.

[0063] S3, obtaining an interactive operation picture of the photographed picture, and performing livestock region segmentation using a pre-constructed second segmentation model based on the comprehensive segmentation picture, the photographed picture and the interactive operation picture to obtain a livestock segmentation picture;

[0064] The interactive operation picture in the embodiment of the present invention is a picture for interactive operation on the captured picture. The interactive operation can be interactive operations such as clicks, closed curves, and non-closed curves, which are used to separate the foreground and background to be segmented to improve the accuracy of segmentation. The second segmentation model can use the popular image segmentation network in the industry, such as U-Net, U2-net, HRNET, Tsegformer, etc.

[0065] Specifically, in the embodiment of the present invention, based on the interactive operation picture, the first segmented picture, and the captured picture, livestock region segmentation is performed using a pre-built second segmentation model to obtain a livestock segmented picture, including:

[0066] Convolving the interactive operation picture to obtain an interactive feature picture;

[0067] Convolving the captured image to obtain a captured feature image;

[0068] All image channels of the interactive feature image, the shooting feature image and the comprehensive segmentation image are used as inputs of the second segmentation model to perform livestock area segmentation to obtain the livestock segmentation image.

[0069] In another embodiment of the present invention, the livestock region segmentation is performed based on the comprehensive segmentation picture, the captured picture and the interactive operation picture using a pre-built second segmentation model to obtain the livestock segmentation picture, including:

[0070] Convolving the captured image to obtain a captured feature image;

[0071] Determining the comprehensive segmented picture as a historical segmented picture;

[0072] Convolving the interactive operation picture to obtain an interactive feature picture;

[0073] Using the interactive feature image, the shooting feature image and all the image channels of the comprehensive segmentation image as inputs of the second segmentation model to perform livestock region segmentation, obtain an initial livestock segmentation image, and record the number of model segmentation times;

[0074] Determine whether the number of model segmentation times is greater than or equal to a preset segmentation threshold;

[0075] When the number of segmentation times of the model is less than a preset segmentation threshold, the initial livestock segmentation picture is determined as a historical segmentation picture, and the step of using the interactive feature picture, the shooting feature picture and all the picture channels of the comprehensive segmentation picture as inputs of the second segmentation model is returned;

[0076] When the model segmentation times is greater than or equal to a preset segmentation threshold, the initial livestock segmentation picture is determined as the livestock segmentation picture.

[0077] Furthermore, in order to improve the segmentation effect in the embodiment of the present invention, the initial livestock segmentation picture is determined as a historical segmentation picture, including:

[0078] Interactively adjusting the initial livestock segmentation picture to obtain an adjusted segmentation picture;

[0079] The adjusted segmented picture is determined as a historical segmented picture.

[0080] S4, calculating the pixel area of ​​the image region corresponding to the marker in the comprehensive segmentation image to obtain the pixel area of ​​the marker;

[0081] In the embodiment of the present invention, the livestock to be measured is measured through a picture by using a marker as a reference. In order to calculate the difference between the parameters of the marker in the picture and the actual parameters, it is necessary to calculate the pixel area of ​​the image area corresponding to the marker in the comprehensive segmented picture to obtain the pixel area of ​​the marker.

[0082] Furthermore, the extracting the pixel area of ​​the marker in the comprehensive segmentation picture to obtain the pixel area of ​​the marker in the embodiment of the present invention includes:

[0083] The total number of pixels in the image area corresponding to the marker in the comprehensive segmentation picture is calculated to obtain the pixel area of ​​the marker.

[0084] S5. Calculate based on the pixel area of ​​the marker and the characteristic value of the marker to obtain a measurement conversion coefficient;

[0085] In order to calculate the actual parameters of the livestock to be measured based on the pixel parameters of the livestock in the picture, the embodiment of the present invention needs to know the correspondence between the pixel parameters and the actual parameters. Therefore, the measurement conversion coefficient is obtained by calculation based on the pixel area of ​​the marker and the characteristic value of the marker.

[0086] Specifically, in the embodiment of the present invention, the calculation based on the pixel area of ​​the marker and the characteristic value of the marker to obtain the measurement conversion coefficient includes:

[0087] Obtaining an area formula of the graphic corresponding to the marker, and performing calculation based on the area formula and the pixel area of ​​the marker to obtain a pixel measurement characteristic value of the marker;

[0088] The ratio of the marker pixel measurement characteristic value to the marker characteristic value is calculated to obtain the measurement conversion coefficient.

[0089] For example: when the marker is a circle, the marker pixel area is taken as the area of ​​the circle, and the marker pixel measurement characteristic value is the calculated diameter of the circle; when the marker is a circle, the marker pixel area is taken as the area of ​​the square, and the marker pixel measurement characteristic value is the calculated side length of the square.

[0090] S6, obtaining livestock pixel measurement parameter information of the livestock segmentation picture, and converting each parameter in the livestock pixel measurement parameter information based on the measurement conversion coefficient to obtain actual livestock measurement parameter information;

[0091] In the embodiment of the present invention, due to different measurement purposes, the corresponding livestock measurement types are also different. The livestock measurement type is height measurement or weight measurement.

[0092] Furthermore, in order to better measure the livestock to be measured in the embodiment of the present invention, it is necessary to know the relevant pixel parameters of the livestock to be measured in the picture. Therefore, the livestock pixel measurement parameters of the livestock segmentation picture are extracted, and the livestock pixel measurement parameters are converted based on the measurement conversion coefficient to obtain the actual measurement parameters of the livestock.

[0093] Specifically, in the embodiment of the present invention, the livestock pixel measurement parameter information of the livestock segmentation picture is obtained, including:

[0094] Binarizing the livestock segmentation picture to obtain a target segmentation picture;

[0095] Calculate the difference in pixel coordinates in the vertical direction between the highest point and the lowest point of the pixel with a pixel gray value of 1 in the target segmented image to obtain a pixel measurement parameter of the livestock height;

[0096] Calculate the ratio of the number of pixels with a grayscale value of 1 in each row of pixels in the target segmentation image to the total number of pixels in the row, and obtain the torso pixel ratio of each row of pixels in the target segmentation image;

[0097] Filtering pixel rows in the target segmentation image based on the torso pixel ratio and a preset torso pixel threshold to obtain torso pixel rows;

[0098] Determine an area consisting of pixels with a pixel gray value of 1 in all the trunk pixel rows as a trunk pixel area;

[0099] Calculating the difference in pixel coordinates of the highest pixel and the lowest pixel in the trunk pixel area in the vertical direction to obtain a pixel measurement parameter of the height of the livestock trunk;

[0100] Calculate the difference in pixel coordinates of the leftmost pixel and the rightmost pixel in the trunk pixel area in the horizontal direction to obtain a pixel measurement parameter of the livestock body length;

[0101] The number of edge pixels in the trunk pixel area is calculated to obtain the livestock trunk circumference pixel measurement parameter.

[0102] The livestock height pixel measurement parameters, the livestock trunk height pixel measurement parameters, the livestock body length pixel measurement parameters and the livestock trunk circumference pixel measurement parameters are summarized to obtain the livestock pixel measurement parameter information.

[0103] Optionally, the torso pixel threshold in the embodiment of the present invention is a real number greater than 0 and less than or equal to 1. Preferably, the torso pixel threshold is 1 / 3.

[0104] Furthermore, in an embodiment of the present invention, each parameter in the livestock pixel measurement parameter information is converted based on the measurement conversion coefficient to obtain the livestock actual measurement parameter information, including:

[0105] Extracting each parameter in the livestock pixel measurement parameter information, and multiplying each extracted parameter by the measurement conversion coefficient to obtain a corresponding actual measurement parameter;

[0106] All the actual measured parameters are summarized to obtain the actual measured parameter information of the livestock.

[0107] Specifically, in the embodiment of the present invention, the method of converting each parameter in the livestock pixel measurement parameter information based on the measurement conversion coefficient to obtain the livestock actual measurement parameter information includes:

[0108] Extracting livestock height pixel measurement parameters from the livestock pixel measurement parameter information, and calculating using the livestock height pixel measurement parameters and the measurement conversion coefficient to obtain livestock height pixel measurement parameters;

[0109] Extracting a livestock trunk height pixel measurement parameter from the livestock pixel measurement parameter information, and performing calculation using the livestock trunk height pixel measurement parameter and the measurement conversion coefficient to obtain a livestock trunk height measurement parameter;

[0110] Extracting livestock body length pixel measurement parameters from the livestock pixel measurement parameter information, and calculating using the livestock body length pixel measurement parameters and the measurement conversion coefficient to obtain livestock body length measurement parameters;

[0111] Extracting the livestock trunk circumference pixel measurement parameter from the livestock pixel measurement parameter information, and calculating using the livestock trunk circumference pixel measurement parameter and the measurement conversion coefficient to obtain the livestock trunk circumference measurement parameter;

[0112] The livestock height measurement parameters, the livestock trunk height measurement parameters, the livestock body length measurement parameters and the livestock trunk circumference measurement parameters are summarized to obtain actual measurement parameter information of the livestock.

[0113] S7. Obtaining a livestock measurement type, and screening or calculating the livestock actual measurement parameter information based on the livestock measurement type to obtain a livestock measurement result.

[0114] In the embodiment of the present invention, due to different measurement purposes, the corresponding livestock measurement types are also different. The livestock measurement type is body parameter measurement or weight parameter measurement.

[0115] In detail, in the embodiment of the present invention, the actual livestock measurement parameter information is screened or calculated based on the livestock measurement type to obtain the livestock measurement result, including:

[0116] When the livestock measurement type is body parameter measurement, obtaining a measurement parameter type corresponding to the livestock measurement type, extracting measurement parameters of the same type from actual livestock measurement parameters according to the measurement parameter type, and obtaining the livestock measurement result;

[0117] When the livestock measurement type is weight measurement, a weight measurement calculation is performed based on the measurement parameters in the actual measurement parameter information of the livestock and a preset weight calculation formula to obtain the measured weight of the livestock to be measured, and the measured weight of the livestock to be measured is determined as the livestock measurement result.

[0118] Specifically, the following formula is used to measure body weight in the embodiment of the present invention:

[0119]

[0120] Wherein, W is the measured weight of the livestock to be measured, r 1 is the livestock height measurement parameter, r 2 is the livestock trunk height measurement parameter, r 3 is the livestock body length measurement parameter, r 4 is the livestock trunk circumference measurement parameter, a 1 、a 2 、a 3 、a 4 、a 5 、a 6 、a 7 、a 8 is the preset weight parameter.

[0121] Furthermore, in the embodiment of the present invention, the corresponding weight parameters can be constructed according to the different breeds of livestock. The embodiment of the present invention can take side photos of a group of livestock of the same breed, and physically weigh each livestock to obtain the real weight, and use the method of the embodiment of the present invention to measure the actual measurement parameter information of each livestock, and use a meta-heuristic search algorithm, such as a genetic algorithm or a cuckoo search algorithm, to solve the weight parameters.

[0122] like Figure 2 The figure shows a functional module diagram of the livestock measuring device of the present invention.

[0123] The livestock measurement device 100 of the present invention can be installed in an electronic device. According to the functions to be implemented, the livestock measurement device can include a data acquisition module 101, an image segmentation module 102, and a livestock measurement module 103. The modules described in the present invention can also be referred to as units, which refer to a series of computer program segments that can be executed by a processor of an electronic device and can complete fixed functions, and are stored in a memory of the electronic device.

[0124] In this embodiment, the functions of each module / unit are as follows:

[0125] The data acquisition module 101 is used to acquire a photograph of the livestock to be measured marked with a preset marker and a marker characteristic value of the marker;

[0126] The image segmentation module 102 is used to perform livestock and landmark area segmentation on the captured image using a pre-constructed first segmentation model to obtain a comprehensive segmentation image; obtain an interactive operation image of the captured image, and perform livestock area segmentation using a pre-constructed second segmentation model based on the comprehensive segmentation image, the captured image and the interactive operation image to obtain a livestock segmentation image;

[0127] The livestock measurement module 103 is used to calculate the pixel area of ​​the image area corresponding to the marker in the comprehensive segmentation image to obtain the marker pixel area; perform calculation based on the marker pixel area and the marker characteristic value to obtain the measurement conversion coefficient; obtain the livestock pixel measurement parameter information of the livestock segmentation image, convert each parameter in the livestock pixel measurement parameter information based on the measurement conversion coefficient to obtain the livestock actual measurement parameter information; obtain the livestock measurement type, screen or calculate the livestock actual measurement parameter information based on the livestock measurement type, and obtain the livestock measurement result.

[0128] In detail, each module described in the livestock measurement device 100 in the embodiment of the present invention is used in the same manner as described above. Figure 1 The livestock measurement method described in the present invention has the same technical means and can produce the same technical effects, so it will not be repeated here.

[0129] like Figure 3 FIG. 1 is a schematic diagram of the structure of an electronic device for implementing the livestock measurement method of the present invention.

[0130] The electronic device may include a processor 10 , a memory 11 , a communication bus 12 , and a communication interface 13 , and may also include a computer program stored in the memory 11 and executable on the processor 10 , such as a livestock measurement program.

[0131] The memory 11 includes at least one type of readable storage medium, and the readable storage medium includes a flash memory, a mobile hard disk, a multimedia card, a card-type memory (e.g., SD or DX memory, etc.), a magnetic memory, a disk, an optical disk, etc. The memory 11 may be an internal storage unit of an electronic device in some embodiments, such as a mobile hard disk of the electronic device. The memory 11 may also be an external storage device of an electronic device in other embodiments, such as a plug-in mobile hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the electronic device. Further, the memory 11 may also include both an internal storage unit of the electronic device and an external storage device. The memory 11 may not only be used to store application software and various types of data installed in the electronic device, such as the code of the livestock measurement program, etc., but also be used to temporarily store data that has been output or is to be output.

[0132] The processor 10 may be composed of an integrated circuit in some embodiments, for example, a single packaged integrated circuit, or a plurality of packaged integrated circuits with the same or different functions, including one or more central processing units (CPUs), microprocessors, digital processing chips, graphics processors, and combinations of various control chips, etc. The processor 10 is the control core (Control Unit) of the electronic device, and uses various interfaces and lines to connect various components of the entire electronic device, and executes or executes programs or modules (such as livestock measurement programs, etc.) stored in the memory 11, and calls data stored in the memory 11 to execute various functions of the electronic device and process data.

[0133] The communication bus 12 may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. The communication bus 12 is configured to realize connection and communication between the memory 11 and at least one processor 10, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.

[0134] Figure 3 Only an electronic device with components is shown, and those skilled in the art will understand that Figure 3The structure shown does not constitute a limitation on the electronic device, and may include fewer or more components than shown in the figure, or combine certain components, or arrange the components differently.

[0135] For example, although not shown, the electronic device may also include a power source (such as a battery) for supplying power to various components. Preferably, the power source may be logically connected to the at least one processor 10 through a power management device, so that the power management device can realize functions such as charging management, discharging management, and power consumption management. The power source may also include any components such as one or more DC or AC power sources, recharging devices, power failure classification circuits, power converters or inverters, power status indicators, etc. The electronic device may also include a variety of sensors, Bluetooth modules, Wi-Fi modules, etc., which will not be repeated here.

[0136] Optionally, the communication interface 13 may include a wired interface and / or a wireless interface (such as a WI-FI interface, a Bluetooth interface, etc.), which is generally used to establish a communication connection between the electronic device and other electronic devices.

[0137] Optionally, the communication interface 13 may also include a user interface, which may be a display, an input unit (such as a keyboard), or a standard wired interface or a wireless interface. Optionally, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, and an OLED (Organic Light-Emitting Diode) touch device. The display may also be appropriately referred to as a display screen or a display unit, which is used to display information processed in the electronic device and to display a visual user interface.

[0138] It should be understood that the embodiment is for illustration only and the scope of the patent application is not limited to this structure.

[0139] The livestock measurement program stored in the memory 11 in the electronic device is a combination of multiple computer programs. When running in the processor 10, it can achieve:

[0140] Obtaining a photograph of the livestock to be measured marked with a preset marker and a marker characteristic value of the marker;

[0141] Using a pre-built first segmentation model to perform regional segmentation of livestock and landmarks on the photographed image to obtain a comprehensive segmentation image;

[0142] Obtaining an interactive operation picture of the photographed picture, and performing livestock region segmentation using a pre-constructed second segmentation model based on the comprehensive segmentation picture, the photographed picture and the interactive operation picture to obtain a livestock segmentation picture;

[0143] Calculating the pixel area of ​​the image region corresponding to the marker in the comprehensive segmentation image to obtain the pixel area of ​​the marker;

[0144] Calculating based on the pixel area of ​​the marker and the characteristic value of the marker to obtain a measurement conversion coefficient;

[0145] Acquire livestock pixel measurement parameter information of the livestock segmentation picture, and convert each parameter in the livestock pixel measurement parameter information based on the measurement conversion coefficient to obtain actual livestock measurement parameter information;

[0146] The livestock measurement type is obtained, and the actual livestock measurement parameter information is screened or calculated based on the livestock measurement type to obtain the livestock measurement result.

[0147] Specifically, the specific implementation method of the processor 10 for the above computer program can refer to Figure 1 The description of the relevant steps in the corresponding embodiments will not be repeated here.

[0148] Furthermore, if the module / unit integrated in the electronic device is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. The computer-readable medium can be non-volatile or volatile. The computer-readable medium can include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM).

[0149] An embodiment of the present invention may further provide a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor of an electronic device, the computer program may implement:

[0150] Obtaining a photograph of the livestock to be measured marked with a preset marker and a marker characteristic value of the marker;

[0151] Using a pre-built first segmentation model to perform regional segmentation of livestock and landmarks on the photographed image to obtain a comprehensive segmentation image;

[0152] Obtaining an interactive operation picture of the photographed picture, and performing livestock region segmentation using a pre-constructed second segmentation model based on the comprehensive segmentation picture, the photographed picture and the interactive operation picture to obtain a livestock segmentation picture;

[0153] Calculating the pixel area of ​​the image region corresponding to the marker in the comprehensive segmentation image to obtain the pixel area of ​​the marker;

[0154] Calculating based on the pixel area of ​​the marker and the characteristic value of the marker to obtain a measurement conversion coefficient;

[0155] Acquire livestock pixel measurement parameter information of the livestock segmentation picture, and convert each parameter in the livestock pixel measurement parameter information based on the measurement conversion coefficient to obtain actual livestock measurement parameter information;

[0156] The livestock measurement type is obtained, and the actual livestock measurement parameter information is screened or calculated based on the livestock measurement type to obtain the livestock measurement result.

[0157] Furthermore, the computer-usable storage medium may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function, etc.; the data storage area may store data created according to the use of the blockchain node, etc.

[0158] In the several embodiments provided by the present invention, it should be understood that the disclosed devices, apparatuses and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of the modules is only a logical function division, and there may be other division methods in actual implementation.

[0159] The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0160] The embodiments of the present application can acquire and process relevant data based on artificial intelligence technology. Among them, artificial intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.

[0161] In addition, each functional module in each embodiment of the present invention may be integrated into one processing unit, each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of hardware plus software functional modules.

[0162] It is obvious to those skilled in the art that the present invention is not limited to the details of the above exemplary embodiments, and that the present invention can be implemented in other specific forms without departing from the spirit or essential characteristics of the present invention.

[0163] Therefore, no matter from which point of view, the embodiments should be regarded as illustrative and non-restrictive, and the scope of the present invention is limited by the appended claims rather than the above description, so it is intended that all changes falling within the meaning and scope of the equivalent elements of the claims are included in the present invention. Any attached figure mark in the claims should not be regarded as limiting the claims involved.

[0164] The blockchain referred to in this invention is a new application mode of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, encryption algorithm, etc. Blockchain is essentially a decentralized database, a string of data blocks generated by cryptographic methods. Each data block contains a batch of network transaction information, which is used to verify the validity of its information (anti-counterfeiting) and generate the next block. Blockchain can include the underlying blockchain platform, platform product service layer, and application service layer.

[0165] In addition, it is clear that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. Multiple units or devices stated in the system claim can also be implemented by one unit or device through software or hardware. The second and other words are used to indicate names, but not to indicate any particular order.

[0166] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solution of the present invention can be modified or replaced by equivalents without departing from the spirit and scope of the technical solution of the present invention.

Claims

1. A livestock measurement method, characterized in that: The method comprises: Obtaining a photograph of the livestock to be measured marked with a preset marker and a marker characteristic value of the marker; Using a pre-built first segmentation model to perform regional segmentation of livestock and landmarks on the photographed image to obtain a comprehensive segmentation image; Obtaining an interactive operation picture of the photographed picture, and performing livestock region segmentation using a pre-constructed second segmentation model based on the comprehensive segmentation picture, the photographed picture and the interactive operation picture to obtain a livestock segmentation picture; Calculating the pixel area of ​​the image region corresponding to the marker in the comprehensive segmentation image to obtain the pixel area of ​​the marker; Calculating based on the pixel area of ​​the marker and the characteristic value of the marker to obtain a measurement conversion coefficient; Acquire livestock pixel measurement parameter information of the livestock segmentation picture, and convert each parameter in the livestock pixel measurement parameter information based on the measurement conversion coefficient to obtain actual livestock measurement parameter information; The livestock measurement type is obtained, and the actual livestock measurement parameter information is screened or calculated based on the livestock measurement type to obtain the livestock measurement result.

2. The livestock measurement method according to claim 1, characterized in that: The calculating the pixel area of ​​the image region corresponding to the marker in the comprehensive segmentation image to obtain the pixel area of ​​the marker includes: The total number of pixels in the image area corresponding to the marker in the comprehensive segmentation picture is calculated to obtain the pixel area of ​​the marker.

3. The livestock measurement method according to claim 1, characterized in that: The calculation based on the pixel area of ​​the marker and the characteristic value of the marker to obtain the measurement conversion coefficient includes: Obtaining an area formula of the graphic corresponding to the marker, and performing calculation based on the area formula and the pixel area of ​​the marker to obtain a pixel measurement characteristic value of the marker; The ratio of the marker pixel measurement characteristic value to the marker characteristic value is calculated to obtain the measurement conversion coefficient.

4. The livestock measurement method as claimed in claim 1, characterized in that: The step of obtaining livestock pixel measurement parameter information of the livestock segmentation picture includes: Binarizing the livestock segmentation picture to obtain a target segmentation picture; Calculate the difference in pixel coordinates in the vertical direction between the highest point and the lowest point of the pixel with a pixel gray value of 1 in the target segmented image to obtain a pixel measurement parameter of the livestock height; Calculate the ratio of the number of pixels with a grayscale value of 1 in each row of pixels in the target segmentation image to the total number of pixels in the row, and obtain the torso pixel ratio of each row of pixels in the target segmentation image; Filtering pixel rows in the target segmentation image based on the torso pixel ratio and a preset torso pixel threshold to obtain torso pixel rows; Determine an area consisting of pixels with a pixel gray value of 1 in all the trunk pixel rows as a trunk pixel area; Calculating the difference in pixel coordinates of the highest pixel and the lowest pixel in the trunk pixel area in the vertical direction to obtain a pixel measurement parameter of the height of the livestock trunk; Calculate the difference in pixel coordinates of the leftmost pixel and the rightmost pixel in the trunk pixel area in the horizontal direction to obtain a pixel measurement parameter of the livestock body length; Calculating the number of edge pixels in the trunk pixel area to obtain a pixel measurement parameter of the livestock trunk circumference; The livestock height pixel measurement parameters, the livestock trunk height pixel measurement parameters, the livestock body length pixel measurement parameters and the livestock trunk circumference pixel measurement parameters are summarized to obtain the livestock pixel measurement parameter information.

5. The livestock measurement method according to claim 1, characterized in that: The method of performing livestock region segmentation based on the comprehensive segmentation picture, the captured picture and the interactive operation picture using a pre-built second segmentation model to obtain a livestock segmentation picture includes: Convolving the interactive operation picture to obtain an interactive feature picture; Convolving the captured image to obtain a captured feature image; All image channels of the interactive feature image, the shooting feature image and the comprehensive segmentation image are used as inputs of the second segmentation model to perform livestock area segmentation to obtain the livestock segmentation image.

6. The livestock measurement method according to claim 1, characterized in that: The method of performing livestock region segmentation based on the comprehensive segmentation picture, the captured picture and the interactive operation picture using a pre-built second segmentation model to obtain a livestock segmentation picture includes: Convolving the captured image to obtain a captured feature image; Determining the comprehensive segmented picture as a historical segmented picture; Convolving the interactive operation picture to obtain an interactive feature picture; Using the interactive feature image, the shooting feature image and all the image channels of the comprehensive segmentation image as inputs of the second segmentation model to perform livestock region segmentation, obtain an initial livestock segmentation image, and record the number of model segmentation times; Determine whether the number of model segmentation times is greater than or equal to a preset segmentation threshold; When the number of segmentation times of the model is less than a preset segmentation threshold, the initial livestock segmentation picture is determined as a historical segmentation picture, and the step of using the interactive feature picture, the shooting feature picture and all the picture channels of the comprehensive segmentation picture as inputs of the second segmentation model is returned; When the model segmentation times is greater than or equal to a preset segmentation threshold, the initial livestock segmentation picture is determined as the livestock segmentation picture.

7. The livestock measurement method according to any one of claims 1 to 6, characterized in that: The method of screening or calculating the actual livestock measurement parameter information based on the livestock measurement type to obtain the livestock measurement result includes: When the livestock measurement type is body parameter measurement, obtaining a measurement parameter type corresponding to the livestock measurement type, extracting measurement parameters of the same type from actual livestock measurement parameters according to the measurement parameter type, and obtaining the livestock measurement result; When the livestock measurement type is weight measurement, a weight measurement calculation is performed based on the measurement parameters in the actual measurement parameter information of the livestock and a preset weight calculation formula to obtain the measured weight of the livestock to be measured, and the measured weight of the livestock to be measured is determined as the livestock measurement result.

8. A livestock measuring device, characterized in that: include: A data acquisition module, used to acquire a photograph of the livestock to be measured marked with a preset marker and a marker characteristic value of the marker; An image segmentation module is used to perform livestock and landmark area segmentation on the photographed picture using a pre-constructed first segmentation model to obtain a comprehensive segmentation picture; obtain an interactive operation picture of the photographed picture, and perform livestock area segmentation using a pre-constructed second segmentation model based on the comprehensive segmentation picture, the photographed picture and the interactive operation picture to obtain a livestock segmentation picture; A livestock measurement module, used to calculate the pixel area of ​​the image region corresponding to the marker in the comprehensive segmentation image to obtain the pixel area of ​​the marker; Calculate based on the pixel area of ​​the marker and the characteristic value of the marker to obtain a measurement conversion coefficient; obtain the livestock pixel measurement parameter information of the livestock segmentation picture, and convert each parameter in the livestock pixel measurement parameter information based on the measurement conversion coefficient to obtain the livestock actual measurement parameter information; The livestock measurement type is obtained, and the actual livestock measurement parameter information is screened or calculated based on the livestock measurement type to obtain the livestock measurement result.

9. An electronic device, characterized in that: The electronic device comprises: at least one processor; and, a memory communicatively coupled to the at least one processor; The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can perform the livestock measurement method according to any one of claims 1 to 7.

10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the livestock measurement method according to any one of claims 1 to 7 is implemented.