A progressive three-level pet detection method

Through the progressive three-level pet detection method, combined with lightweight network and logistic regression model, the error detection problem of pet detection equipment in complex scenarios is solved, and high-precision pet detection and localized deployment are achieved.

CN116597474BActive Publication Date: 2025-09-02ZHEJIANG XINSHENG ELECTRONICS TECH CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202310661931.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-06-06
Publication Date
2025-09-02
Estimated Expiration
2043-06-06

AI Technical Summary

Technical Problem

Existing pet detection equipment is prone to mischecking backgrounds with textures and pets-shaped like backgrounds as pets in complex scenarios, and existing models are difficult to achieve high-precision detection and localized deployment on embedded devices with resource-constrained resources.

Method used

The progressive three-level pet detection method is adopted, combined with a lightweight single-class Yolo detection network, a lightweight repvgg network and a logistic regression model, and through multi-level detection and sample definition methods, the model complexity and detection accuracy are reduced.

Benefits of technology

High-precision pet detection is implemented in complex scenarios, reducing model complexity, enabling localized deployment of detection equipment, and effectively reducing false detection of textures and shapes like pets.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116597474B_ABST
    Figure CN116597474B_ABST
Patent Text Reader

Abstract

The present invention discloses a progressive three-level pet detection method. Through a multi-level pet detection scheme, a pet classification model is introduced to assist the pet detection model, thereby reducing the scheme's requirements on the complexity of the detection model and allowing the design of a detection network with a smaller number of parameters. By defining troubled samples, the requirements on the complexity of the classification network can be reduced. Combining pet detection scores and classification scores, a feature encoding method is used to upgrade the originally two-dimensional difficult-to-distinguish troubled samples to a high-dimensional, easy-to-distinguish space. In the high-dimensional space, only simple logistic regression is required to distinguish the troubled samples. This multi-level scheme solves the problem that a simple detector is too complex to be deployed locally. At the same time, the sample definition method is used to improve the accuracy of pet detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical fields of image processing, convolutional neural networks, feature coding and logistic regression, and in particular to a progressive three-stage pet detection method. Background Art

[0002] With the advancement of technology, the acceleration of urbanization, and the impact of multiple factors such as an aging society, the number of young and elderly people living alone in cities is increasing. Due to the fast-paced world, intense work pressure, and feelings of loneliness and helplessness, many people choose to keep one or more pets to alleviate stress and other psychological issues. Individuals living alone cannot fully care for their pets' needs, but they also want to be aware of their pets' well-being and monitor their condition in real time during work and rest periods. Furthermore, there are a large number of stray pets and pets kept by their owners in communities that require dedicated monitoring. This necessitates the use of smart pet devices that can identify these pets in real time.

[0003] Existing pet monitoring devices can perform pet monitoring; however, they are prone to false detection of objects with backgrounds that resemble the appearance and texture of pets. Deploying convolutional neural network-based object detection on resource-constrained embedded devices requires streamlining model parameters and reducing network input resolution. These approaches significantly impact detection accuracy, hindering effective detection and subsequent video encoding and streaming.

[0004] Chinese patent CN115131823A discloses "A Method for Identifying Household Pets Based on a Residual Network Deconvolution SSD Algorithm." Based on the residual network deconvolution SSD algorithm, this method has a complex model that is not suitable for local deployment. Furthermore, simple pet detectors can easily misidentify pet-like background objects in complex scenes. Chinese patent CN115049966A discloses "A Lightweight YOLO Pet Identification Method Based on GhostNet." This GhostNet-based lightweight YOLO pet identification method has a simple model that meets the requirements of local deployment. However, in complex scenes, it can still misidentify pet-like background objects in complex scenes. Chinese patent CN115131644A discloses "A Method for Eliminating False Positives in Pet Detection." This invention aims to address the problem of misidentifying human heads as pets by adding a human head category to filter out this category, thereby improving accuracy. However, this method's detection model is too complex to be suitable for local deployment. Furthermore, in complex scenes, it can misidentify not only human heads but also background objects with textures and shapes resembling pets. Summary of the Invention

