Pet behavior distinguishing monitoring method and system

By obtaining pet behavior data during non-pregnancy and pregnancy, using Gaussian kernel function and LSTM model to optimize feature distinction and mean square error, dynamically adjusting the optical flow algorithm parameters, the poor generalization ability of pregnancy behavior monitoring caused by individual pets is solved, and accurate identification and early warning of pregnancy behavior is achieved.

CN120510647APending Publication Date: 2025-08-19SHANGHAI VETERINARY RESEARCH INSTITUTE CAAS (CHINESE ANIMAL HEALTH & EPIDEMIOLOGY CENTER SHANGHAI BRANCH)
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510605549.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-12
Publication Date
2025-08-19

AI Technical Summary

Technical Problem

The existing technology is difficult to adapt to pet individual differences, resulting in poor generalization ability of model when behavior changes during pregnancy, and the inability to accurately identify and warn of abnormal pet behaviors.

Method used

By obtaining pet behavior data during non-pregnancy and pregnancy, extracting feature sets and calculating probability density differences, building a dynamic behavior analysis model, using Gaussian kernel function and LSTM model to optimize feature distinction and mean square error, dynamically adjusting optical flow algorithm parameters, real-time monitoring of pregnancy behavior.

Benefits of technology

The model's ability to express and recognize individual behavior evolution characteristics during pregnancy has been improved, and the accuracy and early warning ability of recognition of behavior changes during pregnancy has been improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120510647A_ABST
    Figure CN120510647A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of pet monitoring, and discloses a pet behavior distinguishing and monitoring method and system, and the method comprises the steps: extracting a first behavior feature set and a second behavior feature set of a non-pregnancy stage and a pregnancy stage, calculating the probability density distribution difference of the first behavior feature set and the second behavior feature set based on a Gaussian kernel function, and obtaining a feature distinguishing degree; behavior change features of different stages can be described, feature sets of the two stages are further input into a pre-trained first LSTM model to obtain a feature mean square error, and a loss function of a second LSTM model is constructed in combination with a feature distinction degree to realize dynamic modeling and learning of behavior evolution differences. The method can improve the expression ability and recognition precision of the model on the individual behavior evolution characteristics in the pregnancy stage, thereby solving the problem of poor generalization ability of the model in the prior art.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of pet monitoring, and more particularly to a pet behavior differentiation and monitoring method and system. Background Art

[0002] At present, with the continuous growth in the number of household pets, the demand for intelligent monitoring of pet behavior continues to expand, especially in application scenarios such as pet health management, behavior training, and emotion recognition. Pet behavior monitoring technology based on video image recognition, sensor data acquisition and deep learning models has gradually matured. Related technologies usually collect multi-source data such as pets' movement trajectories, activity frequencies, physiological signals, etc. to build behavior recognition models to achieve classification of behavioral states and early warning of abnormal behaviors. Under non-special physiological conditions such as daily life, existing technologies can achieve relatively ideal recognition accuracy and processing effects in most general scenarios.

[0003] However, due to the widespread individual differences in pet breed, age, personality, body shape, etc., the behavioral changes exhibited by different individuals after entering pregnancy are significantly different and unpredictable. For example, some pets may show a significant decrease in activity in the early stages of pregnancy, while others may have almost no obvious changes. As the pregnancy progresses, the volatility and suddenness of behavioral performance also have individual dependence. Existing technologies mostly rely on static thresholds or fixed rules to establish behavioral recognition models, which are difficult to fully adapt to this individualized behavioral evolution law, resulting in poor generalization ability of the model in practical applications.

[0004] In view of this, the present invention proposes a pet behavior differentiation monitoring method and system to solve the above problems. Summary of the Invention

[0005] In order to overcome the above-mentioned defects of the prior art, the present invention provides a pet behavior differentiation and monitoring method and system.

[0006] To achieve the above object, the present invention provides the following technical solutions:

[0007] In a first aspect, a pet behavior differentiation and monitoring method is provided, comprising:

[0008] Acquire first behavior data of the target pet during the non-pregnancy stage, perform feature extraction on the first behavior data, and obtain a first behavior feature set;

[0009] Acquiring the second behavior data of the target pet during its pregnancy stage, performing feature extraction on the second behavior data, and obtaining a second behavior feature set;

[0010] The Gaussian kernel function is used to calculate the difference in probability density distribution between the first behavior feature set and the second behavior feature set to obtain the feature discrimination.

[0011] Input the first behavior feature set and the second behavior feature set into the pre-trained first LSTM model to obtain the feature mean square error, and construct the loss function of the second LSTM model based on the feature discrimination and the feature mean square error;

[0012] The parameters of the second LSTM model are optimized according to the loss function to obtain a dynamic behavior analysis model, which is used to monitor the behavior of target pets during pregnancy in real time.

[0013] In the above solution, the second behavior data includes second image data and second audio data, the second behavior feature set includes a second posture feature, a second motion trajectory, a second short-time energy value, and a second zero-crossing rate feature, and the method for obtaining the second motion trajectory includes:

[0014] Using a preset deep neural network model, the local movement direction of the target pet during pregnancy is predicted;

[0015] Dynamically adjust the parameters of the optical flow algorithm according to the local motion direction. The dynamic adjustment includes adjusting the search window radius and the number of iterations.

[0016] The second image data is processed based on the dynamically adjusted optical flow algorithm to obtain a second motion trajectory.

[0017] In the above scheme, the method of dynamically adjusting the parameters of the optical flow algorithm according to the local motion direction includes:

[0018] Calculate the direction consistency value and angular velocity change rate according to the local motion direction;

[0019] When the angular velocity change rate is less than a first preset angular velocity threshold, and the direction consistency value is less than the first preset consistency threshold, the search window radius of the optical flow algorithm is expanded to the first preset radius value, and the number of iterations is reduced to the first preset number value;

[0020] When the angular velocity change rate is greater than a second preset angular velocity threshold, and the direction consistency value is greater than the second preset consistency threshold, reducing the search window radius of the optical flow algorithm to a second preset radius value, and increasing the number of iterations to a second preset number value;

[0021] If any of the above state judgment conditions are not met, the search window radius and number of iterations of the optical flow algorithm remain unchanged;

[0022] Among them, the second preset angular velocity threshold is greater than the first preset angular velocity threshold, the second preset consistency threshold is greater than the first preset consistency threshold, the first preset radius value is greater than the second preset radius value, and the first preset number value is less than the second preset number value.

[0023] In the above solution, the method for calculating the direction consistency value and the angular velocity change rate of the local motion direction includes:

[0024] Based on the local motion direction, the optical flow direction vector of each pixel point in the preset local area is extracted, and the cosine value of the angle between each optical flow direction vector and the local motion direction is calculated;

[0025] And average all cosine values to get the directional consistency value;

[0026] Based on the local motion direction, the orientation change angle of the key points in the preset local area is extracted;

[0027] Divide the heading change angle by the preset time interval to obtain the angular velocity change rate.

