Animal anomaly detection method and system based on hybrid expert model

By adopting a hybrid expert model in animal anomaly detection, combining distance threshold method, machine learning method and genetic algorithm, multi-level anomaly detection is carried out, which solves the problem of failure to fully consider behavioral statistical characteristics in the existing technology, and improves the accuracy and reliability of the detection.

CN119832341APending Publication Date: 2025-04-15HUAZHONG AGRI UNIV
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202510220497.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-02-27
Publication Date
2025-04-15

AI Technical Summary

Technical Problem

The prior art fails to fully consider the statistical characteristics and potential connections of pig behavior in animal abnormality detection, resulting in false positives or missed reports, affecting the accuracy and reliability of the detection.

Method used

Animal anomaly detection method based on a hybrid expert model is adopted to obtain animal behavior data, and combine distance threshold method, machine learning method and hybrid expert model to perform multi-level anomaly detection. Specific steps include modeling healthy behavior patterns, optimizing behavioral feature weights using genetic algorithms, classifying multiple machine learning algorithms, and making final weighted voting judgments through gated networks.

Benefits of technology

It improves the accuracy and reliability of animal behavior abnormality detection, overcomes the shortcomings in behavior factor consideration and weight allocation of existing methods, and achieves a more comprehensive and scientific behavior pattern analysis.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119832341A_ABST
    Figure CN119832341A_ABST
Patent Text Reader

Abstract

The invention provides an animal anomaly detection method and system based on a hybrid expert model, and the method comprises the steps: carrying out the modeling of a healthy behavior mode through collecting and analyzing the behavior data of a large number of healthy animals, and extracting a statistical rule of behavior characteristics; the Euclidean distance between the behavior characteristics of the sample to be detected and the health behavior mode is calculated to serve as the basis for judging the abnormal state, image characteristics are considered, and statistical information of the behavior characteristics is integrated; the limitation of the existing animal anomaly detection research on the aspect of judging the anomaly by using apparent data is overcome, and the function of improving the accuracy and reliability of animal behavior anomaly detection is realized. According to the method, the clustering analysis and other methods and genetic algorithms are adopted, behavior factors are comprehensively considered, behavior weights are scientifically distributed, the accuracy and adaptability of behavior pattern analysis are improved, and abnormal behaviors are better captured and recognized; classifying the behavior data by using a plurality of machine learning algorithms, and fusing prediction results of a plurality of models by using integrated learning voting to obtain a final anomaly detection result; advantages of various methods are combined, and accuracy and reliability of behavior pattern analysis are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the technical field of image processing, and in particular relates to an animal abnormality detection method and system based on a hybrid expert model. Background Art

[0002] Current research on abnormality detection in animals, especially pigs, mainly relies on apparent data, that is, directly using image features obtained through image recognition technology to judge the abnormal state of pigs. Although this method is intuitive and easy to implement, its accuracy and reliability are limited by the characteristics of the acquired image data. Specifically, this method fails to fully consider the statistical characteristics of abnormal pig behavior, that is, the changes and regularities of pig behavior in time series, and the potential connection between these changes and abnormal states. Therefore, judging only by image features may lead to false positives or false negatives, affecting the accuracy of abnormality detection.

[0003] Existing methods often fail to fully and deeply consider behavioral factors when analyzing behavioral patterns. They may only focus on certain specific behavioral indicators or characteristics, while ignoring other important factors that may affect behavioral patterns. In addition, in terms of behavioral weight allocation, existing methods often lack scientificity and dynamism, and often rely on researchers' subjective judgment or empirical rules, resulting in unreasonable weight allocation and difficulty in accurately reflecting the importance and impact of behaviors.

[0004] Existing methods often have problems of singleness and one-sidedness when integrating behavioral pattern analysis with machine learning model selection. On the one hand, traditional methods usually rely on traditional rule-based or threshold settings (such as threshold judgment based on behavioral patterns). These methods lack flexibility and adaptability and are difficult to effectively capture the complexity and dynamic changes of animal behavior. On the other hand, although some methods introduce machine learning techniques (such as random forest, XGBoost and other classification algorithms), they usually only use a single model for classification, fail to fully utilize the complementarity between different models, and ignore the potential of ensemble learning in improving model performance. This singleness and one-sidedness limits the accuracy and robustness of behavioral pattern analysis. Summary of the invention

