An intelligent water supply method and system for livestock
Through the improved YOLOV3 algorithm and reinforced learning technology, intelligent detection and automatic water supply for drinking water demand in pastoral livestock are realized, manpower consumption and water resource waste in traditional water supply solutions are solved, and the efficiency and adaptability of intelligent water supply are achieved.
Patent Information
- Application Number
- CN202111345533.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-15
- Publication Date
- 2025-02-11
- Estimated Expiration
- 2041-11-15
AI Technical Summary
Traditional artificial water supply schemes consume a lot of manpower and material resources in pastoral areas and lead to waste of water resources, which cannot meet the needs of modern pastoral herdsmen for intelligent water supply.
The improved YOLOV3 algorithm is used in combination with reinforcement learning, and through image preprocessing, livestock status detection and intelligent water supply action strategy planning, intelligent detection and automatic water supply for livestock drinking water needs are achieved.
It has realized the intelligent supply of livestock drinking water, reduced manpower consumption, improved water resource utilization efficiency, and adapted to the intelligent development needs of modern pastoral areas.
Smart Images

Figure CN113989061B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of livestock industry, and in particular to an intelligent water supply method and system for livestock. Background Art
[0002] The Inner Mongolia Autonomous Region has vast grasslands. The Inner Mongolia pastoral area is one of the largest pastoral areas in the country. Various large and small pastoral areas are scattered across the Inner Mongolia grasslands. However, drinking water for livestock in pastoral areas has always been a worrying problem. The traditional artificial water supply scheme consumes a lot of manpower and material resources, and also brings waste of water resources in pastoral areas. At present, artificial intelligence technology has been prevalent in all walks of life. The traditional artificial water supply scheme or semi-automatic water supply scheme in pastoral areas can no longer meet the needs of herders in pastoral areas. The "Three-Year Action Plan for Modernization of Pastoral Areas" proposes to adhere to ecological priority, green development, and actively transform the development mode of grassland animal husbandry. Therefore, with the continuous development of artificial intelligence technology, herders in pastoral areas are in urgent need of an intelligent water supply system. How to realize the intelligent supply of drinking water for livestock in pastoral areas is a major challenge in the current transformation of the development mode of animal husbandry in pastoral areas, which is of great significance to the development of intelligent pastoral areas.
[0003] In view of this, the present invention is proposed. Summary of the invention
[0004] In view of this, the present invention discloses an intelligent water supply method for livestock, and an intelligent system for implementing the above-mentioned intelligent water supply method. The method is applied to the fields of livestock breeding and grazing water supply in pastoral areas. The whole method is simple to operate and can realize the intelligent supply of drinking water for livestock.
[0005] Specifically, the present invention is achieved through the following technical solutions:
[0006] In a first aspect, the present invention discloses an intelligent water supply method for livestock, the method comprising the following steps:
[0007] Collect pictures of livestock for denoising, and use the improved YOLOV3 algorithm to obtain the state variables of livestock;
[0008] Obtaining the environmental reward value according to the state variables of the livestock and calculating the value function at the next moment;
[0009] The value function at the next moment is used to calculate the action probability at the next moment, and the action strategy at the next moment is formulated according to the action probability, so as to decide whether to supply water.
[0010] In a second aspect, the present invention discloses an intelligent water supply system, comprising:
[0011] State variable calculation module: used to collect livestock pictures for denoising, and obtain livestock state variables after processing using the improved YOLOV3 algorithm;
[0012] Value function calculation module: used to obtain the environmental reward value according to the state variables of the livestock and calculate the value function at the next moment;
[0013] Water supply action calculation module: used to use the value function at the next moment to calculate the action probability at the next moment, and formulate the action strategy at the next moment according to the action probability, so as to decide whether to supply water.
[0014] In a third aspect, the present invention discloses a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the intelligent water supply method for livestock as described in the first aspect.
[0015] In a fourth aspect, the present invention discloses a computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the steps of the intelligent water supply method for livestock as described in the first aspect are implemented.
[0016] The solution of the present invention mainly adopts three parts: image preprocessing, livestock status detection and intelligent water supply action strategy planning algorithm. Based on the enhanced deep livestock detection algorithm, it can autonomously learn the livestock's drinking intention, thereby better simulating artificial livestock water supply and realizing intelligent livestock drinking water supply. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Various other advantages and benefits will become apparent to those of ordinary skill in the art by reading the detailed description of the preferred embodiments below. The accompanying drawings are only for the purpose of illustrating the preferred embodiments and are not to be considered as limiting the present invention. Moreover, the same reference symbols are used throughout the accompanying drawings to represent the same components. In the accompanying drawings:
[0018] Figure 1 An original picture of livestock provided by an embodiment of the present invention;
[0019] Figure 2 A grayscale picture of livestock provided by an embodiment of the present invention;
[0020] Figure 3 A filtered picture of livestock provided by an embodiment of the present invention;
[0021] Figure 4 A restored color picture of livestock provided by an embodiment of the present invention;
[0022] Figure 5 A framework diagram of the improved YOLOV3 algorithm provided in an embodiment of the present invention;
[0023] Figure 6 Recognition images of livestock and water troughs provided by embodiments of the present invention;
[0024] Figure 7 A geometric relationship diagram between a camera coordinate system, an image coordinate system, and a world coordinate system provided by an embodiment of the present invention;
[0025] Figure 8 A pixel geometric relationship diagram provided by an embodiment of the present invention;
[0026] Fig. 9 A state variable labeling diagram for each cow provided by an embodiment of the present invention;
[0027] Fig.10 A flow chart of intelligent supply of drinking water for cattle in pastoral areas provided by an embodiment of the present invention;
[0028] Fig.11 A schematic diagram of a flow chart of an intelligent water supply method provided by an embodiment of the present invention;
[0029] Fig.12 A schematic diagram of the structure of an intelligent water supply system provided by an embodiment of the present invention;
[0030] Fig.13 A schematic diagram of the structure of a computer device provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0031] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.
[0032] The terms used in this disclosure are for the purpose of describing specific embodiments only and are not intended to limit the disclosure. The singular forms of "a", "said" and "the" used in this disclosure and the appended claims are also intended to include plural forms unless the context clearly indicates otherwise. It should also be understood that the term "and / or" used herein refers to and includes any or all possible combinations of one or more associated listed items.
[0033] It should be understood that although the terms first, second, third, etc. may be used in the present disclosure to describe various information, such information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of the present disclosure, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".
[0034] The present invention discloses an intelligent water supply method for livestock, the method comprising:
[0035] Collect pictures of livestock for denoising, and use the improved YOLOV3 algorithm to obtain the state variables of livestock;
[0036] Obtaining the environmental reward value according to the state variables of the livestock and calculating the value function at the next moment;
[0037] The value function at the next moment is used to calculate the action probability at the next moment, and the action strategy at the next moment is formulated according to the action probability, so as to decide whether to supply water.
[0038] Fig.11 This is a flow chart of an intelligent water supply method for livestock disclosed in an embodiment of the present invention, referring to Fig.11 As shown, the following steps are included:
[0039] Step 1: Grayscale the input original image, the original image size is 840*400. Figure 1 As shown, the grayscale image is shown in 2:
[0040] Step 2: Perform adaptive median filtering on the grayscale image.
[0041] Since the collected images may be blurred due to the influence of the pastoral environment, filtering is needed to process them. However, general linear filtering has low-pass properties, which blurs the edges while removing noise. In some cases, median filtering can remove noise and protect the edges of the image. It is a nonlinear method for removing noise, so median filtering is used for denoising. The effect after filtering is as follows: Figure 3 As shown, finally the grayscale image is restored to a color image, as Figure 4 shown.
[0042] Step 3: Process the preprocessed image with the improved YOLOV3 algorithm. The improved YOLOV3 algorithm framework is as follows: Figure 5 As shown, firstly, the recognition images of livestock and water troughs are obtained. Figure 6As shown, the coordinate transformation module in the improved YOLOV3 algorithm framework is used to obtain the distance d of each target, and finally the state s of each target is calculated.
[0043] The distance d is calculated based on the pinhole imaging principle and the geometric relationship between the camera coordinate system, the image coordinate system and the world coordinate system as follows: Figure 7 As shown, the distance and angle between the livestock and the water trough can be calculated as follows:
[0044] First, calibrate the camera and find the camera internal parameter K, such as Figure 7 As shown in the figure, assuming that point p1 is the location of the livestock center and point p2 is the location of the water supply pool center, then we can know that the pixel point From the camera coordinate transformation relationship, we can get:
[0045]
[0046] Among them, K is the camera internal parameter (known), [R, t] is the camera external parameter (known), Z1 and Z2 are the depths of the two locations where livestock and water supply pools are located respectively.
[0047] Because the camera's internal and external parameters are known, p1 and p2 are known, so Figure 7 Combined with the geometric relationship of formula (1), we can calculate Z1 and Z2 of points P1 and P2; then by Figure 8 The pixel geometric relationship can be used to calculate the angle θ. Combining the results of these two calculations, the distances d1 and d2 of points P1 and P2 relative to the camera can be calculated. Then, using the law of cosines, the distance between the livestock and the reservoir can be obtained as:
[0048]
[0049] Therefore, the state variable s of the livestock can be obtained.
[0050] Step 4: Take the scene of livestock drinking water as the environmental variable E, the intelligent water supply system as the intelligent agent I, the position relationship between livestock such as cattle and sheep and the water trough as the state variable S, and whether the intelligent water supply system supplies water as the action variable A. Suppose that when the state variable s<0.5, the environmental reward value 1 can be obtained, otherwise the reward value is 0.
[0051] The intelligent water supply action strategy planning process is as follows:
[0052] 1) Assume that the initial state of water supply is S0;
[0053] 2) Select an initial action a0;
[0054] 3) Transfer according to probability Transfer to the next state S1, where the transition probability represents the probability of reaching the next state under the condition of the current state s and executing the current action a;
[0055] 4) In the next state, the value of the action is calculated based on the reward relationship and value function in Represents the reward value for executing action a in the current state, set γ represents the discount factor, set to γ = 0.65; v(s t+1 ) represents the value of the next state;
[0056] 5) Decide on the specific action A based on the value generated by different actions at the next moment, and repeat the above steps to cyclically determine the action a at each moment.
[0057] Step 5: Finally, the drinking water demand of livestock can be judged by the decision-making status of cattle, sheep and other livestock, so as to control the water level of the water supply pool and realize intelligent detection and intelligent water supply of livestock drinking water status. t+1 )>v(s t ) when the water is added, otherwise do not add water.
[0058] Specific actual cases:
[0059] Taking a ranch as the actual sampling site, take photos of the actual livestock and site conditions, input images, grayscale the images, perform adaptive median filtering, image restoration, target recognition detection, livestock status detection, water demand judgment and water supply action decision. After inputting the video image from the camera, Figure 1 Shown is the initial image:
[0060] First, the initial image is preprocessed and grayscaled to obtain a grayscale image, such as Figure 2 As shown:
[0061] Then, the grayscale image containing noise is processed by adaptive median filtering, and finally the grayscale image is restored to a color image, as shown in Figure 3 , 4 As shown:
[0062] Then use the improved YOLOV3 algorithm to detect the cattle and water troughs in the environment. Figure 6 As shown:
[0063] The coordinate transformation module in the algorithm is used to detect the distance d1, d2, d3 of each head and the distance d4 of the water supply pool and livestock status detection, and then the cosine theorem is used to calculate the status values s1, s2, s3 according to the distance. The status of each cow in the figure is: 0, 0.2, 0.9, as shown in the figure. Fig. 9 As shown:
[0064] Finally, using the intelligent water supply action strategy planning scheme, we first determine the initial state as s = 0, the initial action a = 0 (a = 0 means no water release, a = 1 means water release), and calculate the probability transfer according to the measured state of the cow. Set the reward value to The discount factor is γ = 0.65, and the action value of the next moment is calculated. According to the value, the drinking water demand of the cattle is judged, and the corresponding action a is executed. This step is repeated to judge the action a at each moment, and finally the intelligent supply of drinking water for cattle in pastoral areas is realized. The whole process is as follows: Fig.10 shown.
[0065] Fig.12 The figure is a schematic diagram of the structure of the intelligent water supply system for livestock disclosed in the present invention, and the system comprises:
[0066] State variable calculation module 101: used to collect livestock pictures for denoising, and obtain livestock state variables after processing using an improved YOLOV3 algorithm;
[0067] The value function calculation module 102 is used to obtain the environmental reward value according to the state variables of the livestock and calculate the value function at the next moment;
[0068] The water supply action calculation module 103 is used to calculate the action probability at the next moment by using the value function at the next moment, and formulate the action strategy at the next moment according to the action probability, so as to decide whether to supply water.
[0069] The water supply system is mainly composed of the above three modules. Through the cooperation between the three modules, the problem of livestock drinking water intelligently is solved.
[0070] In specific implementation, the above modules can be implemented as independent entities, or can be arbitrarily combined and implemented as the same or several entities. The specific implementation of the above units can refer to the previous method embodiments, which will not be repeated here.
[0071] Fig.13 It is a structural schematic diagram of a computer device disclosed in the present invention. Fig.13 As shown, the computer device includes: an input device 63, an output device 64, a memory 62 and a processor 61; the memory 62 is used to store one or more programs; when the one or more programs are executed by the one or more processors 61, the one or more processors 61 implement an intelligent water supply method for livestock provided in the above embodiment; wherein the input device 63, the output device 64, the memory 62 and the processor 61 can be connected via a bus or other means, Fig.13 The example of connecting through bus is taken in the following.
[0072] The memory 62 is a readable and writable storage medium of a computing device, which can be used to store software programs and computer executable programs, such as program instructions corresponding to a smart water supply method for livestock described in an embodiment of the present application; the memory 62 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system and at least one application required for a function; the data storage area may store data created according to the use of the device, etc.; in addition, the memory 62 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device; in some instances, the memory 62 may further include a memory remotely arranged relative to the processor 61, and these remote memories may be connected to the device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0073] The input device 63 may be used to receive input digital or character information, and to generate key signal input related to user settings and function control of the device; the output device 64 may include a display device such as a display screen.
[0074] The processor 61 executes various functional applications and data processing of the device by running software programs, instructions and modules stored in the memory 62.
[0075] The computer device provided above can be used to execute an intelligent water supply method for livestock provided in the above embodiment, and has corresponding functions and beneficial effects.
[0076] The present application embodiment also provides a storage medium containing computer executable instructions, which are used to execute a smart water supply method for livestock as provided in the above embodiment when executed by a computer processor, and the storage medium is any of various types of memory devices or storage devices, and the storage medium includes: installation media, such as CD-ROM, floppy disk or tape device; computer system memory or random access memory, such as DRAM, DDR RAM, SRAM, EDO RAM, Rambus RAM, etc.; non-volatile memory, such as flash memory, magnetic media (such as hard disk or optical storage); registers or other similar types of memory elements, etc.; the storage medium may also include other types of memory or a combination thereof; in addition, the storage medium may be located in a first computer system in which the program is executed, or may be located in a different second computer system, the second computer system is connected to the first computer system via a network (such as the Internet); the second computer system may provide program instructions to the first computer for execution. The storage medium includes two or more storage media that can reside in different locations (for example, in different computer systems connected via a network). The storage medium can store program instructions (for example, specifically implemented as a computer program) that can be executed by one or more processors.
[0077] Of course, the storage medium containing computer executable instructions provided in the embodiments of the present application, whose computer executable instructions are not limited to the intelligent water supply method applied to livestock as described in the above embodiments, can also execute related operations in the intelligent water supply method applied to livestock provided in any embodiment of the present application.
[0078] Finally, it should be noted that although this specification contains many specific implementation details, these should not be interpreted as limiting the scope of any invention or the scope of protection claimed, but are mainly used to describe the features of specific embodiments of specific inventions. Certain features described in multiple embodiments within this specification may also be implemented in combination in a single embodiment. On the other hand, the various features described in a single embodiment may also be implemented separately in multiple embodiments or in any suitable sub-combination. In addition, although features may work in certain combinations as described above and even initially claimed as such, one or more features from the claimed combination may be removed from the combination in some cases, and the claimed combination may point to a sub-combination or a variation of a sub-combination.
[0079] Similarly, although operations are depicted in a particular order in the accompanying drawings, this should not be understood as requiring that these operations be performed in the particular order shown or performed sequentially, or requiring that all illustrated operations be performed to achieve the desired results. In some cases, multitasking and parallel processing may be advantageous. In addition, the separation of various system modules and components in the above-described embodiments should not be understood as requiring such separation in all embodiments, and it should be understood that the described program components and systems can generally be integrated together in a single software product, or packaged into multiple software products.
[0080] Thus, specific embodiments of the subject matter have been described. Other embodiments are within the scope of the appended claims. In some cases, the actions recited in the claims can be performed in a different order and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the particular order or sequential order shown to achieve the desired results. In some implementations, multitasking and parallel processing may be advantageous.
[0081] The above description is only a preferred embodiment of the present disclosure and is not intended to limit the present disclosure. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present disclosure shall be included in the scope of protection of the present disclosure.
Claims
1. An intelligent water supply method for livestock, characterized in that: The steps include: Collect pictures of livestock for denoising, and use the improved YOLOV3 algorithm to obtain the state variables of livestock; Obtaining the environmental reward value according to the state variables of the livestock and calculating the value function at the next moment; Using the value function at the next moment, calculating the action probability at the next moment, formulating the action strategy at the next moment according to the action probability, thereby deciding whether to supply water; The process of processing by the improved YOLOV3 algorithm includes: Identify all livestock and water troughs in the picture, calculate the distance and angle between the livestock and the water trough and the camera, and then use the cosine theorem to calculate the distance between the livestock and the water trough, so as to obtain the state variable of the livestock; The method for calculating the state variable includes: First, calibrate the camera. Assuming that point p1 is the location of the livestock center and point p2 is the location of the water supply pool center, we can know the pixel point From the camera coordinate transformation relationship, we can get: K is the camera internal parameter, [R, t] is the camera external parameter, Z1 and Z2 are the depths of the two locations where the livestock and the water supply pool are located, and P1 and P2 are the spatial point coordinates; Based on p1 and p2, we can calculate the Z1 and Z2 of points P1 and P2; let the camera coordinate point be the origin of the O coordinate, and then calculate the angle θ of OP1 and OP2 based on the pixel geometry relationship; Calculate the distances d1=|OP1| and d2=|OP2| between points P1 and P2 and the camera coordinate point, and then use the cosine theorem to get the state variable s=|P1P2|: The method for finally determining whether to supply water based on the state variables of the livestock includes: First, assume that the scene of livestock drinking water is the environmental variable E, the water supply agent I, the position relationship between livestock and water supply trough is the state variable S, and whether the intelligent water supply system supplies water is the action variable A. Assume that the initial state of water supply is S0 and select an initial action a0; Then, by calculating the probability of transfer Transfer to the next state S1, where the transition probability Represents the probability of reaching the next state under the condition of the current state s and executing the current action a; At the next state, the value of the action is calculated based on the reward relationship and value function. in Represents the reward value for executing action a in the current state, set γ represents the discount factor, set to γ = 0.65; v(s t+1 ) represents the value of the next state; Finally, the action variable A of whether to supply water is determined based on the amount generated by different actions in the next state; The method of action variable A for deciding whether to supply water includes: when v(s t+1 )>v(s t ) when the water is added, otherwise do not add water.
2. The intelligent water supply method according to claim 1, characterized in that: The denoising method includes: graying the pictures of the livestock, and then adjusting the grayscale pictures to color pictures after processing by an adaptive median filtering method.
3. An intelligent water supply system for livestock, using the intelligent water supply method for livestock according to claim 1, characterized in that: include: State variable calculation module: used to collect livestock pictures for denoising, and obtain livestock state variables after processing using the improved YOLOV3 algorithm; Value function calculation module: used to obtain the environmental reward value according to the state variables of the livestock and calculate the value function at the next moment; Water supply action calculation module: used to use the value function at the next moment to calculate the action probability at the next moment, and formulate the action strategy at the next moment according to the action probability, so as to decide whether to supply water.
4. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the steps of the intelligent water supply method for livestock described in any one of claims 1-2 are implemented.
5. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the steps of the intelligent water supply method for livestock as described in any one of claims 1-2 are implemented.
Citation Information
Patent Citations
Sensor communication system and method for conducting monitoring through same
CN103475736A
Pig water drinking behavior identification method based on contours
CN107437069A