Image processing method and device, computer device and storage medium

By mapping images to the latent space of the source domain and then using transfer features to transfer them to the latent space of the target domain, the problems of large data volume and high computing power in cross-domain image transfer are solved, and efficient image transfer is achieved.

CN114283049BActive Publication Date: 2025-11-04TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111081567.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-09-15
Publication Date
2025-11-04
Estimated Expiration
2041-09-15

AI Technical Summary

Technical Problem

Existing technologies require training with large datasets when performing cross-domain image transfer, resulting in high time consumption and high computational requirements for the training platform.

Method used

The image to be processed is mapped to the first latent space of the source domain. The first semantic features are transferred to the second latent space of the target domain through feature transfer. The pre-trained adversarial generative model is used for matching to generate the target image.

Benefits of technology

Image transfer can be completed without a large amount of data for training, saving time and requiring low computing power from the training platform.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114283049B_ABST
    Figure CN114283049B_ABST
Patent Text Reader

Abstract

The application provides an image processing method and device, computer equipment and a storage medium, belonging to the technical field of computers, and can be applied to various scenes such as cloud technology, AI, intelligent transportation and vehicle-mounted devices. The method comprises the following steps: mapping a to-be-processed image to a first hidden space of a source field to obtain a first semantic feature; obtaining a migration feature, and migrating the first semantic feature to a second semantic feature based on the migration feature; and generating a target image based on the second semantic feature, wherein the target image has the style of the target field. The above scheme maps the to-be-processed image to the first hidden space of the source field, so that the migration feature is used to migrate the first semantic space feature obtained by mapping, the semantic direction of the to-be-processed image in the first hidden space is migrated to the second hidden space to obtain the second semantic feature, and then the target image is generated. Therefore, the image migration can be completed without a large amount of data for training, time is saved, and the computing power requirement of the training platform is not high.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of computers, and in particular to an image processing method and device, a computer device, and a storage medium. BACKGROUND

[0002] With the development of computer technology, generative adversarial networks are widely used in cross-domain image migration tasks, such as converting real human face images into hand-drawn style human face images. How to better implement image migration is an improvement direction.

[0003] At present, when implementing cross-domain image migration, the data of domain a is usually used to fine-tune the generator of the generative adversarial network pre-trained in domain b, so that the generator obtained by fine-tuning is structurally corresponding to the generator of the generative adversarial network in domain a, thereby realizing image migration from domain a to domain b.

[0004] However, the above technical solutions all need to use large-scale data sets of domain b to train the generative adversarial network, which consumes a lot of time and has a high requirement for the computing power of the training platform. SUMMARY

[0005] The embodiments of the present application provide an image processing method and device, a computer device, and a storage medium, which can complete image migration without using a large amount of data for training, saving time and having a low requirement for the computing power of the training platform. The technical solution is as follows:

[0006] In one aspect, an image processing method is provided, which includes:

[0007] mapping a to-be-processed image to a first latent space of a source domain to obtain a first semantic feature, the to-be-processed image having a style of the source domain, the first semantic feature being used to represent a semantic direction of the to-be-processed image in the first latent space;

[0008] obtaining a migration feature, the migration feature being used to migrate the semantic feature in the first latent space to a second latent space of a target domain, the migration feature being obtained based on matching a first model and a second model, the first model being a generative adversarial network pre-trained in the source domain, and the second model being a generative adversarial network pre-trained in the target domain;

[0009] migrating the first semantic feature to a second semantic feature based on the migration feature, the second semantic feature being used to represent a semantic direction of the to-be-processed image in the second latent space;

[0010] generating a target image based on the second semantic feature, the target image having a style of the target domain.

[0011] In another aspect, an image processing apparatus is provided, the apparatus comprising:

[0012] a mapping module configured to map a to-be-processed image to a first latent space of a source domain to obtain a first semantic feature, the to-be-processed image having a style of the source domain, the first semantic feature being used to represent a semantic direction of the to-be-processed image in the first latent space;

[0013] an obtaining module configured to obtain a migration feature, the migration feature being used to migrate the semantic feature in the first latent space to a second latent space of a target domain, the migration feature being obtained based on matching a first model and a second model, the first model being a pre-trained generative adversarial model in the source domain, the second model being a pre-trained generative adversarial model in the target domain;

[0014] a migration module configured to migrate the first semantic feature to a second semantic feature based on the migration feature, the second semantic feature being used to represent a semantic direction of the to-be-processed image in the second latent space;

[0015] an image generating module configured to generate a target image based on the second semantic feature, the target image having a style of the target domain.

[0016] In some embodiments, the migration module is configured to, for any first semantic element in the first semantic feature, determine a migration element corresponding to the first semantic element from the migration feature, the first semantic element representing a semantic direction of any image semantics in the to-be-processed image; and migrate the first semantic element based on the migration element to obtain a corresponding second semantic element in the second semantic feature.

[0017] In some embodiments, the apparatus further comprises:

[0018] a first determining module configured to determine a plurality of first sample migration features based on the first model and a first sample image set used to train the first model, the plurality of first sample migration features corresponding to a plurality of first sample images in the first sample image set one by one;

[0019] a second determining module configured to determine a plurality of second sample migration features based on the second model and a second sample image set used to train the second model, the plurality of second sample migration features corresponding to a plurality of second sample images in the second sample image set one by one;

[0020] a third determining module configured to determine the migration feature based on the plurality of first sample migration features and the plurality of second sample migration features.

[0021] In some embodiments, the first determining module comprises:

[0022] A first obtaining sub-module is configured to obtain, for any first sample image in the first set of sample images, a first latent space feature of the first sample image in a first latent space of the first model;

[0023] A first dimension reduction sub-module is configured to reduce the dimension of the first latent space feature to obtain a first feature vector matrix;

[0024] A first determining sub-module is configured to determine, based on the first latent space feature and the first feature vector matrix, a first sample migration feature corresponding to the first sample image.

[0025] In some embodiments, the first dimension reduction sub-module comprises:

[0026] A first obtaining unit is configured to obtain an average value of elements in the first latent space feature;

[0027] A first determining unit is configured to determine, based on the average value, a plurality of first eigenvalues and a plurality of first eigenvectors of a first covariance matrix, the first eigenvalues corresponding one-to-one to the first eigenvectors;

[0028] A second determining unit is configured to determine, based on the plurality of first eigenvalues, a first feature vector matrix, a row vector in the first feature vector matrix being a first eigenvector corresponding to a first eigenvalue satisfying an ordering condition.

[0029] In some embodiments, the first determining unit is configured to determine, based on the average value, a covariance corresponding to each element in the first latent space feature to obtain the first covariance matrix; and perform eigenvalue decomposition on the first covariance matrix to obtain the plurality of first eigenvalues and the plurality of first eigenvectors.

[0030] In some embodiments, the second determining unit is configured to order the plurality of first eigenvalues; select at least one first eigenvalue before a first target order from the ordered plurality of first eigenvalues; and take at least one first eigenvector corresponding to the at least one first eigenvalue as a row vector to obtain the first feature vector matrix.

[0031] In some embodiments, the second determining module comprises:

[0032] A second obtaining sub-module is configured to obtain, for any second sample image in the second set of sample images, a second latent space feature of the second sample image in a second latent space of the second model;

[0033] a second dimension reduction submodule, configured to reduce dimension of the second latent space feature to obtain a second feature vector matrix;

[0034] a second determination submodule, configured to determine a second sample migration feature corresponding to the second sample image based on the second latent space feature and the second feature vector matrix.

[0035] In some embodiments, the second dimension reduction submodule comprises:

[0036] a second acquisition unit, configured to acquire an average value of each element in the second latent space feature;

[0037] a third determination unit, configured to determine a plurality of second eigenvalues and a plurality of second eigenvectors of a second covariance matrix based on the average value, the second eigenvalues corresponding to the second eigenvectors one by one;

[0038] a fourth determination unit, configured to determine a second feature vector matrix based on the plurality of second eigenvalues, a row vector in the second feature vector matrix being a second eigenvector corresponding to a second eigenvalue satisfying an ordering condition.

