Hu sheep behavior identification method and system based on ResNet50 network

Through the lake sheep behavior recognition method based on the ResNet50 network, combined with video data and three-axis acceleration sensor data, the problems of equipment shedding and stress behavior in sheep behavior recognition are solved, and high-accurate behavior recognition is achieved, providing a new method for lake sheep health monitoring and breeding.

CN119559690APending Publication Date: 2025-03-04INNER MONGOLIA UNIVERSITY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411476676.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-22
Publication Date
2025-03-04

AI Technical Summary

Technical Problem

The existing sheep behavior recognition methods have problems with equipment shedding and animal stress behavior during the data collection stage, resulting in low accuracy.

Method used

The lake sheep behavior recognition method based on the ResNet50 network is adopted. By collecting video data and three-axis acceleration sensor data, combined with manual annotation data, the ResNet50 network is trained to achieve accurate identification of lake sheep behavior.

Benefits of technology

Accurate identification of lake sheep behavior is achieved, the accuracy of behavior recognition is improved, and new ideas and methods are provided for monitoring the health status of lake sheep and achieving welfare breeding.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119559690A_ABST
    Figure CN119559690A_ABST
Patent Text Reader

Abstract

The invention discloses a Hu sheep behavior recognition method and system based on a ResNet50 network, and belongs to the technical field of action recognition, and the method comprises the steps: S1, data collection; s2, data preprocessing; and S3, model training identification. According to the method, the video data and the three-axis acceleration sensor data are obtained, the three-axis acceleration sensor data are processed to obtain the activity amount data and the three-axis acceleration data, and meanwhile the video data are manually contrasted for labeling to obtain the labeling data; the ResNet50 network is trained and verified by using the activity data, the three-axis acceleration data and the labeled data file, so that the Hu sheep behavior recognition model is obtained, sheep behavior recognition can be accurately realized by using the Hu sheep behavior recognition model, and a new thought and method are provided for monitoring the health condition of the Hu sheep, realizing welfare breeding and improving the breeding benefit.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of action recognition technology, and in particular to a method and system for identifying Hu sheep behavior based on a ResNet50 network. Background Art

[0002] Hu sheep is an animal of the genus Ovis in the order Artiodactyla of the order Bovidae of the class Mammalia. Hu sheep are of medium build, with a narrow and long head, a raised nose bridge, and most ears drooping. Both male and female sheep have no horns, a slender neck, a narrow and long body, a straight back and waist, a slightly drooping belly, a flat and round tail with an upturned tail tip, and thin and tall limbs. They have all white fur, coarse, sparse and short fur on their belly, and a strong physique.

[0003] Existing methods for sheep behavior recognition include manual observation, video analysis, and sensor recognition. Traditional manual observation is time-consuming and laborious, and modern sheep farms are large in scale, so this method is no longer applicable. The occlusion caused by sheep living in groups and the difficulties in image segmentation, especially under conditions of shadows and background changes, lead to low accuracy of video-based behavior recognition. Sensor-based animal behavior recognition has less equipment complexity and higher spatial freedom, and can be accurate to each individual animal, but when the sensor is worn on the animal for a long time, there will be problems with the device falling off and causing stress behavior in the animal. In summary, sensor-based animal behavior recognition has the advantages of simplicity, low cost, and high accuracy. What needs to be improved is the stress behavior and shedding problems caused by the wearing of the device during the data collection stage, so as to accurately realize sheep behavior recognition. Summary of the invention

[0004] The technical problem to be solved by the present invention is: how to more accurately realize the behavior recognition of sheep, and provides a method for recognizing the behavior of Hu sheep based on the ResNet50 network.

[0005] The present invention solves the above technical problems through the following technical solutions, and the present invention comprises the following steps:

[0006] The following steps are involved:

[0007] S1: Data Collection

[0008] Collect video data and three-axis acceleration sensor data;

[0009] S2: Data preprocessing