[0005] The technical problem to be solved by the present invention is to provide an animal anomaly detection method and system based on a hybrid expert model, which is used to improve the accuracy and reliability of animal behavior anomaly detection. The technical solution adopted by the present invention to solve the above technical problems is: an animal abnormality detection method based on a hybrid expert model, comprising the following steps: S1: Obtain animal behavior data; S2: Use the distance threshold method to determine whether the animal behavior is abnormal; S3: Use machine learning to determine whether animal behavior is abnormal; S4: Use a hybrid expert model to determine the final judgment result.

[0006] According to the above scheme, in step S2, the specific steps are: S21: Modeling healthy behavior patterns in animals; S22: Establishing the population of animal behavior and initializing the combination of population and behavioral characteristics weights; S23: calculating the weighted Euclidean distance between the behavioral characteristics of the tested animal and the behavioral characteristics of the healthy behavioral pattern; S24: Based on the weighted Euclidean distance, abnormal animal behaviors and healthy animal behaviors were divided by clustering operation; S25: using the clustering-based partition threshold to calculate the fitness function as the optimization target of the genetic algorithm; S26: Optimizing the weight combination of behavioral features using genetic algorithm; S27: Use the optimized behavioral feature weight combination to perform distance threshold-based anomaly detection on animal behavior.

[0007] Furthermore, in step S21, the specific steps are: S211: Collect behavioral data from healthy animals; S212: Calculate the Euclidean distance of all behavioral characteristics of healthy animals and construct healthy behavior patterns.

[0008] Furthermore, in step S22, the specific steps are: Use genetic algorithm to initialize the population of animal behavior; each individual in the population represents a set of behavioral feature weight combinations; in the interval The initial weight value is randomly generated.

[0009] Furthermore, in step S24, the specific steps are: S241: Use K-means clustering method to divide the behavior of the animals to be tested into two clusters: healthy animal group and abnormal animal group; S242: Calculate the middle value of the cluster boundary value between the two clusters of the healthy animal group and the abnormal animal group as the classification threshold. If the weighted Euclidean distance is greater than the threshold, it is judged as abnormal behavior; if the weighted Euclidean distance is less than or equal to the threshold, it is judged as healthy behavior.

[0010] According to the above scheme, in step S3, the specific steps are: S31: extracting animal behavior characteristics from the input animal behavior data and converting them into numerical features; S32: Use multiple machine learning algorithms as expert models to learn animal behavior characteristics from different perspectives, and train each expert model independently; S33: Using each trained expert model, determine whether the behavior of the animal to be tested is abnormal, and obtain a determination result of each model.

[0011] Furthermore, in step S32, the machine learning algorithms used include ExtraTrees, Random Forest, XGBoost and K-nearest neighbors.

[0012] According to the above scheme, in step S4, the specific steps are: S41: Use a gating network to assign a weight to each expert model based on the input features; S42: Select an expert model for prediction based on the weight, and use a weighted voting mechanism to aggregate the distance threshold method and the output results of each expert model for final judgment; if the number of abnormal votes is greater than or equal to the number of normal votes, the behavior is judged to be abnormal; if the number of abnormal votes is less than the number of normal votes, it is judged to be normal.

[0013] Furthermore, the step S4 further includes the following steps: The gating network is trained using a cross entropy loss function to minimize the prediction error for each sample.

[0014] An animal anomaly detection system based on a hybrid expert model. A data acquisition submodule is used to obtain animal behavior data; A distance threshold submodule is used to determine whether the animal behavior is abnormal by using a distance threshold method; A machine learning submodule is used to determine whether the animal behavior is abnormal using machine learning methods; The hybrid expert submodule is used to determine the final judgment result using a hybrid expert model.