[0028] In the above solution, the method of calculating the difference in probability density distribution between the first behavior feature set and the second behavior feature set using a Gaussian kernel function to obtain feature discrimination includes:

[0029] Calculate a first probability density value corresponding to the first behavior feature set and a second probability density value corresponding to the second behavior feature set respectively;

[0030] Adjusting a preset standard Gaussian kernel bandwidth to a real-time Gaussian kernel bandwidth based on the first probability density value and the second probability density value;

[0031] The feature discrimination is calculated based on the real-time Gaussian kernel bandwidth, the first probability density value, and the second probability density value.

[0032] In the above solution, the method for adjusting the preset standard Gaussian kernel bandwidth to the real-time Gaussian kernel bandwidth based on the first probability density value and the second probability density value includes:

[0033] Align the first probability density value and the second probability density value according to a preset time window, and calculate the distribution difference index in each window;

[0034] According to the size of the distribution difference index, the corresponding difference weight is assigned, and the global difference index is calculated based on the distribution difference index and the corresponding difference weight;

[0035] The standard Gaussian kernel bandwidth is scaled according to the global difference metric to obtain the real-time Gaussian kernel bandwidth.

[0036] In the above solution, the method for calculating the distribution difference index in each window includes:

[0037] Pair the first probability density value and the second probability density value according to the same time index to obtain a first window density sequence and a second window density sequence in the corresponding time window;

[0038] For the current time window, the standard deviation of the density sequence of the first window and the density sequence of the second window is calculated, and the standard deviation is used as the distribution difference indicator.

[0039] In the above scheme, the method of scaling the standard Gaussian kernel bandwidth according to the global difference index to obtain the real-time Gaussian kernel bandwidth includes:

[0040] H=H0·exp(-α·D norm );

[0041] Where H is the real-time Gaussian kernel bandwidth, H0 is the standard Gaussian kernel bandwidth, exp(·) is the exponential function with the natural constant e as the base, β is the sensitivity coefficient, and D norm is the global difference indicator.

[0042] In the above solution, the method for constructing the loss function of the second LSTM model based on feature discrimination and feature mean square error includes:

[0043]

[0044] Where F is the loss function, α is the first weighting coefficient, D(S1, S2) is the feature discrimination, S1 is the first behavior feature set, S2 is the second behavior feature set, η is the second weighting coefficient, is the feature mean square error, is the next time step feature vector predicted by the second LSTM model at time step t, f t+1 is the actual feature vector of the next time step, and T is the time length of the feature sequence.

[0045] In a second aspect, a pet behavior differentiation monitoring system is provided, which is used to implement the above-mentioned pet behavior differentiation monitoring method, including:

[0046] A first feature module is used to obtain first behavior data of the target pet during the non-pregnancy stage, perform feature extraction on the first behavior data, and obtain a first behavior feature set;

[0047] The second feature module is used to obtain the second behavior data of the target pet during its pregnancy stage, perform feature extraction on the second behavior data, and obtain a second behavior feature set;

[0048] The first processing module is used to calculate the difference in probability density distribution between the first behavior feature set and the second behavior feature set using a Gaussian kernel function to obtain feature discrimination;

[0049] The second processing module is used to input the first behavior feature set and the second behavior feature set into the pre-trained first LSTM model to obtain the feature mean square error, and construct a loss function of the second LSTM model based on the feature discrimination and the feature mean square error;

[0050] Identification module: used to optimize the parameters of the second LSTM model according to the loss function to obtain a dynamic behavior analysis model, and use the dynamic behavior analysis model to perform real-time behavior monitoring of the target pet during pregnancy.

[0051] Compared with the prior art, the present invention has the following beneficial effects:

[0052] The present invention obtains first behavior data of a target pet during a non-pregnancy period, performs feature extraction on the first behavior data to obtain a first behavior feature set, obtains second behavior data of the target pet during a pregnancy period, performs feature extraction on the second behavior data to obtain a second behavior feature set, calculates the probability density distribution difference between the first behavior feature set and the second behavior feature set through a Gaussian kernel function to obtain feature discrimination, inputs the first behavior feature set and the second behavior feature set into a pre-trained first LSTM model to obtain a feature mean square error, constructs a loss function of a second LSTM model based on the feature discrimination and the feature mean square error, optimizes parameters of the second LSTM model according to the loss function, and obtains a dynamic behavior classification. Analysis model, real-time behavior monitoring of target pets in the pregnancy stage is performed through a dynamic behavior analysis model. The present invention extracts the first behavior feature set and the second behavior feature set of the non-pregnancy stage and the pregnancy stage, and calculates the probability density distribution difference between the two based on the Gaussian kernel function to obtain the feature discrimination, which can characterize the behavioral change characteristics of different stages. The feature sets of the two stages are further input into the pre-trained first LSTM model to obtain the feature mean square error, and the loss function of the second LSTM model is constructed in combination with the feature discrimination to realize dynamic modeling and learning of behavioral evolution differences. This method can improve the model's expression ability and recognition accuracy of the individual behavioral evolution characteristics of the pregnancy stage, thereby solving the problem of poor generalization ability of the model in the existing technology. BRIEF DESCRIPTION OF THE DRAWINGS

[0053] Figure 1 A schematic diagram of a process for distinguishing and monitoring pet behaviors in the present invention;

[0054] Figure 2 Schematic diagram of the flow of the method for calculating the direction consistency value and the angular velocity change rate according to the local motion direction in the present invention;

[0055] Figure 3 The figure is a structural diagram of a pet behavior differentiation and monitoring system in the present invention. DETAILED DESCRIPTION

[0056] Hereinafter, embodiments of the present invention will be described with reference to the accompanying drawings, but it should be understood that these descriptions are merely exemplary and are not intended to limit the scope of the present invention. In the following detailed description, for ease of explanation, many specific details are set forth to provide a comprehensive understanding of the embodiments of the present invention. However, it is obvious that one or more embodiments may also be implemented without these specific details. In addition, in the following description, descriptions of well-known structures and technologies are omitted to avoid unnecessary confusion of the concepts of the present invention.

[0057] All terms used herein (including technical and scientific terms) have the meanings commonly understood by those skilled in the art. Unless otherwise defined, it should be noted that the terms used herein should be interpreted as having a meaning consistent with the context of this specification and should not be interpreted in an idealized or overly rigid manner.

[0058] In the technical solution of the present invention, the user information involved (including but not limited to user personal information, user image information, user device information, such as location information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) are all information and data authorized by the user or fully authorized by all parties, and the collection, storage, use, processing, transmission, provision, disclosure and application of relevant data comply with relevant laws, regulations and standards, take necessary confidentiality measures, do not violate public order and good morals, and provide corresponding operation entrances for users to choose to authorize or refuse.

[0059] Example 1

[0060] See also Figure 1 As shown, this embodiment discloses a pet behavior differentiation and monitoring method, including:

