Face recognition method, device, computer readable medium and electronic device

By building a blockchain network on terminal devices and downloading and storing facial data, the problem of waste of network traffic and storage resources during facial recognition is solved, efficient offline facial recognition is achieved and data security is improved.

CN113505260BActive Publication Date: 2024-12-03TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202110807730.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-07-16
Publication Date
2024-12-03
Estimated Expiration
2041-07-16

AI Technical Summary

Technical Problem

In the prior art, when performing facial recognition, it is necessary to store the face feature library offline at the terminal local, resulting in a large amount of network traffic and storage resources.

Method used

By using the terminal device as a blockchain node, a blockchain network is built, a block is downloaded and generated, a face-related data is stored on the blockchain, and searched through the blockchain network to realize offline facial recognition.

Benefits of technology

It reduces the network traffic and storage resource consumption of the face feature library stored locally in the terminal, while improving data security and protecting user privacy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113505260B_ABST
    Figure CN113505260B_ABST
Patent Text Reader

Abstract

The embodiment of the present application provides a face recognition method, device, computer-readable medium and electronic device, the method comprising: using a terminal device connected to a local area network as a blockchain node, forming a blockchain network for data communication in the local area network, the blockchain network comprising a target node and a query node; the target node downloads face-related data from a server, and generates a target block containing face-related data; the target block is stored on the target node, and the target block is broadcast on the blockchain network through the target node; when the query node receives the broadcasted chain information, the block record generated according to the chain information is stored on the query node; in response to a face recognition request, according to the block record stored on the query node, each block in the blockchain is traversed to obtain a face recognition result. The embodiment of the present application can reduce the consumption of network traffic and storage resources, and improve the security of user privacy data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of blockchain technology, and more specifically, to a face recognition method, device, computer-readable medium, and electronic device. Background Art

[0002] Currently, when performing face recognition, offline face recognition is mainly achieved by storing the face feature library offline locally in the terminal. However, the files of the face feature library are often very large. Therefore, storing the face feature library locally in the terminal not only consumes a lot of network traffic, but also occupies a lot of local storage resources, resulting in a waste of storage resources. Summary of the invention

[0003] The embodiments of the present application provide a face recognition method, device, computer-readable medium and electronic device, which can reduce, at least to a certain extent, the network traffic and storage resources consumed by storing a face feature library locally in a terminal.

[0004] Other features and advantages of the present application will become apparent from the following detailed description, or may be learned in part by the practice of the present application.

[0005] According to one aspect of an embodiment of the present application, a face recognition method is provided, the method comprising: using a terminal device for face recognition connected to a local area network as a blockchain node, establishing a blockchain network for data communication within the local area network, the blockchain network comprising a target node for generating and storing a target block and a query node for searching the target block; when the target node is connected to the Internet, downloading face-related data for offline storage from a server through the target node, and generating a target block containing the face-related data on the target node; saving the target block on the target node, and broadcasting the on-chain information of the target block on the blockchain network through the target node, the on-chain information being used to indicate the link relationship between the target block and other blocks on the blockchain; when the query node receives the on-chain information broadcasted in the blockchain network, saving a block record generated according to the on-chain information on the query node, the block record comprising a query path for searching the target block; in response to a face recognition request, traversing each block in the blockchain according to the block record saved on the query node to obtain a face recognition result.

[0006] According to one aspect of an embodiment of the present application, a face recognition device is provided, the device comprising: a building unit, used to use a terminal device for face recognition connected to a local area network as a blockchain node, to build a blockchain network for data communication within the local area network, the blockchain network comprising a target node for generating and storing a target block and a query node for searching the target block; a downloading and generating unit, used to download face-related data for offline storage from a server through the target node when the target node is connected to the Internet, and to generate a target block containing the face-related data on the target node; a saving and broadcasting unit, used to The target block is saved on the target node, and the on-chain information of the target block is broadcast on the blockchain network through the target node, wherein the on-chain information is used to indicate the link relationship between the target block and other blocks on the blockchain; a receiving and saving unit is used to save a block record generated according to the on-chain information on the query node when the query node receives the on-chain information broadcast in the blockchain network, wherein the block record includes a query path for finding the target block; a traversal unit is used to traverse each block in the blockchain in response to a face recognition request according to the block record saved on the query node to obtain a face recognition result.

[0007] In some embodiments of the present application, based on the aforementioned scheme, the downloading and generating unit is configured to: obtain the identification information of the target node and the first hash value in the block most recently added to the blockchain; determine the second hash value based on the identification information of the target node, the first hash value and the face-related data; generate a block based on the identification information of the target node, the face-related data, the first hash value and the second hash value.

[0008] In some embodiments of the present application, based on the aforementioned scheme, the downloading and generating unit is configured to: encrypt the face-related data to obtain encrypted face-related data; and pack the identification information of the target node, the encrypted face-related data, the first hash value and the second hash value into a block.

[0009] In some embodiments of the present application, based on the aforementioned scheme, the on-chain information includes a hash value and identification information of the target node, and the receiving and saving unit is configured as: when the query node receives the on-chain information broadcast in the blockchain network, the hash value and identification information of the target node contained in the on-chain information are saved as block records on the query node.

[0010] In some embodiments of the present application, based on the aforementioned scheme, the traversal unit is configured to: obtain the facial data in the facial recognition request; determine the query path of each block in the blockchain according to the hash value in the block record and the identification information of the node; according to the query path, send the facial data to each node in the blockchain network in turn, and each node searches in the stored blocks to obtain the facial recognition results returned by each node.

[0011] In some embodiments of the present application, based on the aforementioned scheme, the downloading and generating unit is also used to: monitor the working status of the target node through the query node; when the query node monitors that the target node in the blockchain network is in an offline state, download the face-related data in the target block generated by the target node from the server, and generate a target backup block containing the face-related data in the target block on the query node; save the target backup block on the query node, and broadcast the associated node information of the target backup block on the blockchain network through the query node, so that other nodes in the blockchain network save the content in the associated node information to the block record, wherein the associated node information includes the identification information of the query node and the identification information of the target node.

[0012] In some embodiments of the present application, based on the aforementioned scheme, the downloading and generating unit is configured to: receive the working status information regularly sent by the target node in the blockchain network; and determine that the target node is in an offline state based on the failure to regularly receive the working status information sent by the target node.

[0013] In some embodiments of the present application, based on the aforementioned scheme, after broadcasting the associated node information of the target backup block on the blockchain network through the query node, the downloading and generating unit is also used to: determine that the target node has been restored to an online state based on the work status information regularly sent by the target node, and clear the stored target backup block.

[0014] In some embodiments of the present application, based on the aforementioned scheme, each node in the blockchain network can collect facial data.

[0015] In some embodiments of the present application, based on the aforementioned solution, each node in the blockchain network is used for face-swiping payment, and each node in the blockchain network corresponds to the same merchant identifier.

[0016] In some embodiments of the present application, based on the aforementioned scheme, in response to a face recognition request, after traversing each block in the blockchain to obtain a face recognition result according to the block record saved on the query node, the traversal unit is also used to: if the face-related data matching the face data in the face recognition request is retrieved, a payment instruction is sent to the server through the query node, and the server performs a payment operation on the payment account corresponding to the face-related data; if the face-related data matching the face data in the face recognition request is not retrieved, the face data is uploaded to the server through the query node, and the server performs a payment operation on the payment account after determining the payment account matching the face data.

[0017] In some embodiments of the present application, based on the aforementioned scheme, the traversal unit is configured as follows: if the face-related data matching the face data in the face recognition request is retrieved, a payment instruction is sent to the server when the query node is connected to the network, and the server performs a payment operation on the payment account corresponding to the face-related data.

[0018] According to one aspect of an embodiment of the present application, a computer-readable medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the face recognition method as described in the above embodiment is implemented.

[0019] According to one aspect of an embodiment of the present application, an electronic device is provided, comprising: one or more processors; a storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the face recognition method as described in the above embodiments.

