Crab aggressiveness classification method based on Kmeans clustering and support vector machine
Through the method of combining Kmeans clustering and support vector machines, the problem of crab aggressiveness evaluation is solved, efficient crab aggressiveness classification is achieved, and the efficiency of crab breeding and breeding quality are improved.
Patent Information
- Application Number
- CN202410657293.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-25
- Publication Date
- 2024-10-29
- Estimated Expiration
- 2044-05-25
AI Technical Summary
Existing technology is difficult to effectively assess and predict the aggressiveness of crabs, resulting in intraspecific food loss and reduced growth rate during breeding, affecting breeding quality and yield.
Using the method of combining Kmeans clustering and support vector machine (SVM), through mirror experiments and fighting experiments, the aggressive behavior indicators of crabs are recorded and quantified, time autocorrelation analysis is performed, the optimal classification value K is screened, and crabs are constructed Aggression classification model, optimizing model parameters to achieve efficient assessment of crab aggressive behavior.
This method provides a convenient and efficient crab aggressiveness classification method, which can accurately assess and predict crab aggressiveness, improve breeding efficiency, reduce economic losses, and enhance animal welfare.
Smart Images

Figure CN118864918A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of aquatic product breeding, and in particular relates to a method for crab aggressiveness classification based on Kmeans clustering and support vector machine (SVM). Background Art
[0002] Aggression is an animal's aggressive response to individuals of the same species, and different individuals show aggressive phenotypes ranging from low to high. Crabs are generally highly aggressive, and visual, tactile, and chemical information can all serve as sensory signals for individual fights. Individuals not only fight for resources, such as food, mates, and shelters, but sometimes fight over accidental encounters. However, looking at the research on animal personality, the current direction is mainly focused on the quantitative analysis of behavior and the correlation between different behavioral indicators, and it is more common in terrestrial vertebrates, while research on aquatic invertebrates is relatively limited. Moreover, in the research on animal personality, due to the incorporation of subjective factors, there are often artificial differences in animal behavior research. Therefore, eliminating the influence of subjective factors and solving the problem of classification standards have become the key to research on animal personality and its environmental adaptation.
[0003] With the development of research, the methods of aquatic animal behavior research have been greatly improved. At the same time, the development of modern science and technology has also provided a technical basis for aquatic animal behavior research. Machine learning is an important method for objectively mining data results. It can make full use of the statistical characteristics of data and obtain more scientific results based on the inherent laws of data. K-Means clustering is a vector quantization method and an unsupervised learning method in machine learning. This research method has been widely used in behavioral research. Studies have shown that mirror experiments can be used to measure individual aggressiveness, which has been confirmed in studies of zebrafish and three-spined sticklebacks. In the study of crustaceans, due to differences in morphology and living habits, there are also large differences in the measurement methods of the same sexual index of individuals of different species. In order to ensure that the species studied matches the experimental method, repeated measurement experiments are usually carried out when selecting the experimental method to determine the consistency of the experimental results over time. At the same time, different measurement methods will be selected for the same indicator to test the correlation between different measurement results, so as to verify the accuracy and stability of the experimental results.
[0004] Under traditional pond culture conditions, crabs often face problems such as limited space, repeated changes in food and group composition. They are more likely to suffer from intraspecific cannibalism than in natural environments, resulting in limb mutilation and even death. It is more difficult for mutilated individuals to feed, so their growth rate is often affected, resulting in a decline in breeding quality and a reduction in breeding output. Efficient aggressiveness assessment technology helps to improve detection efficiency, increase animal welfare and reduce economic losses. Therefore, the present invention qualitatively evaluates and predicts the aggressiveness of crabs by combining K-Means clustering and support vector machines. Summary of the invention
[0005] The purpose of the present invention is to apply machine learning to provide a method for crab aggressiveness classification based on Kmeans clustering and support vector machine (SVM), so as to provide an efficient determination method for the future breeding of excellent crab varieties.
[0006] In order to achieve the above-mentioned purpose, the present invention adopts the following technical solutions:
[0007] A method for crab aggressiveness classification based on Kmeans clustering and support vector machine (SVM), characterized by comprising the following steps:
[0008] Step 1: Repeat the test to measure the aggressive behavior of crabs by mirror experiment, with a sample size of no less than 100 crabs.
[0009] Step 2, record and quantify the crab's aggressive behavior:
[0010] First, the aggressive behavior indicators measured by the mirror experiment were divided into two categories: attack indicators and non-aggression indicators. The attack indicators included attacking the mirror image, chelipeds display frequency, cumulative chelipeds display duration, approaching the mirror image and retreating; the non-aggression indicators included relative moving distance - the ratio of moving distance to carapace width, stillness frequency and cumulative stillness duration; then the number of occurrences and cumulative time of the above indicators in the mirror experiment were recorded.
[0011] Step 3: Perform temporal autocorrelation analysis on the attack index and non-attack index measurement results to verify the accuracy of the mirror experiment measurement results.
[0012] Step 4: Use Kmeans cluster analysis to select the optimal classification value K, and classify and label the aggressiveness of the crabs:
[0013] 1. The feature vectors of Kmeans cluster analysis were set as the five attack indicators measured in the mirror experiment, including attack mirror, chelipeds display, cumulative duration of chelipeds display, approach and retreat;
[0014] 2. First, the original data is processed by maximum and minimum homogenization as the characteristic value for subsequent analysis;
[0015] 3. Then, draw an elbow diagram to screen the optimal classification value K. Select different classification values K, K = 1:10, perform cluster analysis on the eigenvalues through the Kmeans function, draw an elbow diagram with the classification value K, K = 1:10 as the horizontal axis and the error square sum as the vertical axis. The K value corresponding to the inflection point of the elbow diagram is the optimal solution;
[0016] 4. Classify and label the aggressiveness of crabs according to the optimal classification value K.
[0017] Step 5, conduct multiple pairing fighting experiments on the experimental crabs.
[0018] Step 6, measure and quantify the crab's fighting behavior:
[0019] The fighting behaviors were recorded and quantified through the video, including approach - the experimental individual actively approached the matching individual, retreat - individuals separated after fighting interaction, demonstration - the frequency of chelipeds display, defense - the cumulative duration of chelipeds display, the cumulative duration of stillness, the total number of fighting rounds - the total number of fights between individuals, the probability of fighting - the ratio of the number of experiments with fighting to all paired experiments, and the fighting intensity score; the above indicators were taken as the average of repeated experiments as the final result.
[0020] Step 7: Analyze the differences in fighting behaviors between different aggressive categories to verify the reliability of the Kmeans clustering results.
[0021] Step 8: Use support vector machine (SVM) to preliminarily build a crab aggressiveness classification model.
[0022] Step 9: Optimize the aggressiveness classification model through K-fold cross validation and grid search.
[0023] In step 10, the model is evaluated by the accuracy, sensitivity, and specificity of the predicted values.
[0024] Step 11, apply the model to classify crab aggressive behavior:
[0025] 1. Conduct 3-5 mirror tests on a crab to measure three non-aggression indicators in its aggressiveness evaluation index, including movement distance (used to calculate relative movement distance), stationary frequency and cumulative stationary duration;
[0026] 2. Take the average of the original data of the above three aggressiveness evaluation indicators and use them as the input variables of the aggressiveness classification model;
[0027] 3. Input the variables into the aggressiveness classification model, and the output is the aggressiveness category of the crab.
[0028] In step 1, the mirror experiment is performed in the following manner:
[0029] Select an observation tank with an opaque white inner wall, fix the camera just above the observation tank, take two mirrors with the same width as the inner diameter of the observation tank, and place the backs of the two mirrors vertically in the middle of the observation tank so that the mirror experiment can be carried out simultaneously on both sides; insert a partition into each side of the mirror in the observation tank, and put two crabs into the area on one side of the partition so that the crabs and the mirrors are separated by the partition. After 10 minutes of adaptation, gently remove the partition to expose the crabs in front of the mirror, and end the shooting after 20 minutes; after each group of shooting, replace the seawater in the observation tank and clean the observation tank.
[0030] In step 1, the photography is uniformly carried out in a lightless environment, and the seawater temperature and salinity are controlled to be consistent with the temporary culture conditions during the experiment.
[0031] In step 1, before conducting the mirror experiment,
[0032] 1. Isolate the crab in an aquarium for two weeks;
[0033] 2. Select no less than 100 healthy crabs with intact appendages and in the intermolting period for the filming experiment;
[0034] 3. After fasting for 24 hours, conduct the mirror experiment.
[0035] In step 1, after completing one mirror experiment, the crab is placed back into the temporary aquarium to recover for 24 hours before the next measurement, and the shooting is repeated 3-5 times.
[0036] In step 2, the aggressive behavior of the crabs was recorded and quantified using behavioral analysis software as follows:
[0037] Set the detection sampling rate to 8 frames per second, the detection method to dynamic silhouette method or grayscale gradient method, enable lost frame correction and smooth trajectory settings; the trajectory smoothing configuration is:
[0038] a. Smoothing is performed based on 10 samples before and after each sampling point;
[0039] b. If the moving distance is less than 3cm, the sampling point is still set to the previous position;
[0040] c. If the maximum moving distance is greater than 20 cm, the sampling point is set as missing.
[0041] In step 3, the correlation analysis of the attack index and non-attack index measurement results is performed as follows:
[0042] The temporal autocorrelation of crab aggressive behavior was tested by correlation analysis, with P < 0.05 as the significance level. The correlation coefficient r ranged from [-1, 1]. When r > 0, it indicated a positive correlation between the two, and when r < 0, it indicated a negative correlation between the two.
[0043] In step 5, multiple pairing fighting experiments are performed on the experimental crabs, including the following steps:
[0044] After the mirror experiment, no less than 30% of the experimental crabs were randomly matched with 3-5 different opponents of similar specifications for one-on-one fighting experiments. The difference in carapace width between the matched crabs and the experimental crabs was no more than 10%, and the same matched crab could fight with different experimental crabs. After fasting for 24 hours, one experimental crab and the matched crab were placed on both sides of the partition of the observation tank to adapt for 10 minutes. An equal amount of extract from the soft part of the Manila clam was added to the observation tank as an inducer of fighting behavior. The partition was gently removed and the shooting began. The shooting lasted for 20 minutes. After each group of shooting, the seawater in the observation tank was replaced and the observation tank was cleaned. The experimental crab and the matched crab were returned to the temporary aquarium to recover for 24 hours before the next round of fighting.
[0045] In step 5, all experimental crabs were marked with red plastic tags on their carapaces for identification in behavioral analysis. The filming experiment was uniformly conducted in a lightless environment, and the seawater temperature and salinity were controlled to be consistent with the temporary culture conditions during the experiment.
[0046] In step 6, the intensity of the fight is divided into 4 levels: 1. Very weak: one individual approaches another individual and shows aggression, and the other individual shows obedience and has no physical contact, contact behavior = 0, and 1 point is recorded; 2. Weak: Both individuals show aggression and physical contact occurs until the winner successfully climbs on the other or the loser retreats continuously, clamping + pushing = 0 and hitting + climbing > 0, and 2 points are recorded; 3. Moderate: The fight between the two individuals escalates to clamping and pushing, the loser retreats but unfolds its claws to continuously demonstrate, clamping + pushing > 0 and the total number of fighting rounds < 5, and 3 points are recorded; 4. Strong: Although the loser retreats, it constantly restarts the fighting process, clamping + pushing > 0; the total number of fighting rounds is >= 5, and 4 points are recorded.
[0047] In step 6, the crab fighting behavior is recorded and quantified using behavior analysis software, and the detection and settings are consistent with step 2.
[0048] In step 7, analyzing the differences in fighting behaviors between different aggressive categories and verifying the reliability of the Kmeans clustering results includes the following steps:
[0049] 1. Indicators of fighting behavior include approach, retreat, demonstration, defense, cumulative duration of static state, total number of fighting rounds, probability of fighting, and fighting intensity;
[0050] 2. Compare the differences in fighting behavior indicators of K different aggressive categories of crabs using SPSS25.0, with P < 0.05 as the significance level;
[0051] 3. If more than 60% of the fighting behavior indicators are significantly different among different aggressive categories, it indicates that the Kmeans clustering result is reliable as an indicator for aggressive classification evaluation.
[0052] In step 8, the crab aggressiveness classification model is preliminarily constructed using a support vector machine (SVM), which includes the following steps: 1. In order to simplify the classification process of aggressiveness, the non-aggression indicators (relative moving distance, static frequency (number of times all visible movements stopped for more than 5 seconds), and cumulative static duration) measured in the mirror experiment and the Kmeans clustering results are used as feature vectors to construct the model;
[0053] 2. First, the raw data of non-aggression indicators of each crab were averaged and randomly divided into training and test sets, with 80% or more used for training and the rest for testing;
[0054] 3. Use the “svm” function in the R package to train the feature vector, comprehensively compare the model effects of 12 combinations of three “Type” parameters (C-classification, nu-classification, and one-classification) and four kernel functions (linear, polynomial, radial, and sigmoid) in the “svm” function, select the optimal combination, and preliminarily construct an aggressiveness classification model.
[0055] In step 9, optimizing the aggressiveness classification model through K-fold cross validation and grid search includes the following steps:
[0056] 1. In the training set, K-fold cross validation and grid search (K ≥ 10) were established through R language to screen the optimal model parameters, including the coefficient (gamma) of the kernel function and the penalty coefficient C (cost);
[0057] 2. Use the optimal parameters gamma and cost to optimize the aggressiveness classification model.
[0058] In step 10, evaluating the model by the accuracy, sensitivity and specificity of the predicted value includes the following steps: 1. In the test set, applying the optimized aggressiveness classification model, using the "predict" function to classify the feature vector;
[0059] 2. Calculate the accuracy, sensitivity, and specificity of the prediction values and evaluate the model;
[0060] 3. When the model accuracy reaches 90% or above, it indicates that the model works well and can be used for aggressive classification; otherwise, return to step 9 for re-optimization.
[0061] The beneficial effects of the present invention are embodied in:
[0062] 1. This invention applies machine learning to crab aggressiveness classification for the first time, combining Kmeans clustering and support vector machine to construct a more convenient and efficient method for individual aggressiveness assessment.
[0063] 2. The present invention also simplifies the qualitative evaluation indicators of crab aggressiveness, selects relative moving distance, static frequency and static cumulative duration to predict the crab aggressiveness category, and provides a behavioral method for the breeding of excellent crab varieties. BRIEF DESCRIPTION OF THE DRAWINGS
[0064] Figure 1 The figure is a flow chart of the method of the present invention.
[0065] Figure 2 Collect schematics for aggressive behavior.
[0066] Figure 3 Collect top-down images for aggressive behavior.
[0067] Figure 4 Collect schematic diagrams for fighting behavior.
[0068] Figure 5 Collect top-down views for fighting behavior.
[0069] Figure 6 The results of time repeatability analysis of the aggressiveness evaluation index are shown in Figure 2.
[0070] in, Figure 6 A attack mirror, Figure 6 B. Chelipeds display frequency, Figure 6 C Cumulative duration of chelicerae display, Figure 6 D is close to the mirror image, Figure 6 E retreats, Figure 6 F Cumulative duration of static state, Figure 6 GStandstill frequency, Figure 6 H is the relative moving distance.
[0071] Figure 7 This is the Kmeans clustering elbow diagram. The horizontal axis is the classification value k, and the vertical axis is the error square sum SSE.
[0072] Figure 8 The differences in fighting behaviors of different aggressive categories of swimming crabs,
[0073] in Figure 8 A. Fighting intensity, Figure 8 B Total number of combat rounds, Figure 8 C. Frequency of chelonae display, Figure 8 D The cumulative duration of the claw display, Figure 8 E refined cumulative duration, Figure 8 F Fighting probability.
[0074] Fig. 9 It is the precise network diagram of SVM model parameters, where gamma is the coefficient of the kernel function and cost is the penalty coefficient C. DETAILED DESCRIPTION
[0075] like Figure 1 As shown, a method for crab aggressiveness classification based on Kmeans clustering and support vector machine is characterized by comprising the following steps:
[0076] Step 1, repeatedly measure the aggressive behavior of crabs through the mirror experiment, with a sample size of no less than 100 crabs;
[0077] Step 2, record and quantify the crab's aggressive behavior:
[0078] Step 3, performing time autocorrelation analysis on the attack index and non-attack index measurement results to verify the accuracy of the mirror experiment measurement results;
[0079] Step 4, using Kmeans cluster analysis to select the optimal classification value K, and classify and label the aggressiveness of crabs;
[0080] Step 5, conducting multiple pairing fighting experiments on the experimental crabs;
[0081] Step 6, measuring and quantifying the crab's fighting behavior;
[0082] Step 7, analyze the differences in fighting behaviors between different aggressive categories to verify the reliability of the Kmeans clustering results;
[0083] Step 8, using support vector machine (SVM) to preliminarily build a crab aggressiveness classification model;
[0084] Step 9, optimize the aggressiveness classification model through K-fold cross validation and grid search;
[0085] Step 10, evaluate the model by the accuracy, sensitivity and specificity of the predicted values;
[0086] Step 11, apply the model to classify crab aggressive behavior.
[0087] The present invention will be described in detail below by taking the swimming crab trituberculate as an example and in conjunction with the accompanying drawings. The described experiments are only some embodiments of the present invention, but not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained in the art belong to the scope of protection of the present invention.
[0088] Step 1, repeatedly measuring the aggressive behavior of the swimming crab by using a mirror experiment;
[0089] 1. After the male three-tuberculate swimming crab (Portunus trituberculatus) was brought back to the laboratory, it was placed in an aquarium (45×30×30cm,
[0090] 40.95L) were temporarily isolated for two weeks;
[0091] 2. Select healthy, intact appendages and in the intermolting period of three-tuberculate swimming crabs (juvenile crabs: n = 101; adult crabs (before sexual maturity): n
[0092] =146; adult crabs (after sexual maturity): n = 130) were used for filming experiments;
[0093] 3. Aggressive behavior collection device such as Figure 2 , 3 As shown, it includes an infrared night vision camera (HIKVISION, China), a display (PHILLIP, China), an observation tank (juvenile crabs: d1 = 12 cm, h = 11.7 cm, 1 L; adult crabs: d2 = 60 cm, h = 50 cm,
[0094] 141L), mirrors (juvenile crabs: 10×10cm; adult crabs: 58×20cm), and partitions. The inner wall of the observation tank is opaque white, which is convenient for subsequent behavior analysis software to collect information. The camera is fixed directly above the observation tank, and the distance can be adjusted according to the different sizes of crabs, so as to clearly capture the entire observation tank and the experimental crabs. The characteristic of this behavior collection system is that for the first time, two mirrors are combined and placed vertically on the midline of the observation tank, so that different crabs on the left and right sides can be measured for aggressiveness at the same time. This system can not only simulate virtual enemies, but also provide the opponent's smell through the experimental crab on the other side, providing a more realistic aggressiveness measurement scene;
[0095] 4. After fasting for 24 hours, the crabs were placed in the observation tank. The crabs were separated from the mirror image by a partition. After 10 minutes of adaptation, the partition was gently removed to expose the crabs to the mirror. The shooting ended after 20 minutes. After each group of shooting, the seawater in the observation tank was replaced and cleaned;
[0096] 5. Place the crab back into the temporary aquarium to recover for 24 hours before the next measurement, and repeat the shooting 3-5 times. Since crabs are more active in a dark environment, the shooting experiment was conducted in a dark environment. During the experiment, the seawater temperature and salinity were controlled to be consistent with the temporary conditions;
[0097] 6. Save the captured video for later analysis.
[0098] Step 2, record and quantify the aggressive behavior of the swimming crab;
[0099] 1. First, manually add the aggressive behavior indicators measured by the mirror experiment, which are divided into two categories: aggressive indicators and non-aggressive indicators.
[0100] Aggression indicators included attack mirror, chelipeds display frequency, cumulative duration of chelipeds display, approach to mirror, and retreat, while non-aggression indicators included movement distance, immobility frequency, and cumulative duration of immobility;
[0101] 2. Next, set up the observation area. The observation area of the mirror experiment is semicircular, and two observation areas are drawn for each observation cylinder;
[0102] 3. Then, set the experimental animal detection conditions to accurately identify the experimental crabs. The detection sampling rate is 8 frames / second, the detection method is dynamic silhouette method or grayscale gradient method, and the lost frame correction and smooth trajectory settings are turned on. The trajectory smoothing configuration is:
[0103] a. Smoothing is performed based on 10 samples before and after each sampling point;
[0104] b. If the moving distance is less than 3cm, the sampling point is still set to the previous position;
[0105] c. If the maximum moving distance is greater than 20 cm, the sampling point is set as missing.
[0106] 4. After correctly identifying the experimental crab, the behavioral collection began, and the collection time was 20 minutes;
[0107] 5. Manually record the collected video and output the quantified aggressive behavior data of the swimming crab.
[0108] Step 3, testing the temporal autocorrelation of the aggressive behavior of the swimming crab by correlation analysis, and then verifying the accuracy of the results of the mirror experiment;
[0109] 1. The mirror experiment was repeated to verify the temporal stability of the aggressive behavior of the swimming crab.
[0110] 2. Aggressive behavior indicators include attack image, chelicerae display frequency, cumulative duration of chelicerae display, approach to image, retreat, movement distance, immobility frequency and cumulative duration of immobility;
[0111] 3. The results showed that the above eight aggressiveness evaluation indicators were significantly correlated at different measurement times (P<0.05,
[0112] Figure 6 ), which also shows that the mirror experiment measurement method and results used in this experiment are credible.
[0113] Step 4, using Kmeans cluster analysis to select the optimal classification value K, and classify and label the aggressiveness of the swimming crab;
[0114] 1. The feature vectors of Kmeans cluster analysis are the five attack indicators measured in the mirror experiment, including attack mirror, chelipeds display, cumulative duration of chelipeds display, approach and retreat;
[0115] 2. First, the original data is processed by maximum and minimum homogenization as the characteristic value for subsequent analysis;
[0116] 3. Then, draw the elbow diagram to select the optimal classification value k. Select different classification values K (K = 1:10) and use the R package "kmeans"
[0117] The function performs cluster analysis on the eigenvalues and draws an elbow diagram with the classification value K (K = 1:10) as the abscissa and the sum of squared errors (SSE) as the ordinate;
[0118] 4. The cluster analysis results show that the optimal classification value K is 2 ( Figure 7 ). Therefore, the aggressiveness of the three-tuberculate swimming crab can be divided into two categories:
[0119] Strong and weak.
[0120] Step 5, conduct multiple pairing fighting experiments on the experimental crabs:
[0121] 1. After the mirror experiment, 67 adult swimming crabs were randomly selected for fighting experiments. The crabs were randomly matched with 3-5 different opponents of similar size for one-on-one fighting experiments. The fighting behavior collection system consists of an infrared night vision camera, a display, an observation tank and a partition ( Figure 4 , 5 ). The carapace width of the matching crabs and the experimental crabs did not differ by more than 10%, and the same matching crab could fight with different experimental crabs;
[0122] 2. After fasting for 24 hours, place one experimental crab and the matching crab in the fighting behavior collection system (on both sides of the partition) to adapt for 10 minutes, then gently remove the partition and start filming. Filming will end after 20 minutes of continuous filming. Add an equal amount of Philippine clam soft body extract to each observation tank as an inducer of fighting behavior. After each group of filming, replace the seawater in the observation tank and clean it;
[0123] 3. Return the experimental crabs and the matching crabs to the temporary aquarium to recover for 24 hours before the next round of fighting. All experimental crabs were marked with red plastic tags on their carapaces for easy identification in behavioral analysis. The filming experiment was conducted in a dark environment, and the seawater temperature and salinity were kept consistent with the temporary aquarium conditions during the experiment.
[0124] Step 6, measuring and quantifying the fighting behavior of the swimming crab;
[0125] 1. Save the captured video and record and quantify the fighting behavior using behavioral analysis software:
[0126] (1) Manually add fighting behavior indicators. Fighting behavior indicators include approach, retreat, demonstration (chelipeds display frequency), defense (chelipeds display cumulative duration), cumulative duration of static state, total number of fighting rounds, fighting probability and fighting intensity;
[0127] (2) Set up an observation area. The observation area for the fighting experiment is circular, with the entire observation tank serving as the observation area;
[0128] (3) The detection and acquisition settings are the same as step 2;
[0129] 2. Manually record the collected video and output the quantified fighting behavior results.
[0130] Step 7, analyzing the differences in fighting behaviors of different aggressive categories of swimming crabs to verify the reliability of Kmeans clustering results;
[0131] 1. Indicators of fighting behavior include approach, retreat, demonstration (frequency of chelicerae display), defense (cumulative duration of chelicerae display), cumulative duration of immobility, total number of fighting rounds, probability of fighting, and fighting intensity;
[0132] 2. SPSS25.0 was used to compare the differences in fighting behavior indicators between the strong and weak aggressive swimming crabs. The results showed that there were significant differences in demonstration (frequency of chelipeds display), defense (cumulative duration of chelipeds display), cumulative duration of stillness, total number of fighting rounds, probability of fighting and fighting intensity ( Figure 8 ), indicating that the Kmeans clustering result is reliable as an evaluation indicator for aggressiveness classification.
[0133] Step 8, using support vector machine (SVM) to preliminarily build an aggressiveness classification model for the swimming crab;
[0134] 1. In order to simplify the classification process of aggressiveness, the non-aggression indicators (relative moving distance (ratio of moving distance to nail width), static frequency, and static cumulative duration) measured in the mirror experiment and the Kmeans clustering results were selected as feature vectors for model construction;
[0135] 2. First, the raw data of non-aggression indicators of each crab (mixed juvenile and adult crabs) were averaged and randomly divided into training and test sets, with 90% used for training and 10% for testing;
[0136] 3. The “svm” function in the R package was used to train the feature vector, and the model effects of 12 combinations of three “Type” parameters (C-classification, nu-classification and one-classification) and four kernel functions (linear, polynomial, radial and sigmoid) in the “svm” function were comprehensively compared. The results showed that the combination of C-classification and radial had the best effect, and the aggressiveness classification model was preliminarily constructed with the optimal combination.
[0137] Step 9, optimize the aggressiveness classification model through K-fold cross validation and grid search;
[0138] 1. In the training set, 10-fold cross validation and grid search were established through R language to screen the optimal model parameters, including the coefficient of the kernel function (gamma) and the penalty coefficient C (cost). The results showed that the optimal model parameters gamma was 0.35 and cost was 4.00 ( Fig. 9 );
[0139] 2. In the training set, the optimal parameters gamma and cost are used to optimize the aggressiveness classification model. The results show that the SVM supports 126 vectors, 63 strong groups and 63 weak groups.
[0140] Step 10, evaluate the model by the accuracy, sensitivity and specificity of the predicted values;
[0141] 1. In the test set, apply the optimized aggressiveness classification model and classify the feature vector using the “predict” function.
[0142] 2. The prediction results showed that the accuracy, sensitivity and specificity of the model were 92%, 84% and 100% respectively, and the SVM model had a good classification effect.
[0143] In step 11, the model is applied to the aggressiveness classification:
[0144] 1. Take the average of the three non-aggression indicators of the aggressiveness evaluation index of the swimming crab (P. trituberculatus) repeatedly measured in the mirror experiment in this experiment, including relative movement distance, static frequency and cumulative static duration, as input variables of the aggressiveness classification model; 2. Input the above variables into the aggressiveness classification model to finally obtain the aggressiveness classification results.
[0145] After verification by the examples, the present invention provides a convenient and efficient crab aggressiveness classification method, which can more accurately evaluate and quantify the aggressive behavior characteristics of crabs, thereby accurately screening in the breeding process and improving the breeding efficiency. Therefore, the present invention is not only of great significance for the breeding of excellent crab varieties, but also has a certain role in promoting the automated evaluation of aggressive behavior in crustacean models in the future.
Claims
1. A method for crab aggressiveness classification based on Kmeans clustering and support vector machine, Its characteristics are The following steps are involved: Step 1, repeatedly measure the aggressive behavior of crabs through the mirror experiment, with a sample size of no less than 100 crabs; Step 2, record and quantify the crab's aggressive behavior: First, the aggressive behavior indicators measured by the mirror experiment were divided into two categories: attack indicators and non-aggression indicators. The attack indicators included attacking the mirror image, chelicerae display frequency, chelicerae display cumulative duration, approaching the mirror image and retreating. The non-aggression indicators included relative moving distance (the ratio of moving distance to carapace width), immobility frequency and immobility cumulative duration. Then record the number of occurrences and cumulative time of the above indicators in the mirror experiment; Step 3, performing time autocorrelation analysis on the attack index and non-attack index measurement results to verify the accuracy of the mirror experiment measurement results; Step 4: Use Kmeans cluster analysis to select the optimal classification value K, and classify and label the aggressiveness of the crabs:
1. The feature vectors of Kmeans cluster analysis were set as the five attack indicators measured in the mirror experiment, including attack mirror, chelipeds display, cumulative duration of chelipeds display, approach and retreat; 2. First, the original data is processed by maximum and minimum homogenization to serve as the characteristic value for subsequent analysis; 3. Then, draw an elbow diagram to select the optimal classification value K: select different classification values K, K=1:10, perform cluster analysis on the eigenvalues through the Kmeans function, draw an elbow diagram with the classification value K, K=1:10 as the horizontal axis and the error square sum as the vertical axis. The K value corresponding to the inflection point of the elbow diagram is the optimal solution; 4. Classify and label the aggressiveness of crabs according to the optimal classification value K; Step 5, conducting multiple pairing fighting experiments on the experimental crabs; Step 6, measure and quantify the crab's fighting behavior: The fighting behaviors were recorded and quantified through the video, including approach - the experimental individual actively approached the matching individual, retreat - individuals separated after fighting interactions, demonstration - the frequency of chelicerae display, defense - the cumulative duration of chelicerae display, the cumulative duration of stillness, the total number of fighting rounds - the total number of fighting between individuals, the probability of fighting - the ratio of the number of experiments with fighting to all paired experiments, and the fighting intensity score; the above indicators were taken as the average of repeated experiments as the final result; Step 7, analyze the differences in fighting behaviors between different aggressive categories to verify the reliability of the Kmeans clustering results; Step 8, using support vector machine (SVM) to preliminarily build a crab aggressiveness classification model; Step 9, optimize the aggressiveness classification model through K-fold cross validation and grid search; Step 10, evaluate the model by the accuracy, sensitivity and specificity of the predicted values; Step 11, apply the model to classify crab aggressive behavior:
1. Conduct 3-5 mirror tests on a crab to measure three non-aggression indicators in the aggressiveness evaluation index, including movement distance (used to calculate relative movement distance), static frequency and static cumulative duration; 2. Take the average of the original data of the above three aggressiveness evaluation indicators and use them as the input variables of the aggressiveness classification model; 3. Input the variables into the aggressiveness classification model, and the output is the aggressiveness category of the crab.
2. The method for crab aggressiveness classification based on Kmeans clustering and support vector machine as claimed in claim 1, Its characteristics are In step 1, the mirror experiment is performed in the following manner: An observation tank with an opaque white inner wall was selected, and the camera was fixed just above the observation tank. Two mirrors with the same width as the inner diameter of the observation tank were taken, and the backs of the two mirrors were placed vertically in the middle of the observation tank so that the mirror experiment could be carried out simultaneously on both sides. A partition was inserted into each of the two sides of the mirror in the observation tank, and two crabs were placed in the area on one side of the partition so that the crabs were separated from the mirror by the partition. After 10 minutes of adaptation, the partition was gently removed to expose the crabs to the mirror, and the shooting ended after 20 minutes. After each group of shooting, the seawater in the observation tank was replaced and the observation tank was cleaned.
3. The method for crab aggressiveness classification based on Kmeans clustering and support vector machine as claimed in claim 1, Its characteristics are In step 2, the aggressive behavior of the crabs was recorded and quantified using behavioral analysis software as follows: Set the detection sampling rate to 8 frames per second, the detection method to dynamic silhouette method or grayscale gradient method, enable lost frame correction and smooth trajectory settings; the trajectory smoothing configuration is: a. Smoothing is performed based on 10 samples before and after each sampling point; b. If the moving distance is less than 3 cm, the sampling point is still set to the previous position; c. If the maximum moving distance is greater than 20 cm, the sampling point is set as missing.
4. The method for crab aggressiveness classification based on Kmeans clustering and support vector machine as claimed in claim 1, Its characteristics are In step 3, the correlation analysis of the attack index and non-attack index measurement results is performed as follows: Correlation analysis was used to examine the temporal autocorrelation of crab aggressive behavior. P < 0.05 is used as the significance level, and the correlation coefficient r ranges from [-1,1]. When r > 0, it indicates that the two are positively correlated, and when r < 0, it indicates that the two are negatively correlated.
5. The method for crab aggressiveness classification based on Kmeans clustering and support vector machine as claimed in claim 1, Its characteristics are In step 5, multiple pairing fighting experiments are performed on the experimental crabs, including the following steps: After the mirror experiment, no less than 30% of the experimental crabs were randomly matched with 3-5 different opponents of similar specifications for one-on-one fighting experiments. The difference in carapace width between the matched crabs and the experimental crabs did not exceed 10%, and the same matched crab could fight with different experimental crabs. After fasting for 24 hours, one experimental crab and the matched crab were placed on both sides of the partition of the observation tank to adapt for 10 minutes. An equal amount of extract from the soft part of the Manila clam was added to the observation tank as an inducer of fighting behavior. The partition was gently removed and the shooting began. The shooting ended after 20 minutes of continuous shooting. After each group of shooting, the seawater in the observation tank was replaced and the observation tank was cleaned. The experimental crab and the matched crab were put back into the temporary aquarium to recover for 24 hours before the next round of fighting.
6. The method for crab aggressiveness classification based on Kmeans clustering and support vector machine as claimed in claim 1, Its characteristics are In step 6, the intensity of the fight is divided into 4 levels:
1. Very weak: one individual approaches another individual and shows aggression, and the other individual shows obedience and does not make physical contact, contact behavior = 0, 1 point; 2. Weak: Both individuals show aggression and come into physical contact until the winner successfully climbs on the other or the loser retreats continuously, with pinching + pushing = 0 and hitting + climbing > 0, 2 points are recorded; 3. Moderate: The fight between the two individuals escalates to pinching and pushing, the loser retreats but continues to demonstrate with its claws, pinching + pushing > 0 and the total number of fighting rounds < 5, 3 points are recorded; 4. Strong: Although the loser retreats, he keeps restarting the fight, pinching + pushing > 0; the total number of fighting rounds >= 5, 4 points are recorded.
7. The method for crab aggressiveness classification based on Kmeans clustering and support vector machine as claimed in claim 1, Its characteristics are In step 7, analyzing the differences in fighting behaviors between different aggressive categories and verifying the reliability of the Kmeans clustering results includes the following steps:
1. Indicators of fighting behavior include approach, retreat, demonstration, defense, cumulative duration of static state, total number of fighting rounds, probability of fighting, and fighting intensity; 2. Compare the differences in fighting behavior indicators of K different aggressive categories of crabs using SPSS25.
0. P < 0.05 was used as the significance level; 3. If more than 60% of the fighting behavior indicators are significantly different among different aggressive categories, it indicates that the Kmeans clustering result is reliable as an indicator for aggression classification evaluation.
8. The method for crab aggressiveness classification based on Kmeans clustering and support vector machine as claimed in claim 1, Its characteristics are In step 8, using a support vector machine to preliminarily construct a crab aggressiveness classification model includes the following steps:
1. In order to simplify the classification process of aggressiveness, the non-aggression indicators relative moving distance measured in the mirror experiment, the cumulative duration of stillness, the stillness frequency (the number of times all visible movements stopped for more than 5 seconds) and the Kmeans clustering results were used as feature vectors to construct the model; 2. First, the raw data of non-aggression indicators of each crab were averaged and randomly divided into training and test sets, with 80% or more used for training and the rest for testing; 3. Use the "svm" function in the R package to train the feature vector, comprehensively compare the model effects of 12 combinations of three "Type" parameters in the "svm" function, namely C-classification, nu-classification and one-classification, and four kernel functions, namely linear, polynomial, radial and sigmoid, select the optimal combination, and preliminarily build an aggressiveness classification model.
9. The method for crab aggressiveness classification based on Kmeans clustering and support vector machine as claimed in claim 1, Its characteristics are In step 9, optimizing the aggressiveness classification model through K-fold cross validation and grid search includes the following steps:
1. In the training set, K-fold cross validation and grid search (K ≥ 10) were established through R language to screen the optimal model parameters, including the coefficient (gamma) of the kernel function and the penalty coefficient C (cost); 2. Use the optimal parameters gamma and cost to optimize the aggressiveness classification model.
10. The method for crab aggressiveness classification based on Kmeans clustering and support vector machine as claimed in claim 1, Its characteristics are In step 10, evaluating the model by the accuracy, sensitivity and specificity of the predicted value includes the following steps:
1. In the test set, apply the optimized aggressiveness classification model and use the "predict" function to classify the feature vector; 2. Calculate the accuracy, sensitivity, and specificity of the prediction values to evaluate the model; 3. When the model accuracy reaches 90% or above, it indicates that the model works well and can be used for aggressive classification; otherwise, return to step 9 and optimize again.
Citation Information
Patent Citations
Swimming crab group personality classification method based on K-Means algorithm and application thereof
CN111950598A
Method for distinguishing good and non-good Chinese mitten crab groups
CN116803254A
Live pig aggressive behavior identification method based on double-flow convolutional neural network
CN117671793A
Methods, system, and kit for monitoring, diagnosing, and treating impulsive aggression
US20170312289A1
Cited By
Method for quantitatively evaluating crab aggressiveness based on factor analysis and multiple linear regression
CN118506401A
Method for screening comprehensive stress-resistant crabs
CN119184001A