[0005] The present invention overcomes the shortcomings of the existing technology and provides a progressive three-level pet detection method, which enables localized deployment of pet detection in complex outdoor and indoor scenes, while solving the problem of false detection of texture and shape-based pet backgrounds.

[0006] In order to solve the above technical problems, the technical solutions of the present invention are as follows:

[0007] A progressive three-stage pet detection method comprises the following steps:

[0008] Step S1: Select a detection network and use the labeled pet training database to train the network to obtain a locally deployed pet detector; use the pet detector to detect the image to be detected and obtain the detection bounding box and detection score sequence [(bbox1,s d1 ),…,(bbox i ,s di ),...,(bbox n ,s dn )], and intercept the image to be detected to obtain the sub-image sequence to be identified [image1,...,image i ,…,image n ]; the bbox i , s di and image i represents the position of the i-th detection box, the detection score, and the sub-image deducted from the image to be detected; and n represents the total number of pet targets detected by Image;

[0009] Step S2: Use the trained pet detection model to traverse the entire pet training database and intercept the subgraphs respectively; d and the preset detection threshold Thr d Compare the bounding box bbox to obtain the pet classification training library;

[0010] Step S3: Use the lightweight network and the pet classification training library obtained in step S2 to train a binary classification network to obtain a locally deployed pet classifier; use the pet classifier to classify the sub-image sequence [image1,...,image i ,…,image n ] to identify and obtain the subgraph classification score sequence [s c1 ,..,s ci ,...,s cn ]; the s ci represents the i-th classification score;

[0011] Step S4: Setting the pet detector threshold Thr d1 and Thr d2, set the pet classifier threshold Thr c1 and Thr c2 , by detecting the score s di Comparison with pet detector threshold, classification score s ci Compare with the pet classifier threshold to finally determine whether the detected border is a pet or background.

[0012] Furthermore, in step S2, the detection score s d and the preset detection threshold Thr d The comparison of the border bbox specifically includes the following steps: the detection score s d Greater than the preset detection threshold Thr d The bounding box bbox of the image is retrieved, the corresponding image annotation bounding box GTs is queried, and the intersection-over-union (IOU) is calculated. When the intersection-over-union (IOU) (bbox, GTs) ≥ 0.5, the intercepted sub-image is marked as a pet, otherwise it is marked as background.

[0013] Furthermore, in step S4, the detection score s di Comparison with pet detector threshold, classification score s ci The comparison with the pet classifier threshold specifically includes the following steps: 1. The detection score s di ≤Thr d1 The detection border of s is identified as the background; di ≥Thr d2 The detection border is identified as a pet; for the detection score Thr d1 di <Thr d2 The detection box, the classification score s ci ≤Thr c1 Sub-image image i Identified as background, s ci ≥Thr c2 Sub-image image i Identified as a pet; for detection score s di Meet Thr d1 di <Thr d2 The detection box and the corresponding classification score s ci Meet Thr c1 ci <Thr c2 Sub-image image i , which is defined as the troubled sample image hi .

[0014] Furthermore, the sample image will be troubled hi Use two-dimensional [s ci , s​​​di ] score space representation; for troubled sample image hi Quantify each dimension; create a troubled sample training database; use a logistic regression model to train a classifier to distinguish troubled samples, and use the classifier and classifier threshold to distinguish whether the sample to be identified is a pet or background.

[0015] Furthermore, for the troubled sample image hi Quantifying each dimension of includes the following steps:

[0016] to s ci and s di Perform integerization, integerize s ci and s di Perform a single hot encoding operation to obtain the Nc-dimensional classification score feature feature ci and Nd-dimensional detection score feature feature di ; Use sequential concatenation Concat operation to generate the final description image hi Nc+Nd feature hi ; Both Nc and Nd represent quantized intensity.

[0017] Furthermore, in step S1, the detection network is a lightweight single-class Yolo detection network, which is a single-class detection model modified based on yolov5n, and its input size is fixed to S d ×S d .

[0018] Furthermore, in step S3, the lightweight network is a lightweight repvgg network, which is stacked based on network reparameterization modules, and its input size is fixed to S c ×S c .

