A face matching method, system, device and storage medium based on SQL
Patent Information
- Application Number
- CN202111642628.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-29
- Publication Date
- 2026-09-11
- Estimated Expiration
- 2041-12-29
AI Technical Summary
[0004]通常算法厂家提供的SDK demo都是基于c++语言,并且把一些dll文件和bin文件、模型文件都放到跟dll同一目录,非c++开发人员接入的话还是需要自己写不少代码,调试效率低、出错率高
[0034] All nodes in the MPP database cluster of this invention can call the plugin module. The plugin module can directly call the comparison function of the SDK module through the SQL query statement to realize the face matching similarity calculation. No application development is required, which simplifies the data processing steps and development difficulty, and improves efficiency.
Smart Images

Figure CN114328585B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of database data access, and in particular to a face matching method, system, device and storage medium based on SQL. Background Technology
[0002] In the past few years of rapid rise of smartphones, their locks have evolved from digital passwords and gesture unlocking to fingerprint recognition, and now to iris and facial recognition. It is foreseeable that, due to the widespread adoption of full-screen displays and the emergence of the more secure and convenient Face ID technology, fingerprint recognition will soon be abandoned by smartphone manufacturers, completing its historical mission.
[0003] Facial recognition is a biometric technology that identifies individuals based on their facial features. The input to a facial comparison algorithm is two facial features, and the output is the similarity between those two features. Currently, facial recognition algorithm vendors typically provide services in two ways: public / private cloud APIs and offline SDKs, allowing users to perform facial matching by calling facial similarity comparison interfaces.
[0004] Typically, the SDK demos provided by algorithm vendors are based on the C++ language, and they put some DLL files, BIN files, and model files in the same directory as the DLLs. Non-C++ developers still need to write a lot of code to integrate them, resulting in low debugging efficiency and a high error rate.
[0005] In addition, a single comparison using a public / private cloud API requires multiple HTTP interface calls, including face image data transmission, feature extraction, and feature comparison, resulting in low performance and a poor user experience; data storage capacity is limited, and expansion costs are high; face data is a matter of personal privacy, and SDKs typically only provide integration for application development, lacking consideration for the security of data in real-world application scenarios. Summary of the Invention
[0006] In order to overcome the shortcomings of the existing technology, one of the objectives of this invention is to provide a face matching method based on SQL, which can simplify the face matching data processing steps, reduce the difficulty of system debugging, and improve efficiency.
[0007] The second objective of this invention is to provide a face matching system based on SQL.
[0008] The third objective of this invention is to provide an electronic device.
[0009] The fourth objective of this invention is to provide a storage medium.
[0010] One of the objectives of this invention is achieved through the following technical solution:
[0011] A face matching method based on SQL includes:
[0012] Obtain the SQL statement and distribute the matching task corresponding to the SQL statement to multiple data nodes;
[0013] Each data node is controlled to call the corresponding plugin module to perform the matching task based on the face data in the SQL statement, and then the matching result is obtained and output.
[0014] Furthermore, after obtaining the SQL statement, the process also includes:
[0015] Obtain the identity information from the SQL statement;
[0016] Invoke the authentication component and verify the key pre-stored in the authentication component with the identity information;
[0017] If the verification is successful, the matching task is distributed to multiple data nodes;
[0018] If the verification fails, an error message will be displayed.
[0019] Furthermore, the distribution of the matching task to the multiple data nodes is achieved through the master node of the MPP database. The multiple data nodes are connected to the master node, and the master node distributes the matching task to the multiple data nodes according to the received SQL statement.
[0020] Furthermore, the plug-in module is connected to an SDK module, which pre-stores the comparison function corresponding to the face similarity matching algorithm.
[0021] Furthermore, the method for outputting the matching result is as follows:
[0022] The matching result is returned to the master node, and then pushed to the designated client for display via the master node.
[0023] The second objective of this invention is achieved by the following technical solution:
[0024] A face matching system based on SQL includes a master node, data nodes, and plug-in modules; the master node is connected to multiple data nodes, and each data node is connected to the plug-in module;
[0025] The master node is used to receive SQL statements submitted by the client and distribute matching tasks corresponding to the SQL statements to multiple data nodes.
[0026] The data node is used to call the plugin module to execute the matching task according to the received matching task, and return the matching result obtained by executing the matching task to the main node for pushing to the client.
[0027] Furthermore, the plug-in module is connected to an SDK module, which pre-stores the comparison function corresponding to the face similarity matching algorithm.
[0028] Furthermore, the plug-in module is also connected to an authentication component, which stores key information of relevant certificates; the plug-in module accesses the authentication component via a password to obtain the key and perform identity verification operations.
[0029] The third objective of this invention is achieved by the following technical solution:
[0030] An electronic device includes a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the above-described SQL-based face matching method.
[0031] The fourth objective of this invention is achieved by the following technical solution:
[0032] A computer-readable storage medium having a computer program stored thereon, which, when executed, implements the above-described SQL-based face matching method.
[0033] Compared with the prior art, the beneficial effects of the present invention are as follows:
[0034] All nodes in the MPP database cluster of this invention can call the plugin module. The plugin module can directly call the comparison function of the SDK module through the SQL query statement to realize the face matching similarity calculation. No application development is required, which simplifies the data processing steps and development difficulty, and improves efficiency.
[0035] In an MPP database cluster, the master node is connected to multiple data nodes, and each data node can perform face matching operations by calling the plugin model, which avoids network transmission latency issues. At the same time, the data storage capacity is only limited by the MPP database disk space, which facilitates subsequent expansion operations.
[0036] Each data node is connected to an authentication component, and access based on certificate verification ensures the legitimacy of data access and improves data transmission security. Attached Figure Description
[0037] Figure 1 This is a flowchart illustrating the SQL-based face matching method of the present invention.
[0038] Figure 2This is a schematic diagram of the SQL-based face matching system of the present invention. Detailed Implementation
[0039] The present invention will now be further described in conjunction with the accompanying drawings and specific embodiments. It should be noted that, without conflict, the various embodiments or technical features described below can be arbitrarily combined to form new embodiments.
[0040] Example 1
[0041] This embodiment provides a face matching method based on SQL. This method can directly call the face similarity comparison interface to achieve face matching, thereby improving matching efficiency. At the same time, it simplifies the system debugging difficulty and improves debugging efficiency. In addition, the system is highly flexible and reduces expansion costs. It can also improve data transmission security in practical application scenarios and ensure personal privacy security.
[0042] The SQL-based face matching method in this embodiment includes the following steps:
[0043] Step S1: Obtain the SQL statement and distribute the matching task corresponding to the SQL statement to multiple data nodes;
[0044] Step S2: Control each data node to call the corresponding plugin module, execute the matching task according to the face data in the SQL statement to obtain and output the matching result.
[0045] like Figure 1 , Figure 2 As shown, in this embodiment, a corresponding SQL statement can be submitted through a client based on a query request. The client sends the SQL statement to the master node in the MPP database cluster, and the master node then distributes the matching task corresponding to the SQL statement to each data node in the MPP database cluster. The learning cost of SQL statements is relatively low, reducing the difficulty of use. Furthermore, the MPP database is a large-scale parallel processing database, with each node having independent disk storage space. In this embodiment, the master node acts as the entry point for the MPP database, responsible for accepting client connections and submitted SQL statements, and distributing tasks to other data nodes.
[0046] Each data node is the actual executor of the matching task query. After receiving the matching task, each data node calls the plugin module to execute the SQL task and returns the result to the master node, which finally returns it to the client.
[0047] Each data node is connected to an SDK module, which pre-stores a face recognition algorithm development package and resource files. Each data node is also connected to a plugin module, which is responsible for receiving parameters corresponding to SQL statements, extracting identity information from these parameters for identity verification, converting the face data in the parameters into the data type required by the SDK, calling the SDK module's comparison function, and returning the result to the data node for matching task execution. In this embodiment, the plugin module is developed in Java, compiled into a JAR file format, and integrated into the MPP database. Ultimately, the Java functions in the plugin are registered as functions in the MPP database for SQL calls.
[0048] In this embodiment, each data node is connected to an authentication component (ukey), which stores the key information of the CA certificate. Before data transmission, the plug-in module accesses and obtains the key in the ukey via a password, and verifies the identity information in the SQL statement against the key. If the verification is successful, the master node can distribute the matching task to multiple data nodes to ensure data transmission security. If the verification fails, an error message is issued and returned to the master node to be pushed to the client.
[0049] In this embodiment, the plugin module can predefine a function prototype face.java, which has a comparison function with native methods (i.e., Java calling non-Java code) to connect to the face matching interface; the header file face.h corresponding to face.java is generated by javac -h, realizing the header file to connect to the C++ interface of the SDK module; then the header file is compiled using the CMake cross-platform compilation tool to compile the header file, realizing the compilation of the SDK and resource files into the corresponding link library.
[0050] Subsequently, the SDK's libraries are uploaded to the specified directory / usr / lib on each node. The dynamic link library management command (ldconfig command) is executed to ensure that the specified file / etc / ld.so.conf contains libraries that can be loaded from the specified directory / usr / lib. The plugin module references the libraries in the face.java file and compiles them into a jar file, which is then uploaded to the installation directory of all nodes of the MPP database. The jar file is then executed to load the plugin into the MPP database cluster.
[0051] In this embodiment, the plugin module converts the C++ SQL comparison function in the SDK module into a Java function using the above method. The SQL comparison function is registered using a face similarity matching algorithm. The plugin module converts the data type of the face in the SQL statement. Then, the data node matches the face data with the comparison function to calculate the face similarity matching result, thereby completing the matching task. The matching result is then returned to the main node and pushed to the designated client for display through the main node.
[0052] Example 2
[0053] This embodiment provides a face matching system based on SQL, such as Figure 2 As shown, it includes a master node, data nodes, and a plugin module; the master node is connected to multiple data nodes, and each data node is connected to a plugin module.
[0054] The master node is used to receive SQL statements submitted by the client and distribute matching tasks corresponding to the SQL statements to multiple data nodes.
[0055] The data node is used to call the plugin module to execute the matching task according to the received matching task, and return the matching result obtained by executing the matching task to the main node for pushing to the client.
[0056] In this embodiment of the MPP database cluster, the master node is connected to multiple data nodes, and each data node can perform face matching operation by calling the plugin model, which can avoid the problem of network transmission delay. At the same time, the data storage is only limited by the disk space of the MPP database, which facilitates subsequent expansion operations.
[0057] In this embodiment, all nodes in the MPP database cluster can call the plugin module. The plugin module is connected to the SDK module, which pre-stores the comparison function corresponding to the face similarity matching algorithm. The plugin module obtains the comparison function from the SDK module and uploads it to the corresponding data node, so that the data node uses the face data in the SQL statement to call the comparison function to perform face similarity matching calculation and obtain the matching result. This embodiment eliminates the need for secondary application development through plugin invocation, simplifies data processing steps and development difficulty, and improves system debugging efficiency.
[0058] In addition, to improve the security of facial data during transmission, this embodiment connects each plug-in module to a corresponding authentication component, which stores the key information of the relevant certificate. The plug-in module accesses the authentication component via a password to obtain the key and perform identity verification. Only when the identity verification is successful can subsequent query operations continue, thereby improving security.
[0059] Example 3
[0060] This embodiment provides an electronic device, which includes a processor, a memory, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the SQL-based face matching method in Embodiment 1. In addition, this embodiment also provides a storage medium storing a computer program thereon. When the computer program is executed, it implements the above-mentioned SQL-based face matching method.
[0061] The device and storage medium in this embodiment are two aspects of the method in the foregoing embodiments, based on the same inventive concept. The implementation process of the method has been described in detail above, so those skilled in the art can clearly understand the structure and implementation process of the device and storage medium in this embodiment based on the foregoing description. For the sake of brevity, it will not be described again here.
[0062] The above embodiments are merely preferred embodiments of the present invention and should not be construed as limiting the scope of protection of the present invention. Any non-substantial changes and substitutions made by those skilled in the art based on the present invention shall fall within the scope of protection claimed by the present invention.
Claims
1. A face matching method based on SQL, characterized in that, include: The SQL statement is obtained and the matching task corresponding to the SQL statement is distributed to multiple data nodes through the master node of the MPP database. Specifically, the corresponding SQL statement is submitted through the client according to the query request, and the client sends the SQL statement to the master node in the MPP database cluster. Each data node is controlled to call the corresponding plugin module to execute the matching task based on the face data in the SQL statement, and then output the matching result. Each data node is connected to an authentication component (ukey), which stores the key information of the CA certificate. Before data transmission, the plugin module accesses the key in the ukey via a password and verifies the identity information against the key in the SQL statement. The plugin module is developed in Java, compiled into a JAR file, and integrated into the MPP database. The Java functions in the plugin are registered as functions in the MPP database for SQL calls. A function prototype, face.java, is predefined, which contains a comparison function with native methods to interface with the face matching interface. The header file face.h corresponding to face.java is generated using javac-h, implementing the header file's interface with the C++ interface of the SDK module. The header file is then compiled using the CMake cross-platform compilation tool, compiling the SDK and resource files into corresponding libraries. The plugin module references the libraries in the face.java file and compiles them into a JAR file, which is then uploaded to the installation directory of all nodes in the MPP database. The JAR file is then executed to load the plugin into the MPP database cluster. The plug-in module is connected to the SDK module, which pre-stores the comparison function corresponding to the face similarity matching algorithm. The plug-in module converts the SQL comparison function in the SDK module into a Java function, which is registered through the face similarity matching algorithm. The plug-in module converts the data type of the face in the SQL statement and converts the face data in the parameters into the data type required by the SDK. Then, the data node matches the face data and the comparison function to calculate the face similarity matching result.
2. The SQL-based face matching method according to claim 1, characterized in that, After obtaining the SQL statement, the method further includes: obtaining the identity information in the SQL statement; Invoke the authentication component and verify the key pre-stored in the authentication component with the identity information; If the verification is successful, the matching task is distributed to multiple data nodes; If the verification fails, an error message will be displayed.
3. The SQL-based face matching method according to claim 1, characterized in that, The method for outputting the matching result is as follows: return the matching result to the main node, and push it to the specified client for display through the main node.
4. A face matching system based on SQL, characterized in that, It includes master nodes, data nodes, and plugin modules; The master node is connected to multiple data nodes, and each data node is connected to the plug-in module; The master node is used to receive SQL statements submitted by the client and distribute matching tasks corresponding to the SQL statements to multiple data nodes. Specifically, the client submits the corresponding SQL statement according to the query request and sends the SQL statement to the master node in the MPP database cluster. The data nodes are used to call the plugin module to execute the matching task according to the received matching task, and return the matching result obtained from the execution of the matching task to the main node for push to the client; each data node is connected to an authentication component ukey, which stores the key information of the CA certificate; before data transmission, the plugin module accesses and obtains the key in the ukey via password, and verifies the identity information with the key in the SQL statement; the plugin module is developed in Java, compiled into a jar file format and integrated into the MPP database, and the Java functions in the plugin are registered as functions in the MPP database for SQL calls; a function prototype face.java is predefined, which has a native method comparison function to interface with the face matching interface; the header text corresponding to face.java is generated through javac-h. The `face.h` file implements the C++ interface for the SDK module. The header file is then compiled using the CMake cross-platform compiler to create corresponding libraries from the SDK and resource files. The plugin module references these libraries in the `face.java` file and compiles them into a JAR file, which is then uploaded to the installation directory of all nodes in the MPP database. The JAR file is then executed to load the plugin into the MPP database cluster. The plugin module connects to the SDK module, which pre-stores comparison functions corresponding to the face similarity matching algorithm. The plugin module converts the SQL comparison functions in the SDK module into Java functions, which are registered using the face similarity matching algorithm. The plugin module performs data type conversion on the faces in the SQL statements. Finally, the data nodes match the face data with the comparison functions to calculate the face similarity matching result.
5. The SQL face matching system according to claim 4, characterized in that, The plug-in module is also connected to an authentication component, which stores key information of relevant certificates; the plug-in module accesses the authentication component via a password to obtain the key and perform identity verification operations.
6. An electronic device, characterized in that, It includes a processor, a memory, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the SQL-based face matching method according to any one of claims 1 to 3.
7. A computer-readable storage medium, characterized in that, It stores a computer program, which, when executed, implements the SQL-based face matching method according to any one of claims 1 to 3.
Citation Information
Patent Citations
Building door access control method, cloud server and computer-readable storage medium
CN108806041A
Content rapid compression method based on Greenplum large-scale parallel processing database
CN111597201A
Application implementation method and device
CN112000386A