[0061] S10: Acquire first behavior data of the target pet during its non-pregnancy period, perform feature extraction on the first behavior data, and obtain a first behavior feature set;

[0062] In this embodiment, the target pet can be a mammal such as a dog or cat that has a human breeding background and whose behavioral characteristics have obvious stage differences during pregnancy. The first behavioral data includes first image data and first audio data. The first image data refers to continuous video frames or image sequences of the target pet obtained by an image acquisition device in the non-pregnancy stage, which is used to reflect its posture, movement changes and spatial behavioral characteristics; the first audio data refers to the audio signal generated by the target pet collected by a sound acquisition device in the non-pregnancy stage, which is used to reflect its behavior-related sound characteristics such as call frequency, intensity, rhythm, etc.

[0063] The first behavior data includes first image data and first audio data. The method of extracting features from the first behavior data to obtain a first behavior feature set includes:

[0064] Extracting skeleton key points of the target pet in the first image data through a preset posture estimation network model to obtain a first posture feature;

[0065] extracting a first motion trajectory of the target pet from the first image data by using an optical flow algorithm;

[0066] Dividing the first audio data into time frames of a preset length, summing the squares of audio signal samples of each frame, and calculating a first short-time energy value of each frame;

[0067] Counting the number of times the audio signal sample sign changes in each frame to obtain the first zero-crossing rate feature of each frame;

[0068] The first posture feature, the first motion trajectory, the first short-time energy value and the first zero-crossing rate feature are taken as a first behavior feature set.

[0069] It should be noted that the posture estimation network model can be an OpenPose model or an HRNet model, which is used to extract the skeletal key points of the target pet from the first image data to characterize its posture change characteristics. The preset length can be 25 milliseconds per frame and the frame shift is 10 milliseconds, which is suitable for temporal feature modeling of most pet calls. The short-time energy value represents the vocal intensity of the target pet in each time frame, which is used to reflect its behavioral activity and physiological excitement state. The zero-crossing rate feature represents the rhythmicity of the frequency change in the audio signal, which can reflect the urgency and emotional fluctuations of the target pet's call. The optical flow algorithm is a prior art and will not be elaborated on in this embodiment.

[0070] For example, the audio signal is divided into multiple time frames according to a preset length (such as 25 milliseconds), the frame shift between adjacent frames is 10 milliseconds, and assuming the sampling rate is (for example, 44.1kHz), the number of samples per frame is:

[0071] N = frame length × f s =0.025×44100=1102;

[0072] All sample values in each frame are squared and summed to obtain the short-time energy value.

[0073] In this embodiment, by combining the posture feature vector, motion trajectory vector, short-time energy value and zero-crossing rate feature as the first behavioral feature set, it is possible to not only extract the target pet's action pattern, activity frequency and spatial movement trajectory from the visual dimension, but also capture its call intensity, frequency rhythm and other sound behavior information from the auditory dimension, thereby constructing a multimodal behavioral feature representation covering posture, dynamics and sound.

[0074] This first behavioral feature set can comprehensively reflect the target pet's daily behavioral habits and state stability during the non-pregnancy stage, forming an individualized behavioral baseline model, which facilitates the subsequent accurate identification of behavioral deviations and abnormal warnings during the pregnancy stage. Compared with traditional methods that only use a single modality or low-dimensional features, this solution realizes joint modeling of multiple levels of space, time series, energy and spectrum in the feature dimension, improving the system's ability to express individual behavioral differences.

[0075] S20: acquiring second behavior data of the target pet during its pregnancy period, performing feature extraction on the second behavior data, and obtaining a second behavior feature set;

[0076] Similarly, in this embodiment, the second behavioral data includes second image data and second audio data. The second image data refers to continuous video frames or image sequences of the target pet acquired by an image acquisition device during the pregnancy stage. The second audio data refers to the audio signals generated by the target pet acquired by a sound acquisition device during the pregnancy stage. It is worth noting that the difference between the non-pregnancy stage and the pregnancy stage is mainly reflected in changes in the target pet's activity range, posture stability, vocalization frequency, and emotional behavior. The pregnancy stage is usually accompanied by characteristics such as reduced movement, changes in posture structure, and increased fluctuations in the rhythm of the call.

[0077] In this embodiment, the second behavioral feature set includes a second posture feature, a second motion trajectory, a second short-time energy value and a second zero-crossing rate feature. The methods for obtaining the second posture feature, the second short-time energy value and the second zero-crossing rate feature are the same as the methods for obtaining the corresponding first posture feature, the first short-time energy value and the first zero-crossing rate feature, respectively, so this embodiment will not go into details about this.

[0078] The method of obtaining the second motion trajectory includes:

[0079] Using a preset deep neural network model, the local movement direction of the target pet during pregnancy is predicted;

[0080] Dynamically adjust the parameters of the optical flow algorithm according to the local motion direction. The dynamic adjustment includes adjusting the search window radius and the number of iterations.

[0081] The second image data is processed based on the dynamically adjusted optical flow algorithm to obtain a second motion trajectory.

[0082] Methods for dynamically adjusting the parameters of the optical flow algorithm based on the local motion direction include:

[0083] Calculate the direction consistency value and angular velocity change rate according to the local motion direction;

[0084] When the angular velocity change rate is less than a first preset angular velocity threshold, and the direction consistency value is less than the first preset consistency threshold, the search window radius of the optical flow algorithm is expanded to the first preset radius value, and the number of iterations is reduced to the first preset number value;

[0085] When the angular velocity change rate is greater than a second preset angular velocity threshold, and the direction consistency value is greater than the second preset consistency threshold, reducing the search window radius of the optical flow algorithm to a second preset radius value, and increasing the number of iterations to a second preset number value;

[0086] If any of the above state judgment conditions are not met, the search window radius and number of iterations of the optical flow algorithm remain unchanged;

[0087] Among them, the second preset angular velocity threshold is greater than the first preset angular velocity threshold, the second preset consistency threshold is greater than the first preset consistency threshold, the first preset radius value is greater than the second preset radius value, and the first preset number value is less than the second preset number value.

[0088] It should be noted that in the scenario of pregnancy behavior monitoring, the target pet often exhibits low-frequency, low-amplitude but stage-specific behavioral changes, such as lying posture adjustment, slow movement, or periodic abdominal ups and downs. However, the optical flow algorithms widely used in the existing technology (such as Farneback or RAFT) usually process all video frames with a fixed search window radius and number of iterations, and lack the ability to dynamically adapt to differences in target motion patterns. This "static parameter setting" will lead to two significant problems: First, tracking failure or misjudgment is prone to occur when identifying slow, non-centralized movements (such as breathing micro-movements when lying down during pregnancy); second, it cannot provide sufficient motion details when identifying fast, centralized movements (such as turning), affecting trajectory accuracy.