[0015] The beneficial effects of the present invention are: 1. The present invention is an animal abnormality detection method and system based on a hybrid expert model. By collecting and analyzing a large amount of behavioral data of healthy animals, the healthy behavior pattern is modeled and the statistical laws of the behavioral characteristics are extracted. Then, the Euclidean distance between the behavioral characteristics of the sample to be tested and the healthy behavior pattern is calculated as the basis for judging the abnormal state. Not only the image features are considered, but also the statistical information of the behavioral characteristics is integrated. The method and system overcome the limitations of the existing animal abnormality detection research in using the apparent data to judge the abnormality, and realizes the function of improving the accuracy and reliability of animal behavior abnormality detection.

[0016] 2. In order to overcome the shortcomings of existing methods in considering behavioral factors and allocating behavioral weights, the present invention pays special attention to the comprehensive consideration of behavioral factors and the scientific allocation of behavioral weights. First, cluster analysis and other methods are used to carefully classify and extract features of animal behaviors to fully capture the diversity and complexity of behavioral patterns; secondly, a genetic algorithm is introduced to optimize the weight of each behavior based on the clustering results, and the optimal combination of behavioral weights is found through iterative search. This data-driven weight allocation method not only improves the accuracy and adaptability of behavioral pattern analysis, but also can better capture and identify abnormal behaviors.

[0017] 3. In order to overcome the shortcomings of existing methods in comprehensive behavior pattern analysis and machine learning model selection, the present invention adopts a strategy of integrating multiple methods: first, an anomaly detection method based on the Euclidean distance of the behavior pattern is introduced, and the anomaly is dynamically judged by calculating the distance between the sample and the normal behavior pattern, thereby improving flexibility and adaptability; second, a variety of traditional machine learning algorithms (such as random forest, XGBoost, support vector machine, etc.) are used to classify the behavior data, and a mixture of experts (Mixture of Experts, MoE) is constructed to make full use of the advantages of different models; finally, a gating network (GatingNetwork) is introduced to dynamically select the optimal expert model, automatically assign weights by learning sample features, and select the prediction results of the Top-2 expert models for weighted voting, so as to give full play to the complementarity and synergy of the mixed expert model.

[0018] Of course, any product implementing the present invention does not necessarily need to achieve all of the advantages described above at the same time. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0020] Figure 1 is a flow chart of an embodiment of the present invention.

[0021] Figure 2 4 is a flow chart of calculating weighted Euclidean distance according to an embodiment of the present invention.

[0022] Figure 3 It is a flow chart of the computational clustering operation according to an embodiment of the present invention.

[0023] Figure 4 4 is a flow chart of calculating the Euclidean distance weight according to an embodiment of the present invention.

[0024] Figure 5 It is the optimal weight map of the embodiment of the present invention.

[0025] Figure 6 It is a line graph showing the weights changing with genetic generations in an embodiment of the present invention.

[0026] Figure 7 is an anomaly detection diagram based on a distance threshold according to an embodiment of the present invention.

[0027] Figure 8 This is an anomaly detection diagram based on a hybrid expert model according to an embodiment of the present invention.

[0028] Fig. 9 4 is a comparison chart of prediction results of an embodiment of the present invention. DETAILED DESCRIPTION

[0029] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.

[0030] Example 1 See also Figure 1 ,The specific steps of an animal anomaly detection method based on a hybrid expert model are as follows: S1: Obtain animal behavior data; S2: Use the distance threshold method to determine whether the animal behavior is abnormal; S3: Use machine learning to determine whether animal behavior is abnormal; S4: Use a hybrid expert model to determine the final judgment result.

[0031] Furthermore, in step S2, the specific steps are: S21: Modeling healthy behavior patterns in animals; S22: Establishing the population of animal behavior and initializing the combination of population and behavioral characteristics weights; S23: calculating the weighted Euclidean distance between the behavioral characteristics of the tested animal and the behavioral characteristics of the healthy behavioral pattern; S24: Based on the weighted Euclidean distance, abnormal animal behaviors and healthy animal behaviors were divided by clustering operation; S25: using the clustering-based partition threshold to calculate the fitness function as the optimization target of the genetic algorithm; S26: Optimizing the weight combination of behavioral features using genetic algorithm; S27: Use the optimized behavioral feature weight combination to perform distance threshold-based anomaly detection on animal behavior.

