Insect tendency behavior analysis method
By combining a support vector machine classification algorithm with a dynamic kernel width adaptive adjustment strategy, the problem of inaccurate insect directional behavior analysis caused by fixed kernel function parameters in traditional methods is solved, achieving higher accuracy and more stable insect behavior category judgment.
Patent Information
- Application Number
- CN202510980290.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-16
- Publication Date
- 2025-10-31
AI Technical Summary
In existing methods for analyzing insect directional behaviors, traditional support vector machines cannot adaptively adjust the kernel function parameters, leading to inaccurate judgments of insect directional behavior categories.
A support vector machine classification algorithm combining dynamic kernel width adaptive adjustment strategy is adopted. By decomposing the conditional probability distribution between features and the posterior estimation of Bayesian network parameters, the kernel width is dynamically calculated. Combined with particle swarm optimization and self-supervised contrastive learning, the model parameters are optimized to achieve adaptive analysis of insect behavior data.
It improves the accuracy and stability of insect directional behavior category judgment, enhances the model's adaptability to different distribution characteristics, and improves classification accuracy and generalization ability.
Smart Images

Figure CN120873777A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of machine learning, and more specifically to a method for analyzing insect directional behavior. Background Technology
[0002] Insect directional behavior refers to the tendency of insects to approach or avoid a certain stimulus or environment. Directional behavior can be divided into positive directional behavior and negative directional behavior. Positive directional behavior (referred to as directional behavior) refers to the tendency of insects to approach a certain stimulus or environment, while negative directional behavior (referred to as avoidance behavior) refers to the avoidance behavior of animals towards a certain stimulus or environment.
[0003] Insects rely on directional tendencies to find food sources, avoid danger, find mates, and adapt to environmental changes. Different insect species have different response patterns to external stimuli. Therefore, by accurately analyzing the behavioral characteristics of insects under different stimuli, and understanding their behavioral patterns, motivations, survival strategies, and adaptability, we can achieve goals such as insect monitoring, agricultural pest control, and providing support for bionics and robot design (e.g., bionic navigation for robots, optimization of artificial intelligent sensing systems) in multiple fields such as ecology, agricultural pest control, and bionics.
[0004] Currently, insect behavior observations are mainly conducted in specific laboratory environments using instruments designed for insect behavior. First, various adjustable stimuli are emitted via a stimulus module, and stimulus parameter data is recorded. Then, insect behavior data under these stimuli is collected, including data on walking speed, acceleration, movement trajectory, gait, movement details, and dynamic pressure changes during gait. A data processing module integrates the stimulus parameter data and insect behavior data via a high-speed acquisition card and transmits it to a computer in real time. The computer then processes and analyzes the data using an insect directional behavior analysis method to determine the directional behavior category of the insect under specific stimuli.
[0005] Existing methods for analyzing insect directional behavior mainly rely on traditional support vector machines (SVMs) to analyze input data and determine the directional behavior category. Traditional SVMs require fixed or manually adjusted kernel function parameters and cannot adaptively adjust the kernel width according to the distribution characteristics of different features, resulting in some features having an excessively large or small impact on the model.
[0006] Therefore, existing methods for analyzing insect directional behaviors are not accurate in determining the categories of insect directional behaviors. Summary of the Invention
[0007] The technical problem to be solved by the present invention is to overcome the shortcomings of the prior art and provide an insect directional behavior analysis method that can more accurately determine the category of insect directional behavior.
[0008] To solve the above-mentioned technical problems, the present invention provides a method for analyzing insect directional behavior, comprising:
[0009] S1. Collect stimulus source parameter data and at least one insect behavior data as training data;
[0010] Insect behavioral data includes walking speed and movement trajectory;
[0011] S2. Preprocess the training data by converting the insect behavior data from continuous variables to discrete variables to obtain the processed training data;
[0012] S3. Extract features from the processed training data to obtain multiple feature data, and standardize the multiple feature data to obtain multiple standard feature data;
[0013] S4. Label the directional behavior category of each standard feature data;
[0014] S5. Input multiple standard feature data into the analysis model, and train the analysis model using a support vector machine classification algorithm that combines dynamic kernel width adaptive adjustment strategy to obtain the trained analysis model;
[0015] The dynamic kernel width adaptive adjustment strategy is combined to dynamically calculate the kernel width parameter by decomposing the conditional probability distribution between features and fusing the posterior estimate of Bayesian network parameters.
[0016] S6. Collect new stimulus parameter data and new insect behavior data as input data. Preprocess the input data by converting the new insect behavior data from continuous variables to discrete variables to obtain processed input data. After feature extraction and standardization of the processed input data, input it into the trained analysis model. The trained analysis model outputs the directional behavior category of the input data.
[0017] As a further improvement of the present invention: the stimulus source includes sound waves, light waves and chemical signals.
[0018] As a further improvement of the present invention: the support vector machine classification algorithm training and analysis model in S5, which combines a dynamic kernel width adaptive adjustment strategy, includes:
[0019] S501. The initial width of the support vector machine kernel function is determined by calculating the variance of the sample features, and the regularization parameter is set using the reciprocal of the feature standard deviation;
[0020] S502. A dynamic kernel width adaptive adjustment strategy is adopted to perform dynamic kernel width adaptive adjustment;
[0021] S503. Calculate the loss function of the support vector machine, use the energy function to fuse the information gain loss and the support vector machine weight vector cube regularization term, and optimize the model parameters through global search;
[0022] S504. A self-supervised contrastive learning module is adopted, using unlabeled insect behavior data as an auxiliary data source. Different views are generated through random data augmentation methods. The contrastive loss function is used to narrow the distance between the feature representations of different views of the same sample and widen the distance between the feature representations of different samples. The self-supervised contrastive learning module is constrained by the contrastive loss.
[0023] S505. Update the parameters of the support vector machine model based on the dynamic learning rate;
[0024] S506. The support vector machine model is validated and fine-tuned through an active learning mechanism. Based on the uncertainty and entropy of the classification results, insect behavior data with unclear classification is automatically identified and selected to establish a feedback data sample library. After the selected samples are manually labeled and confirmed by those skilled in the art, the newly added labeled samples are fused into the original dataset to retrain the model.
[0025] S507. Repeat S502 to S506 until the model training is complete.
[0026] Preferably, the parameters of the support vector machine model updated based on the dynamic learning rate in S502 include:
[0027] S5021. By decomposing the conditional probability distribution between features and fusing the posterior estimate of Bayesian network parameters, a dynamic kernel width adaptive adjustment is performed to construct a Bayesian network to capture the dependencies of insect behavioral data, and the parameters of the Bayesian network are optimized using maximum a posteriori estimation.
[0028] S5022, the kernel width is optimized based on the particle swarm optimization strategy. When updating the particle speed and position in parallel at multiple scales, the historical best and global best information at different scales are weighted and fused to achieve multi-level exploration of kernel parameter configuration.
[0029] S5023. Combining the probability distribution output by Bayesian network inference with the position vector obtained by particle swarm optimization strategy, the kernel width is dynamically calculated, and the complexity of insect behavior data is quantified by probability ratio and entropy value.
[0030] Preferably, when the energy function is used to fuse the information gain loss and the support vector machine weight vector cube regularization term in S503, the formula for calculating the support vector machine loss function E is as follows:
[0031]
[0032] In the formula, i is a positive integer, and Ns Let L be the number of samples, L be the cross-entropy loss function, and C be the number of samples. u Here, j is the regularization parameter for the support vector machine, and J is the dimension of the support vector machine weight vector. For the cubic regularization term, w j For the j-th dimension of the support vector machine weight vector, L con For comparison loss functions.
[0033] Preferably, in S505, when updating the parameters of the support vector machine model based on the dynamic learning rate, the learning rate of the support vector machine in the (t+1)th iteration is... The calculation formula is:
[0034]
[0035] In the formula, Let be the learning rate of the support vector machine at the t-th iteration, and β be the learning rate adjustment coefficient of the support vector machine. Output the entropy value of the predicted probability for the support vector machine model in the t-th iteration.
[0036] The beneficial effects of this invention are as follows: The insect directional behavior analysis method provided by this invention is more accurate in determining the directional behavior categories of insects. This method uses a support vector machine (SVM) classification algorithm with a dynamic kernel width adaptive adjustment strategy to train the analysis model. By dynamically adjusting the kernel width, the SVM classification algorithm enables the kernel function to adapt to the distribution characteristics of insect behavior data, improving classification accuracy and thus enhancing the accuracy of the method's judgment. Attached Figure Description
[0037] Figure 1 This is a schematic diagram of the principle of the present invention;
[0038] Figure 2 This is a parameter sensitivity analysis diagram of the feature dispersion and regularization parameter of the present invention with respect to classification accuracy;
[0039] Figure 3 This is a graph showing the changing trend of the dynamic kernel width parameter during the training process according to the present invention.
[0040] Figure 4 This is a diagram illustrating the data processing steps of S6 in this invention;
[0041] Figure 5 This is a schematic diagram of the insect directional behavior analysis device of the present invention. Detailed Implementation
[0042] The specific embodiments of the present invention will be described in further detail below with reference to the accompanying drawings.
[0043] Definitions of relevant terms used in this invention:
[0044] (1) Continuous variable: refers to a variable that can take any value within a certain interval. Its value is continuous and two adjacent values can be infinitely divided, so it can take an infinite number of values. For example, the speed of an insect can be any real number such as 1.234cm / s or 1.235cm / s. Theoretically, it can take an infinite number of precise values. The speed is a continuous variable. Similarly, the trajectory of an insect is also continuous in space and can take any position in a plane or three-dimensional space.
[0045] (2) Discrete variables: refer to variables whose values are discrete and discontinuous.
[0046] like Figure 1 , Figure 4 As shown, the method for analyzing insect directional behavior provided by this invention includes:
[0047] S1. Different stimuli are emitted through the stimulus source module, and the behavioral responses of insects under different stimulus source conditions are recorded. Stimuli source parameter data and at least one insect behavior data are collected as training data. Each piece of training data includes a stimulus source parameter data and insect behavior data of the next insect stimulated by the stimulus source with that parameter.
[0048] Stimuli include sound waves, light waves, and chemical signals; the parameters of sound waves include sound wave release time, sound wave frequency, sound wave amplitude, and sound wave release direction; the parameters of light waves include light wave release time, light wave wavelength, light wave intensity, and light wave release direction; the parameters of chemical signals include chemical signal release time, chemical signal concentration, and chemical signal release direction.
[0049] Insect behavioral data includes walking speed, movement trajectory, and gait. Walking speed includes instantaneous speed, average speed, and acceleration, while movement trajectory includes the insect's position coordinates at different times.
[0050] S2. Preprocess the training data to ensure data quality; transform the insect behavior data from continuous variables to discrete variables to obtain processed training data;
[0051] S201. Clean the training data to remove irrelevant and / or noisy data;
[0052] Irrelevant data refers to data that is unrelated to insect behavior or stimuli, while noisy data refers to data that is erroneous, inaccurate, or significantly deviates from normal data.
[0053] S202. Detect and eliminate sensor errors, such as optical errors in optical sensors;
[0054] S203. Analyze the speed and trajectory of movement, and transform the speed and trajectory of movement from continuous variables into multiple discrete variables according to the predefined behavior pattern, and remove some data.
[0055] Predefined behavioral patterns refer to standards or rules set in advance by those skilled in the art based on their knowledge and experience in insect behavior or experimental objectives. In practical application, they manifest as follows:
[0056] (1) The speed of travel can be converted into two discrete variables:
[0057] When the velocity is between 0 and 0.5 cm / s, it is defined as a discrete variable "pause";
[0058] When the speed is greater than 0.5 cm / s, it is defined as the discrete variable "movement".
[0059] It can also be transformed into 4 discrete variables:
[0060] When the velocity is 0 to 0.5 cm / s, it is defined as a discrete variable "pause", indicating that the insect is in a basically still state;
[0061] When the speed is greater than 0.5 cm / s and less than or equal to 2 cm / s, it is defined as the discrete variable "slow movement";
[0062] When the speed is greater than 2 cm / s and less than or equal to 5 cm / s, it is defined as the discrete variable "medium speed".
[0063] When the speed is greater than 5 cm / s, it is defined as a discrete variable "fast line".
[0064] (2) The trajectory can be transformed into four discrete variables:
[0065] Taking the insect's initial direction of movement as the reference direction, for each point on the trajectory, calculate the angle between the direction of movement at that point and the reference direction. The calculation method is to use the dot product formula of vectors to calculate the angle between the vector between two adjacent points and the reference direction vector.
[0066] When the included angle is between 0° and 10°, the insect is considered to move in a straight line and is defined as the discrete variable "no offset", which means that the insect is in a basically stationary state.
[0067] When the included angle is between 10° and 90° and is in a clockwise direction, it is defined as the discrete variable "right offset";
[0068] When the included angle is between 10° and 90° and is counterclockwise (with a negative sign before the value), it is defined as the discrete variable "left offset";
[0069] When the included angle is greater than 90°, it is defined as the discrete variable "turning", indicating that the insect has turned at a relatively large angle.
[0070] To ensure the accuracy of the analysis of directional behaviors, it is necessary to eliminate the influence of complex behaviors on the experimental results. Among the discrete variables mentioned above, "pause" and "turning" are both considered complex behaviors. After classification, all stimulus parameter data and insect behavior data within the time periods corresponding to "pause" and "turning" were removed. We focused on recording all stimulus parameter data and insect behavior data within the time periods corresponding to the three key discrete variables: "movement," "right shift," and "left shift."
[0071] S201 to S202 are preprocessing steps, and S203 is the process of converting insect behavior data from continuous variables to discrete variables.
[0072] S3. Extract features from the processed training data to obtain multiple feature data, and standardize the multiple feature data to obtain multiple standard feature data;
[0073] S301. Select multiple time periods and extract different stimulus source parameter data and insect behavior data corresponding to different time periods from the processed training data to obtain multiple feature data.
[0074] For example, within time period A, the stimulus is a sound wave, the sound wave release time is 30s, the sound wave frequency is 100Hz, the sound wave amplitude is 60dB, the sound wave release direction is 0°, the insect's average speed during the time period is 2.7cm / s, the initial movement direction is 30°, the final movement direction is 0°, and the duration of the time period is 50s. Then the extracted feature data can be represented as: [sound wave", 30s, 100Hz, 60dB, 10°, 2.5m / s, 30°, 0°, 50s].
[0075] The direction of sound wave release refers to the angle between the direction of sound wave release and the reference direction, with the initial direction of the insect's movement as the reference direction.
[0076] The initial direction of movement refers to the angle between the insect's initial position and the reference direction during the time period, with the direction of sound wave release as the reference direction; the final direction of movement refers to the angle between the insect's final position and the reference direction during the time period, with the direction of sound wave release as the reference direction.
[0077] S302. Use mean-variance standardization to standardize each feature data so that the mean of each feature is 0 and the variance is 1, in order to eliminate the problem of scale inconsistency between different features.
[0078] S4. The directional behavior category of each standard feature data point is manually labeled by a person skilled in the art; the directional behavior category includes approach behavior and avoidance behavior.
[0079] When an insect exhibits behavior toward a stimulus in response to a stimulus, it is labeled as gravitational behavior; when an insect exhibits behavior away from a stimulus in response to a stimulus, it is labeled as avoidance behavior.
[0080] S5. Input multiple standard feature data into the analysis model, with each standard feature data as a sample. Use a support vector machine classification algorithm combined with a dynamic kernel width adaptive adjustment strategy to train the analysis model and obtain the trained analysis model.
[0081] Support Vector Machine (SVM) classification algorithms incorporating a dynamic kernel width adaptive adjustment strategy refer to SVM classification algorithms that use a dynamic kernel width adaptive adjustment strategy to adjust the kernel width. This strategy involves dynamically calculating the kernel width parameter by decomposing the conditional probability distributions between features and fusing posterior estimates of Bayesian network parameters. Furthermore, this method combines Bayesian networks and particle swarm optimization to enhance adaptability to complex behavioral features, thereby improving classification accuracy.
[0082] The support vector machine classification algorithm trained and analyzed using a dynamic kernel width adaptive adjustment strategy includes:
[0083] S501. The initial width of the support vector machine kernel function is determined by calculating the variance of the sample features, enabling the kernel function to adapt to the distribution range of insect behavior data. The regularization parameter is set using the reciprocal of the feature standard deviation, giving more stringent constraints to features with high dispersion. This avoids the problem of parameters being disconnected from the characteristics of insect behavior data in traditional methods, enhancing the model's adaptability to insect behavior data with different distributions. This is expressed as:
[0084] The kernel width parameter is the width parameter of the support vector machine kernel function, σ. u The calculation formula is:
[0085]
[0086] In the formula, N s d represents the sample size, indicating the size of the insect behavior dataset; d is a positive integer, x d Let μ be the feature vector of the d-th sample, and μ be the mean of the sample features.
[0087] The regularization parameter C of the support vector machine u The calculation formula is:
[0088]
[0089] In the formula, std(X) u ) is the characteristic matrix X u The standard deviation of X represents the dispersion of insect behavior data. For example, when the insect movement direction is highly dispersed in the experiment, reducing the regularization parameter corresponding to this feature allows the model to avoid being sensitive to misclassification of individual abnormal angles, thereby enhancing the generalization ability of the support vector machine model; u The feature matrix of the samples input to the support vector machine;
[0090] S502. A dynamic kernel width adaptive adjustment strategy is adopted to perform dynamic kernel width adaptive adjustment;
[0091] S5021. Traditional Support Vector Machines (SVMs) mostly assume that features are independent. However, insect behavioral features (such as speed, direction of movement, and stimulus direction) have complex dependencies on each other. Therefore, traditional SVMs fail to effectively model these dependencies and ignore the complex structure of feature interactions. Here, we decompose the conditional probability distribution between features and integrate the posterior estimate of Bayesian network parameters for dynamic kernel width adaptive adjustment. This constructs a Bayesian network to capture the dependencies in insect behavioral data. Maximum a posteriori (MAP) estimation is used to optimize the parameters of the Bayesian network, enabling the SVM kernel function to more accurately reflect the inherent patterns of insect behavioral data and improving the SVM model's ability to represent high-dimensional nonlinear relationships. For example, there is a correlation between insect walking speed and direction of movement (directional behavior is often characterized by higher walking speed and smaller direction of movement). By modeling the probability distribution of the direction of movement feature under the condition of walking speed feature, the Bayesian network automatically strengthens the weight of this correlated feature in the kernel function, better capturing the typical feature combination of directional behavior.
[0092] Characteristic matrix X u The joint probability distribution is composed of the conditional probabilities of each feature and the prior probabilities of the parameters, and the feature matrix X u The joint probability distribution P(X) u The formula for calculating ) is:
[0093]
[0094] In the formula, i is a positive integer, and N s Let P(X) be the sample size. u,i |Pa(X u,i )) represents feature X u,i In its parent node set Pa(X) u,i The probability X under the given condition u,i Let Pa(X) be the i-th feature of the insect behavior data. u,i ) is the feature X u,i The set of parent nodes, i.e., other features or variables that affect this feature; P(θ) uθ represents the Bayesian network parameters. u The prior probability distribution reflects the initial assumptions about the parameters; θ u The parameters of the Bayesian network are optimized using maximum a posteriori estimation.
[0095] S5022. Kernel width is optimized based on a particle swarm optimization (PSO) strategy. Traditional PSO algorithms rely on a single search scale, making them prone to getting trapped in local optima and failing to find the optimal kernel parameters. This fails to fully utilize multi-scale search, resulting in a limited search space and restricted optimization performance. Here, multi-scale PSO optimization is used. While updating particle speed and position in parallel across multiple scales, historical and global optimal information from different scales is weighted and fused to search for the optimal kernel width across different scales. This allows for multi-level exploration of kernel parameter configuration, expanding the search space coverage and enabling the PSO algorithm to locate the global optimum more quickly. It also avoids premature convergence, improving search efficiency and the stability of the global optimum.
[0096] The velocity vector of the i-th particle at the (t+1)-th iteration The calculation formula is:
[0097]
[0098] In the formula, ω is the inertia weighting factor, which controls the historical inertia of the particle's travel speed, and its value ranges from [0,1], specifically set to 0.5; Let α be the velocity vector of the i-th particle at the t-th iteration, where k is a positive integer and K is the scale number; k The weight for the k-th scale is preset by an operator; c 1k p is the first acceleration constant at the k-th scale, and its optimal value is determined through grid search. ik This represents the optimal position in the history of a particle at the k-th scale. c is the position vector of the i-th particle at the t-th iteration; 2k Let be the second acceleration constant at the k-th scale, and determine its optimal value through grid search; This represents the globally optimal position at the k-th scale;
[0099] The position vector of the i-th particle at the (t+1)-th iteration The calculation formula is:
[0100]
[0101] In the formula, Let be the position vector of the i-th particle at the t-th iteration. for Let be the velocity vector of the i-th particle at the (t+1)-th iteration.
[0102] S5023. Combining the probability distribution of Bayesian network inference output with the position vector obtained by particle swarm optimization strategy, the kernel width is dynamically calculated. The complexity of insect behavior data is quantified by probability ratio and entropy value, so that the kernel width gradually converges with the iteration process. In addition, the position vector is based on the form of exponential terms to balance the weight distribution in the exploration and development stages. Compared with the static support vector machine kernel function, it can adjust the kernel scale in real time according to the characteristics of insect behavior data, improving classification accuracy while optimizing computational efficiency. For example, the trajectory entropy in insect behavior features fluctuates greatly in the early homing behavior (homing to the source) and then tends to stabilize. A larger kernel width range is given in the initial iteration stage, and then gradually converges to adapt to the changes in insect behavior data characteristics and achieve efficient classification.
[0103] When dynamically adjusting the kernel width parameter, the adaptive factor generated by the Bayesian network The calculation formula is:
[0104]
[0105] In the formula, P(X) u |θ u Given the Bayesian network parameters θ u Time feature matrix X u The conditional probability, P(X) u ) is the characteristic matrix X u The joint probability distribution, H(X) u ) is the characteristic matrix X u The entropy, H max =log|X u | is the characteristic matrix X u The theoretical maximum entropy, |X u | is the cardinality of the characteristic matrix, when X u When it is a discrete feature, it represents the number of possible values; when it is a continuous feature, it represents the number of samples.
[0106] The kernel width parameter in the (t+1)th iteration The calculation formula is:
[0107]
[0108] In the formula, Let be the kernel width parameter for the t-th iteration. Adaptive factors generated for Bayesian networks Let be the position vector of the i-th particle at the (t+1)-th iteration, where t is the current iteration number and T is the total number of iterations;
[0109] S503. Calculate the loss function for the Support Vector Machine (SVM). Use an energy function to fuse the information gain loss and the cubic regularization term of the SVM weight vector. Traditional SVM models mainly use squared regularization, which makes them less effective at handling outlier data (such as accidental high-speed movements or unusual turns of insects) and prone to misclassification. Here, cubic regularization is used to more strongly suppress the influence of outliers and penalize them more severely, thus improving the robustness of the SVM model. By optimizing the model parameters through global search, the SVM process can adapt to noise in insect behavior data while escaping local optima, thereby enhancing the model's generalization ability.
[0110] The formula for calculating the loss function E of a support vector machine is:
[0111]
[0112] In the formula, i is a positive integer, and N s L is the sample size; L is the cross-entropy loss function, used to measure the difference between the predicted probability distribution and the true distribution; C u Here, j is the regularization parameter for the support vector machine, and J is the dimension of the support vector machine weight vector. The cubic regularization term enhances robustness to outliers, penalizing them more significantly than traditional squared regularization. It also penalizes anomalous behaviors (such as sporadic high-speed motion) more severely, thus improving the robustness of the support vector machine model. j For the j-th dimension of the support vector machine weight vector, L con To compare loss functions;
[0113] The formula for calculating the cross-entropy loss function L is:
[0114]
[0115] In the formula, c is a positive integer, and C is the total number of categories of insect behavior data; y ic Let be the true label of the i-th sample in the c-th category, represented by one-hot encoding; exp() is an exponential function with the natural constant e as its base. This represents the probability predicted by the support vector machine that the i-th sample belongs to the c-th class, where k is a positive integer. This represents the probability predicted by the support vector machine that the i-th sample belongs to the k-th class.
[0116] S504. A self-supervised contrastive learning module is adopted, using unlabeled insect behavior data as an auxiliary data source. Different views are generated through random data augmentation methods. The contrastive loss function is used to narrow the feature representation distance between different views of the same sample and widen the feature representation distance between different samples. Different views are generated through data augmentation (such as Gaussian noise perturbation and feature masking). In this way, the inherent structural features of insect behavior data are automatically mined without additional manual annotation, improving the accuracy and effectiveness of data sample selection in the active learning stage, and enhancing the ability of the support vector machine model to discriminate insect behavior features. The self-supervised contrastive learning module is constrained by contrastive loss.
[0117] Contrast loss function L con The calculation formula is:
[0118]
[0119] In the formula, i is a positive integer, and N s The sample size is sim(), which represents the cosine similarity function, and z i The feature vector representation of the first augmented view for the i-th insect behavior data sample. is the feature vector representation of the second augmented view of the i-th insect behavior data sample; τ is the temperature parameter, whose optimal value is determined through cross-validation; j is a positive integer;
[0120] In practical applications, sample x i For a set of feature data obtained from insect tactic experiments, if its attributes include: walking speed, direction of movement, duration, posture angle, and trajectory entropy value, it is represented as: [2.5cm / s, 30°, 4.0s, 10°, 0.85]. Randomly selected features in the sample feature vector are masked and set to zero or replaced with the average value to generate a new view, represented as: [0, 30°, 4.0s, 0, 0.85].
[0121] A small Gaussian noise is randomly added to the original features to obtain a slightly different but essentially unchanged view, represented as: [2.53cm / s,29.7°,4.05s,10.2°,0.87].
[0122] The generated views [0, 30°, 4.0s, 0, 0.85] and [2.53cm / s, 29.7°, 4.05s, 10.2°, 0.87] are input into a preset feature extraction network. The preset feature extraction network outputs a feature representation of a uniform dimension (e.g., a 128-dimensional vector). Then, in the self-supervised contrastive learning module, the view... Figure 1 The characteristic is: z i =[0.2,0.1,...,0.05], a total of 128 dimensions, view Figure 2 The characteristics are: It has a total of 128 dimensions. The preset feature extraction network is a multilayer perceptron, convolutional neural network, or Transformer network.
[0123] S505. This method updates the parameters of the support vector machine model based on a dynamic learning rate, avoiding the oscillations or slow convergence problems caused by a fixed learning rate. It utilizes the Adam adaptive learning rate algorithm combined with an entropy-aware learning rate adjustment strategy. By calculating the entropy value of the classification output in real time to quantify the uncertainty of the model's predictions, the learning rate is dynamically adjusted. This increases the learning step size when the model's predictions fluctuate significantly to quickly escape local optima, and decreases the learning step size when the prediction results are stable for finer convergence. Traditional fixed learning rates easily lead to training oscillations or slow convergence. This method combines entropy values to dynamically adjust the learning rate: when the model's predictions are unstable, the learning rate is increased to quickly escape local optima; when the model tends to stabilize, the learning rate is decreased to improve convergence accuracy.
[0124] The learning rate of the support vector machine in the (t+1)th iteration The calculation formula is:
[0125]
[0126] In the formula, Let be the learning rate of the support vector machine at the t-th iteration; β is the learning rate adjustment coefficient of the support vector machine, and β is set to 0.2. Output the entropy value of the predicted probability for the support vector machine model in the t-th iteration;
[0127] The support vector machine model outputs the entropy value of the predicted probability in the t-th iteration. The calculation formula is:
[0128]
[0129] In the formula, i is a positive integer, and N s Let c be the number of samples, and C be the total number of categories in the insect behavior data. Let be the probability that the i-th sample is of the c-th class predicted by the support vector machine in the t-th iteration;
[0130] When the parameters of a support vector machine are dynamically updated iteratively, the j-th weight parameter of the support vector machine in the (t+1)-th iteration... The calculation formula is:
[0131]
[0132] In the formula, Let j be the weight parameter of the support vector machine in the t-th iteration. Let E be the learning rate of the support vector machine in the (t+1)th iteration, and E be the loss function of the support vector machine.
[0133] S506. The support vector machine model is validated and fine-tuned through an active learning mechanism. Based on the uncertainty and entropy of the classification results, insect behavior data with unclear classification is automatically identified and selected to establish a feedback data sample library. After manual annotation and confirmation of the selected samples by those skilled in the art, the newly labeled samples are merged into the original dataset to retrain the model. This process is repeated to continuously optimize the model's accuracy and generalization performance. Traditional classification methods rely only on fixed datasets; here, an active learning mechanism is used to automatically identify samples with uncertain classification and perform feedback manual annotation, iteratively optimizing and improving the model's generalization ability.
[0134] In the uncertainty assessment of active learning mechanisms, the uncertainty score of a sample is determined by comprehensively considering the maximum prediction probability and the entropy value. The sample uncertainty score U(X) is... u The formula for calculating ) is:
[0135]
[0136] In the formula, max c∈C () represents the maximum predicted probability of a single sample belonging to any of the classes by the support vector machine, where c is a positive integer, C is the total number of classes in the insect behavior data, and y ic Let H(Y) be the true label of the i-th sample in the c-th class. u H represents the entropy value of the predicted probability output by the support vector machine model. max The theoretical maximum entropy value is preset by humans;
[0137] S507. Repeat S502 to S506 until the model training is complete; the sign that the model training is complete is that the preset stopping iteration condition is met. The preset stopping iteration condition is reaching the preset maximum number of iterations, which is set to 100.
[0138] To further enhance classification performance, multiple (e.g., 50) dynamic kernel-width support vector machines can be trained using different data following the above process. An ensemble learning classification method can then be employed, utilizing these multiple dynamic kernel-width support vector machines to construct an ensemble learning framework. The classification probabilities output by each model are then fused using weights to improve overall classification performance, as shown below:
[0139] Final classification probability output The calculation formula is:
[0140]
[0141] In the formula, m is a positive integer, and M is the number of sub-models. These are the weights that are dynamically adjusted based on the model's historical performance at the t-th iteration. The classification probability output by the m-th sub-model (referring to a single dynamic kernel-width support vector machine);
[0142] When dynamically adjusting weights based on the model's historical performance, the weights at iteration t are dynamically adjusted based on the model's historical performance. The calculation formula is:
[0143]
[0144] In the formula, m is a positive integer, and M is the number of sub-models. The accuracy of the m-th model after the t-th iteration is fed back in real time to dynamically adjust the weights of the sub-models, thereby achieving adaptive integration at the decision-making level. Let be the accuracy of the nth sub-model after the tth iteration, where n is a positive integer;
[0145] S6. Collect new stimulus parameter data and new insect behavior data as input data. Preprocess the input data by converting the new insect behavior data from continuous variables to discrete variables to obtain processed input data. After feature extraction and standardization of the processed input data, input it into the trained analysis model. The trained analysis model outputs the directional behavior category of the input data.
[0146] like Figure 2 As shown, by comparing the classification accuracy of the support vector machine classification algorithm with the dynamic kernel width adaptive adjustment strategy proposed in this invention with that of traditional support vector machines, random forests, and nearest neighbor classification algorithms, the advantages of the support vector machine classification algorithm with the dynamic kernel width adaptive adjustment strategy are demonstrated. The experimental results show that, compared with traditional methods, the support vector machine classification algorithm with the dynamic kernel width adaptive adjustment strategy proposed in this invention can more effectively adapt to the feature changes of insect directional behavior data, improve the accuracy and stability of classification, and demonstrate the significant superiority of this method.
[0147] like Figure 3 As shown, by analyzing the changing trend of the dynamic kernel width parameter during the training process, the effectiveness and rationality of the support vector machine classification algorithm combined with the dynamic kernel width adaptive adjustment strategy adopted in this invention are verified. The experimental results show that the kernel width fluctuates greatly in the early stage of algorithm training, which effectively avoids the risk of the model getting trapped in local optima. Subsequently, the kernel width gradually converges and stabilizes, indicating that the algorithm can adaptively adjust the parameters as training progresses to better reflect the inherent laws of insect behavior data, and significantly improve the convergence efficiency and classification performance of the algorithm.
[0148] like Figure 5As shown, the present invention also provides an insect directional behavior analysis device that applies the above-described insect directional behavior analysis method, comprising:
[0149] A motion carrier module for insect movement;
[0150] A stimulus module capable of emitting adjustable sound waves, light waves, or chemical signals;
[0151] A behavior recording module used to collect videos of insect displacement, behavioral trajectories, and gait.
[0152] Pressure sensing module for recording pressure during insect gait;
[0153] A data processing module used to integrate collected data and transmit it to a computer.
[0154] The motion carrier module is a trackball, a sphere made of polystyrene that provides a low-friction surface for the insect's feet. The surface is coated with micro-textures to enhance the insect's gripping ability and improve the naturalness of the experiment. During operation, the insect is placed on top of the trackball, and a drive motor rotates the ball. Infrared sensors record the trackball's direction and speed. Any insect exhibiting crawling behavior can be used. For better observation, an adjustable flexible support can be used to fix the insect's back, stabilizing the position of insects of different sizes. It is essential to ensure that the insect's feet remain in contact with the trackball and that it can walk naturally after being fixed in place. The height and angle of the flexible support are adjustable to ensure motion stability and eliminate interference from aimless movement data.
[0155] The frequency range of the sound waves emitted by the stimulation source module is 10Hz to 100kHz, and the amplitude and direction are adjustable; the wavelength of the emitted light waves is 250nm to 850nm, the LED array covers the ultraviolet to infrared spectrum, and the light intensity ranges from 0 to 500 lux; the concentration and release direction of the emitted chemical signal are controlled and adjusted by a micro-pump.
[0156] The behavior recording module includes an optical sensor and a high-speed camera. The optical sensor is located above the trackball and the insect and is used to capture the x and y displacement of the suspended ball and convert it into digital signals of travel speed and left and right offset in real time. The high-speed camera is used to record the insect's gait and movement details.
[0157] The pressure sensing module is located below the contact area of the suspended ball, with an accuracy of 1mN to 5N. It can record gait pressure changes and support dynamic gait pressure analysis.
[0158] The data processing module transmits the collected data to the computer in real time via a high-speed acquisition card. The computer analyzes the data using an insect directional behavior analysis method, generates an analysis report, and obtains quantitative results of the insect's directional and avoidance responses. The collected data includes data from a trackball, camera, and stimulus sources.
[0159] This device integrates sound, light, and chemical stimuli, with flexible adjustment capabilities for frequency, intensity, and direction to adapt to diverse experimental needs. It also features a behavior recording module and a pressure sensing module, providing rich data acquisition dimensions and supporting comprehensive analysis. This device can be applied to pest control, navigation behavior analysis, and basic behavioral research, and is particularly suitable for the analysis and application of insect orientation behavior, providing an efficient experimental support tool for pest control, navigation behavior analysis, and basic behavioral research.
Claims
1. A method for analyzing insect directional behavior, characterized in that, include: S1. Collect stimulus source parameter data and at least one insect behavior data as training data; Insect behavioral data includes walking speed and movement trajectory; S2. Preprocess the training data by converting the insect behavior data from continuous variables to discrete variables to obtain the processed training data; S3. Extract features from the processed training data to obtain multiple feature data, and standardize the multiple feature data to obtain multiple standard feature data; S4. Label the directional behavior category of each standard feature data; S5. Input multiple standard feature data into the analysis model, and train the analysis model using a support vector machine classification algorithm that combines dynamic kernel width adaptive adjustment strategy to obtain the trained analysis model; The dynamic kernel width adaptive adjustment strategy is combined to dynamically calculate the kernel width parameter by decomposing the conditional probability distribution between features and fusing the posterior estimate of Bayesian network parameters. S6. Collect new stimulus parameter data and new insect behavior data as input data. Preprocess the input data by converting the new insect behavior data from continuous variables to discrete variables to obtain processed input data. After feature extraction and standardization of the processed input data, input it into the trained analysis model. The trained analysis model outputs the directional behavior category of the input data.
2. The method for analyzing insect directional behavior according to claim 1, characterized in that, The stimuli include sound waves, light waves, and chemical signals.
3. The method for analyzing insect directional behavior according to claim 1, characterized in that, The support vector machine classification algorithm training and analysis model described in S5, which combines a dynamic kernel width adaptive adjustment strategy, includes: S501. The initial width of the support vector machine kernel function is determined by calculating the variance of the sample features, and the regularization parameter is set using the reciprocal of the feature standard deviation; S502. Employs a dynamic kernel width adaptive adjustment strategy for dynamic kernel width adaptive adjustment; S503. Calculate the loss function of the support vector machine, use the energy function to fuse the information gain loss and the support vector machine weight vector cube regularization term, and optimize the model parameters through global search; S504. A self-supervised contrastive learning module is adopted, using unlabeled insect behavior data as an auxiliary data source. Different views are generated through random data augmentation methods. The contrastive loss function is used to narrow the feature representation distance between different views of the same sample and widen the feature representation distance between different samples. The self-supervised contrastive learning module is constrained by the contrastive loss. S505. Update the parameters of the support vector machine model based on the dynamic learning rate; S506. The support vector machine model is validated and fine-tuned through an active learning mechanism. Based on the uncertainty and entropy of the classification results, insect behavior data with unclear classification is automatically identified and selected to establish a feedback data sample library. After the selected samples are manually labeled and confirmed by those skilled in the art, the newly added labeled samples are fused into the original dataset to retrain the model. S507. Repeat S502 to S506 until the model training is complete.
4. The method for analyzing insect directional behavior according to claim 3, characterized in that, The parameters of the support vector machine model updated based on the dynamic learning rate in S502 include: S5021. By decomposing the conditional probability distribution between features and fusing the posterior estimate of Bayesian network parameters, a dynamic kernel width adaptive adjustment is performed to construct a Bayesian network to capture the dependencies of insect behavioral data, and the parameters of the Bayesian network are optimized using maximum a posteriori estimation. S5022, the kernel width is optimized based on the particle swarm optimization strategy. When updating the particle speed and position in parallel at multiple scales, the historical best and global best information at different scales are weighted and fused to achieve multi-level exploration of kernel parameter configuration. S5023. Combining the probability distribution output by Bayesian network inference with the position vector obtained by particle swarm optimization strategy, the kernel width is dynamically calculated, and the complexity of insect behavior data is quantified by probability ratio and entropy value.
5. The method for analyzing insect directional behavior according to claim 3, characterized in that, In step S503, when the information gain loss and the support vector machine weight vector cube regularization term are fused using an energy function, the formula for calculating the support vector machine loss function E is as follows: In the formula, i is a positive integer, and N s Let L be the number of samples, L be the cross-entropy loss function, and C be the number of samples. u Here, j is the regularization parameter for the support vector machine, and J is the dimension of the support vector machine weight vector. For the cubic regularization term, w j Let L be the j-th dimension of the support vector machine weight vector. con For comparison loss functions.
6. The method for analyzing insect directional behavior according to claim 3, characterized in that, In S505, the parameter update of the support vector machine model based on the dynamic learning rate refers to the learning rate of the support vector machine in the (t+1)th iteration. The calculation formula is: In the formula, Let be the learning rate of the support vector machine at the t-th iteration, and β be the learning rate adjustment coefficient of the support vector machine. Output the entropy value of the predicted probability for the support vector machine model in the t-th iteration.