[0089] Based on the above technical background and problems, this embodiment proposes to predict the local motion direction through a deep neural network, and dynamically adjust the optical flow algorithm parameters in combination with the directional consistency value and the angular velocity change rate. When the target pet is detected to be in a state of low angular velocity change (such as lower than the first preset angular velocity threshold) and low directional consistency (such as lower than the first preset consistency threshold), it usually corresponds to slow and scattered movement patterns such as lying down during pregnancy and abdominal heaving. At this time, by expanding the radius of the optical flow search window and reducing the number of iterations, it helps to improve the perception of small and scattered behaviors; and when the angular velocity change rate is high (such as exceeding the second preset angular velocity threshold) and the directional consistency is strong (such as exceeding the second preset consistency threshold), it usually reflects concentrated and fast movement behaviors such as the pet turning around. At this time, narrowing the search window and increasing the number of iterations can more accurately focus on the fast rotation area and improve the trajectory extraction accuracy.

[0090] It should be added that the above-mentioned deep neural network model can be an I3D (Inflated3D ConvNet) model based on a 3D convolution structure. By performing space-time joint modeling on the local area of the continuous video frames of the target pet, its motion change trend in the current time period is extracted, and the local dominant motion direction of the next frame is predicted based on this. Predicting the motion change trend through a deep neural network model is an existing technology, and this embodiment will not go into details about it.

[0091] Methods for calculating the direction consistency value and the angular velocity change rate based on the local motion direction include:

[0092] Based on the local motion direction, the optical flow direction vector of each pixel point in the preset local area is extracted, and the cosine value of the angle between each optical flow direction vector and the local motion direction is calculated;

[0093] And average all cosine values to get the directional consistency value;

[0094] Based on the local motion direction, the orientation change angle of the key points in the preset local area is extracted;

[0095] Divide the heading change angle by the preset time interval to obtain the angular velocity change rate.

[0096] In this embodiment, the local area refers to a rectangular or elliptical area in the image that is centered on the local dominant motion direction predicted by the deep neural network in the current frame and expanded along this direction, preferentially covering the abdomen, trunk or frequently active limbs of the target pet, and is used to capture more significant local motion changes in pregnancy behavior. The key point refers to the skeletal structure point of the target pet in the image frame identified by the posture estimation network (such as OpenPose or HRNet), including but not limited to the head, trunk center, forelimb and hindlimb joints, tail root, etc., which are used to reflect the anatomical key positions of its overall posture changes and local rotation trends.

[0097] In the scenario of pet behavior monitoring during pregnancy, the target pet often exhibits weak, slow, and highly localized movement characteristics, such as slow turning over while lying down, periodic abdominal fluctuations, and small adjustments of the limbs. The spatial distribution of these behaviors is obviously localized, and is accompanied by problems such as small movement amplitude, long duration, and unstable direction. In traditional optical flow algorithms, the evaluation of motion status is often based on global optical flow field analysis of the entire frame image, lacking accurate perception of "local motion trends", resulting in low tracking accuracy in slow behavior recognition and untimely response to rapid motion changes.

[0098] Therefore, this embodiment predicts the local motion direction through a deep neural network model, and constructs a local area related to it based on this. The direction consistency value and angular velocity change rate are calculated in the local area, which can realize the dynamic evaluation of the motion state in the target area. The direction consistency value can reflect whether the motion vector in the area is in the same direction, and assist in identifying concentrated movement (such as turning) or dispersed micro-movement (such as breathing); the angular velocity change rate tracks the direction changes of key points to determine whether the rotation behavior is significant, and effectively distinguish between states such as stillness or slow changes and rapid turning.

[0099] S30: Calculating the difference in probability density distribution between the first behavior feature set and the second behavior feature set using a Gaussian kernel function to obtain feature discrimination;

[0100] In this embodiment, feature discrimination refers to an indicator used to measure the degree of difference in the probability density distribution between the first behavioral feature set and the second behavioral feature set, reflecting the separability of the two in behavioral patterns. The larger the feature discrimination value, the more obvious the distribution difference between the first behavioral feature set and the second behavioral feature set, that is, the more significant the behavioral difference between the two stages, which is conducive to the subsequent model to accurately identify behavioral abnormalities in the pregnancy state; conversely, if the value is small, it means that the distribution of behavioral characteristics of the two stages is relatively overlapping, and the change in behavioral pattern is not obvious.

[0101] Methods for calculating the difference in probability density distribution between the first behavior feature set and the second behavior feature set using a Gaussian kernel function to obtain feature discrimination include:

[0102] Calculate a first probability density value corresponding to the first behavior feature set and a second probability density value corresponding to the second behavior feature set respectively;

[0103] Adjusting a preset standard Gaussian kernel bandwidth to a real-time Gaussian kernel bandwidth based on the first probability density value and the second probability density value;

[0104] The feature discrimination is calculated based on the real-time Gaussian kernel bandwidth, the first probability density value, and the second probability density value.

[0105] The method for calculating the first probability density value corresponding to the first behavior feature set includes:

[0106]

[0107] Where p(x) represents the first probability density value at position x, N represents the number of samples in the first behavioral feature set, d represents the dimension of the first behavioral feature set, h represents the bandwidth parameter of the Gaussian kernel function, and x′ i represents the first line feature vector after normalization of the i-th row, ||xx′ i || represents the test point x and the sample point x′ iThe Euclidean distance between them, K(·) is represented as the Gaussian kernel function.

[0108] It can be understood that the acquisition logic of the second probability density value in the above is the same as the acquisition logic of the first probability density value, and the Gaussian kernel function is also used for calculation, and the bandwidth of the Gaussian kernel function is not adjusted. However, when calculating the feature discrimination, it is necessary to adjust according to the actual situation. This is because the first probability density value and the second probability density value are both estimated by the Gaussian kernel function, and the bandwidth parameters used in each calculation can be the same preset standard bandwidth. However, when further used to calculate the feature discrimination, if a unified fixed bandwidth is still used, it may not be able to accurately reflect the subtle differences in distribution morphology between the first behavior feature set and the second behavior feature set. For this reason, a real-time Gaussian kernel bandwidth adjustment mechanism is introduced in this embodiment, that is, in the stage of calculating the feature discrimination, the kernel bandwidth parameters are dynamically adjusted according to the distribution characteristics of the first probability density value and the second probability density value in each dimension, thereby improving the sensitivity and recognition of the density difference quantification.

[0109] Specifically, in the scenario of pregnancy behavior monitoring, the first behavioral feature set (non-pregnancy period) and the second behavioral feature set (pregnancy period) may show different distribution convergence or discreteness in certain dimensions (such as motion trajectory frequency and short-time energy). At this time, if the unified bandwidth is continued to be used to estimate the distribution difference between the two, it may cause the behavioral pattern changes in certain key dimensions to be over-smoothed or misjudged as invalid differences, thereby affecting the discrimination ability of feature discrimination. By dynamically adjusting the bandwidth to make it more in line with the actual density distribution characteristics of the feature sets in each stage, the feature discrimination ability of small but key behavioral changes (such as abdominal micro-movements and increased trunk rotation trends during pregnancy) can be effectively enhanced.

