Identification model updating method, device, equipment and storage medium
By aligning samples and constructing training samples on the server, the problem of leaking and low accuracy of the training data of the voiceprint recognition model is solved, efficient and safe update of the recognition model is achieved, and the recognition accuracy is improved.
Patent Information
- Application Number
- CN202010206242.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-03-20
- Publication Date
- 2025-02-07
- Estimated Expiration
- 2040-03-20
Smart Images

Figure CN111414636B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing technology of financial technology (Fintech), and in particular to a method, device, equipment and storage medium for updating a recognition model. Background Art
[0002] With the development of computer technology, more and more technologies are applied in the financial field. The traditional financial industry is gradually transforming to financial technology (Fintech), and data processing technology is no exception. However, due to the security and real-time requirements of the financial industry, higher requirements are also placed on data processing technology.
[0003] Existing voiceprint recognition models all use their own local data or some public data sets for model training. Voiceprint recognition requires accurate extraction of voiceprint features, so a large amount of data is needed for training, and the same user must have valid voice data as long as possible. However, in real scenarios, few companies can have a large amount of audio data from different users, and it is difficult to have sufficiently long audio data from the same user. Therefore, the voiceprint recognition model trained with the current audio data often has great limitations. The intra-class spacing of the same user and the inter-class spacing between different users are not learned accurately enough, which makes the generalization ability of the voiceprint recognition model poor and the accuracy of voiceprint recognition is not high enough. At present, it is often solved from the data level, such as sharing audio data to obtain a large amount of audio data for voiceprint recognition model training. However, user audio data belongs to user privacy data, and sharing audio data has a huge risk of privacy leakage. There are also some solutions that do not directly share the user's original audio data, but share the audio data after vectorization. This approach protects user privacy to a certain extent, but there are still two problems. First, the audio data after vectorization has a certain degree of content loss. Second, the shared vector may be able to reversely decode the original audio data, which still poses a risk of privacy leakage.
[0004] From this, we can see that there are problems of training data leakage and low recognition accuracy of the obtained recognition model in the current recognition model training process. Summary of the invention
[0005] The main purpose of the present invention is to provide a method, device, equipment and storage medium for updating a recognition model, aiming to solve the existing technical problems of training data leakage in the recognition model training process and low recognition accuracy of the obtained recognition model.
[0006] To achieve the above object, the present invention provides a method for updating a recognition model, which is applied to a server and comprises the following steps:
[0007] After receiving the user identification sent by each terminal device, detecting the type of the model to be updated in each terminal device;
[0008] If it is detected that the model to be detected in each terminal device belongs to the first type, sample alignment is performed according to the user identifier to obtain an aligned user identifier;
[0009] Constructing a training sample according to the aligned user identifiers, and sending the training sample to each terminal device according to the user identifier, so that each terminal device calculates a sample vector according to the received training sample;
[0010] Receive the sample vector sent by each terminal device, calculate the loss value according to the sample vector, and send the loss value to each terminal device so that each terminal device updates the corresponding first recognition model according to the loss value.
[0011] Optionally, the step of constructing training samples according to the aligned user identifiers includes:
[0012] Anchor training samples, positive training samples and negative training samples in the training samples are constructed according to the aligned user identifiers to obtain training samples, wherein the user identifiers corresponding to the anchor training samples and the positive training samples in the same training sample are the same, and the user identifiers corresponding to the negative training samples and the user identifiers corresponding to the positive training samples in the same training sample are different.
[0013] Optionally, the step of receiving the sample vector sent by each terminal device, calculating the loss value according to the sample vector, and sending the loss value to each terminal device so that each terminal device updates the corresponding first recognition model according to the loss value includes:
[0014] Receive the homomorphically encrypted sample vector sent by each terminal device to obtain an encrypted sample vector;
[0015] Calculating a loss value through the encrypted sample vector, and encrypting the loss value to obtain an encrypted loss value;
[0016] The encrypted loss value is sent to each terminal device so that each terminal device can decrypt the received encrypted loss value to obtain a decrypted loss value, and calculate a first gradient value based on the decrypted loss value, and update the corresponding first recognition model based on the first gradient value.
[0017] Optionally, the step of calculating the loss value through the encrypted sample vector includes:
[0018] Determine in the encrypted sample vectors that each training sample corresponds to an anchor vector of an anchor training sample, a positive vector of a positive training sample, and a negative vector of a negative training sample;
[0019] A first value is calculated by using the anchor vector and the positive example vector, and a second value is calculated by using the anchor vector and the negative example vector;
[0020] The loss value is calculated based on the first value, the second value and a preset constant variable.
[0021] Optionally, the step of sending the training sample to each terminal device according to the user identifier so that each terminal device calculates a sample vector according to the received training sample includes:
[0022] Determine the terminal device corresponding to each user identifier according to the device identifier corresponding to each user identifier;
[0023] The training samples are sent to the terminal devices corresponding to the respective user identifiers according to the user identifiers, so that the terminal devices can obtain sample vectors according to the received training samples.
[0024] Optionally, after the step of detecting the type of the model to be updated in each terminal device after receiving the user identification sent by each terminal device, the method further includes:
[0025] If it is detected that the model to be detected in each terminal device belongs to the second type, a preset second recognition model is sent to the terminal device corresponding to each user identifier, so that each terminal device obtains a second gradient value according to the second recognition model and local training data after receiving the second recognition model, and encrypts the second gradient value;
[0026] Receiving the encrypted second gradient value sent by each terminal device, and updating the model parameters of the second recognition model according to the encrypted second gradient value to obtain updated model parameters;
[0027] The updated model parameters are sent to each terminal device so that each terminal device updates the received second recognition model according to the updated model parameters.
[0028] Optionally, after receiving the user identification sent by each terminal device, before the step of detecting the type of the model to be updated in each terminal device, the method further includes:
[0029] Generate a public key, and send the public key to each terminal device, so that each terminal device encrypts the user identification according to the public key and sends the encrypted user identification.
[0030] In addition, to achieve the above-mentioned purpose, the present invention also provides a recognition model updating device, the recognition model updating method is applied to a terminal device, and the recognition model updating method comprises the following steps:
[0031] Sending the acquired user identification to the server, so that the server returns a training sample constructed based on the user identification when receiving the user identification and determining that the model to be updated in each terminal device belongs to the first type;
[0032] Receive the training sample sent by the server, and calculate the sample vector according to the training sample;
[0033] Sending the sample vector to the server, so that the server can calculate the loss value according to the sample vector;
[0034] Receive the loss value sent by the server, and update the pre-stored first recognition model according to the loss value.
[0035] Optionally, the first recognition model is a voiceprint recognition model, and after the step of receiving the loss value sent by the server and updating the pre-stored first recognition model according to the loss value, the method further includes:
[0036] When a voiceprint recognition request is detected, obtaining voiceprint data corresponding to the recognition request;
[0037] The voiceprint data is input into the updated voiceprint recognition model to determine the user corresponding to the voiceprint data.
[0038] In addition, to achieve the above-mentioned purpose, the present invention further provides a recognition model updating device, the recognition model updating device comprising:
[0039] A detection module, configured to detect the type of the model to be updated in each terminal device after receiving the user identification sent by each terminal device;
[0040] An alignment module, configured to perform sample alignment according to the user identifier to obtain an aligned user identifier if it is detected that the model to be detected in each terminal device belongs to the first type;
[0041] A construction module, used for constructing training samples according to the aligned user identifiers;
[0042] A sending module, used to send the training sample to each terminal device according to the user identifier, so that each terminal device can calculate a sample vector according to the received training sample;
[0043] A receiving module, used for receiving sample vectors sent by each terminal device;
[0044] A calculation module, used to calculate a loss value according to the sample vector;
[0045] The sending module is further used to send the loss value to each terminal device, so that each terminal device updates the corresponding first recognition model according to the loss value.
[0046] In addition, to achieve the above-mentioned purpose, the present invention also provides a recognition model updating device, which includes a memory, a processor, and a recognition model updating program stored in the memory and executable on the processor, and the recognition model updating program, when executed by the processor, implements the steps of the recognition model updating method corresponding to the federated learning server.
[0047] In addition, to achieve the above-mentioned purpose, the present invention also provides a computer-readable storage medium, on which a recognition model update program is stored, and when the recognition model update program is executed by a processor, the steps of the recognition model update method as described above are implemented.
[0048] The present invention performs sample alignment according to the user identifier after receiving the user identifier sent by each terminal device and detecting that the same user identifier exists in each terminal device, obtains the aligned user identifier, constructs a training sample according to the aligned user identifier, sends the training sample to each terminal device, receives the sample vector sent by each terminal device, calculates the loss value according to the sample vector, and sends the loss value to each terminal device, so that each terminal device updates the corresponding first recognition model according to the loss value, thereby achieving in the process of training the recognition model, that is, updating the recognition model, the server obtains the user identifier of each terminal device to construct the training sample, and updates the recognition model according to the training sample, without obtaining the local training data corresponding to each terminal device, thereby avoiding the problem of training data leakage, and because the server constructs the training sample according to the sample vector corresponding to the user identifier of each terminal device during the construction of the training sample, thereby improving the recognition accuracy of the updated recognition model. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] Figure 1 is a flow chart of a first embodiment of a method for updating a recognition model of the present invention;
[0050] Figure 2 is a flow chart of a second embodiment of a method for updating a recognition model of the present invention;
[0051] Figure 3 It is a functional schematic diagram module diagram of a preferred embodiment of the updating device of the recognition model of the present invention;
[0052] Figure 4 It is a structural diagram of the hardware operating environment involved in the embodiment of the present invention.
[0053] 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
[0054] 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.
[0055] The present invention provides a method for updating a recognition model, referring to Figure 1 , Figure 1 FIG. 4 is a flow chart of a first embodiment of a method for updating a recognition model according to the present invention.
[0056] The embodiment of the present invention provides an embodiment of a method for updating a recognition model. It should be noted that, although a logical sequence is shown in the flow chart, in some cases, the steps shown or described may be executed in an order different from that shown here.
[0057] The updating method of the recognition model is applied to a server or a terminal, and the terminal may include a mobile terminal such as a mobile phone, a tablet computer, a laptop computer, a PDA, and a fixed terminal such as a digital TV and a desktop computer. In each embodiment of the updating method of the recognition model, for the convenience of description, each embodiment is described with the server as the execution subject. The updating method of the recognition model includes:
[0058] Step S10: After receiving the user identification sent by each terminal device, the type of the model to be updated in each terminal device is detected.
[0059] After the server receives the user identification sent by each terminal device, the server detects the type of the model to be updated in each terminal device. In this embodiment, the model to be updated corresponds to two types. When there are triples in the update process of the model to be updated, the server can determine that the model to be updated belongs to the first type; when there are no triples in the update process of the model to be updated, the server determines that the model to be updated belongs to the second type. Among them, the triples are anchor training samples, positive training samples and negative training samples.
[0060] It should be noted that the user identification sent by each terminal device carries the device identification of the corresponding terminal device. The user identification can uniquely represent a user, and the device identification can uniquely represent a terminal device. Different users are distinguished by the user identification, and different terminal devices are distinguished by the device identification. In this embodiment, the representation form of the user identification and the device identification is not limited.
[0061] Furthermore, since each terminal device sends a user identifier to the server, in order to reduce the number of user identifiers sent by each terminal device to the server and improve the efficiency of data transmission between the terminal device and the server, the user identifiers sent by a single terminal device to the server are different.
[0062] Furthermore, when the user identification of the terminal device contains private information, such as the user identification is the user's personal information such as the ID number or telephone number, the terminal device will encrypt the user identification before sending it to the server, obtain the encrypted user identification, and then send the encrypted user identification to the server. Specifically, the terminal device can use a symmetric encryption algorithm or an asymmetric encryption algorithm to encrypt the user identification, such as each terminal device can use MD5 or other encryption algorithms to encrypt the user identification. It should be noted that the encryption algorithm used by each terminal device when encrypting the user identification is the same.
[0063] Step S20: If it is detected that the model to be detected in each terminal device belongs to the first type, sample alignment is performed according to the user identifier to obtain an aligned user identifier.
[0064] If the server determines that the model to be detected in each terminal device belongs to the first type, then the same user identifier exists in each terminal device, and the server performs sample alignment based on the received user identifier to obtain the aligned user identifier. It should be noted that after obtaining the aligned user identifier, the server can know which terminal devices each user identifier belongs to, that is, after sample alignment, the server can determine which terminal devices each user identifier exists in.
[0065] In this embodiment, the user identifier is used as the key value for sample alignment. It should be noted that, in the embodiment of the present invention, each terminal device does not want the server to know its real sample data. Therefore, in each terminal device, each user identifier has corresponding sample data. In order to protect the security of the sample data and prevent the sample data from being leaked, each terminal device only sends the user identifier to the server, but does not send the sample data corresponding to the user identifier to the server.
[0066] Step S30: construct training samples according to the aligned user identifiers, and send the training samples to each terminal device according to the user identifiers, so that each terminal device calculates a sample vector according to the received training samples.
[0067] When the server obtains the aligned user identifiers, the server constructs training samples according to the aligned user identifiers to obtain the constructed training samples, and then sends the training samples to each terminal device according to the user identifier corresponding to the training sample. Specifically, the terminal device determines the device identifier carried by the user identifier corresponding to each training sample, and sends the training sample to the terminal device corresponding to the device identifier, that is, returns the constructed training sample to each terminal device according to the source of the user identifier. For example, if the user identifier A1 is sent by the terminal device A to the server, the server will send the training sample corresponding to the user identifier A1 to the terminal device A. After each terminal device receives the training sample sent by the server, each terminal device calculates the corresponding sample vector based on the received training sample. It should be noted that, in this embodiment, the user identifier corresponding to the training sample is the user identifier of the anchor training sample or the positive training sample.
[0068] Furthermore, the step of constructing training samples according to the aligned user identifiers includes:
[0069] Step a, constructing anchor training samples, positive training samples and negative training samples in the training samples according to the aligned user identifiers to obtain training samples, wherein the user identifiers corresponding to the anchor training samples and the positive training samples in the same training sample are the same, and the user identifiers corresponding to the negative training samples in the same training sample are different from the user identifiers corresponding to the positive training samples.
[0070] Specifically, the server constructs an anchor training sample (anchor example), a positive training sample (positive example) and a negative training sample (negative example) in the training sample according to the aligned user identifier to obtain the training sample. It should be noted that each training sample includes an anchor training sample, a positive training sample and a negative training sample, wherein the user identifiers corresponding to the anchor training sample and the positive training sample in the same training sample are the same, and the user identifier corresponding to the negative training sample in the same training sample is different from the user identifier corresponding to the positive training sample. In the same training sample, the anchor training sample, the positive training sample and the negative training sample all have corresponding user identifiers, and these three user identifiers may come from the same terminal device or from different terminal devices.
[0071] The specific training samples in this embodiment can be determined according to the recognition model that needs to be updated. For example, if the recognition model that needs to be updated is a voiceprint recognition model, the corresponding data of the anchor training sample is the voiceprint audio of the target user, the target user is the user identified by the anchor training sample, and the corresponding data of the positive training sample is another voiceprint audio of the target user; the corresponding data of the negative training sample is the voiceprint audio of the non-target user, that is, the voiceprint audio of other users. If the recognition model that needs to be updated is a face recognition model, the corresponding data of the anchor training sample is the face image of the target user, the corresponding data of the positive training sample is another face image of the target user, and the corresponding data of the negative training sample is the face image of the non-target user.
[0072] It should be noted that the training samples constructed by the server only contain corresponding identifiers, but no corresponding sample data. For example, a training sample contains three identifiers, namely (ANC_ID, POS_ID, NEG_ID), where ANC_ID represents the identifier corresponding to the anchor training sample, POS_ID represents the identifier corresponding to the positive training sample, NEG_ID represents the identifier corresponding to the negative training sample, the user identifiers corresponding to ANC_ID and POS_ID are the same, and the user identifier corresponding to NEG_ID is different from the user identifiers corresponding to ANC_ID and POS_ID.
[0073] Furthermore, when the server constructs training samples according to the aligned user identifiers, the number of constructed training samples can be set according to specific needs, such as constructing a batch of training samples each time, or multiple batches of training samples, each batch of which can be 128 samples.
[0074] Furthermore, the step of sending the training sample to each terminal device according to the user identifier so that each terminal device calculates a sample vector according to the received training sample includes:
[0075] Step b: determining the terminal device corresponding to each user identification according to the device identification corresponding to each user identification.
[0076] Step c: sending the training samples to the terminal devices corresponding to the respective user identifiers according to the user identifiers, so that the terminal devices can obtain sample vectors according to the received training samples.
[0077] Specifically, after the server obtains the training sample, the server obtains the device identifier carried in each user identifier, determines the terminal device corresponding to each user identifier according to the device identifier carried in each user identifier, and sends the training sample to the terminal device corresponding to each user identifier according to the user identifier, that is, sends the training sample to the terminal device where the user identifier corresponding to the training sample is located. After each terminal device receives the training sample sent by the server, each terminal device obtains the sample data corresponding to the received training sample, converts the sample data into a sample vector, and thus obtains the sample vector corresponding to the training sample. In this embodiment, each terminal device can obtain the sample vector corresponding to the training sample through a neural network model. The sample vector can represent the specific information of the sample data and represent the relevant features of each user, such as a dense vector (embedding) of a voiceprint feature. In this embodiment, the sample vector can be 128-dimensional, 256-dimensional, or 512-dimensional. After each terminal device obtains the sample vector, each terminal device sends its own sample vector to the server.
[0078] Step S40, receiving the sample vector sent by each terminal device, calculating the loss value according to the sample vector, and sending the loss value to each terminal device, so that each terminal device updates the corresponding first recognition model according to the loss value.
[0079] When the server receives the sample vectors sent by each terminal device, the server calculates the loss value based on the sample vectors sent by each terminal device, and sends the calculated loss value to each terminal device. When each terminal device receives the loss value sent by the server, each terminal device updates the corresponding first recognition model based on the loss value. At this time, the model to be updated is the first recognition model. It should be noted that in each terminal device, there is a corresponding first recognition model, which can be obtained by each terminal device from the server, or it can be pre-stored in the database of each terminal device. It can be understood that if the first recognition model is obtained by each terminal device from the server, the first recognition model in each terminal device is the same; if the first recognition model is obtained by each terminal device in advance according to its own local training data, the first recognition model in each terminal device may be the same or different.
[0080] Further, step S40 includes:
[0081] Step d: receiving the homomorphically encrypted sample vectors sent by each terminal device to obtain the encrypted sample vectors.
[0082] Furthermore, after each terminal device calculates and obtains a sample vector, each terminal device homomorphically encrypts the obtained sample vector to obtain a homomorphically encrypted sample vector. After each terminal device obtains a homomorphically encrypted sample vector, each terminal device sends the obtained homomorphically encrypted sample vector to the server. The server receives the homomorphically encrypted sample vector sent by each terminal device and obtains an encrypted sample vector. It should be noted that the data transmitted between each terminal device and the server are all processed, and the server cannot know the original data in each terminal device.
[0083] Step f, calculating the loss value through the encrypted sample vector, and encrypting the loss value to obtain the encrypted loss value.
[0084] When the server obtains the encrypted sample vector, the server calculates the loss value through the encrypted sample vector, and then encrypts the loss value to obtain the encrypted loss value, and sends the encrypted loss value to each terminal device. It should be noted that the private key used for encryption is pre-stored in the server, and the public key corresponding to the private key has been pre-sent to each terminal device. Therefore, after receiving the encrypted loss value, each terminal device can decrypt it through the pre-stored public key to obtain the loss value.
[0085] Furthermore, the step of calculating the loss value through the encrypted sample vector includes:
[0086] Step f1, determining in the encrypted sample vectors that each training sample corresponds to an anchor vector of an anchor training sample, a positive vector of a positive training sample, and a negative vector of a negative training sample.
[0087] Specifically, the server determines that in the encrypted sample vector, each training sample corresponds to the anchor vector of the anchor training sample, the positive vector of the positive training sample, and the negative vector of the negative training sample. It should be noted that the anchor training sample in each training sample has a corresponding anchor vector, the positive training sample has a corresponding positive vector, and the negative training sample has a corresponding negative vector, that is, each sample vector corresponds to an anchor vector, a negative vector, and a positive vector.
[0088] Step f2, calculating a first value through the anchor vector and the positive example vector, and calculating a second value through the anchor vector and the negative example vector.
[0089] Step f3, calculating the loss value according to the first value, the second value and a preset constant variable.
[0090] The server obtains the first value by calculating the anchor vector and the positive example vector, and obtains the second value by calculating the anchor vector and the negative example vector, wherein the first value is the distance between the anchor vector and the positive example vector, and the second value is the distance between the anchor vector and the negative example vector. In this embodiment, the first value and the second value can be calculated by the cosine distance algorithm. It should be noted that in the process of calculating the first value and the second value, the average value of the sample vectors sent by each terminal device can be calculated, and then the first value and the second value can be calculated according to the corresponding average value, or the sum of the sample vectors sent by each terminal device can be calculated, and then the first value and the second value can be calculated. After the server calculates the first value and the second value, the server subtracts the second value from the first value to obtain the difference between the first value and the second value, and then calculates the sum between the difference and the preset constant variable to obtain the third value, compares the third value with zero, and determines the larger value as the loss value. When the third value is greater than zero, the server determines the third value as the loss value; when the third value is less than zero, the server determines zero as the loss value; when the difference is equal to zero, the server determines zero as the loss value. The size of the constant variable can be set according to specific needs, and this embodiment does not impose any specific restrictions on the size of the constant variable.
[0091] If the first value is recorded as d(a, p), the second value is recorded as d(a, n), the constant variable is recorded as margin, and the loss value is recorded as L, then the formula for calculating the loss value can be recorded as:
[0092] L=max(d(a,p)-d(a,n)+margin,0).
[0093] If there are two terminal devices, terminal device A and terminal device B, the sample vector obtained by terminal device A is The sample vector obtained by terminal device B is [[·]] represents homomorphic encryption, then the encrypted sample vector obtained by terminal device A is The encrypted sample vector obtained by terminal device B is It can be seen from this that the sample vector sent by each terminal device to the server is the sum of all sample vectors in the terminal device.
[0094] If the anchor vector is recorded as The positive example vector is denoted as The formula for calculating the distance between the anchor vector and the positive example vector can be expressed as:
[0095]
[0096] From this we can see that the server or During the process, it is necessary to communicate with each terminal device.
[0097] Further, if it is determined that the absolute value of the difference between the first value and the second value is greater than the preset threshold, at this time, the difference is a negative value, and the server determines that the first recognition model has completed the model update operation, that is, when the first value is much smaller than the second value, the server determines that the model update operation has been completed; when it is determined that the absolute value is less than or equal to the preset threshold, the server continues to perform the model update operation. Among them, the size of the preset threshold can be set according to specific needs, and this embodiment does not specifically limit the size of the preset threshold.
[0098] Step g, sending the encrypted loss value to each terminal device, so that each terminal device can decrypt the received encrypted loss value to obtain the decrypted loss value, and calculate the first gradient value based on the decrypted loss value, and update the corresponding first recognition model based on the first gradient value.
[0099] When the server obtains the encrypted loss value, the server sends the encrypted loss value to each terminal device. When each terminal device receives the encrypted loss value, each terminal device uses a pre-stored public key to decrypt the received encrypted loss value to obtain a decrypted loss value, and calculates a first gradient value based on the decrypted loss value, and updates the model parameters of each first recognition model based on the first gradient value, thereby updating the corresponding first recognition model. Specifically, the first gradient value is multiplied by the gradient coefficient to obtain the product between the first gradient value and the gradient coefficient, and then the product is subtracted from the model parameters before the update to obtain the updated model parameters, and the updated model parameters are used as the model parameters of the first recognition model, thereby updating the first recognition model. In the process of calculating the first gradient value based on the decrypted loss value, the first gradient value is obtained by deriving the decrypted loss value and the corresponding loss function.
[0100] This embodiment, when receiving the user identifier sent by each terminal device and detecting that the same user identifier exists in each terminal device, performs sample alignment according to the user identifier to obtain the aligned user identifier, constructs a training sample according to the aligned user identifier, sends the training sample to each terminal device, receives the sample vector sent by each terminal device, calculates the loss value according to the sample vector, and sends the loss value to each terminal device, so that each terminal device updates the corresponding first recognition model according to the loss value, thereby achieving in the process of training the recognition model, that is, updating the recognition model, the server obtains the user identifier of each terminal device to construct the training sample, and updates the recognition model according to the training sample, without obtaining the local training data corresponding to each terminal device, thereby avoiding the problem of training data leakage, and because the server constructs the training sample according to the sample vector corresponding to the user identifier of each terminal device during the construction of the training sample, the recognition accuracy of the updated recognition model is improved.
[0101] Furthermore, a second embodiment of the method for updating the recognition model of the present invention is proposed. The difference between the second embodiment of the method for updating the recognition model and the first embodiment of the method for updating the recognition model is that, with reference to Figure 2 , the updating method of the recognition model further includes:
[0102] Step S50, if it is detected that the model to be detected in each terminal device belongs to the second type, a preset second recognition model is sent to the terminal device corresponding to each user identifier, so that each terminal device can obtain a second gradient value according to the second recognition model and local training data after receiving the second recognition model, and encrypt the second gradient value.
[0103] When the server detects that the model to be detected in each terminal device belongs to the second type, at this time, the same user identifier does not exist in each terminal device, and the server obtains the pre-stored second recognition model and sends the second recognition model to the terminal device corresponding to each user identifier. After each terminal device receives the second recognition model, each terminal device obtains a second gradient value based on the second recognition model and local training data. After each terminal device obtains the second gradient value, each terminal device encrypts the second gradient value to obtain the encrypted second gradient value, and sends the encrypted second gradient value to the server.
[0104] Step S60, receiving the encrypted second gradient values sent by each terminal device, and updating the model parameters of the second recognition model according to each encrypted second gradient value to obtain updated model parameters.
[0105] Step S70: sending the updated model parameters to each terminal device, so that each terminal device updates the received second recognition model according to the updated model parameters.
[0106] When the server receives the encrypted second gradient value sent by each terminal device, the server updates the model parameters of the second recognition model according to each encrypted second gradient value to obtain the updated model parameters. Specifically, the server can calculate the average value of the encrypted second gradient values sent by each terminal device, update the model parameters of the second recognition model according to the average value, and obtain the updated model parameters; the server can also pre-set the weights corresponding to each terminal device, and then multiply the encrypted second gradient value corresponding to each terminal device by the corresponding weight to obtain the corresponding product, add the obtained products, and obtain the second gradient value. When the server obtains the updated model parameters, it sends the updated model parameters to each terminal device. When each terminal device receives the updated model parameters, each terminal device updates the received second recognition model according to the updated model parameters, that is, uses the updated model parameters as the model parameters of each second recognition model, thereby obtaining a new second recognition model. It can be understood that the model to be updated at this time is the second recognition model.
[0107] Further, when the server determines that the same user identifier does not exist in each terminal device, the server determines the number of received user identifiers, and determines the classification number of each user identifier based on the number of user identifiers. It should be noted that one user identifier corresponds to one classification number. In this embodiment, the expression form of the classification number is not limited, such as the classification number can be expressed in the form of numbers and / or letters. After determining the classification number of each user identifier, the server sends each classification number to the terminal device corresponding to the user identifier. It is understandable that each terminal device can determine the order in which it is arranged in the server according to the classification number.
[0108] When the recognition model is not a fingerprint recognition model, and the same user ID does not exist in each terminal device, at this time, the voiceprint of one user is one category, and the voiceprint data of different users belong to different category data. Therefore, one user ID corresponds to one classification number.
[0109] This embodiment obtains updated model parameters by integrating the second gradient values of each terminal device when the same user identifier does not exist in each terminal device, and returns the updated model parameters to each terminal device so that each terminal device can update the recognition model according to the updated model parameters. In the process of updating the recognition model, it is not necessary to obtain the training data of each terminal device, but only the encrypted second gradient value of each terminal device needs to be obtained, thereby ensuring the security of the training data in each terminal device and avoiding the leakage of the training data in each terminal device. In addition, since the updated model parameters are obtained by integrating the second gradient values of each terminal device, the recognition accuracy of the updated recognition model is improved.
[0110] It should be noted that the embodiment of the present invention provides a training method for an applicable recognition model under a federated learning framework. When the same user identifier exists in each terminal device, the recognition model update method in the first embodiment is adopted, that is, the recognition model is updated by a training method based on metric learning; when the same user identifier does not exist in each terminal device, the recognition model update method in the second embodiment is adopted, that is, the recognition model is updated by a training method based on classification, so that the recognition model update method in the embodiment of the present invention has universal applicability.
[0111] Furthermore, a third embodiment of the method for updating the recognition model of the present invention is proposed. The third embodiment of the method for updating the recognition model is different from the first and / or second embodiments of the method for updating the recognition model in that the method for updating the recognition model further includes:
[0112] Step h: Generate a public key and send the public key to each terminal device, so that each terminal device encrypts the user identification according to the public key and sends the encrypted user identification.
[0113] The server uses an asymmetric encryption algorithm to generate a public key and a private key, and sends the generated public key to each terminal device. After each terminal device receives the public key, each terminal device stores the public key. When each terminal device needs to send a user ID to the server, each terminal device uses the public key to encrypt the user ID, obtains the encrypted user ID, and sends the encrypted user ID to the server. This embodiment does not limit the type of asymmetric encryption algorithm.
[0114] Furthermore, if each terminal device does not want the server to know its original user ID, each terminal device can first encrypt its user ID, and then encrypt the encrypted user ID with the public key generated by the server to obtain the encrypted user ID, that is, each terminal device double encrypts the user ID. For example, each terminal device first encrypts its user ID with the MD5 encryption algorithm to obtain the user ID encrypted by MD5, and then uses the public key sent by the server to encrypt the user ID encrypted by MD5 to obtain the user ID encrypted by the public key, and sends the user ID encrypted by the public key to the server. When the server receives the encrypted user ID, it uses the private key to decrypt the encrypted user ID, and the obtained user ID is only the user ID encrypted by each terminal device itself.
[0115] The server of this embodiment generates a public key and sends the public key to each terminal device, so that each terminal device uses the public key to encrypt the user identification required to be sent to the server, thereby improving the security of data transmitted between the server and each terminal device.
[0116] In addition, the present invention also provides a method for updating a recognition model, which is applied to a terminal device, and the method for updating a recognition model comprises the following steps:
[0117] Step i, sending the acquired user identification to the server, so that the server, upon receiving the user identification and determining that the model to be updated in each terminal device belongs to the first type, returns a training sample constructed based on the user identification;
[0118] Step j, receiving the training sample sent by the server, and calculating the sample vector according to the training sample;
[0119] Step k, sending the sample vector to the server, so that the server can calculate the loss value according to the sample vector;
[0120] Step 1: Receive the loss value sent by the server, and update the pre-stored first recognition model according to the loss value.
[0121] Furthermore, the step 1 comprises:
[0122] Step 11, receiving the encrypted loss value sent by the server, and decrypting the encrypted loss value to obtain the decrypted loss value;
[0123] Step 12, calculate the first gradient value according to the decrypted loss value, and update the pre-stored first recognition model according to the first gradient value.
[0124] It should be noted that the specific implementation process of step i, step j, step k, step l, step l1 and step l2 has been described in detail in the above embodiment and will not be repeated in this embodiment.
[0125] This embodiment, when receiving the user identifier sent by each terminal device and detecting that the same user identifier exists in each terminal device, performs sample alignment according to the user identifier to obtain the aligned user identifier, constructs a training sample according to the aligned user identifier, sends the training sample to each terminal device, receives the sample vector sent by each terminal device, calculates the loss value according to the sample vector, and sends the loss value to each terminal device, so that each terminal device updates the corresponding first recognition model according to the loss value, thereby achieving in the process of training the recognition model, that is, updating the recognition model, the server obtains the user identifier of each terminal device to construct the training sample, and updates the recognition model according to the training sample, without obtaining the local training data corresponding to each terminal device, thereby avoiding the problem of training data leakage, and because the server constructs the training sample according to the sample vector corresponding to the user identifier of each terminal device during the construction of the training sample, the recognition accuracy of the updated recognition model is improved.
[0126] Furthermore, the first recognition model is a voiceprint recognition model, and the updating method of the recognition model further includes:
[0127] Step n: when a voiceprint recognition request is detected, the voiceprint data corresponding to the recognition request is obtained.
[0128] Step m: input the voiceprint data into the updated voiceprint recognition model to determine the user corresponding to the voiceprint data.
[0129] When the terminal device detects a recognition request for voiceprint recognition, the terminal device obtains the voiceprint data corresponding to the recognition request, wherein the recognition request may be sent by the terminal device, or may be triggered in the terminal device by the user corresponding to the terminal device, or may be triggered by a scheduled task in the terminal device. The voiceprint data is carried in the recognition request, and when the terminal device detects the recognition request, it obtains the voiceprint data carried in the recognition request.
[0130] When the terminal device obtains the voiceprint data, the terminal device inputs the voiceprint data into the updated voiceprint recognition model to determine the user corresponding to the voiceprint data. It should be noted that the user corresponding to the voiceprint data can be determined by the output of the voiceprint recognition model. In this embodiment, the output of the voiceprint recognition model can be a user identifier that uniquely represents the user, or other information that can determine the identity of the user.
[0131] This embodiment recognizes voiceprint data through the updated voiceprint recognition model, thereby improving the accuracy of determining the user's identity through voiceprint data.
[0132] In addition, the present invention also provides a recognition model update device, which is applied to the server, referring to Figure 3 , the updating device of the recognition model comprises:
[0133] The detection module 10 is used to detect the type of the model to be updated in each terminal device after receiving the user identification sent by each terminal device;
[0134] An alignment module 20, configured to perform sample alignment according to the user identifier to obtain an aligned user identifier if it is detected that the model to be detected in each terminal device belongs to the first type;
[0135] A construction module 30, configured to construct a training sample according to the aligned user identifiers;
[0136] A sending module 40, configured to send the training sample to each terminal device according to the user identifier, so that each terminal device can calculate a sample vector according to the received training sample;
[0137] A receiving module 50, configured to receive a sample vector sent by each terminal device;
[0138] A calculation module 60, configured to calculate a loss value according to the sample vector;
[0139] The sending module 40 is further used to send the loss value to each terminal device, so that each terminal device updates the corresponding first recognition model according to the loss value.
[0140] Furthermore, the construction module 30 is also used to construct anchor training samples, positive training samples and negative training samples in the training samples according to the aligned user identifiers to obtain training samples, wherein the user identifiers corresponding to the anchor training samples and the positive training samples in the same training sample are the same, and the user identifiers corresponding to the negative training samples in the same training sample are different from the user identifiers corresponding to the positive training samples.
[0141] Furthermore, the receiving module 50 is also used to receive the homomorphically encrypted sample vector sent by each terminal device to obtain an encrypted sample vector;
[0142] The calculation module 60 is also used to calculate the loss value through the encrypted sample vector;
[0143] The updating device of the recognition model also includes:
[0144] An encryption module, used for encrypting the loss value to obtain an encrypted loss value;
[0145] The sending module 40 is also used to send the encrypted loss value to each terminal device so that each terminal device can decrypt the received encrypted loss value to obtain the decrypted loss value, calculate the first gradient value based on the decrypted loss value, and update the corresponding first recognition model based on the first gradient value.
[0146] Furthermore, the calculation module 60 includes:
[0147] A first determining unit is used to determine, in the encrypted sample vector, an anchor vector of an anchor training sample, a positive vector of a positive training sample, and a negative vector of a negative training sample corresponding to each training sample;
[0148] A calculation unit, used to calculate a first value through the anchor vector and the positive example vector, and to calculate a second value through the anchor vector and the negative example vector; and to calculate a loss value according to the first value, the second value and a preset constant variable.
[0149] Furthermore, the sending module 40 includes:
[0150] A second determining unit, configured to determine a terminal device corresponding to each user identifier according to a device identifier corresponding to each user identifier;
[0151] The sending unit is used to send the training samples to the terminal devices corresponding to the respective user identifiers according to the user identifiers, so that the terminal devices can obtain sample vectors according to the received training samples.
[0152] Furthermore, the sending module 40 is further configured to send a preset second recognition model to the terminal device corresponding to each user identifier if it is detected that the model to be detected in each terminal device belongs to the second type, so that each terminal device obtains a second gradient value according to the second recognition model and local training data after receiving the second recognition model, and encrypts the second gradient value;
[0153] The receiving module 50 is also used to receive the encrypted second gradient value sent by each terminal device;
[0154] The updating device of the recognition model also includes:
[0155] An updating module, used for updating the model parameters of the second recognition model according to the encrypted second gradient value to obtain updated model parameters;
[0156] The sending module 40 is further configured to send the updated model parameters to each terminal device, so that each terminal device updates the received second recognition model according to the updated model parameters.
[0157] Furthermore, the updating device of the recognition model further comprises:
[0158] A generation module, used to generate a public key;
[0159] The sending module 40 is further configured to send the public key to each terminal device, so that each terminal device encrypts the user identification according to the public key and sends the encrypted user identification.
[0160] The specific implementation of the device for updating the recognition model of the present invention is basically the same as the embodiments of the method for updating the recognition model described above, and will not be described in detail here.
[0161] In addition, the present invention also provides a recognition model updating device, which is applied to a terminal device, and the recognition model updating device includes:
[0162] A sending module, configured to send the acquired user identification to a server, so that the server, upon receiving the user identification and determining that the model to be updated in each terminal device belongs to the first type, returns a training sample constructed based on the user identification;
[0163] A receiving module, used to receive training samples sent by the server;
[0164] A calculation module, used for calculating a sample vector according to the training sample;
[0165] The sending module is further used to send the sample vector to the server, so that the server can calculate the loss value according to the sample vector;
[0166] The receiving module is also used to receive the loss value sent by the server;
[0167] An updating module is used to update the pre-stored first recognition model according to the loss value.
[0168] Furthermore, the receiving module is also used to receive the encrypted loss value sent by the server;
[0169] The updating device of the recognition model also includes:
[0170] A decryption module, used for decrypting the encrypted loss value to obtain a decrypted loss value;
[0171] The calculation module is also used to calculate the first gradient value according to the decrypted loss value;
[0172] The updating module is also used to update the pre-stored first recognition model according to the first gradient value.
[0173] Furthermore, the updating device of the recognition model further comprises:
[0174] An acquisition module, configured to acquire the voiceprint data corresponding to the recognition request after detecting a recognition request for voiceprint recognition;
[0175] The input module is used to input the voiceprint data into the updated voiceprint recognition model to determine the user corresponding to the voiceprint data.
[0176] The specific implementation of the device for updating the recognition model of the present invention is basically the same as the embodiments of the method for updating the recognition model described above, and will not be described in detail here.
[0177] In addition, the present invention also provides a device for updating the recognition model. Figure 4 As shown, Figure 4 It is a structural diagram of the hardware operating environment involved in the embodiment of the present invention.
[0178] It should be noted that Figure 4 That is, it can be a structural diagram of the hardware operating environment of the updating device of the recognition model. The updating device of the recognition model in the embodiment of the present invention can be a terminal device such as a PC, a portable computer, etc.
[0179] like Figure 4 As shown, the updating device of the recognition model may include: a processor 1001, such as a CPU, a memory 1005, a user interface 1003, a network interface 1004, 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.
[0180] Those skilled in the art will understand that Figure 4 The structure of the updating device for the recognition model shown in the figure does not constitute a limitation on the updating device for the recognition model, and may include more or less components than those shown in the figure, or combine certain components, or arrange the components differently.
[0181] like Figure 4 As shown, the memory 1005 as a computer storage medium may include an operating system, a network communication module, a user interface module, and an update program for the recognition model. The operating system is a program that manages and controls the hardware and software resources of the update device of the recognition model, and supports the operation of the update program of the recognition model and other software or programs.
[0182] exist Figure 4 In the recognition model updating device shown, the user interface 1003 is mainly used to connect to other terminals and communicate data with other terminals, such as obtaining training data sets from other terminals; the network interface 1004 is mainly used for the background server and communicates data with the background server; the processor 1001 can be used to call the recognition model update program stored in the memory 1005, and execute the steps of the recognition model updating method as described above.
[0183] The specific implementation of the updating device of the recognition model of the present invention is basically the same as the embodiments of the updating method of the recognition model described above, and will not be described in detail here.
[0184] In addition, an embodiment of the present invention further proposes a computer-readable storage medium, on which a recognition model update program is stored. When the recognition model update program is executed by a processor, the steps of the recognition model update method described above are implemented.
[0185] The specific implementation of the computer-readable storage medium of the present invention is basically the same as the embodiments of the above-mentioned updating method of the recognition model, and will not be repeated here.
[0186] 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 device 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 device. 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 device including the element.
[0187] 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.
[0188] 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, 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, a magnetic disk, or an optical disk), and includes a number of instructions for enabling a terminal device (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the methods described in each embodiment of the present invention.
[0189] 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 method for updating a recognition model, characterized in that: The updating method of the recognition model is applied to a terminal device, and the updating method of the recognition model comprises the following steps: The acquired user identifier is sent to the server, so that when the server receives the user identifier and determines that the model to be updated in each terminal device belongs to the first type, the server performs sample alignment according to the user identifier, constructs a training sample according to the aligned user identifier and returns the training sample, wherein the training sample includes an anchor training sample, a positive training sample and a negative training sample, the user identifiers corresponding to the anchor training sample and the positive training sample in the same training sample are the same, and the user identifier corresponding to the negative training sample in the same training sample is different from the user identifier corresponding to the positive training sample, and the first type refers to a model type in which a triplet exists in the model update process, and the triplet is the anchor training sample, the positive training sample and the negative training sample; Receive the training sample sent by the server, and calculate the sample vector according to the training sample; Sending the sample vector to the server, so that the server can calculate the loss value according to the sample vector; Receive the loss value sent by the server, and update the pre-stored first recognition model according to the loss value.
2. The updating method of the recognition model according to claim 1, characterized in that: The first recognition model is a voiceprint recognition model. After the step of receiving the loss value sent by the server and updating the pre-stored first recognition model according to the loss value, the method further includes: When a voiceprint recognition request is detected, obtaining voiceprint data corresponding to the recognition request; The voiceprint data is input into the updated voiceprint recognition model to determine the user corresponding to the voiceprint data.
3. A method for updating a recognition model, characterized in that: The updating method of the recognition model is applied to the server, and the updating method of the recognition model comprises the following steps: After receiving the user identification sent by each terminal device, detecting the type of the model to be updated in each terminal device; If it is detected that the model to be detected in each terminal device belongs to the first type, sample alignment is performed according to the user identifier to obtain an aligned user identifier, wherein the first type refers to a model type in which a triplet exists during the model update process, and the triplet is an anchor training sample, a positive training sample, and a negative training sample; Constructing a training sample according to the aligned user identifiers, and sending the training sample to each terminal device according to the user identifier, so that each terminal device calculates a sample vector according to the received training sample; Receiving the sample vector sent by each terminal device, calculating a loss value according to the sample vector, and sending the loss value to each terminal device, so that each terminal device updates the corresponding first recognition model according to the loss value; The step of constructing training samples according to the aligned user identifiers includes: Anchor training samples, positive training samples and negative training samples in the training samples are constructed according to the aligned user identifiers to obtain training samples, wherein the user identifiers corresponding to the anchor training samples and the positive training samples in the same training sample are the same, and the user identifiers corresponding to the negative training samples and the user identifiers corresponding to the positive training samples in the same training sample are different.
4. The updating method of the recognition model according to claim 3, characterized in that: The step of receiving the sample vector sent by each terminal device, calculating the loss value according to the sample vector, and sending the loss value to each terminal device so that each terminal device updates the corresponding first recognition model according to the loss value includes: Receive the homomorphically encrypted sample vector sent by each terminal device to obtain an encrypted sample vector; Calculating a loss value through the encrypted sample vector, and encrypting the loss value to obtain an encrypted loss value; The encrypted loss value is sent to each terminal device so that each terminal device can decrypt the received encrypted loss value to obtain a decrypted loss value, and calculate a first gradient value based on the decrypted loss value, and update the corresponding first recognition model based on the first gradient value.
5. The updating method of the recognition model according to claim 4, characterized in that: The step of calculating the loss value by using the encrypted sample vector comprises: Determine in the encrypted sample vectors that each training sample corresponds to an anchor vector of an anchor training sample, a positive vector of a positive training sample, and a negative vector of a negative training sample; A first value is calculated by using the anchor vector and the positive example vector, and a second value is calculated by using the anchor vector and the negative example vector; The loss value is calculated based on the first value, the second value and a preset constant variable.
6. The updating method of the recognition model according to claim 3, characterized in that: The step of sending the training sample to each terminal device according to the user identifier so that each terminal device can calculate a sample vector according to the received training sample includes: Determine the terminal device corresponding to each user identifier according to the device identifier corresponding to each user identifier; The training samples are sent to the terminal devices corresponding to the respective user identifiers according to the user identifiers, so that the terminal devices can obtain sample vectors according to the received training samples.
7. The method for updating the recognition model according to claim 3, characterized in that: After the step of detecting the type of the model to be updated in each terminal device after receiving the user identification sent by each terminal device, the method further includes: If it is detected that the model to be detected in each terminal device belongs to the second type, a preset second recognition model is sent to the terminal device corresponding to each user identifier, so that each terminal device obtains a second gradient value according to the second recognition model and local training data after receiving the second recognition model, and encrypts the second gradient value, wherein the second type refers to a model type in which the triplet does not exist during the model update process; Receiving the encrypted second gradient value sent by each terminal device, and updating the model parameters of the second recognition model according to the encrypted second gradient value to obtain updated model parameters; The updated model parameters are sent to each terminal device so that each terminal device updates the received second recognition model according to the updated model parameters.
8. The method for updating the recognition model according to any one of claims 3 to 7, characterized in that: After receiving the user identification sent by each terminal device, before the step of detecting the type of the model to be updated in each terminal device, the method further includes: Generate a public key, and send the public key to each terminal device, so that each terminal device encrypts the user identification according to the public key and sends the encrypted user identification.
9. A recognition model updating device, characterized in that: The updating method of the recognition model is applied to a terminal device, and the updating device of the recognition model comprises: A sending module, used to send the acquired user identifier to the server, so that when the server receives the user identifier and determines that the model to be updated in each terminal device belongs to the first type, the server performs sample alignment according to the user identifier, constructs a training sample according to the aligned user identifier and returns the training sample, wherein the training sample includes an anchor training sample, a positive training sample and a negative training sample, the user identifiers corresponding to the anchor training sample and the positive training sample in the same training sample are the same, and the user identifiers corresponding to the negative training sample and the user identifiers corresponding to the positive training sample in the same training sample are different, and the first type refers to a model type in which there are triplets in the model update process, and the triplets are the anchor training sample, the positive training sample and the negative training sample; A receiving module, used to receive training samples sent by the server; A calculation module, used for calculating a sample vector according to the training sample; The sending module is further used to send the sample vector to the server, so that the server can calculate the loss value according to the sample vector; The receiving module is also used to receive the loss value sent by the server; An updating module is used to update the pre-stored first recognition model according to the loss value.
10. A recognition model updating device, characterized in that: The updating method of the recognition model is applied to the server, and the updating device of the recognition model includes: A detection module, configured to detect the type of the model to be updated in each terminal device after receiving the user identification sent by each terminal device; an alignment module, configured to perform sample alignment according to the user identifier to obtain an aligned user identifier if it is detected that the model to be detected in each terminal device belongs to the first type, wherein the first type refers to a model type in which a triplet exists during the model update process, and the triplet is an anchor training sample, a positive training sample, and a negative training sample; A construction module, used for constructing training samples according to the aligned user identifiers; A sending module, used to send the training sample to each terminal device according to the user identifier, so that each terminal device can calculate a sample vector according to the received training sample; A receiving module, used for receiving sample vectors sent by each terminal device; A calculation module, used to calculate a loss value according to the sample vector; The sending module is further used to send the loss value to each terminal device, so that each terminal device updates the corresponding first recognition model according to the loss value; Among them, the construction module is also used to construct anchor training samples, positive training samples and negative training samples in the training samples according to the aligned user identifiers to obtain training samples, wherein the user identifiers corresponding to the anchor training samples and the positive training samples in the same training sample are the same, and the user identifiers corresponding to the negative training samples in the same training sample are different from the user identifiers corresponding to the positive training samples.
11. A device for updating a recognition model, characterized in that: The recognition model updating device includes a memory, a processor, and a recognition model updating program stored in the memory and executable on the processor. When the recognition model updating program is executed by the processor, the steps of the recognition model updating method as described in any one of claims 1 to 2, or 3 to 8 are implemented.
12. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a recognition model update program, and when the recognition model update program is executed by a processor, the steps of the recognition model update method according to any one of claims 1 to 2, or 3 to 8 are implemented.
Citation Information
Patent Citations
Face recognition model updating method, device and equipment and medium
CN111401277A