[0032] Furthermore, in step S21, the specific steps are: S211: Collect behavioral data from healthy animals; S212: Calculate the Euclidean distance of all behavioral characteristics of healthy animals and construct healthy behavior patterns.

[0033] Furthermore, in step S22, the specific steps are: Use genetic algorithm to initialize the population of animal behavior; each individual in the population represents a set of behavioral feature weight combinations; in the interval The initial weight value is randomly generated.

[0034] Furthermore, in step S24, the specific steps are: S241: Use K-means clustering method to divide the behavior of the animals to be tested into two clusters: healthy animal group and abnormal animal group; S242: Calculate the middle value of the cluster boundary value between the two clusters of the healthy animal group and the abnormal animal group as the classification threshold. If the weighted Euclidean distance is greater than the threshold, it is judged as abnormal behavior; if the weighted Euclidean distance is less than or equal to the threshold, it is judged as healthy behavior.

[0035] In step S3, the specific steps are: S31: extracting animal behavior characteristics from the input animal behavior data and converting them into numerical features; S32: Use multiple machine learning algorithms as expert models to learn animal behavior characteristics from different perspectives, and train each expert model independently; S33: Using each trained expert model, determine whether the behavior of the animal to be tested is abnormal, and obtain a determination result of each model.

[0036] Furthermore, in step S32, the machine learning algorithms used include ExtraTrees, Random Forest, XGBoost and K-nearest neighbors.

[0037] In step S4, the specific steps are: S41: Use a gating network to assign a weight to each expert model based on the input features; S42: Select an expert model for prediction based on the weight, and use a weighted voting mechanism to aggregate the distance threshold method and the output results of each expert model for final judgment; if the number of abnormal votes is greater than or equal to the number of normal votes, the behavior is judged to be abnormal; if the number of abnormal votes is less than the number of normal votes, it is judged to be normal.

[0038] Furthermore, step S4 further includes the following steps: The gating network is trained using a cross entropy loss function to minimize the prediction error for each sample.

[0039] This embodiment collects and analyzes a large amount of behavioral data of healthy animals, models healthy behavior patterns, and extracts statistical laws of behavioral characteristics; then, the Euclidean distance between the behavioral characteristics of the sample to be tested and the healthy behavior pattern is calculated as the basis for judging abnormal conditions, which not only considers image features but also incorporates statistical information of behavioral characteristics; overcomes the limitations of existing animal abnormality detection research in using apparent data to judge abnormalities, and realizes the function of improving the accuracy and reliability of animal behavior abnormality detection.

[0040] Example 2 The steps of this embodiment are the same as those of embodiment 1, except that each step is applied to a specific example. Specifically, the following steps are included: S1: Obtain animal behavior data; S2: Use the distance threshold method to determine whether the animal behavior is abnormal; the specific steps are: S21: Modeling healthy behavior patterns in animals; S211: Collect behavioral data of healthy pigs, including five main behavioral characteristics of eating, drinking, standing, sitting and lying; S212: Calculate the Euclidean distance of all behavioral features and construct a healthy behavior model; represent the characteristics of each behavior as a vector ,in is the feature dimension.

[0041] S22: Establish a population of animal behaviors and initialize the population and behavioral feature weight combination; the specific steps are: Initialize the population using a genetic algorithm to optimize the weight of each behavior; Each individual in the population represents a set of behavior weight combinations ,in For behavior The weight of In the interval The initial weight value is randomly generated.

[0042] S23: Calculate the weighted Euclidean distance between the behavioral characteristics of the animal under test and the behavioral characteristics of the healthy behavioral pattern, see Figure 2 ; The specific steps are: To detect anomalies, the weighted Euclidean distance between the pig behavior sample and the healthy pattern is calculated; the behavioral characteristics of the pig to be detected are , then the weighted Euclidean distance The calculation formula is:

[0043] This distance measures the difference between the five behaviors of the pigs under test and healthy pigs. The larger the distance, the more likely it is abnormal behavior.

[0044] Further, for all the pigs to be tested, the weighted Euclidean distance between them and the behavior patterns of healthy pigs is calculated. .