[0010] Each frame of the video data is annotated by manual annotation, and a label is added to each frame to obtain an annotated data file. The three-axis acceleration sensor data is processed to obtain the three-axis acceleration data and activity data, and then three data files are obtained. The three data files are processed to obtain the Huyang behavior data set.

[0011] S3: Model training and recognition

[0012] The Hu sheep behavior dataset is divided into a training set and a validation set according to a set ratio. Multiple frames of data in the training set are input into the base ResNet50 network, and the ResNet50 network is trained to obtain the trained Hu sheep behavior model. Finally, one frame of data in the validation set is input into the trained Hu sheep behavior model to realize the recognition of Hu sheep behavior.

[0013] Furthermore, in step S1, the video data and the three-axis acceleration sensor data are collected synchronously.

[0014] Furthermore, in the step S1, a three-axis acceleration sensor is worn on the jaw of the Hu sheep, and each sheep wears one three-axis acceleration sensor.

[0015] Furthermore, in step S2, the three-axis acceleration sensor simultaneously outputs three kinds of raw data on the X, Y, and Z axes, representing acceleration values ​​in three different directions.

[0016] Furthermore, in step S2, the specific process of processing the three-axis acceleration sensor data to obtain the three-axis acceleration data is as follows:

[0017] S201: Read the data on each axis output by the three-axis acceleration sensor, recorded as X, Y, and Z;

[0018] S202: Use X′, Y′, and Z′ to store the average values ​​of the latest 10 values ​​of X, Y, and Z;

[0019] S203: Calculate the square sum of the three-axis data as the basic data for processing, and the calculation formula is:

[0020] D=X×X+Y×Y+Z×Z

[0021] The square sum D of the three-axis data is calculated and saved in FIFOBUF_0. FIFOBUF_0 stores the latest eight square sums of the three-axis data D1 to D8 in chronological order, where D1 is the latest D value.

[0022] S204: Calculate the average of the square sum data D1 to D8 of the eight three-axis data stored in FIFOBUF_0 in time sequence, and record it in the variable M;

[0023] S205: Variable M is stored in FIFOBUF_1, and the two variables M1 and M2 stored in FIFOBUF_1 in chronological order are averaged and recorded in variable A, where M1 is the latest value of M;

[0024] S206: Save the variable A to FIFOBUF_2, and calculate the difference Δ according to the three variables A1, A2, and A3 stored in FIFOBUF_2 in chronological order. The calculation formula is as follows:

[0025] Δ=A1-A3

[0026] The difference Δ is used to determine whether the acceleration is continuously increasing or decreasing. When Δ is a positive number, it indicates that it is in the continuous increase stage, and when it is a negative number, it indicates that it is in the continuous decrease stage. A1 is the latest A value.

[0027] S207: Determine whether the absolute value of the difference Δ is greater than 512 and greater than 0. If so, set the variable F to +1, that is, set the variable F=+1, and set the variable MaxValue=A1, and output X′, Y′, and Z′, and end the process; otherwise, proceed to the next step;

[0028] S208: Determine whether the absolute value of the difference Δ is greater than 512 and less than 0. If so, continue to determine whether the variable F is +1. Otherwise, output X′, Y′, and Z′, and end the process.

[0029] S209: When it is determined that the variable F is +1, the difference between the variable MaxValue and the variable MinValue is calculated; determine whether it is greater than the set threshold value 2816. If so, it indicates that there is activity, triggering an interrupt signal, performing a new round of detection, resetting the variables: MaxValue=1, MinValue=A1, F=0, and finally outputting X′, Y′, Z′, and ending the process; otherwise, directly performing a new round of detection, resetting the variables: MaxValue=1, MinValue=A1, F=0, and finally outputting X′, Y′, Z′, and ending the process; when it is determined that the variable F is not +1, set the variable F to -1, then set the variable MinValue=A1, output X′, Y′, Z′, and end the process; wherein, the initial value of MinValue is 0.