[0110] The method of adjusting the preset standard Gaussian kernel bandwidth to the real-time Gaussian kernel bandwidth based on the first probability density value and the second probability density value includes:

[0111] Align the first probability density value and the second probability density value according to a preset time window, and calculate the distribution difference index in each window;

[0112] According to the size of the distribution difference index, the corresponding difference weight is assigned, and the global difference index is calculated based on the distribution difference index and the corresponding difference weight;

[0113] The standard Gaussian kernel bandwidth is scaled according to the global difference metric to obtain the real-time Gaussian kernel bandwidth.

[0114] Methods for calculating the distribution difference index in each window include:

[0115] Pair the first probability density value and the second probability density value according to the same time index to obtain a first window density sequence and a second window density sequence in the corresponding time window;

[0116] For the current time window, the standard deviation of the density sequence of the first window and the density sequence of the second window is calculated, and the standard deviation is used as the distribution difference indicator.

[0117] In this embodiment, the corresponding difference weight is assigned according to the size of the distribution difference index, which means that the standard deviation obtained in each time window is used as a measure of the degree of local distribution difference. The larger the standard deviation, the more obvious the difference in the probability density distribution of behavioral characteristics between the non-pregnant period and the pregnant period in the time window. Therefore, a higher weight should be given, and vice versa. Specifically, the normalized standard deviation can be used as the difference weight to ensure that the sum of the weights of all windows is 1, so that when calculating the global difference index, the contribution of the differences in each window to the change in the overall behavioral pattern can be comprehensively considered.

[0118] Based on the above-mentioned difference weights and corresponding distribution difference indicators, the method for calculating the global difference index is: multiply the distribution difference index of each window by its corresponding difference weight, and then perform weighted summation of the product results in all time windows to obtain a global distribution difference measurement value. This global difference index can not only accurately reflect the cumulative effect of behavioral changes during pregnancy, but also serve as an important reference indicator for real-time Gaussian kernel bandwidth adjustment, realizing dynamic adaptation to changes in feature distribution and improving the sensitivity and robustness of feature discrimination calculation.

[0119] Methods for scaling the standard Gaussian kernel bandwidth according to the global difference index to obtain the real-time Gaussian kernel bandwidth include:

[0120] H=H0·exp(-α·D norm );

[0121] Where H is the real-time Gaussian kernel bandwidth, H0 is the standard Gaussian kernel bandwidth, exp(·) is the exponential function with the natural constant e as the base, α is the sensitivity coefficient, and D norm is the global difference indicator.

[0122] This embodiment enhances the model's ability to depict differences in the distribution of pet behavior characteristics at different times, and measures the difference between the second behavior feature set in the probability density space. The method for obtaining feature discrimination is as follows:

[0123] D(S1,S2)=∫|p(x;H(x))-q(x;H(x))| 2 dx;

[0124] Where D(S1, S2) is the feature discrimination, p(x; H(x)) represents the probability density value calculated at position x based on the first behavioral feature set using the Gaussian kernel function with a real-time Gaussian kernel bandwidth, and q(x; H(x)) represents the probability density value calculated at position x based on the second behavioral feature set using the Gaussian kernel function with a real-time Gaussian kernel bandwidth.

[0125] This embodiment proposes dividing the probability density values of the first behavioral feature set and the second behavioral feature set into time windows, and then dynamically adjusting the bandwidth of the Gaussian kernel function based on the distribution differences between the windows. Compared with traditional methods, this scheme not only introduces a time-sensitive difference weight mechanism, but also constructs a global difference index for scaling the standard bandwidth, thereby achieving dynamic adaptation of feature density estimation. This can not only enhance the impact of the distribution mutation window on the overall discrimination, but also avoid the overfitting or underfitting problem caused by the uniform bandwidth on the non-significant change area.

[0126] By introducing a real-time bandwidth adjustment mechanism, the system's ability to perceive subtle changes in pregnancy behavior patterns can be effectively enhanced, and the accuracy and robustness of feature discrimination can be improved, thereby providing more discriminative input features for subsequent behavioral abnormality identification and pregnancy risk warnings, ultimately significantly improving the intelligent discrimination ability and practical value of the pregnancy behavior monitoring system.

[0127] S40: Inputting the first behavior feature set and the second behavior feature set into the pre-trained first LSTM model to obtain a feature mean square error, and constructing a loss function of the second LSTM model based on the feature discrimination and the feature mean square error;

[0128] In this embodiment, the feature mean square error represents the degree of difference in the temporal structure between the first behavioral feature set and the second behavioral feature set. It is a statistical indicator to measure the degree of deviation of the corresponding feature values of the two in the same time dimension. Specifically, the feature mean square error reflects the numerical similarity between the non-pregnancy behavioral feature sequence and the pregnancy behavioral feature sequence on a frame-by-frame or time-step basis. The larger the error value, the more obvious the dynamic feature difference between the two stages in the temporal evolution process, which may indicate that the behavioral pattern has changed significantly; conversely, if the error is small, it indicates that the temporal feature evolution of the two is relatively consistent and the behavioral state remains stable.

[0129] In this embodiment, the first LSTM model is a pre-trained difference evaluation model, whose input is a feature sequence pair consisting of a first behavioral feature set and a second behavioral feature set, and its output is the feature mean square error of the two at the corresponding time step. During the pre-training stage, the model constructs behavioral feature pairs of different stages (such as non-pregnancy and pregnancy) to supervise the learning of its temporal difference expression ability, so that when the model receives any set of behavioral feature sequence pairs, it can accurately output the mean square error value reflecting the degree of difference in its temporal structure. The training process uses the true difference between features as labels, and the model's generalization ability is improved by minimizing the prediction error.

[0130] Methods for obtaining feature mean square error include:

[0131]

[0132] Among them, FMS is the feature mean square error, is the next time step feature vector predicted by the second LSTM model at time step t, f t+1 is the actual feature vector of the next time step, and T is the time length of the feature sequence.

[0133] Methods for constructing the loss function of the second LSTM model based on feature discrimination and feature mean square error include:

[0134]

[0135] Where F is the loss function, α is the first weighting coefficient, D(S1, S2) is the feature discrimination, S1 is the first behavior feature set, S2 is the second behavior feature set, η is the second weighting coefficient, is the feature mean square error, is the next time step feature vector predicted by the second LSTM model at time step t, f t+1 is the actual feature vector of the next time step, and T is the time length of the feature sequence.

[0136] To address the problems of insensitive capture of behavioral sequence changes and low accuracy in anomaly identification in the existing technology, this embodiment introduces feature mean square error as a measurement indicator of temporal structure differences on the basis of calculating feature discrimination, and uses this to construct a composite loss function for the second LSTM model. Compared with traditional methods that only rely on differences in behavioral feature distribution, this embodiment further considers the dynamic evolution differences of behavioral feature sequences between non-pregnant and pregnant periods in the time dimension, allowing the model to simultaneously learn "distribution differences" and "temporal differences" during training, and more comprehensively understand the nature of behavioral changes.

