Face feature matching method, system, equipment and medium
Through particle swarm optimization and adaptive update of inertial dictionary, the problem of insufficient time and accuracy of facial feature search is solved, and efficient and accurate facial feature matching is achieved.
Patent Information
- Application Number
- CN202410992983.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-23
- Publication Date
- 2024-11-19
AI Technical Summary
In the existing face feature search methods, traversal search takes a long time and high computing resources, while the accuracy of the nearest neighbor search algorithm is not satisfactory, making it difficult to reduce the time-consuming and improve the accuracy of face feature matching at the same time.
Using particle swarm optimization method, particle swarm optimization is performed on face features through the first inertial dictionary and vector space to obtain the optimal particles, and particle mapping screening is performed to obtain the matching results. At the same time, the first inertial dictionary is performed based on the second inertial dictionary. Adaptive update.
Effectively reduce the computing resource consumption of face feature matching, improve search speed and accuracy, and reduce matching time.
Smart Images

Figure CN118982853A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of face recognition technology, and in particular to a method, system, device and medium for matching face features. Background Art
[0002] With the continuous development of facial recognition technology, its application in scenarios such as security verification, payment, and social media is becoming more and more common.
[0003] At present, traditional facial feature search methods can be roughly divided into two categories. The first type of facial feature search method is based on the traversal method to realize the search of facial features. The traversal search of this type of method is often slow, time-consuming, and requires high computing resources. The second type of facial feature search method is based on the Approximate Nearest Neighbors (ANN) algorithm, which mainly uses a binary tree to quickly search for facial features. The search accuracy of this type of method is not satisfactory.
[0004] In summary, the technical problems existing in the relevant technologies need to be improved. Summary of the invention
[0005] The purpose of the present invention is to solve one of the technical problems existing in the related art to at least a certain extent.
[0006] The main purpose of the embodiments of the present application is to propose a facial feature matching method, system, device and medium, wherein the matching method can effectively reduce the time consumption and required computing resources of facial feature matching and improve the accuracy of facial feature matching.
[0007] To achieve the above purpose, one aspect of an embodiment of the present application provides a method for matching facial features, the matching method comprising:
[0008] Acquire a vector space formed by a first inertial dictionary and a plurality of feature data, and a facial feature to be matched, wherein the dimension of the vector space is the same as the dimension of the facial feature;
[0009] According to the first inertial dictionary and the vector space, particle swarm optimization is performed on the facial feature to obtain a first optimal particle, where the first optimal particle is used to represent a particle swarm particle corresponding to feature data with the greatest similarity to the facial feature in the vector space;
[0010] According to the first optimal particle, the vector space is screened by particle mapping to obtain a matching result.
[0011] In some embodiments, performing particle swarm optimization on the facial features according to the first inertial dictionary and the vector space to obtain first optimal particles includes:
[0012] Get the preset maximum iteration threshold;
[0013] Acquire a first global particle in the vector space and a current number of iterations, wherein the first global particle is a particle swarm particle corresponding to feature data having the greatest similarity to the facial feature under the current number of iterations;
[0014] According to the first inertial dictionary and the first global particles, updating the face features with a particle swarm to obtain second global particles;
[0015] Compare the current number of iterations with the maximum iteration threshold to obtain an iteration comparison result;
[0016] If the iterative comparison result is that the current number of iterations is less than the maximum iteration threshold, the current number of iterations is updated, and the first global particle is updated according to the second global particle, and then the step of obtaining the first global particle and the current number of iterations is returned to execute; or, if the iterative comparison result is that the current number of iterations is equal to the maximum iteration threshold, the second global particle is determined as the first optimal particle.
[0017] In some embodiments, the updating of the particle swarm of the face features according to the first inertial dictionary and the first global particles to obtain the second global particles includes:
[0018] Acquire a first inertia coefficient in the first inertia dictionary and a global extreme value corresponding to the first global particle;
[0019] According to the first inertia coefficient, performing particle movement on the first volume particle to obtain a second volume particle;
[0020] Acquire a first body extreme value corresponding to the first body particle, and, based on the second body particle, perform similarity calculation on the facial feature to obtain a second body extreme value;
[0021] According to the global extreme value, the first individual extreme value and the second individual extreme value are subjected to extreme value screening to obtain a second global particle.
[0022] In some embodiments, the step of performing extreme value screening on the first individual extreme value and the second individual extreme value according to the global extreme value to obtain a second global particle includes:
[0023] Compare all of the first individual extreme values with all of the second individual extreme values to obtain a group extreme value;
[0024] Comparing the group extreme value with the global extreme value to obtain an extreme value comparison result;
[0025] If the extreme value comparison result is that the group extreme value is greater than the global extreme value, the group particle corresponding to the group extreme value is determined as the second global particle; or, if the extreme value comparison result is that the group extreme value is less than or equal to the global extreme value, the first global particle corresponding to the global extreme value is determined as the second global particle.
[0026] In some embodiments, the matching method further includes:
[0027] Get the second inertia dictionary;
[0028] performing particle swarm optimization on the facial features according to the vector space and the second inertial dictionary to obtain second optimal particles, where the second optimal particles are used to represent unstable particles in the vector space that have the greatest similarity to the facial features;
[0029] The first inertial dictionary is updated according to the second optimal particle and the first optimal particle.
[0030] In some embodiments, updating the first inertial dictionary according to the second optimal particle and the first optimal particle includes:
[0031] Acquire an adaptive extreme value corresponding to the second optimal particle and a global extreme value corresponding to the first optimal particle;
[0032] Comparing the adaptive extreme value and the global extreme value to obtain an optimal comparison result;
[0033] If the optimal comparison result is that the adaptive extreme value is greater than the global extreme value, the first inertial dictionary is updated according to the second inertial dictionary, and then the step of obtaining the second inertial dictionary is returned to be executed.
[0034] In some embodiments, acquiring the second inertia dictionary includes:
[0035] Get the preset dictionary random mutation rules;
[0036] According to the random mutation rule of the dictionary, random coefficient mutation is performed on the first inertial dictionary to obtain the second inertial dictionary.
[0037] To achieve the above purpose, another aspect of the embodiment of the present application provides a facial feature matching system, the matching system comprising:
[0038] An acquisition unit, used to acquire a vector space formed by a first inertial dictionary and a plurality of feature data, and a facial feature to be matched, wherein the dimension of the vector space is the same as the dimension of the facial feature;
[0039] an optimization unit, configured to perform particle swarm optimization on the facial feature according to the first inertial dictionary and the vector space to obtain a first optimal particle, wherein the first optimal particle is used to represent a particle swarm particle corresponding to feature data having the greatest similarity to the facial feature in the vector space;
[0040] A mapping unit is used to perform particle mapping screening on the vector space according to the first optimal particle to obtain a matching result.
[0041] To achieve the above-mentioned purpose, another aspect of an embodiment of the present application provides an electronic device, the electronic device comprising a memory and a processor, the memory storing a computer program, and the processor implementing the above-mentioned method when executing the computer program.
[0042] To achieve the above objective, another aspect of an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method described above is implemented.
[0043] The embodiments of the present application include at least the following beneficial effects:
[0044] The present application provides a method, system, device and medium for matching facial features, wherein the matching method obtains a vector space formed by a first inertial dictionary and a plurality of feature data, and a facial feature to be matched, wherein the dimension of the vector space is the same as the dimension of the facial feature; based on the first inertial dictionary and the vector space, the facial feature is subjected to particle swarm optimization to obtain a first optimal particle, wherein the first optimal particle is used to characterize the particle swarm particle corresponding to the feature data with the greatest similarity to the facial feature in the vector space; based on the first optimal particle, the vector space is subjected to particle mapping screening to obtain a matching result. The matching method is based on the first inertial dictionary, and performs mobile optimization on a plurality of particles of the particle swarm in the vector space, so as to find the particle swarm particle with the greatest similarity to the facial feature. While reducing the computing resources required for facial feature matching, it can also effectively improve the search speed and accuracy of facial feature matching as a whole, and facial feature matching takes less time. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] Figure 1 It is a flowchart of a facial feature matching method provided in an embodiment of the present application;
[0046] Figure 2 is a detailed flow chart of step S120 provided in an embodiment of the present application;
[0047] Figure 3 is a detailed flow chart of step A3 provided in an embodiment of the present application;
[0048] Figure 4 is a detailed schematic diagram of step A34 provided in an embodiment of the present application;
[0049] Figure 5 It is a logical schematic diagram of extreme value screening provided by an embodiment of the present application;
[0050] Figure 6 This is an optional flowchart of a facial feature matching method provided in an embodiment of the present application;
[0051] Figure 7 is a detailed flow chart of step S140 provided in an embodiment of the present application;
[0052] Figure 8 is a detailed flow chart of step S160 provided in an embodiment of the present application;
[0053] Fig. 9 It is a schematic diagram of the framework of a facial feature matching system provided in an embodiment of the present application;
[0054] Fig.10 It is a schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0055] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application is further described in detail below in conjunction with the accompanying drawings and examples. It should be understood that the specific embodiments described herein are only used to explain the present application and are not intended to limit the present application. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the embodiments of the present application. They are only examples of devices / equipment and methods consistent with some aspects of the embodiments of the present application as detailed in the attached claims.
[0056] It is understood that the terms "first", "second", etc. used in this application can be used to describe various concepts in this article, but unless otherwise specified, these concepts are not limited by these terms. These terms are only used to distinguish one concept from another concept. For example, without departing from the scope of the embodiment of the present application, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the words "if" and "if" as used herein can be interpreted as "at the time of" or "when" or "in response to determination".
[0057] The terms "at least one", "multiple", "each", "any", etc. used in this application, at least one includes one, two or more, multiple includes two or more, each refers to each of the corresponding multiple, and any refers to any one of the multiple.
[0058] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.
[0059] At present, traditional facial feature search methods can be roughly divided into two categories. The first type of facial feature search method realizes the search of facial features based on traversal. Specifically, for each single query data input, the facial feature data in the data candidate set is traversed, and the similarity or distance between the query data and all the facial feature data in the data candidate set is calculated. Then, the facial feature data with the greatest similarity or the closest distance is compared to achieve facial feature matching. When the number of samples in the data candidate set is large, the traversal search of this type of method is often slow, the traversal search takes a long time, and the required computing resources are high.
[0060] The second type of facial feature search method is based on the Approximate Nearest Neighbors (ANN) algorithm, which organizes the facial feature data in the data candidate set into a tree data structure and performs rapid retrieval based on the idea of a binary tree. However, it is easy for the optimal facial feature data to not belong to the selected binary tree branch, making the search accuracy of this type of method unsatisfactory.
[0061] In view of this, the present application provides a facial feature matching method, system, device and medium, wherein the matching method is based on a first inertial dictionary, and optimizes the movement of several particles of a particle group in a vector space, so as to find the particle group particles with the greatest similarity to the facial features, which can effectively improve the search speed and accuracy of facial feature matching as a whole while reducing the computing resources required for facial feature matching, and facial feature matching takes less time. In addition, the matching method is also based on a second inertial dictionary, and the first inertial dictionary is adaptively updated several times, which can effectively improve the accuracy of the facial features in the database.
[0062] A facial feature matching method provided in an embodiment of the present application can be applied to a facial recognition application scenario. In a facial recognition application scenario, a facial recognition service provider can use the facial feature matching method provided in an embodiment of the present application to perform facial feature matching on query data provided by a user, which can effectively reduce the time consumption and required computing resources of facial feature matching and improve the accuracy of facial feature matching.
[0063] A facial feature matching method provided in an embodiment of the present application can be applied to a terminal, a server, or software running in a terminal or a server. In some embodiments, the terminal can be a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart speaker, a smart watch, and a car terminal, etc., but is not limited to this; the server side can be configured as an independent physical server, or a server cluster or distributed system composed of multiple physical servers, and can also be configured as a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. The server can also be a node server in a blockchain network; the software can be an application that implements the method, etc., but is not limited to the above forms.
[0064] The present application can be used in many general or special computer system environments or configurations. For example: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, etc. The present application can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The present application can also be practiced in distributed computing environments, in which tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media including storage devices.
[0065] Figure 1 is an optional flow chart of a facial feature matching method provided in an embodiment of the present application. Figure 1 The method may include but is not limited to steps S110 to S130.
[0066] Step S110, obtaining a vector space formed by a first inertial dictionary and a plurality of feature data, and a facial feature to be matched, wherein the dimension of the vector space is the same as the dimension of the facial feature;
[0067] In an embodiment of the present application, the first inertia dictionary may be a set of first inertia coefficients, and each particle of the particle swarm corresponds to a first inertia coefficient; the feature data may be facial feature data pre-stored in a device / server database for matching with query data provided by a user; the facial feature to be matched is the query data provided by the user, which may be based on a facial feature acquisition module / recognition model to collect and detect the user's facial image, so as to obtain facial features with the same dimension as the feature data.
[0068] It can be understood that a single facial feature data in the database can be stored in the form of a multi-dimensional vector, and in each dimension of data, there is an index order corresponding to the facial feature; by combining several feature data in the form of multi-dimensional vectors, a vector space corresponding to several feature data can be obtained, and the number corresponding to the several in the embodiment of the present application can be 1 or greater than or equal to 2.
[0069] Step S120: performing particle swarm optimization on the facial feature according to the first inertial dictionary and the vector space to obtain a first optimal particle, wherein the first optimal particle is used to represent a particle swarm particle corresponding to feature data having the greatest similarity to the facial feature in the vector space;
[0070] Reference Figure 2 In some embodiments, the step S120, performing particle swarm optimization on the facial features according to the first inertial dictionary and the vector space to obtain the first optimal particles, includes:
[0071] A1. Obtain a preset maximum iteration threshold;
[0072] A2. Obtaining a first global particle in the vector space and a current number of iterations, wherein the first global particle is a particle swarm particle corresponding to feature data having the greatest similarity to the facial feature under the current number of iterations;
[0073] In the embodiment of the present application, particle swarm optimization is used to randomly generate a number of particle swarm particles in the vector space formed by all feature data, and select the particle swarm particles corresponding to the feature data with the greatest similarity to the facial features through the movement of a number of particle swarm particles. Specifically, the preset maximum iteration threshold is used to characterize the maximum number of iterations of the particle swarm particle movement optimization, and the specific value of the maximum iteration threshold can be set according to the actual situation, such as any one of 10, 50, 100, 200, etc., and the example of the present application is only for illustration.
[0074] It can be understood that for a certain movement optimization of particles in a particle swarm, the number of iterations corresponding to the movement optimization (i.e., the current number of iterations) and the global optimal particle (i.e., the first global particle) when the particle swarm is not moving optimized under the current number of iterations can be obtained.
[0075] A3. According to the first inertial dictionary and the first global particle, update the particle swarm of the face feature to obtain a second global particle;
[0076] Further, refer to Figure 3 The step A3, performing particle swarm updating on the face feature according to the first inertial dictionary and the first global particle to obtain a second global particle, comprises:
[0077] Step A31, obtaining the first inertia coefficient in the first inertia dictionary and the global extreme value corresponding to the first global particle;
[0078] A32. Perform particle movement on the first volume particle according to the first inertia coefficient to obtain a second volume particle;
[0079] A33, obtaining a first individual extreme value corresponding to the first individual particle, and, based on the second individual particle, performing similarity calculation on the facial feature to obtain a second individual extreme value;
[0080] In the embodiment of the present application, the first individual particle and the second individual particle are used to characterize the different movement stages of the corresponding particle swarm particles under a certain number of iterations. If the current number of iterations is 1, the first global particle obtained in step A31 can be a number of particle swarm particles randomly initialized in the vector space, and by calculating and comparing the similarities between the number of particle swarm particles and the facial features, the particle swarm particle with the greatest similarity to the facial features in the initialization stage is determined as the first global particle when the current number of iterations is 1; or, if the current number of iterations is 1, the first global particle obtained in step A31 can be any one of the number of initialized particle swarm particles. In addition, if the current number of iterations is greater than or equal to 2, the first global particle obtained in step A31 can be the previous number of iterations, and the updated first global particle is determined as the first global particle under the current number of iterations.
[0081] It can be understood that the first global particle is the global optimal particle among all particle swarm particles, and for a particle of a certain particle swarm, the position of the particle swarm particle will continue to change with the increase of the number of iterations, and the first volume particle is used to characterize the particle swarm particle corresponding to the first global particle at the current number of iterations. The first volume particle records the speed and position of the particle swarm particle at the current number of iterations. Step A32 is used to update the speed and position of each first volume particle to obtain a second volume particle, and the second volume particle can be used to determine the first volume particle corresponding to the next number of iterations.
[0082] For example, for a particle of a certain particle group, the equivalent expression of particle movement in the embodiment of the present application can be expressed as:
[0083]
[0084] in, is the velocity of the second individual particle; i is the number of the particle group corresponding to the second individual particle; k is the number of times the particle moves; w k is the first inertia coefficient corresponding to the kth particle movement in the first inertia dictionary; is the velocity of the first particle; c1 and c1 are learning factors; r1 and r2 are two random numbers between [0,1]; is the optimal position of particle i in the particle swarm during the first k particle movements; is the position of the first body particle; is the optimal position of all particles in the swarm in the first k particle moves; is the position of the second individual particle.
[0085] It should be noted that the learning factor is used to adjust the maximum step length of the particle swarm particles flying towards the global optimal particle or the individual optimal particle. The specific values of the two learning factors can be the same or different. For example, the value of the two learning factors can be 2. In addition, for the optimal position, it can be the position where a single or all particle swarm particles have the greatest similarity with the facial features.
[0086] For the first volume extreme value in step A33, it can be the similarity corresponding to the optimal position of the particle swarm particle corresponding to the first volume particle under the current number of iterations, that is, The corresponding similarity can be determined by calculating the similarity under the previous iteration number. As for the second individual particle in step A33, first, the feature data corresponding to the position of the second individual particle is determined according to the position of the second individual particle in the vector space; then, based on the vector elements of the feature data in each dimension, the similarity of the vector elements in the dimension corresponding to the facial features is calculated. The similarity can be obtained based on any one of the calculation methods such as the cosine similarity of the vector, the Euclidean distance of the vector, the inner product of the vector, etc. The examples in this application are for illustration only and do not impose any limitation on this application.
[0087] A34. According to the global extreme value, perform extreme value screening on the first individual extreme value and the second individual extreme value to obtain a second global particle.
[0088] Further, refer to Figure 4 and Figure 5 The step A34, performing extreme value screening on the first individual extreme value and the second individual extreme value according to the global extreme value to obtain a second global particle, comprises:
[0089] A341. Compare all of the first individual extreme values and all of the second individual extreme values to obtain a group extreme value;
[0090] A342. Compare the group extreme value and the global extreme value to obtain an extreme value comparison result;
[0091] A343. If the extreme value comparison result is that the group extreme value is greater than the global extreme value, the group particle corresponding to the group extreme value is determined as the second global particle; or, if the extreme value comparison result is that the group extreme value is less than or equal to the global extreme value, the first global particle corresponding to the global extreme value is determined as the second global particle.
[0092] In an embodiment of the present application, after obtaining the second individual extreme value of all particle swarm particles at the current number of iterations and the first individual extreme value of all particle swarm particles before the particles move, for a certain particle swarm particle, the first individual extreme value obtained previously can be compared with the second individual extreme value calculated at the current number of iterations. If the first individual extreme value is greater than or equal to the second individual extreme value, the first individual extreme value of the particle swarm particle and the position of the individual optimal particle corresponding to the first individual extreme value will not be updated.
[0093] Alternatively, if the first volume extreme value is less than the second volume extreme value, the first volume extreme value of the particle of the particle swarm is updated according to the second volume extreme value to obtain the updated first volume extreme value. Specifically, the second volume extreme value can be determined as the new first volume extreme value of the particle of the particle swarm, and the position corresponding to the second volume extreme value can be determined as the position corresponding to the new first volume extreme value of the particle of the particle swarm.
[0094] It can be understood that, at the current number of iterations, if the first volume extreme value is greater than or equal to the second volume extreme value, then the first volume extreme value can still be determined as the first volume extreme value at the next number of iterations; and at the current number of iterations, if the first volume extreme value is less than the second volume extreme value, then the updated first volume extreme value needs to be determined as the first volume extreme value at the next number of iterations.
[0095] It should be noted that, for all particle swarm particles at the current number of iterations, step A341 may be to compare the size relationship between the first individual extreme values and the second individual extreme values of all particle swarm particles, and determine the extreme value with the largest value among all first individual extreme values and all second individual extreme values as the obtained group extreme value, which is used to characterize the optimal individual extreme value corresponding to all particle swarm particles at the current number of iterations.
[0096] Step A342 can be to compare the size relationship between the group extreme value and the global extreme value in terms of numerical angle. If the extreme value comparison result is that the group extreme value is greater than the global extreme value, the group particle corresponding to the group extreme value is determined as the second global particle, and the group particle is the particle group particle with the largest extreme value corresponding to the current number of iterations; or, if the extreme value comparison result is that the group extreme value is less than or equal to the global extreme value, the first global particle corresponding to the global extreme value is determined as the second global particle.
[0097] A4. Compare the current number of iterations with the maximum iteration threshold to obtain an iteration comparison result;
[0098] A5. If the iterative comparison result is that the current number of iterations is less than the maximum iteration threshold, the current number of iterations is updated, and the first global particle is updated according to the second global particle, and then the step of obtaining the first global particle and the current number of iterations is returned to execute; or, if the iterative comparison result is that the current number of iterations is equal to the maximum iteration threshold, the second global particle is determined as the first optimal particle.
[0099] In an embodiment of the present application, after determining the second global particle and the position corresponding to the second global particle, the size relationship between the current number of iterations and the preset maximum iteration threshold can be compared. If the iterative comparison result is that the current number of iterations is less than the maximum iteration threshold, the current number of iterations is increased by one, and the second global particle obtained under the current number of iterations is determined as the first global particle under the next number of iterations, and then the process returns to execute step A2; or, if the iterative comparison result is that the current number of iterations is equal to the maximum iteration threshold, the second global particle finally obtained can be determined as the first optimal particle with the greatest similarity to the facial features among all particles in the particle group during the entire iterative process.
[0100] It should be noted that the iterative exit condition of the iterative process can also be flexibly changed from the maximum iteration threshold to the accuracy threshold. When the obtained second global particle meets the accuracy threshold, the iterative process is exited. There are many specific implementation methods, which will not be repeated in this application.
[0101] Step S130: According to the first optimal particle, the vector space is screened by particle mapping to obtain a matching result.
[0102] In an embodiment of the present application, after obtaining the first optimal particle, feature data (i.e., matching result) corresponding to the position of the first optimal particle in the vector space can be mapped and found according to the position of the first optimal particle in the vector space, and the feature data has the greatest similarity with the facial features provided by the user.
[0103] In the embodiments of this application, refer to Figure 6 , the matching method further includes:
[0104] Step S140, obtaining a second inertia dictionary;
[0105] Further, refer to Figure 7 The step S140 of obtaining a second inertia dictionary includes:
[0106] B1. Obtaining the preset random mutation rule of the dictionary;
[0107] B2. According to the random mutation rule of the dictionary, random coefficient mutation is performed on the first inertial dictionary to obtain the second inertial dictionary.
[0108] In an embodiment of the present application, the dictionary random mutation rule is used to randomly mutate each first inertia coefficient in the first inertia dictionary. Specifically, the dictionary random mutation rule can be a single random number within the range of the first mutation threshold to the second mutation threshold, wherein the first mutation threshold is less than the second mutation threshold, and the specific value of the first mutation threshold can be any one of 0.8, 0.9, 0.95, etc., and the specific value of the second mutation threshold can be any one of 1.05, 1.1, 1.2, etc.
[0109] For example, the embodiment of the present application takes a single random number in the range of 0.9 to 1.05 as an example, and at this time, for a first inertia coefficient in the first inertia dictionary in step B2, the equivalent expression of the random coefficient variation can be expressed as:
[0110] w nk =rw k
[0111] Among them, w nk is the kth second inertia coefficient in the second inertia dictionary; r is a random number between [0.9, 1.05]; w k is the kth first inertia coefficient in the inertia dictionary.
[0112] It can be understood that the random variation rule of the dictionary can also be a number of random numbers within the range from the first variation threshold to the second variation threshold, and each random number corresponds to one of the first inertia coefficients in the first inertia dictionary.
[0113] Step S150: performing particle swarm optimization on the facial features according to the vector space and the second inertial dictionary to obtain second optimal particles, where the second optimal particles are used to represent unstable particles with the greatest similarity to the facial features in the vector space;
[0114] In an embodiment of the present application, the unstable particles in step S150 and the particle swarm particles in step S120 do not interfere with each other in the vector space. The particle swarm optimization in step S150 is similar to the particle swarm optimization in the aforementioned step S120 and can be simply deduced by analogy, so the present application will not go into details here.
[0115] Step S160: Update the first inertial dictionary according to the second optimal particle and the first optimal particle.
[0116] Further, refer to Figure 8 The step S160 of updating the first inertial dictionary according to the second optimal particle and the first optimal particle includes:
[0117] C1. Obtaining an adaptive extreme value corresponding to the second optimal particle and a global extreme value corresponding to the first optimal particle;
[0118] C2. Compare the adaptive extreme value and the global extreme value to obtain the optimal comparison result;
[0119] C3. If the optimal comparison result is that the adaptive extreme value is greater than the global extreme value, the first inertial dictionary is updated according to the second inertial dictionary, and then the step of obtaining the second inertial dictionary is returned to be executed.
[0120] In an embodiment of the present application, the adaptive extreme value is used to characterize the similarity between the feature data corresponding to the second optimal particle position obtained based on the second inertial dictionary and the facial features; and the global extreme value is used to characterize the similarity between the feature data corresponding to the first optimal particle position obtained based on the first inertial dictionary and the facial features.
[0121] It can be understood that step B2 can be to compare the size relationship between the adaptive extreme value and the global extreme value. When the optimal comparison result is that the adaptive extreme value is greater than the global extreme value, the second inertia coefficient in the second inertia dictionary is replaced to the corresponding element position of the first inertia dictionary, and then return to execute step S140; or, when the optimal comparison result is that the adaptive extreme value is less than or equal to the global extreme value, the update process of the first inertia dictionary is exited.
[0122] For example, in actual applications, when the load of the device server is high, the movement of several particles of the particle swarm can be optimized in the vector space based on the first inertia dictionary, so as to find the particle swarm particles with the greatest similarity to the facial features, which can reduce the computing resources required for facial feature matching and effectively improve the search speed and accuracy of facial feature matching as a whole, and facial feature matching takes less time. When the load of the device server is low, the first inertia dictionary can be adaptively updated several times based on the second inertia dictionary on the basis of steps S110 to S130, and the first inertia coefficient in the first inertia dictionary can be continuously optimized, effectively improving the accuracy of the facial features in the database.
[0123] See also Fig. 9 The embodiment of the present application also provides a facial feature matching system, the matching system comprising:
[0124] An acquisition unit 810 is used to acquire a vector space formed by a first inertial dictionary and a plurality of feature data, and a facial feature to be matched, wherein the dimension of the vector space is the same as the dimension of the facial feature;
[0125] An optimization unit 820 is used to perform particle swarm optimization on the facial feature according to the first inertial dictionary and the vector space to obtain a first optimal particle, where the first optimal particle is used to represent a particle swarm particle corresponding to feature data with the greatest similarity to the facial feature in the vector space;
[0126] The mapping unit 830 is used to perform particle mapping screening on the vector space according to the first optimal particle to obtain a matching result.
[0127] It can be understood that the contents of the above method embodiments are all applicable to the present system embodiments, the functions specifically implemented by the present system embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.
[0128] The embodiment of the present application also provides an electronic device, the electronic device includes a memory and a processor, the memory stores a computer program, and the processor implements the above method when executing the computer program. The electronic device can be any intelligent terminal including a tablet computer, a car computer, etc.
[0129] It can be understood that the contents of the above method embodiments are all applicable to the present device embodiments, the functions specifically implemented by the present device embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.
[0130] See also Fig.10 , Fig.10 The hardware structure of an electronic device of an embodiment is illustrated, and the electronic device includes:
[0131] The processor 901 may be implemented by a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of the present application;
[0132] The memory 902 can be implemented in the form of a read-only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM). The memory 902 can store an operating system and other application programs. When the technical solutions provided in the embodiments of this specification are implemented by software or firmware, the relevant program codes are stored in the memory 902, and the processor 901 calls and executes the methods of the embodiments of this application;
[0133] Input / output interface 903, used to implement information input and output;
[0134] Communication interface 904, used to realize communication interaction between the device and other devices, which can be realized by wired mode (such as USB, network cable, etc.) or wireless mode (such as mobile network, WIFI, Bluetooth, etc.);
[0135] A bus 905 that transmits information between the various components of the device (e.g., the processor 901, the memory 902, the input / output interface 903, and the communication interface 904);
[0136] The processor 901 , the memory 902 , the input / output interface 903 and the communication interface 904 are connected to each other in communication within the device via a bus 905 .
[0137] An embodiment of the present application further provides a computer-readable storage medium, which stores a computer program, and the computer program implements the above method when executed by a processor.
[0138] It can be understood that the contents of the above method embodiments are all applicable to the present storage medium embodiments, the functions specifically implemented by the present storage medium embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.
[0139] The memory, as a non-transient computer-readable storage medium, can be used to store non-transient software programs and non-transient computer executable programs. In addition, the memory may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some embodiments, the memory may optionally include a memory remotely disposed relative to the processor, and these remote memories may be connected to the processor via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0140] The embodiments described in the embodiments of the present application are intended to more clearly illustrate the technical solutions of the embodiments of the present application and do not constitute a limitation on the technical solutions provided in the embodiments of the present application. Those skilled in the art will appreciate that with the evolution of technology and the emergence of new application scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.
[0141] Those skilled in the art will appreciate that the technical solutions shown in the figures do not constitute a limitation on the embodiments of the present application, and may include more or fewer steps than shown in the figures, or a combination of certain steps, or different steps.
[0142] The device embodiments described above are merely illustrative, and the units described as separate components may or may not be physically separated, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0143] Those skilled in the art will appreciate that all or some of the steps in the methods disclosed above, and the functional modules / units in the systems and devices may be implemented as software, firmware, hardware, or a suitable combination thereof.
[0144] The terms "first", "second", "third", "fourth", etc. (if any) in the specification of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0145] It should be understood that in the present application, "at least one (item)" means one or more, and "plurality" means two or more. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the objects associated before and after are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.
[0146] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the above units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0147] The units described above as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0148] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0149] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including multiple instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, referred to as ROM), random access memory (Random Access Memory, referred to as RAM), disk or optical disk and other media that can store programs.
[0150] The preferred embodiments of the present invention are described above with reference to the accompanying drawings, but the scope of the rights of the present invention is not limited thereto. Any modification, equivalent substitution and improvement made by a person skilled in the art without departing from the scope and essence of the present invention should be within the scope of the rights of the present invention.
Claims
1. A facial feature matching method, characterized in that: include: Acquire a vector space formed by a first inertial dictionary and a plurality of feature data, and a facial feature to be matched, wherein the dimension of the vector space is the same as the dimension of the facial feature; According to the first inertial dictionary and the vector space, particle swarm optimization is performed on the facial feature to obtain a first optimal particle, where the first optimal particle is used to represent a particle swarm particle corresponding to feature data with the greatest similarity to the facial feature in the vector space; According to the first optimal particle, the vector space is screened by particle mapping to obtain a matching result.
2. The facial feature matching method according to claim 1, characterized in that: The step of performing particle swarm optimization on the facial features according to the first inertial dictionary and the vector space to obtain first optimal particles includes: Get the preset maximum iteration threshold; Acquire a first global particle in the vector space and a current number of iterations, wherein the first global particle is a particle swarm particle corresponding to feature data having the greatest similarity to the facial feature under the current number of iterations; According to the first inertial dictionary and the first global particles, updating the face features with a particle swarm to obtain second global particles; Compare the current number of iterations with the maximum iteration threshold to obtain an iteration comparison result; If the iterative comparison result is that the current number of iterations is less than the maximum iteration threshold, the current number of iterations is updated, and the first global particle is updated according to the second global particle, and then the step of obtaining the first global particle and the current number of iterations is returned to execute; or, if the iterative comparison result is that the current number of iterations is equal to the maximum iteration threshold, the second global particle is determined as the first optimal particle.
3. The facial feature matching method according to claim 2, characterized in that: The step of updating the face feature by a particle swarm according to the first inertial dictionary and the first global particles to obtain a second global particle comprises: Acquire a first inertia coefficient in the first inertia dictionary and a global extreme value corresponding to the first global particle; According to the first inertia coefficient, performing particle movement on the first volume particle to obtain a second volume particle; Acquire a first body extreme value corresponding to the first body particle, and, based on the second body particle, perform similarity calculation on the facial feature to obtain a second body extreme value; According to the global extreme value, the first individual extreme value and the second individual extreme value are subjected to extreme value screening to obtain a second global particle.
4. The facial feature matching method according to claim 3, characterized in that: The step of performing extreme value screening on the first individual extreme value and the second individual extreme value according to the global extreme value to obtain a second global particle includes: Compare all of the first individual extreme values with all of the second individual extreme values to obtain a group extreme value; Comparing the group extreme value with the global extreme value to obtain an extreme value comparison result; If the extreme value comparison result is that the group extreme value is greater than the global extreme value, the group particle corresponding to the group extreme value is determined as the second global particle; or, if the extreme value comparison result is that the group extreme value is less than or equal to the global extreme value, the first global particle corresponding to the global extreme value is determined as the second global particle.
5. The facial feature matching method according to claim 1, characterized in that: The matching method further comprises: Get the second inertia dictionary; performing particle swarm optimization on the facial features according to the vector space and the second inertial dictionary to obtain second optimal particles, where the second optimal particles are used to represent unstable particles in the vector space that have the greatest similarity to the facial features; The first inertial dictionary is updated according to the second optimal particle and the first optimal particle.
6. The facial feature matching method according to claim 5, characterized in that: The updating of the first inertial dictionary according to the second optimal particle and the first optimal particle includes: Acquire an adaptive extreme value corresponding to the second optimal particle and a global extreme value corresponding to the first optimal particle; Comparing the adaptive extreme value and the global extreme value to obtain an optimal comparison result; If the optimal comparison result is that the adaptive extreme value is greater than the global extreme value, the first inertial dictionary is updated according to the second inertial dictionary, and then the step of obtaining the second inertial dictionary is returned to be executed.
7. The facial feature matching method according to claim 5, characterized in that: The step of obtaining the second inertia dictionary comprises: Get the preset dictionary random mutation rules; According to the random mutation rule of the dictionary, random coefficient mutation is performed on the first inertial dictionary to obtain the second inertial dictionary.
8. A facial feature matching system, characterized in that: include: An acquisition unit, used to acquire a vector space formed by a first inertial dictionary and a plurality of feature data, and a facial feature to be matched, wherein the dimension of the vector space is the same as the dimension of the facial feature; an optimization unit, configured to perform particle swarm optimization on the facial feature according to the first inertial dictionary and the vector space to obtain a first optimal particle, wherein the first optimal particle is used to represent a particle swarm particle corresponding to feature data having the greatest similarity to the facial feature in the vector space; A mapping unit is used to perform particle mapping screening on the vector space according to the first optimal particle to obtain a matching result.
9. An electronic device, characterized in that: include: at least one processor; at least one memory for storing at least one program; When the at least one program is executed by the at least one processor, the at least one processor implements the method according to any one of claims 1 to 7.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.
