Face recognition model updating method, device, equipment and medium
Through the face recognition model update method based on federated learning, the problems of insufficient face recognition model training data and privacy leakage are solved, and joint training with high accuracy and data security is achieved.
Patent Information
- Application Number
- CN202010202695.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-03-20
- Publication Date
- 2024-10-25
- Estimated Expiration
- 2040-03-20
AI Technical Summary
Insufficient training data for existing face recognition models results in low recognition accuracy and the risk of privacy data leakage.
The face recognition model update method based on federated learning is adopted to align the samples by receiving the user identification sent by the client, generate a face feature vector, and use the preset loss function to calculate the loss value. If the loss value is greater than the threshold, the face is updated. Identify the model to ensure that multiple parties can achieve joint training without leaking data privacy.
It effectively avoids the leakage of private data and improves the recognition accuracy and data security of the face recognition model.
Smart Images

Figure CN111401277B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of financial technology (Fintech), and in particular to a face recognition model updating method, device, equipment and medium. Background Art
[0002] In recent years, with the rapid development of Internet financial technology (Fintech), more and more technologies (big data, distributed, blockchain, artificial intelligence, etc.) are being applied in the financial field.
[0003] In order to ensure the security of financial services, the financial sector needs to authenticate users. Currently, face recognition is mainly used for identity authentication. Identity authentication is usually achieved through face recognition models. Face recognition models are trained using local data. Face recognition requires accurate extraction of facial features, so a large amount of data is required for training, and the same person must have as much data as possible in different postures and different environments. However, in real scenarios, few companies have a large amount of face data, and it is difficult to have data on the same person under different conditions. Models trained with insufficient data often have great limitations and are not accurate enough. In order to solve the above problems, data sharing solutions are currently used to obtain a large amount of data for model training. However, this type of data sharing has very high risks. Face data belongs to user privacy data, and shared data has a huge risk of privacy leakage. Summary of the invention
[0004] The main purpose of the present invention is to propose a face recognition model updating method, device, equipment and medium, aiming to solve the problem that the current face recognition model training data is insufficient, resulting in insufficient face recognition model learning, low recognition accuracy, and the risk of privacy data leakage.
[0005] To achieve the above object, the present invention provides a method for updating a face recognition model based on federated learning, and the method for updating a face recognition model based on federated learning comprises the following steps:
[0006] Receive user identifications sent by the client, and perform sample alignment on the user identifications of the same category;
[0007] Sending the sample identification group in the user identification to the client, and obtaining the face feature vector generated by the client after training the face recognition model;
[0008] Processing the facial feature vector by a preset loss function to obtain a loss value;
[0009] If the loss value is greater than a preset threshold, the loss value is sent to the client, so that the client calculates the gradient value according to the loss value and updates the face recognition model according to the gradient value.
[0010] Optionally, before the step of receiving the user identifier sent by the client and performing sample alignment on the user identifiers of the same category, the method includes:
[0011] When receiving the model update instruction, send the user ID application instruction to the clients in the alliance chain, so that each client can feedback the encrypted user ID;
[0012] The step of receiving the user identification sent by the client and performing sample alignment on the user identifications of the same category includes:
[0013] Receive a user ID sent by a client, and decrypt the user ID;
[0014] Obtain the decrypted user IDs of the same category, classify the user IDs of the same category, and perform data alignment according to the classified user IDs.
[0015] Optionally, the step of sending the sample identification group in the user identification to the client and obtaining the face feature vector generated after the client trains the face recognition model includes:
[0016] Randomly selecting a user identifier from the user identifiers as an anchor identifier, selecting a positive example identifier and a negative example identifier according to the anchor identifier, and treating the anchor identifier, the positive example identifier and the negative example identifier as a sample identifier group;
[0017] Selecting a preset number of sample identification groups from the user identifications, and obtaining a first identification associated with an anchor identification, a second identification associated with a positive example identification, and a third identification associated with a negative example identification in each of the sample identification groups;
[0018] The anchor point identifier is sent to a first client corresponding to the first identifier, the positive example identifier is sent to a second client corresponding to the second identifier, and the negative example identifier is sent to a third client associated with the third identifier, so as to process the face image corresponding to the anchor point identifier through the first client to obtain a face feature vector, process the face image corresponding to the positive example identifier through the second client to obtain a face feature vector, and process the face image corresponding to the negative example identifier through the third client to obtain a face feature vector.
[0019] Optionally, the step of processing the facial feature vector by a preset loss function to obtain a loss value includes:
[0020] Receive the facial feature vector sent by the client, and obtain the anchor facial feature vector corresponding to the anchor identifier in the facial feature vector, the positive facial feature vector corresponding to the positive identifier, and the negative facial feature vector corresponding to the negative identifier;
[0021] Calculating a first Euclidean distance between the anchor point face feature vector and the positive example face feature vector, and calculating a second Euclidean distance between the anchor point face feature vector and the negative example face feature vector;
[0022] The first Euclidean distance and the second Euclidean distance are processed according to a preset loss function to obtain a loss value.
[0023] Optionally, the step of sending the sample identification group in the user identification to the client and obtaining the face feature vector generated after the client trains the face recognition model includes:
[0024] Sending the sample identification group in the user identification to the client, and determining whether an initial face recognition model exists in the client;
[0025] If the initial face recognition model does not exist in the client, a pre-stored initial face recognition model is obtained and sent to the client, so that the client processes the face image corresponding to the sample identification group through the initial face recognition model to obtain a face feature vector.
[0026] Optionally, after the step of receiving the facial feature vector sent by the client and processing the facial feature vector to obtain a loss value, the method includes:
[0027] If the loss value is less than or equal to a preset threshold, stop updating the face recognition model.
[0028] Optionally, if the loss value is greater than a preset threshold, the loss value is sent to the client so that the client calculates the gradient value according to the loss value, and updates the face recognition model according to the gradient value, after the step, the method further includes:
[0029] Receive a face recognition instruction, obtain a target face image to be recognized, and send the target face image to a client, so that the client processes the target face image through a face recognition model to obtain a face recognition result;
[0030] Receive the face recognition result sent by the client, and when the face recognition result is wrong, trigger the model update instruction so that the client uses the target face image as a sample image to update the face recognition model.
[0031] In addition, to achieve the above-mentioned purpose, the present invention also provides a face recognition model updating device based on federated learning, and the face recognition model updating device based on federated learning comprises:
[0032] An identification receiving module, used for receiving a user identification sent by a client, and performing sample alignment on the user identifications of the same category;
[0033] An identification selection module, used to send the sample identification group in the user identification to the client, and obtain the face feature vector generated by the client after training the face recognition model;
[0034] A loss value calculation module, used for processing the face feature vector by a preset loss function to obtain a loss value;
[0035] A loss value sending module is used to send the loss value to the client if the loss value is greater than a preset threshold, so that the client calculates the gradient value according to the loss value and updates the face recognition model according to the gradient value
[0036] In addition, to achieve the above-mentioned purpose, the present invention also provides a face recognition model update device based on federated learning, and the face recognition model update device based on federated learning includes: a memory, a processor, and a computer program corresponding to the face recognition model update based on federated learning stored on the memory and runnable on the processor. When the computer program corresponding to the face recognition model update based on federated learning is executed by the processor, the steps of the face recognition model update method based on federated learning as described above are implemented.
[0037] In addition, to achieve the above-mentioned purpose, the present invention also provides a computer-readable storage medium, on which is stored a computer program corresponding to the update of a face recognition model based on federated learning. When the computer program corresponding to the update of a face recognition model based on federated learning is executed by a processor, the steps of the face recognition model update method based on federated learning as described above are implemented.
[0038] The present invention provides a method, device, equipment and medium for updating a face recognition model. In an embodiment of the present invention, a user identification sent by a client is received, and sample alignment is performed on the user identifications of the same category; a sample identification group in the user identification is sent to the client, and a face feature vector generated by the client after training a face recognition model is obtained; the face feature vector is processed by a preset loss function to obtain a loss value; if the loss value is greater than a preset threshold, the loss value is sent to the client, so that the client calculates a gradient value according to the loss value, and updates the face recognition model according to the gradient value. In an embodiment of the present invention, a face recognition model update method based on federated learning enables multiple parties to achieve joint training of face recognition without disclosing their own data privacy, effectively avoiding privacy data leakage, improving data security, and at the same time ensuring the accuracy of face recognition model recognition. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] Figure 1 It is a schematic diagram of the device structure of the hardware operating environment involved in the embodiment of the present invention;
[0040] Figure 2 It is a flowchart of a first embodiment of a method for updating a face recognition model based on federated learning of the present invention;
[0041] Figure 3 A schematic diagram of a specific scenario of the first embodiment of the method for updating a face recognition model based on federated learning of the present invention;
[0042] Figure 4 This is a schematic diagram of the functional modules of an embodiment of a face recognition model updating device based on federated learning of the present invention.
[0043] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0044] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.
[0045] like Figure 1 As shown, Figure 1 It is a schematic diagram of the device structure of the hardware operating environment involved in the embodiment of the present invention.
[0046] The face recognition model updating device based on federated learning in the embodiment of the present invention may be a PC or a server device, such as Figure 1As shown, the face recognition model update device based on federated learning may include: a processor 1001, such as a CPU, a network interface 1004, a user interface 1003, a memory 1005, and a communication bus 1002. Among them, the communication bus 1002 is used to realize the connection and communication between these components. The user interface 1003 may include a display screen (Display), an input unit such as a keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface). The memory 1005 may be a high-speed RAM memory, or a stable memory (non-volatile memory), such as a disk memory. The memory 1005 may also be a storage device independent of the aforementioned processor 1001.
[0047] Those skilled in the art will understand that Figure 1 The device structure shown in the figure does not constitute a limitation of the device, and may include more or less components than shown in the figure, or combine certain components, or arrange the components differently.
[0048] like Figure 1 As shown, the memory 1005 as a computer storage medium may include an operating network communication module, a user interface module, and a computer program corresponding to the face recognition model update based on federated learning.
[0049] exist Figure 1 In the device shown, the network interface 1004 is mainly used to connect to the background server and communicate data with the background server; the user interface 1003 is mainly used to connect to the client (user end) and communicate data with the client; and the processor 1001 can be used to call the computer program corresponding to the update of the face recognition model based on federated learning stored in the memory 1005, and perform the operations in the following face recognition model update method based on federated learning.
[0050] Based on the above hardware structure, an embodiment of a face recognition model updating method based on federated learning of the present invention is proposed.
[0051] Reference Figure 2 , Figure 2 1 is a flow chart of a first embodiment of a method for updating a face recognition model based on federated learning of the present invention. In this embodiment, the method for updating a face recognition model based on federated learning includes:
[0052] Step S10: receiving user identifications sent by the client, and performing sample alignment on the user identifications of the same category.
[0053] In this embodiment, the face recognition model update method based on federated learning is applied to face recognition model update devices in financial institutions (banking institutions, insurance institutions, securities institutions, etc.) in the financial industry, but is not limited to this field.
[0054] The face recognition model update device is a third-party node in the alliance chain. The face recognition model update device selects clients from the alliance chain (the client is the node in the alliance chain that needs to update the face recognition model). The number of clients is not specifically limited, and the number of clients is at least two. The face recognition model update device is an intermediate interaction node, and controls the client to update the face recognition model through the face recognition model update device.
[0055] The face recognition model update device receives the user identifier sent by the client, and the face recognition model update device unifies the user identifiers of the same category, that is, the face recognition model update device combines the user identifiers sent by each client to obtain a training set, and there are n different user identifiers in the training set. Before model training, the face recognition model update device classifies the user identifiers in the training set. Pictures of the same person belong to one category, and pictures of different people belong to different categories. The face recognition model update device unifies the user identifiers of the same category, and the face recognition model update device performs data alignment according to the unified user identifiers. It can be understood that the face recognition model update method in this embodiment is universal, and can be applied to scenarios where user identifiers overlap or do not overlap.
[0056] Step S20, sending the sample identification group in the user identification to the client, and obtaining the face feature vector generated by the client after training the face recognition model.
[0057] The face recognition model updating device will select a sample identification group from the user identification, and the face recognition model updating device will send the identifications in the sample identification group to the client according to the source. Specifically, step S20 in this embodiment includes:
[0058] Step a1, randomly selecting a user identifier from the user identifiers as an anchor identifier, selecting a positive example identifier and a negative example identifier according to the anchor identifier, and treating the anchor identifier, the positive example identifier and the negative example identifier as a sample identifier group;
[0059] Step a2, selecting a preset number of sample identification groups from the user identification, and obtaining a first identification associated with the anchor identification, a second identification associated with the positive example identification, and a third identification associated with the negative example identification in each of the sample identification groups;
[0060] Step a3: Send the anchor point identifier to the first client corresponding to the first identifier, send the positive example identifier to the second client corresponding to the second identifier, and send the negative example identifier to the third client associated with the third identifier, so as to process the face image corresponding to the anchor point identifier through the first client to obtain a face feature vector, process the face image corresponding to the positive example identifier through the second client to obtain a face feature vector, and process the face image corresponding to the negative example identifier through the third client to obtain a face feature vector.
[0061] In this embodiment, the face recognition model updating device randomly selects a user identifier from the user identifiers as an anchor identifier, the face recognition model updating device selects a user identifier of the same category as the anchor identifier as a positive example identifier, the face recognition model updating device selects a user identifier of a different category from the anchor identifier as a negative example identifier, and the face recognition model updating device uses the anchor identifier, the positive example identifier and the negative example identifier as a sample identifier group; the face recognition model updating device selects a preset number of sample identifier groups from the user identifiers (the preset number is set according to the specific scenario, for example, set to 100) to obtain a first identifier associated with the anchor identifier, a second identifier associated with the positive example identifier and a third identifier associated with the negative example identifier in each sample identifier group; the face recognition model updating device sends the anchor identifier to a first client corresponding to the first identifier, sends the positive example identifier to a second client corresponding to the second identifier, and sends the negative example identifier to a third client associated with the third identifier, so as to obtain a facial feature vector by processing the facial image corresponding to the anchor identifier through the first client, obtain a facial feature vector by processing the facial image corresponding to the positive example identifier through the second client, and obtain a facial feature vector by processing the facial image corresponding to the negative example identifier through the third client.
[0062] The face recognition model updating device randomly selects a user identifier from the user identifiers as an anchor identifier, the face recognition model updating device selects a user identifier of the same category as a positive example identifier, and the face recognition model updating device selects a user identifier of a different category as a negative example identifier; the face recognition model updating device uses the anchor identifier, the positive example identifier and the negative example identifier as a sample identifier group; for example, each sample identifier group contains three IDs: (anchor identifier (ANC_ID), positive example identifier (POS_ID), negative example identifier (NEG_ID)), these three IDs may come from the same client or from different clients, ANC_ID and POS_ID are IDs of the same category after alignment, and ANC_ID and NEG_ID are two IDs of different categories.
[0063] The face recognition model updating device selects a preset proportion (the preset proportion refers to a pre-set sample extraction ratio, and the preset proportion can be set according to the number of user identifiers. For example, if the number of user identifiers is 100,000, the preset proportion is set to 10%) of a sample identification group from a set of user identifiers. The face recognition model updating device sends the sample identification group to the client according to the source, so that the client processes the face image corresponding to the sample identification group through the initial face recognition model to obtain a face feature vector. The client sends the face feature vector to the face recognition model updating device.
[0064] Step S30, processing the facial feature vector by a preset loss function to obtain a loss value.
[0065] The face recognition model update device receives the face feature vector sent by the client, and the face recognition model update device inputs the face feature vector into a preset loss function (the preset loss function is specifically set according to the face recognition model), and processes the face feature vector sent by each client through the preset loss function to obtain a loss value, specifically, including:
[0066] Step b1, receiving the facial feature vector sent by the client, obtaining the anchor facial feature vector corresponding to the anchor identifier in the facial feature vector, the positive facial feature vector corresponding to the positive identifier, and the negative facial feature vector corresponding to the negative identifier;
[0067] Step b2, calculating a first Euclidean distance between the anchor point face feature vector and the positive example face feature vector, and calculating a second Euclidean distance between the anchor point face feature vector and the negative example face feature vector;
[0068] Step b3, processing the first Euclidean distance and the second Euclidean distance according to a preset loss function to obtain a loss value;
[0069] That is, the face recognition model update device receives the face feature vector sent by the client, and the face recognition model update device obtains the anchor face feature vector corresponding to the anchor point identifier in the face feature vector, the positive face feature vector corresponding to the positive example identifier, and the negative face feature vector corresponding to the negative example identifier. In this embodiment, the anchor face feature vector, the positive example face feature vector and the negative example face feature vector may come from the same client or from different clients. The face recognition model update device calculates the first Euclidean distance between the anchor face feature vector and the positive example face feature vector, and calculates the second Euclidean distance between the anchor face feature vector and the negative example face feature vector.
[0070] For example, the face recognition model update device records the face feature vector returned by client A as The facial feature vector returned by client B is recorded as The calculation formula of Euclidean distance is as follows:
[0071]
[0072] Face recognition model update device recalculation or This will not be described in detail in this embodiment.
[0073] After the face recognition model update device obtains the first Euclidean distance and the second Euclidean distance, the face recognition model update device brings the first Euclidean distance and the second Euclidean distance into a preset loss function to calculate a loss value. Specifically, the preset loss function is L=max(d(a,p)-d(a,n)+margin,0), where L represents the loss value, d(a,p) represents the first Euclidean distance between the anchor face feature vector and the positive example face feature vector, d(a,p) represents the second Euclidean distance between the anchor face feature vector and the negative example face feature vector, and margin represents a preset data, which can be set according to the specific scenario.
[0074] Step S40, if the loss value is greater than a preset threshold, the loss value is sent to the client, so that the client calculates the gradient value according to the loss value and updates the face recognition model according to the gradient value.
[0075] The face recognition model updating device compares the loss value with a preset threshold (the preset threshold refers to a pre-set critical value, for example, the preset threshold is set to 0.1). If the loss value is greater than the preset threshold, the face recognition model updating device sends the loss value to the client so that the client calculates the gradient value according to the loss value. The client updates the face recognition model in its respective local storage according to the gradient value. The client uses the updated face recognition model to iteratively process the face image corresponding to the sample identification group to obtain the face feature vector until the loss value is less than or equal to the preset threshold.
[0076] For example, refer to Figure 3 , Figure 3 This is a schematic diagram of a specific scenario of the first embodiment of the method for updating a face recognition model based on federated learning of the present invention.
[0077] Step 1: Use a node in the alliance chain as a face recognition model update device. The face recognition model update device aligns the encrypted data uploaded by the client. Specifically:
[0078] Step 1: The face recognition model update device has a globally unique ID for each face data (such as ID card information). This globally unique ID will be used as the key for data alignment. Since the client does not want the face recognition model update device (server) to know the true value of the ID it has, and alignment does not depend on the true value, the ID is mapped on the client (such as MD5 mapping) and the mapped MD5_ID is uploaded to the server.
[0079] Step 2: The face recognition model update device performs sample alignment based on the MD5_ID uploaded by the client. After alignment, the face recognition model update device knows which clients own each ID.
[0080] Step 2: Training sample construction and loss function calculation:
[0081] Step 1: Based on the aligned MD5_ID, the face recognition model update device can start constructing test samples. Each sample identification group contains three IDs: (ANC_ID point identification, POS_ID positive example identification, NEG_ID negative example identification). These three IDs may come from the same client or from different clients. ANC_ID and POS_ID are consistent IDs after alignment, and NEG_ID is an ID that is inconsistent with the above two IDs.
[0082] Step 2: The face recognition model update device sends the sample identification group to each client according to the ID source.
[0083] Step 3: Client A and Client B calculate the facial feature vector of the data based on their current initial facial recognition model (the facial feature vector refers to the dense vector used to characterize the user in facial recognition, generally 128, 256 or 512 dimensions). Client A and Client B homomorphically encrypt the calculated facial feature vector and return the encrypted result to the facial recognition model update device.
[0084] Step 4: The face recognition model update device calculates the loss value after homomorphic encryption based on the returned homomorphic decrypted face feature vector.
[0085] The face recognition model update device records the face feature vector returned by client A as The facial feature vector returned by client B is recorded as [[·]] represents homomorphic encryption. Client A and client B perform homomorphic encryption on their respective facial feature vectors, denoted as and Since each client returns at the same time, the returned result is and
[0086] After receiving the result, the server calculates the loss function. The loss function is calculated as follows:
[0087] L=max(d(a,p)-d(a,n)+margin,0),
[0088] The face recognition model updating device calculates the first Euclidean distance between the anchor face feature vector and the positive face feature vector, and calculates the second Euclidean distance between the anchor face feature vector and the negative face feature vector; the calculation formula of the Euclidean distance is as follows:
[0089]
[0090] The face recognition model update device is calculated according to the same algorithm or This implementation will not be described in detail.
[0091] Step 3: Face recognition model update device updates the model according to the loss value:
[0092] Step 1: The face recognition model update device sends the calculated encrypted loss value to client A and client B respectively. Client A and client B decrypt it with the key, obtain the loss value related to their own parameters, and perform gradient calculation. Client A and client B update the model according to the results of the gradient calculation.
[0093] In the embodiment of the present invention, the face recognition model update method based on federated learning enables multiple parties to implement joint training of face recognition without disclosing their own data privacy, effectively avoiding the leakage of private data, improving data security, and ensuring the accuracy of face recognition model recognition. When training the face recognition model, face recognition is performed through the trained face recognition model, which improves the accuracy of identity authentication.
[0094] Furthermore, based on the first embodiment of the method for updating a face recognition model based on federated learning of the present invention, a second embodiment of the method for updating a face recognition model based on federated learning of the present invention is proposed.
[0095] This embodiment is the step before step S10 in the first embodiment. The difference between this embodiment and the above embodiment is that:
[0096] When a model update instruction is received, a user identification application instruction is sent to the clients in the alliance chain so that each client can feedback an encrypted user identification.
[0097] In this embodiment, the face recognition model update device receives a model update instruction, and the triggering method of the model update instruction is not specifically limited, that is, the model update instruction can be actively triggered by the user, for example, the user clicks the "Model Update" button on the display interface of the face recognition model update device to actively trigger the model update instruction; in addition, the model update instruction can also be automatically triggered, for example, the model update device is pre-set: when the model recognition accuracy is lower than the preset accuracy, the model update instruction is automatically triggered.
[0098] The face recognition model update device receives the model update instruction, and the face recognition model update device sends the user identification application instruction to the client in the alliance chain, so that each client can feedback the encrypted user identification. In this embodiment, the user identification selected in the client can be the user ID number, user mobile phone number and other identification information that uniquely identifies the user's identity. In addition, the client encrypts the user identification and sends the encrypted user identification to the face recognition model update device. In this embodiment, the encryption method of the client is not specifically limited. For example, the client adopts the MD5 encryption method.
[0099] Based on the above steps, step S10 in this embodiment includes:
[0100] Receive a user ID sent by a client, and decrypt the user ID;
[0101] Obtain the decrypted user IDs of the same category, classify the user IDs of the same category, and perform data alignment according to the classified user IDs.
[0102] The face recognition model update device receives the user identification sent by the client, and the face recognition model update device decrypts the user identification; obtains the decrypted user identification of the same category, and the face recognition model update device unifies the user identification of the same category, and performs data alignment according to the unified user identification. In this embodiment, the face recognition model update device receives the encrypted user identification sent by the client, and the face recognition model update device performs decryption processing. Due to the encryption processing, the face recognition model update device does not know the real user identification, which improves the confidentiality of the user identification data.
[0103] Furthermore, based on the above-mentioned embodiment of the face recognition model updating method based on federated learning of the present invention, a third embodiment of the face recognition model updating method based on federated learning of the present invention is proposed.
[0104] This embodiment is a refinement of step S20 in the first embodiment. The difference between this embodiment and the above embodiment is that:
[0105] Sending the sample identification group in the user identification to the client, and determining whether an initial face recognition model exists in the client;
[0106] If the initial face recognition model does not exist in the client, a pre-stored initial face recognition model is obtained and sent to the client, so that the client processes the face image corresponding to the sample identification group through the initial face recognition model to obtain a face feature vector.
[0107] In this embodiment, the face recognition model updating device selects a sample identification group from the user identification, and the face recognition model updating device obtains a first identification associated with an anchor identification, a second identification associated with a positive example identification, and a third identification associated with a negative example identification in the sample identification group; the anchor identification is sent to a first client corresponding to the first identification, the positive example identification is sent to a second client corresponding to the second identification, and the negative example identification is sent to a third client associated with the third identification; the face recognition model updating device determines whether an initial face recognition model exists in the first client, the second client, and the third client; if the initial face recognition model does not exist in the first client, the second client, and / or the third client, the face recognition model updating device sends the initial face recognition model to the first client, the second client, and / or the third client, so that the client processes the face image corresponding to the sample identification group through the initial face recognition model to obtain a face feature vector.
[0108] In this embodiment, the face recognition model update device controls the client to update the face recognition model. If there is no initial face recognition model in the client, the face recognition model update device sends the initial face recognition model to the client, so that each client can use local face images to perform training, effectively preventing the leakage of user information and ensuring data security.
[0109] Furthermore, based on the above-mentioned embodiment of the method for updating a face recognition model based on federated learning of the present invention, a fourth embodiment of the method for updating a face recognition model based on federated learning of the present invention is proposed.
[0110] This embodiment is the step after step S30 in the first embodiment. The difference between this embodiment and the above embodiment is that:
[0111] If the loss value is less than or equal to a preset threshold, it is determined that the face recognition model in the client meets the convergence condition, the face recognition model is updated, and an update completion prompt is sent to the client.
[0112] The face recognition model update device compares the loss value with a preset threshold value. If the loss value is greater than the preset threshold value, the face recognition model update device executes step S40 in the first embodiment: sending the loss value to the client, so that the client calculates the gradient value according to the loss value, and updates the face recognition model according to the gradient value; if the loss value is less than or equal to the preset threshold value, the face recognition model update device determines that the face recognition model in the client meets the convergence condition, and the face recognition model update device sends an update completion prompt to the client. In this embodiment, the face recognition model update device determines the end point of the model training based on the relationship between the loss value and the preset threshold value, so that the face recognition model is simple and accurate.
[0113] Furthermore, based on the above-mentioned embodiment of the method for updating a face recognition model based on federated learning of the present invention, a fifth embodiment of the method for updating a face recognition model based on federated learning of the present invention is proposed.
[0114] This embodiment is the step after step S40 in the first embodiment. The difference between this embodiment and the above embodiment is that:
[0115] Receive a face recognition instruction, obtain a target face image to be recognized, and send the target face image to a client, so that the client processes the target face image through a face recognition model to obtain a face recognition result;
[0116] Receive the face recognition result sent by the client, and when the face recognition result is wrong, trigger the model update instruction so that the client uses the target face image as a sample image to update the face recognition model.
[0117] The face recognition model update device receives the face recognition instruction, obtains the target face image to be recognized, and sends the target face image to the client, so that the client processes the target face image through the updated face recognition model to obtain the face recognition result; the client sends the face recognition result to the face recognition model update device, the face recognition model update device receives the face recognition result sent by the client, and the face recognition model update device determines whether the face recognition result is correct. When the face recognition result is correct, no processing is performed. When the face recognition result is wrong, the face recognition model update device triggers the model update instruction, so that the client uses the target face image as a sample image to update the face recognition model.
[0118] In this embodiment, the client performs face recognition through a face recognition model. When a recognition error occurs, the face recognition model update device performs secondary training, thereby improving the training accuracy of the face recognition model.
[0119] Reference Figure 4The present invention also provides a face recognition model updating device based on federated learning, and the face recognition model updating device based on federated learning comprises:
[0120] The identification receiving module 10 is used to receive the user identification sent by the client and perform sample alignment on the user identifications of the same category;
[0121] The identification selection module 20 is used to send the sample identification group in the user identification to the client, and obtain the face feature vector generated by the client after training the face recognition model;
[0122] A loss value calculation module 30, used to process the face feature vector by a preset loss function to obtain a loss value;
[0123] The loss value sending module 40 is used to send the loss value to the client if the loss value is greater than a preset threshold, so that the client calculates the gradient value according to the loss value and updates the face recognition model according to the gradient value.
[0124] In one embodiment, the face recognition model updating device based on federated learning includes:
[0125] The instruction sending module is used to send a user identification application instruction to the client in the alliance chain when receiving the model update instruction, so that each client can feedback the encrypted user identification;
[0126] The identification receiving module 10 includes:
[0127] A receiving and decrypting unit, used for receiving a user identification sent by a client, and decrypting the user identification;
[0128] The unified alignment unit is used to obtain the decrypted user identifiers of the same category, classify the user identifiers of the same category, and perform data alignment according to the classified user identifiers.
[0129] In one embodiment, the identification selection module 20 includes:
[0130] an identifier selection unit, configured to randomly select a user identifier from the user identifiers as an anchor identifier, select a positive example identifier and a negative example identifier according to the anchor identifier, and use the anchor identifier, the positive example identifier and the negative example identifier as a sample identifier group;
[0131] an association acquisition unit, configured to select a preset number of sample identification groups from the user identification, and acquire a first identification associated with the anchor identification, a second identification associated with the positive example identification, and a third identification associated with the negative example identification in each of the sample identification groups;
[0132] An identification feedback unit is used to send the anchor point identification to a first client corresponding to the first identification, send the positive example identification to a second client corresponding to the second identification, and send the negative example identification to a third client associated with the third identification, so as to process the face image corresponding to the anchor point identification through the first client to obtain a face feature vector, process the face image corresponding to the positive example identification through the second client to obtain a face feature vector, and process the face image corresponding to the negative example identification through the third client to obtain a face feature vector.
[0133] In one embodiment, the loss value calculation module 30 includes:
[0134] A vector selection unit, configured to receive the facial feature vector sent by the client, and obtain an anchor facial feature vector corresponding to the anchor identifier in the facial feature vector, a positive facial feature vector corresponding to the positive identifier, and a negative facial feature vector corresponding to the negative identifier;
[0135] A distance calculation unit, used to calculate a first Euclidean distance between the anchor point face feature vector and the positive example face feature vector, and to calculate a second Euclidean distance between the anchor point face feature vector and the negative example face feature vector;
[0136] A loss value calculation unit is used to process the first Euclidean distance and the second Euclidean distance according to a preset loss function to obtain a loss value.
[0137] In one embodiment, the identification selection module 20 includes:
[0138] An identification sending unit, used to send the sample identification group in the user identification to the client, and determine whether there is an initial face recognition model in the client;
[0139] The model sending unit is used to send the initial face recognition model to the client if the initial face recognition model does not exist in the client, so that the client processes the face image corresponding to the sample identification group through the initial face recognition model to obtain the face feature vector.
[0140] In one embodiment, the face recognition model updating device based on federated learning includes:
[0141] The update prompt module is used to stop updating the face recognition model if the loss value is less than or equal to a preset threshold.
[0142] In one embodiment, the face recognition model updating device based on federated learning further includes:
[0143] The recognition receiving module is used to receive a face recognition instruction, obtain a target face image to be recognized, and send the target face image to the client so that the client processes the target face image through a face recognition model to obtain a face recognition result;
[0144] The receiving trigger module is used to receive the face recognition result sent by the client, and when the face recognition result is wrong, trigger the model update instruction so that the client uses the target face image as a sample image to update the face recognition model.
[0145] Among them, the method implemented when the face recognition model updating device based on federated learning is executed at the location can refer to the various embodiments of the face recognition model updating method based on federated learning of the present invention, and will not be repeated here.
[0146] In the embodiment of the present invention, the face recognition model update device based on federated learning enables multiple parties to implement joint training of face recognition without disclosing their own data privacy, effectively avoiding the leakage of private data, improving data security, and ensuring the accuracy of face recognition model recognition. The above-mentioned face recognition model update method based on federated learning is adopted in financial institutions such as banks to train face recognition models, and face recognition is performed through the trained face recognition model, thereby improving the accuracy of identity authentication.
[0147] The present invention also provides a computer-readable storage medium.
[0148] The computer-readable storage medium of the present invention stores a computer program corresponding to the face recognition model update based on federated learning. When the computer program corresponding to the face recognition model update based on federated learning is executed by a processor, the steps of the face recognition model update method based on federated learning as described above are implemented.
[0149] Among them, the method implemented when the computer program corresponding to the face recognition model update based on federated learning running on the processor is executed can refer to the various embodiments of the face recognition model update method based on federated learning of the present invention, which will not be repeated here.
[0150] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or system including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or system. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or system including the element.
[0151] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.
[0152] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) as described above, and includes a number of instructions for a terminal device (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in each embodiment of the present invention.
[0153] The above are only preferred embodiments of the present invention, and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.
Claims
1. A face recognition model updating method based on federated learning, characterized in that: The face recognition model updating method based on federated learning comprises the following steps: Receive a user identifier sent by a client, and perform sample alignment on the user identifiers of the same category, wherein pictures of the same person belong to one category, and pictures of different people belong to different categories; Sending the sample identification group in the user identification to the client, and obtaining the face feature vector generated by the client after training the face recognition model; Processing the facial feature vector by a preset loss function to obtain a loss value; If the loss value is greater than a preset threshold, the loss value is sent to the client, so that the client calculates the gradient value according to the loss value and updates the face recognition model according to the gradient value; The step of sending the sample identification group in the user identification to the client and obtaining the face feature vector generated by the client after training the face recognition model includes: Randomly selecting a user identifier from the user identifiers as an anchor identifier, selecting a positive example identifier and a negative example identifier according to the anchor identifier, and treating the anchor identifier, the positive example identifier and the negative example identifier as a sample identifier group; Selecting a preset number of sample identification groups from the user identifications, and obtaining a first identification associated with an anchor identification, a second identification associated with a positive example identification, and a third identification associated with a negative example identification in each of the sample identification groups; Sending the anchor point identifier to a first client corresponding to the first identifier, sending the positive example identifier to a second client corresponding to the second identifier, and sending the negative example identifier to a third client associated with the third identifier, so as to process the face image corresponding to the anchor point identifier through the first client to obtain a face feature vector, process the face image corresponding to the positive example identifier through the second client to obtain a face feature vector, and process the face image corresponding to the negative example identifier through the third client to obtain a face feature vector; The step of processing the face feature vector by a preset loss function to obtain a loss value comprises: Receive the facial feature vector sent by the client, and obtain the anchor facial feature vector corresponding to the anchor identifier in the facial feature vector, the positive facial feature vector corresponding to the positive identifier, and the negative facial feature vector corresponding to the negative identifier; Calculating a first Euclidean distance between the anchor point face feature vector and the positive example face feature vector, and calculating a second Euclidean distance between the anchor point face feature vector and the negative example face feature vector; The first Euclidean distance and the second Euclidean distance are processed according to a preset loss function to obtain a loss value.
2. The method for updating a face recognition model based on federated learning according to claim 1, characterized in that: Before the step of receiving the user identification sent by the client and performing sample alignment on the user identifications of the same category, the method includes: When receiving the model update instruction, send the user ID application instruction to the clients in the alliance chain, so that each client can feedback the encrypted user ID; The step of receiving the user identification sent by the client and performing sample alignment on the user identifications of the same category includes: Receive a user ID sent by a client, and decrypt the user ID; Obtain the decrypted user IDs of the same category, classify the user IDs of the same category, and perform data alignment according to the classified user IDs.
3. The method for updating a face recognition model based on federated learning according to claim 1, characterized in that: Before the step of sending the sample identification group in the user identification to the client and obtaining the face feature vector generated by the client after training the face recognition model, the method includes: Sending the sample identification group in the user identification to the client, and determining whether an initial face recognition model exists in the client; If the initial face recognition model does not exist in the client, a pre-stored initial face recognition model is obtained and sent to the client, so that the client processes the face image corresponding to the sample identification group through the initial face recognition model to obtain a face feature vector.
4. The method for updating a face recognition model based on federated learning according to claim 1, characterized in that: After the step of receiving the facial feature vector sent by the client and processing the facial feature vector to obtain a loss value, the method includes: If the loss value is less than or equal to a preset threshold, stop updating the face recognition model.
5. The method for updating a face recognition model based on federated learning according to any one of claims 1 to 4, characterized in that: After the step of sending the loss value to the client if the loss value is greater than a preset threshold, so that the client calculates the gradient value according to the loss value, and updates the face recognition model according to the gradient value, the method further includes: Receive a face recognition instruction, obtain a target face image to be recognized, and send the target face image to a client, so that the client processes the target face image through a face recognition model to obtain a face recognition result; Receive the face recognition result sent by the client, and when the face recognition result is wrong, trigger the model update instruction so that the client uses the target face image as a sample image to update the face recognition model.
6. A face recognition model updating device based on federated learning, characterized in that: The face recognition model updating device based on federated learning includes: An identification receiving module, used to receive a user identification sent by a client, and perform sample alignment on the user identifications of the same category, wherein pictures of the same person belong to one category, and pictures of different people belong to different categories; An identification selection module, used to send the sample identification group in the user identification to the client, and obtain the face feature vector generated by the client after training the face recognition model; A loss value calculation module, used for processing the face feature vector by a preset loss function to obtain a loss value; A loss value sending module, configured to send the loss value to the client if the loss value is greater than a preset threshold, so that the client calculates a gradient value according to the loss value and updates the face recognition model according to the gradient value; The identification selection module comprises: an identifier selection unit, configured to randomly select a user identifier from the user identifiers as an anchor identifier, select a positive example identifier and a negative example identifier according to the anchor identifier, and use the anchor identifier, the positive example identifier and the negative example identifier as a sample identifier group; an association acquisition unit, configured to select a preset number of sample identification groups from the user identification, and acquire a first identification associated with the anchor identification, a second identification associated with the positive example identification, and a third identification associated with the negative example identification in each of the sample identification groups; an identification feedback unit, configured to send the anchor identification to a first client corresponding to the first identification, send the positive example identification to a second client corresponding to the second identification, and send the negative example identification to a third client associated with the third identification, so as to obtain a facial feature vector by processing the facial image corresponding to the anchor identification through the first client, obtain a facial feature vector by processing the facial image corresponding to the positive example identification through the second client, and obtain a facial feature vector by processing the facial image corresponding to the negative example identification through the third client; The loss value calculation module comprises: A vector selection unit, configured to receive the facial feature vector sent by the client, and obtain an anchor facial feature vector corresponding to the anchor identifier in the facial feature vector, a positive facial feature vector corresponding to the positive identifier, and a negative facial feature vector corresponding to the negative identifier; A distance calculation unit, used to calculate a first Euclidean distance between the anchor point face feature vector and the positive example face feature vector, and to calculate a second Euclidean distance between the anchor point face feature vector and the negative example face feature vector; A loss value calculation unit is used to process the first Euclidean distance and the second Euclidean distance according to a preset loss function to obtain a loss value.
7. A face recognition model updating device based on federated learning, characterized in that: The face recognition model update device based on federated learning includes: a memory, a processor, and a computer program corresponding to the face recognition model update based on federated learning stored in the memory and executable on the processor. When the computer program corresponding to the face recognition model update based on federated learning is executed by the processor, the steps of the face recognition model update method based on federated learning as described in any one of claims 1 to 5 are implemented.
8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program corresponding to the update of the face recognition model based on federated learning. When the computer program corresponding to the update of the face recognition model based on federated learning is executed by the processor, the steps of the face recognition model update method based on federated learning as described in any one of claims 1 to 5 are implemented.