[0020] In the technical solutions provided in some embodiments of the present application, a blockchain network is constructed by using terminal devices as blockchain nodes. After obtaining face-related data, each terminal device in the blockchain network generates a block according to the face-related data and puts the block on the chain. At the same time, each block is stored on the terminal device that generates each block, and offline face recognition is finally realized by searching in the blockchain. Therefore, face-related data is downloaded from the server to the local, and there is no need to upload the face data for face matching, so the efficiency of face recognition can be improved; face-related data is stored in a decentralized manner in the blockchain network, and each node only stores a part of the face-related data. While realizing face recognition, especially offline face recognition, it can not only reduce the network traffic consumed by storing face-related data in the terminal, but also greatly reduce the storage resources consumed by storing face-related data. Moreover, since face-related data is stored in the blockchain, the security of data storage can be guaranteed, and the security of user privacy data is improved.

[0021] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] The drawings herein are incorporated into the specification and constitute a part of the specification, showing embodiments consistent with the present application, and together with the specification, are used to explain the principles of the present application. Obviously, the drawings described below are only some embodiments of the present application, and for ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work. In the drawings:

[0023] Figure 1 A schematic diagram showing an exemplary system architecture to which the technical solution of the embodiments of the present application can be applied;

[0024] Figure 2 A flow chart of a face recognition method according to an embodiment of the present application is shown;

[0025] Figure 3 A schematic diagram of an application architecture of a face recognition method according to an embodiment of the present application is shown;

[0026] Figure 4 A schematic diagram of a state monitoring interface when a node in a blockchain network downloads a facial feature library from a server according to an embodiment of the present application is shown;

[0027] Figure 5 A flowchart showing a process of generating a block according to an embodiment of the present application is shown;

[0028] Figure 6 An embodiment according to the present application is shown. Figure 5 A flowchart of the details of step 530;

[0029] Figure 7 A flowchart of searching a blockchain according to an embodiment of the present application is shown;

[0030] Figure 8 A flowchart showing a processing procedure when a target node in a blockchain network is offline according to an embodiment of the present application is shown;

[0031] Fig. 9 An embodiment according to the present application is shown. Figure 2 A flowchart of the steps after step 250;

[0032] Fig.10 A block diagram of a face recognition device according to an embodiment of the present application is shown;

[0033] Fig.11 A schematic diagram of the structure of a computer system suitable for implementing an electronic device of an embodiment of the present application is shown. DETAILED DESCRIPTION

[0034] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this application will be more comprehensive and complete and fully convey the concept of the example embodiments to those skilled in the art.

[0035] In addition, described feature, structure or characteristic can be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present application. However, those skilled in the art will appreciate that the technical scheme of the present application can be put into practice without one or more of the specific details, or other methods, components, devices, steps, etc. can be adopted. In other cases, known methods, devices, realizations or operations are not shown or described in detail to avoid blurring the various aspects of the application.

[0036] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities may be implemented in software form, or in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.

[0037] The flowcharts shown in the accompanying drawings are only exemplary and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps can be decomposed, and some operations / steps can be combined or partially combined, so the actual execution order may change according to actual conditions.

[0038] At present, offline face recognition is required in many scenarios. As mentioned above, in the related technology, the solution to achieve offline face recognition is mainly to store the offline face feature library locally in the terminal. However, the file size of an offline face feature library is often as high as hundreds of megabytes, which consumes a lot of network traffic and occupies a lot of local storage resources, resulting in a waste of storage resources.

[0039] To this end, the present application first provides a face recognition method. Face recognition is a biometric technology that identifies a person based on his or her facial features. This technology uses a camera or a camera to collect images or video streams containing faces, and automatically detects and tracks faces in the images, and then performs facial recognition on the detected faces. This is a series of related technologies, usually also called portrait recognition or facial recognition. The face recognition method of the present application can reduce the network traffic and storage resources consumed by storing face-related data in various nodes of the blockchain network and performing face recognition based on this.

[0040] Figure 1 A schematic diagram of an exemplary system architecture to which the technical solution of the embodiment of the present application can be applied is shown. Figure 1 As shown, the system architecture may include a blockchain network 100, a network 110 and a cloud server 120. The blockchain network 100 includes at least a first node 101, a second node 102, a third node 103, a fourth node 104 and a fifth node 105. Each node in the blockchain network 100 is a face-scanning Internet of Things (IoT) device. The face-scanning IoT device can be set up in a merchant's store. The face-scanning IoT device has a camera that can collect facial data. The face-scanning IoT device is used to perform face-scanning payment when consumers pay, and can perform offline payment. Any two nodes in the blockchain network 100 can communicate with each other, and each node in the blockchain network 100 can also communicate with the cloud server 120 through the network 110. Using Figure 1The process of implementing face recognition in the system architecture shown is as follows: first, each node in the blockchain network 100 downloads data from the cloud server 120 through the network 110 to obtain face-related data; then, each node generates a block based on the obtained face-related data and adds the block to the blockchain, thereby establishing a blockchain. At this time, the blockchain is stored on multiple nodes in the blockchain network; finally, when a node in the blockchain network 100 receives a face retrieval request, that is, when a face-scanning IoT device needs to perform face-scanning payment, face recognition is completed by retrieving face-related data from the blockchain in each node.

[0041] It should be noted that Figure 1 The example shown is only one embodiment of the present application. Figure 1 In the embodiment, face recognition is used in the face payment scenario, but the face recognition method provided by the present application can also be applied to various other scenarios that require face recognition, such as access control; Figure 1 In the embodiment, the face-related data is downloaded by each node from a cloud server, but in other embodiments of the present application, the face-related data can be downloaded by the node from a server cluster or a database cluster including multiple servers; although Figure 1 In the embodiment, the blockchain network includes only five nodes, but in other embodiments or specific applications, the blockchain network may include more or fewer nodes. The embodiment of the present application does not make any limitation to this, and the protection scope of the present application should not be limited in any way.

[0042] Moreover, it is easy to understand that the face recognition method provided in the embodiment of the present application is performed by a face scanning device, and accordingly, the face recognition device is generally a face scanning device. However, in other embodiments of the present application, the server may also have similar functions to the face scanning device, thereby performing the face recognition solution provided in the embodiment of the present application.

[0043] The face recognition method provided in the embodiment of the present application is implemented based on blockchain.

[0044] Blockchain is a new application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, encryption algorithm, etc. Blockchain is essentially a decentralized database, a string of data blocks generated by cryptographic methods. Each data block contains a batch of network transaction information, which is used to verify the validity of its information (anti-counterfeiting) and generate the next block. Blockchain can include the underlying blockchain platform, platform product service layer, and application service layer.

[0045] The underlying blockchain platform can include processing modules such as user management, basic services, smart contracts, and operation monitoring. Among them, the user management module is responsible for the identity information management of all blockchain participants, including maintaining public and private key generation (account management), key management, and the maintenance of the correspondence between the user's real identity and the blockchain address (authority management), etc., and, under authorization, supervises and audits the transactions of certain real identities and provides risk control rule configuration (risk control audit); the basic service module is deployed on all blockchain node devices to verify the validity of business requests, and records valid requests to storage after consensus is reached. For a new business request, the basic service first adapts the interface for parsing and authentication (interface adaptation), and then encrypts the business information through the consensus algorithm (consensus management). The smart contract module is responsible for the registration and issuance of contracts, as well as contract triggering and contract execution. Developers can define the contract logic in a programming language and publish it to the blockchain (contract registration). According to the logic of the contract terms, the key or other events are called to trigger the execution and complete the contract logic. It also provides the function of contract upgrade and cancellation. The operation monitoring module is mainly responsible for the deployment, configuration modification, contract setting, cloud adaptation and real-time status visualization output of the product during the product release process, such as alarm, network monitoring, node equipment health monitoring, etc.

[0046] The platform product service layer provides the basic capabilities and implementation framework of typical applications. Developers can superimpose business features based on these basic capabilities to complete the blockchain implementation of business logic. The application service layer provides application services based on blockchain solutions for business participants to use.

