Livestock health status detection method, device, storage medium and electronic device

By integrating livestock's own status data and environmental status data for feature encoding, the problem of low accuracy in the detection of livestock health status in the prior art is solved, and higher detection accuracy is achieved.

CN114883011BActive Publication Date: 2025-03-04SHENZHEN ZHONGRONG DIGITAL TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210450721.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-04-26
Publication Date
2025-03-04
Estimated Expiration
2042-04-26

AI Technical Summary

Technical Problem

In the prior art, the accuracy of detection of livestock health status is low and there are food safety risks.

Method used

By obtaining the timing itself state data of the livestock to be detected and the timing environment state data of the environment in which it is located, and then feature encoding is performed to determine the health status of the livestock.

Benefits of technology

The accuracy of detection of livestock health status is improved, and it is more accurate than detection schemes based on their own status data only.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114883011B_ABST
    Figure CN114883011B_ABST
Patent Text Reader

Abstract

The present application discloses a method, device, storage medium and electronic device for detecting the health status of livestock. The method comprises: obtaining the time series self-state data of the livestock to be detected and the time series environmental state data of the environment in which the livestock to be detected is located; fusing the time series self-state data and the time series environmental state data to obtain fused data; performing feature encoding on the fused data to obtain the current encoding feature; and determining the health status of the livestock to be detected according to the current encoding feature. The present application can improve the accuracy of detecting the health status of livestock.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of animal husbandry, and in particular to a method, device, storage medium and electronic device for detecting the health status of livestock. Background Art

[0002] In my country, animal husbandry has become an industry with high economic benefits, and its own high efficiency makes it an indispensable part of modern agriculture. As the proportion of meat consumption increases year by year, animal husbandry has also changed from individual households to large-scale, intensive and intelligent farming. Large-scale farms have a large number of livestock, which is prone to large-scale bacterial infection and disease transmission, and there are high food safety risks. Therefore, in the process of raising livestock, in order to ensure the health of livestock, it is necessary to detect the health status of livestock. However, in the related technology, the accuracy of detecting the health status of livestock is low. Summary of the invention

[0003] The embodiments of the present application provide a method, device, storage medium and electronic device for detecting the health status of livestock, which can improve the accuracy of detecting the health status of livestock.

[0004] In a first aspect, an embodiment of the present application provides a method for detecting the health status of livestock, comprising:

[0005] Acquiring time-series self-state data of the livestock to be detected and time-series environmental state data of the environment in which the livestock to be detected is located;

[0006] Fusing the time series self-state data and the time series environment state data to obtain fused data;

[0007] Performing feature encoding on the fused data to obtain current encoding features;

[0008] The health status of the livestock to be detected is determined according to the current coding feature.

[0009] In a second aspect, an embodiment of the present application provides a livestock health status detection device, comprising:

[0010] A data acquisition module, used to acquire the time-series self-state data of the livestock to be detected, and the time-series environmental state data of the environment in which the livestock to be detected is located;

[0011] A data fusion module, used for fusing the time series self-state data and the time series environment state data to obtain fused data;

[0012] A feature encoding module, used for performing feature encoding on the fused data to obtain current encoding features;

[0013] The status determination module is used to determine the health status of the livestock to be detected according to the current coding feature.

[0014] In a third aspect, an embodiment of the present application provides a storage medium having a computer program stored thereon. When the computer program is executed on a computer, the computer executes the livestock health status detection method provided in the embodiment of the present application.

[0015] In a fourth aspect, an embodiment of the present application further provides an electronic device, comprising a memory and a processor, wherein the processor is used to execute the livestock health status detection method provided in the embodiment of the present application by calling a computer program stored in the memory.

[0016] In the embodiment of the present application, the fused data obtained by fusing the time-series self-state data of the livestock to be detected and the time-series environmental state data of the environment in which it is located is feature-encoded to obtain the current encoding feature, and then the health status of the livestock to be detected is determined based on the current encoding feature. As described above, the health status of the livestock to be detected can be determined by combining the time-series self-state data of the livestock to be detected and the time-series environmental state data of the environment in which it is located, which is more accurate than the solution of determining the health status of the livestock to be detected based only on the self-state data of the livestock to be detected. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] The technical solution and beneficial effects of the present application will be made apparent by describing in detail the specific implementation modes of the present application in conjunction with the accompanying drawings.

[0018] Figure 1 It is a flow chart of the livestock health status detection method provided in the embodiment of the present application.

[0019] Figure 2 yes Figure 1 Schematic diagram of the process before 101.

[0020] Figure 3 yes Figure 2 Detailed flow chart of 106.

[0021] Figure 4 This is a schematic diagram of the first scenario of the livestock health status detection method provided in an embodiment of the present application.

[0022] Figure 5 This is a schematic diagram of the second scenario of the livestock health status detection method provided in an embodiment of the present application.

[0023] Figure 6 This is a detailed flow chart of 10621.

[0024] Figure 7 This is a schematic diagram of the third scenario of the livestock health status detection method provided in the embodiment of the present application.

[0025] Figure 8 This is a schematic diagram of the fourth scenario of the livestock health status detection method provided in an embodiment of the present application.

[0026] Fig. 9 This is a schematic diagram of the fifth scenario of the livestock health status detection method provided in the embodiment of the present application.

[0027] Fig.10 This is a detailed flow chart of 1031.

[0028] Fig.11 This is a sixth scenario schematic diagram of the livestock health status detection method provided in an embodiment of the present application.

[0029] Fig.12 yes Fig.10 Detailed process diagram of 10311.

[0030] Fig.13 This is a schematic diagram of the seventh scenario of the livestock health status detection method provided in the embodiment of the present application.

[0031] Fig.14 It is a schematic diagram of the training process provided in the embodiment of the present application.

[0032] Fig.15 It is a schematic diagram of the prediction process provided in the embodiment of the present application.

