A stray pet detection method and system based on vision
Through visual detection methods, image collection and target detection, it is determined whether stray pets have wearing characteristics and the coordinate center positions of people and pets, which solves the problems of low stray pet detection efficiency and high misjudgment rate in the existing technology, and achieves a more efficient and accurate stray pet identification.
Patent Information
- Application Number
- CN202210089984.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-25
- Publication Date
- 2024-09-06
- Estimated Expiration
- 2042-01-25
Smart Images

Figure CN114494965B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of urban management, and in particular to a method and system for detecting stray pets based on vision. Background Art
[0002] With the acceleration of urbanization, more and more people keep pets in cities. Due to lax supervision and other reasons, stray cats and dogs in cities are also common. Every year, there are hundreds of thousands or even millions of stray pets in the country. They are distributed in the cities where we live, which will have a great impact on our living environment, health and safety, and public order. The biggest problem that stray pets bother us is the health and safety of the public. Stray pets may carry unknown viruses, unattended stray pets may maliciously hurt people, and the bacteria caused by the excrement of stray pets also have a great impact on people living nearby. Therefore, it is an important issue to identify and locate stray pets as soon as possible to facilitate the subsequent placement of stray pets.
[0003] Chinese Patent No. 202011553697.7 provides an animal recognition method, system, device and storage medium based on a neural network, the method comprising: classifying an image into animals through a trained animal classification network to obtain animal information of the image, including image preprocessing; building a deep convolutional neural network, the deep convolutional neural network comprising a feature extraction network and a training network, the feature extraction network comprising a target detection part for feature extraction and an image classification part for classification learning of global information and features; performing model training, using the trained weights to initialize the feature extraction network, extracting features from all images, dividing the extracted features into a training set and a validation set, and training at the network layer; classifying the images, and outputting the classification result with the classification label corresponding to the maximum probability.
[0004] Existing technologies The existing methods of identifying stray pets mainly rely on manpower, by checking whether the pet has an owner or the pet's condition, such as whether the pet is very dirty. The manual method of identifying stray pets is obviously not efficient enough, and cannot be deployed in large quantities in various areas due to labor costs. Therefore, it is urgent to design a visual-based stray pet detection method and system to solve the above problems. Summary of the invention
[0005] The object of the present invention is to provide a method and system for detecting stray pets based on vision, so as to solve the problem of low detection efficiency mentioned in the above background technology.
[0006] The technical solution of the present invention is: a stray pet detection method based on vision, comprising the following steps:
[0007] Image acquisition step: collect and transmit video data to target detector 1;
[0008] Target detection step: Use a target detector to detect pets and people in alternate frames of a pair of video data and obtain the corresponding target images;
[0009] Steps for obtaining image blocks: cropping the pet image to obtain image blocks;
[0010] Secondary target detection step: input the image block into target detector 2 to detect whether the pet has wearing features;
[0011] Stray pet confirmation step: pets without detected wearing features are confirmed as stray pets.
[0012] Furthermore, in the stray pet confirmation step, the image block of the pet without wearing features is detected to see whether there is a person. If no person is detected, it is directly determined to be a stray pet.
[0013] Furthermore, in the stray pet confirmation step, if a person is detected, the centers of the coordinate frames of the pet and the person are obtained and judged. When the center position of the pet coordinate frame appears in the upper half of the person coordinate frame, it means that the person is holding the pet, and it is determined to be a non-stray pet.
[0014] Furthermore, in the step of obtaining the image block, the image block is cropped by doubling the width and height of the pet target.
[0015] Furthermore, in the target detection step, when no pet is detected, the process returns to the image acquisition step and continues to acquire images.
[0016] Furthermore, in the target detection step, the range of inter-frame detection is an interval of 15-120 frames. In the target secondary detection step, the pet wearing features include any one of a pet collar, a pet leash, and pet clothes. When a pet collar, a pet leash, or pet clothes is detected in the image block, it is determined to be a non-stray pet, and the image acquisition step is returned to continue acquiring images.
[0017] Furthermore, in the target detection step, the target detector 1 provides coordinate frame information, target confidence information and category probability.
[0018] A stray pet detection system based on vision, comprising
[0019] Image acquisition module: collects and transmits video data to target detector 1;
[0020] Object detection module: detects pets and people in alternate frames of a pair of video data through an object detector, and obtains the corresponding target image;
[0021] Obtaining image block module: Performing target cropping on the pet image to obtain image blocks;
[0022] Secondary target detection module: input the image block into target detector 2 to detect whether the pet has wearing features;
[0023] Stray pet confirmation module: pets without detected wearing features are confirmed as stray pets.
[0024] Furthermore, in the stray pet confirmation module, the image block of the pet without wearing features is detected to see whether there is a person. If no person is detected, it is directly determined to be a stray pet.
[0025] Furthermore, in the stray pet confirmation module, if a person is detected, the centers of the coordinate frames of the pet and the person are obtained and judged. When the center position of the pet coordinate frame appears in the upper half of the person coordinate frame, it means that the person is holding the pet, and it is determined to be a non-stray pet.
[0026] Furthermore, in the module for obtaining image blocks, the image blocks are cropped by doubling the width and height of the pet object.
[0027] Furthermore, in the target detection module, when no pet is detected, the module returns to the image acquisition module to continue acquiring images.
[0028] Furthermore, in the target detection step, the range of inter-frame detection is an interval of 15-120 frames. In the target secondary detection module, the pet wearing features include any one of a pet collar, a pet leash, and pet clothes. When a pet collar, a pet leash, or pet clothes is detected in the image block, it is determined to be a non-stray pet, and the image acquisition module is returned to continue acquiring images.
[0029] Furthermore, in the target detection module, the coordinate frame information, the confidence information and the category probability of the target are provided by the target detector 1.
[0030] The present invention provides a visual-based stray pet detection method and system by improvement, which has the following improvements and advantages compared with the prior art:
[0031] (1) The present invention detects the pet and then further detects whether there is a collar, rope, or clothing on the pet, thereby determining whether it is a stray pet, thereby improving the efficiency of stray pet detection.
[0032] (2) In order to prevent false alarms caused by missed detection, the present invention combines the positions of the coordinate centers of the person and the pet to determine whether the pet without a collar is held by a person, thereby making the analysis of the pet target more accurate. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] The present invention will be further explained below in conjunction with the accompanying drawings and embodiments:
[0034] Figure 1 is a flow chart of an embodiment of the present invention;
[0035] Figure 2 is a detection flow chart of a target detector 1 according to an embodiment of the present invention;
[0036] Figure 3 It is a detection flow chart of the target detector 2 according to an embodiment of the present invention. DETAILED DESCRIPTION
[0037] The following will be combined with the attached Figures 1 to 3 The present invention is described in detail, and the technical solutions in the embodiments of the present invention are clearly and completely described. Obviously, the described embodiments 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 creative work are within the scope of protection of the present invention.
[0038] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art of the present invention. The terms used herein in the specification of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention. The term "and / or" used herein includes any and all combinations of one or more related listed items.
[0039] A stray pet detection method based on vision in an embodiment of the present invention is as follows: Figure 1 to Figure 3 As shown, the following steps are included: the following steps are included:
[0040] Image acquisition step: collect and transmit video data to target detector 1;
[0041] Target detection step: A target detector detects pets and people in alternate frames of a pair of video data, and obtains corresponding target images. The pets are cats, dogs and other pets. The processing of a pair of images by the target detector includes the following steps:
[0042] Data enhancement sub-step: randomly scale, crop and splice image blocks through Mosaic data enhancement;
[0043] Image feature extraction sub-step: Slice the image block through the Focus structure and convolve it through the convolution kernel to obtain the image features. Then, through the CSP structure, map the image features into two parts, and then merge them across stages and levels, so that the repeated calculation of gradient information is reduced while ensuring accuracy.
[0044] Image feature processing sub-step: The image features are processed through the FPN and PAN network structures, which use the CSP2 structure to fuse the image information;
[0045] Steps for obtaining image blocks: cropping the pet image to obtain image blocks;
[0046] Secondary target detection step: input the image block into target detector 2 to detect whether the pet has wearing features. The principle of target detector 2 is the same as that of target detector 1.
[0047] Stray pet confirmation step: pets without detected wearing features are confirmed as stray pets.
[0048] Furthermore, in the stray pet confirmation step, the image block of the pet without wearing features is detected to see whether there is a person. If no person is detected, it is directly determined to be a stray pet.
[0049] Furthermore, in the stray pet confirmation step, if a person is detected, the coordinate frame centers of the pet and the person are obtained and judged. When the center position of the pet coordinate frame appears in the upper half of the person coordinate frame, it means that the person is holding the pet, and it is determined to be a non-stray pet.
[0050] Furthermore, in the step of obtaining the image block, the image block is cropped by doubling the width and height of the pet target, so that the image block can present more information about the pet collar, pet leash, pets wearing clothes and people, making the information reflected by the image block more comprehensive, thereby preventing false alarms and improving the accuracy of stray pet identification.
[0051] Furthermore, in the target detection step, when no pet is detected, the process returns to the image acquisition step and continues to acquire images.
[0052] Furthermore, in the target detection step, the range of inter-frame detection is an interval of 15-120 frames. In the target secondary detection step, the pet wearing features include any one of a pet collar, a pet leash, and pet clothes. When a pet collar, a pet leash, or pet clothes is detected in the image block, it is determined to be a non-stray pet, and the image acquisition step is returned to continue acquiring images.
[0053] Furthermore, in the target detection step, the target detector 1 provides coordinate frame information, target confidence information and category probability.
[0054] A stray pet detection system based on vision, comprising
[0055] Image acquisition module: collects and transmits video data to target detector 1;
[0056] Target detection module: Target detector detects pets and people in alternate frames of a pair of video data and obtains the corresponding target images. The processing of a pair of images by the target detector includes the following modules:
[0057] Data enhancement submodule: randomly scales, crops, and splices image blocks through Mosaic data enhancement;
[0058] Image feature extraction submodule: The image block is sliced through the Focus structure and convolved through the convolution kernel to obtain the image features. Then, the image features are mapped into two parts through the CSP structure, and then they are merged across stages and levels, which reduces the repeated calculation of gradient information and ensures accuracy.
[0059] Image feature processing submodule: The image features are processed through the FPN and PAN network structures, and the CSP2 structure is used to fuse the image information;
[0060] Obtaining image block module: Performing target cropping on the pet image to obtain image blocks;
[0061] Secondary target detection module: input the image block into target detector 2 to detect whether the pet has wearing features;
[0062] Stray pet confirmation module: pets without detected wearing features are confirmed as stray pets.
[0063] Furthermore, in the stray pet confirmation module, the image block of the pet without wearing features is detected to see whether there is a person. If no person is detected, it is directly determined to be a stray pet.
[0064] Furthermore, in the stray pet confirmation module, if a person is detected, the coordinate frame centers of the pet and the person are obtained and judged. When the center position of the pet coordinate frame appears in the upper half of the person coordinate frame, it means that the person is holding the pet, and it is determined to be a non-stray pet.
[0065] Furthermore, in the module for obtaining image blocks, the image blocks are cropped by doubling the width and height of the pet target, so that the image blocks can present more information about the pet collar, pet leash, pets wearing clothes and people, making the information reflected by the image blocks more comprehensive, thereby preventing false alarms and improving the accuracy of stray pet identification.
[0066] Furthermore, in the target detection module, when no pet is detected, the module returns to the image acquisition module to continue acquiring images.
[0067] Furthermore, in the target detection step, the range of inter-frame detection is an interval of 15-120 frames. In the target secondary detection module, the pet wearing features include any one of a pet collar, a pet leash, and pet clothes. When a pet collar, a pet leash, or pet clothes is detected in the image block, it is determined to be a non-stray pet, and the image acquisition module is returned to continue acquiring images.
[0068] Furthermore, in the target detection module, the target detector 1 provides coordinate frame information, target confidence information and category probability.
[0069] The above description of the disclosed embodiments enables one skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for detecting stray pets based on vision, characterized in that: The following steps are involved: Image acquisition step: collect and transmit video data to target detector 1; Target detection step: Use a target detector to detect pets and people in alternate frames of a pair of video data and obtain the corresponding target images; Steps for obtaining image blocks: cropping the pet image to obtain image blocks; Secondary target detection step: input the image block into target detector 2 to detect whether the pet has wearing features; Stray pet confirmation step: confirming pets without detected wearing features as stray pets; Wherein, in the stray pet confirmation step, the image block of the pet without wearing characteristic is detected to see whether there is a person, and if no person is detected, it is directly determined to be a stray pet; In the stray pet confirmation step, if a person is detected, the coordinate frame centers of the pet and the person are obtained and judged. When the center position of the pet coordinate frame appears in the upper half of the person coordinate frame, it means that the person is holding the pet, and it is determined to be a non-stray pet.
2. The method for detecting stray pets based on vision as claimed in claim 1, characterized in that: In the step of obtaining the image block, the image block is cropped by doubling the width and height of the pet target.
3. The method for detecting stray pets based on vision as claimed in claim 1, characterized in that: In the target detection step, when no pet is detected, the process returns to the image acquisition step and continues to acquire images.
4. The method for detecting stray pets based on vision as claimed in claim 1, characterized in that: In the target detection step, the range of inter-frame detection is an interval of 15-120 frames. In the target secondary detection step, the pet wearing features include any one of a pet collar, a pet leash, and pet clothes. When a pet collar, a pet leash, or pet clothes is detected in the image block, it is determined to be a non-stray pet, and the image acquisition step is returned to continue acquiring images.
5. The method for detecting stray pets based on vision as claimed in claim 1, characterized in that: In the target detection step, the target detector 1 provides coordinate frame information, target confidence information and category probability.
6. A stray pet detection system based on vision, characterized in that: include Image acquisition module: collects and transmits video data to target detector 1; Object detection module: detects pets and people in alternate frames of a pair of video data through an object detector, and obtains the corresponding target image; Obtaining image block module: Performing target cropping on the pet image to obtain image blocks; Secondary target detection module: input the image block into the second target detector to detect whether the pet has wearing features; Stray pet confirmation module: confirms pets without detected wearing features as stray pets; Wherein, in the stray pet confirmation module, the image block of the pet without wearing features is detected to see whether there is a person, and if no person is detected, it is directly determined to be a stray pet; In the stray pet confirmation module, if a person is detected, the coordinate frame centers of the pet and the person are obtained and judged. When the center position of the pet coordinate frame appears in the upper half of the person coordinate frame, it means that the person is holding the pet, and it is determined to be a non-stray pet.
7. The visual-based stray pet detection system of claim 6, wherein: In the module for obtaining image blocks, the image blocks are cropped by doubling the width and height of the pet object.
8. The visual-based stray pet detection system of claim 6, wherein: In the target detection module, when no pet is detected, the module returns to the image acquisition module to continue acquiring images.
9. The visual-based stray pet detection system of claim 6, wherein: In the target detection module, the range of inter-frame detection is an interval of 15-120 frames. In the target secondary detection module, the pet wearing features include any one of a pet collar, a pet leash, and pet clothes. When a pet collar, a pet leash, or pet clothes is detected in the image block, it is determined to be a non-stray pet, and the image acquisition module is returned to continue acquiring images.
10. The visual-based stray pet detection system of claim 6, wherein: In the target detection module, the target detector 1 provides coordinate frame information, target confidence information and category probability.