[0047] The implementation details of the technical solution of the embodiment of the present application are described in detail below:

[0048] Figure 2 A flowchart of a face recognition method according to an embodiment of the present application is shown. The face recognition method can be executed by a terminal device with computing and communication functions. These terminal devices can also collect face data through a set camera, such as Figure 1 The face recognition IoT device can be the Frog 1 and Frog 2 smart payment hardware devices used by WeChat Pay. Figure 2 In the embodiment, the execution subject may be a node in the blockchain network in the form of a terminal device, and any node in the blockchain network may execute the face recognition method of the embodiment of the present application. Figure 2 As shown, the face recognition method at least includes the following steps:

[0049] In step 210, a terminal device for performing face recognition connected to a local area network is used as a blockchain node to establish a blockchain network for data communication within the local area network.

[0050] The blockchain network includes a target node that generates and stores a target block and a query node that is used to find the target block.

[0051] The query node here is a node other than the target node in the blockchain network, and the blockchain network may include multiple query nodes. Although the nodes in the blockchain network are divided into target nodes and query nodes in this step, this is only to make the solution of the present application easier to understand. In fact, any node in the blockchain network can generate and store blocks, and any node in the blockchain network can also search for blocks.

[0052] Any two nodes in the blockchain network can communicate with each other. Each node can be installed with a client, and the nodes can communicate with each other using the client. The local area network covers a smaller area, such as a school, a shopping mall or even a store.

[0053] In step 220, when the target node is connected to the Internet, face-related data for offline storage is downloaded from the server through the target node, and a target block containing the face-related data is generated on the target node.

[0054] Face-related data is any data that can be used to identify the identity information corresponding to a face. For example, face-related data can be a face photo, an image frame in a face video stream, or even a group of image frames in a face video stream, etc., which can fully record face information; in addition, face-related data can also be face feature data extracted from the aforementioned face photo, an image frame, or a group of image frames, etc., which can fully record face information. The face feature data here refers to feature data that can describe the shape of facial organs and the distance characteristics between them, and is helpful for face classification.

[0055] When the target node is connected to the Internet, it will download face-related data from the server. A block is a data structure that includes face-related data and other information. Any node in the blockchain network can download face-related data for offline storage from the server.

[0056] The server side can be any terminal or device that can be used to store data, such as a server or a cluster of servers. In the cloud technology scenario, the server side can also be a cloud server located in the cloud.

[0057] The target node can download face-related data from the server at various times according to various methods and rules.

[0058] For example, face-related data can be downloaded from the server when the target node performs system initialization.

[0059] Figure 3 A schematic diagram of the application architecture of a face recognition method according to an embodiment of the present application is shown. Figure 3 When the face recognition IoT device is used for face recognition payment, it is actually used in the scenario of face recognition payment. Figure 3 The three boxes arranged from top to bottom represent the three parts of the application architecture. The box in the middle and the box at the bottom are two parts of the private chain terminal network. The private chain terminal network represents that the blockchain network in this embodiment is a private chain blockchain network established by terminal devices. The content in the box in the middle describes how face-related data is stored in the blockchain network, and the content in the box at the bottom describes the specific process of face-swiping payment based on the private chain terminal network. Figure 3 From the content in the box below, we can see that after the face scan begins, feature retrieval is performed at each node in the blockchain network to perform face recognition.

[0060] Please refer to Figure 3 The backend in the upper box is the server, which stores face-related data in the form of a face feature library, and the face-related data is face feature data. The face feature library is a file that stores batches of face feature data. The file size of each face feature library is 5M. Each face feature library stores different face feature data, so that face feature data can be stored in batches and in an organized manner. Nodes in the blockchain network download face-related data in units of face feature libraries. Specifically, according to Figure 3 From the content in the middle box, we can see that the blockchain network includes three nodes, namely node 1, node 2 and node 3. Each node stores several blocks, each block contains three feature libraries, and each feature library is downloaded from the background (server) by the node that stores the block containing the feature library.

[0061] In the embodiment of the present application, the face-related data is facial feature data, and the file size of the facial feature library storing the facial feature data is 5M. The facial feature library can store facial feature data of hundreds of thousands of people. It can be seen that for two files of the same size, the number of facial feature data that can be stored in the file is much higher than the number of facial photos. Therefore, the embodiment of the present application uses a facial feature library to store facial feature data, which can greatly reduce the storage resources consumed by face recognition.

[0062] Figure 4The following is a schematic diagram of the state monitoring interface when a node in a blockchain network downloads a facial feature library from a server according to an embodiment of the present application. Figure 4 The status monitoring interface can be displayed on the node in the blockchain network or on the server. Figure 4 In the interface, the large cylinder at the top represents the status of all facial feature libraries being downloaded in the server. The relative size of the dark part and the large cylinder in the large cylinder represents the proportional relationship between the number of facial feature libraries downloaded in all facial feature libraries and the total number of facial feature libraries. At the same time, the interface also displays the specific number, where the total number of facial feature libraries is 200 and the number of facial feature libraries downloaded is 120; the small cylinder located below the large cylinder represents the status of the storage capacity of each node in the blockchain network. The relative size of the dark part and the small cylinder in the small cylinder represents the proportional relationship between the occupied capacity and the total capacity in the node. At the same time, the interface also displays the specific capacity value in the node, for example, the total capacity of each node is 1GB, the available capacity of node 1 is 590MB, the available capacity of node 2 is 390MB, and the available capacity of node 3 is 230MB. In addition, the connection line between node 1 and the server is a dotted line, while the connection lines between node 2 and node 3 and the server are solid lines. This means that currently, node 1 is not downloading data from the server, while nodes 2 and 3 are downloading data from the server. Figure 4 The status monitoring interface shown allows people to intuitively understand the status of the entire system when the nodes in the blockchain network download the facial feature library from the server.

[0063] Among the face-related data stored on the server, restrictions can be placed on the face-related data that can be downloaded by each node in the blockchain network, so that the nodes cannot download face-related data at will.

[0064] In one embodiment of the present application, downloading face-related data for offline storage from a server through a target node includes: downloading face-related data corresponding to the regional identification information of the target node from the server through the target node.

[0065] Specifically, for example, the administrator of the target node can send a download request to the server by operating the terminal device of the target node, and the download request carries the regional identification information of the target node; and the server stores the regional identification information and the face-related data corresponding to the regional identification information; after receiving the download request sent by the target node, the server will obtain the regional identification information of the target node in the download request; the server returns a download page to the target node according to the regional identification information of the target node, and the target node contains a download entrance for the face-related data corresponding to the regional identification information of the target node, and the administrator of the target node can download the face-related data corresponding to the regional identification information of the target node through the download entrance.

[0066] For example, in a payment scenario, corresponding regional identification information can be set for each area within a region. When a merchant purchases a face-scanning IoT device, the corresponding face-scanning IoT device can be provided based on the address provided by the merchant. These face-scanning IoT devices are configured with the regional identification information corresponding to the area to which the merchant's address belongs. Therefore, the download requests sent by these face-scanning IoT devices to the server can carry the regional identification information of each node.

[0067] For another example, still taking the payment scenario as an example, the face recognition method provided in the embodiment of the present application can be applied to the payment system. The payment system includes a server. When each user registers a payment account with the server of the payment system, he / she will submit information such as address, household registration address, telephone number, and original face data. When using the payment system, the user can also provide location information to the payment system. In this way, the server can use the original face data to generate face-related data. At the same time, the server will also determine the regional identification information corresponding to this information based on the address, household registration address, telephone number, location information, etc. provided by the user. Then, the server can associate the face-related data with the regional identification information.

[0068] It can be seen that in the above embodiment, the face-scanning IoT device only needs to download the face-related data corresponding to the regional identification information. Therefore, less face-related data needs to be downloaded, thereby saving network resources and storage resources; at the same time, the address, household registration address, telephone number, location information and other information of a payment account may correspond to different regional identification information. Therefore, in the embodiment of the present application, it is also possible to associate one face-related data with multiple regional identification information. In this way, the storage redundancy of face-related data is improved, so that the same user can perform offline face-scanning payment in face-scanning IoT devices in different regions, thereby improving the user experience.