[0030] Furthermore, in step S2, the specific process of processing the three-axis acceleration sensor data to obtain the activity data is as follows:

[0031] S211: Read the acceleration data on the X-axis, Y-axis, and Z-axis output by the three-axis acceleration sensor;

[0032] S212: Initialize the minimum value to 65535, the maximum value to 0, and initialize other related variables at the same time, where the other related variables include the maximum position, the minimum position, the activity amount, and the count value;

[0033] S213: setting two thresholds Th1 and Th2 for subsequent activity amount determination;

[0034] S214: For each data point, the sum of the squares of the three-axis accelerations is calculated, and a displacement operation is performed to reduce the data range;

[0035] S215: Calculate the difference between the sum of squares of the three-axis accelerations of the current data point and the previous data point;

[0036] S216: judging the direction of acceleration change according to the positive or negative sign of the difference, the direction of acceleration change is rising or falling;

[0037] S217: when the data increases, the maximum value is updated; when the data decreases, the minimum value is updated, and the position is recorded;

[0038] S218: When the activity changes from rising to falling, and the falling amplitude exceeds the set value, the activity amount from the most recent peak to the trough is calculated, that is, the maximum value minus the minimum value;

[0039] S219: Determine whether the activity level is between Th1 and Th2, if yes, the count value increases;

[0040] S220: Repeat the above process for each data point in the FIFOBUF_2 array until the processing is completed;

[0041] S221: Output result: The final output count value is the number of activity times that meet the conditions, that is, the activity data is obtained.

[0042] Furthermore, in step S2, the frequency of labeling data is 1 time / minute, and a labeling data file is produced for one sheep 24 hours a day, and each piece of labeling data is matched with a time point and a corresponding sheep device number.

[0043] Furthermore, in step S2, the specific process of processing the labeled data file, activity data, and triaxial acceleration data to obtain the Huyang behavior data set is as follows:

[0044] S221: merging all the annotated data files into one annotated file, the annotated file after merging contains the sheep device number, time, and corresponding behavior information;

[0045] S222: Read activity data from the activity data file, set the reading time period to 5 minutes, and read 33 activity data as a group, including 1 sheep device number, 2 start and end time, and the remaining 30 are activity data;

[0046] S223: Based on the group of data, the three-axis acceleration data is read, and the sheep device number and the start and end time are judged. When they match, the three-axis acceleration data is added to the group of data. Finally, the annotation file is read to add a label, and the sheep device number and the start and end time are also judged. When they match, the label data corresponding to the behavior is added to the group of data, thereby obtaining a frame of data;

[0047] S224: Loop steps S222-S223 until all frame data are read to obtain the Huyang behavior data set.

[0048] The present invention also provides a Hu Yang behavior recognition system based on the ResNet50 network, which uses the above-mentioned Hu Yang behavior recognition method to effectively recognize Hu Yang behavior, including:

[0049] Data acquisition module, used to collect video data and three-axis acceleration sensor data;

[0050] The data preprocessing module is used to annotate each frame of the video data by manual annotation, add a label to each frame, obtain annotated data files, and process the three-axis acceleration sensor data to obtain three-axis acceleration data and activity data, and then obtain three data files, and process the three data files to obtain the Huyang behavior data set;

[0051] The model training and recognition module is used to divide the Hu sheep behavior data set into a training set and a validation set according to a set ratio, input multiple frames of data in the training set into the base ResNet50 network, train the ResNet50 network to obtain the trained Hu sheep behavior model, and finally input a frame of data in the validation set into the trained Hu sheep behavior model to realize the recognition of Hu sheep behavior.

[0052] Compared with the prior art, the present invention has the following advantages: the method for identifying the behavior of Hu sheep based on the ResNet50 network obtains video data and three-axis acceleration sensor data, processes the three-axis acceleration sensor data to obtain activity data and three-axis acceleration data, and uses manual control video data for annotation to obtain annotated data, and uses the activity data, three-axis acceleration data, and annotated data files to train and verify the ResNet50 network, thereby obtaining a Hu sheep behavior identification model. The Hu sheep behavior identification model can be used to accurately identify the behavior of sheep, providing new ideas and methods for monitoring the health status of Hu sheep, realizing welfare breeding, and providing breeding benefits. BRIEF DESCRIPTION OF THE DRAWINGS

