CN113505260A - Face recognition method and device, computer readable medium and electronic equipment - Google Patents

Face recognition method and device, computer readable medium and electronic equipment Download PDF

Info

Publication number
CN113505260A
CN113505260A CN202110807730.2A CN202110807730A CN113505260A CN 113505260 A CN113505260 A CN 113505260A CN 202110807730 A CN202110807730 A CN 202110807730A CN 113505260 A CN113505260 A CN 113505260A
Authority
CN
China
Prior art keywords
node
face
block
target
related data
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110807730.2A
Other languages
Chinese (zh)
Inventor
张晓翼
张志强
王少鸣
洪哲鸣
郭润增
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN202110807730.2A priority Critical patent/CN113505260A/en
Publication of CN113505260A publication Critical patent/CN113505260A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/50Information retrieval; Database structures therefor; File system structures therefor of still image data
    • G06F16/58Retrieval characterised by using metadata, e.g. metadata not derived from the content or metadata generated manually
    • G06F16/583Retrieval characterised by using metadata, e.g. metadata not derived from the content or metadata generated manually using metadata automatically derived from the content
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/62Protecting access to data via a platform, e.g. using keys or access control rules
    • G06F21/6218Protecting access to data via a platform, e.g. using keys or access control rules to a system of files or objects, e.g. local or distributed file system or database
    • G06F21/6245Protecting personal data, e.g. for financial or medical purposes

Abstract

The embodiment of the application provides a face recognition method, a face recognition device, a computer readable medium and electronic equipment, wherein the method comprises the following steps: the method comprises the steps that terminal equipment accessed to a local area network is used as a block chain node, and a block chain network for data communication in the local area network is established, wherein the block chain network comprises a target node and a query node; the target node downloads the face related data from the server and generates a target block containing the face related data; storing the target block on a target node, and broadcasting uplink information of the target block on a block chain network through the target node; when the inquiry node receives the broadcast uplink information, a block record generated according to the uplink information is stored on the inquiry node; and responding to the face recognition request, and traversing each block in the block chain according to the block record stored on the query node to obtain a face recognition result. According to the embodiment of the application, the consumption of network flow and storage resources can be reduced, and the security of user privacy data is improved.

Description