[0069] In one embodiment of the present application, face-related data corresponding to the regional identification information of the target node is downloaded from the server through the target node, including: receiving, through the target node, broadcast information sent by the server to the nodes in the blockchain network, determining that face-related data corresponding to the regional identification information of the target node is newly added in the server, and downloading face-related data corresponding to the regional identification information of the target node from the server, wherein the broadcast information includes the regional identification information of the target node.

[0070] In an embodiment of the present application, once the face-related data is updated in the server, the corresponding terminal devices can receive the broadcast information sent by the server, and then these terminal devices can download the most recently updated face-related data from the server in a timely manner, thereby ensuring the reliability of face recognition.

[0071] In one embodiment of the present application, downloading of face-related data for offline storage from the server is performed periodically.

[0072] In one embodiment of the present application, before downloading face-related data for offline storage from the server through the target node, the method also includes: determining the frequency of face recognition requests received by the target node every hour of every day within a predetermined number of days before the day; for each day within the predetermined number of days, determining the hour with the lowest frequency of face recognition requests received within that day as the low-frequency time period of that day; determining the target low-frequency time period of the day based on the low-frequency time periods of each day; downloading face-related data for offline storage from the server through the target node includes: downloading face-related data for offline storage from the server through the target node during the target low-frequency time period of the day.

[0073] In one embodiment of the present application, the target low-frequency period of the day is determined according to the low-frequency period of each day, including: determining the number of days corresponding to each low-frequency period; and taking the low-frequency period with the largest number of corresponding days as the target low-frequency period of the day.

[0074] For example, if the scheduled number of days is 7 days, then if the number of days with a low-frequency period of 21:00-22:00 is 1, the number of days with a low-frequency period of 22:00-23:00 is 2, and the number of days with a low-frequency period of 23:00-24:00 is 4, then the target low-frequency period is 23:00-24:00, that is, face-related data will be downloaded from the server between 23:00-24:00 on the same day.

[0075] When the frequency of face recognition requests received by a terminal device within an hour is relatively high, it indicates that the load of the terminal device is relatively high. If face-related data is downloaded from the server at this time, the load of the terminal device will be further increased and may affect the performance of the terminal device. In the embodiment of the present application, by predicting the low-frequency time period of the day and downloading face-related data during the low-frequency time period, data is downloaded from the server when the load of the terminal device is low, thereby avoiding affecting the performance of the terminal device; at the same time, the low-frequency time period of the day is determined based on the frequency of face recognition requests received in each hour within the predetermined number of days before the day, which can improve the accuracy of the predicted low-frequency time period.

[0076] In one embodiment of the present application, after sending a download request to the server, each node in the blockchain network sends each download request to the request message queue in the chronological order of the requests, and each node downloads face-related data from the server in sequence according to the order in which the sent download requests are sorted in the request message queue.

[0077] In an embodiment of the present application, the download requests of each node will be stored in the request message queue in the order of sending, and the server will process each download request in turn. The message queue is used to implement peak shaving of download requests, thereby avoiding system crashes caused by the server receiving a large number of download requests in a short period of time, thereby improving the availability of the system.

[0078] In one embodiment of the present application, the target node is a terminal device that has been in an idle state for the longest time in the blockchain network, wherein the idle state is a state in which the terminal device has not downloaded face-related data and has not generated a block.

[0079] That is to say, the target node is the terminal device with the longest idle time among all the terminal devices, and the idle time is the time from the last time a block was generated to the current time. The idle time lengths corresponding to each terminal device can be sorted from large to small, and each terminal device downloads face-related data in turn according to the sorting, and generates and packages blocks based on the face-related data.

[0080] In the embodiment of the present application, each terminal device downloads face-related data and generates blocks in sequence according to the length of idle time, which not only greatly reduces the pressure on the server, but also can fully utilize the idle terminal devices in the blockchain network and improve resource utilization.

[0081] In one embodiment of the present application, the specific steps of the block generation process are as follows: Figure 5 shown. Figure 5 FIG. 1 is a flowchart showing a process of generating a block according to an embodiment of the present application. Figure 5 , specifically including the following steps:

[0082] In step 510, the identification information of the target node and the first hash value in the block most recently added to the blockchain are obtained.

[0083] The identification information of the target node is information that can uniquely identify a target node. The data type of the identification information of the target node can be a string, which can include letters, numbers, underscores, etc.

[0084] Each block added to the blockchain is connected in sequence to form a blockchain. Therefore, each block has a certain order when it is added to the blockchain. The latest block added to the blockchain is the last block added to the blockchain before the current time. Each block has a hash value.

[0085] In step 520, a second hash value is determined based on the identification information of the target node, the first hash value, and the face-related data.

[0086] Specifically, a hash operation is performed on a combination of the first hash value, the face-related data, and the identification information of the target node to obtain a second hash value.

[0087] In step 530, a block is generated based on the identification information of the target node, the face-related data, the first hash value, and the second hash value.

[0088] The role and position of the second hash value in the generated block are similar to the role and position of the first hash value in the aforementioned block that was most recently added to the blockchain.

[0089] In one embodiment of the present application, the specific steps of step 530 may be as follows: Figure 6 shown. Figure 6 An embodiment according to the present application is shown. Figure 5 Detailed flowchart of step 530 in FIG. Figure 6 As shown, step 530 specifically includes the following steps:

[0090] In step 531, the face-related data is encrypted to obtain encrypted face-related data.

[0091] In one embodiment of the present application, face-related data is encrypted to obtain encrypted face-related data, including: encrypting the face-related data using a key stored locally at a target node to obtain encrypted face-related data, wherein the key cannot be obtained by users of the target node.

[0092] For example, in payment scenarios, symmetric keys can be used to encrypt face-related data, and the symmetric keys are burned into the ROM (Read-Only Memory) of the face-scanning IoT device. By burning the symmetric keys into the ROM of the face-scanning IoT device, the symmetric keys cannot be forcibly obtained through technical means, thus improving the security of data storage.

[0093] In one embodiment of the present application, before encrypting face-related data to obtain encrypted face-related data, it also includes: obtaining an encrypted symmetric key sent periodically by the server, the encrypted symmetric key being encrypted by the server using the public key of the target node to obtain the symmetric key; decrypting the encrypted symmetric key based on the private key of the target node to obtain the symmetric key; encrypting face-related data to obtain encrypted face-related data, including: encrypting the face-related data using the symmetric key to obtain encrypted face-related data.

[0094] The private key of the target node is burned into the ROM of the target node as well as the symmetric key to improve security.

[0095] In the embodiment of the present application, automatic updating of the symmetric key in the terminal device is realized, which effectively ensures the encryption security of face-related data. In addition, since the symmetric key is generated by the server using the public key of the terminal device, and the private key of the terminal device is only stored on the terminal device, only the terminal device can obtain the plaintext of the symmetric key, thereby improving the transmission security of the symmetric key.

[0096] In step 532, the identification information of the target node, the encrypted face-related data, the first hash value, and the second hash value are packaged into a block.

[0097] Specifically, the identification information of the target node, the encrypted face-related data, the first hash value and the second hash value are encapsulated according to the data structure of the block to obtain a block. The arrangement order of this information in the block can be arbitrary.

[0098] Since the face-related data in the blockchain is encrypted, when face retrieval is required, the encrypted face-related data needs to be decrypted.

[0099] according to Figure 6 In the embodiment shown, the security of face-related data is further improved by first encrypting the face-related data and then packaging the blocks, thereby avoiding leakage of user privacy.

[0100] In one embodiment of the present application, face-related data is stored in a face feature library located on the server side, and the method also includes: if it is judged based on the size of the target face feature library being downloaded that after downloading the target face feature library, the size of the block file packaged according to the downloaded but unpackaged face feature library will exceed the predetermined file size, then the currently downloaded but unpackaged face feature library will be packaged into blocks.

