Canine animal analysis method, device, electronic device, and storage medium
By combining target detection and appearance feature extraction with Kalman filters and collaborative trackers, the high throughput and accuracy problems of traditional animal behavior analysis are solved. This method achieves high robustness and high precision trajectory tracking and behavior analysis in dogs, and is suitable for animal behavior and neuroscience research.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- INST OF AUTOMATION CHINESE ACAD OF SCI
- Filing Date
- 2026-04-08
- Publication Date
- 2026-07-14
AI Technical Summary
Traditional methods of animal behavior analysis rely on manual observation, which consumes a lot of manpower and resources and is prone to subjective bias, making it difficult to achieve large-scale, high-throughput studies. Existing automated solutions lack accuracy in tracking multiple animals with similar appearances, especially in terms of appearance discrimination when there is occlusion or interaction.
We employ a target detector and appearance feature extraction network to obtain target detection results and appearance features of canines, combine them with a collaborative tracker for trajectory association and tracking, perform weighted matching by calculating motion cost and appearance cost, use a Kalman filter to predict trajectories and dynamically adjust weights, and combine them with a behavior analysis model for high-precision analysis.
It achieves highly robust tracking in multi-target, high-density, and frequently occluded scenarios, improves the accuracy and robustness of automated animal behavior analysis, and provides high-quality individual appearance characteristics and behavioral analysis, making it suitable for animal behavior and neuroscience research.
Smart Images