[0033] Fig.16 It is a structural schematic diagram of a livestock health status detection device provided in an embodiment of the present application.

[0034] Fig.17 It is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0035] It should be noted that the principles of the present application are illustrated by implementing them in an appropriate computing environment. The following description is based on the illustrated specific embodiments of the present application and should not be considered as limiting other specific embodiments of the present application that are not described in detail herein.

[0036] Relational terms such as first and second involved in the following embodiments of the present application are only used to distinguish one object or operation from another object or operation, and are not used to limit the actual sequential relationship between these objects or operations.

[0037] 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. In other words, artificial intelligence is a comprehensive technology in computer science that attempts to understand the essence of intelligence and produce a new intelligent machine that can respond in a similar way to human intelligence. Artificial intelligence is to study the design principles and implementation methods of various intelligent machines so that machines have the functions of perception, reasoning and decision-making.

[0038] Artificial intelligence technology is a comprehensive discipline that covers a wide range of fields, including both hardware-level and software-level technologies. The basic technologies of artificial intelligence generally include sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technology, operation / interaction systems, mechatronics, etc. Artificial intelligence software technology mainly includes machine learning (ML) technology.

[0039] The embodiments of the present application provide a method for detecting the health status of livestock, a device for detecting the health status of livestock, a storage medium, and an electronic device, wherein the execution subject of the method for detecting the health status of livestock may be the device for detecting the health status of livestock provided in the embodiments of the present application, or the electronic device provided in the embodiments of the present application, wherein the device for detecting the health status of livestock may be implemented in hardware or software. The electronic device may be any device that is configured with a processor and has processing capabilities, such as a mobile electronic device with a processor such as a smart phone, a tablet computer, a PDA, a laptop computer, or a fixed electronic device with a processor such as a desktop computer, a television, a server, etc.

[0040] See also Figure 1 , Figure 1 : is a schematic diagram of a method for detecting the health status of livestock provided in an embodiment of the present application, and the process may include:

[0041] 101. Obtaining time-series self-state data of the livestock to be detected and time-series environmental state data of the environment in which the livestock to be detected is located.

[0042] It should be noted that the livestock to be tested may be livestock that needs to be tested for health status. The health status may include a first health status and a second health status. When the health status of the livestock to be tested is the first health status, it means that the livestock to be tested is a healthy livestock, that is, a livestock that is not sick; when the health status of the livestock to be tested is the second health status, it means that the livestock to be tested is an unhealthy livestock, that is, a sick livestock.

[0043] In this embodiment, the time-series self-state data of the livestock to be detected can be obtained by the ear tag worn by the livestock to be detected. The ear tag worn by the livestock to be detected is an undamaged ear tag. The time-series environmental state data of the environment in which the livestock to be detected is located can be obtained by a base station set in the environment in which the livestock to be detected is located. The base station can also obtain the time-series self-state data obtained by the ear tag of the livestock to be detected, and then send the time-series self-state data and the environmental time-series state data to the electronic device that performs health status detection of the livestock to be detected, so as to perform health status detection of the livestock to be detected.

[0044] It is understandable that when the ear tag data of the livestock to be detected is read by multiple base stations at the same time within one minute, minute-level aggregation is adopted based on the ear tag and the current time. Since the base station is offline, there is a situation where the ear tag has missing minute-level data, so it is necessary to fill in the missing minute timestamps within the preset time range, such as the past 24 hours.

[0045] The time series self-state data of the livestock to be detected may include the time series self-state data of the livestock to be detected within a preset time range, such as the time series self-state data within the past 24 hours, or the time series self-state data within the past 12 hours, etc. The time series self-state data may include the time series temperature data and time series movement data of the livestock to be detected. The preset time range may be determined according to actual needs and is not specifically limited here.

[0046] For example, the ear tag worn by the livestock to be detected may have a built-in temperature sensor and a motion sensor, such as a three-axis motion sensor, so that the time-series temperature data of the livestock to be detected can be obtained through the temperature sensor, and the time-series motion data of the livestock to be detected can be obtained through the motion sensor.

[0047] Specifically, the temperature sensor can be used to obtain the time-series temperature data of the livestock to be detected at preset time intervals, and the motion sensor can be used to obtain the time-series motion data of the livestock to be detected at preset time intervals, thereby obtaining the time-series self-state data sequence within the past 24 hours. The preset time interval can be set according to actual needs and is not specifically limited here. For example, the preset time interval can be 30 seconds, 1 minute, and so on.

[0048] For example, assuming that the preset time range is within the past 24 hours and the preset time length is 1 minute, 1440 time series self-state data can be obtained.

[0049] The time series environmental status data of the environment in which the livestock to be detected is located may include the time series environmental status data of the livestock to be detected within a preset time range, such as the time series environmental status data within the past 24 hours, or the time series self-status data within the past 12 hours, etc. The time series environmental status data may include the time series temperature data and the time series humidity data of the environment in which the livestock to be detected is located.

[0050] For example, a base station set up in the environment where the livestock to be detected is located can be equipped with a temperature sensor and a humidity sensor, so that the time series temperature data of the environment where the livestock to be detected is located can be obtained through the temperature sensor, and the time series humidity data of the environment where the livestock to be detected is located can be obtained through the humidity sensor.

[0051] Specifically, the temperature sensor can be used to obtain the time series temperature data of the environment in which the livestock to be detected is located at preset time intervals, and the humidity sensor can be used to obtain the time series humidity data of the environment in which the livestock to be detected is located at preset time intervals, thereby obtaining the time series environmental state data sequence within the past 24 hours. The preset time interval can be set according to actual needs and is not specifically limited here. For example, the preset time interval can be 30 seconds, 1 minute, and so on.

[0052] For example, assuming that the preset time range is within the past 24 hours and the preset duration is 1 minute, 1440 time series environment status data can be obtained.

