Detection method and device of pet pulling rope, monitoring equipment and storage medium
Through edge detection and real-time trajectory tracking technology, identifying changes in the movement trajectory of pets and people is solved, and the problem of low accuracy and efficiency of pet traction leash recognition in the prior art is solved, achieving higher recognition accuracy.
Patent Information
- Application Number
- CN202410179811.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-02-18
- Publication Date
- 2025-08-19
AI Technical Summary
The prior art is difficult to accurately identify whether a pet is traction, especially when there are a large number of people and pets, and the recognition accuracy is insufficient due to the wide variation in the shape and color of the rope.
The suspected traction rope is determined through the edge detection algorithm, and the movement trajectory of the pet and the person is tracked in real time. The traction rope rate is adjusted based on the morphology and distance change information. When the preset threshold is met, it is confirmed as the real traction rope.
The accuracy of traction rope recognition is improved, and the effect of changes in rope shape and color is avoided, which improves the recognition efficiency.
Smart Images

Figure CN120510179A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing technology, and in particular to a detection method, device, monitoring equipment and storage medium for a pet leash. Background Art
[0002] Currently, many dogs are walking without a leash on urban streets and in residential communities. Large, unleashed pet dogs often injure people or bite smaller dogs, causing harm and damage to life and property. These situations are often addressed by manually capturing unleashed large dogs, but this typically wastes significant manpower and fails to effectively monitor, prevent, track, and hold people accountable. Using surveillance cameras to monitor whether pets are on a leash is difficult due to the wide variety of leash shapes and colors, resulting in low accuracy and potential for misidentification.
[0003] In related technologies, a pet leash detection method has been proposed. The coordinate positions of the person and pet dog in the detection image are obtained, the images of the pet dog and the person are combined, and the images are input into a convolutional neural network to determine whether they are on a leash. The pets and people marked as being on a leash are marked and tracked, and the unmarked dogs are captured and output as images. This avoids repeated detection of people and pets, saves resources, and reduces the amount of computation. However, this solution combines images of dogs and people for leash recognition without screening people and dogs. When there are a large number of people and dogs, a large number of images need to be combined for convolutional network leash recognition, which is inefficient. In addition, the leash recognition algorithm in the combined image has not been improved or optimized. Only convolutional networks are used for recognition. In this regard, the recognition efficiency and accuracy have not been improved.
[0004] In related art, a pet leash detection method has been proposed to address the difficulty in identifying leashes due to the wide variety of shapes and colors. This method uses the positional information of the number of people and pets in the detection image. If both the number of people and the number of pets are greater than zero, the target pet's circular leash rate and linear leash rate are determined based on the person and pet position information. The circular leash rate uses an arc fitting algorithm to determine the relative positions of the person and dog, obtaining a fitted circle center. The maximum value is the ratio of the number of circle centers that fall within a preset range to the total number of fitted circle centers. The linear leash rate is also determined based on the relative positions of the person and dog. Based on these two calculations, the target pet's total leash rate is calculated. If the calculated result is less than the preset leash rate, a pet off-leash alarm is generated. However, since the pet's movement trajectory is unlikely to be a regular arc or straight line and is highly random, this solution suffers from insufficient recognition accuracy and results in significant errors in determining whether the pet is on a leash. Summary of the Invention
[0005] The present invention provides a pet leash detection method, device, monitoring equipment and storage medium, which can effectively improve the accuracy of leash identification.
[0006] According to one aspect of the present invention, a method for detecting a pet leash is provided, comprising:
[0007] In response to a pet leash detection event being triggered, determining a suspected leash between a target pet and a target person in a surveillance image;
[0008] Tracking the trajectories of the suspected leash, the target pet, and the target person in real time, respectively, to determine a first motion trajectory of the pet end of the suspected leash, a second motion trajectory of the person end of the suspected leash, a third motion trajectory of the target pet, and a fourth motion trajectory of the target person, and determining, during the trajectory tracking process, information on shape changes of the suspected leash and information on changes in the distance between the target pet and the target person;
[0009] When the first motion trajectory coincides with the third motion trajectory and the second motion trajectory coincides with the fourth motion trajectory, adjusting the traction rope rate of the suspected traction rope in real time according to the morphological change information and the distance change information;
[0010] When the traction rope rate of the suspected traction rope is greater than a preset traction rope rate threshold, the suspected traction rope is determined to be a real traction rope.
[0011] According to another aspect of the present invention, a device for detecting a pet leash is provided, comprising:
[0012] a suspected leash determining module, configured to determine a suspected leash between a target pet and a target person in a monitoring image in response to a pet leash detection event being triggered;
[0013] a trajectory tracking module for respectively tracking the trajectories of the suspected traction rope, the target pet, and the target person in real time, determining a first motion trajectory of the pet end of the suspected traction rope, a second motion trajectory of the person end of the suspected traction rope, a third motion trajectory of the target pet, and a fourth motion trajectory of the target person, and determining, during the trajectory tracking process, information on changes in the shape of the suspected traction rope and information on changes in the distance between the target pet and the target person;
[0014] a traction rope rate adjustment module, configured to adjust the traction rope rate of the suspected traction rope in real time according to the morphological change information and the distance change information when the first motion trajectory coincides with the third motion trajectory and the second motion trajectory coincides with the fourth motion trajectory;
[0015] The real traction rope determining module is configured to determine that the suspected traction rope is a real traction rope when the traction rope rate of the suspected traction rope is greater than a preset traction rope rate threshold.
[0016] According to another aspect of the present invention, a monitoring device is provided, comprising:
[0017] at least one processor; and
[0018] a memory communicatively connected to the at least one processor; wherein,
[0019] The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the pet leash detection method according to any embodiment of the present invention.
[0020] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the pet leash detection method according to any embodiment of the present invention when executed.
[0021] The pet leash detection scheme of the embodiment of the present invention determines a suspected leash between a target pet and a target person in a monitoring image in response to a pet leash detection event being triggered; tracks the trajectories of the suspected leash, the target pet, and the target person in real time, respectively, to determine a first motion trajectory of the pet end of the suspected leash, a second motion trajectory of the person end of the suspected leash, a third motion trajectory of the target pet, and a fourth motion trajectory of the target person; and during the trajectory tracking process, determines morphological change information of the suspected leash and distance change information between the target pet and the target person; when the first motion trajectory coincides with the third motion trajectory and the second motion trajectory coincides with the fourth motion trajectory, adjusts the leash rate of the suspected leash in real time according to the morphological change information and the distance change information; when the leash rate of the suspected leash is greater than a preset leash rate threshold, determines that the suspected leash is a true leash. Through the technical solution provided by the embodiment of the present invention, the trajectory of the leash is tracked and compared, and associated with the movements of pets and people, thereby avoiding the influence of the irregular curve of the leash caused by the thickness, color, material and pet movement on the identification of the leash, thereby effectively improving the accuracy of leash identification.
[0022] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present invention, nor is it intended to limit the scope of the present invention. Other features of the present invention will become readily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. 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 creative work.
[0024] Figure 1 This is a flow chart of a method for detecting a pet leash according to the first embodiment of the present invention;
[0025] Figure 2 is a schematic diagram of a pet detection frame and a human detection frame provided by an embodiment of the present invention;
[0026] Figure 3a This is a schematic diagram of a suspected traction rope with increased curvature provided by an embodiment of the present invention;
[0027] Figure 3b This is a schematic diagram of a suspected traction rope with a reduced curvature provided by an embodiment of the present invention;
[0028] Figure 4 This is a schematic diagram showing the display effect of the probability of a leash between each character and a target pet, provided by an embodiment of the present invention;
[0029] Figure 5 This is a schematic structural diagram of a pet leash detection device provided in accordance with a second embodiment of the present invention;
[0030] Figure 6 2 is a schematic structural diagram of a monitoring device for implementing the pet leash detection method according to an embodiment of the present invention. DETAILED DESCRIPTION
[0031] In order to enable those skilled in the art to better understand the solutions of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the embodiments described are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of the present invention.
[0032] It should be noted that the terms "first", "second", etc. in the description and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that the numbers used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0033] Example 1
[0034] Figure 1 This is a flow chart of a pet leash detection method provided in the first embodiment of the present invention. This embodiment is applicable to the detection of pet leash. The method can be performed by a pet leash detection device. The pet leash detection device can be implemented in the form of hardware and / or software. The pet leash detection device can be configured in a monitoring device. Figure 1 As shown, the method includes:
[0035] S110 : In response to a pet leash detection event being triggered, determining a suspected leash between a target pet and a target person in a monitoring image.
[0036] In an embodiment of the present invention, a pet leash detection event is determined to be triggered when a user inputs a pet leash detection command; or when a pet is detected in the surveillance image, a pet leash detection event is determined to be triggered. The target pet can be a large dog, a small dog, or even a cat. It should be noted that this embodiment of the present invention does not limit the type of target pet. The target person can be any person in the surveillance image, or a person within a preset range of the target pet in the surveillance image.
[0037] The leash between the target pet and the target person is detected using an edge detection algorithm to determine a suspected leash between the target pet and the target person, wherein the suspected leash can be one or more. Optionally, the edge detection algorithm can be a Laplacian algorithm, wherein the Laplacian algorithm is an edge detection algorithm based on second-order derivatives. It performs edge detection by calculating the second-order derivative of each pixel in the image, can capture detailed changes on the edge, and is suitable for leash detection. The specific implementation steps for determining a suspected leash between the target pet and the target person based on the Laplacian algorithm are as follows:
[0038] 1. Based on the target detection algorithm, determine the pet detection frame of the target pet and the human detection frame of the target person, and perform Gaussian filtering on the images within the pet detection frame and the human detection frame to reduce the influence of noise. Figure 2 Schematic diagram of a pet detection frame and a human detection frame provided in an embodiment of the present invention. This configuration has the advantage of effectively avoiding Gaussian filtering of the entire surveillance image, improving the efficiency of detecting suspected leashes. 2. Calculating the Laplace value of each pixel within the pet detection frame and the human detection frame, respectively. The Laplace value can be obtained by calculating the second-order derivative of the pixel values surrounding the pixel. 3. Thresholding each pixel within the pet detection frame and the human detection frame, respectively, is performed. Pixels with Laplace values greater than a preset threshold are marked as edge points, and pixels with Laplace values less than the preset threshold are marked as non-edge points. A dual-thresholding method can be used to classify edge points into strong edge points and weak edge points. Strong edge points are pixels with Laplace values greater than a first preset threshold, and weak edge points are pixels with Laplace values between a second preset threshold and the first preset threshold, where the first preset threshold is greater than the second preset threshold. 4. Connecting edge points, for example, connecting a strong edge pixel with its adjacent weak edge pixels to form a complete edge line. 5. The edge lines at both ends of the edge line, which are located in the pet detection frame and the human detection frame respectively, are determined as the suspected leash between the target pet and the target person.
[0039] It is understandable that one end of the traction rope comes from the target person and the other end comes from the target pet. Through the relative position coordinates of the target person and the target pet, the theoretical shortest distance of the traction rope can be obtained. Ignoring factors such as the elastic deformation and bending of the traction rope, assuming that the traction rope is a straight line, the straight-line distance between the target pet and the target person is the shortest traction rope length. Therefore, whether the traction rope is a straight line or a curve, the length should be greater than or equal to this length (the straight-line distance between the target pet and the target person). Therefore, based on the above conditions, the line in the target image with one end coming from the target person and the other end coming from the target pet, and a length greater than or equal to the straight-line distance between the target person and the target pet, can be used as a suspected traction rope between the target person and the target pet.
[0040] S120. Track the trajectories of the suspected traction rope, the target pet, and the target person in real time, respectively, to determine a first motion trajectory of the pet end of the suspected traction rope, a second motion trajectory of the person end of the suspected traction rope, a third motion trajectory of the target pet, and a fourth motion trajectory of the target person. During the trajectory tracking process, determine morphological change information of the suspected traction rope and distance change information between the target pet and the target person.
[0041] In an embodiment of the present invention, a trajectory tracking algorithm is used to track the trajectory of a suspected leash, a target pet, and a target person based on real-time surveillance footage. The motion trajectories of the pet end of the suspected leash, the person end of the suspected leash, the target pet, and the target person are determined in real time. For ease of description, the motion trajectory of the pet end of the suspected leash is referred to as the first motion trajectory, the motion trajectory of the person end of the suspected leash is referred to as the second motion trajectory, the motion trajectory of the target pet is referred to as the third motion trajectory, and the motion trajectory of the target person is referred to as the fourth motion trajectory. The pet end of the suspected leash refers to the end of the suspected leash that is located outside the pet detection frame of the target pet, and the person end of the suspected leash refers to the end of the suspected leash that is located outside the person detection frame of the target person. During the trajectory tracking process, changes in the shape of the suspected leash are detected in real time to determine the change in shape of the suspected leash, and changes in the distance between the target pet and the target person are detected to determine the change in the distance between the target pet and the target person. Changes in the shape of the suspected leash can include the suspected leash being a straight line, the suspected leash intermittently switching between a curved line and a straight line, or the suspected leash being a curved line. The distance change information between the target pet and the target person can be understood as relevant information that the distance between the target pet and the target person increases, decreases, or remains unchanged.
[0042] S130: When the first motion trajectory coincides with the third motion trajectory and the second motion trajectory coincides with the fourth motion trajectory, adjusting the traction rope rate of the suspected traction rope in real time according to the morphological change information and the distance change information.
[0043] In an embodiment of the present invention, it is determined whether the motion trajectory of the pet end of the suspected leash (i.e., the first motion trajectory) overlaps with the motion trajectory of the target pet (i.e., the third motion trajectory), and whether the motion trajectory of the person end of the suspected leash (i.e., the second motion trajectory) overlaps with the motion trajectory of the target person (i.e., the fourth motion trajectory). If so, it indicates that the suspected leash is highly likely to be the real leash. In this case, the leash rate of the suspected leash is further adjusted in real time based on the morphological change information of the suspected leash and the distance change information between the target pet and the target person. The overlap of the two motion trajectories can include the overlap degree of the two motion trajectories being greater than a preset overlap threshold, or the similarity of the two motion trajectories being greater than a preset similarity threshold. Exemplarily, after determining the suspected traction rope between the target pet and the target person in the monitoring image, the traction rope rate of the suspected traction rope is determined to be a preset threshold value. For example, the traction rope rate of the suspected traction rope is determined to be 20%. In the process of trajectory tracking based on the real-time collected monitoring image, if the first motion trajectory coincides with the third motion trajectory and the second motion trajectory coincides with the fourth motion trajectory, then based on the preset traction rope rate adjustment strategy, the traction rope rate of the suspected traction rope is updated in real time according to the morphological change information and the distance change information.
[0044] Optionally, when the first motion trajectory coincides with the third motion trajectory and the second motion trajectory coincides with the fourth motion trajectory, the traction rope rate of the suspected traction rope is adjusted in real time according to the morphological change information and the distance change information, including: when the first motion trajectory coincides with the third motion trajectory and the second motion trajectory coincides with the fourth motion trajectory, determining the type of the suspected traction rope according to the morphological change information; wherein the type of the suspected traction rope includes a retractable traction rope and a non-retractable traction rope; determining the characteristic change information of the suspected traction rope according to the type of the suspected traction rope, and when the characteristic change information matches the distance change information, increasing the traction rope rate of the suspected traction rope according to preset rules.
[0045] In an embodiment of the present invention, when the first motion trajectory overlaps with the third motion trajectory and the second motion trajectory overlaps with the fourth motion trajectory, if the shape of the suspected traction rope remains unchanged, for example, if the relative distance between the target person and the target pet continues to change, and the shape of the suspected traction rope is detected to be a straight line with a curvature approaching 0, the suspected traction rope can be determined to be a retractable traction rope; if the shape of the suspected traction rope continues to change, for example, if the suspected traction rope changes from a straight line to a curve, or if the curvature of the curve changes when the suspected traction rope is a curve, the suspected traction rope is determined to be a non-retractable traction rope. Feature change information of the suspected traction rope is determined based on the type of the suspected traction rope, and when the feature change information matches the distance change information between the target pet and the target person, the traction rope rate of the suspected traction rope is increased according to a preset rule.
[0046] Optionally, characteristic change information of the suspected traction rope is determined according to the type of the suspected traction rope, and when the characteristic change information matches the distance change information, the traction rope rate of the suspected traction rope is increased according to preset rules, including: when the suspected traction rope is a retractable traction rope, the length change information of the suspected traction rope is determined, and when the length change information matches the distance change information, the traction rope rate of the suspected traction rope is increased according to preset rules; when the suspected traction rope is a non-retractable traction rope, the curvature change information of the suspected traction rope is determined, and when the curvature change information matches the distance change information, the traction rope rate of the suspected traction rope is increased according to preset rules.
[0047] For example, if the suspected leash is determined to be a retractable leash, length change information of the suspected leash is determined, and a determination is made as to whether the length change information matches the distance change information between the target pet and the target person. If so, the leash rate of the suspected leash is increased according to a preset rule, for example, by increasing the leash rate of the suspected leash by a preset fixed value, or by increasing the leash rate of the suspected leash by 20%. When the length change information indicates that the suspected leash has lengthened and the distance between the target pet and the target person has increased, or when the length change information indicates that the suspected leash has shortened and the distance between the target pet and the target person has decreased, the length change information is determined to match the distance change information between the target pet and the target person. When the length change information indicates that the suspected leash has lengthened and the distance between the target pet and the target person has decreased, or when the length change information indicates that the suspected leash has shortened and the distance between the target pet and the target person has increased, the length change information is determined to not match the distance change information between the target pet and the target person.
[0048] For another example, if the suspected leash is determined to be a non-retractable leash, curvature change information of the suspected leash is determined, and a determination is made as to whether the curvature change information matches the distance change information between the target pet and the target person. If so, the leash rate of the suspected leash is increased according to a preset rule. When the curvature of the suspected leash increases and the distance between the target pet and the target person decreases, or when the curvature of the suspected leash decreases and the distance between the target pet and the target person increases, it is determined that the curvature change information matches the distance change information between the target pet and the target person. Figure 3a This is a schematic diagram of a suspected traction rope with increased curvature provided by an embodiment of the present invention. Figure 3b This is a schematic diagram of a suspected leash with decreasing curvature according to an embodiment of the present invention. When the curvature of the suspected leash increases and the distance between the target pet and the target person increases, or when the curvature of the suspected leash decreases and the distance between the target pet and the target person decreases, it is determined that the curvature change information does not match the distance change information between the target pet and the target person.
[0049] Optionally, when the motion trajectory of the pet end of the suspected traction rope (i.e., the first motion trajectory) does not overlap with the motion trajectory of the target pet (i.e., the third motion trajectory), or the motion trajectory of the person end of the suspected traction rope (i.e., the second motion trajectory) does not overlap with the motion trajectory of the target person (i.e., the fourth motion trajectory), the traction rope rate of the suspected traction rope can be directly adjusted to 0. At this time, it can be directly determined that the suspected traction rope is not a real traction rope.
[0050] S140: When the traction rope rate of the suspected traction rope is greater than a preset traction rope rate threshold, determine that the suspected traction rope is a real traction rope.
[0051] In an embodiment of the present invention, during the process of adjusting the traction rope rate of the suspected traction rope in real time, it is determined in real time whether the adjusted traction rope rate is greater than a preset traction rope rate threshold. If so, it can be determined that the suspected traction rope is a real traction rope, that is, the suspected traction rope is identified as the real traction rope between the target pet and the target person.
[0052] The pet leash detection method of an embodiment of the present invention determines a suspected leash between a target pet and a target person in a monitoring image in response to a pet leash detection event being triggered; tracks the trajectories of the suspected leash, the target pet, and the target person in real time, respectively, to determine a first motion trajectory of the pet end of the suspected leash, a second motion trajectory of the person end of the suspected leash, a third motion trajectory of the target pet, and a fourth motion trajectory of the target person; and during the trajectory tracking, determines morphological change information of the suspected leash and distance change information between the target pet and the target person; when the first motion trajectory coincides with the third motion trajectory and the second motion trajectory coincides with the fourth motion trajectory, adjusts the leash rate of the suspected leash in real time according to the morphological change information and the distance change information; when the leash rate of the suspected leash is greater than a preset leash rate threshold, determines that the suspected leash is a true leash. Through the technical solution provided by the embodiment of the present invention, the trajectory of the leash is tracked and compared, and associated with the movements of pets and people, thereby avoiding the influence of the irregular curve of the leash caused by the thickness, color, material and pet movement on the identification of the leash, thereby effectively improving the accuracy of leash identification.
[0053] In some embodiments, in response to a pet leash detection event being triggered, a suspected leash between a target pet and a target person in a monitoring screen is determined, including: in response to a pet leash detection event being triggered, acquiring a target image, and determining the target pet and all persons in the target image; for each of all the persons, determining the relative distance between the person and the target pet based on the monitoring screen acquired in real time, and determining the movement direction and movement speed of the person and the target pet respectively; determining the target leash probability between the person and the target pet based on the relative distance, the movement direction, and the movement speed; when the target leash probability is greater than a preset probability threshold, taking the person as the target person, and determining the suspected leash between the target pet and the target person. The advantage of this setting is that the target leash probability between the target pet and each person in the monitoring screen is determined based on the relative distance between the target pet and the person and the movement direction, movement speed and other factors of the target pet and the person, so as to screen the people in the monitoring screen, exclude people with little correlation with the target pet, and then analyze the suspected leash trajectory between the target pet and the target person, thereby reducing the number of groups of people and pets in the monitoring screen, narrowing the leash detection range, and thus improving the leash detection efficiency.
[0054] Exemplarily, in response to the pet leash detection event being triggered, when the target pet is detected in the monitoring image, the target image is acquired (the currently acquired monitoring image is taken as the target image, which can also be understood as the first frame image acquired when the target pet is detected), and all the people in the target image are determined. For each of all the people in the target image, the relative distance between the person and the target pet is determined in real time based on the subsequent real-time acquired monitoring image, and the movement direction and movement speed of the person and the target pet are determined respectively. Then, based on the relative distance between the person and the target pet, the movement direction and movement speed of the person, and the movement direction and movement speed of the target pet, the target leash probability between the person and the target pet is determined in real time. For example, the relative distance between the person and the target pet, the movement direction and movement speed of the person, and the movement direction and movement speed of the target pet can be input into a pre-trained leash probability determination model in real time, and the target leash probability between the person and the target pet is determined based on the output result of the leash probability determination model.
[0055] Optionally, before determining the relative distance between each of all the characters and the target pet based on the real-time collected monitoring image, and determining the movement direction and movement speed of the character and the target pet respectively, it also includes: determining the initial distance between each character in the target image and the target pet respectively, and determining the initial leash probability between the corresponding character and the target pet based on the initial distance; determining the target leash probability between the character and the target pet based on the relative distance, the movement direction and the movement speed, including: updating the initial leash probability according to a preset adjustment strategy based on the relative distance, the movement direction and the movement speed, and generating a target leash probability between the character and the target pet.
[0056] Exemplarily, an initial distance is determined between each person in the target image and the target pet, and an initial leash probability is determined for each person and the target pet based on the initial distance. For example, the larger the initial distance, the smaller the corresponding initial leash probability. Then, based on the real-time determined relative distance between the person and the target pet, and the direction and speed of movement of the person and the target pet, the initial leash probability is updated according to a preset adjustment strategy, and the updated initial leash probability is used as the target leash probability between the person and the target pet. It is understood that the leash probability between each person in the target image and the target pet is first determined based on the initial distance between the person and the target pet, and then the leash probability is dynamically adjusted according to the preset adjustment strategy based on the real-time determined relative distance between the person and the target pet, and the direction and speed of movement of the person and the target pet.
[0057] For example, within a preset time period or in N consecutive frames of surveillance footage, if the relative distance between the person and the target pet is less than a preset leash distance threshold, the leash probability between the person and the target pet can be increased. When the relative distance between the person and the target pet exceeds this preset leash distance threshold, the leash probability between the person and the target pet can be directly set to 0. In addition, since the person and the pet in the leash state should have similar movement speeds and the same movement direction, therefore, if the person and the target pet move in the same direction (that is, the angle between the person's movement direction and the target pet's movement direction does not exceed 90 degrees) and the person and the target pet move at similar speeds (that is, the difference between the person's movement speed and the target pet's movement speed is within a preset difference range), the leash probability between the person and the target pet can be greatly increased, such as by increasing the leash probability between the person and the target pet by a first preset probability threshold. However, if the person and the target pet move in the same direction (that is, the angle between the person's movement direction and the target pet's movement direction does not exceed 90 degrees) and the movement speed of the person and the target pet is significantly different (that is, the difference between the person's movement speed and the target pet's movement speed exceeds the preset difference range), the probability of the person and the target pet being on a leash can be slightly increased, such as increasing the probability of the person and the target pet on a leash by a second preset probability threshold, wherein the first preset probability threshold is greater than the second preset probability threshold.
[0058] If the person and the target pet are moving in opposite directions (i.e., the angle between the person's movement direction and the target pet's movement direction is greater than 90 degrees), the relative movement directions of the person and the target pet are considered. If the person and the target pet are moving toward each other, the probability of leash engagement between the person and the target pet is increased; if the person and the target pet are moving away from each other, the probability of leash engagement between the person and the target pet is decreased. If the person is stationary and the target pet is moving irregularly around the person, the relative distance between the target pet and the stationary person is compared to see if it remains within the preset leash distance threshold. If this remains within the preset leash distance threshold over a preset time period or across M consecutive frames of surveillance footage, the leash rate between the person and the target pet is increased.
[0059] Optionally, before determining the initial leash probability between the corresponding person and the target pet based on the initial distance, the method further includes: determining a density of people in the target image and determining a leash distance threshold based on the density of people; determining whether the initial distance is less than the leash distance threshold; and determining the initial leash probability between the corresponding person and the target pet based on the initial distance, including: when the initial distance is less than the leash distance threshold, determining the initial leash probability between the corresponding person and the target pet based on the initial distance; wherein the smaller the initial distance, the greater the initial leash probability. In this embodiment of the present invention, the density of people in the target image is determined, wherein more people in the target image indicate a greater density of people. Generally, the denser the crowd, i.e., the greater the density of people, the closer the distance between the pet and its owner should be. Therefore, the maximum leash distance is affected by the density of people. The denser the crowd around the pet, the smaller the maximum leash distance should be. Therefore, the leash distance threshold is determined based on the density of people, wherein the greater the density of people, the smaller the threshold of leash distance. Determine whether the initial distance between each person in the target image and the target pet is less than a leash distance threshold. If so, determine an initial leash probability between the corresponding person and the target pet based on the initial distance, where the smaller the initial distance, the greater the initial leash probability. Optionally, when the initial distance is greater than the leash distance threshold, the initial leash probability between the person and the target pet is set to 0. It will be appreciated that when the initial distance between the person and the target pet is greater than the leash distance threshold, it indicates that a leash is essentially impossible between the person and the target pet, and therefore, the leash probability between the person and the target pet can be set to 0.
[0060] Optionally, since the density of people affects the movement distance and speed of the target pet, the density of people in the monitoring screen can also be determined in real time, and the leash probability between the person and the target pet can be dynamically adjusted according to the density of people. For example, when the density of people increases, the relative distance between the person and the target pet will become smaller, so the leash distance threshold can be lowered, thereby further affecting the adjustment of the leash probability between the person and the target pet.
[0061] Figure 4 A schematic diagram of the display effect of the leash probability between each character and the target pet provided by an embodiment of the present invention.
[0062] Example 2
[0063] Figure 5 This is a schematic diagram of the structure of a pet leash detection device provided in the second embodiment of the present invention. Figure 5 As shown, the device includes:
[0064] a suspected leash determining module 510 for determining a suspected leash between a target pet and a target person in a surveillance image in response to a pet leash detection event being triggered;
[0065] The trajectory tracking module 520 is used to respectively track the trajectories of the suspected traction rope, the target pet, and the target person in real time, determine a first motion trajectory of the pet end of the suspected traction rope, a second motion trajectory of the person end of the suspected traction rope, a third motion trajectory of the target pet, and a fourth motion trajectory of the target person, and determine, during the trajectory tracking process, information on changes in the shape of the suspected traction rope and information on changes in the distance between the target pet and the target person;
[0066] a traction rope rate adjustment module 530 for adjusting the traction rope rate of the suspected traction rope in real time according to the morphological change information and the distance change information when the first motion trajectory coincides with the third motion trajectory and the second motion trajectory coincides with the fourth motion trajectory;
[0067] The real traction rope determining module 540 is configured to determine that the suspected traction rope is a real traction rope when the traction rope rate of the suspected traction rope is greater than a preset traction rope rate threshold.
[0068] Optionally, the traction rope rate adjustment module includes:
[0069] a suspected traction rope type determination unit, configured to determine the type of the suspected traction rope according to the morphological change information when the first motion trajectory coincides with the third motion trajectory and the second motion trajectory coincides with the fourth motion trajectory; wherein the suspected traction rope type includes a retractable traction rope and a non-retractable traction rope;
[0070] The traction rope rate improving unit is used to determine the characteristic change information of the suspected traction rope according to the type of the suspected traction rope, and when the characteristic change information matches the distance change information, improve the traction rope rate of the suspected traction rope according to a preset rule.
[0071] Optionally, the traction rope rate increasing unit is used to:
[0072] When the suspected traction rope is a retractable traction rope, determining the length change information of the suspected traction rope, and when the length change information matches the distance change information, increasing the traction rope rate of the suspected traction rope according to a preset rule;
[0073] When the suspected traction rope is a non-retractable traction rope, curvature change information of the suspected traction rope is determined, and when the curvature change information matches the distance change information, the traction rope rate of the suspected traction rope is increased according to a preset rule.
[0074] Optional, suspected traction rope determination module, including:
[0075] a target image acquisition unit, configured to acquire a target image in response to a pet leash detection event being triggered, and to determine a target pet and all persons in the target image;
[0076] a relative distance determination unit for determining, for each of the persons, a relative distance between the person and the target pet based on the real-time collected surveillance images, and determining the movement direction and movement speed of the person and the target pet respectively;
[0077] a target leash probability determination unit, configured to determine a target leash probability between the person and the target pet based on the relative distance, the movement direction, and the movement speed;
[0078] The suspected leash determining unit is configured to, when the target leash probability is greater than a preset probability threshold, take the person as a target person and determine a suspected leash between the target pet and the target person.
[0079] Optionally, also include:
[0080] an initial leash probability determination module for determining, for each of the characters, the relative distance between the character and the target pet based on the real-time acquired surveillance image, and determining the movement direction and movement speed of the character and the target pet, respectively, and determining an initial leash probability between the corresponding character and the target pet based on the initial distance;
[0081] The target leash probability determination unit is configured to:
[0082] According to the relative distance, the movement direction, and the movement speed, the initial leash probability is updated according to a preset adjustment strategy to generate a target leash probability between the person and the target pet.
[0083] Optionally, the device further includes:
[0084] a leash distance threshold determination module, configured to determine a density of people in the target image before determining an initial leash probability between the corresponding person and the target pet based on the initial distance, and determine a leash distance threshold based on the density of people;
[0085] An initial distance judgment module, configured to judge whether the initial distance is less than the rope distance threshold;
[0086] The initial leash probability determination module is used to:
[0087] When the initial distance is less than the leash distance threshold, the initial leash probability between the corresponding person and the target pet is determined according to the initial distance; wherein, the smaller the initial distance, the greater the initial leash probability.
[0088] Optionally, the device further includes:
[0089] The initial leash probability setting module is used to set the initial leash probability between the character and the target pet to 0 when the initial distance is greater than the leash distance threshold.
[0090] The pet leash detection device provided in the embodiment of the present invention can execute the pet leash detection method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0091] Example 3
[0092] Figure 6 A schematic diagram of a monitoring device 10 that can be used to implement an embodiment of the present invention is shown. The monitoring device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The monitoring device can also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or claimed herein.
[0093] like Figure 6 As shown, monitoring device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12 and a random access memory (RAM) 13, communicatively connected to at least one processor 11. The memory stores a computer program executable by the at least one processor, and processor 11 can perform various appropriate actions and processes based on the computer program stored in ROM 12 or loaded from storage unit 18 into RAM 13. RAM 13 can also store various programs and data required for the operation of monitoring device 10. Processor 11, ROM 12, and RAM 13 are interconnected via bus 14. An input / output (I / O) interface 15 is also connected to bus 14.
[0094] Several components in the monitoring device 10 are connected to the I / O interface 15, including an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a magnetic disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the monitoring device 10 to exchange information / data with other devices via a computer network such as the Internet and / or various telecommunication networks.
[0095] Processor 11 can be any general-purpose and / or specialized processing component with processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various specialized artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. Processor 11 executes the various methods and processes described above, such as the pet leash detection method.
[0096] In some embodiments, the pet leash detection method can be implemented as a computer program tangibly embodied in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program can be loaded and / or installed on monitoring device 10 via ROM 12 and / or communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the pet leash detection method described above can be performed. Alternatively, in other embodiments, processor 11 can be configured to perform the pet leash detection method in any other suitable manner (e.g., via firmware).
[0097] Various embodiments of the systems and techniques described herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), system-on-chip systems (SOCs), programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include being implemented in one or more computer programs that are executable and / or interpreted on a programmable system that includes at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0098] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when the computer program is executed by the processor, the functions / operations specified in the flowcharts and / or block diagrams are implemented. The computer program may be executed entirely on the machine, partially on the machine, as a stand-alone software package, partially on the machine and partially on a remote machine, or entirely on a remote machine or server.
[0099] In the context of the present invention, computer-readable storage media can be tangible media that can contain or store a computer program for use with an instruction execution system, device or equipment or used in combination with an instruction execution system, device or equipment. Computer-readable storage media can include but are not limited to electronic, magnetic, optical, electromagnetic, infrared or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, computer-readable storage media can be machine-readable signal media. More specific examples of machine-readable storage media can include electrical connections based on one or more lines, portable computer disks, hard disks, random access memories (RAM), read-only memories (ROM), erasable programmable read-only memories (EPROM or flash memory), optical fibers, portable compact disk read-only memories (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0100] To provide interaction with a user, the systems and techniques described herein can be implemented on a monitoring device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the monitoring device. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0101] The systems and techniques described herein can be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.
[0102] A computing system may include clients and servers. The clients and servers are typically remote from each other and typically interact via a communication network. This client-server relationship arises through computer programs running on the respective computers, creating a client-server relationship. The server may be a cloud server, also known as a cloud computing server or cloud host. This server is a hosting product within the cloud computing service ecosystem that addresses the management difficulties and limited scalability of traditional physical hosting and VPS services.
[0103] It should be understood that the various forms of the processes shown above can be used to reorder, add, or delete steps. For example, the steps described in the present invention can be performed in parallel, sequentially, or in a different order, as long as the desired results of the technical solution of the present invention can be achieved. This is not limited herein.
[0104] The above specific embodiments do not limit the scope of protection of the present invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions may be made based on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention are intended to be included within the scope of protection of the present invention.
Claims
1. A method for detecting a pet leash, characterized in that: include: In response to a pet leash detection event being triggered, determining a suspected leash between a target pet and a target person in a surveillance image; Tracking the trajectories of the suspected leash, the target pet, and the target person in real time, respectively, to determine a first motion trajectory of the pet end of the suspected leash, a second motion trajectory of the person end of the suspected leash, a third motion trajectory of the target pet, and a fourth motion trajectory of the target person, and determining, during the trajectory tracking process, information on shape changes of the suspected leash and information on changes in the distance between the target pet and the target person; When the first motion trajectory coincides with the third motion trajectory and the second motion trajectory coincides with the fourth motion trajectory, adjusting the traction rope rate of the suspected traction rope in real time according to the morphological change information and the distance change information; When the traction rope rate of the suspected traction rope is greater than a preset traction rope rate threshold, the suspected traction rope is determined to be a real traction rope.
2. The method according to claim 1, characterized in that When the first motion trajectory coincides with the third motion trajectory and the second motion trajectory coincides with the fourth motion trajectory, adjusting the traction rope rate of the suspected traction rope in real time according to the form change information and the distance change information, including: When the first motion trajectory coincides with the third motion trajectory and the second motion trajectory coincides with the fourth motion trajectory, determining the type of the suspected traction rope according to the morphological change information; wherein the type of the suspected traction rope includes a retractable traction rope and a non-retractable traction rope; The characteristic change information of the suspected traction rope is determined according to the type of the suspected traction rope, and when the characteristic change information matches the distance change information, the traction rope rate of the suspected traction rope is increased according to a preset rule.
3. The method according to claim 2, characterized in that Determining characteristic change information of the suspected traction rope according to the type of the suspected traction rope, and when the characteristic change information matches the distance change information, increasing the traction rope rate of the suspected traction rope according to a preset rule, including: When the suspected traction rope is a retractable traction rope, determining the length change information of the suspected traction rope, and when the length change information matches the distance change information, increasing the traction rope rate of the suspected traction rope according to a preset rule; When the suspected traction rope is a non-retractable traction rope, curvature change information of the suspected traction rope is determined, and when the curvature change information matches the distance change information, the traction rope rate of the suspected traction rope is increased according to a preset rule.
4. The method according to claim 1, wherein In response to a pet leash detection event being triggered, determining a suspected leash between a target pet and a target person in a surveillance image includes: In response to a pet leash detection event being triggered, acquiring a target image and determining a target pet and all people in the target image; For each of the persons, determining the relative distance between the person and the target pet based on the real-time collected surveillance images, and determining the movement direction and movement speed of the person and the target pet respectively; determining a target leash probability between the person and the target pet based on the relative distance, the movement direction, and the movement speed; When the target leash probability is greater than a preset probability threshold, the person is taken as a target person, and a suspected leash is determined between the target pet and the target person.
5. The method according to claim 4, characterized in that Before determining the relative distance between each of the persons and the target pet based on the real-time collected surveillance images and respectively determining the movement direction and movement speed of the person and the target pet, the method further includes: Determining the initial distance between each person in the target image and the target pet, and determining an initial leash probability between the corresponding person and the target pet according to the initial distance; Determining a target leash probability between the person and the target pet according to the relative distance, the movement direction, and the movement speed includes: According to the relative distance, the movement direction, and the movement speed, the initial leash probability is updated according to a preset adjustment strategy to generate a target leash probability between the person and the target pet.
6. The method according to claim 5, characterized in that Before determining the initial leash probability between the corresponding person and the target pet according to the initial distance, the method further includes: Determining a density of people in the target image, and determining a leash distance threshold based on the density of people; Determining whether the initial distance is less than the leash distance threshold; Determining an initial leash probability between the corresponding person and the target pet according to the initial distance includes: When the initial distance is less than the leash distance threshold, the initial leash probability between the corresponding person and the target pet is determined according to the initial distance; wherein, the smaller the initial distance, the greater the initial leash probability.
7. The method according to claim 6, characterized in that Also includes: When the initial distance is greater than the leash distance threshold, the initial leash probability between the character and the target pet is set to 0.
8. A pet leash detection device, characterized in that: include: a suspected leash determining module, configured to determine a suspected leash between a target pet and a target person in a monitoring image in response to a pet leash detection event being triggered; a trajectory tracking module for respectively tracking the trajectories of the suspected traction rope, the target pet, and the target person in real time, determining a first motion trajectory of the pet end of the suspected traction rope, a second motion trajectory of the person end of the suspected traction rope, a third motion trajectory of the target pet, and a fourth motion trajectory of the target person, and determining, during the trajectory tracking process, information on changes in the shape of the suspected traction rope and information on changes in the distance between the target pet and the target person; a traction rope rate adjustment module, configured to adjust the traction rope rate of the suspected traction rope in real time according to the morphological change information and the distance change information when the first motion trajectory coincides with the third motion trajectory and the second motion trajectory coincides with the fourth motion trajectory; The real traction rope determining module is configured to determine that the suspected traction rope is a real traction rope when the traction rope rate of the suspected traction rope is greater than a preset traction rope rate threshold.
9. A monitoring device, characterized in that: The monitoring equipment includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor. The computer program is executed by the at least one processor so that the at least one processor can perform the pet leash detection method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the pet leash detection method according to any one of claims 1 to 7 when executed.
Citation Information
Patent Citations
Euclidean distance and relative direction-based uncertain moving object trajectory grouping method
CN112579923A
Method for predicting motion trail of intersection
CN114815829A
Pet guy rope detection method and device and storage medium
CN115063751A
Traction method and positioning method of robot pet, robot pet and medium
CN116214534A
Method, device and system for detecting abnormal pet behaviors in public place
CN117218722A
Cited By
Pet traction detection method and device, electronic equipment and storage medium
CN122090384A
A pet traction detection method and device, an electronic device, and a storage medium
CN122090384B