Vision-based pet biting behavior recognition method, device, equipment and medium
By detecting and tracking real-time video data in pet care scenarios, eliminating non-key frames and eating images, and using pre-trained models to identify pet biting behaviors, the problem of inaccurate recognition in the existing technology is solved and efficient Pet behavior monitoring and safety protection.
Patent Information
- Application Number
- CN202411080647.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-08
- Publication Date
- 2024-10-18
- Estimated Expiration
- 2044-08-08
AI Technical Summary
The existing technology is difficult to accurately distinguish between pet biting behavior and eating behavior, resulting in inaccurate identification, high possibility of false positives and false negatives, and insufficient recognition accuracy and real-time performance in complex home environments.
By acquiring real-time video data in pet care scenarios, it is decomposed into multiple frames of real-time images for target detection and tracking, eliminating non-key frames and eating images, and using pre-trained models to identify bite movements and issue care reminders.
It improves the accuracy and reliability of identifying pet biting behavior, reduces false alarms, can issue timely reminders, reduces the monitoring burden on pet owners, and improves the efficiency and safety of pet care.
Smart Images

Figure CN118609171B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of pet care technology, and in particular to a method, device, equipment and medium for identifying pet biting behavior based on vision. Background Art
[0002] The behavior of pets at home sometimes causes damage to items. Common destructive behaviors include biting furniture, wires, shoes and other items. This not only causes economic losses, but may also pose a threat to the pet's own safety. In order to prevent and intervene in these behaviors in a timely manner, technologies for identifying and monitoring pet destructive behaviors have emerged. However, existing technologies have some defects in identifying pet biting actions, including the possibility of false positives and false negatives, the difficulty in fully covering the behavior patterns of pets of different types and sizes, the limited accuracy and response speed of sensors, and the possibility that the system may be interfered with or blocked by signals in complex home environments, resulting in insufficient recognition accuracy and real-time performance. In addition, the cost and maintenance of these technologies may also be a burden on users. Therefore, how to help pet owners monitor the behavior of their pet dogs in real time, promptly detect and prevent possible biting and destructive behaviors, thereby protecting home safety and reducing unnecessary economic losses.
[0003] The existing Chinese patent CN117894078A discloses a pet behavior analysis system based on AI vision, including: a video acquisition module, which acquires real-time monitoring images through a camera to form an image frame sequence to be detected, and provides a necessary data set for subsequent pet behavior analysis; a target detection and tracking module, which selects the image in which the pet exists in the picture for preprocessing according to the obtained image frame sequence, and uses a detection frame to mark the target pet, identify its type and location, and generate a processed image frame in which the target pet is marked with a detection frame and annotated with its type and location information; a key point detection module, which is used to process the target detection and tracking module The processed image frames are output, and the skeletal key point information of each part of the pet's body in each frame of the image is obtained, and a sequence of pet's key points is generated and the position is tracked, and based on this, the overall posture and body orientation of the target pet are judged, and the basic behavior of the target pet is further analyzed; the behavior analysis module is used to analyze the specific behavior of the pet according to the analysis results of the target pet's basic behavior and the area where the target pet is located, and form a judgment result on the specific behavior of the pet; although the above scheme discloses the identification of the pet's biting behavior through skeletal key points, the biting and eating behaviors are highly similar in body posture and movement patterns, so they are easy to confuse. Both behaviors involve frequent movements of the pet's head and biting actions of the mouth, and may show similar characteristics in the trajectory of skeletal key points, such as repeated movements of the head and neck.
[0004] Therefore, how to distinguish between pet biting and eating behaviors, so as to accurately detect and prevent possible biting and destructive behaviors and protect home safety is an urgent problem to be solved. Summary of the invention
[0005] In view of this, the present invention provides a vision-based pet biting behavior recognition method, device, equipment and medium to solve the problem in the prior art that pet biting behavior and eating behavior cannot be distinguished and biting behavior recognition is inaccurate.
[0006] The technical solution adopted by the present invention is:
[0007] In a first aspect, the present invention provides a method for identifying pet biting behavior based on vision, the method comprising:
[0008] Acquire real-time video data in a pet care scene, and decompose the real-time video data into multiple frames of real-time images;
[0009] Perform target detection and tracking on each frame of real-time image and output a pet target image sequence;
[0010] Preprocessing the pet target image sequence, removing non-key frame images and pet eating images, and outputting the preprocessed images;
[0011] The preprocessed images are used to identify pet biting actions, and when pet biting actions are detected, a care reminder is issued.
[0012] Preferably, the performing target detection and tracking on each frame of real-time image and outputting a pet target image sequence comprises:
[0013] Input each frame of real-time image into the pre-trained pet detection model to detect the pet target in each frame of real-time image;
[0014] The preset target tracking algorithm is used to track the pet target in each frame of real-time image, and the pet target image sequence and the pet target frame position sequence are output.
[0015] Preferably, the preprocessing of the pet target image sequence, removing non-key frame images and pet eating images, and outputting the preprocessed images comprises:
[0016] Performing filtering processing on the pet target image sequence and outputting a filtered image sequence;
[0017] According to the pet target frame position sequence, the filtered image sequence is subjected to image deduplication processing, continuously repeated non-key frame images are eliminated, and key frame images are output;
[0018] Perform pet eating behavior recognition on key frame images, remove images showing pet eating behavior, and output preprocessed images.
[0019] Preferably, the step of performing image deduplication processing on the filtered image sequence according to the pet target frame position sequence, removing continuously repeated non-key frame images, and outputting key frame images comprises:
[0020] Grouping the pet target frame position sequences to determine a plurality of pet target frame position sets;
[0021] According to each pet target frame position in each pet target frame position set, the area of each pet target frame is calculated respectively, and the area of each pet target frame is output;
[0022] According to the area of each pet target frame, the filtered image corresponding to the pet target frame with the largest area in the pet target frame position set is selected as the key frame image.
[0023] Preferably, the step of performing pet eating behavior recognition on key frame images, eliminating images in which pet eating behavior is present, and outputting preprocessed images comprises:
[0024] Inputting the real-time image into a pre-trained target object detection model related to pet eating to obtain a target object detection frame;
[0025] Enlarging the target object detection frame to determine the pet eating area;
[0026] Calculate the cross ratio between the pet's eating area and the key frame image. If the cross ratio is greater than a preset ratio threshold, it is considered that the pet in the key frame image stays in the eating area.
[0027] The length of time the pet stays in the eating area is obtained. When the length of time is greater than a preset length threshold, it is considered that the key frame image contains the pet's eating behavior, and the image containing the pet's eating behavior is removed.
[0028] Preferably, the performing pet biting action recognition on the pre-processed image and issuing a care reminder when the pet biting action is recognized includes:
[0029] Input each preprocessed frame image into the pre-trained pet head detection model, and output a pet head image sequence;
[0030] Calculate the pet head image sequence to obtain the pet movement information;
[0031] The pet movement information is input into a pre-trained biting action recognition model, and a pet biting action recognition result is output.
[0032] Preferably, in the step of inputting the pet movement information into the pre-trained biting action recognition model, before outputting the pet biting action recognition result, the step further includes:
[0033] Obtain training images related to pet biting actions;
[0034] Performing image deduplication processing on the training image and outputting a sample key frame image;
[0035] Acquiring sample motion information according to the sample key frame image;
[0036] The sample motion information is used to train a preset neural network model to obtain the biting action recognition model.
[0037] In a second aspect, the present invention provides a device for identifying pet biting behavior based on vision, the device comprising:
[0038] A real-time image acquisition module is used to acquire real-time video data in a pet care scene and decompose the real-time video data into multiple frames of real-time images;
[0039] The target detection and tracking module is used to detect and track targets in each frame of real-time images and output a sequence of pet target images;
[0040] A preprocessing module, used for preprocessing the pet target image sequence, removing non-key frame images and pet eating images, and outputting the preprocessed images;
[0041] The biting action recognition module is used to recognize pet biting actions in preprocessed images, and issue a care reminder when a pet biting action is detected.
[0042] In a third aspect, an embodiment of the present invention further provides an electronic device, comprising: at least one processor, at least one memory, and computer program instructions stored in the memory, which, when executed by the processor, implement the method of the first aspect in the above-mentioned embodiment.
[0043] In a fourth aspect, an embodiment of the present invention further provides a storage medium on which computer program instructions are stored, and when the computer program instructions are executed by a processor, the method of the first aspect in the above-mentioned embodiment is implemented.
[0044] In summary, the beneficial effects of the present invention are as follows:
[0045] The vision-based pet biting behavior recognition method, device, equipment and medium provided by the present invention include: acquiring real-time video data in a pet care scene, decomposing the real-time video data into multiple frames of real-time images; performing target detection and tracking on each frame of real-time image, and outputting a pet target image sequence; preprocessing the pet target image sequence, eliminating non-key frame images and pet eating images, and outputting the preprocessed images; performing pet biting action recognition on the preprocessed images, and issuing a care reminder when the pet biting action is recognized. The present invention decomposes the video into multiple frames of images through real-time video data acquisition and image decomposition, and uses target detection and tracking technology to extract the pet's target image sequence. The preprocessing step eliminates non-key frames and eating images, and can accurately distinguish between eating behavior and house-destroying behavior, avoiding misjudging eating behavior as house-destroying behavior, reducing false alarms, and improving recognition accuracy and reliability. At the same time, it can immediately issue a care reminder when biting behavior is detected, allowing pet owners to take timely measures to prevent potential dangers or bad behaviors from occurring. This method reduces the owner's burden of monitoring pet behavior through automation and intelligent processing, and improves the efficiency and safety of pet care. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] In order to more clearly illustrate the technical solution of the embodiment of the present invention, the drawings required for use in the embodiment of the present invention will be briefly introduced below. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work, and these are all within the protection scope of the present invention.
[0047] Figure 1 It is a schematic diagram of the overall working process of the method for identifying pet biting behavior based on vision in Example 1 of the present invention;
[0048] Figure 2 Schematic diagram of the process of performing target detection and tracking on each frame of real-time image in Embodiment 1 of the present invention;
[0049] Figure 3 This is a schematic diagram of a process for preprocessing the pet target image sequence in Embodiment 1 of the present invention;
[0050] Figure 4 It is a schematic diagram of a process of performing image deduplication processing on the filtered image sequence in Embodiment 1 of the present invention;
[0051] Figure 5 This is a schematic diagram of the process of identifying the eating behavior of a pet using a key frame image in Embodiment 1 of the present invention;
[0052] Figure 6 This is a schematic diagram of a process of identifying a pet biting action on a pre-processed image in Embodiment 1 of the present invention;
[0053] Figure 7 is a schematic diagram of the process of training the biting action recognition model in Example 1 of the present invention;
[0054] Figure 8 is a structural block diagram of a device for identifying pet biting behavior based on vision in Embodiment 2 of the present invention;
[0055] Fig. 9 It is a schematic diagram of the structure of the electronic device in Embodiment 3 of the present invention. DETAILED DESCRIPTION
[0056] In order to make the purpose, technical solution and advantages of the embodiment of the present invention clearer, the technical solution in the embodiment of the present invention will be clearly and completely described in conjunction with the drawings in the embodiment of the present invention. It should be noted that, in this article, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply that there is any such actual relationship or order between these entities or operations. In the description of the present invention, it should be understood that the orientation or position relationship indicated by the terms "center", "upper", "lower", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inside", "outside", etc. is based on the orientation or position relationship shown in the drawings, which is only for the convenience of describing the present application and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation of the present invention. Moreover, the term "include", "comprise" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such a process, method, article or device. In the absence of further restrictions, the elements defined by the phrase "comprising..." do not exclude the existence of other identical elements in the process, method, article or device comprising the elements. If there is no conflict, the embodiments of the present invention and the various features in the embodiments can be combined with each other, all within the protection scope of the present invention.
[0057] Example 1
[0058] See also Figure 1 Embodiment 1 of the present invention discloses a method for identifying pet biting behavior based on vision, the method comprising:
[0059] Acquire real-time video data in a pet care scene, and decompose the real-time video data into multiple frames of real-time images;
[0060] Specifically, real-time video data in the pet care scenario is obtained and decomposed into multiple frames of real-time images. Since the real-time video data is captured by the front-facing camera installed on the mobile pet cart, the mobile pet cart can flexibly follow the activity trajectory of the pet dog, ensuring that the camera always covers the main area of the pet dog's activities, thereby capturing more key images and behavioral details. This design not only provides a wide monitoring coverage, but also improves the quality and accuracy of real-time video data by dynamically adjusting the shooting angle, which helps to more effectively detect, track and analyze behaviors.
[0061] Perform target detection and tracking on each frame of real-time image and output a pet target image sequence;
[0062] Specifically, target detection and tracking are performed on each frame of real-time images in order to identify and continuously locate the pet's position in the picture. Advanced computer vision algorithms, such as YOLO8S or SSD, can quickly and accurately detect the pet target in each frame and mark its position. Subsequently, tracking algorithms, such as Kalman filter or SORT, can be used to track the pet's position changes in consecutive frames to generate a continuous sequence of pet target images. This process not only ensures the real-time positioning of the pet in the video, but also provides high-quality image data for subsequent behavioral analysis, which helps to capture the dynamic behavioral characteristics of the pet and improve the accuracy and reliability of the entire care system.
[0063] In one embodiment, see Figure 2 , the target detection and tracking of each frame of real-time image, and output of a pet target image sequence include:
[0064] Input each frame of real-time image into the pre-trained pet detection model to detect the pet target in each frame of real-time image;
[0065] Specifically, each frame extracted from the video stream is first input into a pre-trained pet detection model. The model may be based on a deep learning architecture, such as YOLO8S (You Only Look Once), SSD (SingleShot MultiBox Detector), or Faster R-CNN. These models have been trained on a large number of labeled pet images and can quickly and accurately identify pet targets in images. The model extracts and classifies features from the image and outputs the bounding box, type, and confidence score of the pet. The purpose of this step is to locate and identify the pet in each frame for subsequent tracking and behavior analysis.
[0066] The preset target tracking algorithm is used to track the pet target in each frame of real-time image, and the pet target image sequence and the pet target frame position sequence are output.
[0067] Specifically, after detecting the pet targets in each frame, the system will use the preset target tracking algorithm to track these targets. Commonly used tracking algorithms include Kalman filter, SORT, and Deep SORT. These algorithms predict the position of the pet in subsequent frames by using the position, speed, and other dynamic information of the pet in the current frame and previous frames. The tracking algorithm can not only smooth the detection results and reduce the jitter caused by the detector error, but also re-identify and track the pet after it leaves the field of view for a short time. The final output is a sequence of images containing pet targets, and a corresponding sequence of pet target frame positions in each frame.
[0068] Preprocessing the pet target image sequence, removing non-key frame images and pet eating images, and outputting the preprocessed images;
[0069] Specifically, after obtaining a continuous sequence of pet target images, these images are preprocessed to improve the accuracy and efficiency of subsequent behavior recognition. Preprocessing includes removing non-key frames and pet eating images. Non-key frames refer to images that do not contain obvious behavioral information and can be identified by analyzing the degree of change or similarity of the images. Eating images can be detected and eliminated based on specific features (such as the pet's head down and mouth movements) and contextual information (such as the location of the food container). The goal of this step is to filter out irrelevant or interfering information, retain the images that are most useful for identifying specific behaviors such as biting, and output a streamlined and high-quality image sequence for subsequent analysis.
[0070] In one embodiment, see Figure 3 , the pet target image sequence is preprocessed, non-key frame images and pet eating images are removed, and the preprocessed images are outputted, including:
[0071] Performing filtering processing on the pet target image sequence and outputting a filtered image sequence;
[0072] Specifically, the pet target image sequence will be filtered to reduce noise and improve image quality, thereby improving the accuracy of subsequent analysis. Filtering can be done in a variety of ways, such as Gaussian filtering, mean filtering, or median filtering. Gaussian filtering smoothes images through convolution operations to reduce high-frequency noise; mean filtering smoothes images by taking the average of neighborhood pixels; median filtering eliminates noise spikes by using the median of neighborhood pixels. Filtering can not only remove random noise from the image, but also enhance the edges and details of the image, making the features of the pet target more obvious and stable. After filtering, the output filtered image sequence has better visual effects and consistency, laying the foundation for subsequent image deduplication and key frame extraction.
[0073] According to the pet target frame position sequence, the filtered image sequence is subjected to image deduplication processing, continuously repeated non-key frame images are eliminated, and key frame images are output;
[0074] Specifically, the pet target frame position sequence will be used to perform deduplication processing on the filtered image sequence to remove continuously repeated non-key frame images. First, by comparing the pet target frame position and shape changes in adjacent frames, it can be determined whether the two frames are highly similar. If the target frame position in adjacent multi-frame images has almost no change, these frames are considered to be repeated non-key frames. In order to improve the accuracy of deduplication, a threshold can be set, and when the position and shape changes are within the threshold range, the frame is considered to be repeated. In addition, image content features such as texture and color histograms can be combined to further verify the similarity of the image. Through deduplication processing, the system is able to remove redundant images and retain key frames that reflect changes in pet movements, thereby outputting a set of key frame images containing important behavioral information. These key frame images will provide a more effective data basis for subsequent behavior recognition.
[0075] In one embodiment, see Figure 4 , the image deduplication processing is performed on the filtered image sequence according to the pet target frame position sequence, and the continuous and repeated non-key frame images are eliminated, and the key frame images are outputted, including:
[0076] Grouping the pet target frame position sequences to determine a plurality of pet target frame position sets;
[0077] Specifically, in this step, the system groups the pet target frame position sequence to determine multiple pet target frame position sets. Each set corresponds to a continuous time period, indicating the pet's activity area and trajectory during the time period. Grouping can be based on time intervals or changes in the pet's position. For example, target frames that are continuous in time and have little position change can be grouped together, or grouped according to the pet's movement mode (such as stopping, moving slowly, or moving quickly). This grouping method helps the system better analyze and process the pet's behavioral changes and extract representative key frame images.
[0078] According to each pet target frame position in each pet target frame position set, the area of each pet target frame is calculated respectively, and the area of each pet target frame is output;
[0079] Specifically, calculate the area of each pet target frame in each pet target frame position set. The area is calculated by multiplying the width and height of the target frame. Specifically, traverse each target frame in each set, calculate its area and record it. The output result is a list of the areas of each target frame in each target frame position set. The purpose of this step is to evaluate the space occupied by each target frame in the image, so as to provide a basis for the subsequent key frame image selection.
[0080] According to the area of each pet target frame, the filtered image corresponding to the pet target frame with the largest area in the pet target frame position set is selected as the key frame image.
[0081] Specifically, the target box area calculated in the previous step is used to select the target box with the largest area from each pet target box position set. Biting behavior often involves fast and large movements, which will occupy more space in the image. Selecting the image with the largest area can better capture the full picture of these movements. Therefore, the image with the largest area is suitable as a key frame image. Specifically, traverse each position set, compare the areas of all target boxes therein, select the target box with the largest area, and determine its corresponding filtered image as the key frame image. This process ensures that the key frame image has the most important information visually, which is conducive to subsequent behavior recognition.
[0082] Perform pet eating behavior recognition on key frame images, remove images showing pet eating behavior, and output preprocessed images.
[0083] Specifically, the selected key frame images are further processed to identify and eliminate images of pet eating behaviors. Eating behavior recognition can use a specific behavior recognition algorithm to determine whether the pet is eating by analyzing features such as the pet's posture, head position, mouth movement, and whether there is food in the image. The recognition algorithm can be based on machine learning or deep learning models, which have been trained on a large number of pet images with eating behavior labels and can accurately identify eating actions. For images in which eating behaviors are detected, the system eliminates them and retains other images that do not contain eating behaviors as preprocessed images. The final output preprocessed image set is more streamlined and accurately reflects the pet's other behaviors, providing a high-quality data foundation for subsequent behavioral analysis.
[0084] In one embodiment, see Figure 5 , the pet eating behavior is recognized on the key frame images, images with pet eating behavior are eliminated, and the preprocessed images are outputted, including:
[0085] Inputting the real-time image into a pre-trained target object detection model related to pet eating to obtain a target object detection frame;
[0086] Specifically, the real-time image is input into a pre-trained object detection model that is specifically designed to detect objects related to pet eating, such as food bowls, water bowls, etc. This detection model may be based on deep learning algorithms, such as YOLO8S, Faster R-CNN, etc., which have been trained on a large number of images labeled with these object labels. The model will identify the location of these objects in the image and output the bounding box of the target object, that is, the target object detection box. These detection boxes provide the precise location and size information of each target object in the image as the basis for subsequent steps.
[0087] Enlarging the target object detection frame to determine the pet eating area;
[0088] Specifically, the target object detection frame will be enlarged to determine a larger pet eating area. This is because pets are not limited to the location of food and water when eating, and may have a certain range of activities. For example, according to actual tests, by enlarging the pet eating area to twice the size of the detection frame, the possible eating area of the pet can be more comprehensively covered. At the same time, the enlargement ratio can also be set according to specific needs and experimental results to ensure that a reasonable range is covered. After the enlargement process, the obtained pet eating area will be used for the subsequent cross ratio calculation.
[0089] Calculate the cross ratio between the pet's eating area and the key frame image. If the cross ratio is greater than a preset ratio threshold, it is considered that the pet in the key frame image stays in the eating area.
[0090] Specifically, the cross ratio between the pet's eating area and the pet's target box in the keyframe image is calculated. The cross ratio is determined by calculating the ratio of the area of the overlapping part of the two areas to their union area. If the cross ratio is greater than a preset ratio threshold (for example, 0.5), the pet is considered to stay in the eating area in the keyframe image. This threshold is set according to the specific application scenario and experimental results to balance the risk of misjudgment and missed judgment.
[0091] The length of time the pet stays in the eating area is obtained. When the length of time is greater than a preset length threshold, it is considered that the key frame image contains the pet's eating behavior, and the image containing the pet's eating behavior is removed.
[0092] Specifically, the length of time the pet stays in the feeding area is recorded. Through the analysis of continuous frames, if the pet continues to appear in the feeding area in multiple frames and the length of stay exceeds a preset time threshold (for example, 5 seconds), it is determined that the pet is eating. This time threshold is set to avoid misjudging the behavior of briefly passing through the feeding area as eating behavior. For key frame images that identify the presence of pet eating behavior, the system removes them to ensure that subsequent image data only contains non-eating behavior images.
[0093] The preprocessed images are used to identify pet biting actions, and when pet biting actions are detected, a care reminder is issued.
[0094] Specifically, the pet biting action recognition will be performed on the image that has been preprocessed in the previous steps. Biting action recognition can use a pre-trained action recognition model, which recognizes biting actions by analyzing the pet's skeletal key points, motion trajectory and behavioral characteristics. Commonly used models include temporal convolutional networks (TCN) or long short-term memory networks (LSTM) based on deep learning. When the system detects the presence of pet biting actions in the image, it will immediately issue a care reminder to notify the owner to intervene in time to prevent the pet from getting into danger or causing damage. This real-time behavior recognition and reminder mechanism greatly improves the intelligence level and safety of pet care.
[0095] In one embodiment, the performing of pet biting action recognition on the pre-processed image and issuing a care reminder when a pet biting action is recognized includes:
[0096] When a pet biting action is identified, the preprocessed image is input into a pre-trained biting target detection model to obtain a biting target image;
[0097] Specifically, the preprocessed image is input into a pre-trained biting target detection model, which is a target detection model trained based on the YOLO8S architecture. The YOLO8S model is an efficient real-time target detection algorithm that can simultaneously complete object detection in the image through a single forward propagation. Specifically, YOLO8S divides the entire preprocessed image into a grid, each grid is responsible for predicting multiple bounding boxes and their corresponding confidence scores. If the confidence of a bounding box exceeds a preset threshold, the model will determine that there is a biting target in the box. The advantage of the YOLO8S model is its fast speed and high accuracy, which is particularly suitable for real-time detection tasks. By using the YOLO8S model, the pet's biting target can be quickly and accurately detected in the image, and the relevant biting target image can be extracted to provide accurate input data for subsequent classification and care reminder steps.
[0098] Inputting the biting target image into a pre-trained target classification model and outputting a classification result;
[0099] Specifically, when the biting target image is input into the pre-trained target classification model, a specially trained classification model is selected, which can accurately classify according to the characteristics of the target image. This classification model is usually based on deep learning technology, such as convolutional neural network (CNN), and is trained on a large amount of labeled data to learn the characteristics of different target categories. When processing the biting target image, the target classification model will extract high-level features in the biting target image through its multiple convolutional layers, pooling layers, and fully connected layers, and map these features to a predefined category label space. The output of the target classification model will be a classification result, which contains the probability distribution of the category to which the target belongs. Finally, the target classification model will provide a most likely category label or classification result, which can be "toy", "furniture" or other related categories. This classification result is used to further determine whether a care reminder needs to be issued, thereby helping users to effectively manage pet behavior.
[0100] According to the classification result, if the biting target is classified as a preset target or the biting target is not successfully classified, a care reminder is issued;
[0101] Specifically, based on the classification results, whether to issue a care reminder will be determined based on the category information of the biting target or the success of the classification. If the classification model identifies the biting target as a preset target, such as specific furniture, toys, or other items that may cause damage by pets, an alarm will be automatically triggered and a care reminder will be issued to inform the pet owner to pay attention to the item to prevent further damage. In addition, if the biting target is not successfully classified, that is, the category to which it belongs cannot be clearly determined, a care reminder will also be issued. This may occur when the quality of the target image is poor or the model encounters an unknown object. By issuing a reminder, the owner can pay attention to the pet's behavior in a timely manner and take necessary measures to prevent potential damage or intervene in the pet's behavior, thereby better managing the pet's activities and protecting the home environment.
[0102] If the biting target is classified as a non-preset target, no care reminder will be issued.
[0103] Specifically, when the classification result of the biting target indicates that the target does not belong to the preset category, no care reminder will be issued, which means that if the biting target is identified as a non-preset target, such as an ordinary harmless object or an object that is not within the monitoring range, it will be regarded as a low-priority event. At this time, the reminder mechanism will remain silent to avoid unnecessary interference and notifications. Such a design can effectively reduce the frequency of alarms received by users, making care reminders more accurate and targeted, and only issuing an alarm when the target of the pet's bite is a clear object that needs attention. In this way, users can focus on managing targets that pose a potential threat to the home environment, while improving user experience and system efficiency.
[0104] In one embodiment, see Figure 6 The step of performing pet biting action recognition on the pre-processed image and issuing a care reminder when a pet biting action is recognized also includes:
[0105] Input each preprocessed frame image into the pre-trained pet head detection model, and output a pet head image sequence;
[0106] Specifically, each preprocessed frame is input into a pretrained pet head detection model. This model is specially trained to detect the position of the pet head in the image, usually based on deep learning algorithms such as YOLO8S, FasterR-CNN or SSD. Through the feature extraction and classification capabilities of the model, the system can accurately identify the position of the pet's head in each frame and generate a bounding box to represent it. The output result is a sequence of pet head images, each of which contains one or more bounding boxes marking the position of the pet's head. These head image sequences will be used for subsequent motion information calculation and behavior recognition.
[0107] Calculate the pet head image sequence to obtain the pet movement information;
[0108] Specifically, the pet's head image sequence will be calculated to obtain the pet's motion information. Specifically, the system will track the position changes of the pet's head bounding box in each frame and calculate dynamic information such as the head's motion trajectory and speed. This can be achieved through optical flow, Kalman filtering or other target tracking algorithms. The optical flow method determines the direction and speed of an object by analyzing the pixel motion of the image, while the Kalman filter can smooth the motion trajectory and predict future positions. Through these calculations, the system is able to generate a set of feature data describing the pet's head movement, such as position changes, velocity vectors, and motion paths, which constitute the pet's motion information.
[0109] The pet movement information is input into a pre-trained biting action recognition model, and a pet biting action recognition result is output.
[0110] Specifically, the acquired pet motion information is input into a pre-trained biting action recognition model. This model is usually a time series model based on deep learning, such as a long short-term memory network (LSTM) or a temporal convolutional network (TCN), which is good at processing time series data and capturing dynamic behavior patterns. Biting actions have specific motion characteristics, such as rapid, repetitive head movements and biting actions. By analyzing the input motion information, the model can identify these characteristics and determine whether the pet is biting. The output result is a biting action recognition result, which includes the confidence of the biting action and a specific identification label. If a biting action is identified, the system can trigger a corresponding care reminder to notify the owner to take necessary intervention measures.
[0111] In one embodiment, see Figure 7 In the step of inputting the pet movement information into the pre-trained biting action recognition model, before outputting the pet biting action recognition result, the step further includes:
[0112] Obtain training images related to pet biting actions;
[0113] Specifically, a large number of training images related to pet biting actions are collected. These images can come from various sources, such as public datasets, pet monitoring videos, or acquired through special shooting. To ensure the diversity and representativeness of the data, the training images should cover pets of different species, ages, and postures, as well as biting actions in different environments and lighting conditions. These training images will serve as the basic data for the model to learn the characteristics of biting actions.
[0114] Performing image deduplication processing on the training image and outputting a sample key frame image;
[0115] Specifically, the collected training images will be deduplicated to remove duplicate and redundant images. Deduplication can be achieved through image similarity comparison algorithms, such as similarity detection based on image hashing, SIFT (Scale Invariant Feature Transform) feature matching, or deep learning embedding feature comparison. By calculating the similarity between each pair of images and setting a threshold, the system can identify and remove highly similar images and retain representative sample keyframe images. Doing so can reduce data redundancy, improve training efficiency, and ensure that the model learns more behavioral features.
[0116] Acquiring sample motion information according to the sample key frame image;
[0117] Specifically, the sample keyframe images will be further processed to obtain sample motion information of the pet's biting action. Specifically, the system will extract motion features through the position changes of key points of the pet's head or body in the image sequence. This can be achieved using optical flow, target tracking algorithms (such as Kalman filtering or Deep SORT), or key point detection-based methods (such as OpenPose). Motion information includes but is not limited to the movement trajectory of the pet's head and body, speed changes, acceleration, etc. This motion information will be used as feature input to train the biting action recognition model.
[0118] The sample motion information is used to train a preset neural network model to obtain the biting action recognition model.
[0119] Specifically, the acquired sample motion information will be used to train the preset neural network model to build a biting action recognition model. The preset neural network model can be a time series model (such as LSTM, GRU), a convolutional neural network (CNN) combined with a time series model, or other deep learning models suitable for processing time series and motion features. During the training process, the system will use the sample motion information as input data and the label of the biting action as a supervisory signal, and continuously optimize the model parameters through back propagation and gradient descent algorithms. The goal of model training is to allow the neural network to learn the characteristic patterns of biting actions, so that it can accurately identify the biting behavior of pets in practical applications. After the training is completed, after verification and testing, a model that can efficiently identify biting actions is finally obtained for use in actual pet behavior monitoring systems.
[0120] Example 2
[0121] See also Figure 8 Embodiment 2 of the present invention further provides a device for identifying pet biting behavior based on vision, the device comprising:
[0122] A real-time image acquisition module is used to acquire real-time video data in a pet care scene and decompose the real-time video data into multiple frames of real-time images;
[0123] The target detection and tracking module is used to detect and track targets in each frame of real-time images and output a sequence of pet target images;
[0124] A preprocessing module, used for preprocessing the pet target image sequence, removing non-key frame images and pet eating images, and outputting the preprocessed images;
[0125] The biting action recognition module is used to recognize pet biting actions in preprocessed images, and issue a care reminder when a pet biting action is detected.
[0126] Specifically, the vision-based pet biting behavior recognition device provided by the embodiment of the present invention is adopted, and the device includes: a real-time image acquisition module, which is used to acquire real-time video data in a pet care scene and decompose the real-time video data into multiple frames of real-time images; a target detection and tracking module, which is used to perform target detection and tracking on each frame of real-time image and output a pet target image sequence; a preprocessing module, which is used to preprocess the pet target image sequence, eliminate non-key frame images and pet eating images, and output the preprocessed images; a biting action recognition module, which is used to recognize the pet biting action on the preprocessed images, and issue a care reminder when the pet biting action is recognized. This device decomposes the video into multiple frames of images through real-time video data acquisition and image decomposition, and uses target detection and tracking technology to extract the pet's target image sequence. The preprocessing step eliminates non-key frames and eating images, which can accurately distinguish between eating behavior and house-destroying behavior, avoid misjudging eating behavior as house-destroying behavior, reduce false alarms, and improve recognition accuracy and reliability. At the same time, it can immediately issue a care reminder when biting behavior is detected, allowing pet owners to take timely measures to prevent potential dangers or bad behaviors from occurring. This method reduces the owner's burden of monitoring pet behavior through automation and intelligent processing, and improves the efficiency and safety of pet care.
[0127] Example 3
[0128] In addition, combined Figure 1 The vision-based pet biting behavior recognition method of Embodiment 1 of the present invention described above can be implemented by an electronic device. Fig. 9 A schematic diagram of the hardware structure of an electronic device provided in Embodiment 3 of the present invention is shown.
[0129] The electronic device may include a processor and a memory storing computer program instructions.
[0130] Specifically, the processor may include a central processing unit (CPU), or an application specific integrated circuit (ASIC), or may be configured to implement one or more integrated circuits of the embodiment of the present invention.
[0131] The memory may include a large capacity memory for data or instructions. By way of example and not limitation, the memory may include a hard disk drive (HDD), a floppy disk drive, a flash memory, an optical disk, a magneto-optical disk, a magnetic tape, or a universal serial bus (USB) drive or a combination of two or more of these. Where appropriate, the memory may include a removable or non-removable (or fixed) medium. Where appropriate, the memory may be inside or outside the data processing device. In a particular embodiment, the memory is a non-volatile solid-state memory. In a particular embodiment, the memory includes a read-only memory (ROM). Where appropriate, the ROM may be a mask-programmed ROM, a programmable ROM (PROM), an erasable PROM (EPROM), an electrically erasable PROM (EEPROM), an electrically rewritable ROM (EAROM) or a flash memory or a combination of two or more of these.
[0132] The processor implements any one of the vision-based pet biting behavior recognition methods in the above embodiments by reading and executing computer program instructions stored in the memory.
[0133] In one example, the electronic device may further include a communication interface and a bus. Fig. 9 As shown, the processor, memory, and communication interface are connected via a bus and communicate with each other.
[0134] The communication interface is mainly used to implement communication between the modules, devices, units and / or equipment in the embodiments of the present invention.
[0135] The bus includes hardware, software or both, and the components of the device are coupled to each other. For example, but not limitation, the bus may include an accelerated graphics port (AGP) or other graphics bus, an enhanced industrial standard architecture (EISA) bus, a front-side bus (FSB), a hypertransport (HT) interconnection, an industrial standard architecture (ISA) bus, an infinite bandwidth interconnection, a low pin count (LPC) bus, a memory bus, a microchannel architecture (MCA) bus, a peripheral component interconnect (PCI) bus, a PCI-Express (PCI-X) bus, a serial advanced technology attachment (SATA) bus, a video electronics standard association local (VLB) bus or other suitable bus or a combination of two or more of these. Where appropriate, the bus may include one or more buses. Although the embodiments of the present invention describe and illustrate a specific bus, the present invention contemplates any suitable bus or interconnection.
[0136] Example 4
[0137] In addition, in combination with the visual-based pet biting behavior recognition method in the above embodiment 1, the present invention can also provide a computer-readable storage medium for implementation in embodiment 4. The computer-readable storage medium stores computer program instructions; when the computer program instructions are executed by the processor, any of the visual-based pet biting behavior recognition methods in the above embodiments is implemented.
[0138] In summary, the embodiments of the present invention provide a method, device, equipment and medium for identifying pet biting behavior based on vision.
[0139] It should be clear that the present invention is not limited to the specific configuration and processing described above and shown in the figures. For the sake of simplicity, a detailed description of the known method is omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of the present invention is not limited to the specific steps described and shown, and those skilled in the art can make various changes, modifications and additions, or change the order between the steps after understanding the spirit of the present invention.
[0140] The functional blocks shown in the structural block diagram described above can be implemented as hardware, software, firmware or a combination thereof. When implemented in hardware, it can be, for example, an electronic circuit, an application specific integrated circuit (ASIC), appropriate firmware, a plug-in, a function card, etc. When implemented in software, the elements of the present invention are programs or code segments used to perform the required tasks. The program or code segment can be stored in a machine-readable medium, or transmitted on a transmission medium or a communication link by a data signal carried in a carrier. "Machine-readable medium" may include any medium capable of storing or transmitting information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, ROMs, flash memories, erasable ROMs (EROMs), floppy disks, CD-ROMs, optical disks, hard disks, optical fiber media, radio frequency (RF) links, etc. The code segment can be downloaded via a computer network such as the Internet, an intranet, etc.
[0141] It should also be noted that the exemplary embodiments mentioned in the present invention describe some methods or systems based on a series of steps or devices. However, the present invention is not limited to the order of the above steps, that is, the steps can be performed in the order mentioned in the embodiments, or in a different order from the embodiments, or several steps can be performed simultaneously.
[0142] The above is only a specific implementation of the present invention. Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working process of the system, module and unit described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here. It should be understood that the protection scope of the present invention is not limited to this. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed by the present invention, and these modifications or replacements should be covered within the protection scope of the present invention.
Claims
1. A vision-based pet biting behavior recognition method. It is characterized in that The method comprises: Acquire real-time video data in a pet care scene, and decompose the real-time video data into multiple frames of real-time images; Perform target detection and tracking on each frame of real-time image and output a pet target image sequence; Preprocessing the pet target image sequence, removing non-key frame images and pet eating images, and outputting the preprocessed images; The preprocessed images are used to identify pet biting actions, and when pet biting actions are detected, a care reminder is issued.
2. The method for identifying pet biting behavior based on vision according to claim 1, It is characterized in that The target detection and tracking of each frame of real-time image and output of a pet target image sequence include: Input each frame of real-time image into the pre-trained pet detection model to detect the pet target in each frame of real-time image; The preset target tracking algorithm is used to track the pet target in each frame of real-time image, and the pet target image sequence and the pet target frame position sequence are output.
3. The method for identifying pet biting behavior based on vision according to claim 2, It is characterized in that The preprocessing of the pet target image sequence, removing non-key frame images and pet eating images, and outputting the preprocessed images include: Performing filtering processing on the pet target image sequence and outputting a filtered image sequence; According to the pet target frame position sequence, the filtered image sequence is subjected to image deduplication processing, continuously repeated non-key frame images are eliminated, and key frame images are output; Perform pet eating behavior recognition on key frame images, remove images showing pet eating behavior, and output preprocessed images.
4. The method for identifying pet biting behavior based on vision according to claim 3, It is characterized in that The performing image deduplication processing on the filtered image sequence according to the pet target frame position sequence, removing continuously repeated non-key frame images, and outputting key frame images comprises: Grouping the pet target frame position sequences to determine a plurality of pet target frame position sets; According to each pet target frame position in each pet target frame position set, the area of each pet target frame is calculated respectively, and the area of each pet target frame is output; According to the area of each pet target frame, the filtered image corresponding to the pet target frame with the largest area in the pet target frame position set is selected as the key frame image.
5. The method for identifying pet biting behavior based on vision according to claim 3, It is characterized in that The pet eating behavior recognition is performed on the key frame images, the images with the pet eating behavior are eliminated, and the preprocessed images are outputted, including: Inputting the real-time image into a pre-trained target object detection model related to pet eating to obtain a target object detection frame; Enlarging the target object detection frame to determine the pet eating area; Calculate the cross ratio between the pet's eating area and the key frame image. If the cross ratio is greater than a preset ratio threshold, it is considered that the pet in the key frame image stays in the eating area. The length of time the pet stays in the eating area is obtained. When the length of time is greater than a preset length threshold, it is considered that the key frame image contains the pet's eating behavior, and the image containing the pet's eating behavior is removed.
6. The method for identifying pet biting behavior based on vision according to claim 1, It is characterized in that The pet biting action recognition is performed on the pre-processed image, and when the pet biting action is recognized, a care reminder is issued, which includes: Input each preprocessed frame image into the pre-trained pet head detection model, and output a pet head image sequence; Calculate the pet head image sequence to obtain the pet movement information; The pet movement information is input into a pre-trained biting action recognition model, and a pet biting action recognition result is output.
7. The method for identifying pet biting behavior based on vision according to claim 6, It is characterized in that In the step of inputting the pet movement information into the pre-trained biting action recognition model, before outputting the pet biting action recognition result, the method further includes: Obtain training images related to pet biting actions; Performing image deduplication processing on the training image and outputting a sample key frame image; Acquiring sample motion information according to the sample key frame image; The sample motion information is used to train a preset neural network model to obtain the biting action recognition model.
8. A device for identifying pet biting behavior based on vision. It is characterized in that The device comprises: A real-time image acquisition module is used to acquire real-time video data in a pet care scene and decompose the real-time video data into multiple frames of real-time images; The target detection and tracking module is used to detect and track targets in each frame of real-time images and output a sequence of pet target images; A preprocessing module, used for preprocessing the pet target image sequence, removing non-key frame images and pet eating images, and outputting the preprocessed images; The biting action recognition module is used to recognize pet biting actions in preprocessed images, and to issue a care reminder when a pet biting action is detected.
9. An electronic device, It is characterized in that include: At least one processor, at least one memory and computer program instructions stored in the memory, when the computer program instructions are executed by the processor, implement the method according to any one of claims 1 to 7.
10. A storage medium having computer program instructions stored thereon, It is characterized in that When the computer program instructions are executed by a processor, the method according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Pet behavior analysis system based on AI vision
CN117894078A
Pet nursing method and device, electronic equipment and storage medium
CN113420708A
Video-based pig behavior recognition system and method
CN113763429A