[0039] In some embodiments, the third determination unit is configured to determine a covariance corresponding to each element in the second latent space feature based on the average value to obtain the second covariance matrix; and perform eigenvalue decomposition on the second covariance matrix to obtain the plurality of second eigenvalues and the plurality of second eigenvectors.

[0040] In some embodiments, the fourth determination unit is configured to order the plurality of second eigenvalues; select at least one second eigenvalue before a second target order from the ordered plurality of second eigenvalues; and obtain the second feature vector matrix by taking at least one second eigenvector corresponding to the at least one second eigenvalue as a row vector.

[0041] In another aspect, a computer device is provided, which comprises a processor and a memory, the memory being configured to store at least one piece of computer program, the at least one piece of computer program being loaded and executed by the processor to implement operations performed in the image processing method in the embodiments of the present application.

[0042] In another aspect, a computer readable storage medium is provided, which stores at least one piece of computer program, the at least one piece of computer program being loaded and executed by a processor to implement operations performed in the image processing method in the embodiments of the present application.

[0043] In another aspect, a computer program product is provided, which includes computer program codes stored in a computer readable storage medium. A processor of a computer device reads the computer program codes from the computer readable storage medium, and the processor executes the computer program codes to cause the computer device to perform the image processing method provided in various optional implementations of each aspect described above.

[0044] The technical scheme provided by the embodiments of the present application has the beneficial effects that:

[0045] The embodiments of the present application provide an image processing method. By mapping the to-be-processed image to the first latent space of the source field, the first semantic space feature obtained by mapping can be migrated based on the migration feature, the semantic direction of the to-be-processed image in the first latent space is migrated to the second latent space, the second semantic feature is obtained, and the target image is generated. The image migration can be completed without using a large amount of data for training, time is saved, and the computing power requirement of the training platform is not high. BRIEF DESCRIPTION OF DRAWINGS

[0046] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed in the embodiment description will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.

[0047] Figure 1 is a schematic diagram of an implementation environment of an image processing method according to an embodiment of the present application;

[0048] Figure 2 is a flowchart of an image processing method according to an embodiment of the present application;

[0049] Figure 3 is a flowchart of an image processing method according to an embodiment of the present application;

[0050] Figure 4 is a schematic diagram of a technical framework according to an embodiment of the present application;

[0051] Figure 5 is a block diagram of an image processing device according to an embodiment of the present application;

[0052] Figure 6 is a block diagram of another image processing device according to an embodiment of the present application;

[0053] Figure 7 is a structural block diagram of a terminal according to an embodiment of the present application;

[0054] Figure 8 Fig. 1 is a structural schematic diagram of a server according to an embodiment of the present application. DETAILED DESCRIPTION

[0055] In order to make the objects, technical solutions and advantages of the present application clearer, the embodiments of the present application will be further described in detail below with reference to the drawings.

[0056] In the present application, the terms "first", "second" and the like are used to distinguish the same or similar items with substantially the same function and action, and it should be understood that there is no logical or time sequence relationship between "first", "second" and "nth", and the number and execution order are not limited.

[0057] In the present application, the term "at least one" means one or more, and the term "multiple" means two or more.

[0058] In the following, the terms related to the present application are explained.

[0059] GAN (Generative Adversarial Networks) is a kind of deep learning model, and the adversarial generative network generally includes a generator and a discriminator, wherein the discriminator provides a loss function based on adversarial learning for the training of the generator. GAN can be used as an image generation model. The image generation model can realize arbitrary generation of images within the field of training data set, and the image generation model generally takes a random noise with a Gaussian distribution as input to obtain a meaningful image (such as a human face).

[0060] StyleGAN: a kind of adversarial generative model with leading effect.

[0061] StyleGAN2: a kind of adversarial generative model with better effect for improving the shortcomings of StyleGAN, and is one of the best adversarial generative networks in terms of comprehensive performance.

[0062] Latent space: the input space of the generator of the adversarial generative network, which is usually composed of random sampling noise based on the standard Gaussian distribution.

[0063] PCA (Principal Component Analysis, principal component analysis technology), also known as principal component analysis technology, aims to use the idea of dimensionality reduction to convert multiple indicators into a few comprehensive indicators. The main idea of PCA is to map n-dimensional features to k-dimensional features. The k-dimensional features are new orthogonal features, also known as principal components, which are k-dimensional features reconstructed on the basis of the original n-dimensional features. The work of PCA is to sequentially find a set of mutually orthogonal coordinate axes in the original space. The selection of the new coordinate axes is closely related to the data itself. Among them, the first new coordinate axis is the direction with the maximum variance in the original data, the second new coordinate axis is the direction with the maximum variance in the plane orthogonal to the first coordinate axis, and the third axis is the direction with the maximum variance in the plane orthogonal to the first and second axes. By analogy, n such coordinate axes can be obtained. Through this way, we find that most of the variances are contained in the first k coordinate axes, and the variances contained in the remaining coordinate axes are almost zero. Therefore, we can ignore the remaining coordinate axes and only keep the first k coordinate axes containing most of the variances. In fact, this is equivalent to retaining the dimension features containing most of the variances and ignoring the features with almost zero variance, thereby realizing the dimensionality reduction of the data features.

[0064] The image processing method provided by the embodiments of the present application can be executed by a computer device. In some embodiments, the computer device is a terminal or a server. In the following, taking the computer device as a server as an example, the implementation environment of the image processing method provided by the embodiments of the present application is introduced, Figure 1 is a schematic diagram of an implementation environment of an image processing method according to an embodiment of the present application. Referring to Figure 1 , the implementation environment includes a terminal 101 and a server 102.

[0065] The terminal 101 and the server 102 can be directly or indirectly connected through wired or wireless communication, which is not limited in the present application.

[0066] In some embodiments, the terminal 101 is a smart phone, a tablet computer, a notebook computer, a desktop computer, a smart speaker, a smart watch, a smart voice interaction device, a smart home appliance, a vehicle-mounted terminal, etc., but is not limited thereto. The terminal 101 is installed and runs an application program for supporting image processing. Those skilled in the art can know that the number of the above-mentioned terminals can be more or less. For example, the above-mentioned terminals can be only one, or the above-mentioned terminals can be dozens or hundreds, or more. The number and type of the terminal are not limited in the embodiments of the present application.

[0067] In some embodiments, the server 102 is a standalone physical server, can also be a server cluster or distributed system composed of multiple physical servers, and can also be a cloud server providing basic cloud computing services such as cloud service, cloud database, cloud computing, cloud function, cloud storage, network service, cloud communication, middleware service, domain name service, security service, CDN (Content Delivery Network), and big data and artificial intelligence platform. The server 102 is used to provide background services for applications supporting virtual scenes. In some embodiments, the server 102 undertakes the main computing work, and the terminal 101 undertakes the secondary computing work; or the server 102 undertakes the secondary computing work, and the terminal 101 undertakes the main computing work; or the server 102 and the terminal 101 adopt a distributed computing architecture for collaborative computing.

[0068] In this implementation environment, the application for image processing can migrate the to-be-processed image from the style of field a to the style of field b.

[0069] For example, the terminal sends the to-be-processed image to the server based on the above-mentioned application, the server maps the to-be-processed image to the first latent space of field a to obtain a first semantic feature, which is used to represent the semantic direction of the to-be-processed image in the first latent space. Then the server migrates the first semantic feature to a second semantic feature based on the migration feature, the second semantic feature is used to represent the semantic direction in the second latent space of field b. Finally, the server generates a target image based on the second semantic feature, the target image has the style of field b. The server returns the target image to the terminal for display.

[0070] Figure 2 is a flowchart of an image processing method according to an embodiment of the present application, as shown in Figure 2 In the embodiments of the present application, the server is taken as an example for illustration. The image processing method comprises the following steps:

[0071] 201, mapping a to-be-processed image to a first latent space of a source field to obtain a first semantic feature, the to-be-processed image having a style of the source field, the first semantic feature being used to represent a semantic direction of the to-be-processed image in the first latent space.

