A dog walking behavior monitoring method, device, equipment and storage medium
By combining YOLO neural network and ByteTrack multi-objective tracking algorithm, efficient and accurate monitoring of dog walking behavior is achieved, problems of inefficiency and high computational complexity in the existing technology are solved, and automation level and urban management efficiency are improved.
Patent Information
- Application Number
- CN202411575616.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-06
- Publication Date
- 2025-04-04
- Estimated Expiration
- 2044-11-06
AI Technical Summary
The prior art is inefficient in monitoring dog walking behavior, and is prone to missed and false alarms, and has high computational complexity, making it difficult to achieve real-time and efficient monitoring on terminal devices with limited computing power.
The pre-trained YOLO neural network is used to identify the detection boxes of dogs, people and dog leashes in the video stream, and track their movement trajectories through the ByteTrack multi-objective tracking algorithm, and intelligent analysis is carried out in combination with the trajectory queue to automatically judge the safety of dog walking behavior.
It has improved the automation level of dog walking behavior monitoring, reduced the cost of manual intervention, improved urban management efficiency, and enhanced the accuracy and stability of detection.
Smart Images

Figure CN119091515B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of dog walking behavior supervision, and in particular to a dog walking behavior supervision method, device, equipment and storage medium. Background Art
[0002] With the acceleration of urbanization and the improvement of residents' quality of life, pet dogs have become an indispensable member of modern families, bringing endless joy and companionship to people's lives. However, this trend is also accompanied by increasingly severe problems in the management of dog walking behavior, especially the violation of "walking dogs without a leash", which not only seriously threatens the safety of pedestrians, but also may lead to serious consequences such as pet dogs getting lost and frequent traffic accidents. Therefore, the development of an efficient and accurate method for monitoring dog walking behavior is of great significance to improving the level of urban management and community governance.
[0003] At present, the traditional method of monitoring dog walking behavior mainly relies on manual patrols and residents' reports. This method is not only inefficient, but also restricted by the limited human resources and differences in subjective judgment, and is prone to problems such as underreporting and false alarms.
[0004] With the rapid development of computer vision and artificial intelligence technology, some dog walking behavior detection methods based on computer vision have emerged. Among these methods, the more typical one is the strategy of multi-model fusion and static image analysis. The multi-model fusion method integrates multiple deep learning models, such as the target detection model for identifying pet dogs and people in the image, and the behavior analysis model for preliminarily judging the relative position relationship between people and dogs. However, although this method improves the accuracy of detection, it has high computational complexity and high requirements for hardware resources, making it difficult to achieve real-time and efficient monitoring on terminal devices with limited computing power. On the other hand, the static image analysis method attempts to identify and analyze dog walking behavior by capturing key frames. However, static images cannot fully reflect the changes in dynamic scenes, especially when pet dogs and owners move quickly, key information is easily lost, resulting in poor detection results. In addition, static image analysis is also easily affected by environmental factors such as lighting changes and occlusions, further reducing the accuracy and stability of detection. Summary of the invention
[0005] In view of this, the purpose of the present invention is to propose a dog walking behavior supervision method, device, equipment and storage medium, which can improve the automation level of dog walking behavior monitoring, reduce the cost of manual intervention, and improve the efficiency of urban management. It is of great significance. It not only helps to promote civilized dog breeding and ensure public safety, but also provides new technical means and ideas for urban management and community governance.
[0006] According to one aspect of the present invention, a dog walking behavior supervision method is provided, comprising:
[0007] Continuously acquire video streams, use a pre-trained YOLO neural network to identify the detection frames of dogs, people, and dog leashes in the video streams; based on the dogs, people, and dog leashes, use a trajectory tracking method to continuously record the trajectory queues of the dogs, people, and dog leashes respectively; wherein, for an image frame at a certain moment, based on the YOLO neural network model, identify the detection frames of the dogs, people, and dog leashes in the image frame; use the ByteTrack multi-target tracking method to match the detection frames and trajectories of the dogs, people, and dog leashes, and output the trajectory queues of the detection frames of the dogs, people, and dog leashes;
[0008] Based on the trajectory queue, perform the following steps:
[0009] Step A: If the dog track queue is empty, it is judged as "normal", otherwise it goes to step B;
[0010] Step B: If the dog track queue is not empty and the human track queue is empty, it is judged as "unsafe dog walking behavior" and returns, otherwise it goes to step C;
[0011] Step C: If the dog track queue is not empty, the human track queue is not empty, the dog leash track queue is empty, or the number of members in the dog leash track queue is less than the number of members in the dog track team, it is determined to be "unsafe dog walking behavior" and returns, otherwise it goes to step D;
[0012] Step D: Convert the position coordinates of the dog, person, and dog leash trajectory queues into a target frame matrix, and construct an intersection-and-union product matrix based on the three target frame matrices to determine whether the product matrix has any 0 elements. If so, determine it as "unsafe dog walking behavior" and return.
[0013] In the above technical scheme, the present invention trains the YOLO model to meet the needs of dog walking behavior monitoring, so that it can accurately identify the three key targets of dogs, leashes and people, and provide a reliable data basis for subsequent behavior analysis. In terms of trajectory tracking, the present invention adopts the ByteTrack algorithm. The algorithm combines the results of target detection and the motion characteristics of the target to achieve continuous tracking and trajectory drawing of multiple targets. ByteTrack has strong real-time performance and can effectively deal with complex scenes such as occlusion and motion blur, ensuring the accuracy and stability of trajectory tracking. Through the ByteTrack algorithm, the present invention can capture the dynamic changes of dogs, leashes and people during dog walking, providing strong support for analyzing the relationship between the three.
[0014] Based on the integration of the above-mentioned target detection and trajectory tracking technology, the present invention constructs a new dog walking behavior detection method. The method uses the YOLO model to identify dogs, leashes and people, and uses the ByteTrack algorithm to track their movement trajectories. Subsequently, by intelligently analyzing the spatial and temporal relationship between the three, the present invention can automatically determine whether the dog is walking safely or unsafely. This automated behavior judgment method not only improves the accuracy and efficiency of monitoring, but also reduces the cost of manual intervention.
[0015] In summary, the present invention proposes an efficient and accurate method for detecting dog walking behavior by innovatively combining the YOLOv10 target detection algorithm and the ByteTrack trajectory tracking algorithm. This method is of great significance for improving the automation level of dog walking behavior monitoring, reducing the cost of manual intervention, and improving the efficiency of urban management. It not only helps to promote civilized dog breeding and ensure public safety, but also provides new technical means and ideas for urban management and community governance.
[0016] In some embodiments, the YOLO neural network is a YOLO V10 neural network.
[0017] In the above technical solution, the present invention selects the efficient and accurate algorithm YOLOv10. YOLOv10 not only improves the detection speed but also ensures the detection accuracy by introducing innovative technologies such as NMS-free training, dual allocation strategy, and lightweight classification head, making it perform well in processing target detection tasks in high-speed video streams. In particular, the present invention trains the YOLOv10 model to meet the needs of dog walking behavior monitoring, so that it can accurately identify the three key targets of dogs, leashes, and people, providing a reliable data basis for subsequent behavior analysis.
[0018] In some embodiments, the ByteTrack multi-target tracking method is used to match the detection frames and trajectories of the dog, the person, and the dog leash, and output the trajectory queue of the detection frames of the dog, the person, and the dog leash; specifically:
[0019] The detection frames are classified into high-score detection frames and low-score detection frames. The existing trajectory queues are marked as unconfirmed trajectory queues and confirmed trajectory queues respectively. The high-score detection frames are matched with the confirmed trajectory queues, the low-score detection frames are matched with the unsuccessfully matched trajectories, and the unsuccessfully matched detection frames are matched with the unconfirmed trajectory queues. The matching is performed step by step, and the trajectory queues of the detection frames of the dog, the person, and the dog leash are output.
[0020] In the above technical scheme, the present invention adopts an improved ByteTrack multi-track tracking algorithm. Important improvements have been made on the basis of the traditional algorithm, and the problems of target occlusion and track fragmentation have been solved by effectively utilizing low-score detection frames. This improvement not only simplifies the tracking process, but also significantly improves the stability and accuracy of tracking. Compared with the prior art, the improved ByteTrack algorithm shows stronger robustness when dealing with complex tracking scenarios. The method of the present invention accurately identifies and tracks targets in continuous video frames, effectively solving the problem of target identity persistence. This technological innovation enables us to dynamically analyze the behavior patterns during dog walking, rather than relying solely on isolated judgments of static images, thereby greatly reducing the misjudgment rate of unsafe behaviors caused by detection errors and improving the reliability of overall detection.
[0021] In some embodiments, a method is adopted in which a high-score detection frame is matched with a confirmed trajectory queue, a low-score detection frame is matched with an unsuccessfully matched trajectory, and an unsuccessfully matched detection frame is matched with an unconfirmed trajectory queue. Specifically:
[0022] For the confirmed trajectory queue, use the Kalman filter to predict the position of the target in the current frame; match the high-score detection frame with the confirmed trajectory queue, calculate the intersection-and-union ratio of the trajectory frame areas of the two, and use the Hungarian algorithm for optimal matching; obtain the first successfully matched trajectory, the first unsuccessfully matched trajectory, and the first unsuccessfully matched detection frame; update the detection information of the first successfully matched trajectory;
[0023] Match the low-scoring detection frame with the first unsuccessfully matched trajectory, calculate the intersection-and-union ratio of the two trajectory frame areas, adjust the comparison threshold, and use the Hungarian algorithm for optimal matching; obtain the second successfully matched trajectory, the second unsuccessfully matched trajectory, and the second unsuccessfully matched detection frame; update the detection information of the second successfully matched trajectory, put the second unsuccessfully matched trajectory into the lost queue, and discard the second unsuccessfully matched detection frame;
[0024] Match the first unsuccessfully matched detection frame with the unconfirmed trajectory queue, calculate the intersection-and-union ratio of the two trajectory frame areas, adjust the comparison threshold, and use the Hungarian algorithm for optimal matching; obtain the third successfully matched trajectory, the third unsuccessfully matched trajectory, and the third unsuccessfully matched detection frame; update the detection information of the third successfully matched trajectory, discard the third unsuccessfully matched trajectory, and put the third unsuccessfully matched detection frame into the unconfirmed trajectory queue;
[0025] Based on the above steps, the trajectory queue of the detection boxes of the dog, the person, and the dog leash in the image frame at a certain moment is output.
[0026] In the above technical solution, the present invention adopts an improved ByteTrack multi-target tracking algorithm, and its working principle is as follows: in the first step, the detected target detection frames are classified according to the track threshold (track thresh). Target detection frames with confidence greater than track thresh are classified as high-score detection frames (Dhigh), and those with confidence less than track thresh are classified as low-score detection frames (Dlow) (Dhigh is more representative of the real target, while Dlow may contain more noise or false detection). Take out all the recorded tracks of the previous frame, and the target tracks marked as unconfirmed are classified as unconfirmed tracks, and the target tracks marked as confirmed are classified as confirmed tracks. The former indicates the track that has been observed for multiple consecutive frames, and the latter is a newly appeared or not yet stable track. In the second step, for the confirmed tracks, a Kalman filter (KF) is used to predict their positions in the current frame (for confirmed tracks, a Kalman filter is used to predict the position of the target in the current frame, which helps to deal with detection failures caused by occlusion, rapid movement, etc.). In the first match, Dhigh is matched with the confirmed track, and the intersection over union (IoU) of the two track box areas is calculated, and then the Hungarian algorithm is used for optimal matching. If the IoU is less than the set comparison threshold (match thresh), it means that the match is not successful, and if it is greater, it means that the pairing is successful. The first matching result is the matched track (first mtrack), the unmatched track (first utrack), and the unmatched target detection box (first udetection). The detection information of first mtrack is updated (such as position, state, state estimation of Kalman filter, and covariance matrix). In the third step, the second match, Dlow is matched with first utrack, and the IoU and Hungarian algorithm are also used, but adjustments are made for IoU less than the set comparison threshold (match thresh). The second matching result is the matched track (second mtrack), the unmatched track (second utrack), and the unmatched target detection box (second udetection). The detection information of second mtrack is updated (such as position, state, state estimation of Kalman filter, and covariance matrix). For the second utrack, it is considered to be a temporarily lost target and put into the lost queue. For the secondudetection, it is considered to have a low confidence and no successfully matched track, so it is discarded and not recorded.The fourth step is the third matching, matching the first udetection and the unconfirmed track. The IoU and Hungarian algorithm are also used, but the IoU is adjusted when it is less than the set comparison threshold (match thresh). The third matching results include the successfully matched track (three mtrack), the unsuccessfully matched track (three utrack), and the unsuccessfully matched target detection box (three udetection). The detection information of the three mtrack is updated (such as position, state, state estimation of the Kalman filter, and covariance matrix). For the three utrack, the unconfirmed track is considered to be an unreliable record of the previous frame, and the track is not continuous, so it is directly discarded. For the three udetections, they are considered to be new targets, and new track IDs are created and marked as unconfirmed tracks for subsequent frame tracking. When the next frame arrives, repeat the above steps and loop to track the target detection box track.
[0027] In some embodiments, outputting a trajectory queue of the detection boxes of the dog, the person, and the dog leash in the image frame at a certain moment, and then further comprising:
[0028] For the tracks in the lost queue, time is judged. If they exist in the queue for more than the preset time, they are deleted.
[0029] The newly created trajectory is added to the unconfirmed trajectory queue, and all trajectories are checked for duplicate trajectories. After the verification is completed, a new confirmed trajectory queue is obtained.
[0030] In the above technical solution, the trajectories in the lost queue are judged by time. If these trajectories exist in the queue for more than a certain time (such as 30 frames), they are considered to be permanently lost and deleted from the trajectory set. The newly created trajectory is added to the queue of successful matching, and all trajectories are checked for duplicate trajectories. After the verification is completed, a new trajectory queue is obtained to prepare for the next frame.
[0031] In some embodiments, the step D, specifically:
[0032] Convert the position coordinates of the dog, person, and dog leash trajectory queues into a target frame matrix;
[0033] Calculate the intersection and union ratio of the members in the dog target frame matrix with all the members in the dog leash target frame matrix, and then construct a maximum intersection and union ratio matrix of dogs and dog leashes through the maximum intersection and union ratio of each dog and dog leash;
[0034] Calculate the intersection and union ratio of each member in the dog leash target frame matrix with all members in the human target frame matrix, and then construct a maximum intersection and union ratio matrix of dog leash and human through the maximum intersection and union ratio of each dog leash and human;
[0035] The maximum intersection-and-union ratio matrix of the dog and the dog leash is multiplied with the maximum intersection-and-union ratio matrix of the dog leash and the person to obtain the final product matrix;
[0036] Determine whether the final product matrix has any 0 elements. If so, it means that "unsafe dog walking behavior" exists and return.
[0037] In the above technical solution, this case takes into account the problem that the dog is in contact with the rope, the person is in contact with the rope, and the person and the dog are not in contact. Only when they are in contact can IoU be used for judgment. Therefore, the above construction order is set.
[0038] In some embodiments, the step D further comprises:
[0039] If all elements of the product matrix are greater than zero, a relationship chain of dog, leash, and person is constructed and saved;
[0040] Within each preset frame range, determine whether the relationship chain is the same. If so, it is determined as "safe dog walking behavior", otherwise it is "unsafe dog walking behavior".
[0041] In the above technical solution, it is possible to automatically judge whether the dog is walking safely or unsafely. This automated behavior judgment method not only improves the accuracy and efficiency of monitoring, but also reduces the cost of manual intervention.
[0042] According to another aspect of the present invention, a device for monitoring dog walking behavior is provided, comprising the following modules connected in sequence:
[0043] Trajectory module: used to continuously acquire video streams, and use a pre-trained YOLO neural network to identify the detection frames of dogs, people, and dog leashes in the video stream; based on the dogs, people, and dog leashes, a trajectory tracking method is used to continuously record the trajectory queues of the dogs, people, and dog leashes respectively; wherein, for an image frame at a certain moment, based on the YOLO neural network model, the detection frames of the dogs, people, and dog leashes in the image frame are identified; the ByteTrack multi-target tracking method is used to match the detection frames and trajectories of the dogs, people, and dog leashes, and output the trajectory queues of the detection frames of the dogs, people, and dog leashes;
[0044] The determination module is used to perform the following steps based on the trajectory queue:
[0045] Step A: If the dog track queue is empty, it is judged as "normal", otherwise it goes to step B;
[0046] Step B: If the dog track queue is not empty and the human track queue is empty, it is judged as "unsafe dog walking behavior" and returns, otherwise it goes to step C;
[0047] Step C: If the dog track queue is not empty, the human track queue is not empty, the dog leash track queue is empty, or the number of members in the dog leash track queue is less than the number of members in the dog track team, it is determined to be "unsafe dog walking behavior" and returns, otherwise it goes to step D;
[0048] Step D: Convert the position coordinates of the dog, person, and dog leash trajectory queues into a target frame matrix, and construct an intersection-and-union product matrix based on the three target frame matrices to determine whether the product matrix has any 0 elements. If so, determine it as "unsafe dog walking behavior" and return.
[0049] In the above technical scheme, in order to better use the above method, the present application proposes a device for monitoring dog walking behavior, each module corresponds to each step of the above method, and its specific principles have been described above and will not be repeated here.
[0050] According to another aspect of the present invention, there is provided a device for monitoring dog walking behavior, comprising:
[0051] at least one processor and a memory communicatively coupled to the at least one processor;
[0052] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can perform the above method.
[0053] In the above technical solution, in order to better run and process the method, the above method is stored in a memory, and the stored method is executed by a processor. It should be noted that the principle and effect of each step have been described above and will not be described in detail here.
[0054] According to another aspect of the present invention, a computer-readable storage medium is provided, storing a computer program, wherein the computer program implements the above method when executed by a processor.
[0055] In the above technical solution, in order to better run and use the method, the above method is stored in a computer-readable storage medium, and the above method is implemented by a processor. It should be noted that the principle and effect of each step have been described above and will not be described in detail here. BRIEF DESCRIPTION OF THE DRAWINGS
[0056] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0057] Figure 1 It is a flow chart of an embodiment of a method for supervising dog walking behavior of the present invention;
[0058] Figure 2 It is a schematic diagram of the yolov10 reasoning process of an embodiment of a method for supervising dog walking behavior of the present invention;
[0059] Figure 3 It is a schematic diagram of the ByteTrack algorithm flow of an embodiment of a method for supervising dog walking behavior of the present invention;
[0060] Figure 4 It is a schematic diagram of a dog walking behavior detection process according to an embodiment of a dog walking behavior supervision method of the present invention;
[0061] Figures 5 to 10 This is a schematic diagram of an image frame monitoring scene of an embodiment of a method for supervising dog walking behavior of the present invention;
[0062] Fig.11 This is a schematic diagram of the relationship between a dog, a dog leash, and a person in an embodiment of a method for supervising dog walking behavior of the present invention;
[0063] Fig.12 Schematic diagram of a candidate bound A and a ground truth bound B in an embodiment of a method for supervising dog walking behavior of the present invention;
[0064] Fig.13 1 is a schematic diagram of coordinates of a candidate bound A and a ground truth bound B of an embodiment of a method for supervising dog walking behavior of the present invention;
[0065] Fig.14 It is a structural schematic diagram of an embodiment of a device for monitoring dog walking behavior of the present invention. DETAILED DESCRIPTION
[0066] The present invention will be further described in detail below in conjunction with the accompanying drawings and examples. It is particularly noted that the following examples are only used to illustrate the present invention, but are not intended to limit the scope of the present invention. Similarly, the following examples are only partial embodiments of the present invention rather than all embodiments, and all other embodiments obtained by those of ordinary skill in the art without creative work are within the scope of protection of the present invention.
[0067] The present invention provides a dog walking behavior supervision method, device, equipment and storage medium, which can improve the automation level of dog walking behavior monitoring, reduce the cost of manual intervention, and improve the efficiency of urban management, which is of great significance. It not only helps to promote civilized dog breeding and ensure public safety, but also provides new technical means and ideas for urban management and community governance.
[0068] Embodiment 1
[0069] See also Figure 1 , a dog walking behavior supervision method, comprising:
[0070] S1. Continuously acquire a video stream, and use a pre-trained YOLO neural network to identify the detection frames of the dog, the person, and the dog leash in the video stream; based on the dog, the person, and the dog leash, use a trajectory tracking method to continuously record the trajectory queues of the dog, the person, and the dog leash respectively; wherein, for an image frame at a certain moment, based on the YOLO neural network model, identify the detection frames of the dog, the person, and the dog leash in the image frame; use the ByteTrack multi-target tracking method to match the detection frames and trajectories of the dog, the person, and the dog leash, and output the trajectory queues of the detection frames of the dog, the person, and the dog leash;
[0071] In this embodiment, the YOLO neural network is a YOLO V10 neural network. The present invention selects the efficient and accurate algorithm YOLOv10. YOLOv10 not only improves the detection speed but also ensures the detection accuracy by introducing innovative technologies such as NMS-free training, dual allocation strategy, and lightweight classification head, so that it performs well in processing target detection tasks in high-speed video streams. In particular, the present invention trains the YOLOv10 model to meet the needs of dog walking behavior monitoring, so that it can accurately identify the three key targets of dogs, leashes, and people, providing a reliable data basis for subsequent behavior analysis.
[0072] 1. The training steps of YOLOv10 are as follows:
[0073] The first step is to set up the environment, install the required software (such as CUDA, cuDNN, Anaconda), create a new Python virtual environment, and install YOLOv10 dependent libraries (such as PyTorch, torchvision, opencv-python).
[0074] The second step is data annotation. Collect enough pictures of dog walking application scenarios, use annotation tools (such as LabelImg or LabelMe) to annotate the three categories of people, dog leashes, and dogs in the pictures, generate annotation files (such as txt files in YOLO format), put the pictures and corresponding annotation files into corresponding folders to make a data set, and then divide the data set into training set, validation set and test set. According to the structure and annotation information of the data set, create a data set configuration file (such as a yaml file) that YOLOv10 can recognize, which is used to specify the path, category and other information of the data set.
[0075] The third step is to start training, run the training script or command, and specify parameters such as dataset configuration file, model configuration file, training rounds (epochs), batch size, etc.
[0076] The fourth step is to test the model. Use the test set to test the trained model and evaluate its performance on unseen data. If the target detection confidence reaches above 95%, the model can be considered qualified. Otherwise, adjust the training parameters and continue training.
[0077] 2. Target reasoning, see Figure 2 ,The reasoning principle of YOLOv10 is mainly based on deep neural networks, especially convolutional neural networks (CNN), which are used for real-time target detection. The reasoning is mainly divided into the following steps:
[0078] The first step is to extract a frame of image from the surveillance video stream.
[0079] In the second step, feature extraction is performed. The image is sent to the backbone network of YOLOv10 (such as the Backbone layer). After multiple layers of convolution and pooling operations, the feature information in the image is extracted and feature maps of different scales are generated.
[0080] The third step is feature fusion. The neck (such as the PAN layer) receives these feature maps of different scales and realizes the fusion of multi-scale features through operations such as upsampling, downsampling, and feature splicing to capture objects of different sizes in the image.
[0081] The fourth step is prediction generation. The fused feature map is sent to the one-to-one head. Each grid cell in the head is responsible for predicting whether there is an object in the area and the bounding box and category of the object. YOLOv10 uses a one-to-one matching strategy to assign a true value to each prediction and directly generate the prediction result.
[0082] Step 5: Post-processing output. Since YOLOv10 removes NMS, no additional post-processing steps are required. The target location, category, and confidence are directly output based on the prediction results of the Head. Since this mode is specially trained, this model only outputs three category labels: dog, person, and dog leash.
[0083] After the above yolov10 reasoning, all valid target detection frames are obtained.
[0084] In this embodiment, the ByteTrack multi-target tracking method is used to match the detection frames and trajectories of the dog, the person, and the dog leash, and the trajectory queues of the detection frames of the dog, the person, and the dog leash are output; specifically: the detection frames are classified into high-score detection frames and low-score detection frames; the existing trajectory queues are marked as unconfirmed trajectory queues and confirmed trajectory queues respectively; the high-score detection frames are matched with the confirmed trajectory queues, the low-score detection frames are matched with the unmatched trajectories, and the unsuccessfully matched detection frames are matched with the unconfirmed trajectory queues, and the trajectory queues of the detection frames of the dog, the person, and the dog leash are output. The present invention adopts an improved ByteTrack multi-trajectory tracking algorithm. Important improvements have been made on the basis of the traditional algorithm, and the problems of target occlusion and trajectory fragmentation have been solved by effectively utilizing the low-score detection frames. This improvement not only simplifies the tracking process, but also significantly improves the stability and accuracy of the tracking. Compared with the prior art, the improved ByteTrack algorithm shows stronger robustness when dealing with complex tracking scenarios. The method of the present invention accurately identifies and tracks targets in continuous video frames, effectively solving the problem of target identity persistence. This technological innovation enables us to dynamically analyze the behavior patterns of dogs during walking, rather than relying solely on isolated judgments based on static images, thereby greatly reducing the rate of misjudgment of unsafe behaviors due to detection errors and improving the reliability of overall detection. Specifically:
[0085] S11, for the confirmed trajectory queue, use the Kalman filter to predict the position of the target in the current frame; match the high-score detection frame with the confirmed trajectory queue, calculate the intersection-and-union ratio of the trajectory frame areas of the two, and use the Hungarian algorithm for optimal matching; obtain the first successfully matched trajectory, the first unsuccessfully matched trajectory, and the first unsuccessfully matched detection frame; update the detection information of the first successfully matched trajectory;
[0086] S12, matching the low-scoring detection frame with the first unsuccessfully matched trajectory, calculating the intersection-and-union ratio of the trajectory frame areas of the two, adjusting the comparison threshold, and using the Hungarian algorithm for optimal matching; obtaining the second successfully matched trajectory, the second unsuccessfully matched trajectory, and the second unsuccessfully matched detection frame; updating the detection information of the second successfully matched trajectory, placing the second unsuccessfully matched trajectory into a lost queue, and discarding the second unsuccessfully matched detection frame;
[0087] S13, matching the first unsuccessfully matched detection frame with the unconfirmed trajectory queue, calculating the intersection-and-union ratio of the trajectory frame areas of the two, adjusting the comparison threshold, and using the Hungarian algorithm for optimal matching; obtaining the third successfully matched trajectory, the third unsuccessfully matched trajectory, and the third unsuccessfully matched detection frame; updating the detection information of the third successfully matched trajectory, discarding the third unsuccessfully matched trajectory, and placing the third unsuccessfully matched detection frame into the unconfirmed trajectory queue;
[0088] S14. Based on the above steps, output a trajectory queue of the detection frames of the dog, the person, and the dog leash in the image frame at a certain moment.
[0089] See also Figure 3 , the present invention adopts the improved ByteTrack multi-target tracking algorithm, and its working principle is as follows:
[0090] In the first step, the detected target detection frames are classified according to the track threshold (track thresh). Target detection frames with confidence greater than track thresh are classified as high-score detection frames (Dhigh), and those with confidence less than track thresh are classified as low-score detection frames (Dlow) (Dhigh is more representative of the real target, while Dlow may contain more noise or false detection). Take out all the recorded tracks of the previous frame, and the target tracks marked as unconfirmed are classified as unconfirmed tracks, and the target tracks marked as confirmed are classified as confirmed tracks. The former indicates the tracks that have been observed for multiple consecutive frames, and the latter is a newly appeared or not yet stable track.
[0091] In the second step, for the confirmed tracks, a Kalman filter (KF) is used to predict their positions in the current frame (for confirmed tracks, a Kalman filter is used to predict the position of the target in the current frame, which helps to deal with detection failures due to occlusion, rapid movement, etc.). For the first matching, Dhigh is matched with the confirmed track by calculating the intersection over union (IoU) of the track box areas of the two, and then the Hungarian algorithm is used for optimal matching. If the IoU is less than the set comparison threshold (match thresh), it means that the match is not successful, and if it is greater, it means that the pairing is successful. The first matching result obtains the successfully matched track (first mtrack), the unsuccessfully matched track (first utrack), and the unsuccessfully matched target detection box (first udetection). The detection information of first mtrack is updated (such as position, state, state estimation of the Kalman filter, and covariance matrix).
[0092] The third step is the second matching, matching Dlow and first utrack, also using IoU and Hungarian algorithm, but adjusting for IoU less than the set comparison threshold (match thresh). The second matching results include successfully matched tracks (second mtrack), unsuccessfully matched tracks (second utrack), and unsuccessfully matched target detection frames (second udetection). The detection information of second mtrack is updated (such as position, state, state estimation of Kalman filter, and covariance matrix). For second utrack, it is considered to be a temporarily lost target and is placed in the lost queue. For second udetection, the confidence is considered to be low and there is no successfully matched track, so it is discarded and not recorded.
[0093] The fourth step is the third matching, matching the first udetection and the unconfirmed track. The IoU and Hungarian algorithm are also used, but the IoU is adjusted when it is less than the set comparison threshold (match thresh). The third matching results include the successfully matched track (three mtrack), the unsuccessfully matched track (three utrack), and the unsuccessfully matched target detection box (three udetection). The detection information of the three mtrack is updated (such as position, state, state estimation of the Kalman filter, and covariance matrix). For the three utrack, the unconfirmed track is considered to be an unreliable record of the previous frame, and the track is not continuous, so it is directly discarded. For the three udetections, they are considered to be new targets, and new track IDs are created and marked as unconfirmed tracks for subsequent frame tracking. When the next frame arrives, repeat the above steps and loop to track the target detection box track.
[0094] Furthermore, the trajectory queue of the detection box of the dog, the person, and the dog leash is output, and then it also includes:
[0095] S15, performing time judgment on the track in the lost queue, and deleting it if it exists in the queue for more than a preset time;
[0096] S16: Add the newly created trajectory to the unconfirmed trajectory queue, and check all trajectories for duplicate trajectories. After the check is completed, a new confirmed trajectory queue is obtained.
[0097] In this embodiment, the trajectories in the lost queue are judged by time. If these trajectories exist in the queue for more than a certain time (such as 30 frames), they are considered to be permanently lost and deleted from the trajectory set. The newly created trajectory is added to the queue of successful matching, and all trajectories are checked for duplicate trajectories. After the check is completed, a brand new trajectory queue is obtained to prepare for the next frame.
[0098] S2. Based on the trajectory queue, perform the following steps:
[0099] Step A: If the dog track queue is empty, it is judged as "normal", otherwise it goes to step B;
[0100] Step B: If the dog track queue is not empty and the human track queue is empty, it is judged as "unsafe dog walking behavior" and returns, otherwise it goes to step C;
[0101] Step C: If the dog track queue is not empty, the human track queue is not empty, the dog leash track queue is empty, or the number of members in the dog leash track queue is less than the number of members in the dog track team, it is determined to be "unsafe dog walking behavior" and returns, otherwise it goes to step D;
[0102] Step D: Convert the position coordinates of the dog, person, and dog leash trajectory queues into a target frame matrix, and construct an intersection-and-union product matrix based on the three target frame matrices to determine whether the product matrix has any 0 elements. If so, determine it as "unsafe dog walking behavior" and return.
[0103] In this embodiment, the step D specifically comprises:
[0104] D1. Convert the position coordinates of the dog, person, and dog leash trajectory queue into a target frame matrix;
[0105] D2. Calculate the intersection and union ratio of the members in the dog target frame matrix with all the members in the dog leash target frame matrix, and then construct a maximum intersection and union ratio matrix of dogs and dog leashes through the maximum intersection and union ratio of each dog and dog leash;
[0106] D3. Calculate the intersection and union ratio of the members in the dog leash target frame matrix with all the members in the human target frame matrix, and then construct a maximum intersection and union ratio matrix of dog leash and human through the maximum intersection and union ratio of each dog leash and human;
[0107] D4, multiplying the maximum intersection-and-union ratio matrix of the dog and the dog leash with the maximum intersection-and-union ratio matrix of the dog leash and the person to obtain the final product matrix;
[0108] D5. Determine whether the final product matrix has any 0 elements. If so, it means that “unsafe dog walking behavior” exists and returns.
[0109] In this embodiment, the case takes into account the problem that the dog is in contact with the rope, the person is in contact with the rope, and the person and the dog are not in contact, and only when they are in contact can the IoU be used for judgment. Therefore, the above construction order is set.
[0110] In this embodiment, the step D further comprises:
[0111] D6. If all elements of the product matrix are greater than zero, then a relationship chain of dog, dog leash, and person is constructed and saved;
[0112] D7. Within each preset frame range, determine whether the relationship chain is the same. If so, it is determined as "safe dog walking behavior", otherwise it is determined as "unsafe dog walking behavior".
[0113] In the above technical solution, it is possible to automatically judge whether the dog is walking safely or unsafely. This automated behavior judgment method not only improves the accuracy and efficiency of monitoring, but also reduces the cost of manual intervention.
[0114] Specifically, see Figure 4 , step S2, specifically as follows,
[0115] Dog walking behavior detection: Get a frame of video. After the above target trajectory algorithm, assign trajectory IDs to people, dogs, and dog leashes. If N dogs are detected, a dog trajectory queue (such as Dog1, Dog2...DogN) is formed. If M people are detected, a person trajectory queue (such as Person1, Person2...PersonM) is formed. If K dog leashes are detected, a dog leash trajectory queue (such as Leash1, Leash2...LeashK) is formed. Through the above operation, three trajectory queues (including position coordinates, trajectory ID, and confidence) are obtained. At this point, further dog walking behavior judgment can be made, which specifically includes the following steps:
[0116] Step A: If the Dog track queue is empty (N=0), it means that there is no dog at present. Then judge "normal status" and return. Otherwise, go to step B. Figure 5 shown.
[0117] Step B: If the Dog track queue is not empty (N>0) and the Person track queue is empty (M=0), it is judged as "unsafe dog walking behavior" and returns, otherwise it goes to step C; the status is as follows Figure 6 shown.
[0118] Step C: If the Dog trajectory queue is not empty (N>0), the Person trajectory queue is not empty (M>0), and the Leash trajectory queue is empty (K=0) (status as Figure 7as shown), or the number of members in the Leash trajectory queue is less than the number of members in the Dog trajectory queue ((K < N) (the state is as Figure 8 shown), indicating that there is a dog without a leash, then it is determined as an "unsafe dog walking behavior" and returned (the state is as Fig. 9 , Fig.10 shown), otherwise, go to step D;
[0119] Step D: First, convert the position coordinates in the Dog, Person, and Leash trajectory queues into the following target box matrices:
[0120]
[0121] Then, calculate the IoU (Intersection over Union) between each member in the Dog target box matrix and all members in the Leash target box matrix to obtain an N×K matrix. Then, find the maximum IoU value for each Dog and Leash. All the maximum IoU values form an IoU_DL (dog and leash) matrix. The formula calculation is as follows:
[0122]
[0123]
[0124] Next, calculate the IoU (Intersection over Union) between each member in the Leash target box matrix and all members in the Person target box matrix to obtain a K×M matrix. Find the maximum IoU value for each Leash and Person. All the maximum IoU values form an IoU_LP (leash and person) matrix. The formula calculation is as follows:
[0125]
[0126]
[0127] Finally matrix and matrix perform a multiplication operation:
[0128] =
[0129] Judge whether there are elements equal to 0 in the product matrix. If there are 0s, it indicates the existence of "unsafe dog walking behavior" and return. If all are greater than 0, establish the relationship as Fig.11 shown.
[0130] Each dog track ID corresponds to a dog leash track ID and a person track ID. According to this relationship, the corresponding relationships of N dogs are organized into a relationship table and saved. At this point, the judgment of one frame of video is completed.
[0131] In order to reduce the error, the same operation can be performed for multiple frames (such as 3 frames), and then the relationship table saved in all frames is retrieved to determine whether the dog leash ID and the person ID bound to the dog ID are the same. If they are the same, it means "safe dog walking behavior", otherwise it is "unsafe dog walking behavior".
[0132] To summarize, the overall process of the system is to first train the detection model yolov10, then use the yolov10 model to detect the target object, then use the ByteTrack multi-target tracking algorithm to assign a track ID to each target object, and finally use the dog walking behavior detection method to determine whether there is "unsafe dog walking behavior".
[0133] In this embodiment, Intersection over Union (IoU) is the most commonly used evaluation indicator for tasks such as object detection, semantic segmentation, and tracking. As the name suggests, IoU is the ratio of the intersection to the union of two regions. When the two regions completely overlap, the IoU is the largest, which is 1; when the two regions do not overlap at all, the IoU is the smallest, which is 0.
[0134] The IoU calculation method is as follows: Calculate the intersection and union ratio of the candidate bound A and the ground truth bound B, such as Fig.12 shown.
[0135] The IoU calculation formula between box A and box B is:
[0136]
[0137] The coordinates of frame A and frame B are as follows: Fig.13 shown.
[0138] The coordinates of the upper left corner of the intersection are: ; ;
[0139] The coordinates of the lower right corner of the intersection are: ; ;
[0140] The width, height, and area of the intersection: ; ; ;
[0141] Area of frame A: ;
[0142] The area of box B: ;
[0143] Union part: ;
[0144] The intersection ratio is: ;
[0145] In this embodiment, the present invention uses a YOLOv10 model realized through special training, which has the characteristics of high efficiency and accuracy; on the other hand, an improved ByteTrack multi-track tracking algorithm is used to improve the stability and accuracy of tracking; on the other hand, the first two technologies are combined and applied to dog walking behavior detection to achieve automated and efficient supervision.
[0146] YOLOv10 model: Compared with existing technologies, YOLOv10 significantly improves the efficiency and accuracy of target detection by optimizing the network structure and introducing more advanced attention mechanisms and loss functions. This model uses special strategies during training to better adapt to the detection needs of complex scenes and small targets. Compared with the traditional YOLO series or other target detection models, YOLOv10 significantly improves detection accuracy while maintaining real-time performance.
[0147] Improved ByteTrack multi-track tracking algorithm: ByteTrack has made significant improvements on the traditional algorithm. By effectively utilizing low-score detection boxes, it solves the problems of target occlusion and track fragmentation. This improvement not only simplifies the tracking process, but also significantly improves the stability and accuracy of tracking. Compared with existing technologies, the improved ByteTrack algorithm shows stronger robustness when dealing with complex tracking scenarios.
[0148] A dog walking behavior detection method combining technology: Combining the YOLOv10 model with the improved ByteTrack algorithm, the present invention proposes an innovative dog walking behavior detection method. This method can automatically identify pet dogs and their behaviors in the video, and accurately determine whether there is "unsafe dog walking behavior". Compared with the traditional multi-model combination (high hardware computing power requirements lead to low effectiveness) and manual supervision (high cost and low efficiency), the detection method of the present invention has a higher degree of automation and accuracy, and the algorithm complexity is effectively controlled, and the error is significantly reduced. This innovative combined application not only solves the pain points of the existing technology, but also provides new ideas and methods for the field of intelligent supervision.
[0149] Compared with the prior art, the present invention shows significant advantages in the dog walking behavior detection method based on target detection and trajectory algorithm, mainly due to the following key technical innovations:
[0150] First of all, the present invention abandons the complex architecture of multiple models in parallel and instead adopts a single efficient model for detection. This innovation directly reduces the dependence on hardware computing power, allowing the method to be easily deployed on various terminal devices, especially in resource-constrained environments, greatly broadening the application scenarios.
[0151] Secondly, by customizing the training of the YOLOv10 model, we not only achieved a leap in speed, but also reached a new height in detection accuracy. This specially trained model, with its excellent real-time performance and accuracy, has become the key driving force for the efficient operation of this invention.
[0152] Furthermore, the present invention introduces an improved ByteTrack multi-track tracking algorithm, which accurately identifies and tracks targets in continuous video frames, effectively solving the problem of target identity persistence. This technological innovation enables us to dynamically analyze the behavior patterns during dog walking, rather than relying solely on isolated judgments of static images, thereby greatly reducing the misjudgment rate of unsafe behaviors caused by detection errors and improving the reliability of overall detection.
[0153] In summary, the present invention constructs a dog walking behavior detection method that is efficient, accurate, and low-error by integrating the optimized YOLOv10 detection model with the enhanced ByteTrack tracking algorithm. This method not only improves the level of automation, but also finds a perfect balance between algorithm complexity and detection accuracy, providing strong technical support for urban management and public safety.
[0154] Embodiment 2
[0155] See also Fig.14 , a device for monitoring dog walking behavior, comprising the following modules connected in sequence:
[0156] Trajectory module: used to continuously acquire video streams, and use a pre-trained YOLO neural network to identify the detection frames of dogs, people, and dog leashes in the video stream; based on the dogs, people, and dog leashes, a trajectory tracking method is used to continuously record the trajectory queues of the dogs, people, and dog leashes respectively; wherein, for an image frame at a certain moment, based on the YOLO neural network model, the detection frames of the dogs, people, and dog leashes in the image frame are identified; the ByteTrack multi-target tracking method is used to match the detection frames and trajectories of the dogs, people, and dog leashes, and output the trajectory queues of the detection frames of the dogs, people, and dog leashes;
[0157] The determination module is used to perform the following steps based on the trajectory queue:
[0158] Step A: If the dog track queue is empty, it is judged as "normal", otherwise it goes to step B;
[0159] Step B: If the dog track queue is not empty and the human track queue is empty, it is judged as "unsafe dog walking behavior" and returns, otherwise it goes to step C;
[0160] Step C: If the dog track queue is not empty, the human track queue is not empty, the dog leash track queue is empty, or the number of members in the dog leash track queue is less than the number of members in the dog track team, it is determined to be "unsafe dog walking behavior" and returns, otherwise it goes to step D;
[0161] Step D: Convert the position coordinates of the dog, person, and dog leash trajectory queues into a target frame matrix, and construct an intersection-and-union product matrix based on the three target frame matrices to determine whether the product matrix has any 0 elements. If so, determine it as "unsafe dog walking behavior" and return.
[0162] In this embodiment, in order to better use the method described in one of the embodiments, the present application proposes a device for monitoring dog walking behavior, and each module corresponds to each step of the method described in one of the embodiments. The specific principles have been described above and will not be repeated here.
[0163] Embodiment 3, a device for monitoring dog walking behavior, comprising:
[0164] at least one processor and a memory communicatively coupled to the at least one processor;
[0165] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the method described in one of the embodiments.
[0166] In this embodiment, in order to better run and process the method described in one of the embodiments, the above method is stored in a memory, and a processor is used to execute the stored method. It should be noted that the principle and effect of each step have been described above and will not be described in detail here.
[0167] Embodiment 4
[0168] A computer-readable storage medium stores a computer program, wherein when the computer program is executed by a processor, the method described in one of the embodiments is implemented.
[0169] In this embodiment, in order to better run and use the method described in one of the embodiments, the method is stored in a computer-readable storage medium and implemented by a processor. It should be noted that the principle and effect of each step have been described above and will not be described in detail here.
[0170] The above descriptions are only some embodiments of the present invention, and are not intended to limit the protection scope of the present invention. Any equivalent device or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.
Claims
1. A dog walking behavior supervision method, characterized in that: Continuously acquire video streams, use a pre-trained YOLO neural network to identify the detection frames of dogs, people, and dog leashes in the video streams; based on the dogs, people, and dog leashes, use a trajectory tracking method to continuously record the trajectory queues of the dogs, people, and dog leashes respectively; wherein, for an image frame at a certain moment, based on the YOLO neural network model, identify the detection frames of the dogs, people, and dog leashes in the image frame; use the ByteTrack multi-target tracking method to match the detection frames and trajectories of the dogs, people, and dog leashes, and output the trajectory queues of the detection frames of the dogs, people, and dog leashes; Based on the trajectory queue, perform the following steps: Step A: If the dog track queue is empty, it is judged as "normal", otherwise it goes to step B; Step B: If the dog track queue is not empty and the human track queue is empty, it is judged as "unsafe dog walking behavior" and returns, otherwise it goes to step C; Step C: If the dog track queue is not empty, the human track queue is not empty, the dog leash track queue is empty, or the number of members in the dog leash track queue is less than the number of members in the dog track team, it is determined to be "unsafe dog walking behavior" and returns, otherwise it goes to step D; Step D: Convert the position coordinates of the dog, person, and dog leash trajectory queues into a target frame matrix, and construct an intersection-and-union product matrix based on the three target frame matrices to determine whether the product matrix has any 0 elements. If so, determine it as "unsafe dog walking behavior" and return; If all are greater than 0, a relationship chain of dog, dog leash, and person is constructed in such a way that one dog track ID corresponds to one dog leash track ID and one person track ID; the relationship chains corresponding to N dogs are combined into a relationship table and saved; The ByteTrack multi-target tracking method is used to match the detection frames and trajectories of the dog, person, and dog leash, and output the trajectory queue of the detection frames of the dog, person, and dog leash; specifically: The detection frames are classified into high-score detection frames and low-score detection frames. The existing trajectory queues are marked as unconfirmed trajectory queues and confirmed trajectory queues respectively. The high-score detection frames are matched with the confirmed trajectory queues, the low-score detection frames are matched with the unsuccessfully matched trajectories, and the unsuccessfully matched detection frames are matched with the unconfirmed trajectory queues. The matching is performed step by step, and the trajectory queues of the detection frames of the dog, the person, and the dog leash are output.
2. A dog walking behavior supervision method as claimed in claim 1, characterized in that: The YOLO neural network is a YOLO V10 neural network.
3. A dog walking behavior supervision method as claimed in claim 1, characterized in that: The high-score detection frame is matched with the confirmed trajectory queue, the low-score detection frame is matched with the unmatched trajectory, and the unmatched detection frame is matched with the unconfirmed trajectory queue. Specifically: For the confirmed trajectory queue, use the Kalman filter to predict the position of the target in the current frame; match the high-score detection frame with the confirmed trajectory queue, calculate the intersection-and-union ratio of the trajectory frame areas of the two, and use the Hungarian algorithm for optimal matching; obtain the first successfully matched trajectory, the first unsuccessfully matched trajectory, and the first unsuccessfully matched detection frame; update the detection information of the first successfully matched trajectory; Match the low-scoring detection frame with the first unsuccessfully matched trajectory, calculate the intersection-and-union ratio of the two trajectory frame areas, adjust the comparison threshold, and use the Hungarian algorithm for optimal matching; obtain the second successfully matched trajectory, the second unsuccessfully matched trajectory, and the second unsuccessfully matched detection frame; update the detection information of the second successfully matched trajectory, put the second unsuccessfully matched trajectory into the lost queue, and discard the second unsuccessfully matched detection frame; Match the first unsuccessfully matched detection frame with the unconfirmed trajectory queue, calculate the intersection-and-union ratio of the two trajectory frame areas, adjust the comparison threshold, and use the Hungarian algorithm for optimal matching; obtain the third successfully matched trajectory, the third unsuccessfully matched trajectory, and the third unsuccessfully matched detection frame; update the detection information of the third successfully matched trajectory, discard the third unsuccessfully matched trajectory, and put the third unsuccessfully matched detection frame into the unconfirmed trajectory queue; Based on the above steps, the trajectory queue of the detection boxes of the dog, the person, and the dog leash in the image frame at a certain moment is output.
4. A dog walking behavior supervision method as claimed in claim 3, characterized in that: Outputs a queue of trajectories for the dog, person, and leash detection boxes, followed by: For the tracks in the lost queue, time is judged. If they exist in the queue for more than the preset time, they are deleted. The newly created trajectory is added to the unconfirmed trajectory queue, and all trajectories are checked for duplicate trajectories. After the verification is completed, a new confirmed trajectory queue is obtained.
5. A dog walking behavior supervision method as claimed in claim 1, characterized in that: The step D specifically comprises: Convert the position coordinates of the dog, person, and dog leash trajectory queues into a target frame matrix; Calculate the intersection and union ratio of the members in the dog target frame matrix with all the members in the dog leash target frame matrix, and then construct a maximum intersection and union ratio matrix of dogs and dog leashes through the maximum intersection and union ratio of each dog and dog leash; Calculate the intersection and union ratio of the members in the dog leash target frame matrix with all the members in the human target frame matrix, and then construct a maximum intersection and union ratio matrix of dog leash and human through the maximum intersection and union ratio of each dog leash and human; The maximum intersection-and-union ratio matrix of the dog and the dog leash is multiplied with the maximum intersection-and-union ratio matrix of the dog leash and the person to obtain the final product matrix; Determine whether the final product matrix has any 0 elements. If so, it means there is "unsafe dog walking behavior" and return.
6. A dog walking behavior supervision method as claimed in claim 1 or 5, characterized in that: The step D then further comprises: Within each preset frame range, determine whether the relationship chain is the same. If they are the same, it is determined as "safe dog walking behavior", otherwise it is "unsafe dog walking behavior".
7. A device for monitoring dog walking behavior, characterized in that: Includes the following modules connected in sequence: Trajectory module: used to continuously acquire video streams, and use a pre-trained YOLO neural network to identify the detection frames of dogs, people, and dog leashes in the video stream; based on the dogs, people, and dog leashes, a trajectory tracking method is used to continuously record the trajectory queues of the dogs, people, and dog leashes respectively; wherein, for an image frame at a certain moment, based on the YOLO neural network model, the detection frames of the dogs, people, and dog leashes in the image frame are identified; the ByteTrack multi-target tracking method is used to match the detection frames and trajectories of the dogs, people, and dog leashes, and output the trajectory queues of the detection frames of the dogs, people, and dog leashes; The determination module is used to perform the following steps based on the trajectory queue: Step A: If the dog track queue is empty, it is judged as "normal", otherwise it goes to step B; Step B: If the dog track queue is not empty and the human track queue is empty, it is judged as "unsafe dog walking behavior" and returns, otherwise it goes to step C; Step C: If the dog track queue is not empty, the human track queue is not empty, the dog leash track queue is empty, or the number of members in the dog leash track queue is less than the number of members in the dog track team, it is determined to be "unsafe dog walking behavior" and returns, otherwise it goes to step D; Step D: Convert the position coordinates of the dog, person, and dog leash trajectory queues into a target frame matrix, and construct an intersection-and-union product matrix based on the three target frame matrices to determine whether the product matrix has any 0 elements. If so, determine it as "unsafe dog walking behavior" and return; If all are greater than 0, the relationships between N dogs are organized into a relationship table and saved in the manner that one dog track ID corresponds to one dog leash track ID and one person track ID; The ByteTrack multi-target tracking method is used to match the detection frames and trajectories of the dog, person, and dog leash, and output the trajectory queue of the detection frames of the dog, person, and dog leash; specifically: The detection frames are classified into high-score detection frames and low-score detection frames. The existing trajectory queues are marked as unconfirmed trajectory queues and confirmed trajectory queues respectively. The high-score detection frames are matched with the confirmed trajectory queues, the low-score detection frames are matched with the unsuccessfully matched trajectories, and the unsuccessfully matched detection frames are matched with the unconfirmed trajectory queues. The matching is performed step by step, and the trajectory queues of the detection frames of the dog, the person, and the dog leash are output.
8. A device for monitoring dog walking behavior, characterized in that: include: at least one processor and a memory communicatively coupled to the at least one processor; The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the method as claimed in any one of claims 1 to 6.
9. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Dog walking violation behavior detection method, device and equipment based on deep learning
CN115546729A
Multi-target tracking method, system and device based on YOLOv5 and improved interpolation algorithm and readable storage medium
CN117593339A