[0045] S24: Clustering of abnormal and healthy animal behaviors based on weighted Euclidean distance, see Figure 3 ; The specific steps are: S241: Using the K-means clustering method, all samples were divided into two clusters: one cluster was a healthy pig group, and the other was an abnormal pig group; the goal of clustering was to divide pig behaviors into two categories based on the Euclidean distance.

[0046] S242: After K-means clustering is completed, the boundary values ​​of the two clusters are obtained, and the middle value of the cluster boundary values ​​between the two clusters is calculated as the classification threshold , used to determine whether the pig to be tested is abnormal; specifically, if the Euclidean distance of the pig to be tested is greater than the threshold , then its behavior is considered abnormal, otherwise it is healthy.

[0047] In clustering, assume that the centroids of the two clusters are and , then the division threshold It can be defined as the midpoint between two centroids:

[0048] This value is used as the basis for subsequent classification.

[0049] S25: Use the clustering-based partition threshold to calculate the fitness function as the optimization target of the genetic algorithm; optimize the behavioral feature weight combination Maximize the accuracy of anomaly detection; the specific steps are: Specifically, through the iterative process of the genetic algorithm, individuals are selected, crossed, mutated, and the fitness of each individual is evaluated. The fitness function is based on the following process: Calculate weighted Euclidean distance using current weight combination: Calculates the weighted Euclidean distance of all pigs based on the individuals currently in the genetic algorithm.

[0050] Perform K-means clustering: Perform K-means clustering based on Euclidean distance and calculate the middle value of the cluster boundary as the division threshold .

[0051] Classification based on threshold: , and classify the pigs to be tested into healthy or abnormal categories.

[0052] Calculate the F1 value: Calculate the F1 value based on the model prediction results.

[0053] S26: Using genetic algorithms to optimize the process of calculating Euclidean distance weights for pig behaviors to obtain the optimal combination of behavioral feature weights, see Figure 4 ; The specific steps are: After multiple rounds of iterations, the genetic algorithm converges to the optimal combination of behavioral feature weights. .

[0054] Optimal weights see Figure 5 , weights change with genetic generations, see Figure 6 .

[0055] S27: Use optimized behavioral feature weight combination Anomaly detection based on distance threshold for pig behavior, see Figure 7 ; The specific steps are: On the new pig behavior data, first calculate its weighted Euclidean distance, and then use the threshold in the clustering result The pigs to be tested are classified as healthy or abnormal. If the weighted Euclidean distance is greater than the threshold , the pig is judged to have abnormal behavior; otherwise it is considered to be healthy behavior.

[0056] S3: Use machine learning to determine whether animal behavior is abnormal; In order to further improve the accuracy of abnormal behavior detection, multiple machine learning algorithms are used to identify potential abnormal patterns in pig behavior data. Different algorithms learn data from different perspectives and can help the model detect abnormal behavior more accurately in actual scenarios; the specific steps are: S31: Data preprocessing and feature extraction: In a pigpen environment containing normal and abnormal pigs, YOLOv11 and ByteTrack algorithms are used to track pigs in video data, so as to count and extract five behavioral characteristics, including eating time, drinking time, standing time, lying time and sitting time; the extracted features are converted into numerical data suitable for processing by machine learning algorithms.

[0057] Specifically, the data is first divided into features (X) and labels (Y). The labels include three abnormal types: cough, foot pain, and normal. In order to ensure the stability of the model training process and improve its generalization ability, feature X is normalized. The normalization operation is implemented by the following formula:

[0058] Among them, X is the original feature, Xmin and Xmax are the minimum and maximum values ​​of the feature respectively, and X′ is the normalized feature. The data is divided into 80% for training and 20% for validation. In order to ensure the consistency of data distribution, the stratified sampling method is adopted.

[0059] S32: Model selection: This embodiment uses a variety of traditional machine learning algorithms as expert models, including ExtraTrees (ET), Random Forest, XGBoost (XGBClassifier) ​​and K-nearest neighbor (KNN) algorithms. Each model is independently trained on the training set and outputs the classification results on the test set.