[0019] The beneficial effects of the present invention are as follows: through a multi-stage pet detection scheme, the pet classification model is introduced to assist the pet detection model, reducing the scheme's requirements for detection model complexity and enabling the design of a detection network with smaller parameters; by defining troublesome samples, the requirements for classification network complexity are reduced; and by combining pet detection scores with classification scores and using feature encoding, troublesome samples, originally in a two-dimensional, difficult-to-separate space, are upgraded to a high-dimensional, easily separable space, where simple logistic regression is required to distinguish troublesome samples. This multi-stage scheme solves the problem that simple detectors are too complex to be deployed locally, while also improving the accuracy of pet detection through sample definition. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] Figure 1 This is a schematic diagram of the pet testing process;

[0021] Figure 2 Schematic diagram of extracting scores from images for multi-level pet detection;

[0022] Figure 3 Schematic diagram of the distribution of troubled samples and general samples in the two-dimensional score space;

[0023] Figure 4 Schematic diagram of the troubled sample being promoted from two dimensions to high dimensions; DETAILED DESCRIPTION

[0024] The specific embodiments of the present invention are described in detail below with reference to the accompanying drawings.

[0025] A progressive three-stage pet detection method comprises the following steps: using the detector to obtain detection bounding boxes and score information of a to-be-detected image; taking a screenshot of the to-be-detected image using the detection bounding boxes obtained by the detector to obtain a sub-image to be identified, and extracting a classification score for the sub-image to be identified using a pet classifier; then, determining whether a sample is a troubled sample based on a preset pet detection score and a corresponding classification score threshold; then, upgrading the score space of the troubled sample and restating the troubled sample using an easily classified high-dimensional score space; and finally, using a classifier trained with a logistic regression model to distinguish whether the troubled sample is a pet.

[0026] The specific steps are as follows: Figure 1 As shown, a progressive three-level pet detection method,

[0027] Step S1: Select a detection network. For example, in this implementation, a lightweight single-class Yolo detection network is selected. The lightweight single-class Yolo detection network is a single-class detection model modified based on yolov5n, and its input size is fixed to S. d ×S d ;

[0028] like Figure 2 As shown, the network is trained using the labeled pet training database to obtain a locally deployed pet detector; the pet detector is used to detect the image to be detected, and the detection bounding box and detection score sequence [(bbox1,s d1 ),…,(bbox i ,s di ),...,(bbox n ,s dn )], and intercept the image to be detected Image, and obtain the sub-image sequence to be identified [image1,...,image i ,…,image n ];

[0029] The bboxi , s di and image i represents the position of the i-th detection box, the detection score, and the sub-image deducted from the image to be detected; and n represents the total number of pet targets detected in the image to be detected;

[0030] For example Figure 2 In the example, [(bbox1,s d1 ), (bbox2,s d2 ), (bbox3,s d3 ), (bbox4,s d4 )].

[0031] Step S2: Use the trained pet detection model to traverse the entire pet training database image by image, and intercept the sub-images respectively; calculate the detection score s d Greater than the preset detection threshold Thr d The bounding box bbox of the corresponding image is queried, and the intersection-over-union ratio (IOU) is calculated. When the intersection-over-union ratio (IOU) (bbox, GTs) is ≥ 0.5, the intercepted sub-image image is marked as a pet, otherwise it is marked as background, thereby obtaining a pet classification training library; the specific coding representation is

[0032] image=Crop(Image,bbox);IOU(bbox,GTs)≥0.5, s d ≥Thr d

[0033] Step S3: Use a lightweight network, for example, in this embodiment, use a lightweight repvgg network and the pet classification training library obtained in step S2 to train a binary classification network to obtain a locally deployed pet classifier; use the pet classifier to classify the sub-image sequence [image1,...,image i ,…,image n ] to identify and obtain the subgraph classification score sequence [s c1 ,..,s ci ,...,s cn ]; the s ci represents the i-th classification score;

[0034] For example Figure 2 In the 4 subgraph classification score sequences [s c1 , s c2 , s c3 , s c4 ].

[0035] The lightweight repvgg two-classification network is based on the stacking of network reparameterization modules. It is designed by reducing the number of stacking times and the number of channels in each stage. Its input size is fixed to S c ×S c ; The specific technical method for reducing the number of stacking times and the number of channels in each stage can adopt existing technologies.

[0036] Step S4: Setting the pet detector threshold Thr d1 and Thr d2 , the detection score s di ≤Thr d1 The detection border is identified as the background, such as Figure 3 The black circular solid points in the lower edge area of ​​the sample distribution diagram are shown;

[0037] Will s di ≥Thr d2 The detection bounding box is identified as a pet, such as Figure 3 The black circular solid points in the upper edge area of ​​the sample distribution diagram are shown

[0038] Set the pet classifier threshold Thr c1 and Thr c2 ; For the detection score Thr d1 di <Thr d2 The detection box, the classification score s ci ≤Thr c1 Sub-image image i Identified as background, such as Figure 3 The black circle solid point in the center of the left edge of the sample distribution diagram is shown; ci ≥Thr c2 Sub-image image i Identified as a pet, such as Figure 3 It is indicated by the black circular solid point located at the right edge and center of the sample distribution diagram;

[0039] For the detection score s di Meet Thr d1 di <Thr d2 The detection box and the corresponding classification score s ci Meet Thr c1 ci <Thr c2 Sub-image image i , which is defined as the troubled sample image hi ,like Figure 3 The black entity "+" in the sub-axis is shown and will interfere with the sample image​​​hi , using two-dimensional [s ci , s di ] score space representation; the coding of specific trouble samples is:

[0040] image hi ≡image i ;Thr d1 di <Thr d2 ,Thr c1 ci <Thr c2 .

[0041] like Figure 4 As shown, for the troubled sample image hi Quantify each dimension of

[0042] The specific quantitative implementation method is:

[0043] to s ci and s di To integerize, s ci =floor(Nc*s ci ), s di =floor(Nd*s di ); Nc and Nd both represent quantization strength, which are positive integer values. The larger the value, the higher the score after quantization. floor() represents rounding down. ci and s di Perform a single hot encoding operation to obtain the Nc-dimensional classification score feature feature ci and Nd-dimensional detection score feature feature di ; Use sequential concatenation Concat operation to generate the final description image hi Nc+Nd feature hi By using this strategy to increase the dimension of the score space, the discrimination of the troubled samples is enhanced, and the code for the feature sequence splicing is:

[0044] feature hi ≡Concat(feature ci ,feature di )

[0045] Based on step S4, a troubled sample training database is created; a classifier for distinguishing troubled samples is trained using a logistic regression model, and the classifier and the classifier threshold Thr are used. c To distinguish whether the sample to be identified is a pet or background, the sample to be identified is coded as follows:

[0046] ​​

[0047] Among them, W and b are the learning weights of logistic regression, obtained by training. hi )≥Thr c The disturbing sample is judged as a pet, otherwise it is judged as background.

[0048] This method is used for high-precision pet target detection and can be extended to all target detection processes.

[0049] The present invention effectively reduces the dependence of pet detection on a simple detection model through a three-level detection scheme that combines a pet detection model, a classification model, and a logistic regression model, so that lightweight detection and classification models can still achieve high precision and low false detection effects; a scheme for creating a classification training library directly inherits the detection results of the detector, and uses the detector to extract the detection result border bbox and score s of each image in the training library; then sub-images are deducted from each image, and they are classified as pets or backgrounds based on the intersection-union ratio; finally, a classification sample database is generated to train a pet classifier; a method for defining troubled samples and using quantization and OneHot coding sequence operations to increase the dimensionality of the troubled sample score space, thereby improving the discrimination of troubled samples in high-dimensional space; so that the detection scheme can well detect pets in complex environments and reduce false detections of texture and shape-related pets.

[0050] The above is only a preferred embodiment of the present invention. It should be pointed out that ordinary technicians in this technical field can make several improvements and modifications without departing from the concept of the present invention. These improvements and modifications should also be considered within the scope of protection of the present invention.

Claims

1. A progressive three-stage pet detection method, characterized in that: The steps include: Step S1: Select a detection network and use the labeled pet training database to train the network to obtain a locally deployed pet detector; use the pet detector to detect the image to be detected and obtain the detection bounding box and detection score sequence [(bbox1,s d1 ),…,(bbox i ,s di ),...,(bbox n ,s dn )], and intercept the image to be detected to obtain the sub-image sequence to be identified [image1,...,image i ,…,image n ]; The bbox i , s di and image i represents the position of the i-th detection box, the detection score, and the sub-image deducted from the image to be detected; and n represents the total number of pet targets detected by Image; Step S2: Use the trained pet detection model to traverse the entire pet training database and intercept the subgraphs respectively; d and the preset detection threshold Thr d Compare the bounding box bbox to obtain the pet classification training library; Step S3: Use the lightweight network and the pet classification training library obtained in step S2 to train a binary classification network to obtain a locally deployed pet classifier; use the pet classifier to classify the sub-image sequence [image1,...,image i ,…,image n ] to identify and obtain the subgraph classification score sequence [s c1 ,..,s ci, ...,s cn ]; the s ci represents the i-th classification score; Step S4: Setting the pet detector threshold Thr d1 and Thr d2 , set the pet classifier threshold Thr c1 and Thr c2, By detection score s di Comparison with pet detector threshold, classification score s ci Compare with the pet classifier threshold to finally determine whether the detected border is a pet or background.

2. A progressive three-stage pet detection method according to claim 1, characterized in that: In step S2, the detection score s d and the preset detection threshold Thr d The comparison of the border bbox specifically includes the following steps: the detection score s d Greater than the preset detection threshold Thr d The bounding box bbox of the image is retrieved, the corresponding image annotation bounding box GTs is queried, and the intersection-over-union (IOU) is calculated. When the intersection-over-union (IOU) (bbox, GTs) ≥ 0.5, the intercepted sub-image is marked as a pet, otherwise it is marked as background.

3. A progressive three-stage pet detection method according to claim 2, characterized in that: In step S4, the detection score s di Comparison with pet detector threshold, classification score s ci The comparison with the pet classifier threshold specifically includes the following steps: The detection score s di ≤Thr d1 The detection border of s is identified as the background; di ≥Thr d2 The detection border is identified as a pet; for the detection score Thr d1 di <Thr d2 The detection box, the classification score s ci ≤Thr c1 Sub-image image i Identified as background, s ci ≥Thr c2 Sub-image image i Identified as a pet;​ For the detection score s di Meet Thr d1 di <Thr d2 The detection box and the corresponding classification score s ci Meet Thr c1 ci <Thr c2 Sub-image image i , which is defined as the troubled sample image hi。 ​​ 4. A progressive three-stage pet detection method according to claim 3, characterized in that: will trouble the sample image hi Use two-dimensional [s ci , s di ] score space representation; For troubled sample image hi Quantify each dimension of Create a troubled sample training database; use a logistic regression model to train a classifier that can distinguish troubled samples, and use the classifier and the classifier threshold to distinguish whether the sample to be identified is a pet or background.

5. A progressive three-stage pet detection method according to claim 4, characterized in that: For troubled sample image hi Quantifying each dimension of includes the following steps: to s ci and s di Perform integerization, integerize s ci and s di Perform a single hot encoding operation to obtain the Nc-dimensional classification score feature feature ci and Nd-dimensional detection score feature feature di ; Use sequential concatenation Concat operation to generate the final description image hi Nc+Nd feature hi ; Both Nc and Nd represent quantized intensity.

6. A progressive three-stage pet detection method according to claim 1, characterized in that: In step S1, the detection network is a lightweight single-class Yolo detection network, which is a single-class detection model modified based on yolov5n, and its input size is fixed to S d ×S d .

7. A progressive three-stage pet detection method according to claim 1, characterized in that: In step S3, the lightweight network is a lightweight repvgg network, which is based on the stacking of network reparameterization modules, and its input size is fixed to S c ×S c .

Citation Information

Patent Citations

  • Lightweight YOLO pet identification method based on GhostNet

    CN115049966A

  • Method for eliminating false alarm in pet detection

    CN115131644A

  • Household pet identification method based on residual network deconvolution SSD algorithm

    CN115131823A

  • Vehicle detection model training method and vehicle detection method

    CN115965831A

  • Improved YOLOv6 target detection method introducing dynamic position loss

    CN116012686A