[0101] The target facial feature library is currently being downloaded, so the facial feature library that has been downloaded but not packaged does not include the target facial feature library.

[0102] Please continue to see Figure 3 According to the content in the middle box, each block includes the hash value of the previous block and the hash value of the current block, and each block is connected in sequence according to the hash value to form a blockchain. Each block includes 3 facial feature libraries, such as the genesis block includes feature library 1, feature library 2 and feature library 3, and block 1 includes feature library 4, feature library 5 and feature library 6, and so on. The genesis block is the first generated block in the blockchain, and the hash value based on which the block is packaged is a null value. In an embodiment of the present application, when the facial feature library downloaded by each face-swiping IoT device is about to exceed 20M, the face-swiping IoT device is responsible for packaging these facial feature libraries into a block file. Since the file size of each facial feature library is 5M, after downloading three facial feature libraries, the face-swiping IoT device needs to package these facial feature libraries into blocks. This is because the block also includes other information such as hash values ​​and node identification information. If the four facial feature libraries are downloaded and then packaged, the block will be too large.

[0103] Please continue to see Figure 2 In step 230, the target block is saved on the target node, and the on-chain information of the target block is broadcast on the blockchain network through the target node.

[0104] The on-chain information is used to indicate the link relationship between the target block and other blocks on the blockchain.

[0105] The face-related data downloaded by the terminal device from the server in the blockchain network is finally stored in the form of blocks. Other nodes on the blockchain network except the target node can receive the information on the chain.

[0106] Specifically, the on-chain information may include the identification information, the first hash value and the second hash value in the target block. Since the first hash value belongs to the block most recently added to the blockchain, the link relationship between the target block and other blocks can be determined based on the first hash value in the block most recently added to the blockchain and the second hash value in the target block. Of course, the on-chain information may only include the identification information, the second hash value and the timestamp in the target block. The timestamp reflects the sending time of the on-chain information. Therefore, the link relationship between the target block and other blocks can be determined based on the order of the timestamps.

[0107] In step 240, when the query node receives the on-chain information broadcasted in the blockchain network, the block record generated according to the on-chain information is saved on the query node.

[0108] The block record includes a query path used to find the target block.

[0109] The data in the block record can be in various forms. The block record includes the link relationship between each block in the blockchain, and these link relationships are part of the query path of each block.

[0110] Specifically, in one embodiment of the present application, the on-chain information includes a hash value and identification information of the target node. When the query node receives the on-chain information broadcast in the blockchain network, the block record generated according to the on-chain information is saved on the query node, including: when the query node receives the on-chain information broadcast in the blockchain network, the hash value contained in the on-chain information and the identification information of the target node are saved as block records on the query node.

[0111] In fact, the on-chain information can be a part of the block record, and the on-chain information corresponds to this part of the target block in the block record.

[0112] The hash value in the chain information saved as a block record on the query node can be the second hash value, or it can include the first hash value and the second hash value at the same time. When the hash value is the second hash value, the chain information can also include a timestamp, and the timestamp can also be saved as a block record on the query node. The order of these timestamps represents the link relationship between each block.

[0113] The embodiment of the present application realizes the establishment of a blockchain by broadcasting the on-chain information to other nodes in the blockchain network, so that each block added to the blockchain can obtain the information of the block newly added to the blockchain.

[0114] In step 250, in response to the face recognition request, each block in the blockchain is traversed according to the block record stored on the query node to obtain the face recognition result.

[0115] The content of the face recognition request contains face data. The face recognition request is usually triggered by the call of a functional module that relies on face recognition. For example, in the payment scenario, the functional module is a payment module. When a user performs a face-scanning payment operation on a face-scanning IoT device, a face recognition request will be triggered. It should be pointed out that the face recognition request here may not be a network request, for example, it may be an interface call request or parameter transfer between methods.

[0116] Facial data is any data that can be used to identify the identity information corresponding to a face. For example, facial data can be a face photo, an image frame in a face video stream, or even a group of image frames in a face video stream, etc., which can fully record facial information; in addition, facial data can also be facial feature data extracted from the aforementioned face photo, an image frame, or a group of image frames, etc., which can fully record facial information.

[0117] The node that receives the face recognition request can be any query node in the blockchain network. Since the block record includes the query path of each block, it is possible to traverse each block in the blockchain based on the block record.

[0118] Traversing the blocks in the blockchain is actually the process of searching the blockchain. The face recognition results are provided by the nodes in the blockchain network. When searching each node in the blockchain network, each node can return the face recognition results. In the embodiment of the present application, the blocks in the blockchain are generated based on face-related data. Therefore, by searching the blockchain, the face-related data corresponding to the face data can be determined, and the identity information bound to the face-related data is known, so the identity information corresponding to the face data can be identified.

[0119] If a search is performed on the target node and it is found that the face-related data in the target block matches the face data contained in the face recognition request, the target node will return the face recognition result to the node that received the face recognition request. The face recognition results returned by the nodes in the blockchain network can be in various forms.

[0120] For example, the identity information corresponding to the face-related data can be stored on the node. When the face-related data matching the face data is retrieved on a node, the node can return the identity information corresponding to the face-related data as the face recognition result. When the face-related data matching the face data is not retrieved on the node, the face recognition result returned by the node can be "no relevant data retrieved" or other similar information that can indicate the failure of the query. The identity information here can be any information that can uniquely identify the identity corresponding to the face. For example, the identity information can be the user's ID number, bank card number, mobile phone number and other user-specific information, and can also be identification information that corresponds one-to-one with the user's ID number, bank card number, mobile phone number and other user-specific information.

[0121] For another example, when face-related data matching face data is retrieved on a node, the node may return “query successful” or similar information that can indicate a successful query as the face recognition result; when face-related data matching face data is not retrieved on the node, the face recognition result returned by the node may be “query failed” or related information that can indicate a failed query.

[0122] Figure 7 A flowchart of searching a blockchain according to an embodiment of the present application is shown.

[0123] See also Figure 7 , including the following steps:

[0124] In step 710, facial data in the facial recognition request is obtained.

[0125] The face recognition request carries face data.

[0126] The face-related data here can be data such as face photos that can fully record face information, or it can be the aforementioned face feature data that can describe the shape of facial organs and the distance characteristics between them and is helpful for face classification.

[0127] In step 720, the query path of each block in the blockchain is determined based on the hash value in the block record and the identification information of the node.

[0128] When each block is packaged and uploaded to the chain, other terminal devices will receive the chain information broadcast by the terminal device that packages the block. The hash value in the chain information and the identification information of the terminal device will be stored in the block record.

[0129] According to the hash values ​​in the block records (such as the first hash value and the second hash value), the link relationship between each block can be determined. Therefore, each terminal device in the blockchain network knows the connection order of each block in the blockchain; and then according to the identification information of the node corresponding to each hash value in the block record, the query path used to indicate which block on which node in the blockchain network to query in turn can be determined.

[0130] In step 730, according to the query path, the facial data is sent to each node in the blockchain network in turn, and each node searches in the stored blocks to obtain the facial recognition results returned by each node.

[0131] After the face-related data stored on each terminal device is encrypted, it needs to be decrypted first, and then it is determined whether the stored face-related data matches the face data. Each terminal device can specifically determine whether the face-related data matches the face data through various algorithms such as deep learning models.

[0132] pass Figure 3 It can also be seen that different blocks are stored in multiple nodes. In addition to the stored blocks, the nodes also include the storage order of each block in the blockchain on the node. This storage order is the query path of the block, which corresponds to the connection relationship between the blocks in the blockchain. For example, the genesis block is located on node 1, and block 1 is located on node 3. Therefore, the storage order of the genesis block and block 1 is node 1->node 3, that is, the face data needs to be sent to node 1 first, and then to node 3.

[0133] according to Figure 7 In the illustrated embodiment, facial data can be retrieved according to the storage order of the blocks on each terminal device, thereby avoiding repeated retrieval and ensuring retrieval efficiency.