[0053] In some embodiments, when the time series temperature data acquired by the ear tag, the time series temperature data acquired by the base station, and the time series humidity data are missing, the missing values ​​can be filled in by linear interpolation. When the motion data acquired by the ear tag is missing, it is considered to be directly filled with 0 due to the discontinuous special effects of the motion sensor and the special effects of uncertainty whether there is motion. The time series temperature data, time series motion data acquired by the ear tag, the time series temperature data, and time series humidity data acquired by the base station are all standardized using standard deviation.

[0054] 102. Fuse the time series self-state data and the time series environment state data to obtain fused data.

[0055] In this embodiment, after obtaining the time-series self-state data of the livestock to be detected and the time-series environmental state data of the environment in which the livestock to be detected is located, the time-series self-state data of the livestock to be detected and the time-series environmental state data of the environment in which the livestock to be detected is located can be fused to obtain fused data.

[0056] For example, assuming that the time series self-state data of the livestock to be detected includes the temperature data of the livestock to be detected and the three-dimensional motion data of the livestock to be detected, and the time series environmental state data of the livestock to be detected includes the temperature data and humidity data of the environment in which the livestock to be detected is located, the above data can be combined to obtain 6-dimensional fusion data.

[0057] For example, assuming that 1440 time series state data and 1440 time series environment data are obtained, 1440 fusion data can be obtained.

[0058] 103. Perform feature encoding on the fused data to obtain current encoding features.

[0059] In this embodiment, after the fused data is obtained, feature encoding may be performed on the fused data to obtain current encoding features.

[0060] For example, assuming that 1440 fused data are obtained, feature encoding can be performed on the 1440 fused data to obtain current encoding features.

[0061] 104. Determine the health status of the livestock to be tested based on the current coding characteristics.

[0062] In this embodiment, after the current coding feature is obtained, the health status of the livestock to be detected can be determined according to the current coding feature. For example, when the health status of the livestock to be detected is determined to be the first health status according to the current coding feature, it can be determined that the livestock to be detected is a healthy livestock, that is, a livestock that is not sick. Therefore, the livestock to be detected can continue to be detected without the need to treat the livestock to be detected. When the health status of the livestock to be detected is determined to be the second health status according to the current coding feature, it can be determined that the livestock to be detected is an unhealthy livestock, that is, a sick livestock. Therefore, the livestock to be detected can be treated so that the livestock to be detected can recover. After it is determined that the livestock to be detected has recovered, the health status of the livestock to be detected can also be detected by the livestock health status detection method provided in this embodiment to determine whether the health status of the livestock to be detected is the first health status, thereby determining whether the livestock to be detected has indeed recovered.

[0063] In the embodiment of the present application, the fused data obtained by fusing the time-series self-state data of the livestock to be detected and the time-series environmental state data of the environment in which it is located is feature-encoded to obtain the current encoding feature, and then the health status of the livestock to be detected is determined based on the current encoding feature. As described above, the health status of the livestock to be detected can be determined by combining the time-series self-state data of the livestock to be detected and the time-series environmental state data of the environment in which it is located, which is more accurate than the solution of determining the health status of the livestock to be detected based only on the self-state data of the livestock to be detected.

[0064] In some embodiments, determining the health status of the livestock to be detected based on the current coding features may include:

[0065] The health status of the livestock to be detected is determined based on the similarity between the current coding feature and the preset coding feature.

[0066] Among them, the preset coding features are obtained after attention enhancement based on the sample coding features.

[0067] For example, the preset coding feature may include a coding feature of a first health state. The Euclidean distance between the current coding feature and the preset coding feature may be calculated as the similarity between the current coding feature and the preset coding feature, and the probability that the health state of the livestock to be detected is the first health state is obtained. When the probability is greater than the preset probability, the health state of the livestock to be detected is determined to be the first health state; when the probability is less than or equal to the preset probability, the health state of the livestock to be detected is determined to be the second health state. Among them, the preset probability can be set according to actual needs, and no specific limitation is made here. For example, the preset probability can be 0.5.

[0068] For another example, the preset coding feature may include a coding feature of a first health state and a coding feature of a second health state. The Euclidean distance between the current coding feature and the coding feature of the first health state may be calculated as the similarity between the current coding feature and the coding feature of the first health state, and the probability that the health state of the livestock to be detected is the first health state may be obtained. The Euclidean distance between the current coding feature and the coding feature of the second health state may be calculated as the similarity between the current coding feature and the coding feature of the second health state, and the probability that the health state of the livestock to be detected is the second health state may be obtained. Among them, the sum of the probability of the first health state and the probability of the second health state is 1. According to the probability of the first health state and the probability of the second health state, the health state of the livestock to be detected may be determined. Specifically, when the probability of the first health state is greater than the probability of the second health state, the health state of the livestock to be detected may be determined to be the first health state; when the probability of the first health state is less than or equal to the probability of the second health state, the health state of the livestock to be detected may be determined to be the second health state. For example, assuming that the probability of the first health state is 0.8 and the probability of the second health state is 0.2, it can be determined that the health state of the livestock to be detected is the first health state.

[0069] The probability that the health state of the livestock to be detected is the kth health state (including the first health state and the second health state) can be calculated by the following formula.

[0070]

[0071] Where D(z,z′)=||zz′|| 2 .P Θ (y=k|x) represents the probability that the health state of the livestock to be detected is the kth health state (including the first health state and the second health state). Θ (x) represents the current coding feature of the livestock to be detected, c k The encoded features representing the kth health state (including the first health state and the second health state).

[0072] In some embodiments, Figure 2As shown, before obtaining the time series self-state data of the livestock to be detected, the following steps may also be included:

[0073] 105. Obtain a sample coding feature set corresponding to different health states, where the sample coding feature set includes at least one sample coding feature;

[0074] 106. For each health state, perform attention operation on the corresponding sample coding feature to obtain the coding feature of each health state;

