Query of Feature Data and Its User Registration Query Method and Device
By dividing the feature data in the registered feature pool into multiple sets and comparing it with multi-threaded tasks, the problem of inefficient feature data query is solved, and efficient feature data and user registration query is achieved.
Patent Information
- Application Number
- CN202210543144.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-18
- Publication Date
- 2025-07-29
- Estimated Expiration
- 2042-05-18
AI Technical Summary
When the number of feature data in the registered feature pool increases, it is difficult for the prior art to efficiently query feature data matching the feature to be retrieved, resulting in inefficient authentication.
The feature data in the registered feature pool is divided into multiple feature data sets, each set containing multiple feature data. By creating a concurrent ratio of multi-threaded tasks to search feature data and multiple sets, the query results are determined using similarity scores.
Through multi-threaded concurrent comparison, the efficiency of feature data query and user registration query is significantly improved, the order of magnitude of each feature data set is reduced, and the speed of query and verification is improved.
Smart Images

Figure CN114942942B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of data processing, and in particular, to a method and device for querying feature data and querying user registration. Background Art
[0002] In recent years, with the continuous development of technologies in the field of artificial intelligence, there are more and more feature categories that can be used for identity verification. For example, face features, fingerprint features, voiceprint features, iris features, as well as digital passwords and gesture passwords set by users can all be used as features for identifying user identities. When there are more and more such feature categories, the number of features in the registration feature pool for storing these user features is also increasing.
[0003] In this case, how to improve the efficiency of querying features that match the to-be-retrieved features from the registration feature pool, and thus improve the efficiency of verifying user identities, requires a further solution. Summary of the Invention
[0004] The purpose of the embodiments of this application is to provide a method and device for querying feature data and querying user registration, which are used to improve data query efficiency.
[0005] In a first aspect, a method for querying feature data is provided, including:
[0006] Create a multi-threaded task to perform feature comparison between the to-be-retrieved target feature data and multiple feature data sets, and obtain a comparison result, where the comparison result includes a similarity score corresponding to the feature data that is closest to the target feature data; the multiple feature data sets are obtained by partitioning the feature data in the registration feature pool, and each feature data set includes multiple feature data;
[0007] Determine the query result of the target feature data based on the similarity score.
[0008] In a second aspect, a method for querying user registration is provided, including:
[0009] Obtain the registration data of the target user;
[0010] Create a multi-threaded task to perform feature comparison between the registration data of the target user and multiple feature data sets, and obtain a comparison result, where the comparison result includes a similarity score corresponding to the feature data that is closest to the registration data of the target user;
[0011] Obtain the registration query result of the target user.
[0012] In a third aspect, a device for querying feature data includes:
[0013] A feature comparison unit for creating a multi-threaded task to compare the target feature data to be retrieved with the multiple feature data sets to obtain a comparison result, where the comparison result includes a similarity score corresponding to the feature data closest to the target feature data; the multiple feature data sets are obtained by partitioning the feature data in the registered feature pool, and each feature data set includes multiple feature data;
[0014] A data query unit for determining a query result of the target feature data based on the similarity score.
[0015] In a fourth aspect, an electronic device is provided, which includes a processor, a memory, and a computer program stored on the memory and executable on the processor. When the computer program is executed by the processor, the steps of the method in the first aspect are implemented.
[0016] In a fifth aspect, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of the method in the first aspect are implemented.
[0017] In a sixth aspect, a user registration query device includes:
[0018] A data acquisition unit for acquiring registration data of a target user;
[0019] A feature comparison unit for creating a multi-threaded task to compare the registration data of the target user with multiple feature data sets and obtaining a comparison result, where the comparison result includes a similarity score corresponding to the feature data closest to the registration data of the target user;
[0020] A data query unit for obtaining a registration query result of the target user.
[0021] In a seventh aspect, an electronic device is provided, which includes a processor, a memory, and a computer program stored on the memory and executable on the processor. When the computer program is executed by the processor, the steps of the method in the second aspect are implemented.
[0022] In an eighth aspect, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of the method in the second aspect are implemented.
[0023] By adopting the solution of the embodiment of the present application, the feature data in the registration feature pool can be pre-divided into multiple feature data sets, and each feature data set contains multiple feature data. In this way, when there is a need to retrieve feature data, a multi-threaded task can be created. Through multi-threaded concurrent tasks, the target feature data to be retrieved is simultaneously compared with multiple feature data sets to obtain the similarity score corresponding to the target feature data and the closest feature data. Finally, based on the similarity score, the query result of the target feature data can be determined. Since the feature data in the registration feature pool is divided into multiple feature data sets, the order of magnitude of each feature data set is much smaller than that of all the feature data in the original registration feature pool. Therefore, when executing the multi-threaded task, the target feature data to be retrieved is simultaneously compared with multiple feature data sets in parallel, which can greatly improve the feature comparison efficiency and thus improve the query efficiency of the feature data. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] The drawings described herein are used to provide a further understanding of the present application and form a part of the present application. The illustrative embodiments and descriptions thereof of the present application are used to explain the present application and do not constitute an improper limitation of the present application. In the drawings:
[0025] Figure 1 FIG. is a schematic flowchart of a method for querying feature data provided by an embodiment of the present application.
[0026] Figure 2 FIG. is an example diagram of an actual scenario of the application of the method for querying feature data provided by an embodiment of the present application.
[0027] Figure 3 FIG. is a schematic flowchart of a method for user registration query provided by an embodiment of the present application.
[0028] Figure 4 FIG. is a schematic structural diagram of a device for querying feature data provided by an embodiment of the present application.
[0029] Figure 5 FIG. is a schematic structural diagram of a device for user registration query provided by an embodiment of the present application.
[0030] Figure 6 FIG. is a schematic structural diagram of an electronic device provided by an embodiment of the present application.
[0031] Figure 7 FIG. is a schematic structural diagram of another electronic device provided by an embodiment of the present application. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0032] The following will clearly and completely describe the technical solutions in the embodiments of the present application with reference to the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts belong to the scope of protection of the present application. The accompanying drawing numbers in the present application are only used to distinguish each step in the solution and are not used to limit the execution order of each step. The specific execution order shall be subject to the description in the specification.
[0033] As described in the background art, when there are more and more feature data in the registration feature pool, when querying the feature data, it is often necessary to compare a feature data to be queried with a large number of feature data in the registration feature pool one by one, and obtain multiple comparison results. Finally, determine a feature data with the highest score from these multiple comparison results, which makes the query efficiency of the feature data relatively low.
[0034] In response to this, the embodiments of the present application provide a method for querying feature data, which can pre-divide the feature data in the registration feature pool into multiple feature data sets, and each feature data set contains multiple feature data. In this way, when there is a need to retrieve feature data, a multi-threaded task can be created. Through multi-threaded concurrent tasks, the target feature data to be retrieved is simultaneously compared with multiple feature data sets to obtain the similarity score corresponding to the feature data closest to the target feature data. Finally, based on the similarity score, the query result of the target feature data can be determined. Since the feature data in the registration feature pool, after being divided into multiple feature data sets, the quantity level of each feature data set is much smaller than that of all the feature data in the original registration feature pool. Therefore, when executing the multi-threaded task, the target feature data to be retrieved is simultaneously compared with multiple feature data sets in parallel, which can greatly improve the feature comparison efficiency, and thus can improve the query efficiency of the feature data.
[0035] As Figure 1 shown, the solution provided by the embodiments of the present application includes:
[0036] S110, create a multi-threaded task to compare the target feature data to be retrieved with multiple feature data sets to obtain a comparison result, and the comparison result includes the similarity score corresponding to the feature data closest to the target feature data.
[0037] Among them, the multiple feature data sets are obtained by dividing the feature data in the registration feature pool, and each feature data set includes at least one feature data.
[0038] It should be noted that in this embodiment, the number of multi-threaded tasks created corresponds to the number of multiple feature data sets. When performing feature comparison on the target feature data, each thread task completes the comparison of one feature data set with the target feature data.
[0039] Optionally, in order to make full use of the thread cores in the thread pool and avoid wasting the thread core resources in the thread pool, the feature data in the registered feature pool can be divided into multiple feature data sets based on the number of thread cores in the thread pool. Specifically, the method for dividing the feature data in the registered feature pool includes:
[0040] When the first number of the feature data in the registered feature pool is greater than the number of thread cores in the thread pool, based on the number of thread cores, the feature data in the registered feature pool is divided into multiple feature data sets, and the number of the multiple feature data sets is the same as the number of thread cores;
[0041] When the first number of the feature data in the registered feature pool is less than or equal to the number of thread cores in the thread pool, based on the first number, the feature data in the registered feature pool is divided into multiple feature data sets, and the number of the multiple feature data sets is the same as the first number, that is, the number of the multiple feature data sets is the same as the number of the feature data.
[0042] As an example, after obtaining the feature data in the registered feature pool from the data warehouse, the first number N of the feature data in the registered feature pool and the number of thread cores corePoolSize in the thread pool can be determined, and the magnitudes of N and corePoolSize can be compared. If N > corePoolSize, the feature data in the registered feature pool is divided into corePoolSize feature data sets; if N ≤ corePoolSize, the feature data in the registered feature pool is divided into N feature data sets, and there is one feature data in one feature data set.
[0043] Among them, when N > corePoolSize, the following operations can be cyclically executed for i ∈ [0, corePoolSize - 1]: The N / corePoolSize × i-th feature among the N feature data is used as the first feature data in the i-th feature data set, and the N / corePoolSize × (i + 1)-th feature among the N feature data is used as the last feature data in the i-th feature data set, until the feature data in the corresponding feature data set is allocated for each thread pool.
[0044] Optionally, to avoid situations where the service nodes deploying the registration feature pool experience failures such as downtime, resulting in the inability to query the feature data in the registration feature pool, the registration feature pool in the embodiments of the present application can be deployed on multiple service nodes of a server cluster, and each service node includes at least one server. Specifically, when the registration feature pool is deployed on multiple service nodes of the server cluster, the creation of the multi-threaded task compares the target feature data to be retrieved with multiple feature data sets to obtain a comparison result, including:
[0045] Determine a target service node from multiple service nodes of the server cluster according to a preset rule;
[0046] Create a multi-threaded task to compare the target feature data with multiple feature data sets of the target service node to obtain a comparison result.
[0047] The preset rule can be a polling mechanism; when the registration feature pool is deployed on multiple service nodes of the server cluster, since the registration feature pools deployed on each service node are the same, to avoid waste of computing resources, a service node can be determined from multiple service nodes of the server cluster through the polling mechanism to perform the comparison operation of the feature data. Among them, the polling mechanism can determine which service node among multiple service nodes in the server cluster is used as the above-mentioned target service node according to a preset order. For example, the preset order is service node A, service node B, service node C... Assume that service node A was used as the target service node for the feature comparison operation in the previous feature comparison operation. Then, in the next feature comparison operation, according to this polling mechanism, service node B can be used as the target service node.
[0048] Optionally, to improve the query efficiency of the feature data, one thread task in the above multi-threaded task can correspond to one feature data set among multiple feature data sets. That is to say, each thread task corresponds to one feature data set, that is, one thread task performs the comparison operation between one feature data set and the target feature data to be retrieved.
[0049] As an example, to improve the comparison efficiency, each feature data set can be converted into a feature matrix, and the target feature data can be converted into a target feature matrix, and then the comparison between the feature matrices is performed. Specifically, creating a multi-threaded task to compare the target feature data to be retrieved with multiple feature data sets respectively includes:
[0050] Convert each feature data set in multiple feature data sets into a feature matrix;
[0051] Convert the target feature data into a target feature matrix;
[0052] Create multi-threaded tasks to perform feature comparison between the target feature matrix and the feature matrices corresponding to multiple feature data sets respectively.
[0053] Among them, creating multi-threaded tasks to perform feature comparison between the target feature matrix and the feature matrices corresponding to multiple feature data sets respectively can obtain multiple comparison results between the target feature matrix and the feature matrices corresponding to multiple feature data sets. Each comparison result contains the similarity scores between the target feature data and multiple feature data in each feature data set. The feature data with the highest similarity score can be determined from each comparison result in turn. Then, from the feature data with the highest similarity score in multiple comparison results, the feature data with the highest similarity score is determined. And when the similarity score is greater than the preset similarity threshold, it is determined that the target feature data has been registered in the registered feature pool.
[0054] S120. Determine the query result of the target feature data based on the similarity score.
[0055] It should be understood that a preset similarity threshold can be set. When the similarity score is greater than or equal to the preset similarity threshold, it can be determined that the target feature data has been registered in the registered feature pool. And when the similarity score is less than the preset similarity threshold, it can be determined that the target feature data is not registered in the registered feature pool.
[0056] Optionally, when the target feature data is not registered and there is a registration requirement for the target feature data, the method further includes:
[0057] When the query result of the target feature data determined based on the similarity score is non-existent, update the registered feature pool with the target data to be retrieved.
[0058] Optionally, when the registered feature pool is updated, in order to improve the efficiency of each service node in the server cluster to update the registered feature pool deployed by it, two definition parameters can be set on each service node. Each definition parameter has a switch state. Each time, only the data of the updated registered feature pool is assigned to the definition parameter with the parameter state off, that is, the definition parameter with an empty parameter value, and the parameter state is changed to on. At the same time, the other definition parameter with the parameter state on is cleared, and its parameter state is changed to off. Each service node of the multiple service nodes includes two definition parameters. The parameter states of the two definition parameters are set with switches, and the parameter states of the two definition parameters are different. Then, updating the registered feature pool with the target data to be retrieved includes:
[0059] Update the registered feature pool based on the target data to be retrieved to obtain the updated registered feature pool;
[0060] Determine the target definition parameter with the parameter state off from the two definition parameters of each service node of the multiple service nodes;
[0061] Assign the updated registered feature pool to the target definition parameters of each service node among multiple service nodes, and set the parameter status of the target definition parameters to on;
[0062] Set the status of the definition parameters other than the target definition parameters in each service node among multiple service nodes to off, and clear the values of the definition parameters other than the target definition parameters in each service node among multiple service nodes.
[0063] As an example, assume that the two parameters of each service node in the server cluster are param1 and param2, the parameter statuses of each service node in the server cluster are the same, and the memory data is the same. When there is an update to the registered feature pool, a request gateway route can be sent, and the gateway broadcasts the request to each service node. After each service node receives the request, it pulls the data of the latest registered feature pool from the data warehouse, and determines which definition parameter of each service node to update the registered feature pool data to by judging the switches corresponding to the two definition parameters param1 and param2 in each service node.
[0064] Specifically, assume that the parameter status of the definition parameter param1 of each service node is on, and the parameter status of the definition parameter param2 is off. First, determine the target definition parameter param2 with the parameter status off from the two definition parameters param1 and param2 of each service node among multiple service nodes; then assign the updated registered feature pool to the target definition parameter param2 of each service node among multiple service nodes, and change the parameter status of the target definition parameter param2 to on; finally, change the status of the definition parameter param1 in each service node among multiple service nodes to off, and clear the value of the definition parameter param1 in each service node among multiple service nodes. This can ensure that each time the registered feature pool is updated, the updated registered feature pool is assigned to the definition parameter with an empty parameter value, which can improve the data update efficiency of each service node.
[0065] Optionally, in the case where the time difference between two adjacent changes of the registered feature pool is small, to avoid the update of the registered feature pool affecting the previous feature data query, during the process of assigning the updated registered feature pool to the target definition parameters of each service node among multiple service nodes, a locking operation can be performed on the target definition parameters, so that the target definition parameters cannot be operated by other threads during the locking period.
[0066] It should be understood that when performing a locking operation on the target definition parameters, only the update thread can operate on the target definition parameters, and other threads cannot operate on the definition parameters.
[0067] Optionally, on the premise that the above service node includes two defined parameters, when loading the data in the registration feature pool, since the value of the defined parameter with the parameter status being off is empty, the value of the defined parameter with the parameter status being on in the service node needs to be loaded. Specifically, the method for dividing the feature data in the registration feature pool includes:
[0068] Obtain the registration feature pool corresponding to the value of the defined parameter with the parameter status being on in the target service node, where the target service node is any one of the multiple service nodes in the server cluster;
[0069] Divide the feature data in the registration feature pool into multiple feature data sets.
[0070] Figure 2 It is an example diagram of an actual scenario of the application of the query method for feature data provided by an embodiment of the present application, including:
[0071] S21, Obtain N pieces of feature data in the registration feature pool from the data warehouse.
[0072] S22, There are update operations such as addition / deletion / modification on the N pieces of feature data in the registration feature pool.
[0073] S23, Send a data update request to each service node in the server cluster.
[0074] S24, Judge the parameter status in each service node of the server cluster.
[0075] S25, Assign the updated registration feature pool to the defined parameter with the parameter status being off in each service node, and change the parameter status of this defined parameter to on.
[0076] When assigning the updated registration feature pool to the defined parameter with the parameter status being off in each service node, lock this defined parameter.
[0077] S26, Clear the parameter value of the defined parameter with the parameter status being on in each service node, and change the parameter status of this defined parameter to off.
[0078] S27, Load the registration feature pool corresponding to the value of the defined parameter with the parameter status being on in the service node.
[0079] S28, Divide the feature data in the registration feature pool into multiple feature data sets.
[0080] S29, Convert each feature data set into a feature matrix.
[0081] S210, Convert the target feature data to be retrieved into a target feature matrix.
[0082] S211. Create multi-threaded tasks to perform feature comparison between the target feature matrix and multiple feature matrices respectively, and obtain the comparison results.
[0083] S212. Determine whether the target feature data is registered based on the similarity score.
[0084] By using the feature data query method provided in the embodiments of the present application, the feature data in the registered feature pool can be pre-divided into multiple feature data sets, and each feature data set contains multiple feature data. In this way, when there is a need to retrieve feature data, multi-threaded tasks can be created, and through multi-threaded concurrent tasks, the target feature data to be retrieved can be simultaneously compared with multiple feature data sets for features, obtaining the similarity score corresponding to the feature data closest to the target feature data. Finally, based on the similarity score, the query result of the target feature data can be determined. Since the feature data in the registered feature pool is divided into multiple feature data sets, the order of magnitude of each feature data set is much smaller than that of all the feature data in the original registered feature pool. Therefore, when performing multi-threaded tasks, concurrent comparison of the target feature data to be retrieved with multiple feature data sets can greatly improve the feature comparison efficiency, and thus improve the query efficiency of feature data.
[0085] To solve the problems existing in the prior art, as Figure 3 shown, the embodiments of the present application further provide a user registration query method, including:
[0086] S310. Obtain the registration data of the target user;
[0087] S320. Create multi-threaded tasks to perform feature comparison between the registration data of the target user and multiple feature data sets, and obtain the comparison results, where the comparison results include the similarity score corresponding to the feature data closest to the registration data of the target user;
[0088] Among them, the multiple feature data sets are obtained by dividing the feature data in the registered feature pool of the target application, and each feature data set includes multiple feature data.
[0089] Among them, the registration data of the target user can be obtained through the target application; the target application can be any application that requires users to register and have their own personal accounts to use, such as chat applications, shopping applications, payment applications, and ticket purchase applications.
[0090] It should be understood that the specific implementation manner of step S320 is the same as that of Figure 1 step S110 in the embodiment, and will not be elaborated here.
[0091] S330. Obtain the registration query result of the target user.
[0092] It should be understood that the specific implementation manner of step S330 is the same as Figure 1 the implementation manner of step S120 in the embodiment, and will not be elaborated here.
[0093] Figure 3 For the specific implementation of the relevant steps in the illustrated embodiment, reference can be made to Figures 1 - 2 the specific implementation of the corresponding steps in the illustrated embodiment, and this specification will not elaborate here.
[0094] By using the user registration query method provided in the embodiment of the present application, the feature data in the registration feature pool of the target application can be pre-divided into multiple feature data sets, and each feature data set contains multiple feature data. In this way, when there is a registration query requirement for a target user, a multi-threaded task can be created, and through multi-threaded concurrent tasks, the registration data of the target user can be simultaneously compared with multiple feature data sets to obtain the similarity score corresponding to the registration data of the target user and the closest registration data. Finally, based on the similarity score, it can be determined whether the target user has registered the target application. Since the feature data in the registration feature pool is divided into multiple feature data sets, the order of magnitude of each feature data set is much smaller than that of all the feature data in the original registration feature pool. Therefore, when performing multi-threaded tasks, the registration data of the target user can be concurrently compared with multiple registration data sets, which can greatly improve the registration data comparison efficiency, and further greatly improve the registration query efficiency of the target user.
[0095] To solve the problems existing in the prior art, as Figure 4 shown, the embodiment of the present application further provides a query device 400 for feature data, including:
[0096] A feature comparison unit 401, configured to create a multi-threaded task to perform feature comparison on the target feature data to be retrieved with multiple feature data sets, and obtain a comparison result, where the comparison result includes a similarity score corresponding to the feature data closest to the target feature data; the multiple feature data sets are obtained by dividing the feature data in the registration feature pool, and each feature data set includes multiple feature data;
[0097] A data query unit 402, configured to determine the query result of the target feature data based on the similarity score.
[0098] The query device for feature data provided in the embodiment of the present application can pre-divide the feature data in the registered feature pool into multiple feature data sets, and each feature data set contains multiple feature data. In this way, when there is a need to retrieve feature data, a multi-threaded task can be created, and through multi-threaded concurrent tasks, the target feature data to be retrieved can be compared with multiple feature data sets simultaneously to obtain the similarity score corresponding to the target feature data and the closest feature data. Finally, based on the similarity score, the query result of the target feature data can be determined. Since the feature data in the registered feature pool is divided into multiple feature data sets, the order of magnitude of each feature data set is much smaller than that of all the feature data in the original registered feature pool. Therefore, when performing a multi-threaded task, the target feature data to be retrieved is compared with multiple feature data sets concurrently, which can greatly improve the feature comparison efficiency and thus improve the query efficiency of feature data.
[0099] Optionally, in one implementation, the device further includes a data division unit. When dividing the feature data in the registered feature pool, the data division unit specifically performs:
[0100] When the first quantity of the feature data in the registered feature pool is greater than the number of thread cores in the thread pool, based on the number of thread cores, divide the feature data in the registered feature pool into multiple feature data sets, and the number of the multiple feature data sets is the same as the number of thread cores;
[0101] When the first quantity of the feature data in the registered feature pool is less than or equal to the number of thread cores in the thread pool, based on the first quantity, divide the feature data in the registered feature pool into multiple feature data sets, and the number of the multiple feature data sets is the same as the first quantity.
[0102] Optionally, in one implementation, the registered feature pool is deployed on multiple service nodes of a server cluster;
[0103] When the feature comparison unit 401 creates a multi-threaded task to compare the target feature data to be retrieved with multiple feature data sets to obtain a comparison result, it specifically performs:
[0104] Determine a target service node from multiple service nodes of the server cluster according to a preset rule;
[0105] Create the multi-threaded task to compare the target feature data with multiple feature data sets of the target service node to obtain the comparison result.
[0106] Optionally, in one implementation, the device further includes:
[0107] An update unit, configured to update the registered feature pool with the target data to be retrieved when it is determined based on the similarity score that the target feature data is unregistered.
[0108] Optionally, in an implementation, each service node of the multiple service nodes includes two defined parameters, switches are set for the parameter statuses of the two defined parameters, and the parameter statuses of the two defined parameters are different. When the update unit updates the registered feature pool with the target data to be retrieved, it specifically performs:
[0109] Update the registered feature pool based on the target data to be retrieved to obtain an updated registered feature pool;
[0110] Determine a target defined parameter with a parameter status of off from the two defined parameters of each service node of the multiple service nodes;
[0111] Assign the updated registered feature pool to the target defined parameter of each service node of the multiple service nodes, and set the parameter status of the target defined parameter to on;
[0112] Set the statuses of the defined parameters other than the target defined parameter in each service node of the multiple service nodes to off, and clear the values of the defined parameters other than the target defined parameter in each service node of the multiple service nodes.
[0113] Optionally, in an implementation, the apparatus further includes:
[0114] A parameter locking unit, configured to perform a locking operation on the target defined parameter during the process of assigning the updated registered feature pool to the target defined parameter of each service node of the multiple service nodes, so that the target defined parameter is not operated by other threads during the locking period.
[0115] Optionally, in an implementation, when the data partitioning unit partitions the feature data in the registered feature pool, it specifically performs:
[0116] Obtain the registered feature pool corresponding to the value of the defined parameter with a parameter status of on in the target service node, where the target service node is any one of the multiple service nodes in the server cluster;
[0117] Partition the feature data in the registered feature pool into multiple feature data sets.
[0118] Among them, the above modules in the query device for feature data provided by the embodiments of the present application can also implement the steps of the feature data query method provided by the embodiments of the feature data query method. Alternatively, the device provided by the embodiments of the present application may further include other modules in addition to the above modules to implement the steps of the feature data query method provided by the above method embodiments. And the device provided by the embodiments of the present application can achieve the technical effects that the embodiments of the feature data query method can achieve.
[0119] To solve the problems existing in the prior art, such as Figure 5 As shown, the embodiments of the present application further provide a user registration query device 500, including:
[0120] A data acquisition unit 501, configured to acquire registration data of a target user;
[0121] A feature comparison unit 502, configured to create a multi-threaded task to perform feature comparison between the registration data of the target user and multiple feature data sets, and obtain a comparison result, where the comparison result includes a similarity score corresponding to the feature data closest to the registration data of the target user;
[0122] A data query unit 503, configured to obtain a registration query result of the target user.
[0123] By using the user registration query device provided by the embodiments of the present application, the feature data in the registration feature pool of the target application can be divided into multiple feature data sets in advance, and each feature data set contains multiple feature data. In this way, when there is a registration query requirement for a target user, a multi-threaded task can be created, and through multi-threaded concurrent tasks, the registration data of the target user can be simultaneously compared with multiple feature data sets to obtain the similarity score corresponding to the feature data closest to the registration data of the target user. Finally, based on the similarity score, it can be determined whether the target user has registered the target application. Since the feature data in the registration feature pool is divided into multiple feature data sets, the order of magnitude of each feature data set is much smaller than that of all the feature data in the original registration feature pool. Therefore, when performing a multi-threaded task, the registration data of the target user can be concurrently compared with multiple registration data sets at the same time, which can greatly improve the registration data comparison efficiency, and thus can greatly improve the registration query efficiency of the target user.
[0124] Among them, the above modules in the user registration query device provided by the embodiments of the present application can also implement the steps of the user registration query method provided by the embodiments of the above user registration query method. Alternatively, the device provided by the embodiments of the present application may further include other modules in addition to the above modules to implement the steps of the user registration query method provided by the above method embodiments. And the device provided by the embodiments of the present application can achieve the technical effects that the embodiments of the above user registration query method can achieve.
[0125] Figure 6 It is a schematic structural diagram of an electronic device according to an embodiment of this specification. Please refer to Figure 6 , at the hardware level, the electronic device includes a processor, and optionally also includes an internal bus, a network interface, and a memory. Among them, the memory may include internal memory, such as high-speed random access memory (Random-Access Memory, RAM), and may also include non-volatile memory, such as at least one disk memory, etc. Of course, the electronic device may also include other hardware required for other services.
[0126] The processor, network interface, and memory can be interconnected through an internal bus, and the internal bus can be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus, or an EISA (Extended Industry Standard Architecture) bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 6 only a bidirectional arrow is used in
[0127] The memory is used to store programs. Specifically, the program may include program code, and the program code includes computer operation instructions. The memory may include internal memory and non-volatile memory, and provide instructions and data to the processor.
[0128] The processor reads the corresponding computer program from the non-volatile memory into the internal memory and then runs it, forming a query device for feature data at the logical level. The processor executes the program stored in the memory and is specifically used to perform the following operations:
[0129] Create a multi-threaded task to perform feature comparison between the target feature data to be retrieved and multiple feature data sets, and obtain a comparison result, where the comparison result includes a similarity score corresponding to the closest feature data; the multiple feature data sets are obtained by partitioning the feature data in the registered feature pool, and each feature data set includes multiple feature data;
[0130] Determine the query result of the target feature data based on the similarity score.
[0131] The electronic device provided by the embodiment of the present application can pre-partition the feature data in the registered feature pool into multiple feature data sets, and each feature data set contains multiple feature data. In this way, when there is a need to retrieve feature data, a multi-threaded task can be created, and through multi-threaded concurrent tasks, the target feature data to be retrieved is simultaneously compared with multiple feature data sets to obtain the similarity score corresponding to the target feature data and the closest feature data. Finally, the query result of the target feature data can be determined based on the similarity score. Since the feature data in the registered feature pool is partitioned into multiple feature data sets, the order of magnitude of each feature data set is much smaller than that of all the feature data in the original registered feature pool. Therefore, when performing a multi-threaded task, the target feature data to be retrieved is simultaneously compared with multiple feature data sets in parallel, which can greatly improve the feature comparison efficiency and thus improve the query efficiency of feature data.
[0132] The above is as described in this specification Figures 1 - 2The method executed by the query device for the feature data disclosed in the illustrated embodiments can be applied to or implemented by a processor. The processor may be an integrated circuit chip with the ability to process signals. During implementation, the steps of the above method can be completed by the integrated logic circuit in hardware or instructions in software form in the processor. The above-mentioned processor may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it may also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. It can implement or execute the various methods, steps, and logic block diagrams disclosed in the embodiments of this specification. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc. The steps of the method disclosed in combination with the embodiments of this specification can be directly embodied as being executed and completed by a hardware decoding processor, or executed and completed by a combination of hardware and software modules in the decoding processor. The software module may be located in a mature storage medium in the art such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. This storage medium is located in the memory, and the processor reads the information in the memory and combines its hardware to complete the steps of the above method.
[0133] The electronic device can also execute Figures 1 - 2 the method and implement the functions of the query device for feature data in Figures 1 - 2 the illustrated embodiments, which will not be elaborated herein in the embodiments of this specification.
[0134] The embodiments of this specification also propose a computer-readable storage medium that stores one or more programs. The one or more programs include instructions that, when executed by a portable electronic device including multiple application programs, can enable the portable electronic device to execute Figures 1 - 2 the method in the illustrated embodiments and are specifically used to perform the following operations:
[0135] Create a multi-threaded task to perform feature comparison between the target feature data to be retrieved and multiple feature data sets, and obtain a comparison result. The comparison result includes a similarity score corresponding to the closest feature data; the multiple feature data sets are obtained by dividing the feature data in the registered feature pool, and each feature data set includes multiple feature data;
[0136] Determine the query result of the target feature data based on the similarity score.
[0137] The computer-readable storage medium provided by the embodiments of the present application can pre-divide the feature data in the registration feature pool into multiple feature data sets, and each feature data set contains multiple feature data. In this way, when there is a need for feature data retrieval, a multi-threaded task can be created. Through multi-threaded concurrent tasks, the target feature data to be retrieved is simultaneously compared with multiple feature data sets to obtain the similarity score corresponding to the target feature data and the closest feature data. Finally, the query result of the target feature data can be determined based on the similarity score. Since the feature data in the registration feature pool is divided into multiple feature data sets, the order of magnitude of each feature data set is much smaller than that of all the feature data in the original registration feature pool. Therefore, when executing the multi-threaded task, the target feature data to be retrieved is simultaneously compared with multiple feature data sets in parallel, which can greatly improve the feature comparison efficiency, and thus improve the query efficiency of the feature data.
[0138] Figure 7 It is a schematic structural diagram of an electronic device according to an embodiment of the present specification. Please refer to Figure 7 , at the hardware level, the electronic device includes a processor, and optionally also includes an internal bus, a network interface, and a memory. Among them, the memory may include internal memory, such as high-speed random access memory (Random-Access Memory, RAM), and may also include non-volatile memory, such as at least one disk memory, etc. Of course, the electronic device may also include other hardware required for other services.
[0139] The processor, network interface, and memory can be interconnected through an internal bus, and the internal bus can be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus, or an EISA (Extended Industry Standard Architecture) bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For the sake of representation, Figure 7 only a bidirectional arrow is used in
[0140] A memory for storing programs. Specifically, the program may include program code, and the program code includes computer operation instructions. The memory may include a memory and a non-volatile memory, and provides instructions and data to the processor.
[0141] The processor reads the corresponding computer program from the non-volatile memory into the memory and then runs it, forming a user registration query device for feature data at the logical level. The processor executes the program stored in the memory and is specifically used to perform the following operations:
[0142] Obtain the registration data of the target user;
[0143] Create a multi-threaded task to perform feature comparison between the registration data of the target user and multiple feature data sets, and obtain a comparison result, where the comparison result includes a similarity score corresponding to the feature data closest to the registration data of the target user;
[0144] Obtain the registration query result of the target user.
[0145] The electronic device provided by the embodiment of the present application can pre-divide the feature data in the registration feature pool of the target application into multiple feature data sets, and each feature data set contains multiple feature data. In this way, when there is a registration query requirement for the target user, a multi-threaded task can be created, and through multi-threaded concurrent tasks, the registration data of the target user can be simultaneously compared with multiple feature data sets to obtain the similarity score corresponding to the registration data closest to the registration data of the target user. Finally, based on the similarity score, it can be determined whether the target user has registered the target application. Since the feature data in the registration feature pool is divided into multiple feature data sets, the order of magnitude of each feature data set is much smaller than that of all the feature data in the original registration feature pool. Therefore, when performing a multi-threaded task, the registration data of the target user is simultaneously compared with multiple registration data sets in parallel, which can greatly improve the registration data comparison efficiency, and thus can greatly improve the registration query efficiency of the target user.
[0146] The above is as described in this specification Figure 3The method executed by the user registration query device for the feature data disclosed in the illustrated embodiment can be applied to or implemented by a processor. The processor may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the integrated logic circuit in the hardware of the processor or by instructions in the form of software. The above processor may be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc.; it may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. It can implement or execute the various methods, steps, and logic block diagrams disclosed in the embodiments of this specification. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc. The steps of the method disclosed in combination with the embodiments of this specification can be directly embodied as being executed by the hardware decoding processor, or executed by a combination of the hardware and software modules in the decoding processor. The software module may be located in a mature storage medium in the art such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. This storage medium is located in the memory, and the processor reads the information in the memory and combines its hardware to complete the steps of the above method.
[0147] The electronic device can also execute Figure 3 the method, and implement the functions of the user registration query device for feature data in Figure 3 the illustrated embodiment, which will not be elaborated herein in the embodiments of this specification.
[0148] The embodiments of this specification also propose a computer-readable storage medium that stores one or more programs. The one or more programs include instructions that, when executed by a portable electronic device including multiple application programs, can enable the portable electronic device to execute Figure 5 the method in the illustrated embodiment, and specifically be used to perform the following operations:
[0149] Obtain the registration data of the target user;
[0150] Create a multi-threaded task to perform feature comparison between the registration data of the target user and multiple feature data sets, and obtain a comparison result, where the comparison result includes a similarity score corresponding to the feature data that is closest to the registration data of the target user.
[0151] Obtain the registration query result of the target user.
[0152] The computer-readable storage medium provided by the embodiments of the present application can pre-divide the feature data in the registration feature pool of the target application into multiple feature data sets, and each feature data set contains multiple feature data. In this way, when there is a registration query requirement for the target user, a multi-threaded task can be created, and through multi-threaded concurrent tasks, the registration data of the target user can be simultaneously compared with multiple feature data sets to obtain the similarity score corresponding to the registration data of the target user and the closest registration data. Finally, based on the similarity score, it can be determined whether the target user has registered the target application. Since the feature data in the registration feature pool is divided into multiple feature data sets, the order of magnitude of each feature data set is much smaller than that of all the feature data in the original registration feature pool. Therefore, when executing the multi-threaded task, the registration data of the target user can be concurrently compared with multiple registration data sets, which can greatly improve the registration data comparison efficiency and thus greatly improve the registration query efficiency of the target user.
[0153] Of course, in addition to the software implementation method, the electronic device described in this specification does not exclude other implementation methods, such as logical devices or a combination of software and hardware, etc. That is to say, the execution subject of the following processing flow is not limited to each logical unit, but can also be hardware or a logical device.
[0154] The specific embodiments of this specification are described above. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims can be executed in a different order from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or sequential order shown to achieve the desired results. In certain embodiments, multi-tasking and parallel processing are also possible or may be advantageous.
[0155] In summary, the above are only the preferred embodiments of this specification and are not used to limit the protection scope of this specification. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of this specification shall be included in the protection scope of this specification.
[0156] The systems, devices, modules or units illustrated in the above embodiments can be specifically implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, the computer can be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or any combination of these devices.
[0157] Computer-readable media includes both permanent and non-permanent, removable and non-removable media and can be implemented by any method or technology for information storage. The information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, magnetic tape disk storage or other magnetic storage devices, or any other non-transitory media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include transitory computer-readable media such as modulated data signals and carrier waves.
[0158] It should also be noted that the term "including", "comprising" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements not only includes those elements, but also includes other elements not expressly listed, or elements inherent to such process, method, commodity or device. Without further limitation, an element defined by the statement "including one..." does not exclude the presence of additional identical elements in the process, method, commodity or device including the said element.
[0159] Each embodiment in this specification is described in a progressive manner. The same or similar parts among the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the description of the method embodiment.
Claims
1. A method for querying feature data, characterized in that, Including: Obtain the registered feature pool corresponding to the value of the defined parameter with the parameter status of "on" in the target service node, and divide the feature data of the registered feature pool into multiple feature data sets; wherein, the registered feature pool is deployed on multiple service nodes of the server cluster, and the multiple service nodes include the target service node. Each service node contains two defined parameters, and the parameter status of each defined parameter includes "on" and "off"; for each service node, when the data in the registered feature pool is updated, assign the updated data in the registered feature pool to the defined parameter with the parameter status of "off", change the parameter status of the assigned defined parameter to "on", and clear the unassigned defined parameter. At the same time, change the parameter status of the unassigned defined parameter to "off". Create a multi-threaded task to perform feature comparison between the target feature data to be retrieved and the multiple feature data sets to obtain a comparison result, where the comparison result includes a similarity score corresponding to the feature data closest to the target feature data; the feature data set includes at least one feature data. Determine the query result of the target feature data based on the similarity score.
2. The method according to claim 1, wherein The method for dividing the feature data in the registered feature pool includes: When the first quantity of the feature data in the registered feature pool is greater than the number of thread cores in the thread pool, divide the feature data in the registered feature pool into multiple feature data sets based on the number of thread cores, and the number of the multiple feature data sets is the same as the number of thread cores. When the first quantity of the feature data in the registered feature pool is less than or equal to the number of thread cores in the thread pool, divide the feature data in the registered feature pool into multiple feature data sets based on the first quantity, and the number of the multiple feature data sets is the same as the first quantity.
3. The method according to claim 1, wherein The creation of the multi-threaded task to perform feature comparison between the target feature data to be retrieved and multiple feature data sets to obtain a comparison result includes: Determine the target service node from multiple service nodes of the server cluster according to a preset rule. Create the multi-threaded task to perform feature comparison between the target feature data and the multiple feature data sets of the target service node to obtain the comparison result.
4. The method according to claim 3, wherein The method further includes: When it is determined based on the similarity score that the query result of the target feature data does not exist, update the registered feature pool with the target data to be retrieved.
5. The method according to claim 4, characterized in that The parameter statuses of the two defined parameters are different. Updating the registered feature pool with the target data to be retrieved includes: Based on the target data to be retrieved, update the registered feature pool to obtain an updated registered feature pool. Determine the target defined parameter with the parameter status of "off" from the two defined parameters of each service node of the multiple service nodes. Assign the updated registered feature pool to the target defined parameter of each service node of the multiple service nodes, and set the parameter status of the target defined parameter to "on". Set the status of the defined parameters other than the target defined parameter in each service node of the multiple service nodes to off, and clear the values of the defined parameters other than the target defined parameter in each service node of the multiple service nodes.
6. The method according to claim 5, wherein The method further includes: During the process of assigning the updated registration feature pool to the target defined parameter of each service node of the multiple service nodes, perform a locking operation on the target defined parameter so that the target defined parameter cannot be operated by other threads during the locking period.
7. A user registration query method, characterized in that, It includes: Obtain the registration data of the target user; Obtain the registration feature pool corresponding to the value of the defined parameter with the parameter status of on in the target service node, and divide the feature data of the registration feature pool into multiple feature data sets; wherein, the registration feature pool is deployed on multiple service nodes of the server cluster, the multiple service nodes include the target service node, each service node contains two defined parameters, and the parameter status of each defined parameter includes on and off; for each service node, when the data in the registration feature pool is updated, assign the updated data of the registration feature pool to the defined parameter with the parameter status of off, change the parameter status of the assigned defined parameter to on, and clear the unassigned defined parameter, and at the same time change the parameter status of the unassigned defined parameter to off; Create a multi-threaded task to perform feature comparison between the registration data of the target user and the multiple feature data sets, and obtain a comparison result, where the comparison result includes a similarity score corresponding to the feature data closest to the registration data of the target user; the feature data set includes at least one feature data; Obtain the registration query result of the target user.
8. A query device for feature data, characterized in that, It includes: A division unit, configured to obtain the registration feature pool corresponding to the value of the defined parameter with the parameter status of on in the target service node, and divide the feature data of the registration feature pool into multiple feature data sets; wherein, the registration feature pool is deployed on multiple service nodes of the server cluster, the multiple service nodes include the target service node, each service node contains two defined parameters, and the parameter status of each defined parameter includes on and off; for each service node, when the data in the registration feature pool is updated, assign the updated data of the registration feature pool to the defined parameter with the parameter status of off, change the parameter status of the assigned defined parameter to on, and clear the unassigned defined parameter, and at the same time change the parameter status of the unassigned defined parameter to off; A feature comparison unit, configured to create a multi-threaded task to perform feature comparison between the target feature data to be retrieved and the multiple feature data sets, and obtain a comparison result, where the comparison result includes a similarity score corresponding to the feature data closest to the target feature data; the feature data set includes multiple feature data; A data query unit, configured to determine the query result of the target feature data based on the similarity score.
9. An electronic device, characterized in that, It includes: A memory, a processor, and stored in the memory A computer program stored on a memory and executable on the processor, which, when executed by the processor, implements the steps of the method according to any one of claims 1 to 6.
10. A computer-readable storage medium, characterized in that, A computer program is stored on the computer-readable storage medium, which, when executed by a processor, implements the steps of the method according to any one of claims 1 to 6.
11. A user registration query device, characterized in that, Comprising: A data acquisition unit for acquiring registration data of a target user; A division unit for obtaining a registration feature pool corresponding to the values of the defined parameters with the parameter status of "on" in the target service node, and dividing the feature data of the registration feature pool into multiple feature data sets; wherein, the registration feature pool is deployed on multiple service nodes of a server cluster, the multiple service nodes include the target service node, each service node contains two defined parameters, and the parameter status of each defined parameter includes "on" and "off"; for each service node, when the data in the registration feature pool is updated, the updated data in the registration feature pool is assigned to the defined parameter with the parameter status of "off", and the parameter status of the assigned defined parameter is changed to "on", and the unassigned defined parameter is cleared, and at the same time, the parameter status of the unassigned defined parameter is changed to "off"; A feature comparison unit for creating a multi-threaded task to compare the registration data of the target user with the multiple feature data sets and obtain a comparison result, the comparison result including a similarity score corresponding to the feature data closest to the registration data of the target user; the feature data sets include multiple feature data; A data query unit for obtaining a registration query result of the target user.
Citation Information
Patent Citations
Face retrieval method and apparatus as well as storage medium and device
CN108108499A
Data analysis system serving electronic government affairs
CN109658311A
Data comparison method and device, computer equipment and storage medium
CN110765162A
Data query method and device, computer equipment and readable storage medium
CN110825732A