[0134] In one embodiment of the present application, if face-related data matching the face data is not retrieved on a node in the blockchain network, the node will directly send the face data to the next node according to the query path.

[0135] In the embodiment of the present application, when no matching face-related data is retrieved on a terminal device, the current terminal device does not need to send face data to other terminal devices after receiving the face recognition result returned by the terminal device, thereby improving the face recognition efficiency. The embodiment of the present application also implements a backup mechanism.

[0136] Figure 8 A flowchart showing the processing process when the target node in the blockchain network is offline according to an embodiment of the present application is shown. Figure 8 , the backup mechanism can be implemented through the following process:

[0137] In step 810, the working status of the target node is monitored by the query node.

[0138] In one embodiment of the present application, monitoring the working status of the target node by querying the node includes: receiving working status information regularly sent by the target node in the blockchain network; and determining that the target node is in an offline state based on not receiving the working status information regularly sent by the target node.

[0139] For example, all terminal devices in the entire blockchain network will send a broadcast message to other terminal devices every 5 minutes to inform their current status information. Therefore, for each terminal device, they know the survival status of each terminal device on the chain in real time; when the time when the current terminal device last received the broadcast information from the target terminal device exceeds the predetermined time from the current time, it can be determined that the target terminal device is offline.

[0140] In an embodiment of the present application, by determining that other terminal devices are in an offline state based on the failure to regularly receive working status information sent by other terminal devices in the blockchain network, when a terminal device in the blockchain network encounters an accident such as downtime or failure, other terminal devices in the blockchain network can also obtain status information of the terminal device, thereby improving the operational reliability of the blockchain network.

[0141] In step 820, when the query node monitors that the target node in the blockchain network is offline, the face-related data in the target block generated by the target node is downloaded from the server, and a target backup block containing the face-related data in the target block is generated on the query node.

[0142] The face-related data is downloaded by the node from the server. Therefore, the server can know which face-related data is downloaded and packaged by the target node, and then know which face-related data is included in the target block generated by the target node. In this way, the server can provide the face-related data in the target block to the query node.

[0143] In step 830, the target backup block is saved on the query node, and the associated node information of the target backup block is broadcast on the blockchain network through the query node, so that other nodes in the blockchain network save the content in the associated node information into the block record.

[0144] The associated node information includes identification information of the query node and identification information of the target node.

[0145] Since the target node is offline, in order to use the face-related data in the target block for face recognition, the query node in the blockchain network needs to replace the target node to store the face-related data in the target block.

[0146] When other nodes in the blockchain network receive the associated node information, they will save the content in the associated node information for use in the face recognition retrieval process.

[0147] The associated node information corresponds to the target backup block, and reflects not only which node the target backup block is generated by, but also which node the target backup block is used to replace.

[0148] Other nodes can at least save the identification information of the query node in the associated node information to the block record. Specifically, other nodes can replace the identification information of the target node stored in the local block record with the identification information of the query node according to the identification information of the target node in the associated node information; other nodes can also store the identification information of the query node and the identification information of the target node in correspondence with each other according to the identification information of the target node in the associated node information. The face-related data in the target block has been stored in the target backup block in the query node. After that, other nodes replace the identification information of the target node in the block record with the identification information of the query node. In this way, when the nodes in the blockchain network need to retrieve the face-related data in the target block, they can know that they need to send the face data to the query node that stores the target backup block.

[0149] based on Figure 8 The illustrated embodiment realizes the backup of face-related data in the target block in the blockchain network. Even if a node in the blockchain network crashes or goes offline, other nodes can still perform face recognition smoothly.

[0150] It should be pointed out that the selection of a query node as the backup storage node of the target block can be determined according to various rules and mechanisms. For example, when each terminal device in the blockchain detects that a terminal device is down, it can request the server to obtain the face-related data stored by the terminal device in a competitive manner. The server will provide the corresponding face-related data to the first node that issues the request. Since the current query node is the first node to issue the request, the current query node can obtain the face-related data stored by the downed terminal device from the server; for another example, the query node that can download the face-related data in the target block can be the node designated in the blockchain to obtain the face-related data stored by the downed terminal device.

[0151] In one embodiment of the present application, after broadcasting the associated node information of the target backup block on the blockchain network through the query node, the method further includes: determining that the target node has been restored to an online state based on work status information periodically received from the target node, and clearing the stored target backup block.

[0152] In one embodiment of the present application, other nodes replace the identification information of the target node stored in the local block record with the identification information of the query node based on the identification information of the target node in the associated node information. After receiving the working status information sent regularly by the target node, other nodes reset the identification information of the query node in the block record that was replaced by the identification information of the target node to the identification information of the target node based on the work status information sent regularly by the target node.

[0153] Since the working status information regularly sent by the target node can be received again, it can be determined that the target node has been restored to the online state. At this time, the face-related data stored on the target node can be used for face recognition. By clearing the stored target backup block, the storage space occupied can be reduced; and other nodes can reset the identification information of the query node to the identification information of the target node, so that when the face-related data in the target block needs to be used for matching, the target node can be used.

[0154] In one embodiment of the present application, each node in the blockchain network is capable of collecting facial data.

[0155] Specifically, when the embodiment of the present application is used in a face-scanning payment scenario, each node in the blockchain network can be a face-scanning IoT device. At this time, the node can not only store face-related data, but also directly collect face data.

[0156] In one embodiment of the present application, each node in the blockchain network is used for face-scanning payment, and each node in the blockchain network corresponds to the same merchant identifier.

[0157] The merchant ID is used to uniquely identify a merchant. Therefore, the scale of nodes corresponding to the same merchant ID is very small. For example, each terminal node in the blockchain network corresponding to the same merchant ID can be a face-scanning IoT device in a store. These face-scanning IoT devices can be deployed in a local area network. The local area network can be used to transmit data at high speed between nodes, thereby greatly reducing the delay of retrieval in the blockchain network, making the efficiency of face recognition equivalent to that when all face-related data is stored locally.

[0158] Fig. 9 An embodiment according to the present application is shown. Figure 2 Flow chart of the steps after step 250 in FIG. Fig. 9 As shown, after step 250, the following steps may also be included:

[0159] In step 910, if face-related data matching the face data in the face recognition request is retrieved, a payment instruction is sent to the server through the query node, and the server performs a payment operation on the payment account corresponding to the face-related data.

[0160] For example, a node can store a payment account corresponding to face-related data. When face-related data on the node matches face data, the node can return the payment account corresponding to the face-related data to the current node. The current node can send a payment instruction to the server, and the payment instruction includes the payment ticket corresponding to the payment account, thereby performing the payment operation.

[0161] The payment operation on the payment account is to transfer the consumption amount from the payment account to the merchant account.

[0162] In one embodiment of the present application, if face-related data matching the face data in a face recognition request is retrieved, a payment instruction is sent to a server through a query node, and the server performs a payment operation on a payment account corresponding to the face-related data, including: if face-related data matching the face data in a face recognition request is retrieved, a payment instruction is sent to a server when the query node is connected to the network, and the server performs a payment operation on a payment account corresponding to the face-related data.

[0163] Specifically, when the search in the blockchain network is completed, the payment account corresponding to the face-related data matching the face data can be obtained. At this time, since the current query node is not yet connected to the network, the payment note containing the payment account can be temporarily stored locally, and when the current query node is connected to the network, the payment instruction containing the payment note is sent to the server.

[0164] In this embodiment, delayed payment is realized. Through the solution of the embodiment of the present application, even if the terminal device is temporarily not connected to the network, as long as the terminal device can restore connectivity with the network, the payment operation can be successfully completed.

[0165] In step 920, if face-related data matching the face data in the face recognition request is not retrieved, the face data is uploaded to the server through the query node, and the server performs payment operations on the payment account after determining the payment account matching the face data.

[0166] In this embodiment, only when the local area network cannot complete face recognition, the server will perform face recognition and complete the corresponding payment operation; in most cases, face recognition is performed in the local area network, thereby effectively reducing the risk of network congestion.