[0137] By introducing the feature mean square error term, the LSTM model not only focuses on the discriminability of the overall behavioral characteristics, but also captures the prediction deviation of the two-stage behavioral sequence at each time step, thereby improving its sensitivity to subtle changes in the behavioral evolution process. This improvement enhances the model's ability to identify temporal abnormalities in pregnancy behavior, and ultimately significantly improves the practicality and intelligence of the monitoring system in behavioral warning and risk assessment scenarios.

[0138] S50: Parameters of the second LSTM model are optimized according to the loss function to obtain a dynamic behavior analysis model, and the dynamic behavior analysis model is used to perform real-time behavior monitoring of the target pet during pregnancy.

[0139] The method of optimizing the parameters of the second LSTM model according to the loss function to obtain the dynamic behavior analysis model includes:

[0140] The first and second behavioral feature sets are input into the second LSTM model, and the prediction output of each time step is obtained through forward propagation. and with the actual f t+1 Compare and calculate the total loss value of the current training round;

[0141] The back-propagation algorithm is used to calculate the gradient information corresponding to each parameter in the model, and the weight parameters of the LSTM model are updated in combination with the optimizer to gradually reduce the loss function value;

[0142] Repeat the forward propagation, loss calculation, and parameter update process until the loss function converges or the preset number of training rounds is reached, and finally obtain the optimized second LSTM model, that is, the dynamic behavior analysis model.

[0143] In the existing technology, pet behavior monitoring systems usually only rely on static features or single modal input to judge behavioral changes, and lack the ability to deeply model the differences in the temporal structure evolution of behavioral sequences. Especially in the pregnancy behavior recognition scenario, they are unable to effectively capture the subtle but warning-like dynamic changes between the non-pregnant and pregnant periods, such as abdominal fluctuations, reduced movement frequency, or fluctuations in vocal rhythm, resulting in insufficient sensitivity in behavioral abnormality recognition and frequent false alarms and missed alarms.

[0144] To solve the above problems, this embodiment proposes a method for parameter optimization of the second LSTM model based on a joint loss function. This loss function combines the feature discrimination index and the feature mean square error index. It not only measures the static differences of behavioral features at the probability distribution level, but also introduces the modeling of the frame-by-frame evolution deviation of the behavioral sequence in the time dimension. Through this fusion optimization mechanism, the second LSTM model can simultaneously learn the changing laws of the two-stage behaviors in both distribution and timing, significantly improving the accuracy and timeliness of the discrimination of the behavioral status during pregnancy.

[0145] In this embodiment, the first behavior data of the target pet is obtained during the non-pregnancy stage, and features are extracted from the first behavior data to obtain a first behavior feature set. The second behavior data of the target pet is obtained during the pregnancy stage, and features are extracted from the second behavior data to obtain a second behavior feature set. The probability density distribution difference between the first behavior feature set and the second behavior feature set is calculated using a Gaussian kernel function to obtain feature discrimination. The first behavior feature set and the second behavior feature set are input into a pre-trained first LSTM model to obtain a feature mean square error. A loss function of the second LSTM model is constructed based on the feature discrimination and the feature mean square error. The parameters of the second LSTM model are optimized according to the loss function to obtain a dynamic behavior classification. Analysis model, real-time behavior monitoring of target pets in the pregnancy stage is performed through a dynamic behavior analysis model. This embodiment extracts the first behavior feature set and the second behavior feature set of the non-pregnant and pregnant stages, and calculates the probability density distribution difference between the two based on the Gaussian kernel function to obtain the feature discrimination, which can characterize the behavioral change characteristics of different stages. The feature sets of the two stages are further input into the pre-trained first LSTM model to obtain the feature mean square error, and the loss function of the second LSTM model is constructed in combination with the feature discrimination to realize dynamic modeling and learning of behavioral evolution differences. This method can improve the model's expression ability and recognition accuracy of the individual behavioral evolution characteristics of the pregnancy stage, thereby solving the problem of poor model generalization ability in the existing technology.

[0146] Example 2

[0147] See also Figure 2 As shown, based on the same inventive concept, this embodiment discloses a pet behavior differentiation monitoring system. For details not provided in this embodiment, please refer to the description of the relevant parts in Example 1. The system includes:

[0148] A first feature module is used to obtain first behavior data of the target pet during the non-pregnancy stage, perform feature extraction on the first behavior data, and obtain a first behavior feature set;

[0149] In this embodiment, the target pet can be a mammal such as a dog or cat that has a human breeding background and whose behavioral characteristics have obvious stage differences during pregnancy. The first behavioral data includes first image data and first audio data. The first image data refers to continuous video frames or image sequences of the target pet obtained by an image acquisition device in the non-pregnancy stage, which is used to reflect its posture, movement changes and spatial behavioral characteristics; the first audio data refers to the audio signal generated by the target pet collected by a sound acquisition device in the non-pregnancy stage, which is used to reflect its behavior-related sound characteristics such as call frequency, intensity, rhythm, etc.

[0150] The first behavior data includes first image data and first audio data. The method of extracting features from the first behavior data to obtain a first behavior feature set includes:

[0151] Extracting skeleton key points of the target pet in the first image data through a preset posture estimation network model to obtain a first posture feature;

[0152] extracting a first motion trajectory of the target pet from the first image data by using an optical flow algorithm;

[0153] Dividing the first audio data into time frames of a preset length, summing the squares of audio signal samples of each frame, and calculating a first short-time energy value of each frame;

[0154] Counting the number of times the audio signal sample sign changes in each frame to obtain the first zero-crossing rate feature of each frame;

[0155] The first posture feature, the first motion trajectory, the first short-time energy value and the first zero-crossing rate feature are taken as a first behavior feature set.

[0156] The second feature module is used to obtain the second behavior data of the target pet during its pregnancy stage, perform feature extraction on the second behavior data, and obtain a second behavior feature set;

[0157] Similarly, in this embodiment, the second behavioral data includes second image data and second audio data. The second image data refers to continuous video frames or image sequences of the target pet acquired by an image acquisition device during the pregnancy stage. The second audio data refers to the audio signals generated by the target pet acquired by a sound acquisition device during the pregnancy stage. It is worth noting that the difference between the non-pregnancy stage and the pregnancy stage is mainly reflected in changes in the target pet's activity range, posture stability, vocalization frequency, and emotional behavior. The pregnancy stage is usually accompanied by characteristics such as reduced movement, changes in posture structure, and increased fluctuations in the rhythm of the call.

[0158] In this embodiment, the second behavioral feature set includes a second posture feature, a second motion trajectory, a second short-time energy value and a second zero-crossing rate feature. The methods for obtaining the second posture feature, the second short-time energy value and the second zero-crossing rate feature are the same as the methods for obtaining the corresponding first posture feature, the first short-time energy value and the first zero-crossing rate feature, respectively, so this embodiment will not go into details about this.

