WO2023036239A1 - Human face fusion method and apparatus, device and storage medium - Google Patents
Human face fusion method and apparatus, device and storage medium Download PDFInfo
- Publication number
- WO2023036239A1 WO2023036239A1 PCT/CN2022/117804 CN2022117804W WO2023036239A1 WO 2023036239 A1 WO2023036239 A1 WO 2023036239A1 CN 2022117804 W CN2022117804 W CN 2022117804W WO 2023036239 A1 WO2023036239 A1 WO 2023036239A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- image
- facial
- face image
- material object
- fused
- Prior art date
Links
- 238000007500 overflow downdraw method Methods 0.000 title claims abstract description 25
- 230000001815 facial effect Effects 0.000 claims abstract description 310
- 239000000463 material Substances 0.000 claims abstract description 170
- 238000000034 method Methods 0.000 claims abstract description 24
- 238000009877 rendering Methods 0.000 claims abstract description 15
- 238000012549 training Methods 0.000 claims abstract description 14
- 230000004927 fusion Effects 0.000 claims description 43
- 239000011159 matrix material Substances 0.000 claims description 33
- 230000037237 body shape Effects 0.000 claims description 9
- 238000005034 decoration Methods 0.000 claims description 8
- 238000004590 computer program Methods 0.000 claims description 6
- 230000000903 blocking effect Effects 0.000 claims 1
- 230000000694 effects Effects 0.000 abstract description 26
- 230000002708 enhancing effect Effects 0.000 abstract 1
- 238000005516 engineering process Methods 0.000 description 6
- 238000010586 diagram Methods 0.000 description 4
- 238000004891 communication Methods 0.000 description 3
- 238000012545 processing Methods 0.000 description 3
- 238000011161 development Methods 0.000 description 2
- 230000008921 facial expression Effects 0.000 description 2
- 230000006870 function Effects 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 230000009466 transformation Effects 0.000 description 2
- 230000003044 adaptive effect Effects 0.000 description 1
- 230000005540 biological transmission Effects 0.000 description 1
- 238000007499 fusion processing Methods 0.000 description 1
- 230000002093 peripheral effect Effects 0.000 description 1
- 238000012216 screening Methods 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/04—Architecture, e.g. interconnection topology
- G06N3/0475—Generative networks
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/08—Learning methods
- G06N3/094—Adversarial learning
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T11/00—2D [Two Dimensional] image generation
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/30—Determination of transform parameters for the alignment of images, i.e. image registration
- G06T7/33—Determination of transform parameters for the alignment of images, i.e. image registration using feature-based methods
Definitions
- the present disclosure relates to the technical field of image processing, and in particular to a face fusion method, device, equipment and storage medium.
- the present disclosure provides a face fusion method, device, equipment and storage medium to train the target network based on the sample group and provide functional effects of face fusion to meet Users have diverse needs for special effects gameplay.
- the present disclosure provides a face fusion method, the method comprising:
- the image and the fused image obtained by fusing the face image and the face image of the material object, the face image of the material object is obtained after rendering the initial face image of the material object, and the facial feature parameters of the face image and the face image match.
- the present disclosure provides a human face fusion device, which includes:
- An image acquisition module configured to acquire a face image to be fused and a facial image of a material object to be fused
- the fusion module is used to input the face image to be fused and the facial image of the material object to be fused to the trained target network to obtain the target fused image, wherein the target network is trained based on a sample group, and the sample group includes a human face image , the face image of the material object and the fused image obtained by fusing the face image and the face image of the material object, the face image of the material object is obtained after rendering the initial face image of the material object, and the face image and the face image Facial features parameter matching.
- the embodiment of the present invention also provides an electronic device, which includes:
- processors one or more processors
- the one or more processors When the one or more programs are executed by the one or more processors, the one or more processors implement the face fusion method provided in any embodiment of the present invention.
- An embodiment of the present invention also provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the face fusion method provided by any embodiment of the present invention is implemented.
- Embodiments of the present disclosure provide a face fusion method, device, device, and storage medium, capable of acquiring a face image to be fused and a facial image of a material object to be fused, and combining the face image to be fused with the material to be fused
- the face image of the subject is input to the trained target network to obtain the target fused image, because the target network is trained based on the sample group, and the sample group includes the face image, the face image of the material object, and the facial image composed of the face image and the material object
- the facial image of the material object is obtained after rendering the initial facial image of the material object, and the face image matches the facial feature parameters of the facial image, so that the target network that has been trained can be used to convert the face image
- a special effect gameplay that combines the face and the material is obtained, which improves the interest of the video, thereby improving the user experience, and meeting the diverse needs of the user for the special effect gameplay.
- FIG. 1 is a schematic flowchart of a face fusion method provided by an embodiment of the present disclosure
- FIG. 2 is a schematic flowchart of a target network training method provided by an embodiment of the present disclosure
- Fig. 3 is a schematic flow chart of obtaining a sample group provided by an embodiment of the present disclosure
- FIG. 4 is a schematic flowchart of another face fusion method provided by an embodiment of the present disclosure.
- Fig. 5 is a schematic structural diagram of a face fusion device provided by an embodiment of the present disclosure.
- Fig. 6 is a schematic structural diagram of an electronic device provided by an embodiment of the present disclosure.
- embodiments of the present disclosure provide a face fusion method, device, device, and storage medium, which can use the trained target network to fuse face images and facial images, thereby obtaining the fusion of face and facial images.
- the special effect gameplay of material fusion improves the interest of the video, which in turn can improve the user experience to meet the diverse needs of users for special effect gameplay.
- the face fusion method provided by the embodiment of the present disclosure will first be described below with reference to FIG. 1 to FIG. 4 .
- Fig. 1 shows a schematic flowchart of a face fusion method provided by an embodiment of the present disclosure.
- the face fusion method shown in FIG. 1 may be executed by an electronic device.
- electronic devices may include devices with communication functions such as mobile phones, tablet computers, desktop computers, notebook computers, vehicle terminals, wearable devices, all-in-one computers, and smart home devices, as well as devices simulated by virtual machines or simulators.
- the face fusion method may include the following steps.
- the face image to be fused may be the original face image that needs to be fused.
- the face image may be an image of a real person under any facial feature parameter.
- the facial feature parameters may include shooting angle, expression, light intensity, etc., which are not limited here.
- the facial image of the material object to be fused may be a material image fused with a human face image.
- the facial image may be an image of the material object under any facial feature parameter.
- the material object may be a real person or a cartoon character.
- the electronic device obtains the facial image of the material object to be fused selected by the user, and collects the face image, and uses the collected face image as the subject to be fused.
- the fused face image is used to further perform image fusion based on the face image to be fused and the facial image of the material object to be fused.
- the target network may be a Generative Adversarial Network (GAN), and the confrontation network is a network model including a generator and a discriminator. Based on the target network trained by the sample group, the face image to be fused and the face image of the material object to be fused can be fused to obtain a target fused image.
- GAN Generative Adversarial Network
- the facial image of the material object is obtained after rendering the initial facial image of the material object, and the face image matches the facial feature parameters of the facial image.
- the method for rendering the initial facial image of the material object may include: adjusting the shooting angle, expression, and light intensity of the initial facial image of the material object to obtain the facial image of the material object, so that the facial features of the human face image and the facial image The parameters match.
- the face image to be fused, the face image of the material object to be fused, and the fused image obtained by fusing the face image and the face image of the material object can be input to the preset network, Based on the preset network, the face image and the facial image are fused to obtain a predicted fusion image, and the network parameters of the preset network are adjusted based on the predicted fusion image and the fusion image obtained by fusing the face image and the facial image of the material object until the output
- the predicted fusion image is a fusion image, so that the network parameters of the preset network are stabilized, and the trained target network is obtained.
- the trained target network After obtaining the trained target network, input the face image to be fused and the facial image of the material object to be fused into the trained target network, and use the target network to combine the face image to be fused and the material to be fused The facial images of the subject are fused to obtain the fused image of the target.
- the face image to be fused and the facial image of the material object to be fused can be acquired, and the face image to be fused and the facial image of the material object to be fused are input to the target network that has been trained to obtain
- the target fused image because the target network is trained based on the sample group, and the sample group includes the face image, the facial image of the material object, and the fused image obtained by fusing the face image and the facial image of the material object, the facial image of the material object is It is obtained after rendering the initial facial image of the material object, and the face image matches the facial feature parameters of the facial image, so that the trained target network is used to fuse the face image and the facial image, thus obtaining the combination of the human face and the face image.
- the special effect gameplay of material fusion improves the interest of the video, which in turn can improve the user experience to meet the diverse needs of users for special effect gameplay.
- the electronic device may also perform a model training step on the target network before performing S110.
- Fig. 2 shows a schematic flowchart of a target network training method provided by an embodiment of the present disclosure.
- the target network training method may further include the following steps.
- the sample group includes a human face image, a facial image of a material object, and a fused image obtained by fusing the human face image and the facial image of the material object, and the facial image of the material object is the initial facial image of the material object.
- the face image matches the facial feature parameters of the face image.
- FIG. 3 shows a schematic flow chart of acquiring a sample group.
- S210 may include:
- each facial image is an image of a material object under any facial feature parameter
- each human face image is an image of a real person under any facial feature parameter.
- the facial image for each material object may be the original facial images corresponding to multiple materials.
- the multiple material objects may include multiple different real characters and multiple different virtual characters.
- the multiple face images may be images of the same real person under any facial feature parameter.
- facial feature parameters of multiple material object facial images and multiple human face images may be the same or different.
- S2102 may perform at least one of the following operations:
- the face angle may be a shooting angle of the material object.
- the electronic device screens out the facial image of the material object from the facial image that is consistent with the shooting angle of the real person in the face image as the facial image to be matched, and compares the human face The image is matched with the face image to be matched.
- the expression data may be an expression displayed by the material object.
- the electronic device screens out the facial image of the material object from the facial image that is consistent with the facial expression data of the real person in the face image, and uses it as the facial image to be matched. The image is matched with the face image to be matched.
- the facial contour may be determined according to the key points of the facial contour of the material object.
- the electronic device determines the facial contour of the material object according to the key points of the facial contour of the material object, and selects the material object from the facial image that is consistent with the facial contour of a real person in the face image according to the facial contour of the material object.
- the face image is used as the face image to be matched, and the face image is matched with the face image to be matched.
- the features of facial features may be determined according to the key points of facial features in the facial image of the material object.
- the electronic device determines the facial features of the material object according to the key points of the facial features in the facial image of the material object, and according to the facial features of the material object, selects from the facial image the material consistent with the facial features of the real person in the face image
- the face image of the subject is used as the face image to be matched, and the face image and the face image to be matched are matched.
- the facial decoration may be determined according to the non-face key points of the material object except the key points of the facial features and the key points of the facial contour.
- the electronic device determines the facial decoration of the material object according to the non-facial key points of the material object, and selects the face of the material object from the facial image that is consistent with the facial decoration of the real person in the face image according to the facial decoration of the material object The image is used as the face image to be matched, and the face image is matched with the face image to be matched.
- the electronic device can also acquire non-facial feature parameters.
- the non-facial feature parameters may include at least one of the following: lighting conditions, hairstyle data, body shape data, clothing data, and the like.
- matching the face image and the facial image based on the facial feature parameters may also include performing at least one of the following operations:
- the light state may be the light intensity of the facial image.
- the electronic device matches the face image with the face image based on the above at least one facial feature parameter, it can also filter out from the face image the light state of the real person in the face image based on the light state of the material object.
- the face image of the consistent material object is used as the face image to be matched, and the face image is matched with the face image to be matched.
- the hairstyle data may be the hairstyle displayed by the material object.
- the electronic device matches the face image with the face image based on the above at least one facial feature parameter, it can also filter out the hairstyle data of the real person in the face image from the face image based on the hairstyle data of the material object.
- the face image of the consistent material object is used as the face image to be matched, and the face image is matched with the face image to be matched.
- the figure data may be determined based on the key points of the figure outline of the material object. Specifically, after the electronic device matches the face image with the facial image based on the above at least one facial feature parameter, it can also determine the body shape data based on the key points of the body shape outline of the material object, based on the body shape data, from the face image Screen out the face image of the material object that is consistent with the body shape data of the real person in the face image as the face image to be matched, and match the face image with the face image to be matched.
- the clothing data may be determined based on the texture information of the clothing worn by the material object. Specifically, after the electronic device matches the face image with the facial image based on the above at least one facial feature parameter, it can also determine the clothing data based on the texture information of the clothing worn by the material object, and filter the facial image based on the clothing data.
- the face image of the material object consistent with the clothing data of the real person in the face image is obtained as the face image to be matched, and the face image and the face image to be matched are matched.
- S2102 may perform at least one of the following operations:
- the partial facial feature parameters may be used to initially match the facial feature parameters between the face image and the facial image, so as to preliminarily screen out the partial facial images matching the partial facial feature parameters of the human face image from multiple facial images.
- the other facial feature parameters may be facial feature parameters used for secondary matching between the face image and the facial image, so as to accurately screen out the target facial image matching the other facial feature parameters of the human face image from partial facial images.
- some of the facial feature parameters and other facial feature parameters can include at least one of facial angles, expression data, facial contours, facial features, and facial decorations, and the facial features included in the partial facial feature parameters and other facial feature parameters
- the characteristic parameters are different.
- the electronic device can also acquire non-facial feature parameters.
- At least one of the following operations is performed:
- S23-S26 are similar to S16-S19, and will not be repeated here.
- the face image can be matched with the face image through multiple matching methods, and the target face image matching the facial feature parameters of the face image can be selected from the multiple face images, adapting to A variety of matching scenarios, and by matching images based on multiple facial feature parameters, a variety of different styles of matching results can be obtained, and the target network can be trained based on the matching results of multiple styles, so that when using the target network for face fusion, you can get A variety of different styles of face fusion results improve the fun of the video.
- S2103 may perform at least one of the following operations:
- the electronic device can divide the face image and the target facial image into multiple image blocks based on the adaptive image fusion algorithm and according to the preset block size, and each image block can correspond to a pixel matrix, and then , performing wavelet transformation on the pixel matrix of each block of the face image and the pixel matrix of each block of the target facial image to obtain the first wavelet coefficient matrix of each block of the face image and the first wavelet coefficient matrix of each block of the target facial image
- the second wavelet coefficient matrix then, perform sparse processing on the first wavelet coefficient matrix and the second wavelet coefficient matrix respectively, to obtain the first sparse matrix and the second sparse matrix, and again, according to the principle of taking the largest absolute value, the first and second sparse matrices of each block are
- the first sparse matrix is fused with the second sparse matrix to obtain a fused sparse matrix
- the fused sparse matrix is subjected to wavelet inverse transform to obtain a fused image.
- the sparse matrix can be used to accurately express the image information of each block, and then the obtained sparse matrix of each block is calculated. Fusion and inverse transformation of the fused sparse matrix are performed to obtain a fusion image, which improves the fusion effect of the human face image and the target facial image.
- the training process of the target network and the face fusion process can also be described as a whole.
- Fig. 4 shows a schematic flowchart of another face fusion method provided by an embodiment of the present disclosure.
- the face fusion method may include the following steps.
- the sample group includes a human face image, a facial image of a material object, and a fused image obtained by fusing the human face image and the facial image of the material object, and the facial image of the material object is the initial facial image of the material object.
- the face image matches the facial feature parameters of the face image.
- S410-S420 are similar to S210-S220, and S430-S440 are similar to S110-S120, which will not be repeated here.
- Fig. 5 shows a schematic structural diagram of a human face fusion device provided by an embodiment of the present disclosure.
- the face fusion apparatus shown in FIG. 5 may be applied to electronic equipment.
- electronic devices may include devices with communication functions such as mobile phones, tablet computers, desktop computers, notebook computers, vehicle terminals, wearable devices, all-in-one computers, and smart home devices, as well as devices simulated by virtual machines or simulators.
- the face fusion device 500 may include: an image acquisition module 510 and a fusion module 520 .
- the image acquisition module 510 is used to acquire the face image to be fused and the facial image of the material object to be fused;
- the fusion module 520 is used to input the face image to be fused and the facial image of the material object to be fused to the trained target network to obtain the target fused image, wherein the target network is trained based on a sample group, and the sample group includes a human face image, the face image of the material object, and the fused image obtained by fusing the face image and the face image of the material object.
- the face image of the material object is obtained after rendering the initial face image of the material object, and the face image and the face image The facial feature parameters match.
- the face image to be fused and the facial image of the material object to be fused can be acquired, and the face image to be fused and the facial image of the material object to be fused are input to the target network that has been trained to obtain
- the target fused image because the target network is trained based on the sample group, and the sample group includes the face image, the facial image of the material object, and the fused image obtained by fusing the face image and the facial image of the material object, the facial image of the material object is It is obtained after rendering the initial facial image of the material object, and the face image matches the facial feature parameters of the facial image, so that the face image and the facial image can be fused using the trained target network, and the face and material can be obtained.
- the integrated special effects gameplay can improve the interest of the video, which in turn can improve the user experience to meet the diverse needs of users for special effects gameplay.
- the device may also include a target network training module.
- the target network training module includes a sample group acquisition unit and a target network training unit.
- the sample group obtaining unit is used to obtain the sample group.
- the target network training unit is used to train the preset network based on the sample group to obtain the target network for facial fusion of human faces and material objects.
- the sample group acquisition unit may include: an image acquisition subunit, an image matching subunit, and an image fusion subunit.
- the image acquisition subunit is used to acquire facial images and multiple human face images of multiple material objects, each facial image is an image of a material object under any facial feature parameter, and each human face image is a real person in any facial feature Image under parameters.
- the image matching subunit is used to match the face image and the facial image based on the facial feature parameters, and screens out the target facial image matching the facial feature parameters of the human face image from a plurality of facial images;
- the image fusion subunit is used to fuse the human face image and the target facial image to generate a fusion image, and obtain a sample group composed of the human face image, the target facial image and the fusion image corresponding to the human face image.
- the image matching subunit can also be used to perform at least one of the following operations:
- the face image and the facial image are matched
- the image matching subunit can also be used to acquire non-facial feature parameters.
- the image matching subunit can also be used to perform at least one of the following operations:
- the face image and the facial image are matched;
- the face image and the face image are matched.
- the image matching subunit can also be used to match the face image and the facial image based on some facial feature parameters, and select a partial facial image that matches the partial facial feature parameters of the human face image from multiple facial images;
- the face image is matched with the facial image based on other facial feature parameters, and a target facial image matching the other facial feature parameters of the human face image is screened out from part of the facial images.
- the image fusion subunit can also be used to block the face image and the target face image respectively;
- the first sparse matrix and the second sparse matrix of each block are fused, and a fused image is determined according to the fused sparse matrix.
- the face fusion device 500 shown in FIG. 5 can execute each step in the method embodiment shown in FIG. 1 and FIG. 5 , and realize each process in the method embodiment shown in FIG. 1 and FIG. 5 and effects, which will not be described here.
- Fig. 6 shows a schematic structural diagram of an electronic device provided by an embodiment of the present disclosure.
- the electronic device 600 may include a controller 601 and a memory 602 storing computer program instructions.
- controller 601 may include a central processing unit (CPU), or an application specific integrated circuit (Application Specific Integrated Circuit, ASIC), or may be configured to implement one or more integrated circuits of the embodiments of the present application.
- CPU central processing unit
- ASIC Application Specific Integrated Circuit
- Memory 602 may include mass storage for information or instructions.
- the memory 602 may include a hard disk drive (Hard Disk Drive, HDD), a floppy disk drive, a flash memory, an optical disk, a magneto-optical disk, a magnetic tape, or a Universal Serial Bus (Universal Serial Bus, USB) drive or two or more thereof.
- HDD Hard Disk Drive
- floppy disk drive a flash memory
- an optical disk a magneto-optical disk
- magnetic tape or a Universal Serial Bus (Universal Serial Bus, USB) drive or two or more thereof.
- Universal Serial Bus Universal Serial Bus
- Storage 602 may include removable or non-removable (or fixed) media, where appropriate.
- Memory 602 may be internal or external to the integrated gateway device, where appropriate.
- memory 602 is a non-volatile solid-state memory.
- the memory 602 includes a read-only memory (Read-Only Memory, ROM).
- the ROM can be a mask programmed ROM, a programmable ROM (Programmable ROM, PROM), an erasable PROM (Electrical Programmable ROM, EPROM), an electrically erasable PROM (Electrically Erasable Programmable ROM, EEPROM) ), electrically rewritable ROM (Electrically Alterable ROM, EAROM) or flash memory, or a combination of two or more of these.
- the controller 601 executes the steps of the face fusion method provided by the embodiments of the present disclosure by reading and executing the computer program instructions stored in the memory 602 .
- the electronic device 600 may further include a transceiver 603 and a bus 604 .
- the controller 601 , the memory 602 and the transceiver 603 are connected through a bus 604 and complete mutual communication.
- Bus 604 includes hardware, software, or both.
- a bus may include an Accelerated Graphics Port (AGP) or other graphics bus, an Enhanced Industry Standard Architecture (EISA) bus, a Front Side Bus (FSB), a Super Transmission (Hyper Transport, HT) interconnection, Industrial Standard Architecture (Industrial Standard Architecture, ISA) bus, Infinity Bandwidth interconnection, Low Pin Count (Low Pin Count, LPC) bus, memory bus, Micro Channel Architecture (Micro Channel Architecture) , MCA) bus, Peripheral Component Interconnect (PCI) bus, PCI-Express (PCI-X) bus, Serial Advanced Technology Attachment (Serial Advanced Technology Attachment, SATA) bus, Video Electronics Standards Association local (Video Electronics Standards Association Local Bus, VLB) bus or other suitable bus or a combination of two or more of these.
- Bus 604 may comprise one or more buses, where appropriate.
- This embodiment provides a storage medium containing computer-executable instructions, and the computer-executable instructions are used to perform a face fusion method when executed by a computer processor, the method comprising:
- the image and the fused image obtained by fusing the face image and the face image of the material object, the face image of the material object is obtained after rendering the initial face image of the material object, and the facial feature parameters of the face image and the face image match.
- a storage medium containing computer-executable instructions provided by an embodiment of the present invention
- the computer-executable instructions are not limited to the above-mentioned method operations, and can also perform the relevant steps in the face fusion method provided by any embodiment of the present invention. operate.
- the present invention can be realized by means of software and necessary general-purpose hardware, and of course it can also be realized by hardware, but in many cases the former is a better implementation mode .
- the technical solution of the present invention can be embodied in the form of a software product, which can be stored in a computer-readable storage medium, such as a floppy disk of a computer.
- ROM read-only memory
- RAM random access memory
- FLASH flash memory
- hard disk or optical disc etc., including several instructions to make a computer device (which can be a personal computer) , server, or network equipment, etc.) execute the face fusion method provided by various embodiments of the present invention.
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Computational Linguistics (AREA)
- General Health & Medical Sciences (AREA)
- Life Sciences & Earth Sciences (AREA)
- Artificial Intelligence (AREA)
- Biomedical Technology (AREA)
- Biophysics (AREA)
- Software Systems (AREA)
- Data Mining & Analysis (AREA)
- Evolutionary Computation (AREA)
- Health & Medical Sciences (AREA)
- Molecular Biology (AREA)
- Computing Systems (AREA)
- General Engineering & Computer Science (AREA)
- Mathematical Physics (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Processing Or Creating Images (AREA)
- Image Processing (AREA)
Abstract
The present disclosure relates to a human face fusion method and apparatus, a device, and a storage medium. The method comprises: acquiring a human face image to be fused and a face image of a material object to be fused, and inputting the human face image to be fused and the face image of the material object to be fused into a trained target network to obtain a target fused image, where the target network is obtained by training a sample group, the sample group comprises a human face image, a face image of the material object and a fused image obtained by fusing the human face image and the face image of the material object, the face image of the material object is obtained by rendering an initial face image of the material object, and the facial feature parameter of the face image matches that of the face image. The foregoing technical solution realizes special effect play methods fusing the human face and the material is achieved, improves the fun of a video, thereby enhancing the user experience and meeting diversified user requirements for special effect play methods.
Description
相关申请的交叉引用Cross References to Related Applications
本申请要求于2021年09月10日提交的,申请号为202111064260.1、发明名称为“人脸融合方法、装置、设备及存储介质”的中国专利申请的优先权,该申请的全部内容通过引用结合在本申请中。This application claims the priority of the Chinese patent application with the application number 202111064260.1 and the title of the invention "face fusion method, device, equipment and storage medium" submitted on September 10, 2021, the entire content of which is incorporated by reference in this application.
本公开涉及图像处理技术领域,尤其涉及一种人脸融合方法、装置、设备及存储介质。The present disclosure relates to the technical field of image processing, and in particular to a face fusion method, device, equipment and storage medium.
随着科技的发展,越来越多的应用软件走进了用户的生活,逐渐丰富了用户的业余生活,例如,短视频应用程序。用户可以采用视频、照片等方式记录生活,并将视频、照片上传到短视频应用程序上。With the development of science and technology, more and more application software has entered the life of users, gradually enriching the leisure life of users, for example, short video application programs. Users can use video, photos, etc. to record their lives, and upload the videos and photos to the short video application.
短视频应用程序上有许多图像算法与渲染技术的特效玩法,这些特效玩法吸引越来越多的用户使用短视频应用程序,使用户对短视频应用程序上特效玩法的需求越来越多,短视频的特效玩法需要不断更新,以满足用户对特效玩法的多样化需求。There are many special effects of image algorithms and rendering technologies on short video applications. These special effects attract more and more users to use short video applications, which makes users more and more demanding for special effects on short video applications. Video special effects gameplay needs to be constantly updated to meet the diverse needs of users for special effects gameplay.
发明内容Contents of the invention
为了解决上述技术问题或者至少部分地解决上述技术问题,本公开提供了一种人脸融合方法、装置、设备及存储介质,以基于样本组训练目标网络,提供人脸融合的功能特效,以满足用户对特效玩法的多样化需求。In order to solve the above-mentioned technical problems or at least partly solve the above-mentioned technical problems, the present disclosure provides a face fusion method, device, equipment and storage medium to train the target network based on the sample group and provide functional effects of face fusion to meet Users have diverse needs for special effects gameplay.
本公开提供了一种人脸融合方法,该方法包括:The present disclosure provides a face fusion method, the method comprising:
获取待融合的人脸图像和待融合的素材对象的面部图像;Obtain the face image to be fused and the facial image of the material object to be fused;
将待融合的人脸图像和待融合的素材对象的面部图像输入至训练完成的目标网络,得到目标融合图像,其中,目标网络基于样本组训练得到,样本组包括人脸图像、素材对象的面部图像和由人脸图像和素材对象的面部图像融合得到的融合图像,素材对象的面部图像是对素材对象的初始面部图像进行渲染后得到的,且人脸图像与面部图像的面部特征参数匹配。Input the face image to be fused and the facial image of the material object to be fused into the trained target network to obtain the target fused image, wherein the target network is trained based on the sample group, and the sample group includes the face image and the face of the material object The image and the fused image obtained by fusing the face image and the face image of the material object, the face image of the material object is obtained after rendering the initial face image of the material object, and the facial feature parameters of the face image and the face image match.
本公开提供了一种人脸融合装置,该装置包括:The present disclosure provides a human face fusion device, which includes:
图像获取模块,用于获取待融合的人脸图像和待融合的素材对象的面部图像;An image acquisition module, configured to acquire a face image to be fused and a facial image of a material object to be fused;
融合模块,用于将待融合的人脸图像和待融合的素材对象的面部图像输入至训练完成 的目标网络,得到目标融合图像,其中,目标网络基于样本组训练得到,样本组包括人脸图像、素材对象的面部图像和由人脸图像和素材对象的面部图像融合得到的融合图像,素材对象的面部图像是对素材对象的初始面部图像进行渲染后得到的,且人脸图像与面部图像的面部特征参数匹配。The fusion module is used to input the face image to be fused and the facial image of the material object to be fused to the trained target network to obtain the target fused image, wherein the target network is trained based on a sample group, and the sample group includes a human face image , the face image of the material object and the fused image obtained by fusing the face image and the face image of the material object, the face image of the material object is obtained after rendering the initial face image of the material object, and the face image and the face image Facial features parameter matching.
本发明实施例还提供了一种电子设备,该设备包括:The embodiment of the present invention also provides an electronic device, which includes:
一个或多个处理器;one or more processors;
存储装置,用于存储一个或多个程序,storage means for storing one or more programs,
当所述一个或多个程序被所述一个或多个处理器执行,使得所述一个或多个处理器实现本发明任意实施例所提供的人脸融合方法。When the one or more programs are executed by the one or more processors, the one or more processors implement the face fusion method provided in any embodiment of the present invention.
本发明实施例还提供了一种计算机可读存储介质,其上存储有计算机程序,该计算机程序被处理器执行时实现本发明任意实施例所提供的人脸融合方法。An embodiment of the present invention also provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the face fusion method provided by any embodiment of the present invention is implemented.
本公开实施例提供的技术方案与现有技术相比具有如下优点:Compared with the prior art, the technical solutions provided by the embodiments of the present disclosure have the following advantages:
本公开实施例提供了一种人脸融合方法、装置、设备及存储介质,能够获取待融合的人脸图像和待融合的素材对象的面部图像,将待融合的人脸图像和待融合的素材对象的面部图像输入至训练完成的目标网络,得到目标融合图像,由于目标网络基于样本组训练得到,且样本组包括人脸图像、素材对象的面部图像和由人脸图像和素材对象的面部图像融合得到的融合图像,素材对象的面部图像是对素材对象的初始面部图像进行渲染后得到的,且人脸图像与面部图像的面部特征参数匹配,使得利用训练完成的目标网络,将人脸图像和面部图像进行融合,由此得到将人脸与素材进行融合的特效玩法,提高了视频的趣味性,进而能够提高用户体验,以满足用户对特效玩法的多样化需求。Embodiments of the present disclosure provide a face fusion method, device, device, and storage medium, capable of acquiring a face image to be fused and a facial image of a material object to be fused, and combining the face image to be fused with the material to be fused The face image of the subject is input to the trained target network to obtain the target fused image, because the target network is trained based on the sample group, and the sample group includes the face image, the face image of the material object, and the facial image composed of the face image and the material object In the fused image obtained by fusion, the facial image of the material object is obtained after rendering the initial facial image of the material object, and the face image matches the facial feature parameters of the facial image, so that the target network that has been trained can be used to convert the face image By merging with the facial image, a special effect gameplay that combines the face and the material is obtained, which improves the interest of the video, thereby improving the user experience, and meeting the diverse needs of the user for the special effect gameplay.
此处的附图被并入说明书中并构成本说明书的一部分,示出了符合本公开的实施例,并与说明书一起用于解释本公开的原理。The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the disclosure and together with the description serve to explain the principles of the disclosure.
为了更清楚地说明本公开实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,对于本领域普通技术人员而言,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present disclosure or the prior art, the following will briefly introduce the drawings that need to be used in the description of the embodiments or the prior art. Obviously, for those of ordinary skill in the art, In other words, other drawings can also be obtained from these drawings without paying creative labor.
图1是本公开实施例提供的一种人脸融合方法的流程示意图;FIG. 1 is a schematic flowchart of a face fusion method provided by an embodiment of the present disclosure;
图2是本公开实施例提供的一种目标网络训练方法的流程示意图;FIG. 2 is a schematic flowchart of a target network training method provided by an embodiment of the present disclosure;
图3是本公开实施例提供的一种获取样本组的流程示意图;Fig. 3 is a schematic flow chart of obtaining a sample group provided by an embodiment of the present disclosure;
图4是本公开实施例提供的另一种人脸融合方法的流程示意图;FIG. 4 is a schematic flowchart of another face fusion method provided by an embodiment of the present disclosure;
图5是本公开实施例提供的一种人脸融合装置的结构示意图;Fig. 5 is a schematic structural diagram of a face fusion device provided by an embodiment of the present disclosure;
图6是本公开实施例提供的一种电子设备的结构示意图。Fig. 6 is a schematic structural diagram of an electronic device provided by an embodiment of the present disclosure.
为了能够更清楚地理解本公开的上述目的、特征和优点,下面将对本公开的方案进行进一步描述。需要说明的是,在不冲突的情况下,本公开的实施例及实施例中的特征可以相互组合。In order to more clearly understand the above objects, features and advantages of the present disclosure, the solutions of the present disclosure will be further described below. It should be noted that, in the case of no conflict, the embodiments of the present disclosure and the features in the embodiments can be combined with each other.
在下面的描述中阐述了很多具体细节以便于充分理解本公开,但本公开还可以采用其他不同于在此描述的方式来实施;显然,说明书中的实施例只是本公开的一部分实施例,而不是全部的实施例。In the following description, many specific details are set forth in order to fully understand the present disclosure, but the present disclosure can also be implemented in other ways than described here; obviously, the embodiments in the description are only some of the embodiments of the present disclosure, and Not all examples.
随着科技的发展,越来越多的应用软件走进了用户的生活,逐渐丰富了用户的业余生活,例如,短视频应用程序。用户可以采用视频、照片等方式记录生活,并将视频、照片上传到短视频应用程序上。With the development of science and technology, more and more application software has entered the life of users, gradually enriching the leisure life of users, for example, short video application programs. Users can use video, photos, etc. to record their lives, and upload the videos and photos to the short video application.
短视频应用程序上有许多图像算法与渲染技术的特效玩法,这些特效玩法吸引越来越多的用户使用短视频应用程序,为了提高短视频应用程序的趣味性,用户希望使用越来越多的特效玩法,满足使用短视频应用程序的体验。由此,用户对短视频应用程序上特效玩法的需求越来越多,短视频的特效玩法需要不断更新,以满足用户对特效玩法的多样化需求。There are many special effects of image algorithms and rendering technologies on short video applications. These special effects attract more and more users to use short video applications. In order to improve the fun of short video applications, users hope to use more and more The special effect gameplay satisfies the experience of using short video applications. As a result, users have more and more demands for special effects gameplay on short video applications, and the special effects gameplay of short videos needs to be constantly updated to meet users' diverse needs for special effects gameplay.
为了解决上述问题,本公开实施例提供了一种人脸融合方法、装置、设备及存储介质,能够利用训练完成的目标网络,将人脸图像和面部图像进行融合,由此得到将人脸与素材进行融合的特效玩法,提高了视频的趣味性,进而能够提高用户体验,以满足用户对特效玩法的多样化需求。In order to solve the above problems, embodiments of the present disclosure provide a face fusion method, device, device, and storage medium, which can use the trained target network to fuse face images and facial images, thereby obtaining the fusion of face and facial images. The special effect gameplay of material fusion improves the interest of the video, which in turn can improve the user experience to meet the diverse needs of users for special effect gameplay.
下面首先结合图1至图4对本公开实施例提供的人脸融合方法进行说明。The face fusion method provided by the embodiment of the present disclosure will first be described below with reference to FIG. 1 to FIG. 4 .
图1示出了本公开实施例提供的一种人脸融合方法的流程示意图。Fig. 1 shows a schematic flowchart of a face fusion method provided by an embodiment of the present disclosure.
在本公开一些实施例中,图1所示的人脸融合方法可以由电子设备执行。其中,电子设备可以包括移动电话、平板电脑、台式计算机、笔记本电脑、车载终端、可穿戴设备、一体机、智能家居设备等具有通信功能的设备,也可以包括虚拟机或者模拟器模拟的设备。In some embodiments of the present disclosure, the face fusion method shown in FIG. 1 may be executed by an electronic device. Among them, electronic devices may include devices with communication functions such as mobile phones, tablet computers, desktop computers, notebook computers, vehicle terminals, wearable devices, all-in-one computers, and smart home devices, as well as devices simulated by virtual machines or simulators.
如图1所示,该人脸融合方法可以包括如下步骤。As shown in FIG. 1, the face fusion method may include the following steps.
S110、获取待融合的人脸图像和待融合的素材对象的面部图像。S110. Acquire a face image to be fused and a face image of a material object to be fused.
在本公开实施例中,待融合的人脸图像可以是需要进行融合的原始人脸图像。In the embodiment of the present disclosure, the face image to be fused may be the original face image that needs to be fused.
其中,人脸图像可以为真实人物在任一面部特征参数下的图像。可选的,面部特征参数可以包括拍摄角度、表情、光照强度等,在此不做限制。Wherein, the face image may be an image of a real person under any facial feature parameter. Optionally, the facial feature parameters may include shooting angle, expression, light intensity, etc., which are not limited here.
在本公开实施例中,待融合的素材对象的面部图像可以是与人脸图像进行融合的素材图像。In the embodiment of the present disclosure, the facial image of the material object to be fused may be a material image fused with a human face image.
其中,面部图像可以是素材对象在任一面部特征参数下的图像。可选的,素材对象可以是真实人物或者卡通人物等。Wherein, the facial image may be an image of the material object under any facial feature parameter. Optionally, the material object may be a real person or a cartoon character.
具体的,当用户使用电子设备的短视频应用程序上的人脸融合特效时,电子设备获取用户选择的待融合的素材对象的面部图像,并采集人脸图像,将采集的人脸图像作为待融合的人脸图像,以进一步基于待融合的人脸图像和待融合的素材对象的面部图像进行图像融合。Specifically, when the user uses the face fusion special effect on the short video application program of the electronic device, the electronic device obtains the facial image of the material object to be fused selected by the user, and collects the face image, and uses the collected face image as the subject to be fused. The fused face image is used to further perform image fusion based on the face image to be fused and the facial image of the material object to be fused.
S120、将待融合的人脸图像和待融合的素材对象的面部图像输入至训练完成的目标网络,得到目标融合图像,其中,目标网络基于样本组训练得到,样本组包括人脸图像、素材对象的面部图像和由人脸图像和素材对象的面部图像融合得到的融合图像。S120. Input the face image to be fused and the facial image of the material object to be fused into the trained target network to obtain the target fused image, wherein the target network is trained based on a sample group, and the sample group includes a face image and a material object The facial image of and the fused image obtained by fusing the face image and the facial image of the material object.
在本公开实施例中,目标网络可以是对抗网络(Generative Adversarial Network,GAN),对抗网络是一种包括生成器和判别器的网络模型。基于样本组训练得到的目标网络,可以将待融合的人脸图像和待融合的素材对象的面部图像进行融合,得到目标融合图像。In the embodiment of the present disclosure, the target network may be a Generative Adversarial Network (GAN), and the confrontation network is a network model including a generator and a discriminator. Based on the target network trained by the sample group, the face image to be fused and the face image of the material object to be fused can be fused to obtain a target fused image.
在本公开实施例中,素材对象的面部图像是对素材对象的初始面部图像进行渲染后得到的,且人脸图像与面部图像的面部特征参数匹配。In the embodiment of the present disclosure, the facial image of the material object is obtained after rendering the initial facial image of the material object, and the face image matches the facial feature parameters of the facial image.
其中,对素材对象的初始面部图像进行渲染的方法,可以包括:调整素材对象的初始面部图像的拍摄角度、表情、光照强度,得到素材对象的面部图像,使得人脸图像与面部图像的面部特征参数匹配。Wherein, the method for rendering the initial facial image of the material object may include: adjusting the shooting angle, expression, and light intensity of the initial facial image of the material object to obtain the facial image of the material object, so that the facial features of the human face image and the facial image The parameters match.
具体的,电子设备在训练目标网络时,可以将待融合的人脸图像、待融合的素材对象的面部图像以及由人脸图像和素材对象的面部图像融合得到的融合图像输入至预设网络,基于预设网络将人脸图像和面部图像进行融合,得到预测融合图像,并基于预测融合图像与由人脸图像和素材对象的面部图像融合得到的融合图像调整预设网络的网络参数,直至输出的预测融合图像为融合图像,使得预设网络的网络参数达到稳定,得到训练完成的目标网络。Specifically, when the electronic device is training the target network, the face image to be fused, the face image of the material object to be fused, and the fused image obtained by fusing the face image and the face image of the material object can be input to the preset network, Based on the preset network, the face image and the facial image are fused to obtain a predicted fusion image, and the network parameters of the preset network are adjusted based on the predicted fusion image and the fusion image obtained by fusing the face image and the facial image of the material object until the output The predicted fusion image is a fusion image, so that the network parameters of the preset network are stabilized, and the trained target network is obtained.
进一步的,得到训练完成的目标网络之后,将待融合的人脸图像和待融合的素材对象的面部图像输入至训练完成的目标网络,利用目标网络将待融合的人脸图像和待融合的素材对象的面部图像进行融合,得到目标融合图像。Further, after obtaining the trained target network, input the face image to be fused and the facial image of the material object to be fused into the trained target network, and use the target network to combine the face image to be fused and the material to be fused The facial images of the subject are fused to obtain the fused image of the target.
在本公开实施例中,能够获取待融合的人脸图像和待融合的素材对象的面部图像,将待融合的人脸图像和待融合的素材对象的面部图像输入至训练完成的目标网络,得到目标融合图像,由于目标网络基于样本组训练得到,且样本组包括人脸图像、素材对象的面部图像和由人脸图像和素材对象的面部图像融合得到的融合图像,素材对象的面部图像是对 素材对象的初始面部图像进行渲染后得到的,且人脸图像与面部图像的面部特征参数匹配,使得利用训练完成的目标网络,将人脸图像和面部图像进行融合,由此得到将人脸与素材进行融合的特效玩法,提高了视频的趣味性,进而能够提高用户体验,以满足用户对特效玩法的多样化需求。In the embodiment of the present disclosure, the face image to be fused and the facial image of the material object to be fused can be acquired, and the face image to be fused and the facial image of the material object to be fused are input to the target network that has been trained to obtain The target fused image, because the target network is trained based on the sample group, and the sample group includes the face image, the facial image of the material object, and the fused image obtained by fusing the face image and the facial image of the material object, the facial image of the material object is It is obtained after rendering the initial facial image of the material object, and the face image matches the facial feature parameters of the facial image, so that the trained target network is used to fuse the face image and the facial image, thus obtaining the combination of the human face and the face image. The special effect gameplay of material fusion improves the interest of the video, which in turn can improve the user experience to meet the diverse needs of users for special effect gameplay.
在本公开另一种实施方式中,为了保证能够利用目标网络将人脸图像和面部图像进行融合,电子设备执行在S110之前,还可以执行对目标网络的模型训练步骤。In another implementation manner of the present disclosure, in order to ensure that the target network can be used to fuse the face image and the facial image, the electronic device may also perform a model training step on the target network before performing S110.
图2示出了本公开实施例提供的一种目标网络训练方法的流程示意图。Fig. 2 shows a schematic flowchart of a target network training method provided by an embodiment of the present disclosure.
如图2所示,该目标网络训练方法在获取待融合的人脸图像和待融合的素材对象的面部图像之前,还可以包括如下步骤。As shown in FIG. 2 , before acquiring the face image to be fused and the face image of the material object to be fused, the target network training method may further include the following steps.
S210、获取样本组。S210. Obtain a sample group.
在本公开实施例中,样本组包括人脸图像、素材对象的面部图像和由人脸图像和素材对象的面部图像融合得到的融合图像,素材对象的面部图像是对素材对象的初始面部图像进行渲染后得到的,且人脸图像与面部图像的面部特征参数匹配。In the embodiment of the present disclosure, the sample group includes a human face image, a facial image of a material object, and a fused image obtained by fusing the human face image and the facial image of the material object, and the facial image of the material object is the initial facial image of the material object. After rendering, the face image matches the facial feature parameters of the face image.
在本公开一些实施例中,图3示出了一种获取样本组的流程示意图。In some embodiments of the present disclosure, FIG. 3 shows a schematic flow chart of acquiring a sample group.
如图3所示,S210可以包括:As shown in Figure 3, S210 may include:
S2101、获取多个素材对象的面部图像和多个人脸图像,每个面部图像为素材对象在任一面部特征参数下的图像,每个人脸图像为真实人物在任一面部特征参数下的图像。S2101. Acquire facial images of multiple material objects and multiple human face images, each facial image is an image of a material object under any facial feature parameter, and each human face image is an image of a real person under any facial feature parameter.
S2102、基于面部特征参数将人脸图像和面部图像进行匹配,从多个面部图像中筛选出与人脸图像的面部特征参数匹配的目标面部图像。S2102. Match the face image with the facial image based on the facial feature parameters, and select a target facial image matching the facial feature parameters of the human face image from the multiple facial images.
S2103、将人脸图像和目标面部图像进行融合,生成融合图像,得到由人脸图像、目标面部图像以及人脸图像对应的融合图像构成的样本组。S2103. Fusion the human face image and the target facial image to generate a fusion image, and obtain a sample group composed of the human face image, the target facial image, and the fusion image corresponding to the human face image.
其中,对个素材对象的面部图像可以是多个素材对应的原始面部图像。可选的,多个素材对象可以包括多个不同的真实人物和多个不同的虚拟人物。Wherein, the facial image for each material object may be the original facial images corresponding to multiple materials. Optionally, the multiple material objects may include multiple different real characters and multiple different virtual characters.
其中,多个人脸图像可以是同一个真实人物在任一面部特征参数下的图像。Wherein, the multiple face images may be images of the same real person under any facial feature parameter.
需要说明的是,多个素材对象的面部图像和多个人脸图像的面部特征参数可以相同也可以不同。It should be noted that facial feature parameters of multiple material object facial images and multiple human face images may be the same or different.
在一些实施例中,S2102可以执行以下至少一种操作:In some embodiments, S2102 may perform at least one of the following operations:
S11、根据面部特征参数中素材对象的面部角度,将人脸图像和面部图像进行匹配。S11. Match the face image with the face image according to the face angle of the material object in the face feature parameter.
S12、根据面部特征参数中素材对象的表情数据,将人脸图像和面部图像进行匹配。S12. Match the face image with the facial image according to the expression data of the material object in the facial feature parameter.
S13、根据面部特征参数中素材对象的面部轮廓,将人脸图像和面部图像进行匹配。S13. Match the face image with the facial image according to the facial contour of the material object in the facial feature parameter.
S14、根据面部特征参数中素材对象的五官特征,将人脸图像和面部图像进行匹配。S14. Match the face image with the facial image according to the facial features of the material object in the facial feature parameters.
S15、根据面部特征参数中素材对象的面部装饰,将人脸图像和面部图像进行匹配。S15. Match the human face image with the facial image according to the facial decoration of the material object in the facial feature parameter.
其中,面部角度可以是素材对象的拍摄角度。具体的,电子设备根据面部特征参数中素材对象的面部角度,从面部图像中筛选出与人脸图像中真实人物的拍摄角度一致的素材对象的面部图像,作为待匹配面部图像,并将人脸图像和待匹配面部图像进行匹配。Wherein, the face angle may be a shooting angle of the material object. Specifically, according to the facial angle of the material object in the facial feature parameters, the electronic device screens out the facial image of the material object from the facial image that is consistent with the shooting angle of the real person in the face image as the facial image to be matched, and compares the human face The image is matched with the face image to be matched.
其中,表情数据可以是素材对象所展示的表情。具体的,电子设备根据面部特征参数中素材对象的表情数据,从面部图像中筛选出与人脸图像中真实人物的表情数据一致的素材对象的面部图像,作为待匹配面部图像,并将人脸图像和待匹配面部图像进行匹配。Wherein, the expression data may be an expression displayed by the material object. Specifically, according to the facial expression data of the material object in the facial feature parameters, the electronic device screens out the facial image of the material object from the facial image that is consistent with the facial expression data of the real person in the face image, and uses it as the facial image to be matched. The image is matched with the face image to be matched.
其中,面部轮廓可以根据素材对象的面部轮廓的关键点确定。具体的,电子设备根据素材对象的面部轮廓的关键点,确定素材对象的面部轮廓,根据素材对象的面部轮廓,从面部图像中筛选出与人脸图像中真实人物的面部轮廓一致的素材对象的面部图像,作为待匹配面部图像,并将人脸图像和待匹配面部图像进行匹配。Wherein, the facial contour may be determined according to the key points of the facial contour of the material object. Specifically, the electronic device determines the facial contour of the material object according to the key points of the facial contour of the material object, and selects the material object from the facial image that is consistent with the facial contour of a real person in the face image according to the facial contour of the material object. The face image is used as the face image to be matched, and the face image is matched with the face image to be matched.
其中,五官特征可以根据素材对象的面部图像中五官的关键点确定。具体的,电子设备根据素材对象的面部图像中五官的关键点,确定素材对象的五官特征,根据素材对象的五官特征,从面部图像中筛选出与人脸图像中真实人物的五官特征一致的素材对象的面部图像,作为待匹配面部图像,并将人脸图像和待匹配面部图像进行匹配。Wherein, the features of facial features may be determined according to the key points of facial features in the facial image of the material object. Specifically, the electronic device determines the facial features of the material object according to the key points of the facial features in the facial image of the material object, and according to the facial features of the material object, selects from the facial image the material consistent with the facial features of the real person in the face image The face image of the subject is used as the face image to be matched, and the face image and the face image to be matched are matched.
其中,面部装饰可以根据素材对象的除五官的关键点和面部轮廓的关键点以外的非面部关键点确定。具体的,电子设备根据素材对象的非面部关键点,确定素材对象的面部装饰,根据素材对象的面部装饰,从面部图像中筛选出与人脸图像中真实人物的面部装饰一致的素材对象的面部图像,作为待匹配面部图像,并将人脸图像和待匹配面部图像进行匹配。Wherein, the facial decoration may be determined according to the non-face key points of the material object except the key points of the facial features and the key points of the facial contour. Specifically, the electronic device determines the facial decoration of the material object according to the non-facial key points of the material object, and selects the face of the material object from the facial image that is consistent with the facial decoration of the real person in the face image according to the facial decoration of the material object The image is used as the face image to be matched, and the face image is matched with the face image to be matched.
进一步的,为了提高人脸图像和面部图像匹配的准确性,电子设备还可以获取非面部特征参数。Furthermore, in order to improve the matching accuracy between the face image and the face image, the electronic device can also acquire non-facial feature parameters.
可选的,非面部特征参数可以包括以下至少一种:光线状态、发型数据、身形数据、服装数据等。Optionally, the non-facial feature parameters may include at least one of the following: lighting conditions, hairstyle data, body shape data, clothing data, and the like.
相应的,基于面部特征参数将人脸图像和面部图像进行匹配,还可以包括执行以下至少一种操作:Correspondingly, matching the face image and the facial image based on the facial feature parameters may also include performing at least one of the following operations:
S16、基于非面部征参数中面部图像的光线状态,将人脸图像和面部图像进行匹配。S16. Match the face image with the face image based on the light state of the face image in the non-facial feature parameters.
S17、基于非面部征参数中素材对象的发型数据,将人脸图像和面部图像进行匹配。S17. Based on the hairstyle data of the material object in the non-facial feature parameter, match the face image with the face image.
S18、基于非面部征参数中素材对象的身形数据,将人脸图像和面部图像进行匹配。S18. Based on the body shape data of the material object in the non-facial feature parameter, match the face image with the face image.
S19、基于非面部征参数中素材对象的服装数据,将人脸图像和面部图像进行匹配。S19. Based on the clothing data of the material object in the non-facial feature parameter, match the face image with the face image.
其中,光线状态可以是面部图像的光线强度。具体的,电子设备在基于上述至少一种面部特征参数将人脸图像和面部图像进行匹配之后,还可以基于素材对象的光线状态,从 面部图像中筛选出与人脸图像中真实人物的光线状态一致的素材对象的面部图像,作为待匹配面部图像,并将人脸图像和待匹配面部图像进行匹配。Wherein, the light state may be the light intensity of the facial image. Specifically, after the electronic device matches the face image with the face image based on the above at least one facial feature parameter, it can also filter out from the face image the light state of the real person in the face image based on the light state of the material object. The face image of the consistent material object is used as the face image to be matched, and the face image is matched with the face image to be matched.
其中,发型数据可以是素材对象所展示的发型。具体的,电子设备在基于上述至少一种面部特征参数将人脸图像和面部图像进行匹配之后,还可以基于素材对象的发型数据,从面部图像中筛选出与人脸图像中真实人物的发型数据一致的素材对象的面部图像,作为待匹配面部图像,并将人脸图像和待匹配面部图像进行匹配。Wherein, the hairstyle data may be the hairstyle displayed by the material object. Specifically, after the electronic device matches the face image with the face image based on the above at least one facial feature parameter, it can also filter out the hairstyle data of the real person in the face image from the face image based on the hairstyle data of the material object. The face image of the consistent material object is used as the face image to be matched, and the face image is matched with the face image to be matched.
其中,身形数据可以基于素材对象的身形轮廓关键点确定。具体的,电子设备在基于上述至少一种面部特征参数将人脸图像和面部图像进行匹配之后,还可以基于素材对象的身形轮廓关键点确定身形数据,基于身形数据,从面部图像中筛选出与人脸图像中真实人物的身形数据一致的素材对象的面部图像,作为待匹配面部图像,并将人脸图像和待匹配面部图像进行匹配。Wherein, the figure data may be determined based on the key points of the figure outline of the material object. Specifically, after the electronic device matches the face image with the facial image based on the above at least one facial feature parameter, it can also determine the body shape data based on the key points of the body shape outline of the material object, based on the body shape data, from the face image Screen out the face image of the material object that is consistent with the body shape data of the real person in the face image as the face image to be matched, and match the face image with the face image to be matched.
其中,服装数据可以基于素材对象所穿的服装的纹理信息确定。具体的,电子设备在基于上述至少一种面部特征参数将人脸图像和面部图像进行匹配之后,还可以基于素材对象所穿的服装的纹理信息确定服装数据,基于服装数据,从面部图像中筛选出与人脸图像中真实人物的服装数据一致的素材对象的面部图像,作为待匹配面部图像,并将人脸图像和待匹配面部图像进行匹配。Wherein, the clothing data may be determined based on the texture information of the clothing worn by the material object. Specifically, after the electronic device matches the face image with the facial image based on the above at least one facial feature parameter, it can also determine the clothing data based on the texture information of the clothing worn by the material object, and filter the facial image based on the clothing data. The face image of the material object consistent with the clothing data of the real person in the face image is obtained as the face image to be matched, and the face image and the face image to be matched are matched.
在另一些实施例中,S2102可以执行以下至少一种操作:In other embodiments, S2102 may perform at least one of the following operations:
S21、基于部分面部特征参数将人脸图像和面部图像进行匹配,从多个面部图像中筛选出与人脸图像的部分面部特征参数匹配的部分面部图像。S21. Match the face image with the facial image based on the partial facial feature parameters, and select a partial facial image matching the partial facial feature parameters of the human face image from the multiple facial images.
S22、基于其他面部特征参数将人脸图像和面部图像匹配,从部分面部图像中筛选出与人脸图像的其他面部特征参数匹配的目标面部图像。S22. Match the face image with the facial image based on other facial feature parameters, and select a target facial image matching the other facial feature parameters of the human face image from part of the facial images.
其中,部分面部特征参数可以是用于初步匹配人脸图像和面部图像的面部特征参数,以从多个面部图像中初步筛选出与人脸图像的部分面部特征参数匹配的部分面部图像。Wherein, the partial facial feature parameters may be used to initially match the facial feature parameters between the face image and the facial image, so as to preliminarily screen out the partial facial images matching the partial facial feature parameters of the human face image from multiple facial images.
其中,其他面部特征参数可以是用于二次匹配人脸图像和面部图像的面部特征参数,以从部分面部图像中精确筛选出与人脸图像的其他面部特征参数匹配的目标面部图像。Wherein, the other facial feature parameters may be facial feature parameters used for secondary matching between the face image and the facial image, so as to accurately screen out the target facial image matching the other facial feature parameters of the human face image from partial facial images.
可选的,部分面部特征参数和其他面部特征参数均可以包括面部角度、表情数据、面部轮廓、五官特征以及面部装饰中的至少一种,且部分面部特征参数和其他面部特征参数所包括的面部特征参数不同。Optionally, some of the facial feature parameters and other facial feature parameters can include at least one of facial angles, expression data, facial contours, facial features, and facial decorations, and the facial features included in the partial facial feature parameters and other facial feature parameters The characteristic parameters are different.
进一步的,为了提高人脸图像和面部图像匹配的准确性,电子设备还可以获取非面部特征参数。Furthermore, in order to improve the matching accuracy between the face image and the face image, the electronic device can also acquire non-facial feature parameters.
相应的,在从部分面部图像中筛选出与人脸图像的其他面部特征参数匹配的目标面部图像之后,还包括执行以下至少一种操作:Correspondingly, after screening out the target facial images that match other facial feature parameters of the human face images from the partial facial images, at least one of the following operations is performed:
S23、基于非面部征参数中面部图像的光线状态,将人脸图像和目标面部图像进行匹配。S23. Based on the light state of the facial image in the non-facial feature parameters, match the human face image with the target facial image.
S24、基于非面部征参数中素材对象的发型数据,将人脸图像和面部图像进行匹配。S24. Based on the hairstyle data of the material object in the non-facial feature parameter, match the face image with the facial image.
S25、基于非面部征参数中素材对象的身形数据,将人脸图像和面部图像进行匹配。S25. Based on the body shape data of the material object in the non-facial feature parameter, match the face image with the face image.
S26、基于非面部征参数中素材对象的服装数据,将人脸图像和面部图像进行匹配。S26. Based on the clothing data of the material object in the non-facial feature parameter, match the face image with the face image.
其中,S23~S26与S16~S19相似,在此不做赘述。Wherein, S23-S26 are similar to S16-S19, and will not be repeated here.
由此,在本公开实施例中,可以通过多种匹配方式将人脸图像和面部图像进行匹配,并从多个面部图像中筛选出与人脸图像的面部特征参数匹配的目标面部图像,适应多种匹配场景,并且,基于多个面部特征参数匹配图像,可以得到多种不同风格的匹配结果,以基于多种风格的匹配结果训练目标网络,使得利用目标网络进行人脸融合时,可以得到多种不同风格的人脸融合结果,提高了视频的趣味性。Therefore, in the embodiment of the present disclosure, the face image can be matched with the face image through multiple matching methods, and the target face image matching the facial feature parameters of the face image can be selected from the multiple face images, adapting to A variety of matching scenarios, and by matching images based on multiple facial feature parameters, a variety of different styles of matching results can be obtained, and the target network can be trained based on the matching results of multiple styles, so that when using the target network for face fusion, you can get A variety of different styles of face fusion results improve the fun of the video.
在一些实施例中,S2103可以执行以下至少一种操作:In some embodiments, S2103 may perform at least one of the following operations:
S31、分别对人脸图像和目标面部图像进行分块。S31. Block the face image and the target face image respectively.
S32、计算人脸图像的各分块的第一稀疏矩阵和目标面部图像的各分块的第二稀疏矩阵。S32. Calculate the first sparse matrix of each sub-block of the face image and the second sparse matrix of each sub-block of the target facial image.
S33、将每块第一稀疏矩阵和第二稀疏矩阵进行融合,根据融合后的稀疏矩阵确定融合图像。S33. Fuse the first sparse matrix and the second sparse matrix for each block, and determine a fused image according to the fused sparse matrix.
具体的,首先,电子设备可以基于自适应图像融合算法并按照预设的分块尺寸,将人脸图像和目标面部图像分别分成多个图像块,每个图像块均可以对应一个像素矩阵,然后,对人脸图像的各分块的像素矩阵以及目标面部图像的各分块的像素矩阵进行小波变换,得到人脸图像的各分块的第一小波系数矩阵以及目标面部图像的各分块的第二小波系数矩阵,接着,分别对第一小波系数矩阵和第二小波系数矩阵进行稀疏处理,得到第一稀疏矩阵和第二稀疏矩阵,再次,按照绝对值取大的原则,将每块第一稀疏矩阵和第二稀疏矩阵进行融合,得到融合后的稀疏矩阵,最后,将融合后的稀疏矩阵进行小波逆变换,得到融合图像。Specifically, first, the electronic device can divide the face image and the target facial image into multiple image blocks based on the adaptive image fusion algorithm and according to the preset block size, and each image block can correspond to a pixel matrix, and then , performing wavelet transformation on the pixel matrix of each block of the face image and the pixel matrix of each block of the target facial image to obtain the first wavelet coefficient matrix of each block of the face image and the first wavelet coefficient matrix of each block of the target facial image The second wavelet coefficient matrix, then, perform sparse processing on the first wavelet coefficient matrix and the second wavelet coefficient matrix respectively, to obtain the first sparse matrix and the second sparse matrix, and again, according to the principle of taking the largest absolute value, the first and second sparse matrices of each block are The first sparse matrix is fused with the second sparse matrix to obtain a fused sparse matrix, and finally, the fused sparse matrix is subjected to wavelet inverse transform to obtain a fused image.
由此,在本公开实施例中,通过将图像进行分块,并计算各分块的稀疏矩阵,以利用稀疏矩阵准确的表达各分块的图像信息,然后将得到的每块的稀疏矩阵进行融合以及将融合后的稀疏矩阵进行逆变换,得到融合图像,提高了人脸图像和目标面部图像的融合效果。Therefore, in the embodiment of the present disclosure, by dividing the image into blocks and calculating the sparse matrix of each block, the sparse matrix can be used to accurately express the image information of each block, and then the obtained sparse matrix of each block is calculated. Fusion and inverse transformation of the fused sparse matrix are performed to obtain a fusion image, which improves the fusion effect of the human face image and the target facial image.
S220、基于样本组对预设网络进行训练,以得到用于对人脸和素材对象进行面部融合的目标网络。S220. Train the preset network based on the sample group, so as to obtain a target network for facial fusion of human faces and material objects.
其中,S220中的目标网络的训练方式可以参见S120,在此不做赘述。Wherein, for the training method of the target network in S220, reference may be made to S120, which will not be repeated here.
在本公开又一种实施方式中,还可以对目标网络的训练过程和人脸融合过程进行整体描述。In yet another implementation manner of the present disclosure, the training process of the target network and the face fusion process can also be described as a whole.
图4示出了本公开实施例提供的另一种人脸融合方法的流程示意图。Fig. 4 shows a schematic flowchart of another face fusion method provided by an embodiment of the present disclosure.
如图4所示,该人脸融合方法可以包括如下步骤。As shown in FIG. 4, the face fusion method may include the following steps.
S410、获取样本组。S410. Obtain a sample group.
在本公开实施例中,样本组包括人脸图像、素材对象的面部图像和由人脸图像和素材对象的面部图像融合得到的融合图像,素材对象的面部图像是对素材对象的初始面部图像进行渲染后得到的,且人脸图像与面部图像的面部特征参数匹配。In the embodiment of the present disclosure, the sample group includes a human face image, a facial image of a material object, and a fused image obtained by fusing the human face image and the facial image of the material object, and the facial image of the material object is the initial facial image of the material object. After rendering, the face image matches the facial feature parameters of the face image.
S420、基于样本组对预设网络进行训练,以得到用于对人脸和素材对象进行面部融合的目标网络。S420. Train the preset network based on the sample group, so as to obtain a target network for performing facial fusion on human faces and material objects.
S430、获取待融合的人脸图像和待融合的素材对象的面部图像。S430. Acquire a face image to be fused and a face image of a material object to be fused.
S440、将待融合的人脸图像和待融合的素材对象的面部图像输入至训练完成的目标网络,得到目标融合图像。S440. Input the face image to be fused and the face image of the material object to be fused to the trained target network to obtain a target fused image.
其中,S410~S420与S210~S220相似,S430~S440与S110~S120相似,在此不做赘述。Wherein, S410-S420 are similar to S210-S220, and S430-S440 are similar to S110-S120, which will not be repeated here.
图5示出了本公开实施例提供的一种人脸融合装置的结构示意图。Fig. 5 shows a schematic structural diagram of a human face fusion device provided by an embodiment of the present disclosure.
在本公开一些实施例中,图5所示的人脸融合装置可以应用于电子设备中。其中,电子设备可以包括移动电话、平板电脑、台式计算机、笔记本电脑、车载终端、可穿戴设备、一体机、智能家居设备等具有通信功能的设备,也可以包括虚拟机或者模拟器模拟的设备。In some embodiments of the present disclosure, the face fusion apparatus shown in FIG. 5 may be applied to electronic equipment. Among them, electronic devices may include devices with communication functions such as mobile phones, tablet computers, desktop computers, notebook computers, vehicle terminals, wearable devices, all-in-one computers, and smart home devices, as well as devices simulated by virtual machines or simulators.
如图5所示,该人脸融合装置500可以包括:图像获取模块510和融合模块520。As shown in FIG. 5 , the face fusion device 500 may include: an image acquisition module 510 and a fusion module 520 .
其中,图像获取模块510,用于获取待融合的人脸图像和待融合的素材对象的面部图像;Wherein, the image acquisition module 510 is used to acquire the face image to be fused and the facial image of the material object to be fused;
融合模块520,用于将待融合的人脸图像和待融合的素材对象的面部图像输入至训练完成的目标网络,得到目标融合图像,其中,目标网络基于样本组训练得到,样本组包括人脸图像、素材对象的面部图像和由人脸图像和素材对象的面部图像融合得到的融合图像,素材对象的面部图像是对素材对象的初始面部图像进行渲染后得到的,且人脸图像与面部图像的面部特征参数匹配。The fusion module 520 is used to input the face image to be fused and the facial image of the material object to be fused to the trained target network to obtain the target fused image, wherein the target network is trained based on a sample group, and the sample group includes a human face image, the face image of the material object, and the fused image obtained by fusing the face image and the face image of the material object. The face image of the material object is obtained after rendering the initial face image of the material object, and the face image and the face image The facial feature parameters match.
在本公开实施例中,能够获取待融合的人脸图像和待融合的素材对象的面部图像,将待融合的人脸图像和待融合的素材对象的面部图像输入至训练完成的目标网络,得到目标融合图像,由于目标网络基于样本组训练得到,且样本组包括人脸图像、素材对象的面部图像和由人脸图像和素材对象的面部图像融合得到的融合图像,素材对象的面部图像是对素材对象的初始面部图像进行渲染后得到的,且人脸图像与面部图像的面部特征参数匹配,使得利用训练完成的目标网络,将人脸图像和面部图像进行融合,能够得到将人脸与素材 进行融合的特效玩法,提高视频的趣味性,进而能够提高用户体验,以满足用户对特效玩法的多样化需求。In the embodiment of the present disclosure, the face image to be fused and the facial image of the material object to be fused can be acquired, and the face image to be fused and the facial image of the material object to be fused are input to the target network that has been trained to obtain The target fused image, because the target network is trained based on the sample group, and the sample group includes the face image, the facial image of the material object, and the fused image obtained by fusing the face image and the facial image of the material object, the facial image of the material object is It is obtained after rendering the initial facial image of the material object, and the face image matches the facial feature parameters of the facial image, so that the face image and the facial image can be fused using the trained target network, and the face and material can be obtained. The integrated special effects gameplay can improve the interest of the video, which in turn can improve the user experience to meet the diverse needs of users for special effects gameplay.
可选的,该装置还可以包括目标网络训练模块。其中,目标网络训练模块包括样本组获取单元和目标网络训练单元。Optionally, the device may also include a target network training module. Wherein, the target network training module includes a sample group acquisition unit and a target network training unit.
其中,样本组获取单元,用于获取样本组。Wherein, the sample group obtaining unit is used to obtain the sample group.
目标网络训练单元,用于基于样本组对预设网络进行训练,以得到用于对人脸和素材对象进行面部融合的目标网络。The target network training unit is used to train the preset network based on the sample group to obtain the target network for facial fusion of human faces and material objects.
可选的,样本组获取单元可以包括:图像获取子单元、图像匹配子单元和图像融合子单元。Optionally, the sample group acquisition unit may include: an image acquisition subunit, an image matching subunit, and an image fusion subunit.
其中,图像获取子单元,用于获取多个素材对象的面部图像和多个人脸图像,每个面部图像为素材对象在任一面部特征参数下的图像,每个人脸图像为真实人物在任一面部特征参数下的图像。Wherein, the image acquisition subunit is used to acquire facial images and multiple human face images of multiple material objects, each facial image is an image of a material object under any facial feature parameter, and each human face image is a real person in any facial feature Image under parameters.
图像匹配子单元,用于基于面部特征参数将人脸图像和面部图像进行匹配,从多个面部图像中筛选出与人脸图像的面部特征参数匹配的目标面部图像;The image matching subunit is used to match the face image and the facial image based on the facial feature parameters, and screens out the target facial image matching the facial feature parameters of the human face image from a plurality of facial images;
图像融合子单元,用于将人脸图像和目标面部图像进行融合,生成融合图像,得到由人脸图像、目标面部图像以及人脸图像对应的融合图像构成的样本组。The image fusion subunit is used to fuse the human face image and the target facial image to generate a fusion image, and obtain a sample group composed of the human face image, the target facial image and the fusion image corresponding to the human face image.
可选的,图像匹配子单元还可以用于执行以下至少一种操作:Optionally, the image matching subunit can also be used to perform at least one of the following operations:
根据面部特征参数中素材对象的面部角度,将人脸图像和面部图像进行匹配;Matching the human face image and the facial image according to the facial angle of the material object in the facial feature parameter;
根据面部特征参数中素材对象的表情数据,将人脸图像和面部图像进行匹配;Match the face image with the face image according to the expression data of the material object in the facial feature parameter;
根据面部特征参数中素材对象的面部轮廓,将人脸图像和面部图像进行匹配;Matching the face image and the facial image according to the facial contour of the material object in the facial feature parameter;
根据面部特征参数中素材对象的五官特征,将人脸图像和面部图像进行匹配;According to the facial features of the material object in the facial feature parameters, the face image and the facial image are matched;
根据面部特征参数中素材对象的面部装饰,将人脸图像和面部图像进行匹配。Match the human face image with the face image according to the facial decoration of the material object in the facial feature parameter.
可选的,图像匹配子单元还可以用于获取非面部征参数。Optionally, the image matching subunit can also be used to acquire non-facial feature parameters.
相应的,图像匹配子单元还可以用于执行以下至少一种操作:Correspondingly, the image matching subunit can also be used to perform at least one of the following operations:
基于非面部征参数中面部图像的光线状态,将人脸图像和面部图像进行匹配;Matching the face image and the face image based on the light state of the face image in the non-facial feature parameters;
基于非面部征参数中素材对象的发型数据,将人脸图像和面部图像进行匹配;Matching the face image and the face image based on the hairstyle data of the material object in the non-facial feature parameter;
基于非面部征参数中素材对象的身形数据,将人脸图像和面部图像进行匹配;Based on the body shape data of the material object in the non-facial feature parameter, the face image and the facial image are matched;
基于非面部征参数中素材对象的服装数据,将人脸图像和面部图像进行匹配。Based on the clothing data of the material object in the non-facial feature parameter, the face image and the face image are matched.
可选的,图像匹配子单元还可以用于基于部分面部特征参数将人脸图像和面部图像进行匹配,从多个面部图像中筛选出与人脸图像的部分面部特征参数匹配的部分面部图像;Optionally, the image matching subunit can also be used to match the face image and the facial image based on some facial feature parameters, and select a partial facial image that matches the partial facial feature parameters of the human face image from multiple facial images;
基于其他面部特征参数将人脸图像和面部图像匹配,从部分面部图像中筛选出与人脸图像的其他面部特征参数匹配的目标面部图像。The face image is matched with the facial image based on other facial feature parameters, and a target facial image matching the other facial feature parameters of the human face image is screened out from part of the facial images.
可选的,图像融合子单元还可以用于分别对人脸图像和目标面部图像进行分块;Optionally, the image fusion subunit can also be used to block the face image and the target face image respectively;
计算人脸图像的各分块的第一稀疏矩阵和目标面部图像的各分块的第二稀疏矩阵;Calculate the first sparse matrix of each sub-block of the face image and the second sparse matrix of each sub-block of the target facial image;
将每块第一稀疏矩阵和第二稀疏矩阵进行融合,根据融合后的稀疏矩阵确定融合图像。The first sparse matrix and the second sparse matrix of each block are fused, and a fused image is determined according to the fused sparse matrix.
需要说明的是,图5所示的人脸融合装置500可以执行图1和图5所示的方法实施例中的各个步骤,并且实现图1和图5所示的方法实施例中的各个过程和效果,在此不做赘述。It should be noted that the face fusion device 500 shown in FIG. 5 can execute each step in the method embodiment shown in FIG. 1 and FIG. 5 , and realize each process in the method embodiment shown in FIG. 1 and FIG. 5 and effects, which will not be described here.
图6示出了本公开实施例提供的一种电子设备的结构示意图。Fig. 6 shows a schematic structural diagram of an electronic device provided by an embodiment of the present disclosure.
如图6所示,该电子设备600可以包括控制器601以及存储有计算机程序指令的存储器602。As shown in FIG. 6 , the electronic device 600 may include a controller 601 and a memory 602 storing computer program instructions.
具体地,上述控制器601可以包括中央处理器(CPU),或者特定集成电路(Application Specific Integrated Circuit,ASIC),或者可以被配置成实施本申请实施例的一个或多个集成电路。Specifically, the above-mentioned controller 601 may include a central processing unit (CPU), or an application specific integrated circuit (Application Specific Integrated Circuit, ASIC), or may be configured to implement one or more integrated circuits of the embodiments of the present application.
存储器602可以包括用于信息或指令的大容量存储器。举例来说而非限制,存储器602可以包括硬盘驱动器(Hard Disk Drive,HDD)、软盘驱动器、闪存、光盘、磁光盘、磁带或通用串行总线(Universal Serial Bus,USB)驱动器或者两个及其以上这些的组合。在合适的情况下,存储器602可包括可移除或不可移除(或固定)的介质。在合适的情况下,存储器602可在综合网关设备的内部或外部。在特定实施例中,存储器602是非易失性固态存储器。在特定实施例中,存储器602包括只读存储器(Read-Only Memory,ROM)。在合适的情况下,该ROM可以是掩模编程的ROM、可编程ROM(Programmable ROM,PROM)、可擦除PROM(Electrical Programmable ROM,EPROM)、电可擦除PROM(Electrically Erasable Programmable ROM,EEPROM)、电可改写ROM(Electrically Alterable ROM,EAROM)或闪存,或者两个或及其以上这些的组合。 Memory 602 may include mass storage for information or instructions. By way of example and not limitation, the memory 602 may include a hard disk drive (Hard Disk Drive, HDD), a floppy disk drive, a flash memory, an optical disk, a magneto-optical disk, a magnetic tape, or a Universal Serial Bus (Universal Serial Bus, USB) drive or two or more thereof. A combination of the above. Storage 602 may include removable or non-removable (or fixed) media, where appropriate. Memory 602 may be internal or external to the integrated gateway device, where appropriate. In a particular embodiment, memory 602 is a non-volatile solid-state memory. In a particular embodiment, the memory 602 includes a read-only memory (Read-Only Memory, ROM). Where appropriate, the ROM can be a mask programmed ROM, a programmable ROM (Programmable ROM, PROM), an erasable PROM (Electrical Programmable ROM, EPROM), an electrically erasable PROM (Electrically Erasable Programmable ROM, EEPROM) ), electrically rewritable ROM (Electrically Alterable ROM, EAROM) or flash memory, or a combination of two or more of these.
控制器601通过读取并执行存储器602中存储的计算机程序指令,以执行本公开实施例所提供的人脸融合方法的步骤。The controller 601 executes the steps of the face fusion method provided by the embodiments of the present disclosure by reading and executing the computer program instructions stored in the memory 602 .
在一个示例中,该电子设备600还可包括收发器603和总线604。其中,如图6所示,控制器601、存储器602和收发器603通过总线604连接并完成相互间的通信。In an example, the electronic device 600 may further include a transceiver 603 and a bus 604 . Wherein, as shown in FIG. 6 , the controller 601 , the memory 602 and the transceiver 603 are connected through a bus 604 and complete mutual communication.
总线604包括硬件、软件或两者。举例来说而非限制,总线可包括加速图形端口(Accelerated Graphics Port,AGP)或其他图形总线、增强工业标准架构(Extended Industry Standard Architecture,EISA)总线、前端总线(Front Side BUS,FSB)、超传输(Hyper Transport,HT)互连、工业标准架构(Industrial Standard Architecture,ISA)总线、无限带宽互连、低引脚数(Low Pin Count,LPC)总线、存储器总线、微信道架构(Micro Channel Architecture, MCA)总线、外围控件互连(Peripheral Component Interconnect,PCI)总线、PCI-Express(PCI-X)总线、串行高级技术附件(Serial Advanced Technology Attachment,SATA)总线、视频电子标准协会局部(Video Electronics Standards Association Local Bus,VLB)总线或其他合适的总线或者两个或更多个以上这些的组合。在合适的情况下,总线604可包括一个或多个总线。尽管本申请实施例描述和示出了特定的总线,但本申请考虑任何合适的总线或互连。 Bus 604 includes hardware, software, or both. By way of example and not limitation, a bus may include an Accelerated Graphics Port (AGP) or other graphics bus, an Enhanced Industry Standard Architecture (EISA) bus, a Front Side Bus (FSB), a Super Transmission (Hyper Transport, HT) interconnection, Industrial Standard Architecture (Industrial Standard Architecture, ISA) bus, Infinity Bandwidth interconnection, Low Pin Count (Low Pin Count, LPC) bus, memory bus, Micro Channel Architecture (Micro Channel Architecture) , MCA) bus, Peripheral Component Interconnect (PCI) bus, PCI-Express (PCI-X) bus, Serial Advanced Technology Attachment (Serial Advanced Technology Attachment, SATA) bus, Video Electronics Standards Association local (Video Electronics Standards Association Local Bus, VLB) bus or other suitable bus or a combination of two or more of these. Bus 604 may comprise one or more buses, where appropriate. Although the embodiments of this application describe and illustrate a particular bus, this application contemplates any suitable bus or interconnect.
本实施例提供一种包含计算机可执行指令的存储介质,计算机可执行指令在由计算机处理器执行时用于执行一种人脸融合方法,该方法包括:This embodiment provides a storage medium containing computer-executable instructions, and the computer-executable instructions are used to perform a face fusion method when executed by a computer processor, the method comprising:
获取待融合的人脸图像和待融合的素材对象的面部图像;Obtain the face image to be fused and the facial image of the material object to be fused;
将待融合的人脸图像和待融合的素材对象的面部图像输入至训练完成的目标网络,得到目标融合图像,其中,目标网络基于样本组训练得到,样本组包括人脸图像、素材对象的面部图像和由人脸图像和素材对象的面部图像融合得到的融合图像,素材对象的面部图像是对素材对象的初始面部图像进行渲染后得到的,且人脸图像与面部图像的面部特征参数匹配。Input the face image to be fused and the facial image of the material object to be fused into the trained target network to obtain the target fused image, wherein the target network is trained based on the sample group, and the sample group includes the face image and the face of the material object The image and the fused image obtained by fusing the face image and the face image of the material object, the face image of the material object is obtained after rendering the initial face image of the material object, and the facial feature parameters of the face image and the face image match.
当然,本发明实施例所提供的一种包含计算机可执行指令的存储介质,其计算机可执行指令不限于如上的方法操作,还可以执行本发明任意实施例所提供的人脸融合方法中的相关操作。Of course, a storage medium containing computer-executable instructions provided by an embodiment of the present invention, the computer-executable instructions are not limited to the above-mentioned method operations, and can also perform the relevant steps in the face fusion method provided by any embodiment of the present invention. operate.
通过以上关于实施方式的描述,所属领域的技术人员可以清楚地了解到,本发明可借助软件及必需的通用硬件来实现,当然也可以通过硬件实现,但很多情况下前者是更佳的实施方式。基于这样的理解,本发明的技术方案本质上或说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品可以存储在计算机可读存储介质中,如计算机的软盘、只读存储器(Read-Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)、闪存(FLASH)、硬盘或光盘等,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或网络设备等)执行本发明各个实施例所提供的人脸融合方法。Through the above description about the implementation mode, those skilled in the art can clearly understand that the present invention can be realized by means of software and necessary general-purpose hardware, and of course it can also be realized by hardware, but in many cases the former is a better implementation mode . Based on such an understanding, the technical solution of the present invention can be embodied in the form of a software product, which can be stored in a computer-readable storage medium, such as a floppy disk of a computer. , read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), flash memory (FLASH), hard disk or optical disc, etc., including several instructions to make a computer device (which can be a personal computer) , server, or network equipment, etc.) execute the face fusion method provided by various embodiments of the present invention.
注意,上述仅为本发明的较佳实施例及所运用技术原理。本领域技术人员会理解,本发明不限于这里所述的特定实施例,对本领域技术人员来说能够进行各种明显的变化、重新调整和替代而不会脱离本发明的保护范围。因此,虽然通过以上实施例对本发明进行了较为详细的说明,但是本发明不仅仅限于以上实施例,在不脱离本发明构思的情况下,还可以包括更多其他等效实施例,而本发明的范围由所附的权利要求范围决定。Note that the above are only preferred embodiments of the present invention and applied technical principles. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and that various obvious changes, readjustments and substitutions can be made by those skilled in the art without departing from the protection scope of the present invention. Therefore, although the present invention has been described in detail through the above embodiments, the present invention is not limited to the above embodiments, and can also include more other equivalent embodiments without departing from the concept of the present invention, and the present invention The scope is determined by the scope of the appended claims.
Claims (10)
- 一种人脸融合方法,其特征在于,包括:A face fusion method, characterized in that, comprising:获取待融合的人脸图像和待融合的素材对象的面部图像;Obtain the face image to be fused and the facial image of the material object to be fused;将所述待融合的人脸图像和待融合的素材对象的面部图像输入至训练完成的目标网络,得到目标融合图像,其中,所述目标网络基于样本组训练得到,所述样本组包括人脸图像、素材对象的面部图像和由所述人脸图像和所述素材对象的面部图像融合得到的融合图像,所述素材对象的面部图像是对素材对象的初始面部图像进行渲染后得到的,且所述人脸图像与所述面部图像的面部特征参数匹配。Input the face image to be fused and the facial image of the material object to be fused into the trained target network to obtain a target fused image, wherein the target network is trained based on a sample group, and the sample group includes a human face an image, a facial image of a material object, and a fused image obtained by fusing the human face image and the facial image of the material object, where the facial image of the material object is obtained after rendering the initial facial image of the material object, and The facial image is matched with facial feature parameters of the facial image.
- 根据权利要求1所述的方法,其特征在于,目标网络的训练方法包括如下步骤:method according to claim 1, is characterized in that, the training method of target network comprises the steps:获取样本组;get sample group;基于所述样本组对预设网络进行训练,以得到用于对人脸和素材对象进行面部融合的目标网络。The preset network is trained based on the sample group to obtain a target network for facial fusion of human faces and material objects.
- 根据权利要求2所述的方法,其特征在于,所述获取样本组,包括:The method according to claim 2, wherein said acquiring a sample group comprises:获取多个所述素材对象的面部图像和多个所述人脸图像,每个所述面部图像为素材对象在任一面部特征参数下的图像,每个所述人脸图像为真实人物在任一面部特征参数下的图像;Obtain multiple facial images of the material object and multiple facial images, each of the facial images is an image of the material object under any facial feature parameter, and each of the facial images is a real person on any face Image under feature parameters;基于所述面部特征参数将所述人脸图像和所述面部图像进行匹配,从多个所述面部图像中筛选出与所述人脸图像的面部特征参数匹配的目标面部图像;Matching the face image and the facial image based on the facial feature parameters, and selecting a target facial image matching the facial feature parameters of the human face image from a plurality of the facial images;将所述人脸图像和所述目标面部图像进行融合,生成所述融合图像,得到由所述人脸图像、所述目标面部图像以及所述人脸图像对应的融合图像构成的所述样本组。Fusing the face image and the target face image to generate the fused image, and obtaining the sample group consisting of the face image, the target face image, and the fused image corresponding to the face image .
- 根据权利要求3所述的方法,其特征在于,所述基于所述面部特征参数将所述人脸图像和所述面部图像进行匹配,包括执行以下至少一种操作:The method according to claim 3, wherein said matching said facial image with said facial image based on said facial feature parameters comprises performing at least one of the following operations:根据所述面部特征参数中素材对象的面部角度,将所述人脸图像和所述面部图像进行匹配;Matching the human face image and the facial image according to the facial angle of the material object in the facial feature parameter;根据所述面部特征参数中素材对象的表情数据,将所述人脸图像和所述面部图像进行匹配;Matching the human face image and the facial image according to the expression data of the material object in the facial feature parameter;根据所述面部特征参数中素材对象的面部轮廓,将所述人脸图像和所述面部图像进行匹配;Matching the human face image and the facial image according to the facial contour of the material object in the facial feature parameter;根据所述面部特征参数中素材对象的五官特征,将所述人脸图像和所述面部图像进行 匹配;According to the facial features of the material object in the facial feature parameter, the face image and the facial image are matched;根据所述面部特征参数中素材对象的面部装饰,将所述人脸图像和所述面部图像进行匹配。Matching the human face image and the facial image according to the facial decoration of the material object in the facial feature parameters.
- 根据权利要求4所述的方法,其特征在于,还包括:获取非面部征参数;The method according to claim 4, further comprising: acquiring non-facial feature parameters;相应的,所述基于所述面部特征参数将所述人脸图像和所述面部图像进行匹配,还包括执行以下至少一种操作:Correspondingly, the matching of the face image and the face image based on the facial feature parameters also includes performing at least one of the following operations:基于所述非面部征参数中面部图像的光线状态,将所述人脸图像和所述面部图像进行匹配;Matching the face image with the face image based on the light state of the face image in the non-facial feature parameters;基于所述非面部征参数中素材对象的发型数据,将所述人脸图像和所述面部图像进行匹配;Matching the human face image with the facial image based on the hairstyle data of the material object in the non-facial feature parameters;基于所述非面部征参数中素材对象的身形数据,将所述人脸图像和所述面部图像进行匹配;Matching the human face image and the facial image based on the body shape data of the material object in the non-facial feature parameters;基于所述非面部征参数中素材对象的服装数据,将所述人脸图像和所述面部图像进行匹配。Based on the clothing data of the material object in the non-facial feature parameters, the face image is matched with the facial image.
- 根据权利要求3所述的方法,其特征在于,所述基于所述面部特征参数将所述人脸图像和所述面部图像进行匹配,包括:The method according to claim 3, wherein said matching said facial image with said facial image based on said facial feature parameters comprises:基于部分所述面部特征参数将所述人脸图像和所述面部图像进行匹配,从多个所述面部图像中筛选出与所述人脸图像的部分面部特征参数匹配的部分面部图像;Matching the face image with the facial image based on part of the facial feature parameters, and selecting a partial facial image that matches the partial facial feature parameters of the human face image from a plurality of the facial images;基于其他所述面部特征参数将所述人脸图像和所述面部图像匹配,从所述部分面部图像中筛选出与所述人脸图像的其他面部特征参数匹配的目标面部图像。The face image is matched with the facial image based on other facial feature parameters, and target facial images matching other facial feature parameters of the human face image are selected from the partial facial images.
- 根据权利要求3所述的方法,其特征在于,所述将所述人脸图像和所述目标面部图像进行融合,生成所述融合图像,包括:The method according to claim 3, wherein said fusion of said human face image and said target facial image to generate said fusion image comprises:分别对所述人脸图像和所述目标面部图像进行分块;Blocking the face image and the target face image respectively;计算所述人脸图像的各分块的第一稀疏矩阵和所述目标面部图像的各分块的第二稀疏矩阵;Calculating the first sparse matrix of each block of the human face image and the second sparse matrix of each block of the target facial image;将每块所述第一稀疏矩阵和所述第二稀疏矩阵进行融合,根据融合后的稀疏矩阵确定融合图像。The first sparse matrix and the second sparse matrix of each block are fused, and a fused image is determined according to the fused sparse matrix.
- 一种人脸融合装置,其特征在于,包括:A human face fusion device, characterized in that it comprises:图像获取模块,用于获取待融合的人脸图像和待融合的素材对象的面部图像;An image acquisition module, configured to acquire a face image to be fused and a facial image of a material object to be fused;融合模块,用于将所述待融合的人脸图像和待融合的素材对象的面部图像输入至训练完成的目标网络,得到目标融合图像,其中,所述目标网络基于样本组训练得到,所述样本组包括人脸图像、素材对象的面部图像和由所述人脸图像和所述素材对象的面部图像融合得到的融合图像,所述素材对象的面部图像是对素材对象的初始面部图像进行渲染后得到的,且所述人脸图像与所述面部图像的面部特征参数匹配。A fusion module, configured to input the face image to be fused and the facial image of the material object to be fused to the trained target network to obtain a target fused image, wherein the target network is obtained based on sample group training, and the The sample group includes a human face image, a facial image of a material object, and a fused image obtained by fusing the human face image and the facial image of the material object, and the facial image of the material object is rendered from the initial facial image of the material object obtained later, and the face image is matched with the facial feature parameters of the face image.
- 一种电子设备,其特征在于,所述设备包括:An electronic device, characterized in that the device comprises:一个或多个处理器;one or more processors;存储装置,用于存储一个或多个程序,storage means for storing one or more programs,当所述一个或多个程序被所述一个或多个处理器执行,使得所述一个或多个处理器实现如权利要求1-7中任一所述的人脸融合方法。When the one or more programs are executed by the one or more processors, the one or more processors are made to implement the face fusion method according to any one of claims 1-7.
- 一种计算机可读存储介质,其上存储有计算机程序,其特征在于,所述计算机程序被处理器执行时实现如权利要求1-7中任一所述的人脸融合方法。A computer-readable storage medium, on which a computer program is stored, wherein the computer program implements the face fusion method according to any one of claims 1-7 when executed by a processor.
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111064260.1A CN115797481A (en) | 2021-09-10 | 2021-09-10 | Face fusion method, device, equipment and storage medium |
CN202111064260.1 | 2021-09-10 |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2023036239A1 true WO2023036239A1 (en) | 2023-03-16 |
Family
ID=85416880
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2022/117804 WO2023036239A1 (en) | 2021-09-10 | 2022-09-08 | Human face fusion method and apparatus, device and storage medium |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN115797481A (en) |
WO (1) | WO2023036239A1 (en) |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108765272A (en) * | 2018-05-31 | 2018-11-06 | Oppo广东移动通信有限公司 | Image processing method, device, electronic equipment and readable storage medium storing program for executing |
CN111508050A (en) * | 2020-04-16 | 2020-08-07 | 北京世纪好未来教育科技有限公司 | Image processing method and device, electronic equipment and computer storage medium |
CN113361387A (en) * | 2021-06-03 | 2021-09-07 | 湖南快乐阳光互动娱乐传媒有限公司 | Face image fusion method and device, storage medium and electronic equipment |
-
2021
- 2021-09-10 CN CN202111064260.1A patent/CN115797481A/en active Pending
-
2022
- 2022-09-08 WO PCT/CN2022/117804 patent/WO2023036239A1/en unknown
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108765272A (en) * | 2018-05-31 | 2018-11-06 | Oppo广东移动通信有限公司 | Image processing method, device, electronic equipment and readable storage medium storing program for executing |
CN111508050A (en) * | 2020-04-16 | 2020-08-07 | 北京世纪好未来教育科技有限公司 | Image processing method and device, electronic equipment and computer storage medium |
CN113361387A (en) * | 2021-06-03 | 2021-09-07 | 湖南快乐阳光互动娱乐传媒有限公司 | Face image fusion method and device, storage medium and electronic equipment |
Also Published As
Publication number | Publication date |
---|---|
CN115797481A (en) | 2023-03-14 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109102483B (en) | Image enhancement model training method and device, electronic equipment and readable storage medium | |
WO2020119527A1 (en) | Human action recognition method and apparatus, and terminal device and storage medium | |
JP6355746B2 (en) | Image editing techniques for devices | |
WO2019052329A1 (en) | Facial recognition method and related product | |
CN111859023A (en) | Video classification method, device, equipment and computer readable storage medium | |
WO2017206400A1 (en) | Image processing method, apparatus, and electronic device | |
WO2022171024A1 (en) | Image display method and apparatus, and device and medium | |
US20190371050A1 (en) | Image processing method and apparatus, electronic device and computer readable medium | |
CN108198177A (en) | Image acquiring method, device, terminal and storage medium | |
CN107395960A (en) | Photographic method and device, computer installation and computer-readable recording medium | |
CN110266955B (en) | Image processing method, image processing apparatus, electronic device, and storage medium | |
CN108463823A (en) | A kind of method for reconstructing, device and the terminal of user's Hair model | |
CN106815803B (en) | Picture processing method and device | |
CN110570383B (en) | Image processing method and device, electronic equipment and storage medium | |
CN113870133A (en) | Multimedia display and matching method, device, equipment and medium | |
CN112950640A (en) | Video portrait segmentation method and device, electronic equipment and storage medium | |
CN113240760A (en) | Image processing method and device, computer equipment and storage medium | |
CN110689478B (en) | Image stylization processing method and device, electronic equipment and readable medium | |
CN112819016A (en) | Image processing method, image processing device, electronic equipment and storage medium | |
CN116757923A (en) | Image generation method and device, electronic equipment and storage medium | |
CN107766803A (en) | Video personage based on scene cut dresss up method, apparatus and computing device | |
CN113313790A (en) | Video generation method, device, equipment and storage medium | |
CN113887498A (en) | Face recognition method, device, equipment and storage medium | |
WO2023036239A1 (en) | Human face fusion method and apparatus, device and storage medium | |
CN108255995A (en) | A kind of method and device for exporting image |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
NENP | Non-entry into the national phase |
Ref country code: DE |
|
32PN | Ep: public notification in the ep bulletin as address of the adressee cannot be established |
Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 27/06/2024) |