[0060] Machine learning algorithms include but are not limited to: a) Random Forest Random forest can handle complex nonlinear relationships by constructing multiple decision trees and integrating them. In this patent, random forest is used to extract features from a large amount of behavioral data and determine whether it is abnormal behavior. Due to its high efficiency and stability in processing large-scale data, random forest can effectively reduce overfitting. The formula of random forest is:

[0061] Among them, ht(X) represents the prediction of the tth tree for the input abnormal data X, and T is the number of trees. By integrating the prediction results of multiple trees, random forests can obtain a more robust classification result.

[0062] b) XGBoost XGBoost is an optimization algorithm based on gradient boosting, which has advantages in dealing with class imbalance problems and high-dimensional data. We use XGBoost to further optimize the classification results and improve the accuracy and robustness of the model in practical scenarios through weighted training of data. XGBoost optimizes model parameters through a weighted gradient boosting process. The update formula is as follows:

[0063] in, is the predicted value of the model in round t, is the learning rate, is the loss function, and N is the number of samples. By optimizing the objective function in each round of iteration, XGBoost can handle unbalanced data and improve the robustness of the model, especially when there is a strong correlation between features.

[0064] c) Extra Trees Extra Trees is an ensemble learning algorithm based on random forests. Its main feature is that it greatly reduces the overfitting of the model by randomly selecting split points and features for splitting. Unlike random forests, Extra Trees improves computational efficiency by using more randomness to train decision trees. The prediction function of Extra Trees is as follows:

[0065] in Denotes the prediction of the tth tree, where T is the total number of trees. Unlike random forests, each tree of ExtraTrees uses stronger randomness during training, which makes it more efficient to train on large-scale and high-dimensional datasets and less prone to overfitting.

[0066] d) K-Nearest Neighbors (KNN) The K-nearest neighbor algorithm is an instance-based learning method. Its basic idea is to classify by calculating the distance between the sample and all samples in the training set. For a sample to be classified, the KNN algorithm selects the nearest K neighbors to vote and selects the category with the largest number as the predicted category of the sample. The formula of KNN is as follows:

[0067] Among them, y is the category of the sample to be predicted, is the set of K neighbors closest to sample x, is the category label of neighbor i, and mode means returning the category with the highest frequency.

[0068] S4: Use a hybrid expert model to determine the final judgment result, see Figure 8 ; After the training of multiple machine learning algorithms is completed, each expert model is used to predict the input pig behavior data. The gating network dynamically selects the top-2 experts for weighted voting based on the input features, integrates the prediction results of each expert model, and finally outputs the judgment result of whether the behavior is abnormal based on the weighted selection of the gating network, thereby generating the final prediction result. The specific steps are as follows: S41: Use a gating network to assign a weight to each expert model based on the input features: The gating network is a mechanism for selecting expert models. It assigns different expert weights to each sample based on the input features, thereby achieving the final prediction of weighted voting. Each expert model makes predictions based on the input features, and the gating network determines which experts contribute more to the final prediction by learning the relationship between the input features and the expert selection.

[0069] In this embodiment, the gated network is a neural network composed of two fully connected layers, and its output is the weight of each expert, where the weight is calculated by the softmax function. The softmax function converts the original output of the gated network into a normalized weight distribution, thereby assigning a weight to each expert model. The network structure is as follows:

[0070]

[0071]

[0072] Where X is the input feature, is a learnable parameter, and They are the middle layer and output layer of the network respectively. i represents the index of the sample, j represents the expert index, is the i-th output of the gating network i The unnormalized weight of samples for the jth expert. is the normalized weight, which represents the contribution of the i-th sample to the j-th expert. E is the total number of expert models.

[0073] Model training: The training process of the gating network uses the cross entropy loss function L to minimize the prediction error of each sample:

[0074] in is an indicator function, which is 1 if the true label of sample i is the predicted category of expert j, and 0 otherwise. is the weight of the jth expert generated by the gating network for sample i.

[0075] S42: Summary of judgment results: In the prediction stage, the gating network calculates the expert weights of each sample based on the input feature X. Subsequently, the network selects the most appropriate expert for prediction based on these weights and makes the final judgment through a weighted voting mechanism. In this way, the gating network can synthesize the judgments of various expert models and combine their advantages to make more accurate predictions.

