METHOD AND APPARATUS FOR TRAINING CROSS-MODAL FACE RECOGNITION MODEL, DEVICE AND STORAGE MEDIUM
20210390346 · 2021-12-16
Inventors
Cpc classification
G06F18/2148
PHYSICS
G06V40/171
PHYSICS
International classification
Abstract
Embodiments of the present disclosure disclose a method and apparatus for training a cross-modal face recognition model, a device and a storage medium. The method may include: acquiring a first modal face recognition model having a predetermined recognition precision; acquiring a first modality image of a face and a second modality image of the face; acquiring a feature value of the first modality image of the face and a feature value of the second modality image of the face; and constructing a loss function based on a difference between the feature value of the first modality image of the face and the feature value of the second modality image of the face, and tuning a parameter of the first modal face recognition model based on the loss function until the loss function converges, to obtain a trained cross-modal face recognition model.
Claims
1. A method for training a cross-modal face recognition model, comprising: acquiring a first modal face recognition model trained using a first modality image of a face and having a predetermined recognition precision; acquiring the first modality image of the face and a second modality image of the face; inputting the first modality image of the face and the second modality image of the face into the first modal face recognition model to obtain a feature value of the first modality image of the face and a feature value of the second modality image of the face; and constructing a loss function based on a difference between the feature value of the first modality image of the face and the feature value of the second modality image of the face, and tuning a parameter of the first modal face recognition model based on the loss function until the loss function converges, to obtain a trained cross-modal face recognition model.
2. The method according to claim 1, wherein the acquiring the first modality image of the face and a second modality image of the face comprises: acquiring a number of first modality images of the face and an equal number of second modality images of the face.
3. The method according to claim 2, wherein the tuning a parameter of the first modal face recognition model based on the loss function until the loss function converges, comprises: tuning the parameter of the first modal face recognition model until at least one of following conditions is satisfied: a mean value of feature values of the first modality images of the face and a mean value of feature values of the second modality images of the face reach a predetermined similarity; and a variance of the feature values of the first modality images of the face and a variance of the feature values of the second modality images of the face reach the predetermined similarity.
4. The method according to claim 1, further comprising: fine-tuning the trained cross-modal face recognition model by using a first modality image and a second modality image of a given face, to obtain an optimized cross-modal face recognition model.
5. The method according to claim 1, wherein the first modality image is an RGB image, and the second modality image is at least one of an NIR image or a Depth image.
6. An electronic device, comprising: at least one processor; and a memory, communicated with the at least one processor, wherein the memory stores an instruction executable by the at least one processor, and the instruction is executed by the at least one processor, to enable the at least one processor to perform operations, comprising: acquiring a first modal face recognition model trained using a first modality image of a face and having a predetermined recognition precision; acquiring the first modality image of the face and a second modality image of the face; inputting the first modality image of the face and the second modality image of the face into the first modal face recognition model to obtain a feature value of the first modality image of the face and a feature value of the second modality image of the face; and constructing a loss function based on a difference between the feature value of the first modality image of the face and the feature value of the second modality image of the face, and tuning a parameter of the first modal face recognition model based on the loss function until the loss function converges, to obtain a trained cross-modal face recognition model.
7. The electronic device according to claim 6, wherein the acquiring the first modality image of the face and a second modality image of the face comprises: acquiring a number of first modality images of the face and an equal number of second modality images of the face.
8. The electronic device according to claim 7, wherein the tuning a parameter of the first modal face recognition model based on the loss function until the loss function converges, comprises: tuning the parameter of the first modal face recognition model until at least one of following conditions is satisfied: a mean value of feature values of the first modality images of the face and a mean value of feature values of the second modality images of the face reach a predetermined similarity; and a variance of the feature values of the first modality images of the face and a variance of the feature values of the second modality images of the face reach the predetermined similarity.
9. The electronic device according to claim 6, wherein the operations further comprise: fine-tuning the trained cross-modal face recognition model by using a first modality image and a second modality image of a given face, to obtain an optimized cross-modal face recognition model.
10. The electronic device according to claim 6, wherein the first modality image is an RGB image, and the second modality image is at least one of an NIR image or a Depth image.
11. A non-transitory computer readable storage medium, storing a computer instruction, wherein the computer instruction is used to cause a computer to perform operations, comprising: acquiring a first modal face recognition model trained using a first modality image of a face and having a predetermined recognition precision; acquiring the first modality image of the face and a second modality image of the face; inputting the first modality image of the face and the second modality image of the face into the first modal face recognition model to obtain a feature value of the first modality image of the face and a feature value of the second modality image of the face; and constructing a loss function based on a difference between the feature value of the first modality image of the face and the feature value of the second modality image of the face, and tuning a parameter of the first modal face recognition model based on the loss function until the loss function converges, to obtain a trained cross-modal face recognition model.
12. The non-transitory computer readable storage medium according to claim 11, wherein the acquiring the first modality image of the face and a second modality image of the face comprises: acquiring a number of first modality images of the face and an equal number of second modality images of the face.
13. The non-transitory computer readable storage medium according to claim 12, wherein the tuning a parameter of the first modal face recognition model based on the loss function until the loss function converges, comprises: tuning the parameter of the first modal face recognition model until at least one of following conditions is satisfied: a mean value of feature values of the first modality images of the face and a mean value of feature values of the second modality images of the face reach a predetermined similarity; and a variance of the feature values of the first modality images of the face and a variance of the feature values of the second modality images of the face reach the predetermined similarity.
14. The non-transitory computer readable storage medium according to claim 11, wherein the operations further comprise: fine-tuning the trained cross-modal face recognition model by using a first modality image and a second modality image of a given face, to obtain an optimized cross-modal face recognition model.
15. The non-transitory computer readable storage medium according to claim 11, wherein the first modality image is an RGB image, and the second modality image is at least one of an NIR image or a Depth image.
Description
BRIEF DESCRIPTION OF THE DRAWINGS
[0010] After reading detailed descriptions for non-limiting embodiments given with reference to following accompanying drawings, other features, objectives and advantages of the present disclosure will be more apparent. The accompanying drawings are used for a better understanding of the scheme, and do not constitute a limitation to the present disclosure.
[0011]
[0012]
[0013]
[0014]
DETAILED DESCRIPTION OF EMBODIMENTS
[0015] The present disclosure is further described below in detail by combining accompanying drawings and embodiments. It may be appreciated that the specific embodiments described herein are merely used for explaining the relevant disclosure, rather than limiting the disclosure. In addition, it should also be noted that, for the ease of description, only the parts related to the relevant disclosure are shown in the accompanying drawings.
[0016] It should be noted that embodiments in the present disclosure and the features in the embodiments may be combined with each other on a non-conflict basis. The present disclosure will be described below in detail with reference to the accompanying drawings and in combination with the embodiments.
[0017]
[0018] As shown in
[0019] The terminal device 101 may interact with the server 103 via the network 102. A first modality image of a face and a second modality image of the face may be provided from the terminal device 101, including, but not limited to, a database, a user terminal, and the like.
[0020] The server 103 may provide various services. For example, the server 103 may perform processing such as analyzing on data (e.g., the first modality image of the face and the second modality image of the face) acquired from the terminal device 101, and generate a processing result (e.g., obtain a trained cross-modal face recognition model).
[0021] It should be noted that the server 103 may be hardware or software. When the server 103 is the hardware, the server 103 may be implemented as a distributed server cluster composed of a plurality of servers, or may be implemented as a single server. When the server 103 is the software, the server 103 may be implemented as a plurality of pieces of software or a plurality of software modules (e.g., software or software modules for providing a distributed service), or may be implemented as a single piece of software or a single software module, which will not be specifically defined here.
[0022] It should be noted that the method for training a cross-modal face recognition model provided in embodiments of the present disclosure is generally performed by the server 103. Correspondingly, the apparatus for training a cross-modal face recognition model is generally provided in the server 103.
[0023] It should be appreciated that the numbers of the terminal devices, the networks, and the servers in
[0024] Further referring to
[0025] Step 201, acquiring a first modal face recognition model trained using a first modality image of a face and having a predetermined recognition precision.
[0026] In this embodiment, an executing body (e.g., the server 103 shown in
[0027] Here, the process of training the first modal face recognition model includes: acquiring a feature vector of the first modality image of the face; using the feature vector of the first modality image of the face as an input of the first modal face recognition model, and using a data tag corresponding to the feature vector of the first modality image of the face as an output of the first modal face recognition model, to train an initial model of the first modal face recognition model, and generating the trained first modal face recognition model. After the training for the first modal face recognition model is completed, a determination is required to be performed on the recognition precision of the first modal face recognition model, and the first modal face recognition model reaching the predetermined recognition precision is outputted.
[0028] Specifically, the recognition precision of the trained first modal face recognition model is determined by: testing the recognition precision of the trained first modal face recognition model by using a test set composed of the first modality image of the face, to determine whether the recognition precision of the trained first modal face recognition model is greater than or equal to a preset threshold value (e.g., 90%); if the recognition precision of the first modal face recognition model is greater than the preset threshold value, outputting the first modal face recognition model; and if the recognition precision of the first modal face recognition model is less than the preset threshold value, using a different sample to re-extract a face feature vector of the first modality image of the face, continuing to train the first modal face recognition model until the face recognition precision of the first modal face recognition model is greater than or equal to the preset threshold value, and outputting the trained first modal face recognition model reaching the predetermined recognition precision.
[0029] In this embodiment, the initial model of the first modal face recognition model may be the first modal face recognition model that is not trained or the first modal face recognition model for which the training is not completed. Each layer of an initialized first modal face recognition model may be provided with an initial parameter, and the parameter may be continuously tuned during the training for the first modal face recognition model.
[0030] The initial model of the first modal face recognition model may refer to various types of artificial neural networks which are not trained or for which training is not completed, or refer to a model obtained by combining a plurality of artificial neural networks which are not trained or for which training is not completed. For example, the initial model of the first modal face recognition model may be an untrained convolutional neural network, an untrained recurrent neural network, or a model obtained by combining the untrained convolutional neural network, the untrained recurrent neural network and an untrained fully connected layer. The initial model of the first modal face recognition model may be any kind of classification neural network model, for example, Mobilenetv1/v2/v3, and Resnet.
[0031] Step 202, acquiring the first modality image of the face and a second modality image of the face.
[0032] In this embodiment, the above executing body can acquire the first modality image of the face and the second modality image of the face. Here, the first modality image of the face may refer to face modality data of which the amount is sufficient, and the second modality image of the face may refer to face modality data of which the amount is small. The modalities presented by the images obtained using different imaging principles and devices are also different.
[0033] For example, the first modality image of the face may be an RGB image, a CT image, an MRI image, a PET image, or the like, and the second modality image of the face may be an NIR image, a Depth image, or the like.
[0034] As an example, an RGB color pattern is a color standard in the industry, and is to obtain various colors through a change of the channels of three colors (red (R), green (G), and blue (B)) and a superposition therebetween, and RGB are colors representing a red channel, a green channel and a blue channel. The RGB image may be collected by a common camera.
[0035] However, the NIR (near infrared) image or the Depth image needs to be collected by a professional equipment (e.g., a Kinect or RealSense multimodal camera), and thus, it is often difficult to collect the NIR image or the Depth image, resulting in a small amount of data.
[0036] Since the amount of data of the first modality image of the face is sufficient, the face recognition model trained through the first modality image of the face has a high recognition precision. However, since the amount of data of the second modality image of the face is small, the face recognition model trained through the second modality image of the face is often prone to overfitting, which affects the recognition precision.
[0037] Step 203, inputting the first modality image of the face and the second modality image of the face into the first modal face recognition model to obtain a feature value of the first modality image of the face and a feature value of the second modality image of the face.
[0038] In this embodiment, the above executing body inputs the first modality image of the face and the second modality image of the face into the first modal face recognition model. Here, the first modal face recognition model refers to the first modal face recognition model that is obtained by performing the above step 201 and has the predetermined recognition precision.
[0039] Here, the first modality image of the face and the second modality image of the face are inputted into the first modal face recognition model, and thus, the feature value of the first modality image of the face and the feature value of the second modality image of the face may be obtained. For example, the first modality image of the face or the second modality image of the face pass through a convolution kernel in the neural network model, and each convolution kernel may extract a feature value of an image.
[0040] Step 204, constructing a loss function based on a difference between the feature value of the first modality image of the face and the feature value of the second modality image of the face, and tuning a parameter of the first modal face recognition model based on the loss function until the loss function converges, to obtain a trained cross-modal face recognition model.
[0041] In this embodiment, the above executing body constructs the loss function based on the difference between the feature value of the first modality image of the face and the feature value of the second modality image of the face. After the loss function is constructed, the parameter of the first modal face recognition model may be tuned according to the loss function until the loss function converges.
[0042] Specifically, the parameter of the first modal face recognition model is tuned, such that the distributions of the feature value of the first modality image of the face and the feature value of the second modality image of the face reach a predetermined similarity (e.g., 90%), thereby obtaining the trained cross-modal face recognition model.
[0043] As compared with the existing technology, according to the method for training a cross-modal face recognition model in the above embodiment of the present disclosure, the face recognition model trained through the first modality image of the face has the high recognition precision due to the sufficient amount of data of the first modality image of the face. However, in the embodiment of the present disclosure, by constraining the loss function and training a scheme, a domain migration technology is adopted to migrate the strong classification capability of the first modal recognition model of the face to other modal data of the face, so as to achieve the purpose of enhancing the capability to recognize other modalities of the face.
[0044] In some alternative implementations of the above embodiment, the acquiring the first modality image of the face and a second modality image of the face in step 202 includes: acquiring a number of first modality images of the face and an equal number of second modality images of the face. Specifically, image training data may be divided into a plurality of batches, and each batch is divided into two equal parts. One part has only the first modality images of the face and the other part has only the second modality images of the face. For example, a batch of image training data are 2,048 images, of which 1,024 images are images of the first modality of the face and the other 1,024 images are images of the second modality of the face. By dividing the image training data into the first modality images of the face and the second modality images of the face that have the equal numbers, the sample equalization may be achieved, thus preventing a certain image category from being trained in the network model.
[0045] In some alternative embodiments of this embodiment, the loss function may have a function mapping relationship with a mean value of feature values of the first modality images of the face and a mean value of feature values of the second modality images of the face. The loss function may also have a function mapping relationship with a variance of the feature values of the first modality images of the face and a variance of the feature values of the second modality images of the face. The loss function may also have a function mapping relationship with the mean value and variance of the feature values of the first modality images of the face and the mean value and variance of the feature values of the second modality images of the face. For example, the loss function is as follows:
.sub.dist=½[∥u.sub.N.sup.(i)−u.sub.V.sup.(i)∥.sub.2.sup.2+∥σ.sub.N.sup.(i)−σ.sub.V.sup.(i)∥.sub.2.sup.2].
[0046] Here, in the loss function L.sub.dist, U.sub.N represents the mean value of feature values of the second modality images of the face, U.sub.V represents the mean value of feature values of the first modality images of the face, σ.sub.n represents the variance of the feature values of the second modality images of the face, and σ.sub.v represents the variance of the feature values of the first modality images of the face. The parameter of the first modal face recognition model is tuned, such that the mean value U.sub.V of feature values of the first modality images of the face and the mean value U.sub.N of the mean value of feature values of the second modality images of the face reach a predetermined similarity (e.g., 99%); and/or the variance σ.sub.v of the feature values of the first modality images of the face and the variance σ.sub.n of the feature values of the second modality images of the face reach a predetermined similarity (e.g., 99%). The closer the mean value of feature values of the first modality images of the face and the mean value of feature values of the second modality images of the face are, or the closer the variance of the feature values of the first modality images of the face and the variance of the feature values of the second modality images of the face are, the smaller the value of the loss function is.
[0047] In some alternative embodiments of the above embodiment, the method further includes: fine-tuning the trained cross-modal face recognition model by using a first modality image and a second modality image of a given face, to obtain an optimized cross-modal face recognition model. After the training for the cross-modal face recognition model is completed, the fine-tuning may be performed using mixed-modal data of the face, that is, a first modality image and a second modality image of the same person that have consistent tags. A specific fine-tuning process is as follows: the weight of the network backbone part of the cross-modal face recognition model is first fixed (i.e., no training is performed), and only the last fully connected layer of the model is trained; and after the precision of a training set trained in a previous step reaches a preset threshold value (e.g., 90%), all network layer parameters of the model are unlocked for training (i.e., all networks are trained). The fine-tuning for the cross-modal face recognition model is conductive to improving the precision of the face recognition of the cross-modal face recognition model.
[0048] Further referring to
[0049] As shown in
[0050] In this embodiment, for specific processes of the model acquiring module 301, the image acquiring module 302, the feature value acquiring module 303 and the model parameter tuning module 304 in the apparatus 300 for training a cross-modal face recognition model, and their technical effects, reference may be respectively made to relative descriptions of steps 201-204 in the corresponding embodiment of
[0051] In some alternative implementations of this embodiment, the image acquiring module is further configured to: acquire a number of first modality images of the face and an equal number of second modality images of the face.
[0052] In some alternative implementations of this embodiment, the model parameter tuning module is further configured to: tune the parameter of the first modal face recognition model until at least one of following conditions is satisfied: a mean value of feature values of the first modality images of the face and a mean value of feature values of the second modality images of the face reach a predetermined similarity; and a variance of the feature values of the first modality images of the face and a variance of the feature values of the second modality images of the face reach the predetermined similarity.
[0053] In some alternative implementations of this embodiment, the apparatus further includes: a fine-tuning module, configured to fine-tune the trained cross-modal face recognition model by using a first modality image and a second modality image of a given face, to obtain an optimized cross-modal face recognition model.
[0054] In some alternative implementations of this embodiment, the first modality image is an RGB image, and the second modality image is at least one of an NIR image or a Depth image.
[0055] According to the method and apparatus for training a cross-modal face recognition model, the device and the storage medium that are provided in the embodiments of the present disclosure, the first modal face recognition model trained using the first modality image of the face and having the predetermined recognition precision is first acquired. Then, the first modality image of the face and the second modality image of the face are acquired. The first modality image of the face and the second modality image of the face are inputted into the first modal face recognition model to obtain the feature value of the first modality image of the face and the feature value of the second modality image of the face. Finally, the loss function is constructed based on the difference between the feature value of the first modality image of the face and the feature value of the second modality image of the face, and the parameter of the first modal face recognition model is tuned based on the loss function until the loss function converges, to obtain the trained cross-modal face recognition model. Therefore, a domain migration technology is adopted to migrate the classification capability of the first modal recognition model of the face to other modal data of the face, so as to achieve the purpose of enhancing the capability to recognize other modalities of the face.
[0056] As shown in
[0057] As shown in
[0058] The memory 402 is a non-transitory computer readable storage medium provided by the present disclosure. The memory stores instructions executable by at least one processor, so that the at least one processor performs the method for training a cross-modal face recognition model provided by the present disclosure. The non-transitory computer readable storage medium of the present disclosure stores computer instructions for causing a computer to perform the method for training a cross-modal face recognition model provided by the present disclosure.
[0059] The memory 402, as a non-transitory computer readable storage medium, may be used to store non-transitory software programs, non-transitory computer executable programs and modules, such as program instructions/modules corresponding to the method for training a cross-modal face recognition model in the embodiments of the present disclosure (for example, the model acquiring module 301, the image acquiring module 302, the feature value acquiring module 303, and the model parameter tuning module shown in
[0060] The memory 402 may include a storage program area and a storage data area, where the storage program area may store an operating system and at least one function required application program; and the storage data area may store data created by the use of the electronic device according to the method for training a cross-modal face recognition model, etc. In addition, the memory 602 may include a high-speed random access memory, and may also include a non-transitory memory, such as at least one magnetic disk storage device, a flash memory device, or other non-transitory solid-state storage devices. In some embodiments, the memory 402 may optionally include memories remotely provided with respect to the processor 601, and these remote memories may be connected to the electronic device of the method for training a cross-modal face recognition model through a network. Examples of the above network include but are not limited to the Internet, intranet, local area network, mobile communication network, and combinations thereof.
[0061] The electronic device of the method for training a cross-modal face recognition model may further include: an input apparatus 403 and an output apparatus 404. The processor 401, the memory 402, the input apparatus 403, and the output apparatus 404 may be connected through a bus or in other methods. In
[0062] The input apparatus 403 may receive input digital or character information, and generate key signal inputs related to user settings and function control of the electronic device of the method for training a cross-modal face recognition model, such as touch screen, keypad, mouse, trackpad, touchpad, pointing stick, one or more mouse buttons, trackball, joystick and other input apparatuses. The output apparatus 604 may include a display device, an auxiliary lighting apparatus (for example, LED), a tactile feedback apparatus (for example, a vibration motor), and the like. The display device may include, but is not limited to, a liquid crystal display (LCD), a light emitting diode (LED) display, and a plasma display. In some embodiments, the display device may be a touch screen.
[0063] Various embodiments of the systems and technologies described herein may be implemented in digital electronic circuit systems, integrated circuit systems, dedicated ASICs (application specific integrated circuits), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: being implemented in one or more computer programs that can be executed and/or interpreted on a programmable system that includes at least one programmable processor. The programmable processor may be a dedicated or general-purpose programmable processor, and may receive data and instructions from a storage system, at least one input apparatus, and at least one output apparatus, and transmit the data and instructions to the storage system, the at least one input apparatus, and the at least one output apparatus.
[0064] These computing programs (also referred to as programs, software, software applications, or codes) include machine instructions of the programmable processor and may use high-level processes and/or object-oriented programming languages, and/or assembly/machine languages to implement these computing programs. As used herein, the terms “machine readable medium” and “computer readable medium” refer to any computer program product, device, and/or apparatus (for example, magnetic disk, optical disk, memory, programmable logic apparatus (PLD)) used to provide machine instructions and/or data to the programmable processor, including machine readable medium that receives machine instructions as machine readable signals. The term “machine readable signal” refers to any signal used to provide machine instructions and/or data to the programmable processor.
[0065] In order to provide interaction with a user, the systems and technologies described herein may be implemented on a computer, the computer has: a display apparatus for displaying information to the user (for example, CRT (cathode ray tube) or LCD (liquid crystal display) monitor); and a keyboard and a pointing apparatus (for example, mouse or trackball), and the user may use the keyboard and the pointing apparatus to provide input to the computer. Other types of apparatuses may also be used to provide interaction with the user; for example, feedback provided to the user may be any form of sensory feedback (for example, visual feedback, auditory feedback, or tactile feedback); and any form (including acoustic input, voice input, or tactile input) may be used to receive input from the user.
[0066] The systems and technologies described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., application server), or a computing system that includes frontend components (for example, a user computer having a graphical user interface or a web browser, through which the user may interact with the implementations of the systems and the technologies described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., communication network). Examples of the communication network include: local area networks (LAN), wide area networks (WAN), the Internet, and blockchain networks.
[0067] The computer system may include a client and a server. The client and the server are generally far from each other and usually interact through the communication network. The relationship between the client and the server is generated by computer programs that run on the corresponding computer and have a client-server relationship with each other.
[0068] According to the technical solution provided in embodiments of the present disclosure, a first modal face recognition model trained using a first modality image of a face and having a predetermined recognition precision is first acquired. Then, the first modality image of the face and a second modality image of the face are acquired. The first modality image of the face and the second modality image of the face are inputted into the first modal face recognition model to obtain a feature value of the first modality image of the face and a feature value of the second modality image of the face. Finally, a loss function is constructed based on a difference between the feature value of the first modality image of the face and the feature value of the second modality image of the face, and a parameter of the first modal face recognition model is tuned based on the loss function until the loss function converges, to obtain a trained cross-modal face recognition model. Therefore, a domain migration technology is adopted to migrate the classification capability of the first modal recognition model of the face to other modal data of the face, so as to achieve the purpose of enhancing the capability to recognize other modalities of the face.
[0069] It should be understood that the various forms of processes shown above may be used to reorder, add, or delete steps. For example, the steps described in the present disclosure may be performed in parallel, sequentially, or in different orders. As long as the desired results of the technical solution disclosed in the present disclosure can be achieved, no limitation is made herein.
[0070] The above specific embodiments do not constitute limitation on the protection scope of the present disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations and substitutions may be made according to design requirements and other factors. Any modification, equivalent replacement and improvement made within the spirit and principle of the present disclosure shall be included in the protection scope of the present disclosure.