[0053] Figure 1 It is a flow chart of a method for identifying Huyang behavior based on a ResNet50 network in an embodiment of the present invention;

[0054] Figure 2 is a schematic diagram of a three-axis acceleration sensor acquisition circuit in an embodiment of the present invention;

[0055] Figure 3 is a schematic diagram of three types of data in an embodiment of the present invention;

[0056] Figure 4 is a schematic diagram of a three-axis acceleration data acquisition process in an embodiment of the present invention;

[0057] Figure 5 is a schematic diagram of the activity data acquisition process in an embodiment of the present invention;

[0058] Figure 6(a) is Figure 5 A partial enlarged view of the middle part;

[0059] Figure 6(b) is Figure 5 A partial enlarged view of point B in the middle;

[0060] Figure 7 It is a schematic diagram of a process of producing a frame (group) of data in a data set according to an embodiment of the present invention;

[0061] Figure 8 is a schematic diagram of a frame (group) of data of an input model in an embodiment of the present invention;

[0062] Fig. 9 Schematic diagram of the ResNet-50 network structure in an embodiment of the present invention. DETAILED DESCRIPTION

[0063] The following is a detailed description of an embodiment of the present invention. This embodiment is implemented on the premise of the technical solution of the present invention, and a detailed implementation method and a specific operation process are given, but the protection scope of the present invention is not limited to the following embodiment.

[0064] like Figure 1 As shown, this embodiment provides a technical solution: a method for identifying lake sheep behavior based on a ResNet50 network, comprising the following steps:

[0065] Step 1: Data Collection

[0066] Data collection involves two types of data: video data and three-axis acceleration sensor data. Video data is used to annotate the three-axis acceleration sensor data.

[0067] In this embodiment, the three-axis acceleration sensor acquisition circuit includes a main control chip STM32L051k8u6, an ADXL362 tilt sensor module, an SX1278 communication module, an ME6214-3V voltage regulator module, an HWS507 RF switch module, an ADC signal acquisition module, a power supply module, etc. Figure 2 shown.

[0068] In this embodiment, the video data and the three-axis acceleration sensor data are collected synchronously.

[0069] In this embodiment, a three-axis acceleration sensor is worn on the lower jaw of the Hu sheep, and each sheep wears one three-axis acceleration sensor to facilitate the identification of eating and rumination behaviors.

[0070] In this embodiment, video data is collected by cameras. Four cameras are installed in each pen. The cameras are located at the four corners of the pen, about 3 meters from the ground, and shoot all-round images of the sheep at an angle of nearly 45°.

[0071] Step 2: Data Preprocessing

[0072] Each frame of the video data is annotated by manual annotation, and a (hu sheep behavior category) label is added to each frame to obtain an annotated data file. The three-axis acceleration sensor data is processed to obtain activity data and three-axis acceleration data, and then three data files are obtained, such as Figure 3 shown.

[0073] In this embodiment, the three-axis acceleration data acquisition algorithm: the three-axis acceleration sensor simultaneously outputs three kinds of raw data on the X, Y, and Z axes, representing the acceleration values ​​in three different directions. The output frequency of each raw data on the X, Y, and Z axes is 10 Hz, 10 pieces / second. This is prone to problems such as excessive data volume and discontinuous state. To this end, a data processing algorithm is designed, and its process is as follows: Figure 4 The core idea of ​​the algorithm is to obtain data in a stable and continuous state and reduce the amount of data. The specific processing process of the algorithm is as follows:

[0074] 1. Read the data on each axis output by the three-axis acceleration sensor, recorded as X, Y, and Z;