[0072] In the embodiment of the present application, the to-be-processed image is an image uploaded by a terminal, the to-be-processed image has the style of a source domain, and the server can map the to-be-processed image to a first latent space of the source domain based on a generator of a first model pre-trained in the source domain, to obtain a semantic direction of the to-be-processed image in the first latent space, the first model being a generative adversarial model. When the to-be-processed image is a human face image, the semantic direction of the human face image in the first latent space includes gender, facial features, age, and the like.

[0073] It should be noted that the semantic direction can also be referred to as a semantic direction in the embodiment of the present application, which is not limited in the embodiment of the present application.

[0074] 202, obtain a migration feature used for migrating the semantic feature in the first latent space to a second latent space of a target domain, the migration feature being obtained based on matching a first model and a second model, the first model being an adversarial generative model pre-trained in the source domain, and the second model being an adversarial generative model pre-trained in the target domain.

[0075] In the embodiment of the present application, the migration feature is obtained based on matching the pre-trained first model and the pre-trained second model, and the migration feature can be directly obtained when the to-be-processed image is processed.

[0076] 203, migrate the first semantic feature to a second semantic feature based on the migration feature, the second semantic feature being used for representing a semantic direction of the to-be-processed image in the second latent space.

[0077] In the embodiment of the present application, the server can migrate the semantic direction in the first latent space represented by the first semantic feature to a semantic direction in the second latent space of the target domain based on the migration feature, to obtain the second semantic feature. The migration feature is obtained based on matching the first latent space of the first model pre-trained in the source domain and the second latent space of the second model pre-trained in the target domain.

[0078] 204, generate a target image based on the second semantic feature, the target image having the style of the target domain.

[0079] In the embodiment of the present application, after obtaining the second semantic feature, the server can process the second semantic feature based on a generator of the second model pre-trained in the target domain, to obtain the target image.

[0080] This application provides an image processing method that maps the image to be processed to a first latent space in the source domain, enabling the transfer of the first semantic space features obtained by the mapping based on the transfer features. The semantic direction of the image to be processed in the first latent space is transferred to a second latent space to obtain a second semantic feature, thereby generating a target image. The image transfer can be completed without using a large amount of data for training, saving time and having low requirements for the computing power of the training platform.

[0081] The above Figure 2 The main flow of the image processing method provided in this application embodiment is illustrated by way of example. The image processing method will be further described below based on an application scenario. See [link to relevant documentation]. Figure 3 As shown, Figure 3 This is a flowchart of an image processing method provided according to an embodiment of this application. In this embodiment, the method is described using an execution method performed by a server as an example. The image processing method includes the following steps:

[0082] 301. Based on the first model and the first sample image set used to train the first model, determine multiple first sample transfer features. The first model is an adversarial generative model pre-trained in the source domain. The multiple first sample transfer features correspond one-to-one with multiple first sample images in the first sample image set.

[0083] In this embodiment, the server can obtain a first model pre-trained in the source domain. This first model is an adversarial generative model, such as a StyleGAN model or a StyleGAN2 model. The first model can be pre-trained by the server based on multiple first sample images from a first sample image set, or it can directly obtain a pre-trained first model and the first sample image set used to train the first model. Based on the first model, the server maps multiple first sample images from the first sample image set into the first latent space of the first model, thereby obtaining the first sample transfer features corresponding to each first sample image.

[0084] In some embodiments, the server can obtain a first latent space feature of any first sample image in the first set of sample images in the first latent space of the first model. The server can input the first sample image into the first model, and map the first sample image into the first latent space of the first model to obtain the first latent space feature. Then the server can reduce the dimension of the first latent space feature to obtain a first feature vector matrix. The server can reduce the dimension of the first latent space feature based on a latent space decomposition algorithm. Finally, the server can determine a first sample migration feature corresponding to the first sample image based on the first latent space feature and the first feature vector matrix. The first latent space feature is in the form of a vector matrix, and the server obtains the first sample migration feature by multiplying the first latent space feature and the first feature vector matrix. The first sample migration feature corresponding to the first sample image is also in the form of a vector matrix. By mapping the first sample image into the first latent space, the main features in the first sample image, i.e., the features that have an impact on image migration, can be determined by dimension reduction, thereby facilitating matching of latent spaces of different fields.

[0085] In some embodiments, the server can use a principal component analysis method to reduce the dimension of the first latent space feature. Accordingly, the server obtains the average value of each element in the first latent space feature, and then determines a plurality of first eigenvalues and a plurality of first eigenvectors of a first covariance matrix based on the average value, wherein the first eigenvalues and the first eigenvectors correspond one-to-one. Then the server determines a first feature vector matrix based on the plurality of first eigenvalues, wherein the row vectors in the first feature vector matrix are the first eigenvectors corresponding to the first eigenvalues that satisfy the sorting condition. The server can determine the covariance corresponding to each element in the first latent space feature based on the average value to obtain the first covariance matrix, and then perform eigenvalue decomposition on the first covariance matrix to obtain the plurality of first eigenvalues and the plurality of first eigenvectors. The server can sort the plurality of first eigenvalues, and then select at least one first eigenvalue that is sorted before a first target order from the sorted plurality of second eigenvalues, and take at least one first eigenvector corresponding to the at least one first eigenvalue as a row vector to obtain the first feature vector matrix. By calculating the first covariance matrix and performing eigenvalue decomposition on the first covariance matrix, n1-dimensional features can be obtained. By sorting and screening, the n1-dimensional features can be mapped to k-dimensional features to obtain the first feature vector matrix. The k-dimensional features are reconstructed based on the original n1-dimensional features, and n1 is greater than k. n1 and k are both positive integers, thereby realizing dimension reduction of features.

[0086] For example, the server uses a PCA method to reduce the dimension of the first hidden space feature. First, the average value of each element in the first hidden space feature X1 is calculated, and then the first covariance matrix is calculated based on the average value. The first covariance matrix is decomposed by eigenvalue to calculate a plurality of first eigenvalues and a plurality of first eigenvectors. Then, the plurality of first eigenvalues are sorted from large to small, and the first k eigenvalues are selected. The k first eigenvectors corresponding to the first k eigenvalues are taken as row vectors to form a first eigenvector matrix P1. The first sample migration feature is T1 = P1·X1.

[0087] It should be noted that the server can also use other hidden space decomposition algorithms, and the embodiments of the present application do not limit this.

[0088] 302, based on the second model and the second sample image set used to train the second model, determine a plurality of second sample migration features, the second model is an adversarial generative model pre-trained in the target field, and the plurality of second sample migration features correspond one-to-one to the plurality of second sample images in the second sample image set.

[0089] In the embodiments of the present application, the server can obtain a second model pre-trained in the target field, which is an adversarial generative model such as a styleGAN model or a styleGAN2 model. The second model can be pre-trained by the server based on the plurality of second sample images in the second sample image set, or the pre-trained second model and the second sample image set used to train the second model can be directly obtained. The server maps the plurality of second sample images in the second sample image set to the second hidden space of the second model based on the second model, thereby obtaining the second sample migration features corresponding to each second sample image.

[0090] In some embodiments, the second sample image in the second sample image set is taken as an example. The server can obtain a second latent space feature of the second sample image in a second latent space of a second model, where the server can input the second sample image into the second model, map the second sample image into the second latent space of the second model, and thus obtain the second latent space feature. Then the server can reduce the dimension of the second latent space feature to obtain a second feature vector matrix, where the server can reduce the dimension of the second latent space feature based on a latent space decomposition algorithm. Finally, the server can determine a second sample migration feature corresponding to the second sample image based on the second latent space feature and the second feature vector matrix, where the second latent space feature is in the form of a vector matrix, the second latent space feature is in the form of a vector matrix, the server obtains the second sample migration feature by multiplying the second latent space feature and the second feature vector matrix, and the second sample migration feature corresponding to the second sample image is also in the form of a vector matrix. By mapping the second sample image into the second latent space, the main features in the second sample image, i.e., the features that have an impact on image migration, can be determined in a reduced dimension manner, thereby facilitating matching of latent spaces of different fields.