Face recognition method and device, computer readable medium and electronic equipment
Technical Field
The present application relates to the field of block chain technologies, and in particular, to a face recognition method, an apparatus, a computer-readable medium, and an electronic device.
Background
Currently, when face recognition is performed, offline face recognition is mainly realized by storing a face feature library in a local area of a terminal in an offline manner, and files of the face feature library are often very large, so that the face feature library is stored in the local area of the terminal, a large amount of network traffic is consumed, a lot of local storage resources are occupied, and waste of the storage resources is caused.
Disclosure of Invention
Embodiments of the present application provide a face recognition method, an apparatus, a computer-readable medium, and an electronic device, so that network traffic and storage resources consumed by storing a face feature library locally in a terminal can be reduced to at least a certain extent.
Other features and advantages of the present application will be apparent from the following detailed description, or may be learned by practice of the application.
According to an aspect of an embodiment of the present application, there is provided a face recognition method, including: establishing a block chain network for data communication in a local area network by taking terminal equipment which is accessed to the local area network and used for carrying out face recognition as a block chain node, wherein the block chain network comprises a target node for generating and storing a target block and a query node for searching the target block; under the condition that the target node is accessed 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; storing the target block on the target node, and broadcasting uplink information of the target block on the block chain network through the target node, wherein the uplink information is used for representing the link relation between the target block and other blocks on a block chain; when the query node receives the uplink information broadcasted in the block chain network, a block record generated according to the uplink information is stored on the query node, and the block record comprises a query path used for searching the target block; and responding to a face recognition request, and traversing each block in the block chain according to the block record stored on the query node to obtain a face recognition result.
According to an aspect of an embodiment of the present application, there is provided a face recognition apparatus, including: the system comprises a building unit, a searching unit and a processing unit, wherein the building unit is used for building a block chain network for carrying out data communication in a local area network by taking a terminal device which is accessed to the local area network and used for carrying out face recognition as a block chain node, and the block chain network comprises a target node for generating and storing a target block and a query node for searching the target block; the downloading and generating unit is used for downloading the face related data for off-line storage from a server through the target node under the condition that the target node is accessed to the Internet, and generating a target block containing the face related data on the target node; a storing and broadcasting unit, configured to store the target block in the target node, and broadcast uplink information of the target block on the blockchain network through the target node, where the uplink information is used to indicate a link relationship between the target block and other blocks in a blockchain; a receiving and storing unit, configured to store, on the querying node, a block record generated according to the uplink information when the querying node receives the uplink information broadcasted in the block chain network, where the block record includes a querying path used for searching the target block; and the traversing unit is used for responding to the face recognition request, and traversing each block in the block chain according to the block record stored on the query node to obtain a face recognition result.
In some embodiments of the present application, based on the foregoing solution, the downloading and generating unit is configured to: acquiring identification information of the target node and a first hash value of a block which is newly added into a block chain; determining a second hash value according to the identification information of the target node, the first hash value and the face related data; and generating a block based on the identification information of the target node, the face-related data, the first hash value and the second hash value.
In some embodiments of the present application, based on the foregoing solution, the downloading and generating unit is configured to: encrypting the face related data to obtain encrypted face related data; and packaging the identification information of the target node, the encrypted face related data, the first hash value and the second hash value into a block.
In some embodiments of the present application, based on the foregoing solution, the uplink information includes a hash value and identification information of the target node, and the receiving and storing unit is configured to: when the inquiry node receives the uplink information broadcasted in the block chain network, the hash value contained in the uplink information and the identification information of the target node are stored to the inquiry node as a block record.
In some embodiments of the present application, based on the foregoing solution, the traversal unit is configured to: acquiring face data in the face recognition request; determining a query path of each block in the block chain according to the hash value in the block record and the identification information of the node; and sequentially sending the face data to each node in the block chain network according to the query path, and retrieving in the stored blocks by each node to obtain a face recognition result returned by each node.
In some embodiments of the present application, based on the foregoing solution, the downloading and generating unit is further configured to: monitoring the working state of the target node through the query node; when the query node monitors that the target node in the block chain network is in an offline state, downloading the face related data in the target block generated by the target node from the server, and generating a target backup block containing the face related data in the target block on the query node; and storing the target backup block on the query node, and broadcasting the associated node information of the target backup block on the block chain network through the query node so as to enable other nodes in the block chain network to store the content in the associated node information into a block record, wherein the associated node information comprises the identification information of the query node and the identification information of the target node.
In some embodiments of the present application, based on the foregoing solution, the downloading and generating unit is configured to: receiving working state information periodically sent by the target node in the block chain network; and determining that the target node is in an offline state according to the working state information sent by the target node which is not received regularly.
In some embodiments of the present application, based on the foregoing solution, 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 further configured to: and according to the received working state information periodically sent by the target node, determining that the target node is restored to an online state, and clearing the stored target backup block.
In some embodiments of the present application, based on the foregoing scheme, each node in the blockchain network can acquire face data.
In some embodiments of the present application, based on the foregoing scheme, each node in the blockchain network is used for face-brushing payment, and each node in the blockchain network corresponds to the same merchant identifier.
In some embodiments of the present application, based on the foregoing solution, after responding to a face recognition request, traversing each block in the block chain according to a block record stored on the query node to obtain a face recognition result, the traversing unit is further configured to: if the face related data matched with the face data in the face recognition request is retrieved, sending a payment instruction to the server through the query node, and carrying out payment operation on a payment account corresponding to the face related data by the server; and if the face related data matched with 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 operation on the payment account after determining the payment account matched with the face data.
In some embodiments of the present application, based on the foregoing solution, the traversal unit is configured to: and if the face related data matched with the face data in the face recognition request is retrieved, sending a payment instruction to the server when the query node is connected with the network, and carrying out payment operation on a payment account corresponding to the face related data by the server.
According to an aspect of the embodiments of the present application, there is provided a computer readable medium on which a computer program is stored, the computer program, when executed by a processor, implementing the face recognition method as described in the above embodiments.
According to an aspect of an embodiment of the present application, there is provided an electronic device including: one or more processors; a storage device for storing one or more programs which, when executed by the one or more processors, cause the one or more processors to implement the face recognition method as described in the above embodiments.
In the technical solutions provided in some embodiments of the present application, a block chain network is constructed by using terminal devices as block chain link points, after each terminal device in the block chain network acquires face-related data, a block is generated according to the face-related data and is linked up, meanwhile, each block is stored in each block-generated terminal device, and finally, offline face recognition is realized by retrieving in a block chain. Therefore, the face related data is downloaded from the server to the local, and the face data does not need to be uploaded and then face matching is carried out, so that the face recognition efficiency can be improved; the face related data are stored in the block chain network in a scattered mode, each node only stores a part of face related data, when face recognition, particularly offline face recognition, is achieved, network flow consumed by storing the face related data in a local terminal can be reduced, storage resources consumed by storing the face related data are greatly reduced, and the safety of data storage can be guaranteed and the safety of user privacy data is improved due to the fact that the face related data are stored in the block chain.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the application.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and together with the description, serve to explain the principles of the application. It is obvious that the drawings in the following description are only some embodiments of the application, and that for a person skilled in the art, other drawings can be derived from them without inventive effort. In the drawings:
FIG. 1 shows a schematic diagram of an exemplary system architecture to which aspects of embodiments of the present application may be applied;
FIG. 2 shows a flow diagram of a face recognition method according to an embodiment of the present application;
FIG. 3 is a schematic diagram illustrating an application architecture of a face recognition method according to an embodiment of the present application;
fig. 4 is a schematic diagram illustrating a status monitoring interface when a node downloads a face feature library from a server in a blockchain network according to an embodiment of the present application;
FIG. 5 shows a flow diagram of a tile generation process according to one embodiment of the present application;
FIG. 6 shows a flowchart of details of step 530 in FIG. 5, according to one embodiment of the present application;
FIG. 7 shows a flow diagram for retrieving a blockchain according to an embodiment of the present application;
FIG. 8 shows a flow diagram of a process when a target node in a blockchain network is offline according to one embodiment of the present application;
FIG. 9 shows a flowchart of steps following step 250 in FIG. 2 according to one embodiment of the present application;
FIG. 10 shows a block diagram of a face recognition apparatus according to an embodiment of the present application;
FIG. 11 illustrates a schematic structural diagram of a computer system suitable for use in implementing the electronic device of an embodiment of the present application.
Detailed Description
Example embodiments will now be described more fully with reference to the accompanying drawings. Example embodiments may, however, be embodied in many different forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the concept of example embodiments to those skilled in the art.
Furthermore, the described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided to give a thorough understanding of embodiments of the application. One skilled in the relevant art will recognize, however, that the subject matter of the present application can be practiced without one or more of the specific details, or with other methods, components, devices, steps, and so forth. In other instances, well-known methods, devices, implementations, or operations have not been shown or described in detail to avoid obscuring aspects of the application.
The block diagrams shown in the figures are functional entities only and do not necessarily correspond to physically separate entities. I.e. these functional entities may be implemented in the form of software, or in one or more hardware modules or integrated circuits, or in different networks and/or processor means and/or microcontroller means.
The flow charts shown in the drawings are merely illustrative and do not necessarily include all of the contents and operations/steps, nor do they necessarily have to be performed in the order described. For example, some operations/steps may be decomposed, and some operations/steps may be combined or partially combined, so that the actual execution sequence may be changed according to the actual situation.
Currently, many scenes require the use of offline face recognition. As described above, in the related art, the scheme for implementing offline face recognition mainly stores an offline face feature library in the local of the terminal. The file size of an offline human face feature library is usually as high as several hundred megabytes, so that a large amount of network flow is consumed, a lot of local storage resources are occupied, and the waste of the storage resources is caused.
Therefore, the application firstly provides a face recognition method. The face recognition is a biological recognition technology for performing identity recognition based on facial feature information of a person, and the technology is a series of related technologies, generally called face recognition and face recognition, for acquiring an image or video stream containing a face by using a camera or a camera, automatically detecting and tracking the face in the image, and further performing face recognition on the detected face. According to the face recognition method, the face related data are stored in each node of the block chain network in a scattered mode, face recognition is carried out based on the face related data, and therefore network flow and storage resources consumed by storing the face related data can be reduced.
Fig. 1 shows a schematic diagram of an exemplary system architecture to which the technical solution of the embodiments of the present application can be applied. As shown in fig. 1, the system architecture may include a blockchain network 100, a network 110, and a cloud server 120, where 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, and each node in the blockchain network 100 is an Internet of Things (IoT) device for brushing faces, and the IoT device for brushing faces may be disposed in a store of a merchant, and the IoT device for brushing faces has a camera capable of collecting face data, and is configured to perform payment for brushing faces when a consumer pays, and may perform offline payment. Any two nodes in the blockchain network 100 may communicate with each other, and each node in the blockchain network 100 may also communicate with the cloud server 120 through the network 110. The process of implementing face recognition by using the system architecture shown in fig. 1 is as follows: firstly, 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 according to the obtained face related data and adds the block to a block chain, so as to establish the block chain, and the block chain is stored on a plurality of nodes in the block chain network; finally, when a certain node in the blockchain network 100 receives a face retrieval request, that is, when a certain face-brushing internet-of-things device needs face-brushing payment, face identification is completed by retrieving face-related data for the blockchain in each node.
It should be noted that fig. 1 shows only one embodiment of the present application. Although the face recognition is used in the face-brushing payment scene in the embodiment of fig. 1, the face recognition method provided by the application can also be applied to other various scenes needing face-brushing recognition, such as an access control scene; although in the embodiment of fig. 1, the face-related data is downloaded from a cloud server by each node, in other embodiments of the present application, the face-related data may be downloaded from a server cluster or a database cluster comprising a plurality of servers by the node; although the blockchain network in the embodiment of fig. 1 includes only five nodes, in other embodiments or specific applications, more or fewer nodes may be included in the blockchain network. The embodiments of the present application are not limited in this respect, and the scope of protection of the present application should not be limited thereby.
Moreover, it is easy to understand that the face recognition method provided by the embodiment of the present application is executed by a face brushing device, and accordingly, the face recognition apparatus is generally a face brushing device. However, in other embodiments of the present application, the server may also have a similar function as the face brushing device, so as to execute the scheme of face recognition provided in the embodiments of the present application.
The face recognition method provided by the embodiment of the application is realized based on a block chain.
The blockchain is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, a consensus mechanism and an encryption algorithm. A block chain (Blockchain), which is essentially a decentralized database, is a series of data blocks associated by using a cryptographic method, and each data block contains information of a batch of network transactions, so as to verify the validity (anti-counterfeiting) of the information and generate a next block. The blockchain may include a blockchain underlying platform, a platform product services layer, and an application services layer.
The block chain underlying platform can comprise processing modules such as user management, basic service, intelligent contract and operation monitoring. The user management module is responsible for identity information management of all blockchain participants, and comprises public and private key generation maintenance (account management), key management, user real identity and blockchain address corresponding relation maintenance (authority management) and the like, and under the authorization condition, the user management module supervises and audits the transaction condition of certain real identities and provides rule configuration (wind control audit) of risk control; the basic service module is deployed on all block chain node equipment and used for verifying the validity of the service request, recording the service request to storage after consensus on the valid request is completed, for a new service request, the basic service firstly performs interface adaptation analysis and authentication processing (interface adaptation), then encrypts service information (consensus management) through a consensus algorithm, transmits the service information to a shared account (network communication) completely and consistently after encryption, and performs recording and storage; the intelligent contract module is responsible for registering and issuing contracts, triggering the contracts and executing the contracts, developers can define contract logics through a certain programming language, issue the contract logics to a block chain (contract registration), call keys or other event triggering and executing according to the logics of contract clauses, complete the contract logics and simultaneously provide the function of upgrading and canceling the contracts; the operation monitoring module is mainly responsible for deployment, configuration modification, contract setting, cloud adaptation in the product release process and visual output of real-time states in product operation, such as: alarm, monitoring network conditions, monitoring node equipment health status, and the like.
The platform product service layer provides basic capability and an implementation framework of typical application, and developers can complete block chain implementation of business logic based on the basic capability and the characteristics of the superposed business. The application service layer provides the application service based on the block chain scheme for the business participants to use.
The implementation details of the technical solution of the embodiment of the present application are set forth in detail below:
fig. 2 shows a flowchart of a face recognition method according to an embodiment of the present application, where the face recognition method may be executed by terminal devices with computing and communication functions, and these terminal devices may also collect face data through a set camera, such as the face-brushing IoT device in fig. 1, and specifically may be an intelligent payment hardware device such as the frog-first generation and the frog-second generation used for wechat payment. Specifically, in the embodiment of fig. 2, the execution subject may be a node in a blockchain network existing in the form of a terminal device, and any node in the blockchain network may execute the face recognition method in the embodiment of the present application. Referring to fig. 2, the face recognition method at least includes the following steps:
in step 210, a block chain network for data communication in the local area network is established with a terminal device for face recognition accessing the local area network as a block chain node.
The blockchain network includes a target node that generates and stores a target block and a query node for finding the target block.
A query node herein is a node other than a target node in a blockchain network, which may include a plurality of query nodes. Although the nodes in the blockchain network are distinguished into the target node and the query node in this step, this is only for the purpose of making the solution of the present application easier to understand. In fact, any node in the blockchain network may generate and store a block, and any node in the blockchain network may also search for the block.
Any two nodes in the block chain network can communicate with each other, each node can be provided with a client, and the nodes can communicate with each other by using the clients. The local area network covers a small area, such as a school, a mall or even a store.
In step 220, in the case that the target node accesses 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 face-related data is any data that can be used to identify identity information corresponding to a face. For example, the face related data may be data capable of completely recording face information, such as a face photo, a certain image frame in a face video stream, and even a group of image frames in the face video stream; in addition, the face-related data may also be face feature data extracted from data capable of completely recording face information, such as the aforementioned face photograph, an image frame or a group of image frames. The face feature data herein refers to feature data that can describe the shape of the face organs and the distance characteristics between them and contribute to face classification.
When the target node accesses the internet, the face related data can be downloaded from the server. A tile is a data structure that includes face related data and may also include other information. Any node in the block chain network can download the face related data for offline storage from the server.
The server may be various terminals or devices capable of storing data, for example, a server or a cluster of servers, and in a cloud technical scenario, the server may also be a cloud server located in a cloud end.
The target node can download the face related data from the server side at various moments according to various modes and rules.
For example, the face-related data may be downloaded from the server when the target node performs system initialization.
Fig. 3 is a schematic diagram illustrating an application architecture of a face recognition method according to an embodiment of the present application. When the scheme of the embodiment of the present application is applied to fig. 3, it is actually applied to a scenario of using a face-brushing IoT device to perform face-brushing payment. Referring to fig. 3, three boxes arranged from top to bottom respectively represent three parts of the application architecture, where a box located in the middle and a box located below are two parts of a private chain terminal network respectively, and the private chain terminal network represents that the block chain network in this embodiment is a block chain network in a private chain form established by using a terminal device. The content of the middle box describes how the blockchain of the face related data is stored in the blockchain network, and the content of the lower box describes a specific flow of face brushing payment based on the private chain terminal network. As can be seen from the contents of the lower box in fig. 3, after the face brushing is started, feature retrieval is performed at each node in the block chain network, and face recognition is performed.
Referring to fig. 3, the background in the upper square is the server, which stores the face-related data in the form of a face feature library, and the face-related data is the face feature data. The face feature library is a file for storing batch face feature data, the size of each face feature library is 5M, and each face feature library stores different face feature data, so that the storage of the face feature data can be realized in batch and orderly. And the nodes in the block chain network download the face related data by taking the face feature library as a unit. Specifically, as can be seen from the content in the middle box of fig. 3, the blockchain network includes 3 nodes, namely node 1, node 2, and node 3, where each node stores several blocks, each block contains 3 feature libraries, and each feature library is downloaded from the background (server) by the node storing the block containing the feature library.
In the embodiment of the present application, the face-related data is face feature data, and the size of the file of the face feature library storing the face feature data is 5M, and the face feature library can store hundreds of thousands of face feature data, so that it can be seen that, for two files of the same size, the number of the face feature data that can be stored in the file is far higher than the number of the face photos, and therefore, the storage resources consumed by face recognition can be greatly reduced by storing the face feature data in the face feature library in the embodiment of the present application.
Fig. 4 is a schematic diagram illustrating a status monitoring interface when a node downloads a facial feature library from a server in a blockchain network according to an embodiment of the present application. Referring to fig. 4, the status monitoring interface may be displayed on a node in the blockchain network or on a server. In fig. 4, a large cylinder at the top represents the state that all the face feature libraries in the server are downloaded, the relative sizes of the dark part in the large cylinder and the large cylinder represent the proportional relationship between the number of the downloaded face feature libraries in all the face feature libraries and the total number of all the face feature libraries, and meanwhile, the interface also displays the specific number, wherein the total number of the face feature libraries is 200, and the downloaded number of the face feature libraries is 120; the small cylinder located below the large cylinder represents the state of the storage capacity of each node in the block chain network, the relative size of the dark color part in the small cylinder and the small cylinder represents the proportional relation between the occupied capacity and the total capacity in the node, and meanwhile, 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 the node 1 is 590MB, the available capacity of the node 2 is 390MB, and the available capacity of the node 3 is 230 MB. In addition, the connection line between the node 1 and the server is a dashed line, and the connection lines between the node 2 and the node 3 and the server are solid lines. This means that currently, node 1 is not downloading data from the server, while both node 2 and node 3 are downloading data from the server. Therefore, through the state monitoring interface shown in fig. 4, a person can intuitively know the state of the whole system when the nodes in the blockchain network download the face feature library from the server.
In the face related data stored in the server, the face related data which can be downloaded by each node in the block chain network can be limited, so that the node cannot download the face related data at will.
In an embodiment of the present application, downloading, from a server, face-related data for offline storage through a target node includes: and downloading the face related data corresponding to the region identification information of the target node from the server through the target node.
Specifically, for example, an administrator of the target node may send a download request to the server by operating a terminal device, which is the target node, where the download request carries region identification information of the target node; the server stores region identification information and face related data corresponding to the region identification information; after receiving a downloading request sent by a target node, a server side can obtain region identification information of the target node in the downloading request; the server returns a download page to the target node according to the region identification information of the target node, the target node comprises a download inlet of the face-related data corresponding to the region identification information of the target node, and an administrator of the target node can download the face-related data corresponding to the region identification information of the target node through the download inlet.
For example, in a payment scenario, corresponding region identification information may be set for each region in a region, when a merchant purchases a face-brushing IoT device, the face-brushing IoT device may be provided according to an address provided by the merchant, and the face-brushing IoT device is configured with the region identification information corresponding to the region to which the address of the merchant belongs, so that a download request sent by the face-brushing IoT devices to a server may carry the region identification information of each node.
For another example, taking a payment scenario as an example, the face recognition method provided by the embodiment of the present application may be applied to a payment system. The payment system comprises a server. Each user submits information such as an address, a household address, a telephone, face original data and the like when registering a payment account with a server of the payment system, and the user can also provide position information for the payment system when using the payment system, so that the server can generate face related data by using the face original data, meanwhile, the server can determine region identification information corresponding to the information according to the information such as the address, the household address, the telephone, the position information and the like provided by the user, and further, the server can associate the face related data with the region identification information.
Therefore, in the embodiment, the face-brushing IoT device only needs to download the face-related data corresponding to the region identification information, so that the number of the face-related data to be downloaded is less, and network resources and storage resources can be saved; meanwhile, information such as an address, a household address, a telephone number, position information and the like of one payment account may correspond to different region identification information, and therefore, in the embodiment of the application, one face related data may be allowed to be associated with a plurality of region identification information, so that the storage redundancy of the face related data is improved, the same user can carry out offline face brushing payment in face brushing IoT equipment in different regions, and the user experience is improved.
In an embodiment of the present application, downloading, by a target node, face-related data corresponding to region identification information of the target node from a server, includes: the method comprises the steps that broadcast information sent to nodes in a block chain network by a server is received through a target node, face related data corresponding to region identification information of the target node are determined to be newly added in the server, and the face related data corresponding to the region identification information of the target node are downloaded from the server, wherein the broadcast information comprises the region identification information of the target node.
In the embodiment of the application, once the face related data is updated in the server, the corresponding terminal equipment can receive the broadcast information sent by the server, and then the terminal equipment can download the recently updated face related data from the server in time, so that the reliability of face identification is ensured.
In one embodiment of the present application, downloading the face-related data from the server for offline storage is performed periodically.
In an embodiment of the present application, before downloading, by the target node, the face-related data for offline storage from the server, the method further includes: determining the frequency of face recognition requests received by a target node every hour every day within a preset number of days before the current day; determining the hour with the lowest frequency of the face recognition requests received in the day as the low-frequency time period of the day aiming at each day in the preset number of days; determining a target low-frequency time period of the current day according to the low-frequency time period of each day; downloading face related data for offline storage from a server through a target node, comprising: and downloading the face related data for offline storage from the server through the target node in the target low-frequency period of the current day.
In one embodiment of the present application, determining a target low frequency period of a current day according to the low frequency period of each day includes: determining the number of days corresponding to each low-frequency time period; and taking the low-frequency time period with the maximum corresponding days as the target low-frequency time period of the current day.
For example, if the predetermined number of days is 7 days, then if the number of days in the low frequency period of 21:00-22:00 is 1, the number of days in the low frequency period of 22:00-23:00 is 2, and the number of days in the low frequency period of 23:00-24:00 is 4, then the determined target low frequency period is 23:00-24:00, that is, the face related data will be downloaded from the server within 23:00-24:00 of the day.
When the frequency of the face recognition requests received by the terminal device within one hour is relatively high, it indicates that the load of the terminal device is relatively high, and at this time, if the face-related data is downloaded from the server, the load of the terminal device is further increased, and the performance of the terminal device may be affected. In the embodiment of the application, the data is downloaded from the server side when the load of the terminal equipment is low by predicting the low-frequency time period of the day and downloading the face related data in the low-frequency time period, so that the influence on the performance of the terminal equipment is avoided; meanwhile, the low-frequency period of the current day is determined according to the frequency of the face recognition requests received in each hour within the preset number of days before the current day, so that the accuracy of the predicted low-frequency period can be improved.
In an embodiment of the application, after each node in the block chain network sends a download request to the server, each download request is sent to the request message queue according to the time sequence of the requests, and each node downloads the face-related data from the server in sequence according to the sequence of the sent download requests in the request message queue.
In the embodiment of the application, the download requests of all the nodes are stored into the request message queue according to the sending sequence, and the server side processes all the download requests in sequence, so that the message queue is utilized to realize peak clipping processing of the download requests, system breakdown caused by receiving a large number of download requests in a short time by the server side is avoided, and the availability of the system is improved.
In one embodiment of the present application, the target node is a terminal device in a blockchain network, which is continuously in an idle state for the longest time, where the idle state is a state in which the terminal device does not download face related data and does not generate a block.
That is, the target node is the terminal device having the longest idle time among the terminal devices, and the idle time is a time from the time when the block was generated most recently to the current time. The idle time lengths corresponding to the terminal devices can be sorted from large to small, the terminal devices sequentially download the face-related data according to the sorting, and generate and pack blocks according to the face-related data.
In the embodiment of the application, each terminal device downloads the face related data and generates the blocks in sequence according to the idle time, so that the pressure of the server is greatly reduced, idle terminal devices in a block chain network can be fully used, and the utilization rate of resources is improved.
In one embodiment of the present application, the specific steps of the block generation process are shown in fig. 5. Fig. 5 shows a flow diagram of a generation process of a tile according to an embodiment of the present application. Please refer to fig. 5, which specifically includes the following steps:
in step 510, identification information of the target node and a first hash value of a block newly added to the block chain are obtained.
The identification information of the target node is information capable of uniquely identifying one target node, and the data type of the identification information of the target node may be a character string, which may include letters, numbers, underlines, and the like.
The blocks added into the block chain are sequentially connected to form a block chain. Thus, the blocks have a certain order when added to the block chain. The block which is added to the block chain last, namely the block which is added to the block chain last before the current time, and each block has a hash value.
In step 520, a second hash value is determined according to the identification information of the target node, the first hash value, and the face-related data.
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, so as to obtain a second hash value.
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.
The role and location of the second hash value in the generated chunk is similar to the role and location of the first hash value in the previously described chunk that was most recently added to the blockchain.
In one embodiment of the present application, the specific steps of step 530 may be as shown in fig. 6. FIG. 6 shows a flowchart of details of step 530 in FIG. 5, according to one embodiment of the present application. As shown in fig. 6, step 530 specifically includes the following steps:
in step 531, the face related data is encrypted to obtain encrypted face related data.
In an embodiment of the present application, encrypting the face-related data to obtain encrypted face-related data includes: and encrypting the face related data by using a key locally stored in the target node to obtain the encrypted face related data, wherein the key cannot be acquired by a user of the target node.
For example, in a payment scenario, face-related data may be encrypted using a symmetric key, which is burned onto a Read-Only Memory (ROM) of the face IoT device. The symmetric key is burnt in the ROM of the face-brushing IoT device, so that the symmetric key cannot be forcibly acquired through technical means, and the safety of data storage is improved.
In an embodiment of the present application, before encrypting the face-related data to obtain the encrypted face-related data, the method further includes: acquiring an encrypted symmetric key periodically sent by a server, wherein the encrypted symmetric key is formed by encrypting the symmetric key by the server by using a public key of a target node; decrypting the encrypted symmetric key based on the private key of the target node to obtain a symmetric key; encrypting the face related data to obtain the encrypted face related data, comprising: and encrypting the face related data by using the symmetric key to obtain the encrypted face related data.
The private key and the symmetric key of the target node are burnt in the ROM of the target node to improve the security.
In the embodiment of the application, the automatic updating of the symmetric key in the terminal equipment is realized, the encryption security of the face related data is effectively ensured, and the symmetric key is generated by the server side through the encryption of the public key of the terminal equipment, and the private key of the terminal equipment is only stored in the terminal equipment, so that only the terminal equipment can obtain the plaintext of the symmetric key, and the transmission security of the symmetric key is improved.
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 packed into a block.
Specifically, the information, such as the identification information of the target node, the encrypted face-related data, the first hash value, and the second hash value, is data-packaged according to the data structure of the block, so as to obtain the block, and the arrangement order of the information in the block may be arbitrary.
Because the face related data in the block chain is encrypted, when face retrieval is required, the encrypted face related data needs to be decrypted.
According to the embodiment shown in fig. 6, the face-related data is encrypted first, and then the blocks are packed, so that the safety of the face-related data is further improved, and the privacy of the user is prevented from being revealed.
In an embodiment of the present application, the face-related data is stored in a face feature library located at the server, and the method further includes: and if the size of the block file packed according to the downloaded but unpacked face feature library exceeds the preset file size after the target face feature library is downloaded according to the size of the downloaded target face feature library, packing the currently downloaded but unpacked face feature library into a block.
The target facial feature library is currently being downloaded, and therefore, the currently downloaded but unpacked facial feature library does not include the target facial feature library.
Referring to fig. 3, according to the contents of the middle boxes, each block includes the hash value of the previous block and the hash value of the current block, and the blocks are sequentially connected according to the hash values to form a block chain. Each block includes 3 face feature libraries, for example, a created block includes a feature library 1, a feature library 2, and a feature library 3, and a block 1 includes a feature library 4, a feature library 5, and a feature library 6, and so on, where the created block is the first generated block in a block chain, and the hash value of the created block is null when the blocks are packed. In the embodiment of the present application, when the facial feature library downloaded by each face-brushing IoT device exceeds 20M, the face-brushing IoT device is responsible for packaging and integrating the facial feature libraries into one block file. Since the file size of each facial feature library is 5M, after three facial feature libraries are downloaded, the face-brushing IoT device needs to pack the facial feature libraries into blocks, because the blocks also include hash values, node identification information, and other information, and if 4 facial feature libraries are downloaded and then packed, the blocks are too large.
With continued reference to fig. 2, in step 230, the target block is stored at the target node, and uplink information of the target block is broadcast by the target node over the blockchain network.
The uplink information is used to indicate the link relationship between the target block and other blocks in the block chain.
The face related data downloaded by the terminal equipment from the server side in the block chain network is finally stored in a block form. Other nodes than the target node in the blockchain network may receive the uplink information.
Specifically, the uplink information may include identification information, a first hash value, and a second hash value in the target block, and since the first hash value belongs to a block that is newly added to the block chain, the link relationship between the target block and another block may be determined based on the first hash value in the block that is newly added to the block chain and the second hash value in the target block; of course, the uplink information may only include the identification information, the second hash value, and the timestamp in the target block, and the timestamp reflects the transmission time of the uplink information, so that the link relationship between the target block and other blocks may be determined based on the sequence of the timestamps.
In step 240, when the inquiring node receives the uplink information broadcasted in the blockchain network, the inquiring node stores the block record generated according to the uplink information.
The block record includes a query path for finding a target block.
The form of data in the block record may be various. The block record includes the link relations of each block in the block chain, and the link relations are part of the query path of each block.
Specifically, in an embodiment of the present application, the uplink information includes a hash value and identification information of a target node, and when the querying node receives uplink information broadcasted in a block link network, the storing, at the querying node, a block record generated according to the uplink information includes: when the inquiry node receives uplink information broadcasted in the block chain network, the hash value contained in the uplink information and the identification information of the target node are stored to the inquiry node as a block record.
In practice, the uplink information may be a part of the block record, and the uplink information corresponds to the part of the target block in the block record.
The hash value stored as the block record in the uplink information at the querying node may be the second hash value, or may include both the first hash value and the second hash value. When the hash value is the second hash value, the uplink information may further include a timestamp, and the timestamp may be further stored as a block record to the query node. The sequence of the timestamps represents the link relation of each block.
According to the method and the device, the establishment of the block chain is realized by broadcasting the uplink information to other nodes in the block chain network, so that each block added into the block chain can obtain the information of the block newly added into the block chain.
In step 250, in response to the face recognition request, each block in the block chain is traversed according to the block record stored on the query node to obtain a face recognition result.
The contents of the face recognition request include face data. Face recognition requests are typically triggered based on invocation of a functional module that relies on face recognition. For example, in a payment scenario, the functional module is a payment module, and when a user performs a face-brushing payment operation on a face-brushing IoT device, the generation of the face recognition request is triggered. It should be noted that the face recognition request herein may not be a network request, and may be, for example, an interface call request or parameter passing between methods.
The face data is any data that can be used to identify identity information corresponding to a face. For example, the face data may be data capable of completely recording face information, such as a face photograph, a certain image frame in a face video stream, and even a group of image frames in the face video stream; in addition, the face data may also be face feature data extracted from data capable of completely recording face information, such as the aforementioned face photograph, an image frame or a group of image frames.
The node that receives the face recognition request may be any query node in the blockchain network. Since the block record includes the query path of each block, the traversal of each block in the block chain can be realized according to the block record.
Traversing a block in a blockchain is actually a process of retrieving the blockchain, a face recognition result is provided by nodes in the blockchain network, and when each node in the blockchain network is retrieved, each node can return the face recognition result. In the embodiment of the present application, the blocks in the block chain are generated according to the face-related data. Therefore, by searching the block chain, 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 that the identity information corresponding to the face data can be identified.
If the target node is searched to find that the face-related data in the target block matches the face data contained in the face recognition request, the target node returns a face recognition result to the node receiving the face recognition request, and the form of the face recognition result returned by the nodes in the block chain network can be various.
For example, the node may store identity information corresponding to face-related data, and when face-related data matching the face data is retrieved from a node, the node may return the identity information corresponding to the face-related data as a face recognition result, and when face-related data matching the face data is not retrieved from the node, the face recognition result returned from the node may be information that can indicate query failure, such as "relevant data not retrieved", and the like. The identity information here may be any information capable of uniquely identifying the identity corresponding to the face, for example, the identity information may be user-specific information such as an identification number of the user, a bank card number, a mobile phone number, and the like, or may be identification information corresponding to the user-specific information such as the identification number, the bank card number, the mobile phone number, and the like.
For another example, when face related data matching with face data is retrieved from a node, the node may return "query success" or similar information capable of indicating that the query is successful as a face recognition result, and when face related data matching with face data is not retrieved from the node, the face recognition result returned by the node may be "query failure" or related information capable of indicating that the query is failed.
Fig. 7 shows a flow diagram for retrieving a blockchain according to an embodiment of the present application.
Referring to fig. 7, the method includes the following steps:
in step 710, face data in the face recognition request is obtained.
The face identification request carries face data.
The face-related data may be data such as a face photograph that can completely record face information, or the aforementioned face feature data that can describe the shape of face organs and the distance characteristics between them and is helpful for face classification.
In step 720, the query path of each block in the block chain is determined according to the hash value in the block record and the identification information of the node.
When each block is in uplink packaging, other terminal equipment receives uplink information broadcast by the terminal equipment packaging the block, and the hash value in the uplink information and the identification information of the terminal equipment are stored in the block record.
According to the hash values (such as the first hash value and the second hash value) in the block record, the link relationship of each block can be determined, so that each terminal device in the block chain network knows the connection sequence of each block in the block chain; and then, according to the identification information of the node corresponding to each hash value in the block record, a query path for indicating which block on which node in the block chain network is sequentially queried can be determined.
In step 730, according to the query path, face data is sequentially sent to each node in the block chain network, and each node performs retrieval in the stored block to obtain a face recognition result returned by each node.
After the face-related data stored in each terminal device is encrypted, decryption is required to be performed, and then whether the stored face-related data is matched with the face data or not is judged, and each terminal device can specifically determine whether the face-related data is matched with the face data or not through various algorithms such as a deep learning model.
It can also be seen from fig. 3 that different blocks are stored scattered over multiple nodes. The nodes include the stored blocks, and also include the storage sequence of each block in the block chain on the nodes, and the storage sequence is the query path of the blocks and corresponds to the connection relationship of the blocks in the block chain. For example, the created block is located on node 1, and block 1 is located on node 3, so the storage sequence of the created block and block 1 is node 1- > node 3, that is, it is necessary to send the face data to node 1 first, and then send the face data to node 3.
According to the embodiment shown in fig. 7, the face data can be retrieved according to the storage sequence of the blocks on each terminal device, so that repeated retrieval is avoided, and the retrieval efficiency is ensured.
In an embodiment of the present application, if no face related data matching with the face data is retrieved from a node in the blockchain network, the node directly sends the face data to a next node according to the query path.
In the embodiment of the application, when the matched face related data is not retrieved on one terminal device, the current terminal device does not need to send the face data to other terminal devices after receiving the face recognition result returned by the terminal device, and the face recognition efficiency is improved. The embodiment of the application also realizes a backup mechanism.
Fig. 8 shows a flow diagram of a process when a target node in a blockchain network is offline according to one embodiment of the present application. Referring to fig. 8, the backup mechanism may be implemented by the following process:
in step 810, the working state of the target node is monitored through the inquiry node.
In an embodiment of the present application, the monitoring the working state of the target node by the querying node includes: receiving working state information periodically sent by a target node in a block chain network; and determining that the target node is in an offline state according to the working state information sent by the target node which is received in an undetermined period.
For example, all terminal devices in the whole blockchain network may issue broadcast messages to other terminal devices every 5 minutes to inform the current state information of the terminal devices, so that for each terminal device, the terminal devices know the survival state of each terminal device in the chain approximately in real time; when the time from the time when the current terminal device receives the broadcast information from the target terminal device last time to the current time exceeds the predetermined time, it can be determined that the target terminal device is in an off-line state.
In the embodiment of the application, the other terminal devices are determined to be in the offline state according to the working state information which is received from the other terminal devices in the block chain network at an undetermined period, so that when a certain terminal device in the block chain network is in a breakdown, fault and other accidents, the other terminal devices in the block chain network can also acquire the state information of the terminal device, and the operation reliability of the block chain network is improved.
In step 820, 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 face related data is downloaded by the node from the server, so that the server can know which face related data are downloaded and packaged by the target node and further know which face related data are contained in the target block generated by the target node, and thus, the server can provide the face related data in the target block to the query node.
In step 830, the target backup block is saved in 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 blockchain record.
The associated node information comprises identification information of the query node and identification information of the target node.
Since the target node is offline, in order to perform face recognition using the face-related data in the target block, the query node needs to store the face-related data in the target block instead of the target node in the block chain network.
When other nodes in the block chain network receive the associated node information, the contents in the associated node information are stored for the retrieval process of face recognition.
The associated node information corresponds to the target backup block, and reflects both which node the target backup block was generated from and which node the target backup block was used to replace.
The other nodes can at least store the identification information of the query node in the associated node information into the block record. Specifically, the other nodes may 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; the other nodes can correspondingly store the identification information of the query node and the identification information of the target node according to the identification information of the target node in the associated node information. The face related data in the target block is already stored in the target backup block in the query node, and then the other nodes replace the identification information of the target node in the block record with the identification information of the query node, so that when the nodes in the block chain network need to retrieve the face related data in the target block, the nodes can know that the face data needs to be sent to the query node in which the target backup block is stored.
Based on the embodiment shown in fig. 8, the backup of the face-related data in the target block in the blockchain network is realized, and even if the nodes in the blockchain network are offline, such as down, other nodes can perform face recognition smoothly.
It should be noted that the selection of a query node as the backup storage node of the target block may be determined according to various rules and mechanisms. For example, after each terminal device in the block chain monitors that a certain terminal device is down, the server may request to acquire the face-related data stored by the terminal device in a competitive manner, and the server may provide the corresponding face-related data to the first node that issues the request, and since the current query node is the node that issues the request first, the current query node can acquire the face-related data stored by the terminal device that is down from the server; as another example, the query node capable of downloading the face-related data in the target block may be a node in the block chain that is designated to obtain the face-related data stored by the terminal device that is down.
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 comprises: and according to the received working state information periodically sent by the target node, determining that the target node is restored to the online state, and clearing the stored target backup block.
In an embodiment of the application, the other nodes 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, and after receiving the working state information periodically sent by the target node, the other nodes reset the identification information of the query node replaced by the identification information of the target node in the block record to the identification information of the target node according to receiving the working state information periodically sent by the target node.
The working state information periodically sent by the target node can be received again, so that the target node can be determined to be restored to the online state, at the moment, the face related data stored on the target node can be used for face recognition, and the occupation of the storage space can be reduced by clearing the stored target backup block; and other nodes reset the identification information of the query node as the identification information of the target node, so that the target node can be obtained when the face related data in the target block needs to be used for matching.
In one embodiment of the present application, each node in the blockchain network is capable of collecting face data.
Specifically, when the embodiment of the application is used in a face-brushing payment scene, each node in the block chain network may be a face-brushing IoT device, and at this time, the node may store face-related data and may directly acquire face data.
In one embodiment of the application, each node in the blockchain network is used for face-brushing payment, and each node in the blockchain network corresponds to the same merchant identifier.
The merchant identifier is used to uniquely identify one merchant, and therefore, the size of the node corresponding to the same merchant identifier is very small, for example, each terminal node in the block chain network corresponding to the same merchant identifier may be a face-brushing IoT device in a store, and these face-brushing IoT devices may be deployed in a local area network, and data may be transmitted at high speed between each node by using the local area network, so that the delay of retrieving in the block chain network is greatly reduced, and the efficiency of face recognition is equivalent to the efficiency of face recognition when all the face-related data is stored locally.
FIG. 9 shows a flowchart of steps following step 250 in FIG. 2 according to one embodiment of the present application. As shown in fig. 9, after step 250, the following steps may be further included:
in step 910, if the face related data matched with 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 a payment account corresponding to the face related data.
For example, a node may store a payment account corresponding to face-related data, and when one face-related data on the node matches the face data, the node may return the payment account corresponding to the face-related data to the current node, and the current node may send a payment instruction to the server, where the payment instruction includes a payment bill corresponding to the payment account, so as to perform a payment operation.
The payment operation to the payment account is a transfer of the spending amount from the payment account to the merchant account.
In an embodiment of the present application, if face-related data matched with face data in a face recognition request is retrieved, a payment instruction is sent to a server through a query node, and a payment operation is performed on a payment account corresponding to the face-related data by the server, where the payment operation includes: and if the face related data matched with the face data in the face recognition request is retrieved, sending a payment instruction to the server when the query node is communicated with the network, and carrying out payment operation on a payment account corresponding to the face related data by the server.
Specifically, when the search in the blockchain network is completed, the payment account corresponding to the face related data matched with the face data can be obtained. At this time, because the current query node is not connected to the network, the payment bill 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 bill is sent to the server.
In this embodiment, delayed payment is realized, and through the scheme of the embodiment of the present application, even if the terminal device is not connected to the network temporarily, the payment operation can be completed smoothly as long as the terminal device can recover the connection with the network.
In step 920, if the face related data matched with 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 matched with the face data.
In the embodiment, only when the local area network cannot finish the face recognition, the server side carries out the face recognition and finishes the corresponding payment operation; in most cases, the face recognition is carried out in the local area network, so that the risk of network congestion is effectively reduced.
It should be noted that, although in the embodiment of the present application, sending the payment instruction and the face data to the server is performed by the query node that receives the face recognition request, in other embodiments of the present application, sending the payment instruction and the face data to the server may be performed by another node besides the current query node. Specifically, sending the payment instruction to the server may be performed by a node storing face-related data that matches the face data, and the face data may be performed by a node storing the last tile in the blockchain network.
Continuing to refer to fig. 3, it can be determined according to the content in the lower box of fig. 3 that, after the feature retrieval is performed, if the retrieval fails in the block chain network, that is, there is no face-related data matching the face data in the block chain, at this time, face recognition is performed at the cloud, and a fee is directly deducted after the recognition is completed; if the retrieval is successful in the blockchain network, but the current node is not connected with the network, the payment bill containing the payment account can be temporarily stored locally, and when the current node is connected with the network, a payment instruction containing the payment bill is sent to the server, so that delayed payment is realized.
It should be noted that, in the embodiment of the present application, the server performing the payment operation and the server from which the face-related data downloaded by the node is sourced are the same server, but in other embodiments of the present application, the servers performing the payment operation and the face-related data may also be different terminal devices.
In summary, according to the face recognition method provided by the embodiment of the application, the face-related data is downloaded from the server to the local, and the face data does not need to be uploaded and then face matching is performed, so that the face recognition efficiency can be improved; when the face recognition, particularly the off-line face recognition, is realized, the network flow consumed by storing the face related data in the local terminal can be reduced, the storage resources consumed by storing the face related data can also be reduced, the safety of data storage can be ensured by storing the face related data in the block chain, and the user privacy data can be effectively protected.
Embodiments of the apparatus of the present application are described below, which may be used to perform the face recognition method in the above embodiments of the present application. For details that are not disclosed in the embodiments of the apparatus of the present application, please refer to the embodiments of the face recognition method described above.
FIG. 10 shows a block diagram of a face recognition apparatus according to an embodiment of the present application. Referring to fig. 10, a face recognition apparatus 1000 according to an embodiment of the present application includes: a construction unit 1010, a download and generation unit 1020, a save and broadcast unit 1030, a reception and save unit 1040, and a traversal unit 1050.
The building unit 1010 is configured to build a block chain network for performing data communication in a local area network, with a terminal device for performing face recognition accessing the local area network as a block chain node, where the block chain 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 configured to, in a case where the target node accesses the internet, download, from a server, the face-related data for offline storage through the target node, and generate a target block containing the face-related data on the target node; the storing and broadcasting unit 1030 is configured to store the target block in the target node, and broadcast uplink information of the target block on the blockchain network through the target node, where the uplink information is used to indicate a link relationship between the target block and other blocks in a blockchain; the receiving and storing unit 1040 is configured to, when the querying node receives the uplink information broadcasted in the block chain network, store, on the querying node, a block record generated according to the uplink information, where the block record includes a querying path used for searching the target block; the traversal unit 1050 is configured to traverse each block in the block chain according to the block record stored on the query node in response to the face recognition request to obtain a face recognition result.
In some embodiments of the present application, based on the foregoing solution, the downloading and generating unit 1020 is configured to: acquiring identification information of the target node and a first hash value of a block which is newly added into a block chain; determining a second hash value according to the identification information of the target node, the first hash value and the face related data; and generating a block based on the identification information of the target node, the face-related data, the first hash value and the second hash value.
In some embodiments of the present application, based on the foregoing solution, the downloading and generating unit 1020 is configured to: encrypting the face related data to obtain encrypted face related data; and packaging the identification information of the target node, the encrypted face related data, the first hash value and the second hash value into a block.
In some embodiments of the present application, based on the foregoing scheme, the uplink information includes a hash value and identification information of the target node, and the receiving and storing unit 1040 is configured to: when the inquiry node receives the uplink information broadcasted in the block chain network, the hash value contained in the uplink information and the identification information of the target node are stored to the inquiry node as a block record.
In some embodiments of the present application, based on the foregoing scheme, traversal unit 1050 is configured to: acquiring face data in the face recognition request; determining a query path of each block in the block chain according to the hash value in the block record and the identification information of the node; and sequentially sending the face data to each node in the block chain network according to the query path, and retrieving in the stored blocks by each node to obtain a face recognition result returned by each node.
In some embodiments of the present application, based on the foregoing solution, the downloading and generating unit 1020 is further configured to: monitoring the working state of the target node through the query node; when the query node monitors that the target node in the block chain network is in an offline state, downloading the face related data in the target block generated by the target node from the server, and generating a target backup block containing the face related data in the target block on the query node; and storing the target backup block on the query node, and broadcasting the associated node information of the target backup block on the block chain network through the query node so as to enable other nodes in the block chain network to store the content in the associated node information into a block record, wherein the associated node information comprises the identification information of the query node and the identification information of the target node.
In some embodiments of the present application, based on the foregoing solution, the downloading and generating unit 1020 is configured to: receiving working state information periodically sent by the target node in the block chain network; and determining that the target node is in an offline state according to the working state information sent by the target node which is not received regularly.
In some embodiments of the present application, based on the foregoing solution, 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 further configured to: and according to the received working state information periodically sent by the target node, determining that the target node is restored to an online state, and clearing the stored target backup block.
In some embodiments of the present application, based on the foregoing scheme, each node in the blockchain network can acquire face data.
In some embodiments of the present application, based on the foregoing scheme, each node in the blockchain network is used for face-brushing payment, and each node in the blockchain network corresponds to the same merchant identifier.
In some embodiments of the present application, based on the foregoing solution, after traversing, in response to a face recognition request, each block in the block chain according to the block record stored on the query node to obtain a face recognition result, the traversing unit 1050 is further configured to: if the face related data matched with the face data in the face recognition request is retrieved, sending a payment instruction to the server through the query node, and carrying out payment operation on a payment account corresponding to the face related data by the server; and if the face related data matched with 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 operation on the payment account after determining the payment account matched with the face data.
In some embodiments of the present application, based on the foregoing scheme, traversal unit 1050 is configured to: and if the face related data matched with the face data in the face recognition request is retrieved, sending a payment instruction to the server when the query node is connected with the network, and carrying out payment operation on a payment account corresponding to the face related data by the server.
FIG. 11 illustrates a schematic structural diagram of a computer system suitable for use in implementing the electronic device of an embodiment of the present application.
It should be noted that the computer system 1100 of the electronic device shown in fig. 11 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present application.
As shown in fig. 11, a computer system 1100 includes a Central Processing Unit (CPU)1101, which can perform various appropriate actions and processes, such as performing the methods described in the above embodiments, according to a program stored in a Read-Only Memory (ROM) 1102 or a program loaded from a storage section 1108 into a Random Access Memory (RAM) 1103. In the RAM 1103, various programs and data necessary for system operation are also stored. The CPU 1101, ROM 1102, and RAM 1103 are connected to each other by a bus 1104. An Input/Output (I/O) interface 1105 is also connected to bus 1104.
The following components are connected to the I/O interface 1105: an input portion 1106 including a keyboard, mouse, and the like; an output section 1107 including a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, a speaker, and the like; a storage section 1108 including a hard disk and the like; and a communication section 1109 including a Network interface card such as a LAN (Local Area Network) card, a modem, or the like. The communication section 1109 performs communication processing via a network such as the internet. A driver 1110 is also connected to the I/O interface 1105 as necessary. A removable medium 1111 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 1110 as necessary, so that a computer program read out therefrom is mounted into the storage section 1108 as necessary.
In particular, according to embodiments of the application, the processes described above with reference to the flow diagrams may be implemented as computer software programs. For example, embodiments of the present application include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated by the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication portion 1109 and/or installed from the 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.
It should be noted that the computer readable medium shown in the embodiments of the present application may be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, 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 Disc Read-Only Memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present application, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In this application, however, a computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wired, etc., or any suitable combination of the foregoing.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present application. Each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units described in the embodiments of the present application may be implemented by software, or may be implemented by hardware, and the described units may also be disposed in a processor. Wherein the names of the elements do not in some way constitute a limitation on the elements themselves.
As an aspect, the present application also provides a computer-readable medium, which may be contained in the electronic device described in the above embodiments; or may exist separately without being assembled into the electronic device. The computer readable medium carries one or more programs which, when executed by an electronic device, cause the electronic device to implement the method described in the above embodiments.
It should be noted that although in the above detailed description several modules or units of the device for action execution are mentioned, such a division is not mandatory. Indeed, the features and functionality of two or more modules or units described above may be embodied in one module or unit, according to embodiments of the application. Conversely, the features and functions of one module or unit described above may be further divided into embodiments by a plurality of modules or units.
Through the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein may be implemented by software, or by software in combination with necessary hardware. Therefore, the technical solution according to the embodiments 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 disk, a removable 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 embodiments of the present application.
Other embodiments of the present application will be apparent to those skilled in the art from consideration of the specification and practice of the embodiments disclosed herein. This application is intended to cover any variations, uses, or adaptations of the invention following, in general, the principles of the application and including such departures from the present disclosure as come within known or customary practice within the art to which the invention pertains.
It will be understood that the present application is not limited to the precise arrangements 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 application is limited only by the appended claims.