[0075] 2. Use X', Y', and Z' to store the average values ​​of the latest 10 X, Y, and Z;

[0076] 3. Calculate the sum of the squares of the three-axis data as the basic data for processing. The calculation formula is:

[0077] D=X×X+Y×Y+Z×Z

[0078] The square sum D of the three-axis data is calculated and saved in FIFOBUF_0; FIFOBUF_0 can only store the square sum data D1 to D8 of the latest eight three-axis data in chronological order (where D1 is the latest D value). When new data is saved, the old data is automatically discarded;

[0079] 4. Calculate the average of the square sum data D1 to D8 of the eight three-axis data stored in FIFOBUF_0 in chronological order and record them in the variable M;

[0080] 5. Save the variable M in FIFOBUF_1, calculate the average of the two variables M1 and M2 stored in FIFOBUF_1 in chronological order (where M1 is the latest M value), and record it in variable A;

[0081] 6. Save variable A to FIFOBUF_2, and calculate the difference Δ based on the three variables A1, A2, and A3 (where A1 is the latest value of A) stored in FIFOBUF_2 in chronological order. The calculation formula is as follows:

[0082] Δ=A1-A3

[0083] The difference Δ is used to determine whether the acceleration is continuously increasing or continuously decreasing. When Δ is a positive number, it indicates that it is in the continuous increasing stage, and when it is a negative number, it indicates that it is in the continuous decreasing stage.

[0084] 7. Determine whether the absolute value of the difference Δ is greater than 512 and greater than 0. If so, set the variable F to +1, that is, set the variable F = +1, and set the variable MaxValue = A1, and output X', Y', Z', and end the process; otherwise, go to the next step;

[0085] 8. Determine whether the absolute value of the difference Δ is greater than 512 and less than 0. If so, continue to determine whether the variable F is +1. Otherwise, output X′, Y′, and Z′ and end the process.

[0086] 9. When the variable F is judged to be +1, calculate the difference between the variable MaxValue and the variable MinValue; judge whether it is greater than the set threshold value 2816. If so, it means there is activity, trigger the interrupt signal, perform a new round of detection, reset the variables: MaxValue=1, MinValue=A1, F=0, and finally output X′, Y′, Z′, and end the process; otherwise, directly perform a new round of detection, reset the variables: MaxValue=1, MinValue=A1, F=0, and finally output X′, Y′, Z′, and end the process; when it is judged that the variable F is not +1, set the variable F to -1, then set the variable MinValue=A1, output X′, Y′, Z′, and end the process; among them, the initial value of MinValue is 0.

[0087] It should be noted that the purpose of judging whether the absolute value of Δ is greater than 512 is to ignore slight movements. If it is less than 512, nothing is done and it is considered a slight movement; variable F represents the trend of acceleration, F=+1 means the acceleration is increasing, F=-1 means the acceleration is decreasing, and F=0 means the initial state; threshold judgment method is used to determine whether there is activity, the maximum acceleration obtained in this judgment process is recorded in MaxValue, and the minimum acceleration is recorded in MinValue; threshold = 2816 is fixed.

[0088] Activity data acquisition algorithm: Activity data is also generated by processing the three original data X, Y, and Z through an algorithm. The algorithm flow is as follows: Figure 5 shown.

[0089] The specific processing process of the algorithm is as follows:

[0090] 1. [Read data] First read the acceleration data of the X-axis, Y-axis, and Z-axis from the sensor;

[0091] 2. [Data initialization] Initialize the minimum value to 65535, the maximum value to 0, and other related variables (such as maximum position, minimum position, activity, and count value);

[0092] 3. [Set interval value] Set two thresholds Th1 and Th2 for subsequent activity determination;

[0093] 4. [Calculate the sum of squares of accelerations of three axes] For each data point, calculate the sum of squares of accelerations of three axes and perform displacement operations to reduce the data range;

[0094] 5. [Calculate difference] Calculate the difference between the sum of squares of the three-axis accelerations of the current data point and the previous data point;

[0095] 6. [Determine direction] Determine the direction of acceleration change (upward or downward) based on the positive or negative value of the difference;

[0096] 7. [Peak and trough judgment] Update the maximum value when the data rises, update the minimum value when it falls, and record the position;

[0097] 8. [Calculate activity volume] When the volume changes from rising to falling, and the falling amplitude is large, calculate the activity volume from the most recent peak to the trough (i.e. the maximum value minus the minimum value);

[0098] 9. [Interval determination] Determine whether the activity level is between Th1 and Th2. If so, the count value increases;

[0099] 10. [Loop Processing] Repeat the above process for each data point in the FIFOBUF_2 array until the processing is completed;

[0100] 11.

Output result

[0101] Labeled data file: The labeling frequency is 1 time / minute, and one labeling data file is created for one sheep 24 hours a day. Each labeling data is matched with a time point and the corresponding sheep equipment number (sheep number).

[0102] After preparing the above three data sets (labeled data files, activity data files, and three-axis acceleration data files), use the data processing algorithm to merge all the labeled data files into one labeled file. The merged labeled file contains the sheep device number, time, and corresponding behavior (rumination, feeding, drinking water, lying, standing, and walking). Next, read the activity data from the activity data file, set the reading time period to 5 minutes, and read a total of 33 activity data as a group, including 1 sheep device number, 2 start and end times, and the remaining 30 activity data. Based on this group of data, read the three-axis acceleration data, and judge the sheep device number and the start and end time. When they all match, add the three-axis acceleration data to this group of data. Finally, add the label, read the label file, and also judge the device number and the start and end time. When they all match, add the digital label corresponding to the behavior (the behavior of the sheep in the video is represented by numbers, such as '0' represents 'lying' behavior, and '1' represents 'standing' behavior) to this group of data. A group of data is now completed. The process is as follows Figure 7 As shown. This process is repeated until all frame data are read. After the dataset is created, it is sent to the selected RexNet50 network model for training and verification.

[0103] Step 3: Model training and recognition

[0104] In this embodiment, the model is obtained based on ResNet50 network training. Figure 7 , frame by frame) is sent into the model for training and verification. The recognition accuracy of rumination, eating, standing, lying, drinking water, and walking reached 82.3%, 85.1%, 87.6%, 83.1%, 88.3%, and 89.6% respectively, indicating that the sheep behavior recognition can be accurately realized, which provides new ideas and methods for monitoring the health status of Hu sheep, realizing welfare breeding, and improving breeding efficiency. The ResNet-50 network is a convolutional neural network (CNN) architecture and belongs to the ResNet series. ResNet stands for "residual network". Its structure diagram is shown below Figure 8As shown. The key innovation of the ResNet-50 network is the introduction of residual connections or skip connections. These connections allow information to bypass certain layers and are intended to alleviate the gradient vanishing problem that can occur in deep neural networks. By allowing the network to learn a residual mapping rather than directly learning the desired mapping, the ResNet-50 network enables the training of deeper networks and improves accuracy.

[0105] To sum up, the method for identifying the behavior of Hu sheep based on the ResNet50 network in the above-mentioned embodiment obtains video data and three-axis acceleration sensor data, processes the three-axis acceleration sensor data to obtain activity data and three-axis acceleration data, and uses manual control video data to annotate to obtain annotated data, and uses the activity data, three-axis acceleration data, and annotated data files to train and verify the ResNet50 network, thereby obtaining a Hu sheep behavior identification model. The Hu sheep behavior identification model can be used to accurately identify the behavior of sheep, and provide new ideas and methods for monitoring the health status of Hu sheep, realizing welfare breeding, and providing breeding benefits.

[0106] Although the embodiments of the present invention have been shown and described above, it is to be understood that the above embodiments are exemplary and are not to be construed as limitations of the present invention. A person skilled in the art may change, modify, replace and vary the above embodiments within the scope of the present invention.