[0075] 107. The coding feature of each health status is used as a preset coding feature.

[0076] The sample coding feature is obtained by coding the sample fusion data, and the sample fusion data is obtained by fusing the time series self-state data of the sample livestock and the time series environmental state data of the environment in which the sample livestock is located.

[0077] In this embodiment, the health state may include a first health state and a second health state. A sample coding feature set corresponding to the first health state and a sample coding feature set corresponding to the second health state may be obtained. For the first health state, an attention operation may be performed on the sample coding features corresponding to the first health state to obtain the coding features of the first health state. For the second health state, an attention operation may be performed on the sample coding features corresponding to the second health state to obtain the coding features of the second health state. The coding features of the first health state and the coding features of the second health state may be used as preset coding features.

[0078] In some embodiments, obtaining sample coding feature sets corresponding to different health states may include:

[0079] Acquire time-series self-state data of a plurality of sample livestock and time-series environmental state data of the environments in which the plurality of sample livestock are located;

[0080] Fusion of the time series self-state data of each sample livestock and the time series environmental state data of the environment in which each sample livestock is located to obtain a plurality of sample fusion data;

[0081] Perform feature encoding on each sample fusion data to obtain multiple sample encoding features;

[0082] According to the plurality of sample coding features, a sample coding feature set corresponding to different health states is determined.

[0083] In this embodiment, the health status may include a first health status and a second health status.

[0084] Among them, the acquisition process of the time-series self-state data of multiple sample livestock and the time-series environmental state data of the environment in which the multiple sample livestock are located can refer to the acquisition process of the time-series self-state data of the livestock to be detected and the time-series environmental state data of the environment in which the livestock to be detected is located provided in the embodiment of the present application, and will not be described in detail here. It can be understood that in order to improve the accuracy of determining the health status of the livestock to be detected, the multiple sample livestock are all livestock wearing undamaged ear tags. The specific implementation of feature encoding of multiple sample fusion data to obtain multiple sample coding features can refer to the specific implementation of feature encoding of fusion data to obtain current coding features provided in the embodiment of the present application, which will not be repeated here.

[0085] When multiple sample coding features are sample coding features corresponding to labeled samples, the health status category corresponding to each sample coding feature can be obtained; according to the multiple sample coding features and the health status category corresponding to each sample coding feature, the sample coding feature set corresponding to the first health status and the sample coding feature set corresponding to the second health status are determined. For example, assuming that there are 100 sample coding features C1 to C100, where the health status category corresponding to the sample coding features C1 to C40 is the first health status, and the health status category corresponding to the sample coding features C41 to C100 is the second health status category, then the sample coding feature set corresponding to the first health status may include sample coding features C1 to C40, and the sample coding feature set corresponding to the second health status may include sample coding features C41 to C100.

[0086] When multiple sample coding features include sample coding features corresponding to labeled samples and sample coding features corresponding to unlabeled samples, the health status category corresponding to each labeled sample coding feature can be obtained; according to the sample coding features corresponding to the labeled samples and their corresponding health status categories and the sample coding features corresponding to the unlabeled samples, the sample coding feature set corresponding to the first health status and the sample coding feature set corresponding to the second health status are determined. For example, assuming that there are 100 sample coding features C1 to C100, wherein the health status category corresponding to the sample coding features C1 to C40 is the first health status, the health status category corresponding to the sample coding features C41 to C80 is the second health status category, and the sample coding features C81 to C100 are the sample coding features corresponding to the unlabeled samples, then the sample coding feature set corresponding to the first health status may include sample coding features C1 to C40 and sample coding features C81 to C100, and the sample coding feature set corresponding to the second health status may include sample coding features C41 to C100.

[0087] In some embodiments, Figure 3As shown, for each health state, the attention operation is performed on the corresponding sample coding features to obtain the coding features of each health state, which may include:

[0088] 10611. For each health state, calculate the weight of the corresponding sample coding feature to obtain the weight of each sample coding feature;

[0089] 10612. Obtain the coding features of each health state according to the sample coding features and their weights corresponding to each health state.

[0090] In this embodiment, the health state may include a first health state and a second health state. For the first health state, the weight of the sample coding feature corresponding to it may be calculated to obtain the weight of each sample coding feature; then, according to the sample coding feature corresponding to the first health state and its weight, the coding feature of the first health state is obtained. For the second health state, the weight of the sample coding feature corresponding to it may be calculated to obtain the weight of each sample coding feature; then, according to the sample coding feature corresponding to the second health state and its weight, the coding feature of the second health state is obtained.

[0091] In some embodiments, for each health state, performing an attention operation on the corresponding sample coding feature to obtain the coding feature of each health state may include:

[0092] 10621. For each health state, the corresponding sample coding features are input into the attention prototype model to obtain the coding features of each health state.

[0093] In this embodiment, the health state may include a first health state and a second health state. A sample coding feature set corresponding to the first health state and a sample coding feature set corresponding to the second health state may be obtained. Figure 4 As shown in , for the first health state, the corresponding sample coding features can be input into the attention prototype model to obtain the coding features of the first health state. Figure 5 As shown, for the second health state, the corresponding sample coding features can be input into the attention prototype model to obtain the coding features of the second health state. The attention prototype model includes an attention prototype network. The structure of the attention prototype network is (fully connected layers+tanh+fully connected layers).

[0094] In some embodiments, the attention prototype model includes a weight determination module and a feature encoding module, such as Figure 6 As shown, for each health state, the corresponding sample coding features are input into the attention prototype model to obtain the coding features of each health state, which may include:

[0095] 106211. For each health state, input the corresponding sample coding feature into the weight determination module to obtain the weight of each sample coding feature;

[0096] 106212. Input the sample coding features and their weights corresponding to each health state into the feature coding module to obtain the coding features of each health state.