[0159] The method of obtaining the second motion trajectory includes:

[0160] Using a preset deep neural network model, the local movement direction of the target pet during pregnancy is predicted;

[0161] Dynamically adjust the parameters of the optical flow algorithm according to the local motion direction. The dynamic adjustment includes adjusting the search window radius and the number of iterations.

[0162] The second image data is processed based on the dynamically adjusted optical flow algorithm to obtain a second motion trajectory.

[0163] Methods for dynamically adjusting the parameters of the optical flow algorithm based on the local motion direction include:

[0164] Calculate the direction consistency value and angular velocity change rate according to the local motion direction;

[0165] When the angular velocity change rate is less than a first preset angular velocity threshold, and the direction consistency value is less than the first preset consistency threshold, the search window radius of the optical flow algorithm is expanded to the first preset radius value, and the number of iterations is reduced to the first preset number value;

[0166] When the angular velocity change rate is greater than a second preset angular velocity threshold, and the direction consistency value is greater than the second preset consistency threshold, reducing the search window radius of the optical flow algorithm to a second preset radius value, and increasing the number of iterations to a second preset number value;

[0167] If any of the above state judgment conditions are not met, the search window radius and number of iterations of the optical flow algorithm remain unchanged;

[0168] Among them, the second preset angular velocity threshold is greater than the first preset angular velocity threshold, the second preset consistency threshold is greater than the first preset consistency threshold, the first preset radius value is greater than the second preset radius value, and the first preset number value is less than the second preset number value.

[0169] Methods for calculating the direction consistency value and the angular velocity change rate based on the local motion direction include:

[0170] Based on the local motion direction, the optical flow direction vector of each pixel point in the preset local area is extracted, and the cosine value of the angle between each optical flow direction vector and the local motion direction is calculated;

[0171] And average all cosine values to get the directional consistency value;

[0172] Based on the local motion direction, the orientation change angle of the key points in the preset local area is extracted;

[0173] Divide the heading change angle by the preset time interval to obtain the angular velocity change rate.

[0174] The first processing module is used to calculate the difference in probability density distribution between the first behavior feature set and the second behavior feature set using a Gaussian kernel function to obtain feature discrimination;

[0175] In this embodiment, feature discrimination refers to an indicator used to measure the degree of difference in the probability density distribution between the first behavioral feature set and the second behavioral feature set, reflecting the separability of the two in behavioral patterns. The larger the feature discrimination value, the more obvious the distribution difference between the first behavioral feature set and the second behavioral feature set, that is, the more significant the behavioral difference between the two stages, which is conducive to the subsequent model to accurately identify behavioral abnormalities in the pregnancy state; conversely, if the value is small, it means that the distribution of behavioral characteristics of the two stages is relatively overlapping, and the change in behavioral pattern is not obvious.

[0176] Methods for calculating the difference in probability density distribution between the first behavior feature set and the second behavior feature set using a Gaussian kernel function to obtain feature discrimination include:

[0177] Calculate a first probability density value corresponding to the first behavior feature set and a second probability density value corresponding to the second behavior feature set respectively;

[0178] Adjusting a preset standard Gaussian kernel bandwidth to a real-time Gaussian kernel bandwidth based on the first probability density value and the second probability density value;

[0179] The feature discrimination is calculated based on the real-time Gaussian kernel bandwidth, the first probability density value, and the second probability density value.

[0180] The method of adjusting the preset standard Gaussian kernel bandwidth to the real-time Gaussian kernel bandwidth based on the first probability density value and the second probability density value includes:

[0181] Align the first probability density value and the second probability density value according to a preset time window, and calculate the distribution difference index in each window;

[0182] According to the size of the distribution difference index, the corresponding difference weight is assigned, and the global difference index is calculated based on the distribution difference index and the corresponding difference weight;

[0183] The standard Gaussian kernel bandwidth is scaled according to the global difference metric to obtain the real-time Gaussian kernel bandwidth.

[0184] Methods for calculating the distribution difference index in each window include:

[0185] Pair the first probability density value and the second probability density value according to the same time index to obtain a first window density sequence and a second window density sequence in the corresponding time window;

[0186] For the current time window, the standard deviation of the density sequence of the first window and the density sequence of the second window is calculated, and the standard deviation is used as the distribution difference indicator.

[0187] The second processing module is used to input the first behavior feature set and the second behavior feature set into the pre-trained first LSTM model to obtain the feature mean square error, and construct a loss function of the second LSTM model based on the feature discrimination and the feature mean square error;

[0188] Methods for obtaining feature mean square error include:

[0189]

[0190] Among them, FMS is the feature mean square error, is the next time step feature vector predicted by the second LSTM model at time step t, f t+1 is the actual feature vector of the next time step, and T is the time length of the feature sequence.

[0191] Methods for constructing the loss function of the second LSTM model based on feature discrimination and feature mean square error include:

[0192]

[0193] Where F is the loss function, α is the first weighting coefficient, D(S1, S2) is the feature discrimination, S1 is the first behavior feature set, S2 is the second behavior feature set, η is the second weighting coefficient, is the feature mean square error, is the next time step feature vector predicted by the second LSTM model at time step t, f t+1 is the actual feature vector of the next time step, and T is the time length of the feature sequence.

[0194] Identification module: used to optimize the parameters of the second LSTM model according to the loss function to obtain a dynamic behavior analysis model, and use the dynamic behavior analysis model to perform real-time behavior monitoring of the target pet during pregnancy.

[0195] To solve the above problems, this embodiment proposes a method for parameter optimization of the second LSTM model based on a joint loss function. This loss function combines the feature discrimination index and the feature mean square error index. It not only measures the static differences of behavioral features at the probability distribution level, but also introduces the modeling of the frame-by-frame evolution deviation of the behavioral sequence in the time dimension. Through this fusion optimization mechanism, the second LSTM model can simultaneously learn the changing laws of the two-stage behaviors in both distribution and timing, significantly improving the accuracy and timeliness of the discrimination of the behavioral status during pregnancy.

[0196] The flowcharts in the accompanying drawings illustrate the functions that may be implemented according to the methods of various embodiments of the present invention. In this regard, each box in the flowchart may represent a module, program segment or part of a code, and the above-mentioned module, program segment or part of the code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the boxes may also occur in an order different from that marked in the accompanying drawings. For example, two boxes shown in succession may actually be executed substantially in parallel, and they may sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the flowchart and the combination of boxes in the flowchart can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0197] Those skilled in the art will understand that the features described in the various embodiments of the present invention may be combined and / or coupled in various ways, even if such combinations or couplings are not explicitly described in the present invention. In particular, without departing from the spirit and teachings of the present invention, the features described in the various embodiments of the present invention may be combined and / or coupled in various ways, and all such combinations and / or couplings fall within the scope of the present invention.