[0091] In some embodiments, the server can use a principal component analysis method to reduce the dimension of the second latent space feature. Accordingly, the server obtains the average value of each element in the second latent space feature, and then determines a plurality of second eigenvalues and a plurality of second eigenvectors of a second covariance matrix based on the average value, where each second eigenvalue corresponds to a second eigenvector. Then the server determines a second feature vector matrix based on the plurality of second eigenvalues, where the row vectors in the second feature vector matrix are the second eigenvectors corresponding to the second eigenvalues that satisfy an ordering condition. The server can determine the covariance corresponding to each element in the second latent space feature based on the average value to obtain the second covariance matrix, and then perform eigenvalue decomposition on the second covariance matrix to obtain the plurality of second eigenvalues and the plurality of second eigenvectors. The server can sort the plurality of second eigenvalues, and then select at least one second eigenvalue that is ranked before a second target order from the sorted plurality of second eigenvalues, and take at least one second eigenvector corresponding to the at least one second eigenvalue as a row vector to obtain the second feature vector matrix. By calculating the second covariance matrix and performing eigenvalue decomposition on the second covariance matrix, n2-dimensional features can be obtained, and by sorting and screening, the n2-dimensional features can be mapped to k-dimensional features to obtain the second feature vector matrix, where the k-dimensional features are reconstructed based on the original n2-dimensional features, n2 is greater than k, and n and k are positive integers, thereby realizing dimension reduction of the features.

[0092] For example, the server uses a PCA method to reduce the dimension of the first hidden space feature. First, the average value of each element in the first hidden space feature X2 is calculated, and then the first covariance matrix is calculated based on the average value. The first covariance matrix is decomposed by eigenvalue to obtain a plurality of first eigenvalues and a plurality of first eigenvectors. Then, the first eigenvalues are sorted from large to small, and the first k eigenvalues are selected. The k first eigenvectors corresponding to the first k eigenvalues are taken as row vectors to form a first eigenvector matrix P2. The first sample migration feature is T2 = P2·X2.

[0093] 303. Determine a migration feature based on the plurality of first sample migration features and the plurality of second sample migration features.

[0094] In an embodiment of the present application, the server can determine the mean of the plurality of first sample migration features and the plurality of second sample migration features as the migration feature.

[0095] 304. Map a to-be-processed image to a first hidden space of a source domain to obtain a first semantic feature, the to-be-processed image having a style of the source domain, the first semantic feature being used to represent a semantic direction of the to-be-processed image in the first hidden space.

[0096] In an embodiment of the present application, the server can obtain a first model pre-trained in the source domain. The server can also obtain a to-be-processed image uploaded by a terminal, the to-be-processed image having a style of the source domain. Then the server inputs the to-be-processed image into the first model, and the generator of the first model maps the to-be-processed image to the first hidden space to obtain the first semantic feature.

[0097] For example, the first model is a StyleGAN model pre-trained in the source domain, and the to-be-processed image is a real face image uploaded by a terminal. The server maps the real face image to the first hidden space based on the StyleGAN model to obtain the first semantic feature, which includes features of semantic directions such as age, gender, expression, skin color, and face orientation.

[0098] In some embodiments, the server maps the to-be-processed image to the first hidden space of the source domain to obtain a first image hidden space feature, and then decomposes the first image hidden space feature into a first semantic feature and an image preservation feature, the image preservation feature being a feature that does not need to be migrated. For example, the first semantic feature is a feature of a face-related semantic direction, such as gender, age, facial features, expression, etc.; and the image preservation feature is a background-related feature, such as lighting, architecture, and sky, etc.

[0099] 305. Obtain a migration feature, the migration feature being used to migrate the semantic feature in the first hidden space to a second hidden space of a target domain.

[0100] In the embodiment of the present application, the migration feature is directly obtained based on the migration feature determined in steps 301 to 303.

[0101] 306、based on the migration feature, migrating the first semantic feature to a second semantic feature, the second semantic feature being used to represent the semantic direction of the to-be-processed image in the second latent space of the target domain.

[0102] In the embodiment of the present application, the migration feature can be used to adjust the semantic direction of different image semantics. The server can match the source domain and the target domain based on the migration feature, that is, migrate the semantic direction of the to-be-processed image in the first latent space to the semantic direction in the second latent space.

[0103] In some embodiments, the server can multiply the migration feature and the first semantic feature to obtain the second semantic feature. The migration feature, the first semantic feature and the second semantic feature are all represented in the form of a feature matrix. See formula (1).

[0104] Z2=T·Z1 (1);

[0105] Wherein, Z2 represents the second semantic feature, T represents the migration feature, and Z1 represents the first semantic feature.

[0106] In some embodiments, the first semantic feature includes a plurality of first semantic elements, and different first semantic elements represent the semantic direction of different image semantics, such as age, skin color, gender, etc. The following explains the process of migrating the first semantic feature to the second semantic feature from the perspective of semantic elements: for any first semantic element in the first semantic feature, the server determines a migration element corresponding to the first semantic element from the migration feature, the first semantic element representing the semantic direction of any image semantics in the to-be-processed image; the server migrates the first semantic element based on the migration element to obtain a corresponding second semantic element in the second semantic feature.

[0107] In some embodiments, after obtaining the second semantic feature, the server can also fuse the second semantic feature with the unprocessed image preservation feature, such as splicing the second semantic feature with the image preservation feature to obtain a second image latent space feature, and the server generates a target image based on the second image latent space feature. It should be noted that the above fusion method is the inverse operation of the division method of the first image latent space feature, which is not limited in the embodiment of the present application.

[0108] 307、based on the second semantic feature, generating a target image, the target image having a style of the target domain.

[0109] In the embodiment of the present application, the server can obtain a second model pre-trained in the target field, and the server can input the second semantic feature into the second model, and the generator of the second model can generate a target image based on the second semantic feature, so as to realize the style migration of the to-be-processed image from the source field to the target field.

[0110] It should be noted that, in order to make the image processing method described in steps 301 to 306 more easily understood, refer to Figure 4 , Figure 4 is a schematic diagram of a technical framework provided by an embodiment of the present application. The source field is field a, and the target field is field b. The server inputs the to-be-processed image into the generator of the first model pre-trained in field a to obtain a first image hidden space feature. The server divides the first image hidden space feature into a first semantic feature and an image reservation feature. The server realizes the matching of the first hidden space and the second hidden space by using the migration feature determined in steps 301 to 303, that is, realizes the migration of the first semantic feature to the second semantic feature. The server fuses the second semantic feature and the image reservation feature to obtain a second image hidden space feature. The server inputs the second image hidden space feature into the generator of the second model pre-trained in field b to obtain a target image with the style of field b. It should be noted that, if the first semantic feature and the image reservation feature are fused and input into the generator of the generative adversarial model pre-trained in field a, an image with the style of field a can be obtained, and the higher the similarity between the image and the to-be-processed image, the higher the training degree of the first model pre-trained in field a.

[0111] The embodiment of the present application provides an image processing method, which maps a to-be-processed image to a first hidden space of a source field, so that the first semantic space feature obtained by mapping can be migrated based on a migration feature, the semantic direction of the to-be-processed image in the first hidden space is migrated to a second hidden space to obtain a second semantic feature, and a target image is generated, so that the image migration can be completed without using a large amount of data for training, time is saved, and the requirement for the computing power of the training platform is not high.

[0112] Figure 5 is a block diagram of an image processing device provided by an embodiment of the present application. The device is used to execute the steps in the image processing method described above, refer to Figure 5 , the device includes a mapping module 51, an obtaining module 52, a migration module 53, and an image generation module 54.

[0113] The mapping module 51 is configured to map a to-be-processed image to a first hidden space of a source field to obtain a first semantic feature, the to-be-processed image has the style of the source field, and the first semantic feature is used to represent the semantic direction of the to-be-processed image in the first hidden space.

[0114] The acquisition module 52 is configured to acquire a migration feature used for migrating the semantic feature in the first latent space to a second latent space of a target field, the migration feature being obtained based on matching a first model and a second model, the first model being an adversarial generation model pre-trained in the source field, and the second model being an adversarial generation model pre-trained in the target field.