[0097] In this embodiment, the health status may include a first health status and a second health status. Figure 7 As shown, for the first health state, the corresponding sample coding features can be input into the weight determination module, and the weight of each sample coding feature can be calculated by the corresponding formula; then the sample coding features corresponding to the first health state and their weights can be input into the feature coding module, and the coding features of the first health state can be calculated by the corresponding formula. Figure 8 As shown, for the second health state, the corresponding sample coding features can be input into the weight determination module, and the weight of each sample coding feature can be calculated through the corresponding formula; then the sample coding features corresponding to the second health state and their weights are input into the feature coding module, and the coding features of the second health state are calculated through the corresponding formula.

[0098] For example, when the attention prototype model is obtained through supervised training, the sample coding features corresponding to the first health state and the sample coding features corresponding to the second health state are both sample coding features corresponding to labeled samples. The sample coding features corresponding to the first health state are the sample coding features corresponding to the samples of the first health state category, and the sample coding features corresponding to the second health state are the sample coding features corresponding to the samples of the second health state category. Then the weight A of the sample coding features corresponding to the kth health state is k It can be calculated by the following formula.

[0099]

[0100] Among them, W k , V k H is the training parameter of the attention prototype model. k The sample encoding features corresponding to the k-th health state (including the first health state and the second health state).

[0101] For example, a sample encoding feature corresponding to the first health state is used as H k Substituting into the above formula, we can get the weight corresponding to the sample coding feature. Similarly, we take a sample coding feature corresponding to the second health state as H k Substituting into the above formula, we can get the weight corresponding to the encoding feature of the sample.

[0102] The encoding feature C of the kth health state (including the first health state and the second health state) k It can be calculated by the following formula.

[0103]

[0104] Among them, A k,i represents the i-th coding feature corresponding to the k-th health state (including the first health state and the second health state), H k,i Represents the weight corresponding to the i-th encoded feature corresponding to the k-th health state (including the first health state and the second health state).

[0105] In some embodiments, when the attention prototype model is obtained through semi-supervised training, the sample coding feature set corresponding to each health state includes the sample coding features of the unlabeled samples and the sample coding features of each health state. That is, the sample coding features corresponding to the first health state include the sample coding features corresponding to the samples of the first health state category and the sample coding features corresponding to the unlabeled samples, and the sample coding features corresponding to the second health state include the sample coding features corresponding to the samples of the second health state category and the sample coding features corresponding to the unlabeled samples. Then the weight A of the sample coding features corresponding to the kth health state is k It can be calculated by the following formula.

[0106]

[0107] Among them, W k , V k H is the training parameter of the attention prototype model. k The sample encoding features corresponding to the k-th health state (including the first health state and the second health state).

[0108] For example, a sample encoding feature corresponding to the first health state is used as H k Substituting into the above formula, we can get the weight corresponding to the sample coding feature. Similarly, we take a sample coding feature corresponding to the second health state as H k Substituting into the above formula, we can get the weight corresponding to the encoding feature of the sample.

[0109] The encoding feature C of the kth health state k It can be calculated by the following formula.

[0110]

[0111] Among them, A k,i represents the coding feature corresponding to the i-th sample corresponding to the k-th health state (including the first health state and the second health state), H k,iIndicates the weight corresponding to the encoding feature corresponding to the i-th sample of the k-th health state (including the first health state and the second health state) category. represents the encoding feature corresponding to the unlabeled i-th sample, Represents the weight corresponding to the encoded feature of the i-th unlabeled sample.

[0112] It can be understood that after the coding features of the first health state and the coding features of the second health state are calculated through the above process, the similarity between the sample coding features corresponding to the first health state and the coding features of the first health state can be calculated to obtain the probability that the sample coding features corresponding to the first health state belong to the first health state category. The similarity between the sample coding features corresponding to the first health state and the coding features of the second health state can be calculated to obtain the probability that the sample coding features corresponding to the first health state belong to the second health state category. The similarity between the sample coding features corresponding to the second health state and the coding features of the first health state is calculated to obtain the probability that the sample coding features corresponding to the second health state belong to the first health state category. The similarity between the sample coding features corresponding to the second health state and the coding features of the second health state is calculated to obtain the probability that the sample coding features corresponding to the second health state belong to the second health state category.

[0113] Specifically, the Euclidean distance between the sample coding features corresponding to the first health state and the coding features of the first health state can be calculated as the similarity between the sample coding features corresponding to the first health state and the coding features of the first health state. The Euclidean distance between the sample coding features corresponding to the first health state and the coding features of the second health state can be calculated as the similarity between the sample coding features corresponding to the first health state and the coding features of the second health state. The Euclidean distance between the sample coding features corresponding to the second health state and the coding features of the first health state is calculated as the similarity between the sample coding features corresponding to the second health state and the coding features of the first health state. The Euclidean distance between the sample coding features corresponding to the second health state and the coding features of the second health state is calculated as the similarity between the sample coding features corresponding to the second health state and the coding features of the second health state.

[0114] Based on the above-mentioned probability and the corresponding loss function, the attention prototype model is trained in a supervised or semi-supervised manner to obtain a trained attention prototype model. The coding features of the first health state and the coding features of the second health state corresponding to the trained attention prototype model can be used as preset coding features. That is to say, assuming that the accuracy of the attention prototype model is 99%, for 100 livestock to be detected, according to the current coding features of each livestock to be detected, the coding features of the first health state and the coding features of the second health state, the health status of each livestock to be detected can be accurately predicted.

[0115] Among them, the loss function can be:

[0116] J(θ)=-logP Θ (y=k|x)

[0117] Among them, P Θ (y=k|x) represents the probability that a certain sample coding feature belongs to the kth health state (including the first health state and the second health state) category.

[0118] In some embodiments, feature encoding is performed on the fused data to obtain current encoding features, which may include:

[0119] 1031. Input the fused data into the feature coding model to obtain the current coding feature.