Claims (15)

1. A face recognition method, comprising:
establishing a block chain network for data communication in a local area network by taking terminal equipment which is accessed to the local area network and used for carrying out face recognition as a block chain node, wherein the block chain network comprises a target node for generating and storing a target block and a query node for searching the target block;
under the condition that the target node is accessed 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;
storing the target block on the target node, and broadcasting uplink information of the target block on the block chain network through the target node, wherein the uplink information is used for representing the link relation between the target block and other blocks on a block chain;
when the query node receives the uplink information broadcasted in the block chain network, a block record generated according to the uplink information is stored on the query node, and the block record comprises a query path used for searching the target block;
and responding to a face recognition request, and traversing each block in the block chain according to the block record stored on the query node to obtain a face recognition result.
2. The method of claim 1, wherein the generating a target block containing the face-related data at the target node comprises:
acquiring identification information of the target node and a first hash value of a block which is newly added into a block chain;
determining a second hash value according to the identification information of the target node, the first hash value and the face related data;
and generating a block 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 of claim 2, wherein the generating a block based on the identification information of the target node, the face-related data, the first hash value, and the second hash value comprises:
encrypting the face related data to obtain encrypted face related data;
and packaging the identification information of the target node, the encrypted face related data, the first hash value and the second hash value into a block.
4. The face recognition method of claim 3, wherein the uplink information includes a hash value and identification information of the target node, and the storing, at the querying node, a block record generated according to the uplink information when the querying node receives the uplink information broadcasted in the block chain network comprises:
when the inquiry node receives the uplink information broadcasted in the block chain network, the hash value contained in the uplink information and the identification information of the target node are stored to the inquiry node as a block record.
5. The method of claim 4, wherein traversing the blocks in the block chain according to the block records stored in the query node to obtain the face recognition result in response to the face recognition request comprises:
acquiring face data in the face recognition request;
determining a query path of each block in the block chain according to the hash value in the block record and the identification information of the node;
and sequentially sending the face data to each node in the block chain network according to the query path, and retrieving in the stored blocks by each node to obtain a face recognition result returned by each node.
6. The face recognition method of claim 5, wherein the method further comprises:
monitoring the working state of the target node through the query node;
when the query node monitors that the target node in the block chain network is in an offline state, downloading the face related data in the target block generated by the target node from the server, and generating a target backup block containing the face related data in the target block on the query node;
and storing the target backup block on the query node, and broadcasting the associated node information of the target backup block on the block chain network through the query node so as to enable other nodes in the block chain network to store the content in the associated node information into a block record, wherein the associated node information comprises the identification information of the query node and the identification information of the target node.
7. The face recognition method of claim 6, wherein the monitoring the working state of the target node through the query node comprises:
receiving working state information periodically sent by the target node in the block chain network;
and determining that the target node is in an offline state according to the working state information sent by the target node which is not received regularly.
8. The face recognition method of claim 7, wherein after broadcasting the associated node information of the target backup block over the blockchain network through the query node, the method further comprises:
and according to the received working state information periodically sent by the target node, determining that the target node is restored to an online state, and clearing the stored target backup block.
9. The face recognition method of claim 1, wherein each node in the blockchain network is capable of collecting face data.
10. The face recognition method of claim 9, wherein each node in the blockchain network is used for face-brushing payment, and each node in the blockchain network corresponds to the same merchant identifier.
11. The method of claim 10, wherein after traversing each block in the block chain according to the block record stored on the query node to obtain a face recognition result in response to a face recognition request, the method further comprises:
if the face related data matched with the face data in the face recognition request is retrieved, sending a payment instruction to the server through the query node, and carrying out payment operation on a payment account corresponding to the face related data by the server;
and if the face related data matched with 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 operation on the payment account after determining the payment account matched with the face data.
12. The method according to claim 11, wherein if the face-related data matching the face data in the face recognition request is retrieved, sending a payment instruction to the server through the query node, and performing, by the server, a payment operation on a payment account corresponding to the face-related data, includes:
and if the face related data matched with the face data in the face recognition request is retrieved, sending a payment instruction to the server when the query node is connected with the network, and carrying out payment operation on a payment account corresponding to the face related data by the server.
13. An apparatus for face recognition, the apparatus comprising:
the system comprises a building unit, a searching unit and a processing unit, wherein the building unit is used for building a block chain network for carrying out data communication in a local area network by taking a terminal device which is accessed to the local area network and used for carrying out face recognition as a block chain node, and the block chain network comprises a target node for generating and storing a target block and a query node for searching the target block;
the downloading and generating unit is used for downloading the face related data for off-line storage from a server through the target node under the condition that the target node is accessed to the Internet, and generating a target block containing the face related data on the target node;
a storing and broadcasting unit, configured to store the target block in the target node, and broadcast uplink information of the target block on the blockchain network through the target node, where the uplink information is used to indicate a link relationship between the target block and other blocks in a blockchain;
a receiving and storing unit, configured to store, on the querying node, a block record generated according to the uplink information when the querying node receives the uplink information broadcasted in the block chain network, where the block record includes a querying path used for searching the target block;
and the traversing unit is used for responding to the face recognition request, and traversing each block in the block chain according to the block record stored on the query node to obtain a face recognition result.
14. A computer-readable medium, on which a computer program is stored, which, when being executed by a processor, carries out the face recognition method according to any one of claims 1 to 12.
15. An electronic device, comprising:
one or more processors;
storage means for storing one or more programs which, when executed by the one or more processors, cause the one or more processors to implement a face recognition method as claimed in any one of claims 1 to 12.
CN202110807730.2A 2021-07-16 2021-07-16 Face recognition method and device, computer readable medium and electronic equipment Pending CN113505260A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110807730.2A CN113505260A (en) 2021-07-16 2021-07-16 Face recognition method and device, computer readable medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110807730.2A CN113505260A (en) 2021-07-16 2021-07-16 Face recognition method and device, computer readable medium and electronic equipment