[0115] The migration module 53 is configured to migrate the first semantic feature to a second semantic feature based on the migration feature, the second semantic feature being used to represent a semantic direction of the to-be-processed image in the second latent space.

[0116] The image generation module 54 is configured to generate a target image based on the second semantic feature, the target image having a style of the target field.

[0117] In some embodiments, the migration module 53 is configured to, for any first semantic element in the first semantic feature, determine a migration element corresponding to the first semantic element from the migration feature, the first semantic element representing a semantic direction of any image semantic in the to-be-processed image; and migrate the first semantic element based on the migration element to obtain a corresponding second semantic element in the second semantic feature.

[0118] In some embodiments, Figure 6 is a block diagram of another image processing apparatus provided by an embodiment of the present application, as shown in Figure 6 The apparatus further includes:

[0119] The first determination module 55 is configured to determine a plurality of first sample migration features based on a first model and a first sample image set used for training the first model, the plurality of first sample migration features corresponding to a plurality of first sample images in the first sample image set in a one-to-one manner.

[0120] The second determination module 56 is configured to determine a plurality of second sample migration features based on a second model and a second sample image set used for training the second model, the plurality of second sample migration features corresponding to a plurality of second sample images in the second sample image set in a one-to-one manner.

[0121] The third determination module 57 is configured to determine the migration feature based on the plurality of first sample migration features and the plurality of second sample migration features.

[0122] In some embodiments, the first determination module 55 includes:

[0123] The first acquisition sub-module 551 is configured to, for any first sample image in the first sample image set, acquire a first latent space feature of the first sample image in a first latent space of the first model.

[0124] The first dimension reduction submodule 552 is configured to perform dimension reduction on the first hidden space feature to obtain a first feature vector matrix.

[0125] The first determination submodule 553 is configured to determine, based on the first hidden space feature and the first feature vector matrix, a first sample transfer feature corresponding to the first sample image.

[0126] In some embodiments, the first dimension reduction submodule 552 includes:

[0127] The first acquisition unit 5521 is configured to acquire an average value of elements in the first hidden space feature.

[0128] The first determination unit 5522 is configured to determine, based on the average value, a plurality of first eigenvalues and a plurality of first eigenvectors of a first covariance matrix, the first eigenvalues corresponding to the first eigenvectors one by one.

[0129] The second determination unit 5523 is configured to determine, based on the plurality of first eigenvalues, a first feature vector matrix, a row vector in the first feature vector matrix being a first eigenvector corresponding to a first eigenvalue satisfying an ordering condition.

[0130] In some embodiments, the first determination unit 5522 is configured to determine, based on the average value, a covariance corresponding to elements in the first hidden space feature to obtain the first covariance matrix; and perform eigenvalue decomposition on the first covariance matrix to obtain the plurality of first eigenvalues and the plurality of first eigenvectors.

[0131] In some embodiments, the second determination unit 5523 is configured to order the plurality of first eigenvalues; select at least one first eigenvalue before a first target order from the ordered plurality of first eigenvalues; and obtain the first feature vector matrix by taking at least one first eigenvector corresponding to the at least one first eigenvalue as a row vector.

[0132] In some embodiments, the second determination module 56 includes:

[0133] The second acquisition submodule 561 is configured to, for any second sample image in the second sample image set, acquire a second hidden space feature of the second sample image in a second hidden space of the second model.

[0134] The second dimension reduction submodule 562 is configured to perform dimension reduction on the second hidden space feature to obtain a second feature vector matrix.

[0135] The second determination submodule 563 is configured to determine, based on the second hidden space feature and the second feature vector matrix, a second sample transfer feature corresponding to the second sample image.

[0136] In some embodiments, the second dimension reduction submodule 562 comprises:

[0137] The second acquisition unit 5621 acquires the average value of each element in the second latent space feature;

[0138] The third determination unit 5622 is configured to determine, based on the average value, a plurality of second eigenvalues of a second covariance matrix and a plurality of second eigenvectors, the second eigenvalues corresponding to the second eigenvectors one by one;

[0139] The fourth determination unit 5623 is configured to determine, based on the plurality of second eigenvalues, a second eigenvector matrix, the row vectors in the second eigenvector matrix being the second eigenvectors corresponding to the second eigenvalues satisfying an ordering condition.

[0140] In some embodiments, the third determination unit 5622 is configured to determine, based on the average value, the covariance corresponding to each element in the second latent space feature to obtain the second covariance matrix; and perform eigenvalue decomposition on the second covariance matrix to obtain the plurality of second eigenvalues and the plurality of second eigenvectors.

[0141] In some embodiments, the fourth determination unit 5623 is configured to sort the plurality of second eigenvalues; select at least one second eigenvalue before a second target order from the sorted plurality of second eigenvalues; and obtain the second eigenvector matrix by taking at least one second eigenvector corresponding to the at least one second eigenvalue as a row vector.

[0142] The embodiments of the present application provide an image processing apparatus. By mapping the image to be processed to a first latent space of a source field, the first semantic space feature obtained by mapping can be migrated based on the migration feature, the semantic direction of the image to be processed in the first latent space is migrated to the second latent space to obtain the second semantic feature, and the target image is generated. Therefore, the image migration can be completed without using a large amount of data for training, time is saved, and the computing power requirement of the training platform is not high.

[0143] It should be noted that the image processing apparatus provided in the above embodiments is only used as an example for illustrating the division of the above functional modules in image processing. In actual applications, the above functions can be completed by different functional modules according to needs, that is, the internal structure of the apparatus is divided into different functional modules to complete all or part of the above described functions. In addition, the image processing apparatus and the image processing method provided in the above embodiments belong to the same concept, and the specific implementation process is described in detail in the method embodiments, which will not be repeated here.

[0144] In the embodiments of the present application, the computer device can be configured as a terminal or a server. When the computer device is configured as a terminal, the technical solutions provided by the embodiments of the present application can be implemented by the terminal as an execution subject. When the computer device is configured as a server, the technical solutions provided by the embodiments of the present application can be implemented by the server as an execution subject. The technical solutions provided by the present application can also be implemented through the interaction between the terminal and the server, and the embodiments of the present application do not limit this.

[0145] When the computer device is configured as a terminal, Figure 7 is a structural block diagram of a terminal 700 provided by an embodiment of the present application. The terminal 700 can be a portable mobile terminal, such as a smart phone, a tablet computer, an MP3 (Moving Picture Experts Group Audio Layer III) player, an MP4 (Moving Picture Experts Group Audio Layer IV) player, a notebook computer or a desktop computer. The terminal 700 can also be referred to as a user equipment, a portable terminal, a laptop terminal, a desktop terminal, and other names.

[0146] Generally, the terminal 700 includes a processor 701 and a memory 702.

[0147] The processor 701 can include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 701 can be implemented in at least one of a hardware form of a DSP (Digital Signal Processing), an FPGA (Field-Programmable Gate Array), and a PLA (Programmable Logic Array). The processor 701 can also include a main processor and a coprocessor. The main processor is a processor for processing data in an awake state, also known as a CPU (Central Processing Unit). The coprocessor is a low-power processor for processing data in a standby state. In some embodiments, the processor 701 can be integrated with a GPU (Graphics Processing Unit) for rendering and drawing the content required to be displayed by the display screen. In some embodiments, the processor 701 can also include an AI (Artificial Intelligence) processor for processing machine learning-related computing operations.

[0148] The memory 702 can include one or more computer-readable storage media. The computer-readable storage media can be non-transitory. The memory 702 can also include high-speed random access memory and can include non-volatile memory, such as one or more magnetic disk storage devices, optical disk storage devices, flash memory devices, or other non-volatile memory storage devices. In some embodiments, the non-transitory computer-readable storage medium of the memory 702 is used to store at least one computer program for being executed by the processor 701 to implement the image processing method provided by the method embodiments of the present application.