[0167] It is worth mentioning that, although in the embodiment of the present application, the sending of payment instructions and facial data to the server is executed by the query node that receives the facial recognition request, in other embodiments of the present application, the sending of payment instructions and facial data to the server can be executed by other nodes other than the current query node. Specifically, the sending of payment instructions to the server can be executed by the node that stores the facial data that matches the facial data, and the facial data can be executed by the node that stores the last block in the blockchain network.

[0168] Please continue to see Figure 3 ,according to Figure 3 The content in the box below can determine that after feature retrieval, if the retrieval fails in the blockchain network, that is, there is no face-related data matching the face data in the blockchain, then face recognition is performed in the cloud and the money is directly deducted after the recognition is completed; if the retrieval is successful in the blockchain network, but if the current node is not yet connected to the network, the payment note containing the payment account can be temporarily stored locally, and when the current node is connected to the network, the payment instruction containing the payment note is sent to the server, thereby realizing delayed payment.

[0169] It should be pointed out that although in the embodiment of the present application, the server for performing payment operations and the server from which the face-related data downloaded by the node comes from are the same server, in other embodiments of the present application, the server for performing payment operations and the server from which the face-related data comes from can also be different terminal devices.

[0170] To summarize, according to the face recognition method provided in the embodiment of the present application, face-related data is downloaded from the server to the local, and there is no need to upload the face data for face matching, thereby improving the efficiency of face recognition; while realizing face recognition, especially offline face recognition, it can reduce the network traffic consumed by storing face-related data locally in the terminal, and can also reduce the storage resources consumed by storing face-related data, and, by storing face-related data in the blockchain, it can also ensure the security of data storage, and can effectively protect user privacy data.

[0171] The following describes an embodiment of the device of the present application, which can be used to execute the face recognition method in the above embodiment of the present application. For details not disclosed in the embodiment of the device of the present application, please refer to the embodiment of the face recognition method in the above embodiment of the present application.

[0172] Fig.10 FIG. 1 is a block diagram of a face recognition device according to an embodiment of the present application. Fig.10 As shown, according to an embodiment of the present application, a face recognition device 1000 includes: a building unit 1010, a downloading and generating unit 1020, a saving and broadcasting unit 1030, a receiving and saving unit 1040 and a traversing unit 1050.

[0173] Among them, the building unit 1010 is used to use the terminal device for face recognition connected to the local area network as a blockchain node, and to build a blockchain network for data communication in the local area network, wherein the blockchain network includes a target node for generating and storing a target block and a query node for searching the target block; the downloading and generating unit 1020 is used to download face-related data for offline storage from the server through the target node when the target node is connected to the Internet, and to generate a target block containing the face-related data on the target node; the saving and broadcasting unit 1030 is used to save the target block in the target node. The query node 1040 is used to receive the on-chain information broadcasted in the blockchain network, and broadcast the on-chain information of the target block on the blockchain network through the target node, wherein the on-chain information is used to indicate the link relationship between the target block and other blocks on the blockchain; the receiving and saving unit 1040 is used to save the block record generated according to the on-chain information on the query node when the query node receives the on-chain information broadcasted in the blockchain network, and the block record includes a query path for finding the target block; the traversal unit 1050 is used to respond to the face recognition request, and traverse each block in the blockchain according to the block record saved on the query node to obtain the face recognition result.

[0174] In some embodiments of the present application, based on the aforementioned scheme, the downloading and generating unit 1020 is configured to: obtain the identification information of the target node and the first hash value in the block most recently added to the blockchain; determine the second hash value based on the identification information of the target node, the first hash value and the face-related data; generate a block based on the identification information of the target node, the face-related data, the first hash value and the second hash value.

[0175] In some embodiments of the present application, based on the aforementioned scheme, the downloading and generating unit 1020 is configured to: encrypt the face-related data to obtain encrypted face-related data; and pack the identification information of the target node, the encrypted face-related data, the first hash value and the second hash value into a block.

[0176] In some embodiments of the present application, based on the aforementioned scheme, the on-chain information includes a hash value and identification information of the target node, and the receiving and saving unit 1040 is configured as: when the query node receives the on-chain information broadcast in the blockchain network, the hash value and identification information of the target node contained in the on-chain information are saved as block records on the query node.

[0177] In some embodiments of the present application, based on the aforementioned scheme, the traversal unit 1050 is configured to: obtain the facial data in the facial recognition request; determine the query path of each block in the blockchain according to the hash value in the block record and the identification information of the node; according to the query path, send the facial data to each node in the blockchain network in turn, and each node searches in the stored blocks to obtain the facial recognition results returned by each node.

[0178] In some embodiments of the present application, based on the aforementioned scheme, the downloading and generating unit 1020 is also used to: monitor the working status of the target node through the query node; when the query node monitors that the target node in the blockchain network is in an offline state, download the face-related data in the target block generated by the target node from the server, and generate a target backup block containing the face-related data in the target block on the query node; save the target backup block on the query node, and broadcast the associated node information of the target backup block on the blockchain network through the query node, so that other nodes in the blockchain network save the content in the associated node information to the block record, wherein the associated node information includes the identification information of the query node and the identification information of the target node.

[0179] In some embodiments of the present application, based on the aforementioned scheme, the downloading and generating unit 1020 is configured to: receive the working status information regularly sent by the target node in the blockchain network; and determine that the target node is in an offline state based on the failure to regularly receive the working status information sent by the target node.

[0180] In some embodiments of the present application, based on the aforementioned scheme, after broadcasting the associated node information of the target backup block on the blockchain network through the query node, the downloading and generating unit 1020 is also used to: determine that the target node has been restored to an online state based on the work status information regularly sent by the target node, and clear the stored target backup block.

[0181] In some embodiments of the present application, based on the aforementioned scheme, each node in the blockchain network can collect facial data.

[0182] In some embodiments of the present application, based on the aforementioned solution, each node in the blockchain network is used for face-swiping payment, and each node in the blockchain network corresponds to the same merchant identifier.

[0183] In some embodiments of the present application, based on the aforementioned scheme, in response to a face recognition request, after traversing each block in the blockchain to obtain a face recognition result according to the block record saved on the query node, the traversal unit 1050 is also used to: if the face-related data matching the face data in the face recognition request is retrieved, a payment instruction is sent to the server through the query node, and the server performs a payment operation on the payment account corresponding to the face-related data; if the face-related data matching the face data in the face recognition request is not retrieved, the face data is uploaded to the server through the query node, and the server performs a payment operation on the payment account after determining the payment account matching the face data.

[0184] In some embodiments of the present application, based on the aforementioned scheme, the traversal unit 1050 is configured as follows: if the face-related data matching the face data in the face recognition request is retrieved, a payment instruction is sent to the server when the query node is connected to the network, and the server performs a payment operation on the payment account corresponding to the face-related data.

[0185] Fig.11 A schematic diagram of the structure of a computer system suitable for implementing an electronic device of an embodiment of the present application is shown.

[0186] It should be noted that Fig.11 The computer system 1100 of the electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0187] like Fig.11 As shown, the computer system 1100 includes a central processing unit (CPU) 1101, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 1102 or the program loaded from the storage part 1108 to the random access memory (RAM) 1103, such as executing the method described in the above embodiment. In the RAM 1103, various programs and data required for system operation are also stored. The CPU 1101, the ROM 1102 and the RAM 1103 are connected to each other through the bus 1104. The input / output (I / O) interface 1105 is also connected to the bus 1104.

[0188] The following components are connected to the I / O interface 1105: an input section 1106 including a keyboard, a mouse, etc.; an output section 1107 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 1108 including a hard disk, etc.; and a communication section 1109 including a network interface card such as a LAN (Local Area Network) card, a modem, etc. The communication section 1109 performs communication processing via a network such as the Internet. A drive 1110 is also connected to the I / O interface 1105 as needed. A removable medium 1111, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 1110 as needed so that a computer program read therefrom is installed into the storage section 1108 as needed.

