A time domain segmentation method and early warning system for gander pecking behavior recognition
By identifying and merging the breakpoints in feather-pecking behavior in goose flock monitoring videos, and extracting vibration damping characteristics and muscle group synchronization features, the problem of broken feather-pecking behavior in high-density farming was solved, achieving efficient behavior recognition and early warning.
Patent Information
- Application Number
- CN202511232717.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-01
- Publication Date
- 2025-11-07
- Estimated Expiration
- 2045-09-01
AI Technical Summary
In high-density farming environments, the dynamic occlusion caused by frequent interactions among geese can result in feather-pecking behavior being segmented into multiple discontinuous segments over time. Existing temporal segmentation methods cannot restore the continuity of the occluded behavior, leading to an increase in the false negative and false positive rates of behavior recognition systems.
By acquiring continuous frame sequences of goose flock monitoring videos, behavioral breakpoints caused by occlusion are identified, feather-pecking behavior is segmented into multiple discontinuous sub-segments, action feature vectors are extracted, including vibration damping characteristics and the synchronicity of neck muscle group movements, the changes and similarities of vibration damping characteristics of adjacent sub-segments are calculated, and related sub-segments are merged to generate a complete feather-pecking behavior time period and trigger an alert.
It effectively overcomes the problem of feather-pecking behavior breakage caused by dynamic shading in high-density breeding, accurately identifies the inherent continuity of shading behavior, reduces the missed detection rate and improves the reliability of early warning signals, and avoids false alarms caused by fragmented actions.
Smart Images