[0149] In some embodiments, the terminal 700 can further optionally include a peripheral device interface 703 and at least one peripheral device. The processor 701, the memory 702, and the peripheral device interface 703 can be connected through a bus or a signal line. Each peripheral device can be connected to the peripheral device interface 703 through a bus, a signal line, or a circuit board. Specifically, the peripheral device includes at least one of a radio frequency circuit 704, a display screen 705, a camera assembly 706, an audio circuit 707, a positioning assembly 708, and a power supply 709.

[0150] The peripheral device interface 703 can be used to connect at least one peripheral device related to I / O (Input / Output) to the processor 701 and the memory 702. In some embodiments, the processor 701, the memory 702, and the peripheral device interface 703 are integrated on the same chip or circuit board; in some other embodiments, any one or two of the processor 701, the memory 702, and the peripheral device interface 703 can be implemented on a separate chip or circuit board, and the present embodiments are not limited in this regard.

[0151] The radio frequency circuit 704 is used to receive and transmit RF (Radio Frequency) signals, also known as electromagnetic signals. The radio frequency circuit 704 communicates with a communication network and other communication devices through electromagnetic signals. The radio frequency circuit 704 converts electrical signals into electromagnetic signals for transmission, or converts received electromagnetic signals into electrical signals. In some embodiments, the radio frequency circuit 704 includes an antenna system, an RF transceiver, one or more amplifiers, a tuner, an oscillator, a digital signal processor, a codec chipset, a subscriber identity module card, and the like. The radio frequency circuit 704 can communicate with other terminals through at least one wireless communication protocol. The wireless communication protocol includes but is not limited to the World Wide Web, a metropolitan area network, an intranet, various generations of mobile communication networks (2G, 3G, 4G, and 5G), a wireless local area network, and / or a WiFi (Wireless Fidelity) network. In some embodiments, the radio frequency circuit 704 can also include NFC (Near Field Communication) related circuitry, which is not limited by the present application.

[0152] The display screen 705 is configured to display a UI (User Interface). The UI can include graphics, text, icons, video, and any combination thereof. When the display screen 705 is a touch display screen, the display screen 705 is also capable of capturing touch signals on or above the surface of the display screen 705. The touch signals can be input to the processor 701 as control signals for processing. At this time, the display screen 705 can also be configured to provide virtual buttons and / or virtual keyboards, also known as soft buttons and / or soft keyboards. In some embodiments, the display screen 705 can be one, disposed on the front panel of the terminal 700; in other embodiments, the display screen 705 can be at least two, respectively disposed on different surfaces of the terminal 700 or in a folding design; in other embodiments, the display screen 705 can be a flexible display screen, disposed on a curved surface or a folding surface of the terminal 700. Even, the display screen 705 can also be disposed in an irregular shape other than a rectangle, i.e., a special-shaped screen. The display screen 705 can be made of materials such as LCD (Liquid Crystal Display) or OLED (Organic Light-Emitting Diode).

[0153] The camera assembly 706 is configured to capture images or videos. In some embodiments, the camera assembly 706 includes a front camera and a rear camera. Typically, the front camera is disposed on the front panel of the terminal, and the rear camera is disposed on the back of the terminal. In some embodiments, the rear camera is at least two, which are any one of a main camera, a depth-of-field camera, a wide-angle camera, and a telephoto camera, to realize the background blur function by fusing the main camera and the depth-of-field camera, the panoramic shooting and VR (Virtual Reality) shooting function by fusing the main camera and the wide-angle camera, or other fusion shooting functions. In some embodiments, the camera assembly 706 can also include a flash. The flash can be a single-color temperature flash or a dual-color temperature flash. The dual-color temperature flash refers to the combination of a warm light flash and a cold light flash, which can be used for light compensation under different color temperatures.

[0154] The audio circuit 707 can include a microphone and a speaker. The microphone is used to collect sound waves of a user and an environment, and convert the sound waves into an electrical signal input to the processor 701 for processing, or input to the radio frequency circuit 704 to realize voice communication. For the purpose of stereo sound collection or noise reduction, the microphone can be multiple, which are respectively arranged at different parts of the terminal 700. The microphone can also be an array microphone or an omnidirectional collection type microphone. The speaker is used to convert an electrical signal from the processor 701 or the radio frequency circuit 704 into sound waves. The speaker can be a conventional diaphragm speaker, or a piezoelectric ceramic speaker. When the speaker is a piezoelectric ceramic speaker, not only can the electrical signal be converted into a sound wave audible to humans, but also can be converted into a sound wave inaudible to humans for ranging purposes. In some embodiments, the audio circuit 707 can also include a headphone jack.

[0155] The positioning component 708 is used to position the current geographic location of the terminal 700 to realize navigation or LBS (Location Based Service). The positioning component 708 can be a positioning component based on the GPS (Global Positioning System) of the United States, the Beidou system of China or the Galileo system of Russia.

[0156] The power supply 709 is used to supply power to each component in the terminal 700. The power supply 709 can be alternating current, direct current, disposable battery or rechargeable battery. When the power supply 709 includes a rechargeable battery, the rechargeable battery can be a wired charging battery or a wireless charging battery. The wired charging battery is a battery charged through a wired line, and the wireless charging battery is a battery charged through a wireless coil. The rechargeable battery can also be used to support fast charging technology.

[0157] In some embodiments, the terminal 700 further includes one or more sensors 710. The one or more sensors 710 include but are not limited to an acceleration sensor 711, a gyroscope sensor 712, a pressure sensor 713, a fingerprint sensor 714, an optical sensor 715 and a proximity sensor 716.

[0158] The acceleration sensor 711 can detect the acceleration size in three coordinate axes of the coordinate system established by the terminal 700. For example, the acceleration sensor 711 can be used to detect the components of gravitational acceleration in three coordinate axes. The processor 701 can control the display screen 705 to display the user interface in a landscape view or a portrait view according to the gravitational acceleration signal collected by the acceleration sensor 711. The acceleration sensor 711 can also be used for game or user motion data collection.

[0159] The gyroscope sensor 712 can detect the body direction and rotation angle of the terminal 700, and can collect 3D motions of the user on the terminal 700 in cooperation with the acceleration sensor 711. The processor 701 can implement the following functions according to the data collected by the gyroscope sensor 712: motion sensing (e.g., changing a UI according to a tilt operation of the user), image stabilization during shooting, game control, and inertial navigation.

[0160] The pressure sensor 713 can be disposed on the side frame of the terminal 700 and / or the lower layer of the display screen 705. When the pressure sensor 713 is disposed on the side frame of the terminal 700, the grip signal of the user on the terminal 700 can be detected, and the left-hand / right-hand recognition or shortcut operation can be performed by the processor 701 according to the grip signal collected by the pressure sensor 713. When the pressure sensor 713 is disposed on the lower layer of the display screen 705, the operable control on the UI interface can be controlled by the processor 701 according to the pressure operation of the user on the display screen 705. The operable control includes at least one of a button control, a scroll bar control, an icon control, and a menu control.

[0161] The fingerprint sensor 714 is used to collect the fingerprint of the user, and the identity of the user can be recognized by the processor 701 according to the fingerprint collected by the fingerprint sensor 714, or by the fingerprint sensor 714 according to the collected fingerprint. When the identity of the user is recognized as a trusted identity, the processor 701 authorizes the user to perform a related sensitive operation, which includes unlocking the screen, viewing encrypted information, downloading software, payment, and changing settings, etc. The fingerprint sensor 714 can be disposed on the front, back, or side of the terminal 700. When the terminal 700 is provided with a physical button or a manufacturer's logo, the fingerprint sensor 714 can be integrated with the physical button or the manufacturer's logo.

[0162] The optical sensor 715 is used to collect the ambient light intensity. In one embodiment, the processor 701 can control the display brightness of the display screen 705 according to the ambient light intensity collected by the optical sensor 715. Specifically, when the ambient light intensity is high, the display brightness of the display screen 705 is increased; when the ambient light intensity is low, the display brightness of the display screen 705 is decreased. In another embodiment, the processor 701 can also dynamically adjust the shooting parameters of the camera assembly 706 according to the ambient light intensity collected by the optical sensor 715.