[0076] Weighted voting: In order to increase the contribution of certain expert models, the voting results are weighted according to the performance of the model. For example, if a model performs better during training, the vote of that model can be given a higher weight; in this way, experts with excellent performance will have a greater influence in the final decision.

[0077] Final judgment: Through the ensemble voting method, the gating network combines the prediction results of multiple experts and finally outputs a judgment on whether the behavior is abnormal. This method reduces the possible misjudgment of a single model by integrating the judgments of multiple models, thereby improving the robustness and accuracy of the entire system.

[0078] By adopting this multi-model weighted voting method, the system can fully utilize the advantages of each expert model, reduce the deviation and misjudgment rate of a single algorithm, and achieve more stable and accurate animal abnormal behavior detection. This integrated method makes the final prediction results more reliable, thereby improving the performance of the overall detection system.

[0079] The following is a comparison of the prediction results on 60 test samples, see Fig. 9 :

[0080] As can be seen from the table, the MoE model proposed in this patent performs well in both accuracy and F1 score, both of which are 0.93, showing its advantages in prediction stability and precision-recall balance. Random Forest and Extra Trees followed closely, with accuracy rates of 0.88 and 0.86 respectively, showing robust performance and suitable for abnormal behavior detection. XGBoost performed well, but slightly worse than the first two, with an accuracy rate of 0.83 and an F1 score of 0.83. The distance threshold method has an accuracy rate of 0.86, but an F1 score of 0.82, showing certain false positives or negatives. KNN performed the worst in all indicators, with an accuracy rate and F1 score of 0.72, indicating that it has poor adaptability to the characteristics of the data set. Overall, the MOE model is better than the traditional model, which also has higher performance.

[0081] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.

[0082] Example 3 This embodiment is used to implement the principle of the above method embodiment to build an animal abnormality detection system based on a hybrid expert model, including a data acquisition submodule, a distance threshold submodule, a machine learning submodule and an integrated voting submodule; A data acquisition submodule is used to obtain animal behavior data; A distance threshold submodule is used to determine whether the animal behavior is abnormal by using a distance threshold method; A machine learning submodule is used to determine whether the animal behavior is abnormal using machine learning methods; The integrated voting submodule is used to determine the final judgment result by integrated voting.

[0083] Each sub-module is mainly used to implement each step of the method embodiment, which will not be described in detail here.

[0084] It should be pointed out that, according to the needs of implementation, the various steps / components described in this application can be split into more steps / components, and two or more steps / components or partial operations of steps / components can be combined into new steps / components to achieve the purpose of the present invention.

[0085] This embodiment also includes a processor, a communication interface, a memory and a communication bus; wherein the processor, the communication interface and the memory communicate with each other via the communication bus; a computer program is stored in the memory, and when the program is executed by the processor, the processor executes the steps of an animal abnormality detection method based on a hybrid expert model.

[0086] This embodiment also provides a computer-readable storage medium on which executable instructions are stored. When the instructions are executed by a processor, the processor implements an animal abnormality detection method based on a hybrid expert model.

[0087] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware.

[0088] Moreover, the present application may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.

[0089] The present application is described with reference to the flowchart of the method and computer program product according to Embodiment 1 of the present application and the block diagram of the device (system) according to Embodiment 3. It should be understood that each process or box in the flowchart or block diagram, and the combination of processes or boxes in the flowchart or block diagram can be implemented by computer program instructions.

[0090] These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the process Figure 1 A process or multiple processes or boxes Figure 1 An animal anomaly detection system based on a hybrid expert model that specifies functions in one or more boxes.

[0091] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes or boxes Figure 1 A function specified in one or more boxes.

[0092] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes or boxes Figure 1 The steps of an animal anomaly detection method based on a hybrid expert model are specified in one or more boxes.

[0093] The above embodiments are only used to illustrate the design ideas and features of the present invention, and their purpose is to enable those skilled in the art to understand the content of the present invention and implement it accordingly. The protection scope of the present invention is not limited to the above embodiments. Therefore, any equivalent changes or modifications made based on the principles and design ideas disclosed by the present invention are within the protection scope of the present invention.

Claims