Figure CN120748171B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of behavior recognition, more particularly, the present application relates to a time domain segmentation method for recognizing goose pecking feather behavior and a warning system. BACKGROUND
[0002] In the intelligent monitoring of large-scale goose farms, abnormal behavior recognition can be performed based on computer vision. Existing methods usually capture the activities of goose flocks through video streams, locate individuals after target detection and tracking, extract continuous time periods of specific behaviors using time domain segmentation techniques, and finally determine abnormal behaviors such as pecking feathers through classification models. Such techniques rely on the integrity segmentation of behavior segments in continuous video frames and are the mainstream technology route for poultry health monitoring.
[0003] However, in a high-density breeding environment, dynamic occlusion caused by frequent interactions between goose flocks can cause a single pecking behavior to be cut into multiple non-continuous segments in the time dimension. Existing time domain segmentation methods lack a correlation mechanism for broken time sequences and cannot restore the continuity of occluded behaviors, resulting in complete behavior events being disassembled into fragmented actions. This destruction of temporal continuity directly causes the false negative rate and false positive rate of the behavior recognition system to rise simultaneously. SUMMARY
[0004] In order to overcome the above-mentioned defects of the prior art, the present application provides a time domain segmentation method for recognizing goose pecking feather behavior and a warning system to solve the problems raised in the background art.
[0005] To achieve the above-mentioned purpose, the present application provides the following technical solutions:
[0006] A time domain segmentation method for recognizing goose pecking feather behavior, comprising the following steps:
[0007] S1, acquiring a continuous frame sequence of a goose flock monitoring video, performing target detection and tracking on each frame of image, and outputting the motion trajectory of each target goose;
[0008] S2, identifying behavior break points caused by occlusion on the motion trajectory, and cutting the pecking feather behavior into multiple non-continuous sub-segments;
[0009] S3, extracting an action feature vector of each non-continuous sub-segment, the action feature vector including the vibration damping characteristic of the pecked feather area and the synchronicity of the neck muscle movement;
[0010] S4, calculating the vibration damping characteristic change between adjacent non-continuous sub-segments according to the vibration damping characteristic;
[0011] S5. Calculate the similarity of the action feature vectors of adjacent non-continuous sub-segments, and detect the continuity of the spatio-temporal trajectory. When the similarity exceeds a first threshold value, the spatio-temporal trajectory meets a preset continuity condition, and the vibration damping characteristic changes by no more than a second threshold value, it is determined that the sub-segment is associated;
[0012] S6. Merge the time intervals of all associated sub-segments to generate a complete preening behavior time period. When the cumulative length of the complete preening behavior time period exceeds a preset risk threshold value, a warning signal is triggered.
[0013] Further, a continuous frame sequence of the goose group monitoring video is obtained, target detection and tracking are performed on each frame image, and the motion trajectory of each target goose is output, including:
[0014] Based on the kernel correlation filtering algorithm, the position of the target goose in the continuous frame sequence is detected to generate an initial motion trajectory point set;
[0015] The initial motion trajectory point set is subjected to noise filtering and trajectory smoothing processing through a Kalman filtering model;
[0016] The detection positions of the same target goose in adjacent frames are connected in chronological order to form the motion trajectory of each target goose.
[0017] Further, the behavior break point caused by occlusion is identified on the motion trajectory, and the preening behavior is cut into multiple non-continuous sub-segments, including:
[0018] The overlap rate of the bounding boxes of the same target goose in adjacent video frames is calculated;
[0019] When the bounding box overlap rate is below a preset occlusion threshold, it is marked as a behavior break start point;
[0020] During the behavior break duration, if the bounding box overlap rate returns to above the preset visibility threshold, it is marked as a behavior break end point;
[0021] According to the time interval between the behavior break start point and the behavior break end point, a non-continuous sub-segment is cut out from the motion trajectory.
[0022] Further, the action feature vector of each non-continuous sub-segment is extracted, the action feature vector includes the vibration damping characteristic of the preened feather area and the synchronization of the neck muscle movement, including:
[0023] For the video frame sequence contained in the non-continuous sub-segment, the optical flow acceleration field between consecutive frames in the preened feather area is calculated;
[0024] According to the decay slope of the optical flow acceleration field over time, the vibration damping characteristic is extracted;
[0025] Divide the interest region of the stretch muscle group and the peck muscle group in the neck region, and calculate the phase coherence coefficient of the optical flow vector of the two groups of interest regions;
[0026] Take the phase coherence coefficient as the synchrony feature value of the neck muscle group movement;
[0027] Combine the vibration damping characteristic and the synchrony feature value of the neck muscle group movement to form the action feature vector.
[0028] Further, according to the attenuation slope of the optical flow acceleration field changing with time, the vibration damping characteristic includes:
[0029] In the time window of the non-continuous sub-fragment, an exponential decay curve of the intensity of the optical flow acceleration field changing with time is fitted;
[0030] The absolute value of the negative slope of the exponential decay curve is extracted as the vibration damping characteristic value.
[0031] Further, the calculation of the phase coherence coefficient of the optical flow vector includes:
[0032] Based on the goose neck anatomical atlas, the stretch muscle group region and the peck muscle group region are located;
[0033] The Fourier phase spectrum of the optical flow vector field of the two regions is calculated respectively;
[0034] The phase coherence coefficient is calculated by the peak value of the cross-correlation function of the phase spectrum.
[0035] Further, according to the vibration damping characteristic, the vibration damping characteristic change between adjacent non-continuous sub-fragments is calculated, including:
[0036] The vibration damping characteristic values corresponding to adjacent non-continuous sub-fragments are obtained;
[0037] The relative change amount of the vibration damping characteristic value of the latter non-continuous sub-fragment and the vibration damping characteristic value of the former non-continuous sub-fragment is calculated;
[0038] The relative change amount is taken as the vibration damping characteristic change between adjacent non-continuous sub-fragments.
[0039] Further, the similarity of the action feature vector is calculated for adjacent non-continuous sub-fragments, and the continuity of the spatiotemporal trajectory is detected, and when the similarity exceeds a first threshold, the spatiotemporal trajectory meets a preset continuity condition, and the vibration damping characteristic change does not exceed a second threshold, it is determined as a related sub-fragment, including:
[0040] The cosine similarity between the action feature vectors of adjacent non-continuous sub-fragments is calculated as the similarity;
[0041] The motion trajectory of adjacent non-continuous sub-fragments is linearly interpolated, and the average displacement deviation of the interpolated trajectory point and the actual trajectory point is calculated.
[0042] When the cosine similarity is greater than the first threshold value, the average displacement deviation is less than the preset continuity condition limiting displacement value, and the vibration damping characteristic change is less than the second threshold value, it is determined that the corresponding adjacent non-continuous sub-fragment is a related sub-fragment.
[0043] Further, the time intervals of all related sub-fragments are merged to generate a complete preening behavior time period, and a warning signal is triggered when the cumulative duration of the complete preening behavior time period exceeds a preset risk threshold value, including:
[0044] The time intervals determined as related sub-fragments are arranged in chronological order;
[0045] The start time point of the first related sub-fragment and the end time point of the last related sub-fragment are taken to constitute a complete preening behavior time period;
[0046] The time difference between the end time point and the start time point of the complete preening behavior time period is calculated as the cumulative duration;
[0047] When the cumulative duration exceeds the preset risk threshold value, a warning signal is sent to the breeding management terminal.
[0048] On the other hand, the present application provides a time domain segmentation warning system for goose preening behavior recognition, including the following modules:
[0049] The trajectory generation module is used to obtain the continuous frame sequence of the goose group monitoring video, perform target detection and tracking on each frame of image, and output the motion trajectory of each target goose;
[0050] The break cutting module is used to identify the behavior break point generated due to occlusion on the motion trajectory, and cut the preening behavior into multiple non-continuous sub-fragments;
[0051] The feature extraction module is used to extract the motion feature vector of each non-continuous sub-fragment, and the motion feature vector includes the vibration damping characteristic of the preened feather area and the synchronization of the neck muscle group motion;
[0052] The damping calculation module is used to calculate the vibration damping characteristic change between adjacent non-continuous sub-fragments according to the vibration damping characteristic;
[0053] The correlation determination module is used to calculate the similarity of the motion feature vectors of adjacent non-continuous sub-fragments, and detect the continuity of the space-time trajectory, and when the similarity exceeds the first threshold value, the space-time trajectory satisfies the preset continuity condition, and the vibration damping characteristic change does not exceed the second threshold value, it is determined as a related sub-fragment;
[0054] The warning output module is used to merge the time intervals of all related sub-fragments to generate a complete preening behavior time period, and a warning signal is triggered when the cumulative duration of the complete preening behavior time period exceeds a preset risk threshold value.
[0055] Compared with the prior art, the present application has the following beneficial effects:
[0056] 1. By constructing the time sequence correlation mechanism under the shielding scene, the problem of broken pecking behavior caused by dynamic shielding in high-density breeding is effectively overcome; for the non-continuous sub-fragments generated by the break, the vibration damping characteristics and the neck muscle synchronization characteristics are fused to construct a motion feature vector with strong discriminability, which captures the core mode of the pecking behavior from the essence of biomechanics; at the same time, combined with the space-time trajectory continuity detection, a multi-dimensional correlation determination criterion is established to accurately identify the internal continuity of the shielded behavior, and the real continuous time length of the shielded behavior is restored, which significantly improves the integrity and accuracy of the abnormal behavior recognition.
[0057] 2. The target tracking, break repair, feature fusion and early warning decision process are integrated to realize the end-to-end identification of the pecking behavior under the shielding scene, the break correlation is quantified by the change of the vibration damping characteristics, and the robust determination model is constructed combined with the motion similarity and the trajectory continuity, which breaks through the strong dependence on continuous video frames of the prior art; the early warning mechanism is triggered based on the complete behavior time period, which avoids the false alarm caused by fragmented actions, greatly reduces the missed detection rate while ensuring the high credibility of the early warning signal. BRIEF DESCRIPTION OF DRAWINGS
[0058] Figure 1 The flowchart of the time domain segmentation method for the goose pecking behavior recognition of the present application;
[0059] Figure 2 The structural schematic diagram of the time domain segmentation early warning system for the goose pecking behavior recognition of the present application. DETAILED DESCRIPTION
[0060] The technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor are within the scope of protection of the present application.
[0061] Embodiment 1: Figure 1 A time domain segmentation method for goose pecking behavior recognition of the present application is given, which includes the following steps:
[0062] S1, acquiring the continuous frame sequence of the goose group monitoring video, detecting and tracking each frame image, and outputting the motion trajectory of each target goose;
[0063] S2, identifying the behavior break point caused by shielding on the motion trajectory, and cutting the pecking behavior into multiple non-continuous sub-fragments;
[0064] S3, extracting the motion feature vector of each non-continuous sub-clip, the motion feature vector including the vibration damping characteristic of the pecking feather region and the synchronicity of the neck muscle movement;
[0065] S4, calculating the vibration damping characteristic change between adjacent non-continuous sub-clips according to the vibration damping characteristic;
[0066] S5, calculating the similarity of the motion feature vectors of adjacent non-continuous sub-clips and detecting the continuity of the space-time trajectory, when the similarity exceeds a first threshold value, the space-time trajectory meets a preset continuity condition and the vibration damping characteristic change does not exceed a second threshold value, determining that the sub-clips are associated sub-clips;
[0067] S6, merging the time intervals of all associated sub-clips to generate a complete pecking behavior time period, and triggering a warning signal when the cumulative length of the complete pecking behavior time period exceeds a preset risk threshold value.
[0068] S1, obtaining a sequence of continuous frames of a goose group monitoring video, performing target detection and tracking on each frame of image, and outputting the motion trajectory of each target goose, which is implemented as:
[0069] When the kernel correlation filtering algorithm detects the position of the target goose in the sequence of continuous frames, the input sequence of continuous frames is first converted into a sequence of gray-scale images to reduce the computational complexity. For each gray-scale image, the center of the bounding box of the target goose in the previous frame is taken as the reference point, and a rectangular search region is defined in the current frame. The side length of the search region is set to 1.2 times the side length of the bounding box of the previous frame, for example, if the width of the bounding box of the previous frame is 100 pixels, the width of the search region is set to 120 pixels. In the search region, a sample set is generated by cyclic matrix sampling, wherein the positive sample is defined as the region with an offset of no more than 2 pixels from the reference point, and the negative sample is defined as the region with an offset of between 4 pixels and 15 pixels. A 32-dimensional direction gradient histogram feature vector is extracted for all sample blocks, and a ridge regression classifier is trained based on the features of the positive and negative samples. The weight vector of the classifier is solved by minimizing the regularized least squares loss function, and the regularization coefficient is determined by five-fold cross-validation: divide the sample set into five equal parts, take four parts to train the classifier in turn and verify the remaining one part, take the coefficient value corresponding to the highest average classification accuracy, for example, 0.01. The candidate block with the maximum response value is output as the detection position of the target goose by inputting the candidate blocks in the search region of the current frame into the classifier, for example, the pixel point (256, 138) in the image coordinate system. After traversing all frames in the sequence of continuous frames, an initial motion trajectory point set composed of position coordinates of each frame is generated, and the position coordinates are represented in a pixel coordinate system with the top-left corner of the image as the origin, the right direction as the positive direction of the horizontal axis, and the downward direction as the positive direction of the vertical axis.
[0070] When filtering the noise of the initial motion trajectory point set by the Kalman filter model, a state vector containing four components of horizontal coordinate position, vertical coordinate position, horizontal velocity and vertical velocity is established. The state transition matrix is constructed according to the uniform motion model, and the coupling coefficient of position and velocity in the matrix is calculated according to the video frame sampling interval: for example, when the frame interval is 40 milliseconds, the coefficient is 0.04. The observation matrix is designed in the form of [1, 0, 0, 0; 0, 1, 0, 0], so that the system can only observe the position component. The process noise covariance matrix is set according to the target goose motion acceleration range: for example, when the maximum acceleration of the target goose is 100 pixels / s², the diagonal element is 0.25. The observation noise covariance matrix is determined according to the target detection positioning error: for example, when the positioning error standard deviation is 3 pixels, the diagonal element is 9. The Kalman filter performs the following operations: in the prediction stage, the formula "prior state estimate = state transition matrix * posterior state estimate" is used for calculation; in the update stage, the formula "posterior state estimate = prior state estimate + Kalman gain * (actual observation value - observation matrix * prior state estimate)" is used for calculation. The filter is performed on each position point of the initial motion trajectory point set, and the smoothed motion trajectory point sequence is output.
[0071] When connecting the detection positions of the same target goose in adjacent frames in chronological order, a target identity matching mechanism is used. Each target goose detected in the first frame is assigned an identity number in the format of "G+three-digit serial number", such as G001. In subsequent frame processing, the Euclidean distance between the current frame detection position and the positions of each target goose in the previous frame is calculated. When the minimum Euclidean distance is less than the matching threshold (for example, 15 pixels) and the corresponding target goose has no matching record, the current detection position is associated with the identity number of the target goose. If the number of consecutive unmatched frames of the target goose reaches the disappearance threshold (for example, 5 frames), its identity number is released. When the minimum Euclidean distance between a newly appearing detection position and all existing target positions is greater than the appearance threshold (for example, 25 pixels), a new identity number is assigned. The motion trajectory of each target goose is composed of the position coordinates corresponding to its identity number arranged in ascending order of timestamp, and the timestamp accuracy is 1 millisecond. The final motion trajectory is stored as a doubly linked list data structure, and the linked list node contains three fields: timestamp (unit: millisecond), horizontal coordinate value (unit: pixel), and vertical coordinate value (unit: pixel). The time interval between adjacent nodes is equal to the video frame sampling interval, for example, 40 milliseconds.
[0072] In a specific implementation, the matching threshold and the appearance threshold are dynamically adjusted according to the number of targets in a single frame: when the number of targets is greater than 20, the matching threshold is lowered to 12 pixels; when the number of targets is less than 5, the matching threshold is raised to 30 pixels. The observation noise covariance matrix is calibrated offline: 1000 frames of images are collected in a static scene, and the variance of the background point coordinates is calculated as the reference value. The process noise covariance calibration method is: control the target goose to move at a constant speed, and record the deviation variance of the actual trajectory and the theoretical trajectory. The linked list operation supports bidirectional traversal: forward traversal accesses from the head node to the tail node along the next pointer; backward traversal accesses from the tail node to the head node along the prev pointer.
[0073] S2, identify the behavior breaking point caused by occlusion on the motion trajectory, cut the preening behavior into multiple non-continuous sub-segments, and implement as:
[0074] When calculating the overlap rate of the bounding boxes of the same target goose in adjacent video frames, first obtain the motion trajectory data of the target goose in the continuous frame sequence. The motion trajectory data is derived from the bidirectional linked list structure output by step S1, and the linked list node includes a timestamp field, a horizontal coordinate value field, and a vertical coordinate value field. For two adjacent frames (denoted as the t-th frame and the t+1-th frame), the position coordinates of the target goose in the two frames are extracted from the linked list node. A rectangular bounding box is generated centered on the position coordinates, and the size of the bounding box is set according to the average size of the target goose, for example, the width is 80 pixels and the height is 120 pixels. The overlap rate calculation uses the intersection over union formula, which is defined as the area of the overlapping region divided by the area of the union of the two bounding boxes. When implementing, the following operations are performed: calculate the left upper corner coordinates and the right lower corner coordinates of the intersection region of the two bounding boxes, the left upper horizontal coordinate of the intersection region takes the maximum value of the left upper horizontal coordinates of the two bounding boxes, and the left upper vertical coordinate takes the maximum value of the left upper vertical coordinates of the two bounding boxes; the right lower horizontal coordinate of the intersection region takes the minimum value of the right lower horizontal coordinates of the two bounding boxes, and the right lower vertical coordinate takes the minimum value of the right lower vertical coordinates of the two bounding boxes. When the width and height values of the intersection region are both positive, the overlapping area is calculated as width x height; when either the width or the height value is negative, the overlapping area is set to zero. The area of the union of the two bounding boxes is calculated as the area of the first bounding box plus the area of the second bounding box minus the area of the overlapping region. Finally, the overlap rate is calculated according to the formula "overlap rate = overlapping area ÷ union area x 100%", and the calculation result is rounded to two decimal places.
[0075] The behavior break starting point is marked when the bounding box overlap ratio is lower than a preset occlusion threshold. The preset occlusion threshold is determined by statistical experiments: collect video clips containing target goose occlusion, manually annotate the occlusion starting frame, and calculate the average overlap ratio distribution of the previous 10 frames. When the 5th percentile value of the overlap ratio distribution is, for example, 15%, the occlusion threshold is set to 15%. The specific marking process is: establish the occlusion state flag of the target goose, and the initial state is set to visible state. Traverse the video frame sequence in chronological order, and when the overlap ratio of the current frame and the previous frame is lower than the preset occlusion threshold (for example, 15%) and the target goose is in the visible state, mark the current frame as the behavior break starting point, and switch the state flag to the occlusion state. The behavior break starting point record information includes: target goose identity number (format G plus three digit serial number, for example, G001), starting frame number field, starting timestamp field (precision 1 millisecond).
[0076] During the behavior break duration, if the bounding box overlap ratio returns to above the preset visible threshold, the behavior break ending point is marked. The preset visible threshold setting principle is: in the statistical sample, calculate the average overlap ratio distribution of the target goose when it reappears for 10 consecutive frames, and take the 95th percentile value as, for example, 65%, then set the visible threshold to 65%. The termination point marking condition contains three constraints: the target goose is currently in the occlusion state; the overlap ratio of the current frame and the previous frame is greater than or equal to the preset visible threshold (for example, 65%); the overlap ratio state duration reaches the stable threshold (for example, 3 consecutive frames). When all conditions are met, the frame that first reaches the visible threshold is marked as the behavior break ending point, and the state flag is restored to the visible state. The behavior break ending point record information includes: target goose identity number, ending frame number field, ending timestamp field (precision 1 millisecond), and forms a pairing relationship with the starting point of the target.
[0077] According to the time interval cutting of the behavior fracture starting point and the behavior fracture ending point, a time interval mapping table is established. The time interval mapping table is a hash table structure, the key is the target goose identification number field, and the value is the list of all fracture intervals of the target goose. Each fracture interval object contains three fields: a starting timestamp field, an ending timestamp field, and an associated motion trajectory pointer field. The cutting operation includes the following steps: reading the motion trajectory double-linked list generated by the target goose at S1; traversing the list nodes, marking all nodes with a timestamp field value greater than or equal to the fracture interval starting timestamp field value and less than or equal to the fracture interval ending timestamp field value as invalid nodes; and cutting the adjacent valid node sequence into independent sub-segments. Each non-continuous sub-segment is stored as a new double-linked list, and sub-segment metadata is added to the head of the list. The metadata includes: the target goose identification number field, the sub-segment starting timestamp field, the sub-segment ending timestamp field, the predecessor sub-segment pointer field (if none, set to empty value), and the successor sub-segment pointer field (if none, set to empty value). The original motion trajectory data is preserved during sub-segment cutting, and no coordinate transformation or interpolation processing is performed.
[0078] In a specific implementation, the stability threshold is dynamically adjusted according to the video frame rate: when the frame rate is 25 frames per second, the stability threshold is set to 3 frames (corresponding to 120 milliseconds); when the frame rate drops to 15 frames per second, the stability threshold is simultaneously lowered to 2 frames (corresponding to 133 milliseconds). The overlap rate calculation uses double-precision floating-point operations to avoid precision loss in integer division. The fracture interval processing boundary conditions are as follows: if the target goose is still in the occluded state at the end of the video, the last frame timestamp is used as a virtual ending point; if it is already in the occluded state at the beginning of the video, the first frame timestamp is used as a virtual starting point. After generating the sub-segment linked list, integrity verification is performed: check the timestamp continuity of adjacent sub-segments to ensure that there is no overlap or gap; verify that the predecessor pointer field and the successor pointer field form a bidirectional link relationship.
[0079] The calibration process of the preset occlusion threshold and the visible threshold: the experiment includes different lighting conditions (sunny, cloudy, night light compensation). At least 50 samples are collected for each condition, the overlap rate distribution curve of each sample set is calculated, and the minimum value of the 5th percentile of all distribution curves is taken as the final occlusion threshold, and the maximum value of the 95th percentile of all distribution curves is taken as the final visible threshold. The calibration data is stored as a threshold lookup table, and the table index includes the ambient light intensity (unit: lux). During implementation, the corresponding threshold is matched according to the real-time light sensor reading.
[0080] S3, extract the motion feature vector of each non-continuous sub-segment, which includes the vibration damping characteristics of the pecked feather area and the synchronization of the neck muscle group motion, and is implemented as:
[0081] For the video frame sequence contained in the non-continuous sub-fragment, when calculating the optical flow acceleration field between the continuous frames in the pecked feather region, first locate the pecked feather region. The region positioning method is: taking the center of the target goose back as the reference point, taking a rectangular region of a length proportion of, for example, 30% downward along the spine direction, and setting the width to, for example, 50% of the width of the target goose body. The region coordinates are obtained from the non-continuous sub-fragment bidirectional linked list output in the S2 step, and the linked list node contains a position coordinate field. The optical flow acceleration field calculation is implemented using the Farneback algorithm: for three continuous frames (denoted as the nth frame, the nth+1 frame, and the nth+2 frame), first calculate the optical flow vector field between the nth frame and the nth+1 frame, and then calculate the optical flow vector field between the nth+1 frame and the nth+2 frame. The optical flow vector field is approximated by a second-order polynomial expansion, and the neighborhood window size is set to, for example, 15 pixels by 15 pixels. The acceleration field is obtained by subtracting the previous optical flow vector from the latter optical flow vector, and the calculation result is stored as a three-dimensional array structure, with the array dimensions being the image height value multiplied by the width value multiplied by 2 (corresponding to the x-axis acceleration component and the y-axis acceleration component, respectively). The intensity value of the optical flow acceleration field of the pecked feather region is calculated by taking the square of the x component and the square of the y component and then taking the square root, and the intensity value matrix size is consistent with the region size.
[0082] When extracting the vibration damping characteristic according to the decay slope of the optical flow acceleration field over time, the operation is performed within the time window of the non-continuous sub-fragment. The time window length is set according to the sub-fragment duration: when the sub-fragment duration is greater than 200 milliseconds, the time window is 200 milliseconds; when the sub-fragment duration is less than 200 milliseconds, the complete sub-fragment duration is taken. Within the time window, the optical flow acceleration field intensity values are sampled at intervals of 20 milliseconds, and the number of sampling points is the time window length divided by 20 milliseconds. The intensity value sequence of the sampling points is fitted with an exponential decay curve, and the curve model satisfies the form of the intensity value equal to the initial intensity value multiplied by the negative decay coefficient of the natural constant e multiplied by the time power. The fitting is implemented using the least squares method, and the iteration termination condition is that the change amount of the residual sum of squares is less than 0.01. The decay coefficient value of the fitted curve is extracted, and the absolute value of the coefficient is taken as the vibration damping characteristic value. When the sub-fragment contains multiple time windows, the average value of the window results is taken, for example, 5 windows are calculated to obtain the arithmetic mean of the absolute values of the 5 decay coefficients.
[0083] In the division of the interest region of the stretch muscle group and the pecking muscle group in the neck region, a coordinate system is established based on the standard goose neck atlas. The atlas is pre-labeled with key anatomical points: skull base point, first cervical vertebra point, third cervical vertebra point, suprasternal point. The stretch muscle group region is defined as a left strip region of the line connecting the skull base point and the suprasternal point, with a width of, for example, 15% of the length of the line; the pecking muscle group region is defined as a circular region with the third cervical vertebra point as the center, with a radius of, for example, 30 pixels. The region coordinate conversion method is: according to the current posture of the target goose, the atlas coordinate system is mapped to the image coordinate system through affine transformation, and the transformation process includes translation operation, rotation operation and scaling operation. The translation parameter takes the image coordinate of the neck base point, the rotation parameter takes the included angle between the neck axis and the horizontal axis, and the scaling parameter takes the ratio of the atlas reference length to the actual pixel length. The mapped interest region is stored as a binary mask matrix, with pixel values of 1 in the region and 0 elsewhere.
[0084] When calculating the phase coherence coefficient of the optical flow vector of the two groups of interest regions, the stretch muscle group region and the pecking muscle group region are processed respectively. The optical flow vector field is derived from the calculation results of the aforementioned Farneback algorithm. For each region, the following operations are performed: extract the optical flow vector of all pixel points in the region; decompose the vector into x component sequence and y component sequence; perform discrete Fourier transform on the component sequences respectively. The Fourier transform uses the fast Fourier transform algorithm, with a sampling frequency of video frame rate (e.g. 25 frames per second) and a transform length of zero padding to the nearest power of 2. Extract the phase spectrum after transformation, and obtain the ratio of the imaginary part to the real part by the inverse tangent function. The cross-correlation function of the phase spectrum of the two regions is calculated in the following way: shift the stretch muscle group phase spectrum and the pecking muscle group phase spectrum by the time shift parameter, then multiply and accumulate point by point, where the time shift parameter ranges from -10 frames to +10 frames. By traversing the time shift parameter value, the maximum peak value of the cross-correlation function is found, and the normalized phase coherence coefficient is obtained by dividing the peak value by the geometric mean of the energy values of the two phase spectra, with the normalized coefficient ranging from 0 to 1.
[0085] When the phase coherence coefficient is used as the synchronization feature value of the neck muscle group movement, the normalized phase coherence coefficient value calculated is directly used without additional conversion. This value represents the coordination degree of the two muscle groups in the feather pecking behavior, and the closer the coefficient value is to 1, the stronger the synchronization is.
[0086] When the vibration damping characteristic and the synchronization characteristic value of the neck muscle group movement form the action feature vector, a two-dimensional vector data structure is created. The first element of the vector stores the vibration damping characteristic value, and the second element stores the phase coherence coefficient value. The vector storage uses a floating-point number array format, and the array length is 2. The memory is allocated continuously. The above process is repeated for each frame of image of the non-continuous sub-fragment, and finally a time sequence composed of all frame action feature vectors is output, and the time sequence is strictly aligned with the video frame timestamp.
[0087] In a specific implementation, the anatomical atlas reference length is determined by actual measurement: collect X-ray images of the neck of 10 adult geese, measure the average distance from the base of the skull to the upper sternum, for example, 250 mm, and set it as the reference length. The affine transformation parameter calculation uses the least squares method: label 4 anatomical points (skull base point, first cervical vertebra point, third cervical vertebra point, and upper sternum point) in the image, establish a corresponding relationship with the atlas coordinates, and solve the optimal transformation matrix. The phase spectrum calculation boundary processing: when the number of region pixels is less than 50, the region radius is expanded until the minimum pixel requirement is met. Time series storage uses a structure array, each element contains a timestamp field and a feature vector field, and the timestamp accuracy is 1 ms.
[0088] The unit dimension of the vibration damping characteristic value is millisecond per one, and the phase coherence coefficient is dimensionless. After the feature vector is generated, data verification is performed: check whether the vibration damping characteristic value is within a reasonable range (for example, 0.01 to 10 milliseconds per one); verify whether the phase coherence coefficient is within the interval of 0 to 1; and confirm that the feature vector dimension matches the frame number.
[0089] S4, calculate the vibration damping characteristic change between adjacent non-continuous sub-fragments according to the vibration damping characteristic, which is implemented as:
[0090] When the vibration damping characteristic values corresponding to adjacent non-continuous sub-fragments are obtained, first, the time sequence index of the non-continuous sub-fragments is established. The index construction method is: from the action feature vector time sequence output in step S3, extract the start timestamp field and the end timestamp field of each non-continuous sub-fragment. Arrange all non-continuous sub-fragments in ascending order of the start timestamp field value to form an ordered sub-fragment list. Adjacent non-continuous sub-fragments are defined as two sub-fragments with consecutive serial numbers in the list, i.e. the i-th sub-fragment and the i+1-th sub-fragment. The vibration damping characteristic value acquisition process is: traverse the action feature vector time sequence of each non-continuous sub-fragment; extract the vibration damping characteristic value field of the sub-fragment from the sequence; when the sub-fragment contains multiple frames of data, take the arithmetic mean of all frame vibration damping characteristic values as the representative value. The vibration damping characteristic values of adjacent non-continuous sub-fragment pairs are stored as two-dimensional tuple structures, and the first element of the tuple stores the vibration damping characteristic value of the previous sub-fragment, and the second element stores the vibration damping characteristic value of the next sub-fragment.
[0091] When the relative change amount of the vibration damping characteristic value of the latter non-continuous sub-fragment and the vibration damping characteristic value of the former non-continuous sub-fragment is calculated, a difference and normalization operation is performed. The difference operation calculates the absolute difference value of the two vibration damping characteristic values, that is, the result of subtracting the former value from the latter value. The normalization operation adopts a relative change rate calculation method: when the difference value is positive, the relative change amount is equal to the absolute difference value divided by the former vibration damping characteristic value; when the difference value is negative, the relative change amount is equal to the absolute difference value divided by the latter vibration damping characteristic value after taking a negative sign; when the difference value is zero, the relative change amount is zero. The specific implementation includes the following processing rules: if the former vibration damping characteristic value is zero, skip the adjacent pair and do not calculate; if the calculation result exceeds the preset reasonable range (for example, -10 to +10), start a data verification process to reacquire the original characteristic value. The calculation process adopts double-precision floating-point number operation, and the result is kept to four decimal places. For each adjacent non-continuous sub-fragment pair, a relative change amount record object is generated, which includes three fields: a former sub-fragment index field, a latter sub-fragment index field, and a relative change amount field.
[0092] When the relative change amount is output as the vibration damping characteristic change between adjacent non-continuous sub-fragments, a vibration damping characteristic change mapping table is constructed. The mapping table adopts a hash table data structure, the key is the unique identifier of the adjacent sub-fragment pair, and the identifier generation rule is that the former sub-fragment index value is multiplied by 10000 and then the latter sub-fragment index value is added. The value object includes five fields: a former vibration damping characteristic value field, a latter vibration damping characteristic value field, a relative change amount field, a calculation timestamp field (precision 1 millisecond), and a validity flag field. Before output, data verification is performed: check whether the relative change amount field is within the numerical range (for example, -10 to +10); verify whether the former and latter sub-fragment index fields are continuous; confirm whether the vibration damping characteristic value field is derived from the valid output of S3 step. The validity flag field setting rule is: when all data verifications pass, set to the valid state value 1, otherwise set to the invalid state value 0.
[0093] In the specific implementation, the sorting algorithm of the time sequence index adopts quicksort. The sorting comparison function is defined as: if the starting timestamp field value of sub-fragment A is less than the starting timestamp field value of sub-fragment B, it is determined that A is before B; if they are equal, the terminal timestamp field value is compared. The boundary processing of the relative change amount calculation: when the interval between adjacent sub-fragments exceeds the preset time threshold (for example, 500 milliseconds), a time interval warning flag is added in the relative change amount record object. The average number calculation when the vibration damping characteristic value is obtained adopts a weighted average strategy: for the vibration damping characteristic values of different time windows in the sub-fragment, the weights are allocated according to the proportion of the corresponding window duration in the total duration of the sub-fragment.
[0094] The data storage adopts a columnar structure: three independent arrays are established, i.e., a vibration damping characteristic value array, a relative change amount array, and a timestamp array. The array index strictly corresponds to the ordered sub-fragment list index. After the output mapping table is generated, integrity checking is performed: all adjacent pairs are traversed to ensure that there is no omission or repetition; the hash collision processing mechanism (using a linked list method to solve the collision) is checked; and the identifier generation rule is verified to ensure that it will not cause duplication (the index value range is limited to 0 to 9999). Finally, the output is written to a binary data file, and the file header includes a version number field, a creation timestamp field, and an adjacent pair number field. The data body is stored in the order of adjacent pairs.
[0095] The dimension of the vibration damping characteristic value is millisecond per one, and the relative change amount is a dimensionless ratio. During the implementation process, log information is recorded: the input value, the output value, and the calculation time (in milliseconds) are recorded each time. When invalid state values appear continuously for more than a preset number of times (e.g., 5 times), an abnormal processing procedure is triggered: the current calculation is paused; the feature data of S3 is reloaded; and the sub-fragment time sequence index is re-established.
[0096] The time effectiveness constraint of adjacent sub-fragments: only adjacent pairs with a starting timestamp difference less than the maximum allowed interval (e.g., 2 seconds) are processed. If the sub-fragment interval exceeds this value, no vibration damping characteristic change record is generated. Metadata is attached when the mapping table is output: it includes the total number of sub-fragments involved in the calculation, the number of valid adjacent pairs, the number of invalid adjacent pairs, and the failure reason statistics. The output interface is defined as a function call, and the input parameter is the S3 feature data pointer. The output parameter is the vibration damping characteristic change mapping table pointer.
[0097] Special case handling for relative change amount calculation: when the vibration damping characteristic values of adjacent sub-fragments are both zero, the relative change amount is set to zero; when the sign changes (positive to negative or negative to positive), the relative change amount takes the sign change flag value (e.g., +999 indicates positive to negative, and -999 indicates negative to positive). The calculation result is rounded to the fourth digit after the decimal point, and the rounding rule is that if the fifth digit is greater than or equal to 5, it is incremented.
[0098] S5, calculate the similarity of the action feature vector of adjacent non-continuous sub-fragments, and detect the continuity of the spatio-temporal trajectory. When the similarity exceeds a first threshold value, the spatio-temporal trajectory meets a preset continuity condition, and the vibration damping characteristic change does not exceed a second threshold value, the sub-fragments are determined to be associated, and the following is implemented:
[0099] When the cosine similarity between the action feature vectors of adjacent non-continuous subsegments is calculated, the action feature vector sequence generated in S3 is first obtained. For an adjacent non-continuous subsegment pair (denoted as subsegment A and subsegment B), the feature vectors are selected according to the timestamp alignment principle in the interval from the end timestamp of A to the start timestamp of B. The alignment method is as follows: a 20 ms time window is taken, and the arithmetic mean of the feature vectors in each time window is taken as the representative vector. When there is no data in the time window, the feature vector is completed by linear interpolation. The cosine similarity calculation performs the following operations: the dimension component values of the representative vector of subsegment A and the representative vector of subsegment B are extracted; the dot product value (sum of the product of each dimension component) of the two vectors is calculated; the modulus of vector A (square root of the sum of the squares of each component) and the modulus of vector B are calculated respectively; and finally the similarity value is equal to the dot product value divided by the product of the modulus of vector A and the modulus of vector B. The calculation result ranges from -1 to 1, and is kept to four decimal places.
[0100] When the motion trajectory of adjacent non-continuous subsegments is linearly interpolated and the average displacement deviation is calculated, the data is extracted from the motion trajectory double-linked list output from S1. The linear interpolation operation includes: determining the interpolation time interval as the end timestamp of subsegment A to the start timestamp of subsegment B; generating an interpolation time point sequence with an interval of 10 ms; for each interpolation time point, calculating the interpolation position according to the coordinates of the front and rear trajectory points. The position calculation rule is as follows: let the adjacent trajectory points P1 have a timestamp T1 and coordinates (X1, Y1), and P2 have a timestamp T2 and coordinates (X2, Y2), and the interpolation point time Tx has coordinates Xx = X1 + (X2 - X1) × (Tx - T1) / (T2 - T1), and Yx is calculated in the same way. The actual trajectory points are derived from the original detection positions in S1, and are matched with the interpolation time points according to the timestamps. The average displacement deviation calculation process is as follows: for each interpolation time point, the Euclidean distance between the interpolation coordinates and the actual coordinates is calculated; the distance values of all time points are accumulated; and the average displacement deviation value is obtained by dividing the total number of interpolation points. The calculation result is in pixels, and is kept to one decimal place.
[0101] The sub-fragments are marked as associated when all three conditions are met. The first condition is that the cosine similarity is greater than a first threshold value: the first threshold value is set by counting 100 consecutive pecking behavior samples, taking the 90th percentile value of the sample similarity distribution, for example 0.85. The second condition is that the average displacement deviation is less than a preset continuity condition limited displacement value: the value is set according to the target goose movement speed, calculated according to the formula "limited displacement value = reference speed x maximum allowed time interval", wherein the reference speed is the average walking speed of geese (for example, 200 pixels per second), and the maximum allowed time interval is the upper limit of the sub-fragment break time (for example, 500 milliseconds), and then the limited displacement value is 100 pixels. The third condition is that the vibration damping characteristic change is less than a second threshold value: the second threshold value is derived from the reasonable range of vibration damping characteristic change output by step S4, taking the 95th percentile value of the absolute value of the change, for example 0.5. The determination execution process is as follows: create an associated determination record object; check whether the cosine similarity field value is greater than the first threshold value (for example, 0.85); check whether the average displacement deviation field value is less than the limited displacement value (for example, 100 pixels); check whether the absolute value of the vibration damping characteristic change field output by S4 is less than the second threshold value (for example, 0.5); when all three conditions are met, set the association flag field to true, otherwise set it to false.
[0102] The association sub-fragment determination result is stored as an association graph structure. The nodes of the graph represent non-continuous sub-fragments, and the node attributes include sub-fragment index, start timestamp, and end timestamp. The edges of the graph represent the association relationship, and the edge attributes include: cosine similarity value, average displacement deviation value, vibration damping characteristic change value, and association flag state (true / false). The construction rule of the graph is: when two sub-fragments meet the time adjacency (no other sub-fragments in between) and the association flag is true, a directed edge is added from the original sub-fragment to the subsequent sub-fragment. The edge weight is set as the weighted sum of the cosine similarity, the reciprocal of the displacement deviation, and the reciprocal of the vibration damping change, with weight coefficients of 0.6, 0.3, and 0.1, respectively.
[0103] In specific implementation, the time window length of feature vector alignment is dynamically adjusted according to the sub-fragment density: when the average length of sub-fragments is less than 100 milliseconds, the time window is shortened to 10 milliseconds; when it is greater than 500 milliseconds, it is extended to 50 milliseconds. The interpolation point density is associated with the video frame rate: when the frame rate is 25 frames per second, the interpolation is 10 milliseconds; when the frame rate is 15 frames per second, the interpolation is 15 milliseconds. The boundary condition processing of the association determination includes: when the sub-fragment interval exceeds 2 seconds, no association determination is performed; when the feature vector contains invalid values, the previous value is used instead; when the motion trajectory is missing by more than 50%, the displacement deviation calculation is skipped.
[0104] Threshold updating mechanism: Recalculate the first threshold and the second threshold according to new samples after processing 1000 adjacent pairs. The first threshold is updated to the 90th percentile of the sliding window of historical similarity data (window size 100 pairs); the second threshold is updated to the 95th percentile of the sliding window of absolute values of vibration damping changes. Limit displacement value adjustment according to ambient light: When the light intensity is lower than 50 lux, the limit displacement value is increased by 20%; when it is higher than 200 lux, it is decreased by 10%.
[0105] Log records include: input and output values of each decision, calculation time consumption (milliseconds), decision result. When 10 consecutive decisions appear associated with false, trigger threshold calibration process: suspend real-time processing; reload historical samples; update all threshold parameters. The association graph output is in the adjacency list format, and the table entry contains the start node index, the end node index, and the edge attribute tuple. The final associated sub-fragment list is generated by traversing the connected components of the graph: start depth-first search from the node with no predecessor edge, and mark all sub-fragments on the same path as an associated group.
[0106] Verification mechanism: Check the time continuity of sub-fragments in the associated group (the start timestamp of the next fragment is greater than the end timestamp of the previous fragment); verify that the displacement deviation mean is less than the limit displacement value in the group; confirm that the vibration damping change magnitude is stable (the standard deviation of changes in the group is less than 0.1). Invalid associated group automatic exclusion criteria: less than 3 sub-fragments in the group; the total duration of the group is less than 300 milliseconds; the similarity fluctuation in the group exceeds 0.2.
[0107] S6, merge the time intervals of all associated sub-fragments to generate the complete preening behavior time period, and trigger a warning signal when the cumulative duration of the complete preening behavior time period exceeds the preset risk threshold, which is implemented as:
[0108] When the time intervals of the associated sub-fragments are arranged in chronological order, data is extracted from the association graph output in step S5. The extraction process is: traverse all connected components of the association graph; sort the sub-fragment nodes in each connected component in ascending order of the start timestamp field value; generate an ordered sub-fragment list. The sorting algorithm uses merge sort, and the comparison function is defined as: if the start timestamp field value of sub-fragment A is less than that of sub-fragment B, then A is before B; if they are equal, compare the end timestamp field value. The time interval data structure is defined as a triple: start timestamp field (unit: milliseconds), end timestamp field (unit: milliseconds), sub-fragment index field. The arrangement result is stored as an ordered array structure, and the array elements are time interval triples. The array index strictly corresponds to the time order. Boundary condition processing includes: when the sub-fragments in the connected component overlap in time, sort them according to the start timestamp field value priority principle; when the time interval exceeds the preset tolerance (e.g. 5 milliseconds), insert a virtual interval marker.
[0109] When the start time point of the first associated sub-fragment and the end time point of the last associated sub-fragment are taken to constitute a complete pecking behavior time period, a merging operation is performed for each connected component. The merging rule is: read the first element of the ordered sub-fragment list, extract the start time stamp field value as the start point of the time period; read the last element of the list, extract the end time stamp field value as the end point of the time period. The time period data structure is defined as: start time point field (unit: millisecond), end time point field (unit: millisecond), number of included sub-fragments field, time period index field. The time period index generation rule is: year (4 bits), month (2 bits), day (2 bits), serial number (4 bits), for example, 202307150001. When the number of sub-fragments in the connected component is 1, the time interval of the sub-fragment is directly taken as the complete time period. Time period validity verification includes: checking that the start time point field value is less than the end time point field value; confirming that all sub-fragments in the time period have been associated; verifying time continuity (the start time stamp field value of the next sub-fragment is not earlier than the end time stamp field value of the previous sub-fragment).
[0110] When the time difference between the end time point and the start time point of the complete pecking behavior time period is calculated as the cumulative duration, the time difference is calculated. The calculation rule is: the cumulative duration field value is equal to the end time point field value minus the start time point field value, and the result is in milliseconds. The calculation process uses 64-bit integer operation to avoid overflow. The cumulative duration is stored as an additional field of the time period data structure, and a dimension identifier "ms" is added. When the cumulative duration exceeds 24 hours, it is stored in the format of "day: hour: minute: second", for example, 86400000 milliseconds is converted to "1:00:00:00". Cumulative duration data verification includes: value non-negative check; reasonable range check (for example, 10 milliseconds to 1 hour); deviation check from the total duration of the sub-fragments (the deviation threshold is set to 5%).
[0111] When the cumulative duration exceeds the preset risk threshold, a warning signal is sent to the breeding management terminal to implement a warning triggering mechanism. The preset risk threshold is set through statistical analysis: collect historical pecking behavior data and calculate the duration distribution of normal pecking and aggressive pecking. Take the 95th percentile value of the aggressive pecking duration distribution as the risk threshold reference value, for example, 5000 milliseconds. Threshold dynamic adjustment mechanism: automatically adjust according to the density of the goose group, when the number of geese per shed exceeds 50, the threshold is lowered by 20%; when it is less than 20, the threshold is raised by 10%. The warning trigger condition is that the cumulative duration field value is greater than the current risk threshold. The warning signal contains the following fields: goose shed number field, target goose identification number field, time period start time point field, time period end time point field, cumulative duration field, risk level field (1-3 levels). The signal transmission uses MQTT protocol, the topic format is "farm / alert / pecking / {goose shed number}", and the message body is in JSON format, containing all the warning fields.
[0112] In a specific implementation, time-ordered fault-tolerant processing: when there is a time gap between sub-segments (more than 100 milliseconds), add a gap marker object in the ordered array. Exception handling for complete time period generation: when the connected component contains more than 20 sub-segments, automatically split into multiple time periods; when the time period spans multiple days, add a date change marker. The time reference for cumulative duration calculation is UTC timestamp, avoiding time zone conversion errors. Warning signal sending uses an asynchronous queue mechanism: create a warning task queue; the task object contains warning data and a retry count field (initial value 0); retry count increases by 1 when sending fails, with a maximum of 3 retries; if it fails for 3 consecutive times, it is converted to offline storage.
[0113] Calibration process of preset risk threshold: update the threshold every 24 hours. The update data source is all pecking behavior time periods for the day; calculate the 95th percentile value of the duration distribution; if the difference between the current threshold is more than 10%, update the threshold. Warning classification rules: level 1 warning is when the cumulative duration exceeds the risk threshold but is less than 1.2 times the threshold; level 2 is 1.2 to 1.5 times; level 3 is 1.5 times or more. Different levels correspond to different response strategies: level 1 sends an APP notification; level 2 adds a SMS reminder; level 3 triggers a sound and light alarm.
[0114] Breeding management terminal interface specification: supports HTTP / HTTPS protocol, port 8080; authentication uses OAuth2.0 protocol; data exchange format is JSON. Terminal types include: mobile APP (Android / iOS), Web console, sound and light alarm. Warning record storage uses a time series database, with a data retention policy of: level 1 warning for 7 days, level 2 for 30 days, and level 3 for 180 days. Terminal feedback mechanism: the operator sends a confirmation signal after confirming the warning, and the system records the confirmation timestamp and operator ID.
[0115] Verification and monitoring: generate a warning effectiveness report daily, including a false positive rate field (proportion of non-attack behavior triggers) and a false negative rate field (proportion of real attacks not triggered). Real-time monitoring dashboard displays: current active warning quantity field, today's cumulative warning times field, and processing response time field. When the false positive rate exceeds 20% or the false negative rate exceeds 5%, automatically trigger the model recalibration process: re-collect training data; update S3 feature extraction parameters; recalculate the risk threshold.
[0116] Merging boundary conditions for time intervals of associated sub-segments: the maximum allowed time gap is set to 200 milliseconds, and if it exceeds this value, it will not be merged. Delay handling for cumulative duration exceeding the risk threshold: set a 10-second buffer period, during which if the cumulative duration falls below the threshold, cancel the warning. Time period index conflict resolution: use a distributed unique ID generation algorithm (snowflake algorithm) to avoid index duplication when deploying multiple nodes.
[0117] Embodiment 2: Figure 2 A structural schematic diagram of a time domain segmentation early warning system for recognizing pecking behavior of geese is given, and the time domain segmentation early warning system for recognizing pecking behavior of geese comprises the following modules:
[0118] A trajectory generation module is configured to acquire a continuous frame sequence of a geese monitoring video, perform target detection and tracking on each frame of image, and output a motion trajectory of each target goose;
[0119] A break cutting module is configured to identify a behavior break point caused by occlusion on the motion trajectory, and cut the pecking behavior into a plurality of non-continuous sub-segments;
[0120] A feature extraction module is configured to extract a motion feature vector of each non-continuous sub-segment, and the motion feature vector comprises vibration damping characteristics of a pecked feather region and synchronization of neck muscle movement;
[0121] A damping calculation module is configured to calculate a vibration damping characteristic change between adjacent non-continuous sub-segments according to the vibration damping characteristics;
[0122] An association determination module is configured to calculate a similarity of motion feature vectors of adjacent non-continuous sub-segments, and detect continuity of a space-time trajectory, and when the similarity exceeds a first threshold value, the space-time trajectory meets a preset continuity condition, and the vibration damping characteristic change does not exceed a second threshold value, the non-continuous sub-segments are determined as associated sub-segments;
[0123] An early warning output module is configured to merge time intervals of all associated sub-segments to generate a complete pecking behavior time period, and trigger an early warning signal when a cumulative length of the complete pecking behavior time period exceeds a preset risk threshold value.
[0124] The calculations involved in the embodiments are all de-dimensioned to calculate numerical values, and preset parameters and threshold values in the calculations are set by a person skilled in the art according to actual conditions.
[0125] The above embodiments can be realized in whole or in part through software, hardware, firmware or any combination thereof. When realized through software, the above embodiments can be realized in whole or in part in the form of a computer program product.
[0126] Those skilled in the art can realize that the modules and algorithm steps of the examples described in combination with the embodiments disclosed herein can be realized by electronic hardware or a combination of computer software and electronic hardware. Whether the functions are realized in hardware or software depends on the specific application of the technical solution and the constraints of the invention. A person skilled in the art can use different methods to realize the described functions for each specific application, but such implementation should not be considered beyond the scope of the present application.
[0127] In addition, each function module in each embodiment of the present application can be integrated in one processing module, or each module can exist physically separately, or two or more modules can be integrated in one module.
[0128] In several embodiments provided in the present application, it should be understood that the disclosed system, device and method can be implemented in other ways. For example, the device embodiments described above are merely illustrative, for example, the division of the modules is only a logical function division, and actual implementation can have another division manner, for example, a plurality of modules or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the displayed or discussed each other can be indirect coupling or communication connection through some interfaces, devices or modules, which can be electrical, mechanical or other forms.
[0129] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto, any person skilled in the art can easily think of changes or replacements within the technical range disclosed in the present application, which should be covered in the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.
[0130] Finally: the above is only the preferred embodiment of the present application, and is not used to limit the present application, any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the protection scope of the present application.
Claims
1. A time domain segmentation method for identifying gait behavior of goose pecking, characterized in that, The method comprises the following steps: S1, acquiring a continuous frame sequence of a goose group monitoring video, performing target detection and tracking on each frame image, and outputting motion trajectories of each target goose; S2, identifying behavior breaking points caused by occlusion on the motion trajectories, and cutting the preening behavior into multiple non-continuous sub-segments; S3, extracting an action feature vector of each non-continuous sub-segment, the action feature vector comprising vibration damping characteristics of a preened feather region and synchronization of neck muscle movement; S4, calculating vibration damping characteristic changes between adjacent non-continuous sub-segments according to the vibration damping characteristics; S5, calculating the similarity of the action feature vectors of adjacent non-continuous sub-segments, and detecting the continuity of the space-time trajectory, when the similarity exceeds a first threshold value, the space-time trajectory meets a preset continuity condition, and the vibration damping characteristic changes do not exceed a second threshold value, it is determined that the sub-segments are associated; S6, merging the time intervals of all associated sub-segments to generate a complete preening behavior time period, and triggering a warning signal when the cumulative length of the complete preening behavior time period exceeds a preset risk threshold value.
2. The time domain segmentation method for identifying the pecking behavior of geese according to claim 1, characterized in that, The method comprises the following steps: detecting the positions of the target geese in the continuous frame sequence based on a kernel correlation filtering algorithm to generate an initial motion trajectory point set; performing noise filtering and trajectory smoothing processing on the initial motion trajectory point set through a Kalman filtering model; connecting the detection positions of the same target goose in adjacent frames in time sequence to form the motion trajectories of the target geese.
3. The time domain segmentation method for identifying gander pecking behavior according to claim 1, characterized in that, The method comprises the following steps: calculating the bounding box overlap rate of the same target goose in adjacent video frames; when the bounding box overlap rate is lower than a preset occlusion threshold value, marking a behavior breaking start point; during the behavior breaking period, if the bounding box overlap rate returns to above a preset visible threshold value, marking a behavior breaking end point; cutting out non-continuous sub-segments from the motion trajectories according to the time intervals of the behavior breaking start point and the behavior breaking end point.
4. The time domain segmentation method for identifying gander pecking behavior according to claim 1, characterized in that, The method comprises the following steps: calculating the optical flow acceleration field between consecutive frames in the preened feather region for the video frame sequence contained in the non-continuous sub-segment; extracting the vibration damping characteristics according to the decay slope of the optical flow acceleration field over time; dividing the interest regions of the stretch muscle group and the pecking muscle group in the neck region, and calculating the phase coherence coefficient of the optical flow vectors of the two groups of interest regions; taking the phase coherence coefficient as the synchronization characteristic value of the neck muscle movement; combining the vibration damping characteristics and the synchronization characteristic value of the neck muscle movement to form the action feature vector.
5. The time domain segmentation method for identifying gander pecking behavior according to claim 4, characterized in that, The method comprises the following steps: in the time window of the non-continuous sub-segment, fitting an exponential decay curve of the intensity of the optical flow acceleration field over time; extracting the absolute value of the negative slope of the exponential decay curve as the vibration damping characteristic value.
6. The time domain segmentation method for identifying gander pecking behavior according to claim 4, characterized in that, The method comprises the following steps: locating the stretch muscle group region and the pecking muscle group region based on a goose neck anatomical atlas; The Fourier phase spectrum of the optical flow vector field of the two regions is calculated respectively; The phase coherence coefficient is calculated by the peak value of the cross-correlation function of the phase spectrum.
7. The time domain segmentation method for identifying gander pecking behavior according to claim 1, wherein, According to the vibration damping characteristics, the vibration damping characteristic change between adjacent non-continuous sub-segments is calculated, including: Obtaining the vibration damping characteristic values corresponding to adjacent non-continuous sub-segments; Calculating the relative change amount of the vibration damping characteristic value of the next non-continuous sub-segment and the vibration damping characteristic value of the previous non-continuous sub-segment; The relative change amount is output as the vibration damping characteristic change between adjacent non-continuous sub-segments.
8. The time domain segmentation method for identifying gander pecking behavior according to claim 1, wherein, The similarity of the action feature vectors of adjacent non-continuous sub-segments is calculated, and the continuity of the space-time trajectory is detected, and when the similarity exceeds the first threshold value, the space-time trajectory meets the preset continuity condition, and the vibration damping characteristic change does not exceed the second threshold value, it is determined that the sub-segment is associated, including: The cosine similarity between the action feature vectors of adjacent non-continuous sub-segments is calculated as the similarity; The motion trajectory of adjacent non-continuous sub-segments is linearly interpolated, and the average displacement deviation of the interpolated trajectory point and the actual trajectory point is calculated; When the cosine similarity is greater than the first threshold value, the average displacement deviation is less than the displacement value limited by the preset continuity condition, and the vibration damping characteristic change is less than the second threshold value, it is determined that the corresponding adjacent non-continuous sub-segments are associated sub-segments.
9. The time domain segmentation method for identifying gander pecking behavior according to claim 1, wherein, Merge the time intervals of all associated sub-segments to generate a complete preening behavior time period, and trigger a warning signal when the cumulative duration of the complete preening behavior time period exceeds the preset risk threshold, including: Arrange the time intervals of the associated sub-segments in chronological order; Take the start time point of the first associated sub-segment and the end time point of the last associated sub-segment to form a complete preening behavior time period; Calculate the time difference between the start time point and the end time point of the complete preening behavior time period as the cumulative duration; When the cumulative duration exceeds the preset risk threshold, send a warning signal to the breeding management terminal.
10. A time domain segmentation early warning system for identifying preening behavior of geese, for implementing the time domain segmentation method for identifying preening behavior of geese according to any one of claims 1-9, characterized in that, It includes the following modules: A trajectory generation module for obtaining a continuous frame sequence of a goose group monitoring video, performing target detection and tracking on each frame of image, and outputting the motion trajectory of each target goose; A breaking cutting module for identifying behavior breaking points on the motion trajectory caused by occlusion, and cutting the preening behavior into multiple non-continuous sub-segments; A feature extraction module for extracting the action feature vector of each non-continuous sub-segment, the action feature vector including the vibration damping characteristic of the preening feather region and the synchronization of the neck muscle movement; A damping calculation module for calculating the vibration damping characteristic change between adjacent non-continuous sub-segments according to the vibration damping characteristic; An association determination module for calculating the similarity of the action feature vectors of adjacent non-continuous sub-segments, and detecting the continuity of the space-time trajectory, when the similarity exceeds the first threshold value, the space-time trajectory meets the preset continuity condition, and the vibration damping characteristic change does not exceed the second threshold value, it is determined that the sub-segment is associated; A warning output module for merging the time intervals of all associated sub-segments to generate a complete preening behavior time period, and triggering a warning signal when the cumulative duration of the complete preening behavior time period exceeds the preset risk threshold.
Citation Information
Patent Citations
Video behavior segmentation method and device, computer equipment and medium
CN112836687A
Cage chicken abnormal behavior detection and early warning system
CN117649681A