[0163] The proximity sensor 716, also called a distance sensor, is usually arranged on the front panel of the terminal 700. The proximity sensor 716 is used to collect the distance between the user and the front of the terminal 700. In one embodiment, when the proximity sensor 716 detects that the distance between the user and the front of the terminal 700 gradually decreases, the display screen 705 is switched from the bright screen state to the screen-off state under the control of the processor 701; when the proximity sensor 716 detects that the distance between the user and the front of the terminal 700 gradually increases, the display screen 705 is switched from the screen-off state to the bright screen state under the control of the processor 701.

[0164] Those skilled in the art can understand that the structure shown in the figure does not constitute a limitation on the terminal 700, and can include more or fewer components than the figure, or combine certain components, or adopt a different component arrangement. Figure 7 Those skilled in the art can understand that the structure shown in the figure does not constitute a limitation on the terminal 700, and can include more or fewer components than the figure, or combine certain components, or adopt a different component arrangement.

[0165] When the computer device is configured as a server, Figure 8 FIG. 8 is a structural schematic diagram of a server according to an embodiment of the present application. The server 800 can have a large difference due to different configurations or performances, and can include one or more processors (Central Processing Units, CPUs) 801 and one or more memories 802, wherein the memory 802 stores at least one computer program, the at least one computer program is loaded and executed by the processor 801 to realize the image processing method provided by each method embodiment. Of course, the server can also have a wired or wireless network interface, a keyboard, and an input and output interface, and other components for realizing the functions of the device, which are not described here.

[0166] The embodiment of the present application further provides a computer readable storage medium, and the computer readable storage medium stores at least one computer program, the at least one computer program is loaded and executed by the processor of the computer device to realize the operation of the computer device in the image processing method of the above embodiment. For example, the computer readable storage medium can be a read-only memory (Read-Only Memory, ROM), a random access memory (Random Access Memory, RAM), a compact disc read-only memory (Compact Disc Read-Only Memory, CD-ROM), a magnetic tape, a floppy disk and an optical data storage device, etc.

[0167] In some embodiments, the computer program related to the embodiments of the present application can be deployed on one computer device to execute, or on multiple computer devices located in one place to execute, or on multiple computer devices distributed in multiple places and interconnected through a communication network to execute. The multiple computer devices distributed in multiple places and interconnected through a communication network can constitute a blockchain system.

[0168] The embodiments of the present application further provide a computer program product, which comprises computer program code stored in a computer readable storage medium. A processor of a computer device reads the computer program code from the computer readable storage medium, and the processor executes the computer program code, so that the computer device executes the image processing method provided in various optional implementation manners described above.

[0169] Those of ordinary skill in the art can understand that all or part of the steps of the above-mentioned embodiments can be completed by hardware, or can be instructed by a program to complete the related hardware, and the program can be stored in a computer readable storage medium. The storage medium mentioned above can be a read-only memory, a magnetic disk or an optical disk, etc.

[0170] The above only describes the optional embodiments of the present application, and is not intended to limit the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims

1. An image processing method, characterized by, The method comprises: mapping a to-be-processed image to a first latent space of a source domain to obtain a first semantic feature, the to-be-processed image having a style of the source domain, the first semantic feature being used to represent a semantic direction of the to-be-processed image in the first latent space; obtaining a migration feature, the migration feature being used to migrate the semantic feature in the first latent space to a second latent space of a target domain, the migration feature being obtained based on matching a first model and a second model, the first model being an adversarial generation model pre-trained in the source domain, and the second model being an adversarial generation model pre-trained in the target domain; migrating the first semantic feature to a second semantic feature based on the migration feature, the second semantic feature being used to represent a semantic direction of the to-be-processed image in the second latent space; generating a target image based on the second semantic feature, the target image having a style of the target domain.

2. The method of claim 1, wherein, The migrating the first semantic feature to a second semantic feature based on the migration feature comprises: for any first semantic element in the first semantic feature, determining a migration element corresponding to the first semantic element from the migration feature, the first semantic element representing a semantic direction of any image semantics in the to-be-processed image; migrating the first semantic element based on the migration element to obtain a corresponding second semantic element in the second semantic feature.

3. The method of claim 1, wherein, The method further comprises: determining a plurality of first sample migration features based on the first model and a first sample image set used to train the first model, the plurality of first sample migration features corresponding to a plurality of first sample images in the first sample image set in a one-to-one manner; determining a plurality of second sample migration features based on the second model and a second sample image set used to train the second model, the plurality of second sample migration features corresponding to a plurality of second sample images in the second sample image set in a one-to-one manner; determining the migration feature based on the plurality of first sample migration features and the plurality of second sample migration features.

4. The method of claim 3, wherein, The determining a plurality of first sample migration features based on the first model and a first sample image set used to train the first model comprises: for any first sample image in the first sample image set, obtaining a first latent space feature of the first sample image in a first latent space of the first model; performing dimension reduction on the first latent space feature to obtain a first feature vector matrix; determining a first sample migration feature corresponding to the first sample image based on the first latent space feature and the first feature vector matrix.

5. The method of claim 4, wherein, The performing dimension reduction on the first latent space feature to obtain a first feature vector matrix comprises: obtaining an average value of each element in the first latent space feature; determining a plurality of first eigenvalues and a plurality of first eigenvectors of a first covariance matrix based on the average value, the first eigenvalues corresponding to the first eigenvectors in a one-to-one manner; determining a first feature vector matrix based on the plurality of first eigenvalues, a row vector in the first feature vector matrix being a first eigenvector corresponding to a first eigenvalue satisfying an ordering condition.

6. The method of claim 5, wherein, The determining, based on the average value, of a plurality of first eigenvalues and a plurality of first eigenvectors of a first covariance matrix comprises: The determining, based on the average value, of a plurality of first eigenvalues and a plurality of first eigenvectors of a first covariance matrix comprises: The determining, based on the plurality of first eigenvalues, of a first eigenvector matrix comprises:

7. The method of claim 5, wherein, The determining, based on the plurality of first eigenvalues, of a first eigenvector matrix comprises: The determining, based on the plurality of first eigenvalues, of a first eigenvector matrix comprises: The determining, based on the second model and a second sample image set used for training the second model, of a plurality of second sample transfer features comprises: For any second sample image in the second sample image set, a second hidden space feature of the second sample image in a second hidden space of the second model is obtained.

8. The method of claim 3, wherein, The dimensionality reduction of the second hidden space feature to obtain a second eigenvector matrix comprises: The dimensionality reduction of the second hidden space feature to obtain a second eigenvector matrix comprises: The dimensionality reduction of the second hidden space feature to obtain a second eigenvector matrix comprises: The dimensionality reduction of the second hidden space feature to obtain a second eigenvector matrix comprises:

9. The method of claim 8, wherein, The dimensionality reduction of the second hidden space feature to obtain a second eigenvector matrix comprises: The dimensionality reduction of the second hidden space feature to obtain a second eigenvector matrix comprises: The dimensionality reduction of the second hidden space feature to obtain a second eigenvector matrix comprises: The dimensionality reduction of the second hidden space feature to obtain a second eigenvector matrix comprises:

10. The method of claim 9, wherein, The dimensionality reduction of the second hidden space feature to obtain a second eigenvector matrix comprises: The dimensionality reduction of the second hidden space feature to obtain a second eigenvector matrix comprises: The dimensionality reduction of the second hidden space feature to obtain a second eigenvector matrix comprises:

11. The method of claim 9, wherein, The dimensionality reduction of the second hidden space feature to obtain a second eigenvector matrix comprises: The dimensionality reduction of the second hidden space feature to obtain a second eigenvector matrix comprises: The dimensionality reduction of the second hidden space feature to obtain a second eigenvector matrix comprises: The dimensionality reduction of the second hidden space feature to obtain a second eigenvector matrix comprises:

12. An image processing apparatus characterized by comprising: The dimensionality reduction of the second hidden space feature to obtain a second eigenvector matrix comprises: The dimensionality reduction of the second hidden space feature to obtain a second eigenvector matrix comprises: The dimensionality reduction of the second hidden space feature to obtain a second eigenvector matrix comprises: The dimensionality reduction of the second hidden space feature to obtain a second eigenvector matrix comprises: The dimensionality reduction of the second hidden space feature to obtain a second eigenvector matrix comprises: The dimensionality reduction of the second hidden space feature to obtain a second eigenvector matrix comprises: The dimensionality reduction of the second hidden space feature to obtain a second eigenvector matrix comprises: The dimensionality reduction of the second hidden space feature to obtain a second eigenvector matrix comprises: The dimensionality reduction of the second hidden space feature to obtain a second eigenvector matrix comprises: The dimensionality reduction of the second hidden space feature to obtain a second eigenvector matrix comprises: The dimensionality reduction of the second hidden space feature to obtain a second eigenvector matrix comprises: The dimensionality reduction of the second hidden space feature to obtain a second eigenvector matrix comprises: The dimensionality reduction of the second hidden space feature to obtain a second eigenvector matrix comprises: The dimensionality reduction of the second hidden space feature to obtain a second eigenvector matrix comprises: The dimensionality reduction of the second hidden space feature to obtain a second eigenvector matrix comprises: The dimensionality reduction of the second hidden space feature to obtain a second eigenvector matrix comprises: The dimensionality reduction of the second hidden space feature to obtain a second eigenvector matrix comprises: The dimensionality reduction of the second hidden space feature to obtain a second eigenvector matrix comprises: The dimensionality reduction of the second hidden space feature to obtain a second eigenvector matrix comprises: The dimensionality reduction of the second hidden space feature to obtain a second eigenvector matrix comprises: The dimensionality reduction of the second hidden space feature to obtain a second eigenvector matrix comprises: The dimensionality reduction of the second hidden space feature to obtain a second eigenvector matrix comprises: The dimensionality reduction of the second hidden space feature to obtain a second eigenvector matrix comprises: The dimensionality reduction of the second hidden space feature to obtain a second eigenvector matrix comprises: The dimensionality reduction of the second hidden space feature to obtain a second eigenvector matrix comprises: The dimensionality reduction of the second hidden space feature to obtain a second eigenvector matrix comprises: The dimensionality reduction of the second hidden space feature to obtain a second eigenvector matrix comprises: The dimensionality reduction of the second hidden space feature to obtain a second eigenvector matrix comprises: The dimensionality reduction of the second hidden space feature to obtain a second eigenvector matrix comprises: The dimensionality reduction of the second hidden space feature to obtain a second eigenvector matrix comprises: The dimensionality reduction of the second hidden space feature to obtain a second eigenvector matrix comprises: The dimensionality reduction of the second hidden space feature to obtain a second eigenvector matrix comprises: The dimensionality reduction of the second hidden space feature to obtain a second eigenvector matrix comprises: The dimensionality reduction of the second hidden space feature to obtain a second eigenvector matrix comprises: The dimensionality reduction of the second hidden space feature to obtain a second eigenvector matrix comprises: The dimensionality reduction of the second hidden space feature to obtain a second eigenvector matrix comprises: The dimensionality reduction of the second hidden space feature to obtain a second eigenvector matrix comprises: The dimensionality reduction of the second hidden space feature to obtain a second eigenvector matrix comprises: The dimensionality reduction of the second hidden space feature to obtain a second eigenvector matrix comprises: The dimensionality reduction of the second hidden space feature to obtain a second eigenvector matrix comprises: The dimensionality reduction of the second hidden space feature to obtain a second eigenvector matrix comprises: The dimensionality reduction of the second hidden space feature to obtain a second eigenvector matrix comprises: The dimensionality reduction of the second hidden space feature to obtain a second eigenvector matrix comprises: The dimensionality reduction of the second hidden space feature to obtain a second eigenvector matrix comprises: The dimensionality reduction of the second hidden space feature to obtain a second eigenvector matrix comprises: The dimensionality reduction of the second hidden space feature to obtain a second eigenvector matrix comprises: The dimensionality reduction of the second hidden space feature to obtain a second eigenvector matrix comprises: The dimensionality reduction of the second hidden space feature to obtain a second eigenvector matrix comprises: The dimensionality reduction of the second hidden space feature to obtain a second eigenvector matrix comprises: The dimensionality reduction of the second hidden space feature to obtain a second eigenvector matrix comprises: The dimensionality reduction of the second hidden space feature to obtain a second eigenvector matrix comprises: The dimensionality reduction of the second hidden space feature to obtain a second eigenvector matrix comprises: The dimensionality reduction of the second hidden space feature to obtain a second eigenvector matrix comprises: The dimensionality reduction of the second hidden space feature to obtain a second eigenvector matrix comprises: The dimensionality reduction of the second hidden space feature to obtain a second eigenvector matrix comprises: The dimensionality reduction of the second hidden space feature to obtain a second eigenvector matrix comprises: The dimensionality reduction of the second hidden space feature to obtain a second eigenvector matrix comprises: The dimensionality reduction of the second hidden space feature to obtain a second eigenvector matrix comprises: The dimensionality reduction of the second hidden space feature to obtain a second eigenvector matrix comprises: The dimensionality reduction of the second hidden space feature to obtain a second eigenvector matrix comprises: The dimensionality reduction of the second hidden space feature to obtain a second eigenvector matrix comprises: The dimensionality reduction of the second hidden space feature to obtain a second eigenvector matrix comprises: The dimensionality reduction of the second hidden space feature to obtain a second eigenvector matrix comprises: The dimensionality reduction of the second hidden space feature to obtain a second eigenvector matrix comprises: The dimensionality reduction of the second hidden space feature to obtain a second eigenvector matrix comprises: The dimensionality reduction of the second hidden space feature to obtain a second eigenvector matrix comprises: The dimensionality reduction of the second hidden space feature to obtain a second eigenvector matrix comprises: The dimensionality reduction of the second hidden space feature to obtain a second eigenvector matrix comprises: The dimensionality reduction of the second hidden space feature to obtain a second eigenvector matrix comprises: The dimensionality reduction of the second hidden space feature to obtain a second eigenvector matrix comprises: The dimensionality reduction of the second hidden space feature to obtain a second eigenvector matrix comprises: The dimensionality reduction of the second hidden space feature to obtain a second eigenvector matrix comprises: The dimensionality reduction of the second hidden space feature to obtain a second eigenvector matrix comprises: The dimensionality reduction of the second hidden space feature to obtain a second eigenvector matrix comprises: The dimensionality reduction of the second hidden space feature to obtain a second eigenvector matrix comprises: The dimensionality reduction of the second hidden space feature to obtain a second eigenvector matrix comprises: The dimensionality reduction of the second hidden space feature to obtain a second eigenvector matrix comprises: The dimensionality reduction of the second hidden space feature to obtain a second eigenvector matrix An acquisition module is configured to acquire a migration feature, the migration feature being used to migrate a semantic feature in the first latent space into a second latent space of a target field, the migration feature being obtained based on matching a first model and a second model, the first model being an adversarial generation model pre-trained in the source field, and the second model being an adversarial generation model pre-trained in the target field; A migration module is configured to migrate the first semantic feature into a second semantic feature based on the migration feature, the second semantic feature being used to represent a semantic direction of the to-be-processed image in the second latent space; An image generation module is configured to generate a target image based on the second semantic feature, the target image having a style of the target field.

13. A computer device, comprising: The computer device comprises a processor and a memory, the memory being configured to store at least one piece of computer program, the at least one piece of computer program being loaded and executed by the processor to execute the image processing method according to any one of claims 1 to 11.

14. A computer-readable storage medium, characterized in that, The computer readable storage medium is configured to store at least one piece of computer program, the at least one piece of computer program being used to execute the image processing method according to any one of claims 1 to 11.

15. A computer program product, characterised in that, The computer program product comprises computer program code stored in the computer readable storage medium, the computer program code being read by the processor of the computer device from the computer readable storage medium, and the processor executes the computer program code, so that the computer device executes the image processing method according to any one of claims 1 to 11.

Citation Information

Patent Citations

  • Multi-domain image style migration method based on generative adversarial network

    CN110310221A

  • Image generation method and device and computer storage medium

    CN110728319A