[0120] like Fig. 9 As shown, in this embodiment, after the fused data is obtained, the fused data can be input into a pre-trained feature encoding model to obtain the current encoding feature.

[0121] It should be noted that how to train the feature encoding model can be based on actual needs and will not be described in detail here.

[0122] In some embodiments, the feature encoding model includes a feature enhancement module and a feature mapping module, such as Fig.10 As shown, the fused data is input into the feature encoding model to obtain the current encoding features, including:

[0123] 10311. Input the fused data into a feature enhancement module to obtain enhanced features;

[0124] 10312. Input the enhanced features into the feature mapping module to obtain the current encoding features.

[0125] like Fig.11 As shown, in this embodiment, after the fused data is obtained, the fused data can be input into a feature enhancement module to obtain enhanced features.

[0126] After the enhanced features are obtained, the enhanced features can be input into a feature mapping module to obtain the current encoding features.

[0127] Specifically, the feature mapping module may include a mapping network. After the enhanced feature passes through the mapping network, a low-dimensional embedding vector may be obtained. The low-dimensional embedding vector may be used as the current encoding feature. It is understandable that the mapping network is a pre-trained mapping network. The mapping network is composed of multiple layers (fully connected layers+batchnormalization+relu).

[0128] In some embodiments, the feature enhancement module includes a first feature extraction unit, a second feature extraction unit and a feature fusion unit, such as Fig.12 As shown, the fused data is input into the feature enhancement module to obtain enhanced features, including:

[0129] 103111. Input the fused data into a first feature extraction unit to obtain a first time series feature;

[0130] 103112. Input the fused data into a second feature extraction unit to obtain a second time series feature;

[0131] 103113. Input the first time series feature and the second time series feature into a feature fusion unit to obtain an enhanced feature.

[0132] like Fig.13 As shown, in this embodiment, after the fused data is obtained, the fused data can be input into the first feature extraction unit to obtain the first time series feature, and the fused data can be input into the second feature extraction unit to obtain the second time series feature. After the first time series feature and the second time series feature are obtained, the first time series feature and the second time series feature can be input into the feature fusion unit to obtain the enhanced feature.

[0133] Specifically, the first feature extraction unit may include an LSTM (Long short-term memory) network, which is a special recurrent neural network (RNN). It mainly extracts time series information from the original time series data, applies the global maximum pooling operation to the extracted time series information and obtains the output. That is to say, after the fused data passes through the LSTM network, the first time series feature can be obtained. The second feature extraction unit may include a TCN (Temporal Convolutional Network). TCN is composed of a plurality of Residual blocks stacked together, and the top layer is connected to the global maximum pooling and linear transformation to obtain the final output. In this embodiment, assuming that the time series motion data of the livestock to be detected is obtained by a three-axis motion sensor, the fused data may include data of 6 dimensions, namely, the temperature data of the livestock to be detected, the 3-dimensional motion data of the livestock to be detected, and the temperature data and humidity data of the environment in which the livestock to be detected are located. Then, the TCN performs convolution operations on a group of data respectively. Among them, each group is obtained by randomly permuting 6 dimensions three times to obtain three groups, and each group extracts the first 3 dimensional variables. That is to say, after the fused data passes through TCN, the second time series feature can be obtained.

[0134] After the first time series feature and the second time series feature are obtained, the first time series feature and the second time series feature may be input into a feature fusion unit to concatenate the first time series feature and the second time series feature to obtain an enhanced feature.

[0135] It should be noted that the above-mentioned feature coding model and the attention prototype model can be supervised or semi-supervised based on multiple sample fusion data and the loss function provided in the above embodiment until the corresponding stop condition is met, and then the trained feature coding model is used to obtain the current coding feature based on the fusion data of the livestock to be detected, and the coding feature of the first health state and the coding feature of the second health state corresponding to the trained attention prototype model are combined with the current coding feature to obtain the health state of the livestock to be detected. Among them, how to obtain multiple sample fusion data can be referred to the previous embodiment, which will not be repeated here.

[0136] Please also read Fig.14 and Fig.15 , Fig.14 is a schematic diagram of the training process provided in the embodiment of the present application, Fig.15 It is a schematic diagram of the prediction process provided in the embodiment of the present application.

[0137] For example, in the training phase, the time series self-state data of multiple sample livestock and the time series environmental state data of the environment in which the multiple sample livestock are located can be obtained. By fusing the time series self-state data of each sample livestock and the time series environmental state data of the environment in which each sample livestock is located, multiple sample fusion data can be obtained. Subsequently, the multiple sample fusion data can be input into the LSTM network and TCN respectively to obtain the first time series feature of each sample and the second time series feature of each sample. Then, the first time series feature of each sample and the second time series feature of each sample are input into the feature fusion unit to splice the first time series feature of each sample and the second time series feature of each sample to obtain the enhanced feature of each sample. Then, the enhanced feature of each sample is input into the mapping network to obtain the sample coding feature of each sample, thereby obtaining the sample coding features of multiple samples. Next, the sample coding features of multiple samples can be input into the attention prototype network to obtain the coding features of the first health state and the coding features of the second health state. Then, according to the sample coding features of each sample and the coding features of the first health state, the probability that each sample livestock belongs to the first health state category is calculated, and according to the sample coding features of each sample and the coding features of the second health state, the probability that each sample livestock belongs to the second health state category is calculated. Based on the above process, supervised or semi-supervised training is performed on the LSTM network, TCN, mapping network and attention prototype network to obtain the trained LSTM network, TCN network, mapping network and attention prototype network. The coding features of the first health state and the coding features of the second health state corresponding to the trained attention prototype network can be obtained and stored for future use.