1. An animal anomaly detection method based on a hybrid expert model, characterized in that: The following steps are involved: S1: Obtain animal behavior data; S2: Use the distance threshold method to determine whether the animal behavior is abnormal; S3: Use machine learning to determine whether animal behavior is abnormal; S4: Use a hybrid expert model to determine the final judgment result.

2. The method for detecting anomalies in animals based on a hybrid expert model according to claim 1, characterized in that: In the step S2, the specific steps are: S21: Modeling healthy behavior patterns in animals; S22: Establishing the population of animal behavior and initializing the combination of population and behavioral characteristics weights; S23: calculating the weighted Euclidean distance between the behavioral characteristics of the tested animal and the behavioral characteristics of the healthy behavioral pattern; S24: Based on the weighted Euclidean distance, abnormal animal behaviors and healthy animal behaviors were divided by clustering operation; S25: using the clustering-based partition threshold to calculate the fitness function as the optimization target of the genetic algorithm; S26: Optimizing the weight combination of behavioral features using genetic algorithm; S27: Use the optimized behavioral feature weight combination to perform distance threshold-based anomaly detection on animal behavior.

3. The method for detecting anomalies in animals based on a hybrid expert model according to claim 2, characterized in that: In the step S21, the specific steps are: S211: Collect behavioral data from healthy animals; S212: Calculate the Euclidean distance of all behavioral characteristics of healthy animals and construct healthy behavior patterns.

4. The method for detecting anomalies in animals based on a hybrid expert model according to claim 2, characterized in that: In the step S22, the specific steps are: Use genetic algorithm to initialize the population of animal behavior; each individual in the population represents a set of behavioral feature weight combinations; in the interval The initial weight value is randomly generated.

5. The method for detecting animal anomalies based on a hybrid expert model according to claim 2, characterized in that: In the step S24, the specific steps are: S241: Use K-means clustering method to divide the behavior of the animals to be tested into two clusters: healthy animal group and abnormal animal group; S242: Calculate the middle value of the cluster boundary value between the two clusters of the healthy animal group and the abnormal animal group as the classification threshold. If the weighted Euclidean distance is greater than the threshold, it is judged as abnormal behavior; if the weighted Euclidean distance is less than or equal to the threshold, it is judged as healthy behavior.

6. The animal anomaly detection method based on a hybrid expert model according to claim 1, characterized in that: In the step S3, the specific steps are: S31: extracting animal behavior characteristics from the input animal behavior data and converting them into numerical characteristics; S32: Use multiple machine learning algorithms as expert models to learn animal behavior characteristics from different perspectives, and train each expert model independently; S33: Using each trained expert model, determine whether the behavior of the animal to be tested is abnormal, and obtain a determination result of each model.

7. The method for detecting animal anomalies based on a hybrid expert model according to claim 6, characterized in that: In step S32, the machine learning algorithms used include ExtraTrees, Random Forest, XGBoost and K-nearest neighbor.

8. The animal anomaly detection method based on a hybrid expert model according to claim 1, characterized in that: In the step S4, the specific steps are: S41: Use a gating network to assign a weight to each expert model based on the input features; S42: Select an expert model for prediction based on the weights, and use a weighted voting mechanism to aggregate the distance threshold method and the output results of each expert model for final judgment; if the number of abnormal votes is greater than or equal to the number of normal votes, the behavior is determined to be abnormal; If the number of abnormal votes is less than the number of normal votes, it is considered normal.

9. The method for detecting animal anomalies based on a hybrid expert model according to claim 8, characterized in that: The step S4 further includes the following steps: The gating network is trained using a cross entropy loss function to minimize the prediction error for each sample.

10. An animal anomaly detection system based on a hybrid expert model, characterized in that: A data acquisition submodule is used to obtain animal behavior data; A distance threshold submodule is used to determine whether the animal behavior is abnormal by using a distance threshold method; A machine learning submodule is used to determine whether the animal behavior is abnormal using machine learning methods; The hybrid expert submodule is used to determine the final judgment result using a hybrid expert model.

Citation Information

Cited By

  • Unbiased animal behavior recognition method and system based on multi-scale feature fusion

    CN120260142A