Claims

1. A method for identifying Huyang behavior based on ResNet50 network, characterized in that: The following steps are involved: S1: Data Collection Collect video data and three-axis acceleration sensor data; S2: Data preprocessing Each frame of the video data is annotated by manual annotation, and a label is added to each frame to obtain an annotated data file. The three-axis acceleration sensor data is processed to obtain the three-axis acceleration data and activity data, and then three data files are obtained. The three data files are processed to obtain the Huyang behavior data set. S3: Model training and recognition The Hu sheep behavior dataset is divided into a training set and a validation set according to a set ratio. Multiple frames of data in the training set are input into the base ResNet50 network, and the ResNet50 network is trained to obtain the trained Hu sheep behavior model. Finally, one frame of data in the validation set is input into the trained Hu sheep behavior model to realize the recognition of Hu sheep behavior.

2. According to claim 1, a method for identifying lake sheep behavior based on ResNet50 network is characterized in that: In step S1, video data and triaxial acceleration sensor data are collected synchronously.

3. According to claim 1, a method for identifying lake sheep behavior based on ResNet50 network is characterized in that: In step S1, a three-axis acceleration sensor is worn on the lower jaw of the Hu sheep, and each sheep wears one three-axis acceleration sensor.

4. According to a method for identifying Hu sheep behavior based on ResNet50 network according to claim 1, it is characterized in that: In step S2, the three-axis acceleration sensor simultaneously outputs three kinds of raw data on the X, Y, and Z axes, representing acceleration values ​​in three different directions.

5. According to claim 4, a method for identifying lake sheep behavior based on ResNet50 network is characterized in that: In step S2, the specific process of processing the three-axis acceleration sensor data to obtain the three-axis acceleration data is as follows: S201: Read the data on each axis output by the three-axis acceleration sensor, recorded as X, Y, and Z; S202: Use X′, Y′, and Z′ to store the average values ​​of the latest 10 values ​​of X, Y, and Z; S203: Calculate the square sum of the three-axis data as the basic data for processing, and the calculation formula is: D=X×X+Y×Y+Z×Z The square sum D of the three-axis data is calculated and saved in FIFOBUF_0. FIFOBUF_0 stores the latest eight square sums of the three-axis data D1 to D8 in chronological order, where D1 is the latest D value. S204: Calculate the average of the square sum data D1 to D8 of the eight three-axis data stored in FIFOBUF_0 in time sequence, and record it in the variable M; S205: Variable M is stored in FIFOBUF_1, and the two variables M1 and M2 stored in FIFOBUF_1 in chronological order are averaged and recorded in variable A, where M1 is the latest value of M; S206: Save the variable A to FIFOBUF_2, and calculate the difference Δ according to the three variables A1, A2, and A3 stored in FIFOBUF_2 in chronological order. The calculation formula is as follows: Δ=A1-A3 The difference Δ is used to determine whether the acceleration is continuously increasing or decreasing. When Δ is a positive number, it indicates that it is in the continuous increase stage, and when it is a negative number, it indicates that it is in the continuous decrease stage. A1 is the latest A value. S207: Determine whether the absolute value of the difference Δ is greater than 512 and greater than 0. If so, set the variable F to +1, that is, set the variable F=+1, and set the variable MaxValue=A1, and output X′, Y′, and Z′, and end the process; otherwise, proceed to the next step; S208: Determine whether the absolute value of the difference Δ is greater than 512 and less than 0. If so, continue to determine whether the variable F is +1. Otherwise, output X′, Y′, and Z′, and end the process. S209: When it is determined that the variable F is +1, the difference between the variable MaxValue and the variable MinValue is calculated; determine whether it is greater than the set threshold value 2816. If so, it indicates that there is activity, triggering an interrupt signal, performing a new round of detection, resetting the variables: MaxValue=1, MinValue=A1, F=0, and finally outputting X′, Y′, Z′, and ending the process; otherwise, directly performing a new round of detection, resetting the variables: MaxValue=1, MinValue=A1, F=0, and finally outputting X′, Y′, Z′, and ending the process; when it is determined that the variable F is not +1, set the variable F to -1, then set the variable MinValue=A1, output X′, Y′, Z′, and end the process; wherein, the initial value of MinValue is 0.