Publications (1)

Publication Number Publication Date
CN113505260A true CN113505260A (en) 2021-10-15

Family

ID=78013609

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110807730.2A Pending CN113505260A (en) 2021-07-16 2021-07-16 Face recognition method and device, computer readable medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN113505260A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114821751A (en) * 2022-06-27 2022-07-29 北京瑞莱智慧科技有限公司 Image recognition method, device, system and storage medium
CN116682167A (en) * 2023-08-01 2023-09-01 山东威尔数据股份有限公司 Cluster type IoT-based face feature extraction method

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114821751A (en) * 2022-06-27 2022-07-29 北京瑞莱智慧科技有限公司 Image recognition method, device, system and storage medium
CN116682167A (en) * 2023-08-01 2023-09-01 山东威尔数据股份有限公司 Cluster type IoT-based face feature extraction method
CN116682167B (en) * 2023-08-01 2023-10-27 山东威尔数据股份有限公司 Cluster type IoT-based face feature extraction method

Similar Documents

Publication Publication Date Title
US10129118B1 (en) Real time anomaly detection for data streams
CN110543464B (en) Big data platform applied to intelligent park and operation method
CN103098070B (en) For the methods, devices and systems of Data Position in monitoring network service
CN110826111B (en) Test supervision method, device, equipment and storage medium
CN108600163B (en) Cloud environment distributed hash chain architecture and cloud data integrity verification method
CN112632129B (en) Code stream data management method, device and storage medium
US8761727B2 (en) Method and apparatus for pre-caching in a telecommunication system
CN113505260A (en) Face recognition method and device, computer readable medium and electronic equipment
CN102739774A (en) Method and system for obtaining evidence under cloud computing environment
CN111488372A (en) Data processing method, device and storage medium
CN110866265A (en) Data storage method, device and storage medium based on block chain
CN110660466A (en) Personal health data chaining method and system of Internet of things by combining block chains
CN111241195B (en) Database processing method, device, equipment and storage medium of distributed system
CN113052721A (en) Electric power data processing method and device
CN110599144B (en) Network access method and device for blockchain nodes
CN110807209B (en) Data processing method, device and storage medium
CN112200680B (en) Block link point management method, device, computer and readable storage medium
Sultanov et al. Development of a centralized system for data storage and processing on operation modes and reliability indicators of power equipment
CN110633326A (en) Method and system for uplink of weather data of Internet of things on block chain
CN112511515B (en) Chain number cube for data chaining
CN114070847B (en) Method, device, equipment and storage medium for limiting current of server
CN113965434A (en) API gateway routing implementation method under cross-machine-room scene
CN116975158B (en) Request processing method, apparatus, computer device and storage medium
CN117057806B (en) Data processing method and device based on block chain and related equipment
CN116684425B (en) Block chain data processing method, system, device and computer equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
REG Reference to a national code

Ref country code: HK

Ref legal event code: DE

Ref document number: 40053647

Country of ref document: HK

SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination