A method and system for pet identification based on dynamic weighted comparison
By using a dynamic weighted comparison method, pet image frames are split into non-overlapping image blocks. Image blocks that represent pet characteristics are selected for feature extraction, and the sorting of identity comparison templates is optimized. This solves the problems of insufficient feature extraction and low recognition accuracy in existing pet identity recognition, and achieves efficient and accurate pet identity recognition.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SHENZHEN CHONGZHILING TECHNOLOGY CO LTD
- Filing Date
- 2026-04-01
- Publication Date
- 2026-07-03
AI Technical Summary
Existing pet identification methods suffer from insufficient targeted and effective feature extraction, low identification efficiency, and low identification accuracy. In particular, it is difficult to achieve accurate identification and continuous tracking of multiple pets at all times in complex life scenarios.
A dynamic weighted comparison method is adopted. By splitting pet image frames into non-overlapping image blocks, calculating the pet feature selection representation value, filtering out image blocks that represent pet features for feature extraction, and constructing a time sequence of identity comparison templates. The template sorting is optimized by combining historical similarity index and usage frequency, and feature point matching and alignment and dynamic weighted comparison are performed to confirm the pet's identity.
It improves the accuracy and effectiveness of feature extraction, shortens the recognition time, increases recognition efficiency, reduces the false positive rate and false negative rate, and achieves accurate identification of pet identities.
Smart Images

Figure CN122336801A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of pet identification technology, specifically to a method and system for pet identification based on dynamic weighted comparison. Background Technology
[0002] With the expansion of multi-pet ownership in households and the widespread adoption of IoT devices such as smart pet access control, automatic feeders, and home surveillance cameras, accurate concurrent identification and continuous tracking of multiple pets in complex living scenarios has become an urgent need.
[0003] Current pet identification methods mostly rely on comparing and identifying pets based on visual features such as facial features, body shape, and markings. However, in practical applications, these methods suffer from several technical shortcomings: First, existing methods extract features from pet image frames indiscriminately, resulting in feature redundancy and excessive interference, leading to insufficient targeting and effectiveness of pet image feature extraction. Second, existing identification databases use fixed sorting of comparison templates without dynamic scheduling based on usage effects, resulting in poor timeliness and matching of comparison template selection, thus leading to low recognition efficiency. Third, existing feature comparisons do not perform precise feature point matching and alignment, and use static comparison methods without dynamic weighting based on feature point importance. This can lead to inaccurate feature matching due to factors such as pet posture and shooting angle, resulting in low recognition accuracy.
[0004] Therefore, there is an urgent need for a method and system for pet identification based on dynamic weighted comparison to solve the above problems. Summary of the Invention
[0005] The purpose of this invention is to provide a method and system for pet identification based on dynamic weighted comparison: to solve the technical problems of insufficient targeting and effectiveness of pet image feature extraction, low identification efficiency and low identification accuracy in existing pet identification technologies.
[0006] The objective of this invention can be achieved through the following technical solutions:
[0007] On the one hand, a method for pet identification based on dynamic weighted comparison, the method includes:
[0008] The system acquires image frames of the pet to be identified, splits the image frames into multiple non-overlapping image blocks, calculates the pet feature selection representation value for each image block, and determines whether the image block is the image block representing the pet feature in the image frame based on the pet feature selection representation value of each image block.
[0009] Feature extraction is performed on image patches representing pet characteristics to obtain the pet features to be identified. An identity database access request is generated based on the pet features to be identified. The identity database access request is responded to and the latest sequence corresponding to the identity comparison template of the pet to be identified is obtained from the identity database. The identity comparison template at the top of the latest sequence is recorded as the identity comparison template of the pet to be identified, and identity comparison features are extracted based on the identity comparison template.
[0010] Feature point matching and alignment processing is performed on the identity comparison features and the features of the pet to be identified. Then, a weighted comparison processing is performed on the identity comparison features and the features of the pet to be identified after feature point matching and alignment processing to obtain a similarity index. The identity of the pet to be identified is confirmed based on the similarity index, and the new sequence is updated based on the similarity index.
[0011] Furthermore, the calculation of the pet feature selection representation value for each image patch specifically includes the following process:
[0012] Obtain the pixel set corresponding to each image patch, and calculate the pixel values of the pixel set and the comparison pixel set. The proximity rate P;
[0013] The pixels in the pixel set are numbered. A rectangular coordinate system is established with the pixel number as the X-axis and the proximity rate corresponding to the pixel as the Y-axis. A proximity rate characterization curve is generated by plotting points. The lower peak and lower valley values of the proximity rate characterization curve are counted. The lower peak value is the maximum proximity rate, and the lower valley value is the minimum proximity rate. The peak-valley difference between the lower peak and lower valley values is calculated. Perpendicular lines are drawn from the two endpoints of the proximity rate characterization curve to the X-axis to obtain two perpendicular line segments. A graph is formed by the proximity rate characterization curve, the two perpendicular line segments, and the X-axis. The area of the graph is calculated, and the product of the area of the graph and the peak-valley difference after unifying the dimensions is recorded as the pet feature selection characterization value.
[0014] Furthermore, determining whether an image patch is a pet-characteristic image patch in an image frame by selecting a representation value based on the pet features of each image patch specifically includes the following process:
[0015] Load the pet feature selection representation value threshold, and determine whether the pet feature selection representation value of each image block exceeds the pet feature selection representation value threshold. If it does, then the image block is determined to be an image block representing pet features in the image frame. If not, then the image block is determined not to be an image block representing pet features in the image frame.
[0016] Furthermore, obtaining the up-to-date sequence corresponding to the identity comparison template of the pet to be identified specifically includes the following process:
[0017] Obtain the latest sequence value of each identity comparison template, sort all identity comparison templates in descending order of their latest sequence values, and generate a sequence after sorting. This sequence is the latest sequence of the identity comparison template.
[0018] Furthermore, calculating the latest sequence value of the identity comparison template specifically includes the following process:
[0019] The historical similarity index and historical usage frequency of each identity comparison template are obtained through a search engine. The historical similarity index SX and historical usage frequency SY of each identity comparison template are then substituted into the calculation formula to obtain the current sequence value of the identity comparison template. The calculation formula is as follows: Where XL is the latest sequence value, , These are the weighting coefficients for the historical similarity index and the historical usage frequency, respectively.
[0020] Furthermore, the feature point matching and alignment process for identity comparison features and pet features to be identified specifically includes the following steps:
[0021] Identity comparison features and characteristics of the pet to be identified Dimensionality is unified through 1×1 convolution operation;
[0022] based on and Generate graph structure ,in, For feature point node set, feature point node set , The number of feature point nodes, For the set of associated edges between feature points, The number of associated edges is ;
[0023] compute nodes Importance weights of the d-th eigenvalues : ;
[0024] in, For nodes eigenvalues, Represents a node Centrality;
[0025] based on compute nodes Matching probability : ;
[0026] in, , for The maximum value, for The average value, To limit the probability;
[0027] By matching probability Nodes with a matching probability below a preset threshold are deleted, resulting in identity comparison features after feature point matching and alignment. and characteristics of the pet to be identified .
[0028] Furthermore, the similarity index is obtained by weighted comparison of the identity comparison features after feature point matching and alignment with the features of the pet to be identified, specifically including the following process:
[0029] ;
[0030] in, The similarity index, After matching and aligning pet feature points, the first The weight coefficients corresponding to the 3D feature vectors This indicates identity comparison features after feature point matching and alignment. The Each feature vector value This indicates the pet features to be identified after feature point matching and alignment. The Each feature vector value.
[0031] Furthermore, confirming the identity of the pet to be identified based on the similarity index specifically includes the following process:
[0032] Load the similarity index threshold, and determine whether the similarity index exceeds the similarity index threshold. If it does, determine that the pet identity corresponding to the image frame of the pet to be identified is consistent with the pet identity corresponding to the identity comparison template. If not, determine that the pet identity corresponding to the image frame of the pet to be identified is inconsistent with the pet identity corresponding to the identity comparison template.
[0033] Furthermore, updating the new sequence based on the similarity index specifically includes the following process: replacing the historical similarity index in the identity database with the similarity index.
[0034] On the other hand, a pet identification system based on dynamic weighted comparison includes:
[0035] The image frame processing module is used to acquire image frames of the pet to be identified, split the image frames into multiple non-overlapping image blocks, calculate the pet feature selection representation value of each image block, and determine whether the image block is the image block representing the pet feature in the image frame based on the pet feature selection representation value of each image block. The feature processing module is used to extract features from the image blocks representing the pet feature to obtain the pet feature to be identified, generate an identity database access request based on the pet feature to be identified, respond to the identity database access request, and obtain the current sequence corresponding to the identity comparison template of the pet to be identified from the identity database. The identity comparison template at the top of the current sequence is recorded as the identity comparison template of the pet to be identified, and identity comparison features are extracted based on the identity comparison template. The identity recognition module is used to perform feature point matching and alignment processing on the identity comparison features and the pet feature to be identified, and perform weighted comparison processing on the identity comparison features and the pet feature to be identified after feature point matching and alignment processing to obtain a similarity index. The identity of the pet to be identified is confirmed based on the similarity index, and the current sequence is updated based on the similarity index.
[0036] Compared to existing solutions, the beneficial effects achieved by this invention are:
[0037] Improve the targeting of feature extraction and reduce redundant interference: By splitting pet image frames into non-overlapping image blocks, calculating the pet feature selection value and filtering out the image blocks that represent pet features, feature extraction is performed only on valid image blocks, eliminating interference information from background and irrelevant areas, effectively reducing feature redundancy, improving the accuracy and effectiveness of pet feature extraction, and laying the foundation for subsequent accurate recognition.
[0038] To improve recognition efficiency, dynamic scheduling of comparison templates is implemented: By constructing a timely sequence of identity comparison templates, the timely sequence value is calculated by combining historical similarity index and historical usage frequency, and the templates are sorted. Templates with strong timeliness and good matching effect are selected for comparison first, avoiding the retrieval and comparison of invalid templates, which significantly shortens the time consumption of identity recognition and improves the overall recognition efficiency. At the same time, the timely sequence is updated based on the similarity index, realizing dynamic optimization of template sorting and ensuring the adaptability of the identity database.
[0039] To improve the accuracy of feature matching and reduce recognition errors: a graph structure is constructed and the importance weights and matching probabilities of feature point nodes are calculated to achieve accurate matching and alignment of feature points and eliminate invalid matching edges; then, a similarity index is calculated based on the dynamic weighted comparison of feature point importance, making the feature comparison more closely match the core features of the pet, effectively offsetting the influence of factors such as changes in pet posture, shooting angle deviation, and image blur, greatly improving the accuracy of feature matching and reducing the false positive and false negative rates of identity recognition. Attached Figure Description
[0040] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this invention. For those skilled in the art, other drawings can be obtained based on these drawings.
[0041] Figure 1 This is a flowchart illustrating the process of a pet identification method based on dynamic weighted comparison according to an embodiment of the present invention.
[0042] Figure 2 This is a flowchart illustrating another method for pet identification based on dynamic weighted comparison according to an embodiment of the present invention.
[0043] Figure 3 This is a system block diagram of a pet identification system based on dynamic weighted comparison, according to an embodiment of the present invention. Detailed Implementation
[0044] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0045] Furthermore, the described features, structures, or characteristics can be combined in any suitable manner in one or more exemplary embodiments. Numerous specific details are provided in the following description to give a full understanding of exemplary embodiments of this disclosure. However, those skilled in the art will recognize that the technical solutions of this disclosure can be practiced with one or more of the specific details omitted, or other methods, components, steps, etc., can be employed. In other instances, well-known structures, methods, implementations, or operations are not shown or described in detail to avoid obscuring various aspects of this disclosure.
[0046] This embodiment provides a method for pet identification based on dynamic weighted comparison. Figure 1 This is a flowchart illustrating a method for pet identification based on dynamic weighted comparison according to an embodiment of the present invention. Figure 1 As shown, the method includes the following steps:
[0047] Step S101: Acquire image frames of the pet to be identified, split the image frames into multiple non-overlapping image blocks, calculate the pet feature selection representation value of each image block, and determine whether the image block is the image block representing the pet features in the image frame based on the pet feature selection representation value of each image block.
[0048] It is worth noting that the image splitting rules can be implemented as follows: Based on the common resolution of the pet image frame (such as 480P, 720P, 1080P), preset the size of the rectangular pixel blocks of equal size (such as 16×16, 32×32, 64×64 pixels), and with the upper left corner of the image frame as the origin of the coordinate system, divide the image frame into grids row by row and column by column along the horizontal X-axis and vertical Y-axis, splitting the entire image frame into multiple rectangular image blocks of the same size, with no overlapping edges and seamless stitching; if the pixel length or width of the image frame cannot be divided evenly by the preset block size, the edges of the image frame are padded with zeros or cropped to ensure that the edge blocks are the same size as other blocks.
[0049] Step S102: Extract features from the image patch representing pet characteristics to obtain the features of the pet to be identified, and generate an identity database access request based on the features of the pet to be identified;
[0050] Step S103: Respond to the identity database access request and obtain the latest sequence corresponding to the identity comparison template of the pet to be identified from the identity database. Record the identity comparison template at the top of the latest sequence as the identity comparison template of the pet to be identified, and extract identity comparison features based on the identity comparison template.
[0051] Step S104: Perform feature point matching and alignment processing on the identity comparison features and the pet features to be identified, and perform weighted comparison processing on the identity comparison features and the pet features to be identified after feature point matching and alignment processing to obtain the similarity index;
[0052] Step S105: Confirm the identity of the pet to be identified based on the similarity index, and update the new sequence based on the similarity index.
[0053] In summary, this invention splits pet image frames into non-overlapping image blocks, calculates pet feature selection values, and filters out image blocks that represent pet features. It extracts features only from valid image blocks, eliminating background and irrelevant interference, effectively reducing feature redundancy and improving the accuracy and effectiveness of pet feature extraction. By constructing a timely sequence of identity comparison templates, combining historical similarity indices and historical usage frequencies to calculate the timely sequence value and sort the templates, it prioritizes templates with strong timeliness and good matching performance for comparison, avoiding the retrieval and comparison of invalid templates, significantly shortening the time required for identity recognition, and improving overall recognition efficiency. It constructs a graph structure and calculates the importance weights and matching probabilities of feature point nodes to achieve accurate matching and alignment of feature points, eliminating invalid matching edges. Furthermore, it dynamically weights and calculates the similarity index based on the importance of feature points, making the feature comparison more closely match the core features of the pet, effectively offsetting the influence of pet posture changes, shooting angle deviations, image blur, and other factors, significantly improving the accuracy of feature matching and reducing the false positive and false negative rates of identity recognition.
[0054] In some embodiments, Figure 2 This is a flowchart illustrating another method for pet identification based on dynamic weighted comparison according to an embodiment of the present invention, as shown below. Figure 2 As shown, the specific process for calculating the pet feature selection representation value for each image patch includes the following steps:
[0055] Step S201: Obtain the pixel set corresponding to each image block, and calculate the proximity rate between the pixel set and the comparison pixel set at each pixel point;
[0056] Specifically, the pixel set corresponding to each image patch is obtained, and the pixel set and the comparison pixel set are calculated at the pixel level. Proximity P:
[0057] ;
[0058] in, Represents the set of pixels corresponding to each image patch. Location coordinates, Represents the set of pixels corresponding to the center vector. Location coordinates express and European distance, The value is 2.72. It is a learnable parameter for small image patches (8×8 or 16×16 pixels). Option 1, to improve the proximity rate It is more sensitive to subtle differences in coordinates, accurately distinguishing pet feature pixels from background pixels within a block. This is particularly effective for medium-sized image blocks (32×32 or 64×64 pixels). Option 3 balances sensitivity and tolerance to coordinate differences, adapting to the distribution patterns of most pet feature pixels. This is particularly beneficial for large image blocks (128×128 and above). Option 5 ensures the effectiveness of the proximity calculation of feature pixels.
[0059] The process of obtaining the comparison pixel set is as follows: Standard feature images of pets of various breeds, sizes, and coat colors are collected, covering core feature areas such as the pet's face, ears, and torso, to construct a pet feature benchmark image sample library. All benchmark images use the same pixel resolution, color mode, and image format as the pet image frames to be identified, ensuring consistency in pixel analysis. For each pet benchmark image in the sample library, according to the above image block segmentation rules, it is split into multiple non-overlapping image blocks. Using the pet feature selection representation value calculation and judgment method, image blocks representing the core features of the pet in each benchmark image are selected as benchmark feature image blocks. Coordinate statistics and mean calculation are performed on the pixel set of all benchmark feature image blocks, using pixel position coordinates... Using the dimension as the mean of the coordinates of each pixel position, a pet feature center pixel vector is generated. This vector serves as the pixel position benchmark corresponding to the core pet feature. Taking the pixel position corresponding to the pet feature center pixel vector as the core, the position coordinates and pixel attribute information of all pixels covered by this center vector are extracted and integrated into a standardized pixel set, which is the comparison pixel set.
[0060] Step S202: Number the pixels in the pixel set, establish a rectangular coordinate system with the pixel number as the X-axis and the proximity rate corresponding to the pixel as the Y-axis, generate a proximity rate characterization curve by plotting points, and count the lower peak and lower valley values of the proximity rate characterization curve.
[0061] Among them, the lower peak value is the maximum value of the proximity rate, and the lower trough value is the minimum value of the proximity rate. The peak-to-trough difference between the lower peak value and the lower trough value is calculated.
[0062] Step S203: Draw perpendicular lines from the two endpoints of the proximity rate characterization curve to the X-axis to obtain two perpendicular line segments. The proximity rate characterization curve, the two perpendicular line segments, and the X-axis form a graph. Calculate the area of the graph, and multiply the area of the graph by the peak-valley difference after uniform dimension processing. Record the product value as the pet feature selection characterization value.
[0063] In some embodiments, determining whether an image patch is a pet-characteristic image patch in an image frame by selecting a representation value based on the pet features of each image patch specifically includes the following process:
[0064] The system loads a pet feature selection threshold and determines whether the pet feature selection value of each image patch exceeds the threshold. If it does, the image patch is considered a pet feature image patch in the image frame; otherwise, it is not. It's worth noting that the pet feature selection threshold is set to 15, which is suitable for medium-sized image patches in typical scenarios and is the system's default threshold. The threshold can be set to 10 for small image patches and 30 for large image patches.
[0065] In some embodiments, obtaining the up-to-date sequence corresponding to the identity comparison template of the pet to be identified specifically includes the following process:
[0066] Obtain the latest sequence value of each identity comparison template, sort all identity comparison templates in descending order of their latest sequence values, and generate a sequence after sorting. This sequence is the latest sequence of the identity comparison template.
[0067] Furthermore, calculating the latest sequence value of the identity comparison template specifically includes the following process:
[0068] The historical similarity index and historical usage frequency of each identity comparison template are obtained through a search engine. The historical usage frequency is the frequency with which the identity comparison template is used for identity recognition and comparison.
[0069] Substituting the historical similarity index SX and historical usage frequency SY of each identity comparison template into the calculation formula yields the current sequence value of the identity comparison template. The calculation formula is as follows: Where XL is the latest sequence value, , These are the weighting coefficients for the historical similarity index and the historical usage frequency, respectively. Considering that the historical similarity index has a greater impact on the current sequence value than the historical usage frequency, we can... Set to 0.6. Set to 0.4.
[0070] In some embodiments, feature extraction of image patches representing pet characteristics to obtain the pet features to be identified specifically includes the following process:
[0071] Image patches representing pet characteristics ,in, Represents the set of real numbers. For image blocks height, For image blocks width, The dimension of the image patch. The size of each image patch is represented by [insert size here]. All image patches are flattened, and the image embedding representation is obtained through a linear mapping function, represented as [insert representation here]. ,in, The length of the embedded representation, For the dimension of the embedded representation, The input is fed into the Transformer encoding layer for feature extraction, extracting the features of the pet to be identified. The Transformer encoding layer has the following structure: Multi-Head Self-Attention (MHSA) + Feed-Forward Network (FFN), supplemented by residual connections and layer normalization. It is worth noting that the extraction of identity comparison features based on the identity comparison template also follows the above feature extraction method.
[0072] In some embodiments, the feature point matching and alignment process for identity comparison features and features of the pet to be identified specifically includes the following steps:
[0073] Identity comparison features and characteristics of the pet to be identified Dimensionality is unified through a 1×1 convolution operation:
[0074] ; ;in, , To identify the features respectively and characteristics of the pet to be identified The feature vector after dimension unification; where, This is a 1×1 convolution operation.
[0075] based on and Generate graph structure ,in, For feature point node set, feature point node set , The number of feature point nodes is and The sum of the number of feature points, and connecting edges are established between related feature point nodes. A relationship between two feature points includes: the two feature points having the same feature dimension or the two feature points being adjacent in the graph structure space. For the set of associated edges between feature points, The number of associated edges is ;
[0076] compute nodes Importance weights of the d-th eigenvalues : ;
[0077] in, For nodes eigenvalues, Represents a node Centrality;
[0078] node The centrality of a node is calculated as follows: the number of edges U directly connected to the node, then... ;
[0079] based on compute nodes Matching probability : ;
[0080] in, , for The maximum value, for The average value, To limit the probability and ensure matching accuracy, the probability can be set to 0.3.
[0081] By matching probability Nodes with a matching probability below a preset threshold are deleted, resulting in identity comparison features after feature point matching and alignment. and characteristics of the pet to be identified .
[0082] It is worth noting that, in order to ensure the core technical goal of filtering effective matching edges based on feature point matching probability and improving the accuracy of pet feature matching, the preset matching probability threshold is preferably set to 0.4 in normal scenarios;
[0083] In some embodiments, the weighted comparison of the identity comparison features after feature point matching and alignment processing and the features of the pet to be identified to obtain a similarity index specifically includes the following process:
[0084] ;
[0085] in, The similarity index, After matching and aligning pet feature points, the first The weight coefficients corresponding to the 3D feature vectors This indicates identity comparison features after feature point matching and alignment. The Each feature vector value This indicates the pet features to be identified after feature point matching and alignment. The Each feature vector value.
[0086] Furthermore, after the pet feature points are matched and aligned, the first... The weight coefficients corresponding to the dimensional feature vectors are set by the user. For example, the weight coefficient corresponding to the RGB color feature vector of the pet's nose tip pixel is 0.15, the weight coefficient corresponding to the texture gradient feature vector of the pet's left eye contour is 0.48, and the weight coefficient corresponding to the edge detection feature vector of the pet's right ear shape is 0.25.
[0087] In some embodiments, confirming the identity of a pet to be identified based on a similarity index specifically includes the following process:
[0088] The similarity index threshold is loaded, and it is determined whether the similarity index exceeds the threshold. If it does, the pet identity corresponding to the image frame of the pet to be identified is determined to be consistent with the pet identity corresponding to the identity comparison template; otherwise, the pet identity corresponding to the image frame of the pet to be identified is determined to be inconsistent with the pet identity corresponding to the identity comparison template. It is worth noting that the core technical goal of achieving accurate pet identity recognition based on the dynamically weighted similarity index is to achieve the core functions of "distinguishing between target pets and non-target pets and balancing recognition precision and recall." In conventional identity recognition scenarios, a threshold of 0.8 is preferred.
[0089] In some embodiments, updating a new sequence based on a similarity index specifically includes the following process: replacing the historical similarity index in the identity database with the similarity index.
[0090] This invention also provides a pet identification system based on dynamic weighted comparison. Figure 3 This is a system block diagram of a pet identification system based on dynamic weighted comparison according to an embodiment of the present invention, such as... Figure 3 As shown, the system includes:
[0091] The image frame processing module is used to acquire image frames of the pet to be identified, split the image frames into multiple non-overlapping image blocks, calculate the pet feature selection representation value of each image block, and determine whether the image block is the image block representing the pet feature in the image frame based on the pet feature selection representation value of each image block. The feature processing module is used to extract features from the image blocks representing the pet feature to obtain the pet feature to be identified, generate an identity database access request based on the pet feature to be identified, respond to the identity database access request, and obtain the current sequence corresponding to the identity comparison template of the pet to be identified from the identity database. The identity comparison template at the top of the current sequence is recorded as the identity comparison template of the pet to be identified, and identity comparison features are extracted based on the identity comparison template. The identity recognition module is used to perform feature point matching and alignment processing on the identity comparison features and the pet feature to be identified, and perform weighted comparison processing on the identity comparison features and the pet feature to be identified after feature point matching and alignment processing to obtain a similarity index. The identity of the pet to be identified is confirmed based on the similarity index, and the current sequence is updated based on the similarity index.
[0092] The above formulas are all dimensionless calculations, and the preset parameters in the formulas should be set by those skilled in the art according to the actual situation.
[0093] The above embodiments can be implemented, in whole or in part, by software, hardware, firmware, or any other combination thereof. When implemented using software, the above embodiments can be implemented, in whole or in part, as a computer program product. The computer program product includes one or more computer instructions or computer programs. When the computer instructions or computer programs are loaded or executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more sets of available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium. A semiconductor medium can be a solid-state drive.
[0094] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0095] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0096] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.
[0097] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0098] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A method for pet identification based on dynamic weighted comparison, characterized in that, The methods include: The system acquires image frames of the pet to be identified, splits the image frames into multiple non-overlapping image blocks, calculates the pet feature selection representation value for each image block, and determines whether the image block is the image block representing the pet feature in the image frame based on the pet feature selection representation value of each image block. Feature extraction is performed on image patches representing pet characteristics to obtain the pet features to be identified. An identity database access request is generated based on the pet features to be identified. The identity database access request is responded to and the latest sequence corresponding to the identity comparison template of the pet to be identified is obtained from the identity database. The identity comparison template at the top of the latest sequence is recorded as the identity comparison template of the pet to be identified, and identity comparison features are extracted based on the identity comparison template. Feature point matching and alignment processing is performed on the identity comparison features and the features of the pet to be identified. Then, a weighted comparison processing is performed on the identity comparison features and the features of the pet to be identified after feature point matching and alignment processing to obtain a similarity index. The identity of the pet to be identified is confirmed based on the similarity index, and the new sequence is updated based on the similarity index.
2. The method for pet identification based on dynamic weighted comparison according to claim 1, characterized in that, The specific process for calculating the pet feature selection representation value for each image patch includes the following steps: Obtain the pixel set corresponding to each image patch, and calculate the pixel values of the pixel set and the comparison pixel set. The proximity rate P; The pixels in the pixel set are numbered. A rectangular coordinate system is established with the pixel number as the X-axis and the proximity rate corresponding to the pixel as the Y-axis. A proximity rate characterization curve is generated by plotting points. The lower peak and lower valley values of the proximity rate characterization curve are counted. The lower peak value is the maximum proximity rate, and the lower valley value is the minimum proximity rate. The peak-valley difference between the lower peak and lower valley values is calculated. Perpendicular lines are drawn from the two endpoints of the proximity rate characterization curve to the X-axis to obtain two perpendicular line segments. A graph is formed by the proximity rate characterization curve, the two perpendicular line segments, and the X-axis. The area of the graph is calculated, and the product of the area of the graph and the peak-valley difference after unifying the dimensions is recorded as the pet feature selection characterization value.
3. The method for pet identification based on dynamic weighted comparison according to claim 1, characterized in that, Determining whether an image patch is a representative image patch representing pet features in an image frame based on the pet features of each image patch specifically includes the following process: Load the pet feature selection representation value threshold, and determine whether the pet feature selection representation value of each image block exceeds the pet feature selection representation value threshold. If it does, then the image block is determined to be an image block representing pet features in the image frame. If not, then the image block is determined not to be an image block representing pet features in the image frame.
4. The method for pet identification based on dynamic weighted comparison according to claim 1, characterized in that, The process of obtaining the up-to-date sequence corresponding to the identity comparison template of the pet to be identified includes the following steps: Obtain the latest sequence value of each identity comparison template, sort all identity comparison templates in descending order of their latest sequence values, and generate a sequence after sorting. This sequence is the latest sequence of the identity comparison template.
5. The method for pet identification based on dynamic weighted comparison according to claim 4, characterized in that, The calculation of the latest sequence value of the identity comparison template includes the following process: The historical similarity index and historical usage frequency of each identity comparison template are obtained through a search engine. The historical similarity index SX and historical usage frequency SY of each identity comparison template are then substituted into the calculation formula to obtain the current sequence value of the identity comparison template. The calculation formula is as follows: Where XL is the latest sequence value, , These are the weighting coefficients for the historical similarity index and the historical usage frequency, respectively.
6. The method for pet identification based on dynamic weighted comparison according to claim 1, characterized in that, The specific process of matching and aligning feature points between identity comparison features and features of the pet to be identified includes the following steps: Identity comparison features and characteristics of the pet to be identified Dimensionality is unified through 1×1 convolution operation; based on and Generate graph structure ,in, For feature point node set, feature point node set , The number of feature point nodes, For the set of associated edges between feature points, The number of associated edges is ; compute nodes Importance weights of the d-th eigenvalues : ; in, For nodes eigenvalues, Represents a node Centrality; based on compute nodes Matching probability : ; in, , for The maximum value, for The average value, To limit the probability; By matching probability Nodes with a matching probability below a preset threshold are deleted, resulting in identity comparison features after feature point matching and alignment. and characteristics of the pet to be identified .
7. The method for pet identification based on dynamic weighted comparison according to claim 6, characterized in that, The process of weighted comparison between the identity comparison features (after feature point matching and alignment) and the features of the pet to be identified to obtain the similarity index includes the following steps: ; in, The similarity index After matching and aligning pet feature points, the first The weight coefficients corresponding to the 3D feature vectors This indicates identity comparison features after feature point matching and alignment. The Each feature vector value This indicates the pet features to be identified after feature point matching and alignment. The Each feature vector value.
8. The method for pet identification based on dynamic weighted comparison according to claim 1, characterized in that, The identity of the pet to be identified was confirmed based on the similarity index. The process includes the following: Load the similarity index threshold, and determine whether the similarity index exceeds the similarity index threshold. If it does, determine that the pet identity corresponding to the image frame of the pet to be identified is consistent with the pet identity corresponding to the identity comparison template. If not, determine that the pet identity corresponding to the image frame of the pet to be identified is inconsistent with the pet identity corresponding to the identity comparison template.
9. The method for pet identification based on dynamic weighted comparison according to claim 1, characterized in that, The process of updating a new sequence based on the similarity index includes the following steps: replacing the historical similarity index in the identity database with the new similarity index.
10. A pet identification system based on dynamic weighted comparison, characterized in that, A method for pet identification based on dynamic weighted comparison, applicable to any one of claims 1 to 9, the system comprising: The image frame processing module is used to acquire image frames of the pet to be identified, split the image frames into multiple non-overlapping image blocks, calculate the pet feature selection representation value of each image block, and determine whether the image block is the image block representing the pet feature in the image frame based on the pet feature selection representation value of each image block. The feature processing module is used to extract features from the image blocks representing the pet feature to obtain the pet feature to be identified, generate an identity database access request based on the pet feature to be identified, respond to the identity database access request, and obtain the current sequence corresponding to the identity comparison template of the pet to be identified from the identity database. The identity comparison template at the top of the current sequence is recorded as the identity comparison template of the pet to be identified, and identity comparison features are extracted based on the identity comparison template. The identity recognition module is used to perform feature point matching and alignment processing on the identity comparison features and the pet feature to be identified, and perform weighted comparison processing on the identity comparison features and the pet feature to be identified after feature point matching and alignment processing to obtain a similarity index. The identity of the pet to be identified is confirmed based on the similarity index, and the current sequence is updated based on the similarity index.