[0189] In particular, according to an embodiment of the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present application includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication section 1109, and / or installed from a removable medium 1111. When the computer program is executed by a central processing unit (CPU) 1101, various functions defined in the system of the present application are executed.

[0190] It should be noted that the computer-readable medium shown in the embodiment of the present application may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, - but not limited to - an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by an instruction execution system, device or device or used in combination with it. In the present application, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, wherein a computer-readable program code is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate, or transmit programs for use by or in conjunction with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.

[0191] The flowchart and block diagram in the accompanying drawings illustrate the possible architecture, functions and operations of the system, method and computer program product according to various embodiments of the present application. Wherein, each box in the flowchart or block diagram can represent a module, a program segment, or a part of the code, and the above-mentioned module, program segment, or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flowchart, and the combination of boxes in the block diagram or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0192] The units involved in the embodiments described in this application may be implemented by software or hardware, and the units described may also be set in a processor. The names of these units do not, in some cases, constitute limitations on the units themselves.

[0193] As one aspect, the present application also provides a computer-readable medium, which may be included in the electronic device described in the above embodiment; or may exist independently without being assembled into the electronic device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by an electronic device, the electronic device implements the method described in the above embodiment.

[0194] It should be noted that, although several modules or units of the equipment for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the embodiments of the present application, the features and functions of two or more modules or units described above can be embodied in one module or unit. On the contrary, the features and functions of one module or unit described above can be further divided into being embodied by multiple modules or units.

[0195] Through the description of the above implementation methods, it is easy for those skilled in the art to understand that the example implementation methods described here can be implemented by software or by combining software with necessary hardware. Therefore, the technical solution according to the implementation methods of the present application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which can be a personal computer, a server, a touch terminal, or a network device, etc.) to execute the method according to the implementation methods of the present application.

[0196] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the embodiments disclosed herein. The present application is intended to cover any variations, uses or adaptations of the present application, which follow the general principles of the present application and include common knowledge or customary technical means in the art that are not disclosed in the present application.

[0197] It should be understood that the present application is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.

[0198] The facial information in this invention is used legally.

Claims

1. A face recognition method, characterized in that: The method comprises: A terminal device for performing face recognition connected to a local area network is used as a blockchain node to form a blockchain network for data communication within the local area network, wherein the blockchain network includes a target node for generating and storing a target block and a query node for searching the target block; When the target node is connected to the Internet, the face-related data for offline storage is downloaded from the server through the target node, and a target block containing the face-related data is generated on the target node; The target block is stored on the target node, and the target node broadcasts the on-chain information of the target block on the blockchain network, where the on-chain information is used to indicate the link relationship between the target block and other blocks on the blockchain; When the query node receives the on-chain information broadcasted in the blockchain network, the query node saves a block record generated according to the on-chain information, wherein the block record includes a query path for finding the target block; In response to the face recognition request, each block in the blockchain is traversed according to the block record stored on the query node to obtain the face recognition result.

2. The face recognition method according to claim 1, characterized in that: Generating a target block containing the face-related data on the target node includes: Obtain identification information of the target node and a first hash value in a block most recently added to the blockchain; Determine a second hash value according to the identification information of the target node, the first hash value and the face-related data; A block is generated based on the identification information of the target node, the face-related data, the first hash value, and the second hash value.

3. The face recognition method according to claim 2, characterized in that: The generating block based on the identification information of the target node, the face-related data, the first hash value and the second hash value includes: Encrypting the face-related data to obtain encrypted face-related data; The identification information of the target node, the encrypted face-related data, the first hash value and the second hash value are packaged into a block.

4. The face recognition method according to claim 3, characterized in that: The on-chain information includes a hash value and identification information of the target node, the hash value is the second hash value, or the hash value includes the first hash value and the second hash value; when the query node receives the on-chain information broadcasted in the blockchain network, the block record generated according to the on-chain information is saved on the query node, including: When the query node receives the on-chain information broadcast in the blockchain network, the hash value and identification information of the target node contained in the on-chain information are saved as part of the block record on the query node.

5. The face recognition method according to claim 4, characterized in that: The responding to the face recognition request, traversing each block in the blockchain according to the block record stored on the query node to obtain the face recognition result, includes: Obtaining face data in the face recognition request; Determine the query path of each block in the blockchain according to the hash value in the block record and the identification information of the node; According to the query path, the facial data is sent to each node in the blockchain network in turn, and each node searches the stored blocks to obtain the facial recognition results returned by each node.

6. The face recognition method according to claim 5, characterized in that: The method further comprises: Monitoring the working status of the target node through the query node; When the query node monitors that the target node in the blockchain network is in an offline state, the face-related data in the target block generated by the target node is downloaded from the server, and a target backup block containing the face-related data in the target block is generated on the query node; The target backup block is saved on the query node, and the associated node information of the target backup block is broadcasted on the blockchain network through the query node, so that other nodes in the blockchain network save the content in the associated node information into the block record, wherein the associated node information includes the identification information of the query node and the identification information of the target node.

7. The face recognition method according to claim 6, characterized in that: The monitoring the working status of the target node through the query node includes: Receiving working status information regularly sent by the target node in the blockchain network; According to the failure to regularly receive the working status information sent by the target node, it is determined that the target node is in an offline state.

8. The face recognition method according to claim 7, characterized in that: After broadcasting the associated node information of the target backup block on the blockchain network through the query node, the method further includes: According to the work status information periodically sent by the target node, it is determined that the target node is restored to an online state, and the stored target backup block is cleared.

9. The face recognition method according to claim 1, characterized in that: Each node in the blockchain network is capable of collecting facial data.

10. The face recognition method according to claim 9, characterized in that: Each node in the blockchain network is used for face-swiping payment, and each node in the blockchain network corresponds to the same merchant identifier.

11. The face recognition method according to claim 10, characterized in that: After responding to the face recognition request and traversing each block in the blockchain according to the block record stored on the query node to obtain the face recognition result, the method further includes: If the face-related data matching the face data in the face recognition request is retrieved, a payment instruction is sent to the server through the query node, and the server performs a payment operation on the payment account corresponding to the face-related data; If the face-related data that matches the face data in the face recognition request is not retrieved, the face data is uploaded to the server through the query node, and the server performs a payment operation on the payment account after determining the payment account that matches the face data.

12. The face recognition method according to claim 11, characterized in that: If the face-related data matching the face data in the face recognition request is retrieved, a payment instruction is sent to the server through the query node, and the server performs a payment operation on the payment account corresponding to the face-related data, including: If the face-related data matching the face data in the face recognition request is retrieved, a payment instruction is sent to the server when the query node is connected to the network, and the server performs a payment operation on the payment account corresponding to the face-related data.

13. A face recognition device, characterized in that: The device comprises: A building unit, configured to use a terminal device for performing face recognition connected to a local area network as a blockchain node, to build a blockchain network for data communication in the local area network, wherein the blockchain network includes a target node for generating and storing a target block and a query node for searching the target block; A downloading and generating unit, configured to download face-related data for offline storage from a server through the target node when the target node is connected to the Internet, and generate a target block containing the face-related data on the target node; A storage and broadcasting unit, used to store the target block on the target node, and broadcast the on-chain information of the target block on the blockchain network through the target node, wherein the on-chain information is used to indicate the link relationship between the target block and other blocks on the blockchain; A receiving and saving unit, configured to save a block record generated according to the on-chain information on the query node when the query node receives the on-chain information broadcasted in the blockchain network, wherein the block record includes a query path for finding the target block; The traversal unit is used to respond to the face recognition request and traverse each block in the blockchain according to the block record stored on the query node to obtain the face recognition result.

14. A computer readable medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the face recognition method according to any one of claims 1 to 12 is implemented.

15. An electronic device, characterized in that: include: one or more processors; A storage device for storing one or more programs, when the one or more programs are executed by the one or more processors, enables the one or more processors to implement the face recognition method as described in any one of claims 1 to 12.

Citation Information

Patent Citations

  • Blockchain-based smart home system

    CN109245973A

  • Identity verification method and device based on face recognition, equipment and storage medium

    CN112330331A