Figure CN122392093A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of artificial intelligence technology, and in particular to a method, apparatus, electronic device, and storage medium for analyzing canine animals. Background Technology
[0002] Animal behavior research, particularly in assessing canine social interaction, cognitive abilities, and neuroscience-related behavioral phenotypes, demands extensive and precise recordings of individual behaviors over extended periods. Traditional methods of animal behavior analysis rely heavily on manual observation and coding, which are not only resource-intensive but also prone to introducing observer bias, hindering large-scale, high-throughput studies.
[0003] In recent years, with the development of computer vision technology, automated behavior analysis has become possible. However, existing automated solutions are prone to identity switching or loss in scenes containing multiple animals with similar appearances due to frequent interactions, mutual occlusion, and rapid posture changes, leading to data association errors. Therefore, when faced with prolonged occlusion or close-range interactions between multiple individuals with extremely similar appearances, the lack of appearance discrimination capabilities still poses a significant challenge to tracking accuracy. Summary of the Invention
[0004] This invention provides a method, apparatus, electronic device, and storage medium for analyzing canine animals, thereby overcoming the deficiencies in the prior art.
[0005] This invention provides a method for analyzing canine animals, comprising: Acquire the image to be analyzed, and extract the target detection results and target appearance features of the canine animal to be analyzed from the image; Trajectory association tracking is performed based on the target detection results and the target appearance features; Based on the target detection results, behavioral analysis is performed on the canine animal to be analyzed.
[0006] According to a canine animal analysis method provided by the present invention, the step of trajectory correlation tracking based on the target detection result and the target appearance features includes: Based on the target detection results and the target appearance features, calculate the motion cost and appearance cost of the canine to be analyzed and each target canine; Calculate the uncertainty of the predicted trajectory of each of the target canines, and calculate the fusion weights based on the uncertainty; Based on the fusion weight, the motion cost and the appearance cost are weighted and calculated to obtain the matching cost; Based on the matching cost, the trajectory association and tracking of the canine animal to be analyzed and the target canine animal are performed.
[0007] According to a canine animal analysis method provided by the present invention, the step of calculating the motion cost and appearance cost of the canine animal to be analyzed and each target canine animal based on the target detection results and the target appearance features includes: Obtain historical trajectory data and historical appearance data of each of the target canines; Based on the historical trajectory data, the predicted trajectory corresponding to the image to be analyzed is determined, and the motion cost is calculated based on the predicted trajectory and the target detection result; The target historical appearance features are determined based on the historical appearance data, and the appearance cost is calculated based on the target historical appearance features and the target appearance features.
[0008] According to a canine analysis method provided by the present invention, the step of calculating the uncertainty of the predicted trajectory of each target canine and calculating the fusion weight based on the uncertainty includes: Calculate the uncertainty of the predicted trajectory for each of the target canines; Acquire the amount of historical trajectory data for each of the target canines, and determine the trajectory maturity factor based on the number of historical trajectories; The fusion weight is calculated based on the uncertainty and the trajectory maturity factor.
[0009] According to a canine animal analysis method provided by the present invention, the step of trajectory correlation tracking based on the target detection result and the target appearance features includes: If there are multiple canine animals to be analyzed, the canine animals to be analyzed are divided into multiple animal groups based on the detection confidence in the target detection results; Based on the detection confidence level, the animal groups are sorted in descending order to obtain the grouping sequence; Based on the grouping sequence, the matching cost between each canine animal to be analyzed in each animal group and each target canine animal that is not currently associated is calculated in turn. Based on the matching cost, the trajectory association tracking between the canine animal to be analyzed and the target canine animal is performed.
[0010] According to a canine animal analysis method provided by the present invention, the step of performing behavioral analysis on the canine animal to be analyzed based on the target detection result includes: Based on the target detection results, the target image of the canine animal to be analyzed is determined; The target image to be analyzed is input into a preset behavior analysis model to obtain the behavior analysis results.
[0011] According to the present invention, a canine animal analysis method is provided, wherein the behavior analysis model includes a feature extraction module, a behavior state analysis module, and a body part state analysis module; the step of inputting the target image to be analyzed into a preset behavior analysis model to obtain behavior analysis results includes: Based on the feature extraction module, a depth feature vector is extracted from the target image to be analyzed; Based on the behavior state analysis module, the deep feature vector is analyzed to obtain the behavior category of the canine animal to be analyzed; Based on the body part state analysis module, the depth feature vector is analyzed to obtain the posture category of the target body part of the canine to be analyzed.
[0012] The present invention also provides a canine animal analysis device, comprising: The extraction module is configured to acquire the image to be analyzed and extract the target detection results and target appearance features of the canine animal to be analyzed from the image to be analyzed; The association module is configured to perform trajectory association tracking based on the target detection results and the target appearance features; The behavior analysis module is configured to perform behavior analysis on the canine animal to be analyzed based on the target detection results.
[0013] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the canine analysis method described above.
[0014] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the canine animal analysis method as described above.
[0015] The present invention also provides a computer program product, including a computer program that, when executed by a processor, implements the canine animal analysis method as described above.
[0016] The canine animal analysis method, apparatus, electronic device, and storage medium provided by this invention extract target detection results and target appearance features from the images to be analyzed, providing high-quality, highly recognizable target location information and individual appearance features for subsequent trajectory association and tracking, ensuring accurate and reliable input from the source. By organically combining target detection results and target appearance features, persistent and robust tracking of multiple canine animals to be analyzed is achieved, effectively solving the problem of low tracking accuracy in complex scenes with multiple targets, high density, and frequent occlusion. Simultaneously, based on the target detection results, behavioral analysis of the canine animals to be analyzed is also achieved, significantly improving the accuracy, robustness, and automation level of automated animal behavior analysis. Attached Figure Description
[0017] To more clearly illustrate the technical solutions in this invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0018] Figure 1 This is a flowchart illustrating the canine animal analysis method provided by the present invention.
[0019] Figure 2 This is a schematic diagram of the canine animal analysis device provided by the present invention.
[0020] Figure 3 This is a schematic diagram of the structure of the electronic device provided by the present invention. Detailed Implementation
[0021] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.
[0022] Figure 1 This is a flowchart illustrating a canine animal analysis method according to an exemplary embodiment. For example... Figure 1 As shown in an exemplary embodiment, the canine animal analysis method includes steps 110 to 130, which are described in detail below.
[0023] Step 110: Obtain the image to be analyzed, and extract the target detection results and target appearance features of the canine animal to be analyzed from the image.
[0024] In this embodiment of the invention, real-time or pre-recorded video streams are acquired from one or more video acquisition devices (such as conventional surveillance cameras). Using frames as the basic processing unit, a still image frame is sequentially extracted from the video stream as the input data for the current processing cycle, i.e., the image to be analyzed. One processing cycle processes one image frame.
[0025] After acquiring the image to be analyzed, a high-performance object detector is used to process it. This object detector is pre-trained and can quickly and accurately identify and locate all the canines to be analyzed in the image. Its output is a set of detection results (Dets), which includes the target detection result for each canine to be analyzed. Each target detection result contains at least one bounding box and a detection confidence score. The bounding box is used to precisely define the spatial location of the canine to be analyzed in the image, and the detection confidence score is used to represent the reliability of the detection result. In this embodiment of the invention, the object detector can be trained using the YOLO v11 model.
[0026] In this embodiment of the invention, in order to distinguish different individuals, the target detection results representing the location information of each canine to be analyzed are insufficient. Therefore, based on each target detection result, the image region defined by its bounding box is cropped, and the cropped image region is input into a deep learning-based appearance feature extraction network. This network is a re-identification (Re-ID) model, which excels at extracting high-dimensional, highly recognizable appearance feature vectors that can stably represent individual identities, i.e., target appearance features. These appearance feature vectors are appended to the original target detection results, forming an enhanced set of detection results, Dets_emb.
[0027] In this embodiment of the invention, the appearance feature extraction network can be obtained based on the ConvNeXt v2 network.
[0028] Step 120: Perform trajectory association tracking based on the target detection results and the target appearance features.
[0029] In this embodiment of the invention, trajectory association tracking is performed based on target detection results and target appearance features. When performing trajectory association tracking, the canine animal to be analyzed can be associated with a previously identified target canine animal, or a new target canine animal can be created for trajectory association tracking with subsequent frames.
[0030] In this embodiment of the invention, trajectory association tracking is the core of achieving persistent individual identity tracking. A collaborative tracker (SynTracker) algorithm is employed. This algorithm receives the enhanced detection result Dets_emb as input and performs trajectory association tracking between the canine to be analyzed and existing target canines in the maintained trajectory appearance set. During association, the collaborative tracker can determine which known target canine corresponds to each canine to be analyzed in the current frame, or determine whether it is a newly appearing canine. Each historical trajectory data and historical appearance data in the trajectory appearance set is associated with a unique, persistent individual identity identifier (ID), which is set for the confirmed target canine.
[0031] Step 130: Based on the target detection results, perform behavioral analysis on the canine animal to be analyzed.
[0032] In this embodiment of the invention, for each canine to be analyzed, the image region defined by its bounding box is input into a multi-task behavior analysis model. This model simultaneously parses one or more current behavior categories of the canine to be analyzed from a preset set containing behavior categories such as running, walking, standing, and sniffing, and parses the posture category of the target body part from a preset set containing different posture categories of the target body part of the canine to be analyzed. This completes the behavior analysis of the canine to be analyzed, generating and outputting a structured analysis result. This analysis result explicitly links each persistent individual identifier (ID) to one or more behavior categories and posture categories parsed in the behavior analysis in an end-to-end manner.
[0033] In this embodiment of the invention, target detection results and appearance features of the canines to be analyzed are extracted from the images to be analyzed. This provides high-quality, highly recognizable target location information and individual appearance features for subsequent trajectory association and tracking, ensuring accurate and reliable input from the source. The organic combination of target detection results and target appearance features enables persistent and robust tracking of multiple canines to be analyzed, effectively solving the problem of low tracking accuracy in complex scenes with multiple targets, high density, and frequent occlusion. Simultaneously, based on the target detection results, behavioral analysis of the canines to be analyzed is also achieved, significantly improving the accuracy, robustness, and automation level of automated animal behavior analysis.
[0034] In an exemplary embodiment of the present invention, the trajectory correlation tracking based on the target detection result and the target appearance features includes: Based on the target detection results and the target appearance features, calculate the motion cost and appearance cost of the canine to be analyzed and each target canine; Calculate the uncertainty of the predicted trajectory of each of the target canines, and calculate the fusion weights based on the uncertainty; Based on the fusion weight, the motion cost and the appearance cost are weighted and calculated to obtain the matching cost; Based on the matching cost, the trajectory association and tracking of the canine animal to be analyzed and the target canine animal are performed.
[0035] In this embodiment of the invention, the core of the trajectory association tracking process is to calculate a matching cost that measures the degree of matching between the dog to be analyzed and the target dog, and then to perform association based on this matching cost. When it is necessary to evaluate the matching cost between a dog to be analyzed and a target dog, the initial cost is calculated in parallel from two dimensions: motion cost and appearance cost. Then, the uncertainty of the predicted trajectory of each target dog is calculated, and the fusion weight is dynamically calculated based on the uncertainty. Using the dynamically generated fusion weight, the calculated motion cost and appearance cost are weighted and summed to obtain a final, single matching cost. This matching cost integrates information from both spatial location and identity / appearance aspects, and is intelligently adjusted according to the real-time uncertainty of the tracking through the fusion weight.
[0036] Through the above process, the calculated matching cost can be used to track dogs mainly by relying on accurate motion prediction when the dogs are moving smoothly. However, when the uncertainty of motion prediction increases due to complex situations such as occlusion, rapid movement, or dense crossing, the decision-making basis is automatically and smoothly shifted to more reliable appearance features, thereby greatly improving the robustness and accuracy of tracking.
[0037] Specifically, the system receives the enhanced detection result (Dets_emb) and the track appearance set (Tracks_prev) obtained after canine animal analysis of the previous frame of the image to be analyzed. As mentioned earlier, the enhanced detection result (Dets_emb) contains the bounding boxes, detection confidence scores, and target appearance features of each canine animal to be analyzed. The track appearance set contains historical track data and historical appearance data of all known target canine animals obtained after canine animal analysis of the previous frame of the image to be analyzed. The historical track data consists of the bounding boxes obtained from target detection in each historical frame of the image to be analyzed. The historical appearance data consists of the historical appearance features extracted from each historical frame of the image to be analyzed.
[0038] For each target canine, based on its corresponding historical trajectory data, a Kalman filter is used to predict its motion state in the current frame. The predicted motion state of the Kalman filter includes at least the target canine's center coordinates (cx, cy), size information (characterized by area s and aspect ratio r), and the first and second time derivatives (velocity) and acceleration of these quantities. This yields the predicted trajectory, which represents the bounding box of the predicted target canine in the current frame. Based on the predicted trajectory and target detection results, the motion cost of each canine to be analyzed and each target canine is calculated. The appearance cost of each canine to be analyzed and each target canine is calculated based on historical appearance data and target appearance features.
[0039] To achieve adaptive fusion, the reliability of the predicted trajectory needs to be quantified. For each predicted trajectory, the associated Kalman filter generates a state covariance matrix after the prediction step. This state covariance matrix reflects the degree of uncertainty in estimating the motion state (position, velocity, etc.) of the predicted trajectory. In this embodiment, a scalar value is obtained by calculating the trace of the state covariance matrix, i.e., the sum of the diagonal elements, to quantify the overall uncertainty. The obtained scalar value is used as the uncertainty; a larger uncertainty indicates that the predicted motion state of the trajectory has high uncertainty. For example, when the target reappears after being occluded for a long time, the error range of its predicted position will increase significantly.
[0040] Based on the calculated uncertainty, a fusion weight is dynamically calculated to weight the motion cost and appearance cost. This calculation follows this core logic: when the uncertainty is high, it means the predicted trajectory is less reliable, and more reliance should be placed on appearance information for identity determination; therefore, the weight of appearance cost in the final matching cost calculation is dynamically increased. Conversely, when the uncertainty is low, indicating that the predicted trajectory is very stable and reliable, a higher weight is assigned to the motion cost.
[0041] The motion cost and appearance cost are weighted based on the calculated fusion weights to obtain the matching cost. Based on the matching cost, the target canine animal with the minimum matching cost is determined for each canine animal to be analyzed for trajectory association tracking.
[0042] In this embodiment of the invention, for each known canine animal, a Kalman filter based on a constant acceleration model is used to predict its theoretical position, size, and corresponding state covariance matrix in the current frame based on its historical trajectory data, thereby providing motion prior information for subsequent matching.
[0043] In an exemplary embodiment of the present invention, the step of calculating the motion cost and appearance cost of the canine to be analyzed and each target canine based on the target detection result and the target appearance features includes: Obtain historical trajectory data and historical appearance data of each of the target canines; Based on the historical trajectory data, the predicted trajectory corresponding to the image to be analyzed is determined, and the motion cost is calculated based on the predicted trajectory and the target detection result; The target historical appearance features are determined based on the historical appearance data, and the appearance cost is calculated based on the target historical appearance features and the target appearance features.
[0044] In this embodiment of the invention, historical trajectory data and historical appearance data of each target canine are acquired. As mentioned above, based on the historical trajectory data, a Kalman filter is used to determine the predicted trajectory. The predicted trajectory is the bounding box of the predicted target canine in the current frame. Therefore, the Intersection over Union (IoU) ratio between the predicted bounding box and the bounding box in the target detection result is calculated. A higher IoU ratio (indicating high spatial overlap) corresponds to a lower motion cost.
[0045] Historical appearance data consists of multiple historical appearance feature vectors accumulated from historical frames. Therefore, when calculating the appearance cost, all historical appearance features are aggregated to generate representative target historical appearance features, thereby improving the robustness of appearance matching. Vector averaging can be used to aggregate historical appearance features.
[0046] The cosine distance between the target's physical appearance features and its historical physical appearance features is calculated, and this cosine distance is used as the appearance cost. The smaller the cosine distance, the more similar the two canines being analyzed are to the target canine in terms of their physical appearance, and the lower the corresponding appearance cost.
[0047] In an exemplary embodiment of the present invention, calculating the uncertainty of the predicted trajectory of each of the target canines and calculating the fusion weight based on the uncertainty includes: Calculate the uncertainty of the predicted trajectory for each of the target canines; Acquire the amount of historical trajectory data for each of the target canines, and determine the trajectory maturity factor based on the number of historical trajectories; The fusion weight is calculated based on the uncertainty and the trajectory maturity factor.
[0048] In this embodiment of the invention, as described above, the uncertainty of the predicted trajectory is obtained by calculating the trace of the state covariance matrix of the Kalman filter. Based on the uncertainty, the fusion weight is also modulated by a trajectory maturity factor. The trajectory maturity factor is related to the amount of historical trajectory data stored by the target canine, which is used to reduce its dependence on unreliable single appearance features in the early stage of new trajectory creation, thereby improving the stability of the new trajectory.
[0049] In an exemplary embodiment of the present invention, the trajectory correlation tracking based on the target detection result and the target appearance features includes: If there are multiple canine animals to be analyzed, the canine animals to be analyzed are divided into multiple animal groups based on the detection confidence in the target detection results; Based on the detection confidence level, the animal groups are sorted in descending order to obtain the grouping sequence; Based on the grouping sequence, the matching cost between each canine animal to be analyzed in each animal group and each target canine animal that is not currently associated is calculated in turn. Based on the matching cost, the trajectory association tracking between the canine animal to be analyzed and the target canine animal is performed.
[0050] In this embodiment of the invention, if there are multiple canine animals to be analyzed in the image, to improve the efficiency and robustness of trajectory association tracking, the canine animals to be analyzed are divided into multiple animal groups based on the detection confidence in the target detection results. The animal groups are then sorted in descending order based on the detection confidence to obtain a group sequence. Based on the group sequence, the matching cost between each canine animal to be analyzed in each animal group and each currently unassociated target canine animal is calculated sequentially. Based on the matching cost, trajectory association tracking is performed between the canine animals to be analyzed and the target canine animals. Specifically, the matching cost between all canine animals to be analyzed and all target canine animals in the first animal group of the group sequence is calculated first. Based on the calculated matching cost, trajectory association tracking is performed between the canine animals to be analyzed and the target canine animals in the first animal group. After completing the trajectory association tracking for the first animal group, the matching cost between all canine animals to be analyzed and unassociated target canine animals in the second animal group of the group sequence is calculated, and trajectory association tracking is performed based on the calculated matching cost. This process is repeated until trajectory association tracking for all animal groups is completed.
[0051] Specifically, a confidence threshold is set. Dogs to be analyzed with a detection confidence level greater than or equal to the threshold are assigned to the first animal group, while those with a detection confidence level less than the threshold are assigned to the second animal group. The most reliable information is prioritized, namely the target detection results and predicted trajectories of the target dogs in the first animal group. A cost matrix is calculated to obtain the matching cost between the dog to be analyzed in the first animal group and all target dogs. The process of calculating the matching cost follows the aforementioned process of dynamically weighting and fusing motion and appearance costs to obtain the matching cost, and will not be elaborated upon here.
[0052] During the trajectory association tracking of the canine animals to be analyzed in the first animal group, based on the generated cost matrix, linear allocation solvers such as the Hungarian algorithm are used to find the globally optimal matching scheme with the minimum total cost for each canine animal to be analyzed in the first animal group.
[0053] For canines whose tracks are successfully associated and tracked, the historical track and appearance data of the corresponding target canines are updated using the target detection results and target appearance feature information. Subsequently, these matched tracks and detections are removed from the processing pool.
[0054] For the canines to be analyzed and the unmatched target canines in the second animal group, the aforementioned matching cost calculation and matching are repeated. This allows canines to be analyzed whose detection confidence is reduced due to temporary occlusion to have a chance to be reassociated with their correct target canines. Similarly, the historical trajectory data and historical appearance data of the target canines that were successfully matched in this round are updated.
[0055] In this embodiment of the invention, after multiple rounds of matching, trajectory lifecycle management is performed. Specifically, for canines that have not been matched after the first round of matching, they are identified as newly appearing target canines, and a completely new historical trajectory and appearance data set is initialized for them. For target canines that have not found any matches after all matching stages, their disappearance time counter is incremented. The disappearance time counter tracks the disappearance time of the target canine that has not been matched with any canines to be analyzed. It is checked whether the disappearance time exceeds a preset time threshold. If the disappearance time is greater than or equal to the time threshold, it indicates that the target canine may have left the scene, and its corresponding data is terminated and permanently removed from the trajectory appearance set. If the disappearance time is less than the time threshold, the corresponding data is temporarily retained so that matching attempts can continue in subsequent frames.
[0056] In this embodiment of the invention, a Non-Maximum Suppression with Mapping (NMS) algorithm is applied to identify and merge multiple spatially overlapping trajectories that may correspond to the same canine animal. Based on a trajectory stability metric (e.g., the number of frames in which a trajectory is successfully assigned consecutively), the ID of a representative trajectory is selected from each merged group as the final output of that group, further improving the accuracy of the final result.
[0057] In this embodiment of the invention, after completing all the above processing, a trajectory appearance set Tracks_curr that has undergone update, creation and deletion operations and combines the current frame scene state is output. This set will be passed to the next frame's image to be analyzed for trajectory association tracking.
[0058] In an exemplary embodiment of the present invention, the step of performing behavioral analysis on the canine animal to be analyzed based on the target detection result includes: Based on the target detection results, the target image of the canine animal to be analyzed is determined; The target image to be analyzed is input into a preset behavior analysis model to obtain the behavior analysis results.
[0059] In this embodiment of the invention, based on the bounding boxes in the target detection results, the image to be analyzed is cropped to obtain the target image of the canine to be analyzed. This target image is then input into a preset behavior analysis model to achieve a deeper understanding of the canine's behavior and obtain the behavior analysis results. The behavior analysis model can efficiently parse multi-dimensional behavioral information from a single target image through a single forward propagation. For example, it outputs a multi-label result describing the overall action and a single-label result describing the pose of the target body part. All behavior analysis results for the canines to be analyzed are aggregated into a behavior result set called Behaviors.
[0060] In an exemplary embodiment of the present invention, the behavior analysis model includes a feature extraction module, a behavior state analysis module, and a body part state analysis module; the step of inputting the target image to be analyzed into a preset behavior analysis model to obtain the behavior analysis result includes: Based on the feature extraction module, a depth feature vector is extracted from the target image to be analyzed; Based on the behavior state analysis module, the deep feature vector is analyzed to obtain the behavior category of the canine animal to be analyzed; Based on the body part state analysis module, the depth feature vector is analyzed to obtain the posture category of the target body part of the canine to be analyzed.
[0061] In this embodiment of the invention, the behavior analysis model includes a feature extraction module, a behavior state analysis module, and a body part state analysis module. The target image to be analyzed is first input into the feature extraction module, where it is processed through a shared deep learning backbone network to extract a deep feature map containing rich spatial and semantic information. Subsequently, an adaptive global average pooling layer converts this deep feature map into a fixed-length feature vector, resulting in a deep feature vector. This vector condenses the key information in the image and is ready for subsequent analysis tasks. The feature extraction module in this embodiment employs a shared backbone network design, allowing different subsequent analysis tasks to reuse the same set of deep features, greatly improving computational efficiency. In this embodiment, the deep learning backbone network can be based on the ConvNeXt v2 architecture.
[0062] The deep feature vector is fed in parallel into the behavior state analysis module and the body part state analysis module to perform different analysis tasks.
[0063] The behavior state analysis module is used to roughly identify the overall actions of the canine being analyzed. After the deep feature vector is fed into the behavior state analysis module, its output layer uses the sigmoid activation function to independently calculate an activation probability for each preset behavior category (such as running, walking, standing, sniffing, etc.) of the canine being analyzed. Finally, each activation probability is compared with a preset probability threshold; all behavior categories exceeding the probability threshold are output as the behavior category of the canine being identified. This multi-label output mechanism allows the behavior analysis model to identify and output multiple concurrent behaviors of the canine being identified. For example, a dog can be in a walking and sniffing state simultaneously, which more closely reflects the complexity of canine behavior in the real world.
[0064] The body part state analysis module focuses on analyzing the posture of the target body part. The same deep feature vector is also fed into this module. The output layer of the body part state analysis module uses the Argmax function to select the posture category with the highest probability from a set of mutually exclusive posture categories as the final result. Therefore, the output is a unique, multi-class posture category. For example, if the target body part is the tail, the body part state analysis module can identify whether the tail of the canine being analyzed is held high, horizontal, or drooping.
[0065] Finally, the behavior analysis model integrates the outputs of the two parallel branches. That is, it combines the multi-labeled behavior category results with a unique posture category to form a complete, multi-dimensional behavior analysis of the current state of the canine being analyzed. This description is then associated with its corresponding individual identifier.
[0066] In this embodiment of the invention, individual identity identifiers, target detection results, target appearance features, and behavior analysis results are integrated and formatted. Each persistent individual ID, its corresponding spatial location in the current frame (from the target detection results), and its multi-dimensional behavioral state (from the behavior analysis results) are explicitly linked to form complete, structured records. These records can be output in real time, stored in a database, or used for further data analysis.
[0067] In this embodiment of the invention, after analyzing each frame of the image to be analyzed, it is determined whether the video sequence has ended and whether there are any subsequent image frames to be processed. If not (i.e., the video playback has ended or the processing has been terminated), the entire process ends. If there is a next frame, the above process is repeated to process the next frame image. Through this frame-by-frame cyclic processing method, continuous and automated multi-dimensional sensing and monitoring of the entire video stream can be achieved.
[0068] In this embodiment of the invention, the technical solution provided by the present invention allows for the analysis of canine animals based entirely on video input from conventional cameras. No sensors need to be worn on the canines or the monitoring environment needs to be physically modified. Furthermore, the structured data output is suitable for quantitative research in animal behavior, analysis of social hierarchy and interaction patterns, and automated assessment of behavioral phenotypes in neuroscience.
[0069] In this embodiment of the invention, a high-performance target detector and appearance feature extraction network are employed to provide high-quality, highly recognizable target location information and individual appearance features for subsequent trajectory association and tracking, ensuring accurate and reliable input from the source. The core SynTracker algorithm organically combines Kalman filter-based predicted trajectories with deep learning-based target appearance features, achieving persistent and robust tracking of multiple canine animals to be analyzed. By calculating the trace of the state covariance matrix of the Kalman filter, the uncertainty of the predicted motion trajectory is measured in real time, providing a crucial basis for dynamic decision-making. Based on this uncertainty, the weights of motion information and appearance features in data association are dynamically adjusted: when the canine animal is moving smoothly (low uncertainty), motion prediction is emphasized; when the canine animal is occluded or undergoes violent movement (high uncertainty), appearance matching is automatically emphasized. This intelligent and dynamic fusion strategy allows for flexible adaptation to various complex situations during the tracking process, greatly improving tracking accuracy in occlusion and multi-target close-range interaction scenarios. Furthermore, a multi-stage cascaded matching strategy is employed to effectively utilize target detection results with low detection confidence to recover occluded canines under analysis. This is combined with final post-processing using mapped non-maximum suppression to filter and optimize the tracking results. This multi-layered protection mechanism ensures that the final output tracking trajectory is both continuous and accurate, improving overall robustness.
[0070] The technical solution provided by this invention not only achieves high-precision individual tracking but also, through seamless integration with multi-task behavioral analysis models, enables end-to-end parsing from raw video to individual ID and multi-dimensional behavioral states. This provides a powerful, efficient, and non-invasive data acquisition and analysis tool for quantitative research in fields such as animal behavior, neuroscience, and social structure analysis. Furthermore, it effectively solves the problem of ID switching and trajectory interruption in traditional tracking algorithms by adaptively fusing multi-source information in complex scenarios with multiple targets, high density, and frequent occlusion, significantly improving the accuracy, robustness, and automation level of automated animal behavior analysis.
[0071] The canine analysis device provided by the present invention will be described below. The canine analysis device described below can be referred to in correspondence with the canine analysis method described above. It should be noted that the device provided in the following embodiments and the method provided in the above embodiments belong to the same concept, and the specific way in which each module and unit performs its operation has been described in detail in the method embodiments, and will not be repeated here.
[0072] In one exemplary embodiment of the present invention, please refer to Figure 2 , Figure 2 This is an exemplary embodiment of a canine animal analysis device, comprising the following modules.
[0073] Extraction module 210 is configured to acquire an image to be analyzed and extract the target detection results and target appearance features of the canine animal to be analyzed in the image to be analyzed; The association module 220 is configured to perform trajectory association tracking based on the target detection result and the target appearance features; The behavior analysis module 230 is configured to perform behavior analysis on the canine animal to be analyzed based on the target detection results.
[0074] In an exemplary embodiment of the present invention, the association module 220 includes: The first calculation submodule is configured to calculate the motion cost and appearance cost of the canine to be analyzed and each target canine based on the target detection results and the target appearance features; The second calculation submodule is configured to calculate the uncertainty of the predicted trajectory of each of the target canines, and calculate the fusion weight based on the uncertainty; The weighted calculation submodule is configured to perform weighted calculation on the motion cost and the appearance cost based on the fusion weight to obtain the matching cost; The association tracking submodule is configured to perform trajectory association tracking between the canine to be analyzed and the target canine based on the matching cost.
[0075] In an exemplary embodiment of the present invention, the first computing submodule includes: The acquisition unit is configured to acquire historical trajectory data and historical appearance data of each of the target canines; The first computing unit is configured to determine the predicted trajectory corresponding to the image to be analyzed based on the historical trajectory data, and to calculate the motion cost based on the predicted trajectory and the target detection result; The second calculation unit is configured to determine the target historical appearance features based on the historical appearance data, and to calculate the appearance cost based on the target historical appearance features and the target appearance features.
[0076] In one exemplary embodiment of the present invention, the second computing submodule includes: The third calculation unit is configured to calculate the uncertainty of the predicted trajectory of each of the target canines; The determining unit is configured to acquire the amount of historical trajectory data for each of the target canines and determine a trajectory maturity factor based on the number of historical trajectories. The fourth calculation unit is configured to calculate the fusion weight based on the uncertainty and the trajectory maturity factor.
[0077] In an exemplary embodiment of the present invention, the association module 220 includes: The segmentation submodule is configured to, if there are multiple canine animals to be analyzed, divide the canine animals to be analyzed into multiple animal groups based on the detection confidence in the target detection results; The descending order sorting submodule is configured to sort each of the animal groups in descending order based on the detection confidence level to obtain a grouping sequence; The third calculation submodule is configured to calculate the matching cost between each canine animal to be analyzed and each target canine animal that is not currently associated in each animal group, based on the grouping sequence, and to perform trajectory association tracking between the canine animal to be analyzed and the target canine animal based on the matching cost.
[0078] In an exemplary embodiment of the present invention, the behavior analysis module 230 includes: The determination submodule is configured to determine the target image of the canine to be analyzed based on the target detection results; The analysis submodule is configured to input the target image to be analyzed into a preset behavior analysis model to obtain behavior analysis results.
[0079] In an exemplary embodiment of the present invention, the behavior analysis model includes a feature extraction module, a behavior state analysis module, and a body part state analysis module; the analysis submodule includes: The extraction unit is configured to extract depth feature vectors from the target image to be analyzed based on the feature extraction module. The first analysis unit is configured to analyze the deep feature vector based on the behavior state analysis module to obtain the behavior category of the canine to be analyzed; The second analysis unit is configured to analyze the depth feature vector based on the body part state analysis module to obtain the posture category of the target body part of the canine to be analyzed.
[0080] Figure 3 An example is a schematic diagram of the physical structure of an electronic device, such as... Figure 3 As shown, the electronic device may include a processor 310, a communications interface 320, a memory 330, and a communication bus 340, wherein the processor 310, communications interface 320, and memory 330 communicate with each other via the communication bus 340. The processor 310 can call logical instructions in the memory 330 to execute a canine animal analysis method, which includes: acquiring an image to be analyzed, and extracting target detection results and target appearance features of the canine animal to be analyzed from the image to be analyzed; Trajectory association tracking is performed based on the target detection results and the target appearance features; Based on the target detection results, behavioral analysis is performed on the canine animal to be analyzed.
[0081] Furthermore, the logical instructions in the aforementioned memory 330 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, essentially, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0082] On the other hand, the present invention also provides a computer program product, the computer program product including a computer program, the computer program being able to be stored on a non-transitory computer-readable storage medium, the computer program being executed by a processor, the computer being able to execute the canine animal analysis method provided by the above methods, the method including: acquiring an image to be analyzed, and extracting the target detection result and target appearance features of the canine animal to be analyzed in the image to be analyzed; Trajectory association tracking is performed based on the target detection results and the target appearance features; Based on the target detection results, behavioral analysis is performed on the canine animal to be analyzed.
[0083] In another aspect, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to perform the canine analysis method provided by the above methods, the method comprising: acquiring an image to be analyzed, and extracting target detection results and target appearance features of the canine to be analyzed in the image to be analyzed; Trajectory association tracking is performed based on the target detection results and the target appearance features; Based on the target detection results, behavioral analysis is performed on the canine animal to be analyzed.
[0084] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.
[0085] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0086] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for analyzing canine animals, characterized in that, include: Acquire the image to be analyzed, and extract the target detection results and target appearance features of the canine animal to be analyzed from the image; Trajectory association tracking is performed based on the target detection results and the target appearance features; Based on the target detection results, behavioral analysis is performed on the canine animal to be analyzed.
2. The canine animal analysis method according to claim 1, characterized in that, The trajectory correlation tracking based on the target detection result and the target appearance features includes: Based on the target detection results and the target appearance features, calculate the motion cost and appearance cost of the canine to be analyzed and each target canine; Calculate the uncertainty of the predicted trajectory of each of the target canines, and calculate the fusion weights based on the uncertainty; Based on the fusion weight, the motion cost and the appearance cost are weighted and calculated to obtain the matching cost; Based on the matching cost, the trajectory association and tracking of the canine animal to be analyzed and the target canine animal are performed.
3. The canine animal analysis method according to claim 2, characterized in that, The calculation of the motion cost and appearance cost between the canine being analyzed and each target canine, based on the target detection results and the target appearance features, includes: Obtain historical trajectory data and historical appearance data of each of the target canines; Based on the historical trajectory data, the predicted trajectory corresponding to the image to be analyzed is determined, and the motion cost is calculated based on the predicted trajectory and the target detection result; The target historical appearance features are determined based on the historical appearance data, and the appearance cost is calculated based on the target historical appearance features and the target appearance features.
4. The canine animal analysis method according to claim 2, characterized in that, The calculation of the uncertainty of the predicted trajectory of each of the target canines, and the calculation of the fusion weight based on the uncertainty, includes: Calculate the uncertainty of the predicted trajectory for each of the target canines; Acquire the amount of historical trajectory data for each of the target canines, and determine the trajectory maturity factor based on the number of historical trajectories; The fusion weight is calculated based on the uncertainty and the trajectory maturity factor.
5. The canine animal analysis method according to claim 1, characterized in that, The trajectory correlation tracking based on the target detection result and the target appearance features includes: If there are multiple canine animals to be analyzed, the canine animals to be analyzed are divided into multiple animal groups based on the detection confidence in the target detection results; Based on the detection confidence level, the animal groups are sorted in descending order to obtain the grouping sequence; Based on the grouping sequence, the matching cost between each canine animal to be analyzed in each animal group and each target canine animal that is not currently associated is calculated in turn. Based on the matching cost, the trajectory association tracking between the canine animal to be analyzed and the target canine animal is performed.
6. The method for analyzing canines according to any one of claims 1 to 5, characterized in that, The behavioral analysis of the canine animal to be analyzed based on the target detection results includes: Based on the target detection results, the target image of the canine animal to be analyzed is determined; The target image to be analyzed is input into a preset behavior analysis model to obtain the behavior analysis results.
7. The method for analyzing canine animals according to claim 6, characterized in that, The behavior analysis model includes a feature extraction module, a behavior state analysis module, and a body part state analysis module. The step of inputting the target image to be analyzed into a preset behavior analysis model to obtain behavior analysis results includes: Based on the feature extraction module, a depth feature vector is extracted from the target image to be analyzed; Based on the behavior state analysis module, the deep feature vector is analyzed to obtain the behavior category of the canine animal to be analyzed; Based on the body part state analysis module, the depth feature vector is analyzed to obtain the posture category of the target body part of the canine to be analyzed.
8. A canine animal analysis device, characterized in that, include: The extraction module is configured to acquire the image to be analyzed and extract the target detection results and target appearance features of the canine animal to be analyzed from the image to be analyzed; The association module is configured to perform trajectory association tracking based on the target detection results and the target appearance features; The behavior analysis module is configured to perform behavior analysis on the canine animal to be analyzed based on the target detection results.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that, When the processor executes the computer program, it implements the canine animal analysis method as described in any one of claims 1 to 7.
10. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the canine animal analysis method as described in any one of claims 1 to 7.