[0138] In the prediction stage, the time series self-state data of the livestock to be detected and the time series environmental state data of the environment in which the livestock to be detected are located can be obtained. The time series self-state data of the livestock to be detected and the time series environmental state data of the environment in which the livestock to be detected are fused to obtain fused data. Subsequently, the fused data can be input into the LSTM network and TCN respectively to obtain the first time series feature and the second time series feature. Then, the first time series feature and the second time series feature are input into the feature fusion unit to splice the first time series feature and the second time series feature to obtain the enhanced feature. Then, the enhanced feature is input into the mapping network to obtain the current coding feature. Then, the first probability that the livestock to be detected belongs to the first health state category can be calculated based on the current coding feature and the stored coding feature of the first health state, and the second probability that the livestock to be detected belongs to the second health state category can be calculated based on the current coding feature and the coding feature of the second health state. According to the first probability and the second probability, the health state of the livestock to be detected is determined. For example, assuming that the first probability is 0.8 and the second probability is 0.2, it can be determined that the health state of the livestock to be detected is the first health state, that is, the livestock to be detected is a healthy livestock.

[0139] See also Fig.16 , Fig.16 The structure diagram of the livestock health status detection device provided in the embodiment of the present application is as follows: The livestock health status detection device 200 comprises: a data acquisition module 201 , a data fusion module 202 , a feature encoding module 203 and a status determination module 204 .

[0140] The data acquisition module 201 is used to acquire the time-series self-state data of the livestock to be detected and the time-series environmental state data of the environment in which the livestock to be detected is located;

[0141] A data fusion module 202 is used to fuse the time series self-state data and the time series environment state data to obtain fused data;

[0142] The feature encoding module 203 is used to perform feature encoding on the fused data to obtain the current encoding feature;

[0143] The state determination module 204 is used to determine the health state of the livestock to be detected according to the current coding characteristics.

[0144] In some embodiments, the state determination module 204 can be used to determine the health state of the livestock to be detected based on the similarity between the current coding feature and the preset coding feature; wherein the preset coding feature is obtained by performing attention enhancement based on the sample coding feature.

[0145] In some embodiments, the livestock health status detection device 200 may further include a feature set acquisition module and an attention operation module. The feature set acquisition module may be used to: acquire a sample coding feature set corresponding to different health statuses, the sample coding feature set including at least one sample coding feature, the sample coding feature being obtained by feature encoding the sample fusion data, the sample fusion data being obtained by fusing the time series self-state data of the sample livestock and the time series environmental state data of the environment in which the sample livestock is located;

[0146] The attention operation module can be used to: for each health state, perform attention operation on the corresponding sample coding features to obtain the coding features of each health state; and use the coding features of each health state as preset coding features.

[0147] In some embodiments, the attention operation module can be used to: for each health state, calculate the weight of the corresponding sample coding feature to obtain the weight of each sample coding feature; obtain the coding feature of each health state based on the sample coding features corresponding to each health state and their weights.

[0148] In some embodiments, the attention operation module can be used to: for each health state, input the corresponding sample coding feature into the attention prototype model to obtain the coding feature of each health state.

[0149] In some embodiments, the attention prototype model includes a weight determination module and a feature encoding module. The attention operation module can be used to: for each health state, input the corresponding sample coding feature into the weight determination module to obtain the weight of each sample coding feature; input the sample coding features corresponding to each health state and their weights into the feature encoding module to obtain the coding features of each health state.

[0150] In some embodiments, when the attention prototype model is obtained through semi-supervised training, the sample encoding feature set corresponding to each health state includes unlabeled sample encoding features and sample encoding features of each health state.

[0151] In some embodiments, the feature encoding module 203 may be used to: input the fused data into a feature encoding model to obtain current encoding features.

[0152] In some embodiments, the feature coding model includes a feature enhancement module and a feature mapping module. The feature coding module 203 can be used to: input the fused data into the feature enhancement module to obtain enhanced features; input the enhanced features into the feature mapping module to obtain current coding features.

[0153] In some embodiments, the feature enhancement module includes a first feature extraction unit, a second feature extraction unit and a feature fusion unit. The feature encoding module 203 can be used to: input the fused data into the first feature extraction unit to obtain the first time series feature; input the fused data into the second feature extraction unit to obtain the second time series feature; input the first time series feature and the second time series feature into the feature fusion unit to obtain the enhanced feature.

[0154] It should be noted that the livestock health status detection device 200 provided in the embodiment of the present application and the livestock health status detection method in the above embodiment belong to the same concept, and its specific implementation process is detailed in the above related embodiments and will not be repeated here.

[0155] An embodiment of the present application also provides an electronic device, including a memory and a processor, wherein the processor is used to execute the steps of the livestock health status detection method provided in this embodiment by calling a computer program stored in the memory.

[0156] Please refer to Fig.17 , Fig.17 A schematic diagram of the structure of an electronic device 300 provided in an embodiment of the present application.

[0157] The electronic device 300 may include components such as a network interface 301, a memory 302, a processor 303, and a screen assembly. Those skilled in the art will appreciate that Fig.17The structure of the electronic device 300 shown in the figure does not constitute a limitation on the electronic device 300, and may include more or less components than shown in the figure, or combine certain components, or arrange the components differently.

[0158] The network interface 301 may be used to establish a network connection between devices.

[0159] The memory 302 may be used to store computer programs and data. The computer programs stored in the memory 302 include executable codes. The computer programs may be divided into various functional modules. The processor 303 executes various functional applications and data processing by running the computer programs stored in the memory 302.

[0160] The processor 303 is the control center of the electronic device 300. It uses various interfaces and lines to connect various parts of the entire electronic device 300, and executes various functions and processes data of the electronic device 300 by running or executing computer programs stored in the memory 302 and calling data stored in the memory 302, thereby controlling the electronic device 300 as a whole.

[0161] In the embodiment of the present application, the processor 303 in the electronic device 300 will load the executable code corresponding to one or more computer programs into the memory 302 according to the following instructions, and the processor 303 will execute the steps in the livestock health status detection method provided by the present application, for example:

[0162] Acquire the time-series self-state data of the livestock to be detected, and the time-series environmental state data of the environment in which the livestock to be detected is located;

[0163] Fusing the time series self-state data and the time series environment state data to obtain fused data;

[0164] Perform feature encoding on the fused data to obtain the current encoding feature;

[0165] Determine the health status of the livestock to be tested based on the current coding characteristics.

[0166] It should be noted that the electronic device 300 provided in the embodiment of the present application and the livestock health status detection method in the above embodiment belong to the same concept, and its specific implementation process is detailed in the above related embodiments and will not be repeated here.

[0167] The present application also provides a computer-readable storage medium, on which a computer program is stored. When the computer program stored therein is executed on the processor of the electronic device provided in the embodiment of the present application, the processor of the electronic device executes the steps in any of the above livestock health status detection methods suitable for the electronic device. The storage medium may be a magnetic disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM), etc.

[0168] The above is a detailed introduction to a livestock health status detection method, device, storage medium and electronic device provided by the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method and core idea of ​​the present application; at the same time, for technicians in this field, according to the idea of ​​the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.

Claims

1. A method for detecting the health status of livestock, characterized in that: include: Acquire a sample coding feature set corresponding to different health states, wherein the sample coding feature set includes at least one sample coding feature, wherein the sample coding feature is obtained by performing feature coding on sample fusion data, wherein the sample fusion data is obtained by fusing the time series self-state data of the sample livestock and the time series environmental state data of the environment in which the sample livestock is located; For each health state, perform attention operation on the corresponding sample coding features to obtain the coding features of each health state; The coding feature of each health state is used as a preset coding feature; Acquiring time-series self-state data of the livestock to be detected and time-series environmental state data of the environment in which the livestock to be detected is located; Fusing the time series self-state data and the time series environment state data to obtain fused data; Performing feature encoding on the fused data to obtain current encoding features; The health status of the livestock to be detected is determined according to the similarity between the current coding feature and the preset coding feature, wherein the preset coding feature is obtained after attention enhancement based on the sample coding feature.

2. The method for detecting the health status of livestock according to claim 1, characterized in that: For each health state, the attention operation is performed on the corresponding sample coding feature to obtain the coding feature of each health state, including: For each health state, calculate the weight of the corresponding sample coding feature to obtain the weight of each sample coding feature; According to the sample coding features corresponding to each health state and its weight, the coding features of each health state are obtained.

3. The method for detecting the health status of livestock according to claim 1, characterized in that: For each health state, the attention operation is performed on the corresponding sample coding feature to obtain the coding feature of each health state, including: For each health state, the corresponding sample encoding features are input into the attention prototype model to obtain the encoding features of each health state.

4. The method for detecting the health status of livestock according to claim 3, characterized in that: The attention prototype model includes a weight determination module and a feature encoding module. For each health state, the corresponding sample encoding feature is input into the attention prototype model to obtain the encoding feature of each health state, including: For each health state, the corresponding sample coding feature is input into the weight determination module to obtain the weight of each sample coding feature; The sample coding features and their weights corresponding to each health state are input into the feature coding module to obtain the coding features of each health state.

5. The method for detecting the health status of livestock according to claim 3, characterized in that: When the attention prototype model is obtained through semi-supervised training, the sample coding feature set corresponding to each health state includes unlabeled sample coding features and sample coding features of each health state.

6. The method for detecting the health status of livestock according to any one of claims 1 to 5, characterized in that: The step of encoding the fused data to obtain current encoding features includes: The fused data is input into a feature coding model to obtain current coding features.

7. The method for detecting the health status of livestock according to claim 6, characterized in that: The feature coding model includes a feature enhancement module and a feature mapping module, and the fusion data is input into the feature coding model to obtain the current coding feature, including: Inputting the fused data into the feature enhancement module to obtain enhanced features; The enhanced features are input into the feature mapping module to obtain current encoding features.

8. The method for detecting the health status of livestock according to claim 7, characterized in that: The feature enhancement module includes a first feature extraction unit, a second feature extraction unit and a feature fusion unit, and the fusion data is input into the feature enhancement module to obtain enhanced features, including: Inputting the fused data into the first feature extraction unit to obtain a first time series feature; Inputting the fused data into the second feature extraction unit to obtain a second time series feature; The first time series feature and the second time series feature are input into the feature fusion unit to obtain enhanced features.

9. A device for detecting the health status of livestock, characterized in that: include: A data acquisition module is used to acquire a sample coding feature set corresponding to different health states, wherein the sample coding feature set includes at least one sample coding feature, wherein the sample coding feature is obtained by performing feature coding on sample fusion data, wherein the sample fusion data is obtained by fusing the time series self-state data of the sample livestock and the time series environmental state data of the environment in which the sample livestock is located; for each health state, an attention operation is performed on the corresponding sample coding feature to obtain a coding feature of each health state; and the coding feature of each health state is used as a preset coding feature; Acquiring time-series self-state data of the livestock to be detected and time-series environmental state data of the environment in which the livestock to be detected is located; A data fusion module, used for fusing the time series self-state data and the time series environment state data to obtain fused data; A feature encoding module, used for performing feature encoding on the fused data to obtain current encoding features; The state determination module is used to determine the health state of the livestock to be detected according to the similarity between the current coding feature and the preset coding feature; wherein the preset coding feature is obtained after attention enhancement based on the sample coding feature.

10. A storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed on a computer, the computer executes the livestock health status detection method according to any one of claims 1 to 8.

11. An electronic device, characterized in that: The electronic device includes a processor and a memory, wherein a computer program is stored in the memory, and the processor is used to execute the livestock health status detection method according to any one of claims 1 to 8 by calling the computer program stored in the memory.

Citation Information

Patent Citations

  • Animal health monitoring method and device, and computer readable storage medium

    CN108922622A

  • Community intelligent pension service system and method

    CN112183228A