6. The method for identifying lake sheep behavior based on ResNet50 network according to claim 5 is characterized in that: In step S2, the specific process of processing the three-axis acceleration sensor data to obtain the activity data is as follows: S211: Read the acceleration data on the X-axis, Y-axis, and Z-axis output by the three-axis acceleration sensor; S212: Initialize the minimum value to 65535, the maximum value to 0, and initialize other related variables at the same time, where the other related variables include the maximum position, the minimum position, the activity amount, and the count value; S213: setting two thresholds Th1 and Th2 for subsequent activity amount determination; S214: For each data point, the sum of the squares of the three-axis accelerations is calculated, and a displacement operation is performed to reduce the data range; S215: Calculate the difference between the sum of squares of the three-axis accelerations of the current data point and the previous data point; S216: judging the direction of acceleration change according to the positive or negative sign of the difference, the direction of acceleration change is rising or falling; S217: when the data increases, the maximum value is updated; when the data decreases, the minimum value is updated, and the position is recorded; S218: When the activity changes from rising to falling, and the falling amplitude exceeds the set value, the activity amount from the most recent peak to the trough is calculated, that is, the maximum value minus the minimum value; S219: Determine whether the activity level is between Th1 and Th2, if yes, the count value increases; S220: Repeat the above process for each data point in FIFOBUF_2 until the processing is completed; S221: Output result: The final output count value is the number of activity times that meet the conditions, that is, the activity data is obtained.

7. The method for identifying lake sheep behavior based on ResNet50 network according to claim 6 is characterized in that: In step S2, the frequency of labeling data is 1 time / minute, and a labeling data file is produced for one sheep 24 hours a day, and each piece of labeling data is matched with a time point and a corresponding sheep device number.

8. The method for identifying lake sheep behavior based on ResNet50 network according to claim 7 is characterized in that: In step S2, the specific process of processing the labeled data file, activity data, and triaxial acceleration data to obtain the Huyang behavior data set is as follows: S221: merging all the annotated data files into one annotated file, the annotated file after merging contains the sheep device number, time, and corresponding behavior information; S222: Read activity data from the activity data file, set the reading time period to 5 minutes, and read 33 activity data as a group, including 1 sheep device number, 2 start and end time, and the remaining 30 are activity data; S223: Based on the group of data, the three-axis acceleration data is read, and the sheep device number and the start and end time are judged. When they match, the three-axis acceleration data is added to the group of data. Finally, the annotation file is read to add a label, and the sheep device number and the start and end time are also judged. When they match, the label data corresponding to the behavior is added to the group of data, thereby obtaining a frame of data; S224: Loop steps S222-S223 until all frame data are read to obtain the Huyang behavior data set.

9. A Huyang behavior recognition system based on ResNet50 network, characterized in that: Using the Hu sheep behavior identification method as described in any one of claims 1 to 8 to effectively identify Hu sheep behavior, comprising: Data acquisition module, used to collect video data and three-axis acceleration sensor data; The data preprocessing module is used to annotate each frame of the video data by manual annotation, add a label to each frame, obtain annotated data files, and process the three-axis acceleration sensor data to obtain three-axis acceleration data and activity data, and then obtain three data files, and process the three data files to obtain the Huyang behavior data set; The model training and recognition module is used to divide the Hu sheep behavior data set into a training set and a validation set according to a set ratio, input multiple frames of data in the training set into the base ResNet50 network, train the ResNet50 network to obtain the trained Hu sheep behavior model, and finally input a frame of data in the validation set into the trained Hu sheep behavior model to realize the recognition of Hu sheep behavior.