[0198] The embodiments of the present invention are described above, but these embodiments are only for illustrative purposes and are not intended to limit the scope of the present invention. Although each embodiment is described above separately, it does not mean that the measures in each embodiment cannot be used in combination to advantage. The scope of the present invention is limited by the attached embodiments and their equivalents. Without departing from the scope of the present invention, those skilled in the art may make various substitutions and modifications, which should all fall within the scope of the present invention.

Claims

1. A pet behavior differentiation and monitoring method, characterized in that: include: Acquire first behavior data of the target pet during the non-pregnancy stage, perform feature extraction on the first behavior data, and obtain a first behavior feature set; Acquiring the second behavior data of the target pet during its pregnancy stage, performing feature extraction on the second behavior data, and obtaining a second behavior feature set; The Gaussian kernel function is used to calculate the difference in probability density distribution between the first behavior feature set and the second behavior feature set to obtain the feature discrimination. Input the first behavior feature set and the second behavior feature set into the pre-trained first LSTM model to obtain the feature mean square error, and construct the loss function of the second LSTM model based on the feature discrimination and the feature mean square error; The parameters of the second LSTM model are optimized according to the loss function to obtain a dynamic behavior analysis model, which is used to monitor the behavior of target pets during pregnancy in real time.

2. The pet behavior differentiation and monitoring method according to claim 1, characterized in that: The second behavior data includes second image data and second audio data, the second behavior feature set includes a second posture feature, a second motion trajectory, a second short-time energy value, and a second zero-crossing rate feature, and the method for obtaining the second motion trajectory includes: Using a preset deep neural network model, the local movement direction of the target pet during pregnancy is predicted; Dynamically adjust the parameters of the optical flow algorithm according to the local motion direction. The dynamic adjustment includes adjusting the search window radius and the number of iterations. The second image data is processed based on the dynamically adjusted optical flow algorithm to obtain a second motion trajectory.

3. The pet behavior differentiation and monitoring method according to claim 2, characterized in that: Methods for dynamically adjusting the parameters of the optical flow algorithm based on the local motion direction include: Calculate the direction consistency value and angular velocity change rate according to the local motion direction; When the angular velocity change rate is less than a first preset angular velocity threshold, and the direction consistency value is less than the first preset consistency threshold, the search window radius of the optical flow algorithm is expanded to the first preset radius value, and the number of iterations is reduced to the first preset number value; When the angular velocity change rate is greater than a second preset angular velocity threshold, and the direction consistency value is greater than the second preset consistency threshold, reducing the search window radius of the optical flow algorithm to a second preset radius value, and increasing the number of iterations to a second preset number value; If any of the above state judgment conditions are not met, the search window radius and number of iterations of the optical flow algorithm remain unchanged; Among them, the second preset angular velocity threshold is greater than the first preset angular velocity threshold, the second preset consistency threshold is greater than the first preset consistency threshold, the first preset radius value is greater than the second preset radius value, and the first preset number value is less than the second preset number value.

4. The pet behavior differentiation and monitoring method according to claim 3, characterized in that: Methods for calculating the direction consistency value and the angular velocity change rate based on the local motion direction include: Based on the local motion direction, the optical flow direction vector of each pixel point in the preset local area is extracted, and the cosine value of the angle between each optical flow direction vector and the local motion direction is calculated; And average all cosine values to get the directional consistency value; Based on the local motion direction, the orientation change angle of the key points in the preset local area is extracted; Divide the heading change angle by the preset time interval to obtain the angular velocity change rate.

5. The pet behavior differentiation and monitoring method according to claim 1, characterized in that: Methods for calculating the difference in probability density distribution between the first behavior feature set and the second behavior feature set using a Gaussian kernel function to obtain feature discrimination include: Calculate a first probability density value corresponding to the first behavior feature set and a second probability density value corresponding to the second behavior feature set respectively; Adjusting a preset standard Gaussian kernel bandwidth to a real-time Gaussian kernel bandwidth based on the first probability density value and the second probability density value; The feature discrimination is calculated based on the real-time Gaussian kernel bandwidth, the first probability density value, and the second probability density value.

6. The pet behavior differentiation and monitoring method according to claim 1, characterized in that: The method of adjusting the preset standard Gaussian kernel bandwidth to the real-time Gaussian kernel bandwidth based on the first probability density value and the second probability density value includes: Align the first probability density value and the second probability density value according to a preset time window, and calculate the distribution difference index in each window; According to the size of the distribution difference index, the corresponding difference weight is assigned, and the global difference index is calculated based on the distribution difference index and the corresponding difference weight; The standard Gaussian kernel bandwidth is scaled according to the global difference metric to obtain the real-time Gaussian kernel bandwidth.

7. The pet behavior differentiation and monitoring method according to claim 6, characterized in that: Methods for calculating the distribution difference index in each window include: Pair the first probability density value and the second probability density value according to the same time index to obtain a first window density sequence and a second window density sequence in the corresponding time window; For the current time window, the standard deviation of the density sequence of the first window and the density sequence of the second window is calculated, and the standard deviation is used as the distribution difference indicator.

8. The pet behavior differentiation and monitoring method according to claim 7, characterized in that: Methods for scaling the standard Gaussian kernel bandwidth according to the global difference index to obtain the real-time Gaussian kernel bandwidth include: H=H0·exp(-α·D norm ); Where H is the real-time Gaussian kernel bandwidth, H0 is the standard Gaussian kernel bandwidth, exp(·) is the exponential function with the natural constant e as the base, β is the sensitivity coefficient, and D norm is the global difference indicator.

9. The pet behavior differentiation and monitoring method according to claim 5, characterized in that: Methods for constructing the loss function of the second LSTM model based on feature discrimination and feature mean square error include: Where F is the loss function, α is the first weighting coefficient, D(S1, S2) is the feature discrimination, S1 is the first behavior feature set, S2 is the second behavior feature set, η is the second weighting coefficient, is the feature mean square error, is the next time step feature vector predicted by the second LSTM model at time step t, f t+1 is the actual feature vector of the next time step, and T is the time length of the feature sequence.

10. A pet behavior differentiation monitoring system, used to implement the pet behavior differentiation monitoring method according to any one of claims 1 to 9, characterized in that: include: A first feature module is used to obtain first behavior data of the target pet during the non-pregnancy stage, perform feature extraction on the first behavior data, and obtain a first behavior feature set; The second feature module is used to obtain the second behavior data of the target pet during its pregnancy stage, perform feature extraction on the second behavior data, and obtain a second behavior feature set; The first processing module is used to calculate the difference in probability density distribution between the first behavior feature set and the second behavior feature set using a Gaussian kernel function to obtain feature discrimination; The second processing module is used to input the first behavior feature set and the second behavior feature set into the pre-trained first LSTM model to obtain the feature mean square error, and construct a loss function of the second LSTM model based on the feature discrimination and the feature mean square error; Identification module: used to optimize the parameters of the second LSTM model according to the loss function to obtain a dynamic behavior analysis model, and use the dynamic behavior analysis model to perform real-time behavior monitoring of the target pet during pregnancy.